diff options
80 files changed, 2203 insertions, 2256 deletions
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index 7a6ce50aae..66e0e89785 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -42,13 +42,13 @@ PLUGININFOEX pluginInfo = { {0xb68a8906, 0x748b, 0x435d, {0x93, 0xe, 0x21, 0xcc, 0x6e, 0x8f, 0x3b, 0x3f}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
g_hInstance = hinstDLL;
return TRUE;
}
-extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
@@ -82,7 +82,7 @@ static VOID NTAPI ShowContactMenu(ULONG_PTR wParam) }
-void Popup_DoAction(HWND hWnd, BYTE Action, PLUGIN_DATA *pdata)
+void Popup_DoAction(HWND hWnd, BYTE Action, PLUGIN_DATA*)
{
MCONTACT hContact = (MCONTACT)CallService(MS_POPUP_GETCONTACT, (WPARAM)hWnd, 0);
switch (Action) {
@@ -266,13 +266,13 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0;
}
-static INT_PTR srvTogglePopups(WPARAM wParam, LPARAM lParam)
+static INT_PTR srvTogglePopups(WPARAM, LPARAM)
{
g_PopupOptPage.SetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY, !g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY));
return 0;
}
-static int PrebuildMainMenu(WPARAM wParam, LPARAM lParam)
+static int PrebuildMainMenu(WPARAM, LPARAM)
{
// we have to use ME_CLIST_PREBUILDMAINMENU instead of updating menu items only on settings change, because "popup_enabled" and "popup_disabled" icons are not always available yet in ModulesLoaded
if (bPopupExists) {
@@ -284,7 +284,7 @@ static int PrebuildMainMenu(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR CALLBACK CCNErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK CCNErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM)
{
switch (uMsg) {
case WM_INITDIALOG:
@@ -304,7 +304,7 @@ INT_PTR CALLBACK CCNErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM return 0;
}
-static int ModuleLoad(WPARAM wParam, LPARAM lParam)
+static int ModuleLoad(WPARAM, LPARAM)
{
bPopupExists = ServiceExists(MS_POPUP_ADDPOPUPT);
bFingerprintExists = ServiceExists(MS_FP_SAMECLIENTST) && ServiceExists(MS_FP_GETCLIENTICONT);
@@ -312,7 +312,7 @@ static int ModuleLoad(WPARAM wParam, LPARAM lParam) return 0;
}
-int MirandaLoaded(WPARAM wParam, LPARAM lParam)
+int MirandaLoaded(WPARAM, LPARAM)
{
ModuleLoad(0, 0);
COptPage PopupOptPage(g_PopupOptPage);
diff --git a/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp b/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp index 1d703be59e..f83c9265b3 100644 --- a/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp +++ b/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp @@ -147,7 +147,7 @@ COptPage& COptPage::operator = (const COptPage& Page) }
-int COptItem::GetIntDBVal(CString &sModule, int bSigned, CString *sDBSettingPrefix)
+int COptItem::GetIntDBVal(CString &sModule, int bSigned, CString*)
{ // default procedure for reading value from DB; used only for integral types
if (sDBSetting != NULL)
{
@@ -161,7 +161,7 @@ int COptItem::GetIntDBVal(CString &sModule, int bSigned, CString *sDBSettingPref return GetDefValue();
}
-void COptItem::SetIntDBVal(CString &sModule, int Value, CString *sDBSettingPrefix)
+void COptItem::SetIntDBVal(CString &sModule, int Value, CString*)
{ // default procedure for writing value to the DB; used only for integral types
if (sDBSetting != NULL && !ReadOnly)
{
diff --git a/plugins/ClientChangeNotify/src/CommonLibs/Options.h b/plugins/ClientChangeNotify/src/CommonLibs/Options.h index 07ed3dca28..5d429b8a8a 100644 --- a/plugins/ClientChangeNotify/src/CommonLibs/Options.h +++ b/plugins/ClientChangeNotify/src/CommonLibs/Options.h @@ -33,20 +33,18 @@ public: COptItem() {}
COptItem(int DlgItemID, char *szDBSetting, int nValueSize, int lParam = 0, bool ReadOnly = false):
DlgItemID(DlgItemID), nValueSize(nValueSize), sDBSetting(szDBSetting), lParam(lParam), Enabled(true), ReadOnly(ReadOnly), Modified(false) {}
-/* COptItem(const COptItem &Item): DlgItemID(Item.DlgItemID), nValueSize(Item.nValueSize),
- sDBSetting(Item.szDBSetting), lParam(Item.lParam), Enabled(Item.Enabled) {};*/
virtual ~COptItem() {}
- virtual void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Modified = false;}
- virtual void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {Modified = false;}
- virtual void WndToMem(HWND hWnd) {}
+ virtual void DBToMem(CString&, CString* = NULL) { Modified = false; }
+ virtual void MemToDB(CString&, CString* = NULL) { Modified = false; }
+ virtual void WndToMem(HWND) {}
virtual void MemToWnd(HWND hWnd) {EnableWindow(GetDlgItem(hWnd, DlgItemID), Enabled);}
void DBToMemToWnd(CString &sModule, HWND hWnd, CString *sDBSettingPrefix = NULL) {DBToMem(sModule, sDBSettingPrefix); MemToWnd(hWnd);}
void WndToMemToDB(HWND hWnd, CString &sModule, CString *sDBSettingPrefix = NULL) {WndToMem(hWnd); MemToDB(sModule, sDBSettingPrefix);}
virtual void CleanDBSettings(CString &sModule, CString *sDBSettingPrefix = NULL) {db_unset(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting);}; // TODO: also set Value to DefValue?
- virtual void SetValue(int Value) {Modified = true;}
- virtual void SetDefValue(int DefValue) {}
+ virtual void SetValue(int) {Modified = true;}
+ virtual void SetDefValue(int) {}
virtual int GetValue() {return 0;}
virtual int GetDefValue() {return 0;}
int GetDBValue(CString &sModule, CString *sDBSettingPrefix = NULL) {DBToMem(sModule, sDBSettingPrefix); return GetValue();}
diff --git a/plugins/ClientChangeNotify/src/OptDlg.cpp b/plugins/ClientChangeNotify/src/OptDlg.cpp index 1d08a2851d..6d9d4f5e8f 100644 --- a/plugins/ClientChangeNotify/src/OptDlg.cpp +++ b/plugins/ClientChangeNotify/src/OptDlg.cpp @@ -166,7 +166,7 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara return 0;
}
-int OptionsDlgInit(WPARAM wParam, LPARAM lParam)
+int OptionsDlgInit(WPARAM wParam, LPARAM)
{
if (bPopupExists) {
OPTIONSDIALOGPAGE optDi = { sizeof(optDi) };
diff --git a/plugins/Cln_skinedit/src/main.cpp b/plugins/Cln_skinedit/src/main.cpp index f52dc0814b..2ac20830a2 100644 --- a/plugins/Cln_skinedit/src/main.cpp +++ b/plugins/Cln_skinedit/src/main.cpp @@ -366,14 +366,6 @@ static void SetChangedStatusItemFlag(WPARAM wParam, HWND hwndDlg) } } -static BOOL isValidItem(void) -{ - if (StatusItems[LastModifiedItem]->statusID == ID_EXTBKSEPARATOR) - return FALSE; - - return TRUE; -} - // updates the struct with the changed dlg item static void UpdateStatusStructSettingsFromOptDlg(HWND hwndDlg, int index) { @@ -858,12 +850,7 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa * unimplemented */ -static BOOL CALLBACK SkinEdit_ImageItemEditProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - return FALSE; -} - -static INT_PTR SkinEdit_FillByCurrentSel(WPARAM wParam, LPARAM lParam) +static INT_PTR SkinEdit_FillByCurrentSel(WPARAM wParam, LPARAM) { if (wParam) FillOptionDialogByCurrentSel((HWND)wParam); @@ -876,7 +863,7 @@ static INT_PTR SkinEdit_FillByCurrentSel(WPARAM wParam, LPARAM lParam) * expects a SKINDESCRIPTON * in lParam */ -static INT_PTR SkinEdit_Invoke(WPARAM wParam, LPARAM lParam) +static INT_PTR SkinEdit_Invoke(WPARAM, LPARAM lParam) { SKINDESCRIPTION *psd = (SKINDESCRIPTION *)lParam; TCITEM tci = {0}; @@ -917,19 +904,13 @@ static int LoadModule() return 0; } -extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD) { return &pluginInfo; } -static int ModulesLoaded(WPARAM wParam, LPARAM lParam) -{ - return 0; -} - -static int systemModulesLoaded(WPARAM wParam, LPARAM lParam) +static int ModulesLoaded(WPARAM, LPARAM) { - ModulesLoaded(wParam, lParam); return 0; } @@ -939,7 +920,7 @@ extern "C" int __declspec(dllexport) Load(void) return(LoadModule()); } -static int ShutdownProc(WPARAM wParam, LPARAM lParam) +static int ShutdownProc(WPARAM, LPARAM) { if (hSvc_invoke) DestroyServiceFunction(hSvc_invoke); @@ -953,7 +934,7 @@ extern "C" int __declspec(dllexport) Unload(void) return ShutdownProc(0, 0); } -BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved) +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD, LPVOID) { g_hInst = hInstDLL; DisableThreadLibraryCalls(g_hInst); diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index b474684de4..cfe09ffcb7 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -64,9 +64,7 @@ void exportModule(MCONTACT hContact, const char *module, FILE *file) setting = settinglist.first;
while (setting) {
DBVARIANT dbv;
-
if (!db_get_s(hContact, module, setting->name, &dbv, 0)) {
-
switch (dbv.type) {
case DBVT_BYTE:
fprintf(file, "\n%s=b%s", setting->name, _ultoa(dbv.bVal, tmp, 10));
@@ -78,15 +76,11 @@ void exportModule(MCONTACT hContact, const char *module, FILE *file) fprintf(file, "\n%s=d%s", setting->name, _ultoa(dbv.dVal, tmp, 10));
break;
case DBVT_BLOB:
- {
- ptrA data(StringFromBlob(dbv.pbVal, dbv.cpbVal));
- fprintf(file, "\n%s=n%s", setting->name, data);
+ fprintf(file, "\n%s=n%s", setting->name, ptrA(StringFromBlob(dbv.pbVal, dbv.cpbVal)));
break;
- }
case DBVT_WCHAR:
case DBVT_ASCIIZ:
case DBVT_UTF8:
- {
char *str = (dbv.type == DBVT_WCHAR) ? mir_utf8encodeW(dbv.pwszVal) : dbv.pszVal;
if (strchr(str, '\r')) {
@@ -95,15 +89,15 @@ void exportModule(MCONTACT hContact, const char *module, FILE *file) end.Replace("\r", "\\r");
end.Replace("\n", "\\n");
fprintf(file, "\n%s=g%s", setting->name, end.c_str());
- } else {
+ }
+ else {
fprintf(file, "\n%s=%c", setting->name, (dbv.type == DBVT_ASCIIZ) ? 's' : 'u');
fputs(str, file);
}
- if (str != dbv.pszVal)
+ if (str != dbv.pszVal)
mir_free(str);
break;
}
- } // switch
db_free(&dbv);
}
setting = (ModSetLinkLinkItem *)setting->next;
diff --git a/plugins/FTPFileYM/src/deletetimer.cpp b/plugins/FTPFileYM/src/deletetimer.cpp index 1ff72c620e..f177ac081e 100644 --- a/plugins/FTPFileYM/src/deletetimer.cpp +++ b/plugins/FTPFileYM/src/deletetimer.cpp @@ -51,7 +51,7 @@ void DeleteTimer::stop() }
}
-void CALLBACK DeleteTimer::AutoDeleteTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
+void CALLBACK DeleteTimer::AutoDeleteTimerProc(HWND, UINT, UINT_PTR, DWORD)
{
mir_cslock lock(DBEntry::mutexDB);
diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index 302a5750dc..b76d70f601 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -55,13 +55,13 @@ static PLUGININFOEX pluginInfoEx = //------------ BASIC STAFF ------------//
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
hInst = hinstDLL;
return TRUE;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
@@ -199,7 +199,7 @@ void InitTabsrmmButton() //------------ MENU & BUTTON HANDLERS ------------//
-int PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
+int PrebuildContactMenu(WPARAM wParam, LPARAM)
{
bool bIsContact = false;
@@ -333,7 +333,7 @@ int UploadFile(MCONTACT hContact, int iFtpNum, GenericJob::EMode mode) //------------ MIRANDA SERVICES ------------//
-INT_PTR UploadService(WPARAM wParam, LPARAM lParam)
+INT_PTR UploadService(WPARAM, LPARAM lParam)
{
FTPUPLOAD* ftpu = (FTPUPLOAD *)lParam;
if (ftpu == NULL || ftpu->cbSize != sizeof(FTPUPLOAD))
@@ -346,7 +346,7 @@ INT_PTR UploadService(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR ShowManagerService(WPARAM wParam, LPARAM lParam)
+INT_PTR ShowManagerService(WPARAM, LPARAM)
{
manDlg = Manager::getInstance();
manDlg->init();
@@ -360,7 +360,7 @@ INT_PTR ContactMenuService(WPARAM hContact, LPARAM lParam) return UploadFile(hContact, ftpNum, (UploadJob::EMode)mode);
}
-INT_PTR MainMenuService(WPARAM wParam, LPARAM lParam)
+INT_PTR MainMenuService(WPARAM wParam, LPARAM)
{
int ftpNum = wParam & (1|2|4);
int mode = wParam & (UploadJob::FTP_RAWFILE | UploadJob::FTP_ZIPFILE | UploadJob::FTP_ZIPFOLDER);
@@ -382,7 +382,7 @@ int ModulesLoaded(WPARAM, LPARAM) return 0;
}
-int Shutdown(WPARAM wParam, LPARAM lParam)
+int Shutdown(WPARAM, LPARAM)
{
deleteTimer.deinit();
diff --git a/plugins/FTPFileYM/src/job_packer.cpp b/plugins/FTPFileYM/src/job_packer.cpp index 47a74c6feb..2d018f7639 100644 --- a/plugins/FTPFileYM/src/job_packer.cpp +++ b/plugins/FTPFileYM/src/job_packer.cpp @@ -228,7 +228,7 @@ Cleanup: return result;
}
-uLong PackerJob::getFileTime(TCHAR *file, tm_zip *tmzip, uLong *dt)
+uLong PackerJob::getFileTime(TCHAR *file, tm_zip*, uLong *dt)
{
FILETIME ftLocal;
HANDLE hFind;
diff --git a/plugins/FTPFileYM/src/options.cpp b/plugins/FTPFileYM/src/options.cpp index d14684ea02..fa29f361ba 100644 --- a/plugins/FTPFileYM/src/options.cpp +++ b/plugins/FTPFileYM/src/options.cpp @@ -244,7 +244,7 @@ INT_PTR CALLBACK Options::DlgProcOptsAdvanced(HWND hwndDlg, UINT msg, WPARAM wPa return FALSE;
}
-int Options::InitOptions(WPARAM wParam, LPARAM lParam)
+int Options::InitOptions(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 100000000;
diff --git a/plugins/HistoryLinkListPlus/src/linklist.cpp b/plugins/HistoryLinkListPlus/src/linklist.cpp index fa00543f4c..cc18a043a3 100644 --- a/plugins/HistoryLinkListPlus/src/linklist.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist.cpp @@ -39,7 +39,7 @@ PLUGININFOEX pluginInfo = { {0xDA0B09F5, 0x9C66, 0x488C, {0xAE, 0x37, 0x8A, 0x5F, 0x19, 0x1C, 0x90, 0x79}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
hInst = hinstDLL;
return TRUE;
@@ -87,7 +87,7 @@ extern "C" __declspec(dllexport) int Load(void) return 0;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 09b860078c..57e54e5f89 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -205,7 +205,7 @@ void ShutdownAction(void) SweepHistoryFromContact(hContact, Criteria, TRUE); // sweep contact history, keepunread==1
}
-int OnWindowEvent(WPARAM wParam, LPARAM lParam)
+int OnWindowEvent(WPARAM, LPARAM lParam)
{
MessageWindowEventData* msgEvData = (MessageWindowEventData*)lParam;
switch (msgEvData->uType) {
diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index 79436b8212..990f957d9c 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -42,7 +42,7 @@ static PLUGININFOEX pluginInfoEx = { 0x1d9bf74a, 0x44a8, 0x4b3f, { 0xa6, 0xe5, 0x73, 0x6, 0x9d, 0x3a, 0x89, 0x79 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
hInst = hinstDLL;
return TRUE;
@@ -71,7 +71,7 @@ int OnIconPressed(WPARAM hContact, LPARAM lParam) return 0;
}
-int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
+int OnModulesLoaded(WPARAM, LPARAM)
{
int sweep = db_get_b(NULL, ModuleName, "SweepHistory", 0);
@@ -114,7 +114,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) return 0;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index b1196b68b0..ebbcb9a86d 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -190,7 +190,7 @@ void SaveSettings(HWND hwndDlg) Srmm_ModifyIcon(NULL, &sid);
}
-INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
@@ -270,7 +270,7 @@ INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa return FALSE;
}
-int HSOptInitialise(WPARAM wParam, LPARAM lParam)
+int HSOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
diff --git a/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp b/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp index f7af3c9ccc..677cb1ff89 100644 --- a/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp +++ b/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp @@ -67,7 +67,7 @@ CHAR key_name_buffer[150]; // áóôåð êóäà ïå÷àòàåòñÿ èìÿ êíîïêè â íàñòðîéêàõ. ANS // ============================================================================
-BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+BOOL APIENTRY DllMain( HMODULE hModule, DWORD, LPVOID)
{
hInstance = hModule;
return TRUE;
diff --git a/plugins/KeyboardNotify/src/EnumProc.cpp b/plugins/KeyboardNotify/src/EnumProc.cpp index b3d8575b00..527e4fda05 100644 --- a/plugins/KeyboardNotify/src/EnumProc.cpp +++ b/plugins/KeyboardNotify/src/EnumProc.cpp @@ -27,7 +27,6 @@ extern PROCESS_LIST ProcessList; BOOL areThereProcessesRunning(void)
{
HANDLE hSnapShot = NULL;
- LPDWORD lpdwPIDs = NULL;
PROCESSENTRY32 procentry;
BOOL bFlag;
diff --git a/plugins/KeyboardNotify/src/flash.cpp b/plugins/KeyboardNotify/src/flash.cpp index 7972f6782c..c2a22d11bf 100644 --- a/plugins/KeyboardNotify/src/flash.cpp +++ b/plugins/KeyboardNotify/src/flash.cpp @@ -343,7 +343,7 @@ void previewFlashing(BOOL buttonState) }
-static void PreviewThread(void *dummy)
+static void PreviewThread(void*)
{
if (wStartDelay > 0)
Sleep(wStartDelay * 1000);
diff --git a/plugins/KeyboardNotify/src/ignore.cpp b/plugins/KeyboardNotify/src/ignore.cpp index 035b264406..5f1fe9dc6a 100644 --- a/plugins/KeyboardNotify/src/ignore.cpp +++ b/plugins/KeyboardNotify/src/ignore.cpp @@ -190,7 +190,7 @@ static void SetAllContactIcons(HWND hwndList) }
}
-INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
{
static HICON hIcons[IGNOREEVENT_MAX+2];
static HANDLE hItemAll, hItemUnknown;
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index d51412af9b..183aeb0f4e 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -267,7 +267,7 @@ BOOL checkUnopenEvents() static void __cdecl FlashThreadFunction(void *) { BOOL bEvent = FALSE; - DWORD dwEventStarted, dwFlashStarted; + DWORD dwEventStarted, dwFlashStarted = 0; BYTE data, unchangedLeds; while (TRUE) { @@ -418,7 +418,7 @@ static int PluginMessageEventHook(WPARAM hContact, LPARAM hEvent) // ** Checks for pending events. If it finds any, it pings the FlashThread to keep the LEDs flashing. // ** -static VOID CALLBACK ReminderTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime) +static VOID CALLBACK ReminderTimer(HWND, UINT, UINT_PTR, DWORD) { int nIndex; CLISTEVENT *pCLEvent; @@ -471,7 +471,7 @@ static INT_PTR StartBlinkService(WPARAM wParam, LPARAM lParam) return 0; } -static INT_PTR EventsWereOpenedService(WPARAM wParam, LPARAM lParam) +static INT_PTR EventsWereOpenedService(WPARAM wParam, LPARAM) { if ((unsigned int)wParam > nExternCount) nExternCount = 0; @@ -491,7 +491,7 @@ static INT_PTR IsFlashingActiveService(WPARAM, LPARAM) } -INT_PTR NormalizeSequenceService(WPARAM wParam, LPARAM lParam) +INT_PTR NormalizeSequenceService(WPARAM, LPARAM lParam) { TCHAR strAux[MAX_PATH + 1], *strIn = (TCHAR*)lParam; @@ -741,15 +741,13 @@ static int ModulesLoaded(WPARAM, LPARAM) return 0; } - - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) { hInst = hinstDLL; return TRUE; } -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; } diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index c937021697..a4033d0f57 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -194,97 +194,96 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP return FALSE; } - -INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) { - static BOOL initDlg=FALSE; + static BOOL initDlg = FALSE; switch (msg) { - case WM_INITDIALOG: - initDlg=TRUE; - TranslateDialogDefault(hwndDlg); + case WM_INITDIALOG: + initDlg = TRUE; + TranslateDialogDefault(hwndDlg); - // proto list - { - LVCOLUMN lvCol; - LVITEM lvItem; - HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST); - - // create columns - ListView_SetExtendedListViewStyleEx(hList, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES); - memset(&lvCol, 0, sizeof(lvCol)); - lvCol.mask = LVCF_WIDTH|LVCF_TEXT; - lvCol.pszText = TranslateT("Protocol"); - lvCol.cx = 118; - ListView_InsertColumn(hList, 0, &lvCol); - // fill - memset(&lvItem, 0, sizeof(lvItem)); - lvItem.mask = LVIF_TEXT|LVIF_PARAM; - lvItem.iItem = 0; - lvItem.iSubItem = 0; - for (int i=0; i < ProtoList.protoCount; i++) { - int count; PROTOACCOUNT** protos; - Proto_EnumAccounts( &count, &protos ); - if(ProtoList.protoInfo[i].visible) { - lvItem.lParam = (LPARAM)ProtoList.protoInfo[i].szProto; - lvItem.pszText = protos[i] -> tszAccountName; - ListView_InsertItem(hList, &lvItem); - ListView_SetCheckState(hList, lvItem.iItem, ProtoList.protoInfo[i].enabled); - lvItem.iItem++; - } + // proto list + { + LVCOLUMN lvCol; + LVITEM lvItem; + HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST); + + // create columns + ListView_SetExtendedListViewStyleEx(hList, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES); + memset(&lvCol, 0, sizeof(lvCol)); + lvCol.mask = LVCF_WIDTH | LVCF_TEXT; + lvCol.pszText = TranslateT("Protocol"); + lvCol.cx = 118; + ListView_InsertColumn(hList, 0, &lvCol); + // fill + memset(&lvItem, 0, sizeof(lvItem)); + lvItem.mask = LVIF_TEXT | LVIF_PARAM; + lvItem.iItem = 0; + lvItem.iSubItem = 0; + for (int i = 0; i < ProtoList.protoCount; i++) { + int count; PROTOACCOUNT** protos; + Proto_EnumAccounts(&count, &protos); + if (ProtoList.protoInfo[i].visible) { + lvItem.lParam = (LPARAM)ProtoList.protoInfo[i].szProto; + lvItem.pszText = protos[i]->tszAccountName; + ListView_InsertItem(hList, &lvItem); + ListView_SetCheckState(hList, lvItem.iItem, ProtoList.protoInfo[i].enabled); + lvItem.iItem++; } } + } - initDlg=FALSE; - return TRUE; + initDlg = FALSE; + return TRUE; - case WM_NOTIFY: - { - //Here we have pressed either the OK or the APPLY button. - switch(((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) { - case PSN_APPLY: - // enabled protos - { - int i; - LVITEM lvItem; - HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST); - - memset(&lvItem, 0, sizeof(lvItem)); - lvItem.mask = LVIF_PARAM; - lvItem.iSubItem = 0; - for (i=0; i < ListView_GetItemCount(hList); i++) { - lvItem.iItem = i; - ListView_GetItem(hList, &lvItem); - db_set_b(NULL, KEYBDMODULE, (char *)lvItem.lParam, (BYTE)!!ListView_GetCheckState(hList, lvItem.iItem)); - } + case WM_NOTIFY: + { + //Here we have pressed either the OK or the APPLY button. + switch (((LPNMHDR)lParam)->idFrom) { + case 0: + switch (((LPNMHDR)lParam)->code) { + case PSN_APPLY: + // enabled protos + { + int i; + LVITEM lvItem; + HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST); + + memset(&lvItem, 0, sizeof(lvItem)); + lvItem.mask = LVIF_PARAM; + lvItem.iSubItem = 0; + for (i = 0; i < ListView_GetItemCount(hList); i++) { + lvItem.iItem = i; + ListView_GetItem(hList, &lvItem); + 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 + 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 idFrom - } - break; //End WM_NOTIFY + } // switch code - IDC_PROTOCOLLIST + break; + } //switch idFrom + } + break; //End WM_NOTIFY - default: - break; + default: + break; } return FALSE; @@ -292,246 +291,246 @@ INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - static BOOL initDlg=FALSE; + static BOOL initDlg = FALSE; switch (msg) { - case WM_INITDIALOG: - initDlg=TRUE; - TranslateDialogDefault(hwndDlg); + case WM_INITDIALOG: + initDlg = TRUE; + TranslateDialogDefault(hwndDlg); + + createProcessListAux(); + createXstatusListAux(); + + CheckDlgButton(hwndDlg, IDC_ONMESSAGE, bFlashOnMsg ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONURL, bFlashOnURL ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONFILE, bFlashOnFile ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONOTHER, bFlashOnOther ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_FSCREEN, bFullScreenMode ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SSAVER, bScreenSaverRunning ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_LOCKED, bWorkstationLocked ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_PGMS, bProcessesAreRunning ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ACTIVE, bWorkstationActive ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_IFOPEN, bFlashIfMsgOpen ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_IFNOTTOP, bFlashIfMsgWinNotTop ? BST_CHECKED : BST_UNCHECKED); + if (!bFlashIfMsgOpen) + EnableWindow(GetDlgItem(hwndDlg, IDC_IFNOTTOP), FALSE); + CheckDlgButton(hwndDlg, IDC_IFOLDER, bFlashIfMsgOlder ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SOLDER), 0); + SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETRANGE32, 1, MAKELONG(UD_MAXVAL, 0)); + SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETPOS, 0, MAKELONG(wSecondsOlder, 0)); + if (!bFlashIfMsgOlder) { + EnableWindow(GetDlgItem(hwndDlg, IDC_SOLDER), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_OLDERSPIN), FALSE); + } - createProcessListAux(); - createXstatusListAux(); - - CheckDlgButton(hwndDlg, IDC_ONMESSAGE, bFlashOnMsg ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ONURL, bFlashOnURL ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ONFILE, bFlashOnFile ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ONOTHER, bFlashOnOther ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_FSCREEN, bFullScreenMode ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SSAVER, bScreenSaverRunning ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_LOCKED, bWorkstationLocked ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_PGMS, bProcessesAreRunning ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ACTIVE, bWorkstationActive ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_IFOPEN, bFlashIfMsgOpen ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_IFNOTTOP, bFlashIfMsgWinNotTop ? BST_CHECKED : BST_UNCHECKED); - if (!bFlashIfMsgOpen) - EnableWindow(GetDlgItem(hwndDlg, IDC_IFNOTTOP), FALSE); - CheckDlgButton(hwndDlg, IDC_IFOLDER, bFlashIfMsgOlder ? BST_CHECKED : BST_UNCHECKED); - SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SOLDER), 0); - SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETRANGE32, 1, MAKELONG(UD_MAXVAL, 0)); - SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETPOS, 0, MAKELONG(wSecondsOlder, 0)); - if (!bFlashIfMsgOlder) { - EnableWindow(GetDlgItem(hwndDlg, IDC_SOLDER), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_OLDERSPIN), FALSE); - } + CheckDlgButton(hwndDlg, IDC_UNTILBLK, bFlashUntil&UNTIL_NBLINKS ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SBLINK), 0); + SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE32, 1, MAKELONG(UD_MAXVAL, 0)); + SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(wBlinksNumber, 0)); + if (!(bFlashUntil & UNTIL_NBLINKS)) { + EnableWindow(GetDlgItem(hwndDlg, IDC_SBLINK), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), FALSE); + } + CheckDlgButton(hwndDlg, IDC_UNTILATTENDED, bFlashUntil&UNTIL_REATTENDED ? BST_CHECKED : BST_UNCHECKED); + for (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) + SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i); + } + SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_SETCURSEL, (WPARAM)bMirandaOrWindows, 0); + if (!(bFlashUntil & UNTIL_REATTENDED)) + EnableWindow(GetDlgItem(hwndDlg, IDC_MIRORWIN), FALSE); + CheckDlgButton(hwndDlg, IDC_UNTILOPEN, bFlashUntil&UNTIL_EVENTSOPEN ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_UNTILCOND, bFlashUntil&UNTIL_CONDITIONS ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_ONLINE, wStatusMap&MAP_ONLINE ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AWAY, wStatusMap&MAP_AWAY ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NA, wStatusMap&MAP_NA ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_OCCUPIED, wStatusMap&MAP_OCCUPIED ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DND, wStatusMap&MAP_DND ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_FREECHAT, wStatusMap&MAP_FREECHAT ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_INVISIBLE, wStatusMap&MAP_INVISIBLE ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONTHEPHONE, wStatusMap&MAP_ONTHEPHONE ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_OUTTOLUNCH, wStatusMap&MAP_OUTTOLUNCH ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_OFFLINE, wStatusMap&MAP_OFFLINE ? BST_CHECKED : BST_UNCHECKED); + + SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SREMCHECK), 0); + SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_SETRANGE32, 0, MAKELONG(UD_MAXVAL, 0)); + SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_SETPOS, 0, MAKELONG(wReminderCheck, 0)); + + initDlg = FALSE; + return TRUE; + + case WM_VSCROLL: + case WM_HSCROLL: + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + break; - CheckDlgButton(hwndDlg, IDC_UNTILBLK, bFlashUntil&UNTIL_NBLINKS ? BST_CHECKED : BST_UNCHECKED); - SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SBLINK), 0); - SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE32, 1, MAKELONG(UD_MAXVAL, 0)); - SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(wBlinksNumber, 0)); - if (!(bFlashUntil & UNTIL_NBLINKS)) { - EnableWindow(GetDlgItem(hwndDlg, IDC_SBLINK), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), FALSE); + case WM_DESTROY: + destroyProcessListAux(); + destroyXstatusListAux(); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_ONMESSAGE: + case IDC_ONURL: + case IDC_ONFILE: + case IDC_ONOTHER: + case IDC_IFOPEN: + case IDC_IFNOTTOP: + case IDC_IFOLDER: + case IDC_UNTILBLK: + case IDC_UNTILATTENDED: + case IDC_UNTILOPEN: + case IDC_UNTILCOND: + case IDC_FSCREEN: + case IDC_SSAVER: + case IDC_LOCKED: + case IDC_PGMS: + case IDC_ACTIVE: + case IDC_ONLINE: + case IDC_AWAY: + case IDC_NA: + case IDC_OCCUPIED: + case IDC_DND: + case IDC_FREECHAT: + case IDC_INVISIBLE: + case IDC_ONTHEPHONE: + case IDC_OUTTOLUNCH: + case IDC_OFFLINE: + EnableWindow(GetDlgItem(hwndDlg, IDC_IFNOTTOP), IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_SOLDER), IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_OLDERSPIN), IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_SBLINK), IsDlgButtonChecked(hwndDlg, IDC_UNTILBLK) == BST_CHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), IsDlgButtonChecked(hwndDlg, IDC_UNTILBLK) == BST_CHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_MIRORWIN), IsDlgButtonChecked(hwndDlg, IDC_UNTILATTENDED) == BST_CHECKED); + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + return TRUE; + case IDC_SOLDER: + if (HIWORD(wParam) == EN_CHANGE && !initDlg) { + BOOL translated; + int val = GetDlgItemInt(hwndDlg, IDC_SOLDER, &translated, FALSE); + if (translated && val < 1) + SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETPOS, 0, MAKELONG(val, 0)); + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); } - 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) - SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i); + return TRUE; + case IDC_SBLINK: + if (HIWORD(wParam) == EN_CHANGE && !initDlg) { + BOOL translated; + int val = GetDlgItemInt(hwndDlg, IDC_SBLINK, &translated, FALSE); + if (translated && val < 1) + SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(val, 0)); + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); } - SendDlgItemMessage(hwndDlg, IDC_MIRORWIN, CB_SETCURSEL, (WPARAM)bMirandaOrWindows, 0); - if (!(bFlashUntil & UNTIL_REATTENDED)) - EnableWindow(GetDlgItem(hwndDlg, IDC_MIRORWIN), FALSE); - CheckDlgButton(hwndDlg, IDC_UNTILOPEN, bFlashUntil&UNTIL_EVENTSOPEN ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_UNTILCOND, bFlashUntil&UNTIL_CONDITIONS ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_ONLINE, wStatusMap&MAP_ONLINE ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AWAY, wStatusMap&MAP_AWAY ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_NA, wStatusMap&MAP_NA ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OCCUPIED, wStatusMap&MAP_OCCUPIED ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DND, wStatusMap&MAP_DND ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_FREECHAT, wStatusMap&MAP_FREECHAT ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_INVISIBLE, wStatusMap&MAP_INVISIBLE ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ONTHEPHONE, wStatusMap&MAP_ONTHEPHONE ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OUTTOLUNCH, wStatusMap&MAP_OUTTOLUNCH ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OFFLINE, wStatusMap&MAP_OFFLINE ? BST_CHECKED : BST_UNCHECKED); - - SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SREMCHECK), 0); - SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_SETRANGE32, 0, MAKELONG(UD_MAXVAL, 0)); - SendDlgItemMessage(hwndDlg, IDC_REMCHECK, UDM_SETPOS, 0, MAKELONG(wReminderCheck, 0)); - - initDlg=FALSE; return TRUE; + case IDC_ASSIGNPGMS: + if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_PROCESSES), hwndDlg, DlgProcProcesses, 0) == IDC_OKPGM) + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + return TRUE; + case IDC_SELECTXSTATUS: + if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_XSTATUSES), hwndDlg, DlgProcXstatusList, 0) == IDC_OKXST) + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + return TRUE; + case IDC_SREMCHECK: + if (HIWORD(wParam) == EN_CHANGE && !initDlg) + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + return TRUE; + case IDC_MIRORWIN: + if (HIWORD(wParam) == CBN_SELCHANGE) + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + return TRUE; + } + break; - case WM_VSCROLL: - case WM_HSCROLL: - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - break; - - case WM_DESTROY: - destroyProcessListAux(); - destroyXstatusListAux(); - 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_ts(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 (int 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(); - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_ONMESSAGE: - case IDC_ONURL: - case IDC_ONFILE: - case IDC_ONOTHER: - case IDC_IFOPEN: - case IDC_IFNOTTOP: - case IDC_IFOLDER: - case IDC_UNTILBLK: - case IDC_UNTILATTENDED: - case IDC_UNTILOPEN: - case IDC_UNTILCOND: - case IDC_FSCREEN: - case IDC_SSAVER: - case IDC_LOCKED: - case IDC_PGMS: - case IDC_ACTIVE: - case IDC_ONLINE: - case IDC_AWAY: - case IDC_NA: - case IDC_OCCUPIED: - case IDC_DND: - case IDC_FREECHAT: - case IDC_INVISIBLE: - case IDC_ONTHEPHONE: - case IDC_OUTTOLUNCH: - case IDC_OFFLINE: - EnableWindow(GetDlgItem(hwndDlg, IDC_IFNOTTOP), IsDlgButtonChecked(hwndDlg, IDC_IFOPEN) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_SOLDER), IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_OLDERSPIN), IsDlgButtonChecked(hwndDlg, IDC_IFOLDER) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_SBLINK), IsDlgButtonChecked(hwndDlg, IDC_UNTILBLK) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), IsDlgButtonChecked(hwndDlg, IDC_UNTILBLK) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_MIRORWIN), IsDlgButtonChecked(hwndDlg, IDC_UNTILATTENDED) == BST_CHECKED); - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_SOLDER: - if(HIWORD(wParam) == EN_CHANGE && !initDlg) { - BOOL translated; - int val = GetDlgItemInt(hwndDlg, IDC_SOLDER, &translated, FALSE); - if (translated && val < 1) - SendDlgItemMessage(hwndDlg, IDC_OLDERSPIN, UDM_SETPOS, 0, MAKELONG(val, 0)); - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - } - return TRUE; - case IDC_SBLINK: - if(HIWORD(wParam) == EN_CHANGE && !initDlg) { - BOOL translated; - int val = GetDlgItemInt(hwndDlg, IDC_SBLINK, &translated, FALSE); - if (translated && val < 1) - SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(val, 0)); - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - } - return TRUE; - case IDC_ASSIGNPGMS: - if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_PROCESSES), hwndDlg, DlgProcProcesses, 0) == IDC_OKPGM) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_SELECTXSTATUS: - if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_XSTATUSES), hwndDlg, DlgProcXstatusList, 0) == IDC_OKXST) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_SREMCHECK: - if(HIWORD(wParam) == EN_CHANGE && !initDlg) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_MIRORWIN: - if(HIWORD(wParam) == CBN_SELCHANGE) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - } - break; + return TRUE; + } // switch code + break; + } //switch idFrom + } + break; //End WM_NOTIFY - 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_ts(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 (int 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; + default: + break; } return FALSE; @@ -541,151 +540,151 @@ INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA { int i; DBVARIANT dbv; - static BOOL initDlg=FALSE; + static BOOL initDlg = FALSE; switch (msg) { - case WM_INITDIALOG: - initDlg=TRUE; - TranslateDialogDefault(hwndDlg); + case WM_INITDIALOG: + initDlg = TRUE; + TranslateDialogDefault(hwndDlg); + + trillianLedsMsg = bTrillianLedsMsg; + trillianLedsURL = bTrillianLedsURL; + trillianLedsFile = bTrillianLedsFile; + trillianLedsOther = bTrillianLedsOther; + + CheckDlgButton(hwndDlg, IDC_NUM, bFlashLed[0] ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_CAPS, bFlashLed[1] ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SCROLL, bFlashLed[2] ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_SAMETIME, bFlashEffect == FLASH_SAMETIME ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_INTURN, bFlashEffect == FLASH_INTURN ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_INSEQUENCE, bFlashEffect == FLASH_INSEQUENCE ? BST_CHECKED : BST_UNCHECKED); + for (i = 0; i < 3; i++) { + int index = SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_INSERTSTRING, -1, (LPARAM)OrderName[i]); + if (index != CB_ERR && index != CB_ERRSPACE) + SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i); + } + SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_SETCURSEL, (WPARAM)bSequenceOrder, 0); + if (bFlashEffect != FLASH_INSEQUENCE) + EnableWindow(GetDlgItem(hwndDlg, IDC_SEQORDER), FALSE); + CheckDlgButton(hwndDlg, IDC_CUSTOM, bFlashEffect == FLASH_CUSTOM ? BST_CHECKED : BST_UNCHECKED); + for (i = 0; !db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) { + int index = SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.ptszVal); + db_free(&dbv); + if (index != CB_ERR && index != CB_ERRSPACE) + SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i); + } + SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_SETCURSEL, (WPARAM)wCustomTheme, 0); + if (bFlashEffect != FLASH_CUSTOM) + EnableWindow(GetDlgItem(hwndDlg, IDC_SCUSTOM), FALSE); + CheckDlgButton(hwndDlg, IDC_TRILLIAN, bFlashEffect == FLASH_TRILLIAN ? BST_CHECKED : BST_UNCHECKED); + if (bFlashEffect != FLASH_TRILLIAN) + EnableWindow(GetDlgItem(hwndDlg, IDC_ASSIGNLEDS), FALSE); - trillianLedsMsg = bTrillianLedsMsg; - trillianLedsURL = bTrillianLedsURL; - trillianLedsFile = bTrillianLedsFile; - trillianLedsOther = bTrillianLedsOther; + SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SDELAY), 0); + SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_SETRANGE32, 0, MAKELONG(UD_MAXVAL, 0)); + SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_SETPOS, 0, MAKELONG(wStartDelay, 0)); - CheckDlgButton(hwndDlg, IDC_NUM, bFlashLed[0] ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CAPS, bFlashLed[1] ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SCROLL, bFlashLed[2] ? BST_CHECKED : BST_UNCHECKED); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETRANGE, FALSE, MAKELONG(0, 5)); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, bFlashSpeed); - CheckDlgButton(hwndDlg, IDC_SAMETIME, bFlashEffect == FLASH_SAMETIME ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_INTURN, bFlashEffect == FLASH_INTURN ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_INSEQUENCE, bFlashEffect == FLASH_INSEQUENCE ? BST_CHECKED : BST_UNCHECKED); - for (i=0; i < 3; i++) { - int index = SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_INSERTSTRING, -1, (LPARAM)OrderName[i]); - if (index != CB_ERR && index != CB_ERRSPACE) - SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i); - } - SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_SETCURSEL, (WPARAM)bSequenceOrder, 0); - if (bFlashEffect != FLASH_INSEQUENCE) - EnableWindow(GetDlgItem(hwndDlg, IDC_SEQORDER), FALSE); - CheckDlgButton(hwndDlg, IDC_CUSTOM, bFlashEffect == FLASH_CUSTOM ? BST_CHECKED : BST_UNCHECKED); - for (i=0; !db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) { - int index = SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.ptszVal); - db_free(&dbv); - if (index != CB_ERR && index != CB_ERRSPACE) - SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i); - } - SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_SETCURSEL, (WPARAM)wCustomTheme, 0); - if (bFlashEffect != FLASH_CUSTOM) - EnableWindow(GetDlgItem(hwndDlg, IDC_SCUSTOM), FALSE); - CheckDlgButton(hwndDlg, IDC_TRILLIAN, bFlashEffect == FLASH_TRILLIAN ? BST_CHECKED : BST_UNCHECKED); - if (bFlashEffect != FLASH_TRILLIAN) - EnableWindow(GetDlgItem(hwndDlg, IDC_ASSIGNLEDS), FALSE); + CheckDlgButton(hwndDlg, IDC_KEYPRESSES, bEmulateKeypresses ? BST_CHECKED : BST_UNCHECKED); - SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SDELAY), 0); - SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_SETRANGE32, 0, MAKELONG(UD_MAXVAL, 0)); - SendDlgItemMessage(hwndDlg, IDC_DELAYSPIN, UDM_SETPOS, 0, MAKELONG(wStartDelay, 0)); + initDlg = FALSE; + return TRUE; - SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETRANGE, FALSE, MAKELONG(0, 5)); - SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, bFlashSpeed); - - CheckDlgButton(hwndDlg, IDC_KEYPRESSES, bEmulateKeypresses ? BST_CHECKED : BST_UNCHECKED); + case WM_VSCROLL: + case WM_HSCROLL: + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + break; - initDlg=FALSE; - return TRUE; + case WM_DESTROY: + previewFlashing(FALSE); + break; - case WM_VSCROLL: - case WM_HSCROLL: + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_NUM: + case IDC_CAPS: + case IDC_SCROLL: + case IDC_SAMETIME: + case IDC_INTURN: + case IDC_INSEQUENCE: + case IDC_CUSTOM: + case IDC_TRILLIAN: + case IDC_SPEED: + case IDC_KEYPRESSES: + EnableWindow(GetDlgItem(hwndDlg, IDC_SEQORDER), IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_SCUSTOM), IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_ASSIGNLEDS), IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED); SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - break; - - case WM_DESTROY: - previewFlashing(FALSE); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_NUM: - case IDC_CAPS: - case IDC_SCROLL: - case IDC_SAMETIME: - case IDC_INTURN: - case IDC_INSEQUENCE: - case IDC_CUSTOM: - case IDC_TRILLIAN: - case IDC_SPEED: - case IDC_KEYPRESSES: - EnableWindow(GetDlgItem(hwndDlg, IDC_SEQORDER), IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_SCUSTOM), IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_ASSIGNLEDS), IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED); + return TRUE; + case IDC_ASSIGNLEDS: + if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EVENTLEDS), hwndDlg, DlgProcEventLeds, 0) == IDC_OK) SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_ASSIGNLEDS: - if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EVENTLEDS), hwndDlg, DlgProcEventLeds, 0) == IDC_OK) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_SDELAY: - if(HIWORD(wParam) == EN_CHANGE && !initDlg) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_PREVIEW: - previewFlashing(IsDlgButtonChecked(hwndDlg, IDC_PREVIEW) == BST_CHECKED); - return TRUE; - case IDC_SEQORDER: - case IDC_SCUSTOM: - if(HIWORD(wParam) == CBN_SELCHANGE) - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - } - break; + return TRUE; + case IDC_SDELAY: + if (HIWORD(wParam) == EN_CHANGE && !initDlg) + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + return TRUE; + case IDC_PREVIEW: + previewFlashing(IsDlgButtonChecked(hwndDlg, IDC_PREVIEW) == BST_CHECKED); + return TRUE; + case IDC_SEQORDER: + case IDC_SCUSTOM: + if (HIWORD(wParam) == CBN_SELCHANGE) + SendMessage(GetParent(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: - 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)); + 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)); - 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 - - default: - break; + return TRUE; + } // switch code + break; + } //switch idFrom + } + break; //End WM_NOTIFY + + default: + break; } return FALSE; @@ -696,122 +695,123 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int i; TCHAR *str; DBVARIANT dbv; - static BOOL initDlg=FALSE; + static BOOL initDlg = FALSE; switch (msg) { - case WM_INITDIALOG: - initDlg=TRUE; - TranslateDialogDefault(hwndDlg); + case WM_INITDIALOG: + initDlg = TRUE; + TranslateDialogDefault(hwndDlg); - SendDlgItemMessage(hwndDlg, IDC_THEME, EM_LIMITTEXT, MAX_PATH, 0); - SendDlgItemMessage(hwndDlg, IDC_CUSTOMSTRING, EM_LIMITTEXT, MAX_PATH, 0); + SendDlgItemMessage(hwndDlg, IDC_THEME, EM_LIMITTEXT, MAX_PATH, 0); + SendDlgItemMessage(hwndDlg, IDC_CUSTOMSTRING, EM_LIMITTEXT, MAX_PATH, 0); - for (i=0; !db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) { - int index = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.ptszVal); - db_free(&dbv); - if (index != CB_ERR && index != CB_ERRSPACE) { - str = (TCHAR *)malloc((MAX_PATH+1)*sizeof(TCHAR)); - if (str) - if (db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv)) - str[0] = _T('\0'); - else { - mir_tstrcpy(str, dbv.ptszVal); - db_free(&dbv); - } + for (i = 0; !db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) { + int index = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.ptszVal); + db_free(&dbv); + if (index != CB_ERR && index != CB_ERRSPACE) { + str = (TCHAR *)malloc((MAX_PATH + 1)*sizeof(TCHAR)); + if (str) + if (db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv)) + str[0] = _T('\0'); + else { + mir_tstrcpy(str, dbv.ptszVal); + db_free(&dbv); + } SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETITEMDATA, (WPARAM)index, (LPARAM)str); - } } + } - EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - if (SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0) == 0) - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); - else { - SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETCURSEL, (WPARAM)wCustomTheme, 0); - str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)wCustomTheme, 0); - if (str) - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); - } + EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); + if (SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0) == 0) + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); + else { + SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETCURSEL, (WPARAM)wCustomTheme, 0); + str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)wCustomTheme, 0); + if (str) + SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); + } - CheckDlgButton(hwndDlg, IDC_OVERRIDE, bOverride ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_OVERRIDE, bOverride ? BST_CHECKED : BST_UNCHECKED); - initDlg=FALSE; - return TRUE; + initDlg = FALSE; + return TRUE; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_THEME: - switch (HIWORD(wParam)) { + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_THEME: + switch (HIWORD(wParam)) { int item; - TCHAR theme[MAX_PATH+1]; + TCHAR theme[MAX_PATH + 1]; - case CBN_SELENDOK: - case CBN_SELCHANGE: - str = (TCHAR *)SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0); + case CBN_SELENDOK: + case CBN_SELCHANGE: + str = (TCHAR *)SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0); + if (str) + SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); + else + SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, _T("")); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); + break; + case CBN_EDITCHANGE: + GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); + if ((item = SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)theme)) == CB_ERR) { //new theme + SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, _T("")); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); + } + else { + str = (TCHAR *)SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)item, 0); if (str) SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); else SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, _T("")); EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); - break; - case CBN_EDITCHANGE: - GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); - if ((item = SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)theme)) == CB_ERR) { //new theme - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, _T("")); - EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); - } else { - str = (TCHAR *)SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)item, 0); - if (str) - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); - else - SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, _T("")); - EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), TRUE); - } - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - break; } - return TRUE; - case IDC_CUSTOMSTRING: - if(HIWORD(wParam) == EN_CHANGE) { - TCHAR theme[MAX_PATH+1], customAux[MAX_PATH+1]; - - GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); - int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); - if (item == CB_ERR) - return TRUE; - str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); - if (str) { - GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, customAux, _countof(customAux)); - if (mir_wstrcmp(str, customAux)) - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), TRUE); - else - EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - } + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); + break; + } + return TRUE; + case IDC_CUSTOMSTRING: + if (HIWORD(wParam) == EN_CHANGE) { + TCHAR theme[MAX_PATH + 1], customAux[MAX_PATH + 1]; + + GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); + int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); + if (item == CB_ERR) + return TRUE; + str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); + if (str) { + GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, customAux, _countof(customAux)); + if (mir_wstrcmp(str, customAux)) + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), TRUE); + else + EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); } - return TRUE; - case IDC_TEST: - { - TCHAR custom[MAX_PATH+1]; + } + return TRUE; + case IDC_TEST: + { + TCHAR custom[MAX_PATH + 1]; GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, custom, _countof(custom)); SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(custom)); testSequence(custom); - } - return TRUE; - case IDC_ADD: - { - TCHAR theme[MAX_PATH+1]; + } + return TRUE; + case IDC_ADD: + { + TCHAR 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); - str = (TCHAR *)malloc((MAX_PATH+1)*sizeof(TCHAR)); + str = (TCHAR *)malloc((MAX_PATH + 1)*sizeof(TCHAR)); if (str) { GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str, MAX_PATH); SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(str)); @@ -820,12 +820,12 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR 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: - { - TCHAR theme[MAX_PATH+1]; + } + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + return TRUE; + case IDC_UPDATE: + { + TCHAR theme[MAX_PATH + 1]; GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); @@ -835,12 +835,12 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(str)); } EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - } - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_DELETE: - { - TCHAR theme[MAX_PATH+1]; + } + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + return TRUE; + case IDC_DELETE: + { + TCHAR theme[MAX_PATH + 1]; GetDlgItemText(hwndDlg, IDC_THEME, theme, _countof(theme)); int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); @@ -852,20 +852,21 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetDlgItemText(hwndDlg, IDC_THEME, _T("")); SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, _T("")); EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); - } else { + } + else { SendDlgItemMessage(hwndDlg, IDC_THEME, CB_SETCURSEL, 0, 0); str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, 0, 0); if (str) SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str); } EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), FALSE); - } - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; - case IDC_EXPORT: - { - TCHAR path[MAX_PATH+1], filter[MAX_PATH+1], *pfilter; - OPENFILENAME ofn={0}; + } + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + return TRUE; + case IDC_EXPORT: + { + TCHAR path[MAX_PATH + 1], filter[MAX_PATH + 1], *pfilter; + OPENFILENAME ofn = { 0 }; path[0] = _T('\0'); ofn.lStructSize = sizeof(OPENFILENAME); @@ -880,20 +881,20 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR pfilter = pfilter + mir_tstrlen(pfilter) + 1; mir_tstrcpy(pfilter, _T("*.*")); pfilter = pfilter + mir_tstrlen(pfilter) + 1; - *pfilter = _T('\0'); + *pfilter = _T('\0'); ofn.lpstrFilter = filter; ofn.lpstrFile = path; - ofn.Flags = OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_NOREADONLYRETURN|OFN_PATHMUSTEXIST; + ofn.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST; ofn.nMaxFile = _countof(path); ofn.lpstrDefExt = _T("knt"); - if(GetSaveFileName(&ofn)) + if (GetSaveFileName(&ofn)) exportThemes(path); - } - return TRUE; - case IDC_IMPORT: - { - TCHAR path[MAX_PATH+1], filter[MAX_PATH+1], *pfilter; - OPENFILENAME ofn={0}; + } + return TRUE; + case IDC_IMPORT: + { + TCHAR path[MAX_PATH + 1], filter[MAX_PATH + 1], *pfilter; + OPENFILENAME ofn = { 0 }; path[0] = _T('\0'); ofn.lStructSize = sizeof(OPENFILENAME); @@ -908,88 +909,88 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR pfilter = pfilter + mir_tstrlen(pfilter) + 1; mir_tstrcpy(pfilter, _T("*.*")); pfilter = pfilter + mir_tstrlen(pfilter) + 1; - *pfilter = _T('\0'); + *pfilter = _T('\0'); ofn.lpstrFilter = filter; ofn.lpstrFile = path; - ofn.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NOCHANGEDIR; ofn.nMaxFile = _countof(path); ofn.lpstrDefExt = _T("knt"); - if(GetOpenFileName(&ofn)) { + if (GetOpenFileName(&ofn)) { importThemes(path, IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED); SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); } - } - return TRUE; - case IDC_OVERRIDE: - SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); - return TRUE; } - break; + return TRUE; + case IDC_OVERRIDE: + SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); + return TRUE; + } + break; - case WM_NOTIFY: - { - int count; - TCHAR theme[MAX_PATH+1], themeAux[MAX_PATH+1], *str; - //Here we have pressed either the OK or the APPLY button. - switch(((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) { - case PSN_APPLY: - if (!db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", wCustomTheme), &dbv)) - mir_tstrcpy(theme, dbv.ptszVal); + case WM_NOTIFY: + { + int count; + TCHAR theme[MAX_PATH + 1], themeAux[MAX_PATH + 1], *str; + //Here we have pressed either the OK or the APPLY button. + switch (((LPNMHDR)lParam)->idFrom) { + case 0: + switch (((LPNMHDR)lParam)->code) { + case PSN_APPLY: + if (!db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", wCustomTheme), &dbv)) + mir_tstrcpy(theme, dbv.ptszVal); + else + theme[0] = _T('\0'); + + // Here we will delete all the items in the theme combo on the Flashing tab: we will load them again later + for (i = 0; SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_DELETESTRING, 0, (LPARAM)i) != CB_ERR; i++); + + count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0); + for (i = 0, wCustomTheme = 0; i < count; i++) { + SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETLBTEXT, (WPARAM)i, (LPARAM)themeAux); + db_set_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), themeAux); + str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)i, 0); + if (str) + db_set_ts(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), str); else - theme[0] = _T('\0'); - - // Here we will delete all the items in the theme combo on the Flashing tab: we will load them again later - for (i=0; SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_DELETESTRING, 0, (LPARAM)i) != CB_ERR; i++); - - count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0); - for (i=0, wCustomTheme=0; i < count; i++) { - SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETLBTEXT, (WPARAM)i, (LPARAM)themeAux); - db_set_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), themeAux); - str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)i, 0); - if (str) - db_set_ts(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), str); - else - db_set_ts(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), _T("")); - - 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 (i=count; !db_unset(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i)); i++) - db_unset(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i)); + db_set_ts(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), _T("")); + + if (!mir_wstrcmp(theme, themeAux)) + wCustomTheme = i; - 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); + // Here we will update the theme combo on the Flashing tab: horrible but can't imagine a better way right now + SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_INSERTSTRING, (WPARAM)i, (LPARAM)themeAux); + SendDlgItemMessage(hwndEffect, IDC_SCUSTOM, CB_SETITEMDATA, (WPARAM)i, (LPARAM)i); + } + for (i = count; !db_unset(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i)); i++) + db_unset(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i)); - db_set_b(NULL, KEYBDMODULE, "override", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED ? 1:0)); + 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); - return TRUE; - } // switch code - break; - } //switch idFrom - } - break; //End WM_NOTIFY + db_set_b(NULL, KEYBDMODULE, "override", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE) == BST_CHECKED ? 1 : 0)); - case WM_DESTROY: - { + return TRUE; + } // switch code + break; + } //switch idFrom + } + break; //End WM_NOTIFY + + case WM_DESTROY: + { int item, count = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETCOUNT, 0, 0); - for (item=0; item < count; item++) { + for (item = 0; item < count; item++) { str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); if (str) free(str); } break; - } - - default: - break; + } + + default: + break; } return FALSE; @@ -1007,7 +1008,7 @@ void exportThemes(const TCHAR *filename) fwprintf(fExport, TranslateT("\n; Automatically generated Keyboard Notify Theme file\n\n\n")); - for (i=0; !db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) { + for (i = 0; !db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) { _ftprintf(fExport, _T("[%s]\n"), dbv.ptszVal); db_free(&dbv); if (db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv)) @@ -1030,27 +1031,27 @@ void importThemes(const TCHAR *filename, BOOL overrideExisting) if (!fImport) return; - int status=0; + int status = 0; size_t i; - TCHAR buffer[MAX_PATH+1], theme[MAX_PATH+1], *str; + TCHAR buffer[MAX_PATH + 1], theme[MAX_PATH + 1], *str; while (_fgetts(buffer, MAX_PATH, fImport) != NULL) { - for (str=buffer; *str && isspace(*str); str++); //ltrim + for (str = buffer; *str && isspace(*str); str++); //ltrim if (!*str || *str == ';') //empty line or comment continue; - for (i=mir_tstrlen(str)-1; isspace(str[i]); str[i--]='\0'); //rtrim + for (i = mir_tstrlen(str) - 1; isspace(str[i]); str[i--] = '\0'); //rtrim switch (status) { - case 0: - if (i > 1 && str[0] == '[' && str[i] == ']') { - status = 1; - mir_tstrcpy(theme, str+1); - theme[i-1] = '\0'; - } - break; - case 1: - status = 0; - writeThemeToCombo(theme, normalizeCustomString(str), overrideExisting); - break; + case 0: + if (i > 1 && str[0] == '[' && str[i] == ']') { + status = 1; + mir_tstrcpy(theme, str + 1); + theme[i - 1] = '\0'; + } + break; + case 1: + status = 0; + writeThemeToCombo(theme, normalizeCustomString(str), overrideExisting); + break; } } @@ -1065,11 +1066,12 @@ void writeThemeToCombo(const TCHAR *theme, const TCHAR *custom, BOOL overrideExi int item = SendDlgItemMessage(hwndTheme, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); if (item == CB_ERR) { item = SendDlgItemMessage(hwndTheme, IDC_THEME, CB_ADDSTRING, 0, (LPARAM)theme); - str = (TCHAR *)malloc((MAX_PATH+1)*sizeof(TCHAR)); + str = (TCHAR *)malloc((MAX_PATH + 1)*sizeof(TCHAR)); if (str) mir_tstrcpy(str, custom); SendDlgItemMessage(hwndTheme, IDC_THEME, CB_SETITEMDATA, (WPARAM)item, (LPARAM)str); - } else + } + else if (overrideExisting) { str = (TCHAR *)SendDlgItemMessage(hwndTheme, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); if (str) @@ -1082,54 +1084,55 @@ INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM { switch (msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, EM_LIMITTEXT, MAX_PATH, 0); + SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, EM_LIMITTEXT, MAX_PATH, 0); - for (int i = 0; i < ProcessListAux.count; i++) - if (ProcessListAux.szFileName[i]) { - int index = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)ProcessListAux.szFileName[i]); - if (index != CB_ERR && index != CB_ERRSPACE) - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i); - } + for (int i = 0; i < ProcessListAux.count; i++) + if (ProcessListAux.szFileName[i]) { + int index = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)ProcessListAux.szFileName[i]); + if (index != CB_ERR && index != CB_ERRSPACE) + SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i); + } - EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE); - if (SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETCOUNT, 0, 0) == 0) - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE); - else - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETCURSEL, 0, 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE); + if (SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETCOUNT, 0, 0) == 0) + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE); + else + SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETCURSEL, 0, 0); - return TRUE; + return TRUE; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_PROGRAMS: - switch (HIWORD(wParam)) { + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_PROGRAMS: + switch (HIWORD(wParam)) { int item; - TCHAR szFileName[MAX_PATH+1]; + TCHAR szFileName[MAX_PATH + 1]; - case CBN_SELENDOK: - case CBN_SELCHANGE: + case CBN_SELENDOK: + case CBN_SELCHANGE: + EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), TRUE); + break; + case CBN_EDITCHANGE: + GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, _countof(szFileName)); + if ((item = SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)szFileName)) == CB_ERR) { //new program + EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE); + } + else { EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), TRUE); - break; - case CBN_EDITCHANGE: - GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, _countof(szFileName)); - if ((item = SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)szFileName)) == CB_ERR) { //new program - EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE); - } else { - EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), TRUE); - } - break; } break; - case IDC_ADDPGM: - { + } + break; + case IDC_ADDPGM: + { int item; - TCHAR szFileName[MAX_PATH+1]; + TCHAR szFileName[MAX_PATH + 1]; GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, _countof(szFileName)); if (!szFileName[0]) @@ -1137,12 +1140,12 @@ INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM item = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_ADDSTRING, 0, (LPARAM)szFileName); EnableWindow(GetDlgItem(hwndDlg, IDC_ADDPGM), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), TRUE); - } - break; - case IDC_DELETEPGM: - { + } + break; + case IDC_DELETEPGM: + { int item; - TCHAR szFileName[MAX_PATH+1]; + TCHAR szFileName[MAX_PATH + 1]; GetDlgItemText(hwndDlg, IDC_PROGRAMS, szFileName, _countof(szFileName)); item = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_FINDSTRINGEXACT, -1, (LPARAM)szFileName); @@ -1150,32 +1153,33 @@ INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETCOUNT, 0, 0) == 0) { SetDlgItemText(hwndDlg, IDC_PROGRAMS, _T("")); EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEPGM), FALSE); - } else - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETCURSEL, 0, 0); } - break; - case IDC_OKPGM: - destroyProcessListAux(); - - ProcessListAux.count = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETCOUNT, 0, 0); - ProcessListAux.szFileName = (TCHAR **)malloc(ProcessListAux.count * sizeof(TCHAR *)); - if (!ProcessListAux.szFileName) - ProcessListAux.count = 0; else - for (int i = 0; i < ProcessListAux.count; i++) { - TCHAR szFileNameAux[MAX_PATH+1]; - - SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETLBTEXT, (WPARAM)i, (LPARAM)szFileNameAux); - ProcessListAux.szFileName[i] = (TCHAR *)malloc((mir_tstrlen(szFileNameAux) + 1)*sizeof(TCHAR)); - if (ProcessListAux.szFileName[i]) - mir_tstrcpy(ProcessListAux.szFileName[i], szFileNameAux); - } - - case IDC_CANCELPGM: - EndDialog(hwndDlg, LOWORD(wParam)); - break; + SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_SETCURSEL, 0, 0); } break; + case IDC_OKPGM: + destroyProcessListAux(); + + ProcessListAux.count = SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETCOUNT, 0, 0); + ProcessListAux.szFileName = (TCHAR **)malloc(ProcessListAux.count * sizeof(TCHAR *)); + if (!ProcessListAux.szFileName) + ProcessListAux.count = 0; + else + for (int i = 0; i < ProcessListAux.count; i++) { + TCHAR szFileNameAux[MAX_PATH + 1]; + + SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETLBTEXT, (WPARAM)i, (LPARAM)szFileNameAux); + ProcessListAux.szFileName[i] = (TCHAR *)malloc((mir_tstrlen(szFileNameAux) + 1)*sizeof(TCHAR)); + if (ProcessListAux.szFileName[i]) + mir_tstrcpy(ProcessListAux.szFileName[i], szFileNameAux); + } + + case IDC_CANCELPGM: + EndDialog(hwndDlg, LOWORD(wParam)); + break; + } + break; } return FALSE; @@ -1205,7 +1209,7 @@ void destroyProcessListAux(void) { if (ProcessListAux.szFileName == NULL) return; - for (int i = 0; i < ProcessListAux.count; i ++) { + for (int i = 0; i < ProcessListAux.count; i++) { if (ProcessListAux.szFileName[i]) { free(ProcessListAux.szFileName[i]); } @@ -1216,71 +1220,71 @@ void destroyProcessListAux(void) } -INT_PTR CALLBACK DlgProcEventLeds(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK DlgProcEventLeds(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { switch (msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_MSGLEDNUM, trillianLedsMsg&2 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MSGLEDCAPS, trillianLedsMsg&4 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MSGLEDSCROLL, trillianLedsMsg&1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MSGLEDNUM, trillianLedsMsg & 2 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MSGLEDCAPS, trillianLedsMsg & 4 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MSGLEDSCROLL, trillianLedsMsg & 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_FILELEDNUM, trillianLedsFile&2 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_FILELEDCAPS, trillianLedsFile&4 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_FILELEDSCROLL, trillianLedsFile&1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_FILELEDNUM, trillianLedsFile & 2 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_FILELEDCAPS, trillianLedsFile & 4 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_FILELEDSCROLL, trillianLedsFile & 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_URLLEDNUM, trillianLedsURL&2 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_URLLEDCAPS, trillianLedsURL&4 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_URLLEDSCROLL, trillianLedsURL&1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_URLLEDNUM, trillianLedsURL & 2 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_URLLEDCAPS, trillianLedsURL & 4 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_URLLEDSCROLL, trillianLedsURL & 1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OTHERLEDNUM, trillianLedsOther&2 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OTHERLEDCAPS, trillianLedsOther&4 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_OTHERLEDSCROLL, trillianLedsOther&1 ? BST_CHECKED : BST_UNCHECKED); + 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; + return TRUE; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_OK: - trillianLedsMsg = 0; - if(IsDlgButtonChecked(hwndDlg, IDC_MSGLEDNUM) == BST_CHECKED) - trillianLedsMsg |= 2; - if(IsDlgButtonChecked(hwndDlg, IDC_MSGLEDCAPS) == BST_CHECKED) - trillianLedsMsg |= 4; - if(IsDlgButtonChecked(hwndDlg, IDC_MSGLEDSCROLL) == BST_CHECKED) - trillianLedsMsg |= 1; - - trillianLedsFile = 0; - if(IsDlgButtonChecked(hwndDlg, IDC_FILELEDNUM) == BST_CHECKED) - trillianLedsFile |= 2; - if(IsDlgButtonChecked(hwndDlg, IDC_FILELEDCAPS) == BST_CHECKED) - trillianLedsFile |= 4; - if(IsDlgButtonChecked(hwndDlg, IDC_FILELEDSCROLL) == BST_CHECKED) - trillianLedsFile |= 1; - - trillianLedsURL = 0; - if(IsDlgButtonChecked(hwndDlg, IDC_URLLEDNUM) == BST_CHECKED) - trillianLedsURL |= 2; - if(IsDlgButtonChecked(hwndDlg, IDC_URLLEDCAPS) == BST_CHECKED) - trillianLedsURL |= 4; - if(IsDlgButtonChecked(hwndDlg, IDC_URLLEDSCROLL) == BST_CHECKED) - trillianLedsURL |= 1; - - trillianLedsOther = 0; - if(IsDlgButtonChecked(hwndDlg, IDC_OTHERLEDNUM) == BST_CHECKED) - trillianLedsOther |= 2; - if(IsDlgButtonChecked(hwndDlg, IDC_OTHERLEDCAPS) == BST_CHECKED) - trillianLedsOther |= 4; - if(IsDlgButtonChecked(hwndDlg, IDC_OTHERLEDSCROLL) == BST_CHECKED) - trillianLedsOther |= 1; - - case IDC_CANCEL: - EndDialog(hwndDlg, LOWORD(wParam)); - break; - } + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_OK: + trillianLedsMsg = 0; + if (IsDlgButtonChecked(hwndDlg, IDC_MSGLEDNUM) == BST_CHECKED) + trillianLedsMsg |= 2; + if (IsDlgButtonChecked(hwndDlg, IDC_MSGLEDCAPS) == BST_CHECKED) + trillianLedsMsg |= 4; + if (IsDlgButtonChecked(hwndDlg, IDC_MSGLEDSCROLL) == BST_CHECKED) + trillianLedsMsg |= 1; + + trillianLedsFile = 0; + if (IsDlgButtonChecked(hwndDlg, IDC_FILELEDNUM) == BST_CHECKED) + trillianLedsFile |= 2; + if (IsDlgButtonChecked(hwndDlg, IDC_FILELEDCAPS) == BST_CHECKED) + trillianLedsFile |= 4; + if (IsDlgButtonChecked(hwndDlg, IDC_FILELEDSCROLL) == BST_CHECKED) + trillianLedsFile |= 1; + + trillianLedsURL = 0; + if (IsDlgButtonChecked(hwndDlg, IDC_URLLEDNUM) == BST_CHECKED) + trillianLedsURL |= 2; + if (IsDlgButtonChecked(hwndDlg, IDC_URLLEDCAPS) == BST_CHECKED) + trillianLedsURL |= 4; + if (IsDlgButtonChecked(hwndDlg, IDC_URLLEDSCROLL) == BST_CHECKED) + trillianLedsURL |= 1; + + trillianLedsOther = 0; + if (IsDlgButtonChecked(hwndDlg, IDC_OTHERLEDNUM) == BST_CHECKED) + trillianLedsOther |= 2; + if (IsDlgButtonChecked(hwndDlg, IDC_OTHERLEDCAPS) == BST_CHECKED) + trillianLedsOther |= 4; + if (IsDlgButtonChecked(hwndDlg, IDC_OTHERLEDSCROLL) == BST_CHECKED) + trillianLedsOther |= 1; + + case IDC_CANCEL: + EndDialog(hwndDlg, LOWORD(wParam)); break; + } + break; } return FALSE; @@ -1321,34 +1325,33 @@ void destroyXstatusListAux(void) } -INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { switch (msg) { - case WM_INITDIALOG: - + case WM_INITDIALOG: { WPARAM j; - TVINSERTSTRUCT tvis={0}; - TVITEM tvi={0}; + TVINSERTSTRUCT tvis = { 0 }; + TVITEM tvi = { 0 }; HTREEITEM hSectionItem, hItem; HWND hwndTree = GetDlgItem(hwndDlg, IDC_TREE_XSTATUS); TranslateDialogDefault(hwndDlg); - SetWindowLongPtr(hwndTree, GWL_STYLE, GetWindowLongPtr(hwndTree, GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); + SetWindowLongPtr(hwndTree, GWL_STYLE, GetWindowLongPtr(hwndTree, GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); if (!XstatusListAux) return TRUE; // Calculate hImageList size - int imageCount=1; + int imageCount = 1; for (int i = 0; i < ProtoList.protoCount; i++) if (ProtoList.protoInfo[i].enabled && XstatusListAux[i].count) imageCount += XstatusListAux[i].count; - + HIMAGELIST hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, imageCount, imageCount); TreeView_SetImageList(hwndTree, hImageList, TVSIL_NORMAL); - HICON hIconAux=(HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 0, 0, 0); + HICON hIconAux = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 0, 0, 0); if (hIconAux) { ImageList_AddIcon(hImageList, hIconAux); DestroyIcon(hIconAux); @@ -1362,60 +1365,61 @@ INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (ProtoList.protoInfo[i].enabled && XstatusListAux[i].count) { int count; PROTOACCOUNT **protos; - Proto_EnumAccounts( &count, &protos ); + Proto_EnumAccounts(&count, &protos); tvis.hParent = NULL; tvis.hInsertAfter = TVI_LAST; - tvis.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE|TVIF_IMAGE|TVIF_SELECTEDIMAGE; - tvis.item.pszText = protos[i] -> tszAccountName; + tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; + tvis.item.pszText = protos[i]->tszAccountName; tvis.item.lParam = (LPARAM)i; - tvis.item.stateMask = TVIS_BOLD|TVIS_EXPANDED; - tvis.item.state = TVIS_BOLD|TVIS_EXPANDED; - tvis.item.iImage = tvis.item.iSelectedImage = ImageList_AddIcon(hImageList, hIconAux=(HICON)CallProtoService(ProtoList.protoInfo[i].szProto, PS_LOADICON, PLI_PROTOCOL, 0)); + tvis.item.stateMask = TVIS_BOLD | TVIS_EXPANDED; + tvis.item.state = TVIS_BOLD | TVIS_EXPANDED; + tvis.item.iImage = tvis.item.iSelectedImage = ImageList_AddIcon(hImageList, hIconAux = (HICON)CallProtoService(ProtoList.protoInfo[i].szProto, PS_LOADICON, PLI_PROTOCOL, 0)); if (hIconAux) DestroyIcon(hIconAux); HTREEITEM hParent = TreeView_InsertItem(hwndTree, &tvis); for (j = 0; j < XstatusListAux[i].count; j++) { tvis.hParent = hParent; - tvis.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE; - if (!j){ - tvis.item.pszText = TranslateT("None"); } + tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE; + if (!j) { + tvis.item.pszText = TranslateT("None"); + } else { TCHAR szDefaultName[1024]; - CUSTOM_STATUS xstatus={0}; + CUSTOM_STATUS xstatus = { 0 }; xstatus.cbSize = sizeof(CUSTOM_STATUS); - xstatus.flags = CSSF_MASK_NAME|CSSF_DEFAULT_NAME|CSSF_TCHAR; + xstatus.flags = CSSF_MASK_NAME | CSSF_DEFAULT_NAME | CSSF_TCHAR; xstatus.ptszName = szDefaultName; xstatus.wParam = &j; CallProtoService(ProtoList.protoInfo[i].szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&xstatus); tvis.item.pszText = TranslateTS(szDefaultName); } tvis.item.lParam = (LPARAM)j; - tvis.item.iImage = tvis.item.iSelectedImage = j?ImageList_AddIcon(hImageList, hIconAux=(HICON)CallProtoService(ProtoList.protoInfo[i].szProto, PS_GETCUSTOMSTATUSICON, (WPARAM)j, 0)):0; + tvis.item.iImage = tvis.item.iSelectedImage = j ? ImageList_AddIcon(hImageList, hIconAux = (HICON)CallProtoService(ProtoList.protoInfo[i].szProto, PS_GETCUSTOMSTATUSICON, (WPARAM)j, 0)) : 0; if (hIconAux) DestroyIcon(hIconAux); TreeView_InsertItem(hwndTree, &tvis); } } - tvi.mask = TVIF_HANDLE|TVIF_PARAM; - for (hSectionItem=TreeView_GetRoot(hwndTree); hSectionItem; hSectionItem=TreeView_GetNextSibling(hwndTree, hSectionItem)) { + tvi.mask = TVIF_HANDLE | TVIF_PARAM; + for (hSectionItem = TreeView_GetRoot(hwndTree); hSectionItem; hSectionItem = TreeView_GetNextSibling(hwndTree, hSectionItem)) { tvi.hItem = hSectionItem; TreeView_GetItem(hwndTree, &tvi); unsigned int i = (unsigned int)tvi.lParam; TreeView_SetItemState(hwndTree, hSectionItem, INDEXTOSTATEIMAGEMASK(0), TVIS_STATEIMAGEMASK); - for (hItem=TreeView_GetChild(hwndTree, hSectionItem); hItem; hItem=TreeView_GetNextSibling(hwndTree, hItem)) { + for (hItem = TreeView_GetChild(hwndTree, hSectionItem); hItem; hItem = TreeView_GetNextSibling(hwndTree, hItem)) { tvi.hItem = hItem; TreeView_GetItem(hwndTree, &tvi); j = (unsigned int)tvi.lParam; - TreeView_SetItemState(hwndTree, hItem, INDEXTOSTATEIMAGEMASK(XstatusListAux[i].enabled[j]?2:1), TVIS_STATEIMAGEMASK); + TreeView_SetItemState(hwndTree, hItem, INDEXTOSTATEIMAGEMASK(XstatusListAux[i].enabled[j] ? 2 : 1), TVIS_STATEIMAGEMASK); } } ShowWindow(hwndTree, SW_SHOW); TreeView_SetItemState(hwndTree, 0, TVIS_SELECTED, TVIS_SELECTED); - return TRUE; } + return TRUE; - case WM_DESTROY: + 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); @@ -1428,24 +1432,24 @@ INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA 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: + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_OKXST: { unsigned int i, j; HTREEITEM hSectionItem, hItem; - TVITEM tvi={0}; + 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.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)) { + for (hItem = TreeView_GetChild(hwndTree, hSectionItem); hItem; hItem = TreeView_GetNextSibling(hwndTree, hItem)) { tvi.hItem = hItem; TreeView_GetItem(hwndTree, &tvi); j = (unsigned int)tvi.lParam; @@ -1454,11 +1458,11 @@ INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } } - case IDC_CANCELXST: - EndDialog(hwndDlg, LOWORD(wParam)); - return TRUE; - } - break; + case IDC_CANCELXST: + EndDialog(hwndDlg, LOWORD(wParam)); + return TRUE; + } + break; } return FALSE; diff --git a/plugins/KeyboardNotify/src/stdafx.h b/plugins/KeyboardNotify/src/stdafx.h index 9e41225be3..9ec3fb4d65 100644 --- a/plugins/KeyboardNotify/src/stdafx.h +++ b/plugins/KeyboardNotify/src/stdafx.h @@ -17,7 +17,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define WIN32_LEAN_AND_MEAN
-#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <stdlib.h>
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index 8a9c67b675..e417bcf361 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -571,13 +571,11 @@ int check() { //before pure lotus notes api functions call
void checkthread(void*)
{
-
STATUS error = NOERROR;
char fullpath[255];
DBHANDLE db_handle = NULLHANDLE; /* database handle */
- TCHAR buffer[NSF_INFO_SIZE] = TEXT(""); /* database info buffer */
- TCHAR title[NSF_INFO_SIZE] = TEXT(""); /* database title */
- char UserName [MAXUSERNAME + 1];
+ TCHAR buffer[NSF_INFO_SIZE] = TEXT(""); /* database info buffer */
+ char UserName[MAXUSERNAME + 1];
HANDLE hTable;
DWORD noteID = 0L;
@@ -607,44 +605,46 @@ void checkthread(void*) }
log_p(L"checkthread: OSPathNetConstruct: %S", fullpath);
- if (error = (NSFDbOpen1) (fullpath, &db_handle)) {
- if(mir_strcmp(settingServerSec, "") != 0) {
+ if (error = (NSFDbOpen1)(fullpath, &db_handle)) {
+ if (mir_strcmp(settingServerSec, "") != 0) {
if (error = (OSPathNetConstruct1)(NULL, settingServerSec, settingDatabase, fullpath)) {
goto errorblock;
- } else {
- if (error = (NSFDbOpen1) (fullpath, &db_handle)) {
+ }
+ else {
+ if (error = (NSFDbOpen1)(fullpath, &db_handle)) {
goto errorblock;
}
}
- } else {
+ }
+ else {
goto errorblock;
}
}
assert(db_handle);
log(L"checkthread: DBOpened");
- if(error = (SECKFMGetUserName1) (UserName)) {
+ if (error = (SECKFMGetUserName1)(UserName)) {
goto errorblock0;
}
assert(UserName);
log_p(L"checkthread: Username: %S", UserName);
- /* Get the unread list */
- if(error = (NSFDbGetUnreadNoteTable1) (db_handle,UserName,(WORD) mir_strlen(UserName),TRUE,&hTable)) {
+ /* Get the unread list */
+ if (error = (NSFDbGetUnreadNoteTable1)(db_handle, UserName, (WORD)mir_strlen(UserName), TRUE, &hTable)) {
goto errorblock0;
}
log(L"checkthread: Unread Table got");
//error = IDTableCopy (hTable, &hOriginalTable);
//IDDestroyTable (hTable);
- if(error = (NSFDbUpdateUnread1) (db_handle, hTable)){
+ if (error = (NSFDbUpdateUnread1)(db_handle, hTable)) {
goto errorblock;
}
log(L"checkthread: Unread Table updated");
assert(hTable);
- while((IDScan1)(hTable, fFirst, ¬eID)) {
+ while ((IDScan1)(hTable, fFirst, ¬eID)) {
WORD Att;
BLOCKID bhAttachment;
@@ -654,9 +654,9 @@ void checkthread(void*) TIMEDATE retModified; /* modified timedate */
WORD retNoteClass; /* note class */
TIMEDATE sendDate;
- char strLink[4*16];
+ char strLink[4 * 16];
- if (Plugin_Terminated || Miranda_Terminated()){
+ if (Plugin_Terminated || Miranda_Terminated()) {
log_p(L"checkthread: Plugin_Terminated (=%d) OR Miranda_Terminated()", Plugin_Terminated);
break;
}
@@ -665,26 +665,26 @@ void checkthread(void*) fFirst = FALSE;
assert(noteID);
- if(!getEl(noteID))
+ if (!getEl(noteID))
addNewId(noteID);
else
(getEl(noteID))->again = TRUE;
- if(!settingOnceOnly && (getEl(noteID))->again == TRUE){
+ if (!settingOnceOnly && (getEl(noteID))->again == TRUE) {
//don't show again and note was not showed (ID not on list)
continue;
}
log(L"checkthread: skiped-don't show again and note was not showed (ID not on list)");
- if(settingOnceOnly && settingNonClickedOnly && (getEl(noteID))->clicked == TRUE){
+ if (settingOnceOnly && settingNonClickedOnly && (getEl(noteID))->clicked == TRUE) {
//show again, but only not clicked (id added to list on Left Button click)
continue;
}
log(L"checkthread: skiped-show again, but only not clicked (id added to list on Left Button click)");
- if(settingNewest && settingNewestID >= noteID){
+ if (settingNewest && settingNewestID >= noteID) {
//only newest option enabled, so if old id don't show it
continue;
}
@@ -692,53 +692,53 @@ void checkthread(void*) log(L"checkthread: skiped-only newest option enabled, so if old id don't show it");
// remember newest id depending on options set
- if(settingNewest&&settingEvenNonClicked&&(noteID > settingNewestID) )
- db_set_dw(NULL, PLUGINNAME, "LNNewestID", settingNewestID=noteID);
+ if (settingNewest&&settingEvenNonClicked && (noteID > settingNewestID))
+ db_set_dw(NULL, PLUGINNAME, "LNNewestID", settingNewestID = noteID);
//if(((!settingOnceOnly||(settingOnceOnly&&settingNonClickedOnly))&&existElem(noteID))||(settingNewest&&settingNewestID>=noteID))
- //continue;
+ //continue;
- if (error = (NSFNoteOpen1) (db_handle, noteID, 0, ¬e_handle)) {
+ if (error = (NSFNoteOpen1)(db_handle, noteID, 0, ¬e_handle)) {
continue;
}
log_p(L"checkthread: Opened Note: %d", noteID);
(NSFDbGetNoteInfo1)(db_handle, /* DBHANDLE */
- noteID, /* NOTEID */
- &retNoteOID, /* out: OID */
- &retModified, /* out: */
- &retNoteClass) ;
+ noteID, /* NOTEID */
+ &retNoteOID, /* out: OID */
+ &retModified, /* out: */
+ &retNoteClass);
memset(strLink, 0, sizeof(strLink));
mir_snprintf(strLink, "%.8lX%.8lX%.8lX%.8lX",
- retNoteOID.File.Innards[1],
- retNoteOID.File.Innards[0],
- retNoteOID.Note.Innards[1],
- retNoteOID.Note.Innards[0]
- );
+ retNoteOID.File.Innards[1],
+ retNoteOID.File.Innards[0],
+ retNoteOID.Note.Innards[1],
+ retNoteOID.Note.Innards[0]
+ );
log_p(L"checkthread: got noteInfo, built link: %S", strLink);
- field_len = (NSFItemGetText1) (note_handle, MAIL_FROM_ITEM, field_lotus_LMBCS, (WORD)sizeof(field_lotus_LMBCS));
+ field_len = (NSFItemGetText1)(note_handle, MAIL_FROM_ITEM, field_lotus_LMBCS, (WORD)sizeof(field_lotus_LMBCS));
(OSTranslate1)(OS_TRANSLATE_LMBCS_TO_UNICODE, field_lotus_LMBCS, field_len, field_lotus_UNICODEatCHAR, sizeof(field_lotus_UNICODEatCHAR));
memcpy(field_from_UNICODE, field_lotus_UNICODEatCHAR, field_len * sizeof(TCHAR));
field_from_UNICODE[field_len] = '\0';
- (NSFItemGetTime1) (note_handle,MAIL_POSTEDDATE_ITEM,&sendDate);
+ (NSFItemGetTime1)(note_handle, MAIL_POSTEDDATE_ITEM, &sendDate);
error = (ConvertTIMEDATEToText1)(NULL, NULL, &sendDate, field_date, MAXALPHATIMEDATE, &field_len);
field_date[field_len] = '\0';
- field_len = (NSFItemGetText1) (note_handle, MAIL_SUBJECT_ITEM, field_lotus_LMBCS, (WORD)sizeof(field_lotus_LMBCS));
+ field_len = (NSFItemGetText1)(note_handle, MAIL_SUBJECT_ITEM, field_lotus_LMBCS, (WORD)sizeof(field_lotus_LMBCS));
(OSTranslate1)(OS_TRANSLATE_LMBCS_TO_UNICODE, field_lotus_LMBCS, field_len, field_lotus_UNICODEatCHAR, sizeof(field_lotus_UNICODEatCHAR));
memcpy(field_subject_UNICODE, field_lotus_UNICODEatCHAR, field_len * sizeof(TCHAR));
field_subject_UNICODE[field_len] = '\0';
- field_len = (NSFItemGetText1) (note_handle, MAIL_SENDTO_ITEM, field_lotus_LMBCS, (WORD)sizeof (field_lotus_LMBCS));
+ field_len = (NSFItemGetText1)(note_handle, MAIL_SENDTO_ITEM, field_lotus_LMBCS, (WORD)sizeof(field_lotus_LMBCS));
(OSTranslate1)(OS_TRANSLATE_LMBCS_TO_UNICODE, field_lotus_LMBCS, field_len, field_lotus_UNICODEatCHAR, sizeof(field_lotus_UNICODEatCHAR));
memcpy(field_to_UNICODE, field_lotus_UNICODEatCHAR, field_len * sizeof(TCHAR));
field_to_UNICODE[field_len] = '\0';
- field_len = (NSFItemGetText1) (note_handle, MAIL_COPYTO_ITEM, field_lotus_LMBCS, (WORD)sizeof (field_lotus_LMBCS));
+ field_len = (NSFItemGetText1)(note_handle, MAIL_COPYTO_ITEM, field_lotus_LMBCS, (WORD)sizeof(field_lotus_LMBCS));
(OSTranslate1)(OS_TRANSLATE_LMBCS_TO_UNICODE, field_lotus_LMBCS, field_len, field_lotus_UNICODEatCHAR, sizeof(field_lotus_UNICODEatCHAR));
memcpy(field_copy_UNICODE, field_lotus_UNICODEatCHAR, field_len * sizeof(TCHAR));
field_copy_UNICODE[field_len] = '\0';
@@ -748,24 +748,24 @@ void checkthread(void*) memset(msgFrom, 0, sizeof(msgFrom));
memset(msgSubject, 0, sizeof(msgSubject));
- if(mir_wstrlen(field_from_UNICODE) < 512 && mir_wstrlen(field_from_UNICODE) > 3 && wcsstr(field_from_UNICODE, L"CN=") == field_from_UNICODE)
- _tcsncpy_s(msgFrom, &(field_from_UNICODE[3]), wcscspn(field_from_UNICODE, L"/")-3 );
+ if (mir_wstrlen(field_from_UNICODE) < 512 && mir_wstrlen(field_from_UNICODE) > 3 && wcsstr(field_from_UNICODE, L"CN=") == field_from_UNICODE)
+ _tcsncpy_s(msgFrom, &(field_from_UNICODE[3]), wcscspn(field_from_UNICODE, L"/") - 3);
else
_tcsncpy_s(msgFrom, field_from_UNICODE, _TRUNCATE);
- for (Att = 0; (MailGetMessageAttachmentInfo1)(note_handle, Att,&bhAttachment, NULL, &cSize, NULL, NULL, NULL, NULL); Att++)
+ for (Att = 0; (MailGetMessageAttachmentInfo1)(note_handle, Att, &bhAttachment, NULL, &cSize, NULL, NULL, NULL, NULL); Att++)
attSize += cSize;
- #ifdef _DEBUG
+#ifdef _DEBUG
log_p(L"checkthread: MAIL INFO: date=[%S], from=[%s], to=[%s], cc=[%s], sub=[%s], attSize=[%d]"
- ,field_date
- ,field_from_UNICODE
- ,field_to_UNICODE
- ,field_copy_UNICODE
- ,field_subject_UNICODE
- ,attSize
- );
- #else
+ , field_date
+ , field_from_UNICODE
+ , field_to_UNICODE
+ , field_copy_UNICODE
+ , field_subject_UNICODE
+ , attSize
+ );
+#else
//do not put private user data into log
log_p(L"checkthread: MAIL INFO (sizes): date=[%S], from=[%d], to=[%d], cc=[%d], sub=[%d], attSize=[%d]"
,field_date
@@ -774,45 +774,46 @@ void checkthread(void*) ,mir_wstrlen(field_copy_UNICODE)
,mir_wstrlen(field_subject_UNICODE)
,attSize
- );
- #endif
+ );
+#endif
- if(attSize){
+ if (attSize) {
WCHAR field_attachments_UNICODE[MAX_FIELD];
mir_sntprintf(field_attachments_UNICODE, _countof(field_attachments_UNICODE), TranslateW(L"Attachments: %d bytes"), attSize);
- mir_sntprintf(msgSubject, _countof(msgSubject), L"%S\n%s\n%s", field_date, field_subject_UNICODE, field_attachments_UNICODE );
- } else {
- mir_sntprintf(msgSubject, _countof(msgSubject), L"%S\n%s", field_date, field_subject_UNICODE );
+ mir_sntprintf(msgSubject, _countof(msgSubject), L"%S\n%s\n%s", field_date, field_subject_UNICODE, field_attachments_UNICODE);
+ }
+ else {
+ mir_sntprintf(msgSubject, _countof(msgSubject), L"%S\n%s", field_date, field_subject_UNICODE);
}
//check if this is not filtered msg
- if( ! checkFilters(field_from_UNICODE, 0)
- && ! checkFilters(field_subject_UNICODE, 1)
- && ! checkFilters(field_to_UNICODE, 2)
- && ! checkFilters(field_copy_UNICODE, 2))
- {
+ if (!checkFilters(field_from_UNICODE, 0)
+ && !checkFilters(field_subject_UNICODE, 1)
+ && !checkFilters(field_to_UNICODE, 2)
+ && !checkFilters(field_copy_UNICODE, 2)) {
log(L"checkthread: filters checked - positive");
///TODO eliminate popups with blank fields
- showMsg(msgFrom,msgSubject,noteID,strLink);
+ showMsg(msgFrom, msgSubject, noteID, strLink);
SkinPlaySound("LotusNotify");
- } else {
+ }
+ else {
log(L"checkthread: filters checked - negative");
}
- if (error = (NSFNoteClose1) (note_handle)) {
+ if (error = (NSFNoteClose1)(note_handle)) {
continue;
}
log_p(L"checkthread: Close note id: %d", noteID);
- }
+ }
- if(error = (IDDestroyTable1) (hTable)){
+ if (error = (IDDestroyTable1)(hTable)) {
goto errorblock0;
}
log(L"checkthread: Table destroyed");
- if (error = (NSFDbClose1) (db_handle)){
+ if (error = (NSFDbClose1)(db_handle)) {
goto errorblock;
}
log(L"checkthread: DB closed");
@@ -822,22 +823,22 @@ void checkthread(void*) log(L"checkthread: Terminating Notes thread");
running = FALSE;
- if(currentStatus != ID_STATUS_OFFLINE)
+ if (currentStatus != ID_STATUS_OFFLINE)
Menu_EnableItem(hMenuHandle, !running);
return;
errorblock0:
log(L"checkthread: errorblock0");
- (NSFDbClose1) (db_handle);
+ (NSFDbClose1)(db_handle);
errorblock:
log_p(L"checkthread: errorblock. error=%d", error);
ErMsgByLotusCode(error);
//NotesTerm();
// go offline if connection error occurs and let KeepStatus or other plugin managing reconnection
- if(!settingKeepConnection && currentStatus!=ID_STATUS_OFFLINE) {
- Menu_EnableItem(hMenuHandle,!running);
- SetStatus(ID_STATUS_OFFLINE,0);
+ if (!settingKeepConnection && currentStatus != ID_STATUS_OFFLINE) {
+ Menu_EnableItem(hMenuHandle, !running);
+ SetStatus(ID_STATUS_OFFLINE, 0);
}
running = FALSE;
@@ -846,7 +847,7 @@ errorblock: //hooked notification from service that listning to check lotus
-static int eventCheck(WPARAM,LPARAM)
+static int eventCheck(WPARAM, LPARAM)
{
log(L"check event...");
check();
@@ -867,10 +868,10 @@ void CALLBACK atTime(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) {
log(L"atTime: start");
BOOL b = KillTimer(hTimerWnd, idEvent);
- if(currentStatus != ID_STATUS_OFFLINE) {
+ if (currentStatus != ID_STATUS_OFFLINE) {
//if status lets to check
check();
- if(settingInterval != 0){
+ if (settingInterval != 0) {
log_p(L"atTime: SetTimer settingInterval=%d", settingInterval * 60000);
SetTimer(hTimerWnd, TID, settingInterval * 60000, atTime);
}
@@ -880,11 +881,11 @@ void CALLBACK atTime(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) void decodeServer(char *tmp)
{
- if (strstr(tmp,"CN=") && strstr(tmp,"OU=") && strstr(tmp,"O=")) {
+ if (strstr(tmp, "CN=") && strstr(tmp, "OU=") && strstr(tmp, "O=")) {
//if lotus convention
- while(strrep(tmp,"CN=",""));
- while(strrep(tmp,"OU=",""));
- while(strrep(tmp,"O=",""));
+ while (strrep(tmp, "CN=", ""));
+ while (strrep(tmp, "OU=", ""));
+ while (strrep(tmp, "O=", ""));
}
}
@@ -892,7 +893,7 @@ void decodeServer(char *tmp) //fill combo in options dlgbox with all known servers
void fillServersList(HWND hwndDlg)
{
- HANDLE hServerList=NULLHANDLE;
+ HANDLE hServerList = NULLHANDLE;
BYTE far *pServerList; /* Pointer to start of Server List */
WORD wServerCount; /* Number of servers in list. */
WORD far *pwServerLength; /* Index to array of servername lens */
@@ -902,31 +903,31 @@ void fillServersList(HWND hwndDlg) LPSTR szServerString = ServerString;
USHORT i;
- if(!hLotusDll) {
+ if (!hLotusDll) {
return;
}
error = (NSGetServerList1)(NULL, &hServerList);
if (error == NOERROR) {
- pServerList = (BYTE far *)(OSLockObject1)(hServerList);
- wServerCount = (WORD) *pServerList;
+ pServerList = (BYTE far *)(OSLockObject1)(hServerList);
+ wServerCount = (WORD)*pServerList;
pwServerLength = (WORD *)(pServerList + sizeof(WORD));
- pServerName = (BYTE far *) pServerList + sizeof(wServerCount) +((wServerCount) * sizeof(WORD));
+ pServerName = (BYTE far *) pServerList + sizeof(wServerCount) + ((wServerCount)* sizeof(WORD));
- for (i=0; i<wServerCount; pServerName+=pwServerLength[i], i++)
- {
- memmove (szServerString, pServerName, pwServerLength[i]);
+ for (i = 0; i < wServerCount; pServerName += pwServerLength[i], i++) {
+ memmove(szServerString, pServerName, pwServerLength[i]);
szServerString[pwServerLength[i]] = '\0';
decodeServer(ServerString);
SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)szServerString);
}
- (OSUnlockObject1) (hServerList);
- (OSMemFree1) (hServerList);
+ (OSUnlockObject1)(hServerList);
+ (OSMemFree1)(hServerList);
- } else {
+ }
+ else {
ErMsgByLotusCode(error);
}
@@ -937,12 +938,12 @@ void fillServersList(HWND hwndDlg) //gets default settings from notes.ini file
void lookupLotusDefaultSettings(HWND hwndDlg)
{
- char tmp[MAXENVVALUE+1];
+ char tmp[MAXENVVALUE + 1];
// Get the info from the .ini file
- if(hLotusDll) {
- if ((OSGetEnvironmentString1) ("MailFile", tmp, MAXENVVALUE)) //path to mail file
+ if (hLotusDll) {
+ if ((OSGetEnvironmentString1)("MailFile", tmp, MAXENVVALUE)) //path to mail file
SetDlgItemTextA(hwndDlg, IDC_DATABASE, tmp); //and set fields in opt. dialog
- if ((OSGetEnvironmentString1) ("MailServer", tmp, MAXENVVALUE)) //server name
+ if ((OSGetEnvironmentString1)("MailServer", tmp, MAXENVVALUE)) //server name
{
decodeServer(tmp);
SetDlgItemTextA(hwndDlg, IDC_SERVER, tmp);
@@ -959,45 +960,45 @@ void LoadSettings() settingKeepConnection = db_get_b(NULL, PLUGINNAME, "LNKeepConnection", 1);
DBVARIANT dbv;
- if(!db_get_s(NULL, PLUGINNAME, "LNDatabase", &dbv)){
+ if (!db_get_s(NULL, PLUGINNAME, "LNDatabase", &dbv)) {
strncpy_s(settingDatabase, _countof(settingDatabase), dbv.pszVal, _countof(settingDatabase));
db_free(&dbv);
}
- if(!db_get_s(NULL, PLUGINNAME, "LNServer", &dbv)) {
+ if (!db_get_s(NULL, PLUGINNAME, "LNServer", &dbv)) {
strncpy_s(settingServer, _countof(settingServer), dbv.pszVal, _countof(settingServer));
db_free(&dbv);
}
- if(!db_get_s(NULL, PLUGINNAME, "LNServerSec", &dbv)) {
+ if (!db_get_s(NULL, PLUGINNAME, "LNServerSec", &dbv)) {
strncpy_s(settingServerSec, _countof(settingServerSec), dbv.pszVal, _countof(settingServerSec));
db_free(&dbv);
}
- if(!db_get(NULL, PLUGINNAME, "LNPassword", &dbv)) {
+ if (!db_get(NULL, PLUGINNAME, "LNPassword", &dbv)) {
strncpy_s(settingPassword, _countof(settingPassword), dbv.pszVal, _countof(settingPassword));
db_free(&dbv);
}
- if(!db_get_s(NULL, PLUGINNAME, "LNCommand", &dbv, DBVT_ASCIIZ)) {
+ if (!db_get_s(NULL, PLUGINNAME, "LNCommand", &dbv, DBVT_ASCIIZ)) {
strncpy_s(settingCommand, _countof(settingCommand), dbv.pszVal, _countof(settingCommand));
db_free(&dbv);
}
- if(!db_get_s(NULL, PLUGINNAME, "LNParameters", &dbv, DBVT_ASCIIZ)) {
+ if (!db_get_s(NULL, PLUGINNAME, "LNParameters", &dbv, DBVT_ASCIIZ)) {
strncpy_s(settingParameters, _countof(settingParameters), dbv.pszVal, _countof(settingParameters));
db_free(&dbv);
}
- if(!db_get_ts(NULL, PLUGINNAME, "LNFilterSender",&dbv)) {
+ if (!db_get_ts(NULL, PLUGINNAME, "LNFilterSender", &dbv)) {
_tcsncpy_s(settingFilterSender, dbv.ptszVal, _TRUNCATE);
db_free(&dbv);
}
- if(!db_get_ts(NULL, PLUGINNAME, "LNFilterSubject",&dbv)) {
+ if (!db_get_ts(NULL, PLUGINNAME, "LNFilterSubject", &dbv)) {
_tcsncpy_s(settingFilterSubject, dbv.ptszVal, _TRUNCATE);
db_free(&dbv);
}
- if(!db_get_ts(NULL, PLUGINNAME, "LNFilterTo",&dbv)) {
+ if (!db_get_ts(NULL, PLUGINNAME, "LNFilterTo", &dbv)) {
_tcsncpy_s(settingFilterTo, dbv.ptszVal, _TRUNCATE);
db_free(&dbv);
}
- settingOnceOnly = db_get_b (NULL, PLUGINNAME, "LNOnceOnly",0);
+ settingOnceOnly = db_get_b(NULL, PLUGINNAME, "LNOnceOnly", 0);
settingNonClickedOnly = db_get_b(NULL, PLUGINNAME, "LNNonClickedOnly", 1);
settingShowError = db_get_b(NULL, PLUGINNAME, "LNShowError", 1);
@@ -1009,8 +1010,8 @@ void LoadSettings() settingNewestID = (DWORD)db_get_dw(NULL, PLUGINNAME, "LNNewestID", 0);
settingIniAnswer = db_get_b(NULL, PLUGINNAME, "LNIniAnswer", 0);
settingIniCheck = db_get_b(NULL, PLUGINNAME, "LNIniCheck", 0);
-
- for(int i = 0; i < STATUS_COUNT; i++) {
+
+ for (int i = 0; i < STATUS_COUNT; i++) {
char buff[128];
mir_snprintf(buff, "LNStatus%d", i);
settingStatus[i] = (db_get_b(0, PLUGINNAME, buff, 0) == 1);
@@ -1020,459 +1021,435 @@ void LoadSettings() void SaveSettings(HWND hwndDlg)
{
- char buff[128];
- GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, _countof(settingServer));
- db_set_s(NULL, PLUGINNAME, "LNServer", settingServer );
- db_set_s(NULL, PLUGINNAME, "LNServerSec", settingServerSec);
- db_set_s(NULL, PLUGINNAME, "LNPassword", settingPassword);
- db_set_s(NULL, PLUGINNAME, "LNDatabase", settingDatabase);
- db_set_dw (NULL, PLUGINNAME, "LNInterval", settingInterval);
- db_set_dw (NULL, PLUGINNAME, "LNInterval1", settingInterval1);
- db_set_b(NULL, PLUGINNAME, "LNKeepConnection", settingKeepConnection);
- db_set_s(NULL, PLUGINNAME, "LNCommand", settingCommand );
- db_set_s(NULL, PLUGINNAME, "LNParameters", settingParameters);
- db_set_b(NULL, PLUGINNAME, "LNOnceOnly", settingOnceOnly);
- db_set_b(NULL, PLUGINNAME, "LNNonClickedOnly", settingNonClickedOnly);
- db_set_b(NULL, PLUGINNAME, "LNShowError", settingShowError);
- db_set_b(NULL, PLUGINNAME, "LNSetColours", settingSetColours);
- db_set_dw(NULL, PLUGINNAME, "LNBgColor", (DWORD)settingBgColor);
- db_set_dw(NULL, PLUGINNAME, "LNFgColor", (DWORD)settingFgColor);
- db_set_b(NULL, PLUGINNAME, "LNNewest", settingNewest);
- db_set_b(NULL, PLUGINNAME, "LNEvenNonClicked", settingEvenNonClicked);
- db_set_b(NULL, PLUGINNAME, "LNIniCheck", settingIniCheck);
- db_set_b(NULL, PLUGINNAME, "LNIniAnswer", settingIniAnswer);
-
- for(int i = 0; i < STATUS_COUNT ; i++){
- mir_snprintf(buff, "LNStatus%d", i);
- settingStatus[i] = (ListView_GetCheckState(GetDlgItem(hwndDlg, IDC_STATUS), i) ? TRUE : FALSE);
- db_set_b(0, PLUGINNAME, buff, settingStatus[i] ? 1 : 0);
- }
+ char buff[128];
+ GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, _countof(settingServer));
+ db_set_s(NULL, PLUGINNAME, "LNServer", settingServer);
+ db_set_s(NULL, PLUGINNAME, "LNServerSec", settingServerSec);
+ db_set_s(NULL, PLUGINNAME, "LNPassword", settingPassword);
+ db_set_s(NULL, PLUGINNAME, "LNDatabase", settingDatabase);
+ db_set_dw(NULL, PLUGINNAME, "LNInterval", settingInterval);
+ db_set_dw(NULL, PLUGINNAME, "LNInterval1", settingInterval1);
+ db_set_b(NULL, PLUGINNAME, "LNKeepConnection", settingKeepConnection);
+ db_set_s(NULL, PLUGINNAME, "LNCommand", settingCommand);
+ db_set_s(NULL, PLUGINNAME, "LNParameters", settingParameters);
+ db_set_b(NULL, PLUGINNAME, "LNOnceOnly", settingOnceOnly);
+ db_set_b(NULL, PLUGINNAME, "LNNonClickedOnly", settingNonClickedOnly);
+ db_set_b(NULL, PLUGINNAME, "LNShowError", settingShowError);
+ db_set_b(NULL, PLUGINNAME, "LNSetColours", settingSetColours);
+ db_set_dw(NULL, PLUGINNAME, "LNBgColor", (DWORD)settingBgColor);
+ db_set_dw(NULL, PLUGINNAME, "LNFgColor", (DWORD)settingFgColor);
+ db_set_b(NULL, PLUGINNAME, "LNNewest", settingNewest);
+ db_set_b(NULL, PLUGINNAME, "LNEvenNonClicked", settingEvenNonClicked);
+ db_set_b(NULL, PLUGINNAME, "LNIniCheck", settingIniCheck);
+ db_set_b(NULL, PLUGINNAME, "LNIniAnswer", settingIniAnswer);
+
+ for (int i = 0; i < STATUS_COUNT; i++) {
+ mir_snprintf(buff, "LNStatus%d", i);
+ settingStatus[i] = (ListView_GetCheckState(GetDlgItem(hwndDlg, IDC_STATUS), i) ? TRUE : FALSE);
+ db_set_b(0, PLUGINNAME, buff, settingStatus[i] ? 1 : 0);
+ }
- settingFilterSender[0] = 0;
- for(int i=0; i<SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER, CB_GETCOUNT, 0, 0); i++){
- TCHAR text[512] = TEXT("");
- SendDlgItemMessage(hwndDlg,IDC_FILTER_SENDER ,CB_GETLBTEXT,(WPARAM)i,(LPARAM)text);
- _tcscat_s(settingFilterSender, _countof(settingFilterSender), text);
- _tcscat_s(settingFilterSender, _countof(settingFilterSender), TEXT(";"));
- }
- db_set_ts(NULL, PLUGINNAME, "LNFilterSender", settingFilterSender);
-
- settingFilterSubject[0] = 0;
- for(int i=0; i<SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_GETCOUNT, 0, 0); i++){
- TCHAR text[512] = TEXT("");
- SendDlgItemMessage(hwndDlg,IDC_FILTER_SUBJECT ,CB_GETLBTEXT,(WPARAM)i,(LPARAM)text);
- _tcscat_s(settingFilterSubject, _countof(settingFilterSubject), text);
- _tcscat_s(settingFilterSubject, _countof(settingFilterSubject), TEXT(";"));
- }
- db_set_ts(NULL, PLUGINNAME, "LNFilterSubject", settingFilterSubject);
-
- settingFilterTo[0] = 0;
- for(int i=0; i<SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_GETCOUNT, 0, 0); i++){
- TCHAR text[512] = TEXT("");
- SendDlgItemMessage(hwndDlg,IDC_FILTER_TO ,CB_GETLBTEXT,(WPARAM)i,(LPARAM)text);
- _tcscat_s(settingFilterTo, _countof(settingFilterTo), text);
- _tcscat_s(settingFilterTo, _countof(settingFilterTo), TEXT(";"));
- }
- db_set_ts(NULL, PLUGINNAME, "LNFilterTo", settingFilterTo);
+ settingFilterSender[0] = 0;
+ for (int i = 0; i < SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER, CB_GETCOUNT, 0, 0); i++) {
+ TCHAR text[512] = TEXT("");
+ SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER, CB_GETLBTEXT, (WPARAM)i, (LPARAM)text);
+ _tcscat_s(settingFilterSender, _countof(settingFilterSender), text);
+ _tcscat_s(settingFilterSender, _countof(settingFilterSender), TEXT(";"));
+ }
+ db_set_ts(NULL, PLUGINNAME, "LNFilterSender", settingFilterSender);
+
+ settingFilterSubject[0] = 0;
+ for (int i = 0; i < SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_GETCOUNT, 0, 0); i++) {
+ TCHAR text[512] = TEXT("");
+ SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_GETLBTEXT, (WPARAM)i, (LPARAM)text);
+ _tcscat_s(settingFilterSubject, _countof(settingFilterSubject), text);
+ _tcscat_s(settingFilterSubject, _countof(settingFilterSubject), TEXT(";"));
+ }
+ db_set_ts(NULL, PLUGINNAME, "LNFilterSubject", settingFilterSubject);
+
+ settingFilterTo[0] = 0;
+ for (int i = 0; i < SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_GETCOUNT, 0, 0); i++) {
+ TCHAR text[512] = TEXT("");
+ SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_GETLBTEXT, (WPARAM)i, (LPARAM)text);
+ _tcscat_s(settingFilterTo, _countof(settingFilterTo), text);
+ _tcscat_s(settingFilterTo, _countof(settingFilterTo), TEXT(";"));
+ }
+ db_set_ts(NULL, PLUGINNAME, "LNFilterTo", settingFilterTo);
}
//callback function to speak with user interactions in options page
INT_PTR CALLBACK DlgProcLotusNotifyConnectionOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- static bool bInit = false;
-
- int i;
- char text[MAXENVVALUE];
- switch(msg)
- {
- case WM_INITDIALOG://initialize dialog, so set properties from db.
- bInit = true;
- TranslateDialogDefault(hwndDlg);//translate miranda function
- LoadSettings();
- CheckDlgButton(hwndDlg, IDC_BUTTON_CHECK, settingIniCheck ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer);
- SetDlgItemTextA(hwndDlg, IDC_SERVERSEC, settingServerSec);
- SetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase);
- SetDlgItemTextA(hwndDlg, IDC_PASSWORD, settingPassword);
- SetDlgItemInt(hwndDlg, IDC_INTERVAL, settingInterval,FALSE);
- CheckDlgButton(hwndDlg, IDC_KEEP_CONNEXION_ON_ERROR, settingKeepConnection ? BST_CHECKED : BST_UNCHECKED);
- bInit = false;
- break;
-
- case WM_COMMAND://user changed something, so get changes to variables
- if (!bInit)
- {
- switch (HIWORD(wParam))
- {
- case EN_CHANGE: // text is modified in an edit ctrl
- case BN_CLICKED: // a checkbox is modified
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- }
- switch(LOWORD(wParam))
- {
- case IDC_BUTTON_DETECT:
- lookupLotusDefaultSettings(hwndDlg);
- GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, _countof(settingServer));
- GetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase, _countof(settingDatabase));
- break;
- case IDC_BUTTON_CHECK:
- settingIniCheck = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BUTTON_CHECK);
- checkNotesIniFile(TRUE);
- break;
- case IDC_DATABASE:
- GetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase, _countof(settingDatabase));
- break;
- case IDC_SERVER:
- switch(HIWORD(wParam))
- {
- case CBN_SELCHANGE:
- i=SendDlgItemMessage(hwndDlg,IDC_SERVER,CB_GETCURSEL,0,0);
- SendDlgItemMessageA(hwndDlg,IDC_SERVER,CB_GETLBTEXT,(WPARAM)i,(LPARAM)text);
- SetDlgItemTextA(hwndDlg,IDC_SERVER,text);
- if (!bInit)
- {
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
-
- case CBN_DROPDOWN:
- SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_RESETCONTENT ,0, 0);
- fillServersList(hwndDlg);
- SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)settingServer);
- SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_SELECTSTRING , -1, (LPARAM)settingServer);
- break;
- }
- break;
- case IDC_SERVERSEC:
- GetDlgItemTextA(hwndDlg, IDC_SERVERSEC, settingServerSec, _countof(settingServerSec));
- break;
- case IDC_PASSWORD:
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, settingPassword, _countof(settingPassword));
- break;
- case IDC_INTERVAL:
- settingInterval = GetDlgItemInt(hwndDlg, IDC_INTERVAL, NULL, FALSE);
- break;
- case IDC_KEEP_CONNEXION_ON_ERROR:
- settingKeepConnection = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_KEEP_CONNEXION_ON_ERROR);
- break;
- }
- break;
-
- case WM_NOTIFY://apply changes so write it to db
- switch(((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_RESET:
- LoadSettings();
- return TRUE;
-
- case PSN_APPLY:
- SaveSettings(hwndDlg);
- return TRUE;
- }
- break;
- } //id from
-
- break; //switch(msg)
+ static bool bInit = false;
+
+ int i;
+ char text[MAXENVVALUE];
+ switch (msg) {
+ case WM_INITDIALOG://initialize dialog, so set properties from db.
+ bInit = true;
+ TranslateDialogDefault(hwndDlg);//translate miranda function
+ LoadSettings();
+ CheckDlgButton(hwndDlg, IDC_BUTTON_CHECK, settingIniCheck ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer);
+ SetDlgItemTextA(hwndDlg, IDC_SERVERSEC, settingServerSec);
+ SetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase);
+ SetDlgItemTextA(hwndDlg, IDC_PASSWORD, settingPassword);
+ SetDlgItemInt(hwndDlg, IDC_INTERVAL, settingInterval, FALSE);
+ CheckDlgButton(hwndDlg, IDC_KEEP_CONNEXION_ON_ERROR, settingKeepConnection ? BST_CHECKED : BST_UNCHECKED);
+ bInit = false;
+ break;
- }
- return FALSE;
+ case WM_COMMAND://user changed something, so get changes to variables
+ if (!bInit) {
+ switch (HIWORD(wParam)) {
+ case EN_CHANGE: // text is modified in an edit ctrl
+ case BN_CLICKED: // a checkbox is modified
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ }
+ switch (LOWORD(wParam)) {
+ case IDC_BUTTON_DETECT:
+ lookupLotusDefaultSettings(hwndDlg);
+ GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, _countof(settingServer));
+ GetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase, _countof(settingDatabase));
+ break;
+ case IDC_BUTTON_CHECK:
+ settingIniCheck = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BUTTON_CHECK);
+ checkNotesIniFile(TRUE);
+ break;
+ case IDC_DATABASE:
+ GetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase, _countof(settingDatabase));
+ break;
+ case IDC_SERVER:
+ switch (HIWORD(wParam)) {
+ case CBN_SELCHANGE:
+ i = SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_GETCURSEL, 0, 0);
+ SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_GETLBTEXT, (WPARAM)i, (LPARAM)text);
+ SetDlgItemTextA(hwndDlg, IDC_SERVER, text);
+ if (!bInit) {
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case CBN_DROPDOWN:
+ SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_RESETCONTENT, 0, 0);
+ fillServersList(hwndDlg);
+ SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)settingServer);
+ SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_SELECTSTRING, -1, (LPARAM)settingServer);
+ break;
+ }
+ break;
+ case IDC_SERVERSEC:
+ GetDlgItemTextA(hwndDlg, IDC_SERVERSEC, settingServerSec, _countof(settingServerSec));
+ break;
+ case IDC_PASSWORD:
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, settingPassword, _countof(settingPassword));
+ break;
+ case IDC_INTERVAL:
+ settingInterval = GetDlgItemInt(hwndDlg, IDC_INTERVAL, NULL, FALSE);
+ break;
+ case IDC_KEEP_CONNEXION_ON_ERROR:
+ settingKeepConnection = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_KEEP_CONNEXION_ON_ERROR);
+ break;
+ }
+ break;
+
+ case WM_NOTIFY://apply changes so write it to db
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_RESET:
+ LoadSettings();
+ return TRUE;
+
+ case PSN_APPLY:
+ SaveSettings(hwndDlg);
+ return TRUE;
+ }
+ break;
+ } //id from
+
+ break; //switch(msg)
+
+ }
+ return FALSE;
}
INT_PTR CALLBACK DlgProcLotusNotifyPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- static bool bInit = false;
-
- switch(msg)
- {
- case WM_INITDIALOG://initialize dialog, so set properties from db.
- bInit = true;
- TranslateDialogDefault(hwndDlg);//translate miranda function
- LoadSettings();
-
- CheckDlgButton(hwndDlg, IDC_SETCOLOURS, settingSetColours ? BST_CHECKED : BST_UNCHECKED);
- SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_SETCOLOUR, 0, (LPARAM)settingBgColor);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BGCOLOR), settingSetColours!=0);
- SendDlgItemMessage(hwndDlg, IDC_FGCOLOR, CPM_SETCOLOUR, 0, (LPARAM)settingFgColor);
- EnableWindow(GetDlgItem(hwndDlg, IDC_FGCOLOR), settingSetColours!=0);
-
- SetDlgItemInt(hwndDlg, IDC_INTERVAL1, settingInterval1,TRUE);
- CheckDlgButton(hwndDlg, IDC_ONCEONLY, settingOnceOnly ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NONCLICKEDONLY, settingNonClickedOnly ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_NONCLICKEDONLY), settingOnceOnly!=0);
- CheckDlgButton(hwndDlg, IDC_SHOWERROR, settingShowError ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NEWEST, settingNewest ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_REMEMBEREVENNONCLICKED, settingEvenNonClicked ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMEMBEREVENNONCLICKED), settingNewest!=0);
- SetDlgItemTextA(hwndDlg, IDC_COMMAND, settingCommand);
- SetDlgItemTextA(hwndDlg, IDC_PARAMETERS, settingParameters);
-
- bInit = FALSE;
- break;
-
- case WM_COMMAND://user changed something, so get changes to variables
- if (!bInit)
- {
- switch (HIWORD(wParam))
- {
- case EN_CHANGE: // text is modified in an edit ctrl
- case BN_CLICKED: // a checkbox is modified
- case CPN_COLOURCHANGED: // a color has changed
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- }
- switch(LOWORD(wParam))
- {
- case IDC_SETCOLOURS:
- settingSetColours=IsDlgButtonChecked(hwndDlg, IDC_SETCOLOURS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BGCOLOR), settingSetColours );
- EnableWindow(GetDlgItem(hwndDlg, IDC_FGCOLOR), settingSetColours);
- break;
- case IDC_BGCOLOR:
- settingBgColor = (COLORREF)SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0);
- break;
- case IDC_FGCOLOR:
- settingFgColor = (COLORREF)SendDlgItemMessage(hwndDlg, IDC_FGCOLOR, CPM_GETCOLOUR, 0, 0);
- break;
- case IDC_INTERVAL1:
- settingInterval1 = GetDlgItemInt(hwndDlg, IDC_INTERVAL1, NULL, TRUE);
- break;
- case IDC_ONCEONLY:
- settingOnceOnly=(BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONCEONLY);
- EnableWindow(GetDlgItem(hwndDlg, IDC_NONCLICKEDONLY), settingOnceOnly);
- break;
- case IDC_NONCLICKEDONLY:
- settingNonClickedOnly = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NONCLICKEDONLY);
- break;
- case IDC_SHOWERROR:
- settingShowError = (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWERROR);
- break;
- case IDC_NEWEST:
- settingNewest =(BYTE) IsDlgButtonChecked(hwndDlg, IDC_NEWEST);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMEMBEREVENNONCLICKED), settingNewest);
- break;
- case IDC_REMEMBEREVENNONCLICKED:
- settingEvenNonClicked = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_REMEMBEREVENNONCLICKED);
- break;
- case IDC_COMMAND:
- GetDlgItemTextA(hwndDlg, IDC_COMMAND, settingCommand, _countof(settingCommand));
- break;
- case IDC_PARAMETERS:
- GetDlgItemTextA(hwndDlg, IDC_PARAMETERS, settingParameters, _countof(settingParameters));
- break;
- case IDC_BUTTON_CLEAR:
- deleteElements();
- break;
- }
- break;
-
- case WM_NOTIFY://apply changes so write it to db
- switch(((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- {
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_RESET:
- LoadSettings();
- return TRUE;
- case PSN_APPLY:
- SaveSettings(hwndDlg);
-
- return TRUE;
- break;
- }
- //KillTimer(hTimerWnd,TID);
- //if(settingInterval!=0)
- // SetTimer(hTimerWnd, TID, settingInterval*60000, (TIMERPROC)atTime);
-
- break;
- } //case 0
- } //id from
-
- break; //switch(msg)
+ static bool bInit = false;
+
+ switch (msg) {
+ case WM_INITDIALOG://initialize dialog, so set properties from db.
+ bInit = true;
+ TranslateDialogDefault(hwndDlg);//translate miranda function
+ LoadSettings();
+
+ CheckDlgButton(hwndDlg, IDC_SETCOLOURS, settingSetColours ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_SETCOLOUR, 0, (LPARAM)settingBgColor);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BGCOLOR), settingSetColours != 0);
+ SendDlgItemMessage(hwndDlg, IDC_FGCOLOR, CPM_SETCOLOUR, 0, (LPARAM)settingFgColor);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FGCOLOR), settingSetColours != 0);
+
+ SetDlgItemInt(hwndDlg, IDC_INTERVAL1, settingInterval1, TRUE);
+ CheckDlgButton(hwndDlg, IDC_ONCEONLY, settingOnceOnly ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_NONCLICKEDONLY, settingNonClickedOnly ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_NONCLICKEDONLY), settingOnceOnly != 0);
+ CheckDlgButton(hwndDlg, IDC_SHOWERROR, settingShowError ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_NEWEST, settingNewest ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_REMEMBEREVENNONCLICKED, settingEvenNonClicked ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_REMEMBEREVENNONCLICKED), settingNewest != 0);
+ SetDlgItemTextA(hwndDlg, IDC_COMMAND, settingCommand);
+ SetDlgItemTextA(hwndDlg, IDC_PARAMETERS, settingParameters);
+
+ bInit = FALSE;
+ break;
- }
- return FALSE;
+ case WM_COMMAND://user changed something, so get changes to variables
+ if (!bInit) {
+ switch (HIWORD(wParam)) {
+ case EN_CHANGE: // text is modified in an edit ctrl
+ case BN_CLICKED: // a checkbox is modified
+ case CPN_COLOURCHANGED: // a color has changed
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ }
+ switch (LOWORD(wParam)) {
+ case IDC_SETCOLOURS:
+ settingSetColours = IsDlgButtonChecked(hwndDlg, IDC_SETCOLOURS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BGCOLOR), settingSetColours);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FGCOLOR), settingSetColours);
+ break;
+ case IDC_BGCOLOR:
+ settingBgColor = (COLORREF)SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0);
+ break;
+ case IDC_FGCOLOR:
+ settingFgColor = (COLORREF)SendDlgItemMessage(hwndDlg, IDC_FGCOLOR, CPM_GETCOLOUR, 0, 0);
+ break;
+ case IDC_INTERVAL1:
+ settingInterval1 = GetDlgItemInt(hwndDlg, IDC_INTERVAL1, NULL, TRUE);
+ break;
+ case IDC_ONCEONLY:
+ settingOnceOnly = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONCEONLY);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_NONCLICKEDONLY), settingOnceOnly);
+ break;
+ case IDC_NONCLICKEDONLY:
+ settingNonClickedOnly = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NONCLICKEDONLY);
+ break;
+ case IDC_SHOWERROR:
+ settingShowError = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWERROR);
+ break;
+ case IDC_NEWEST:
+ settingNewest = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NEWEST);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_REMEMBEREVENNONCLICKED), settingNewest);
+ break;
+ case IDC_REMEMBEREVENNONCLICKED:
+ settingEvenNonClicked = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_REMEMBEREVENNONCLICKED);
+ break;
+ case IDC_COMMAND:
+ GetDlgItemTextA(hwndDlg, IDC_COMMAND, settingCommand, _countof(settingCommand));
+ break;
+ case IDC_PARAMETERS:
+ GetDlgItemTextA(hwndDlg, IDC_PARAMETERS, settingParameters, _countof(settingParameters));
+ break;
+ case IDC_BUTTON_CLEAR:
+ deleteElements();
+ break;
+ }
+ break;
+
+ case WM_NOTIFY://apply changes so write it to db
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ {
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_RESET:
+ LoadSettings();
+ return TRUE;
+ case PSN_APPLY:
+ SaveSettings(hwndDlg);
+
+ return TRUE;
+ break;
+ }
+ //KillTimer(hTimerWnd,TID);
+ //if(settingInterval!=0)
+ // SetTimer(hTimerWnd, TID, settingInterval*60000, (TIMERPROC)atTime);
+
+ break;
+ } //case 0
+ } //id from
+
+ break; //switch(msg)
+
+ }
+ return FALSE;
}
INT_PTR CALLBACK DlgProcLotusNotifyMiscOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- static bool bInit = false;
-
- HWND hwndList;
- TCHAR buff[512];
- char tmp[255];
- int index, size;
- TCHAR* strptr;
- LVITEM lvI={0};
- LVCOLUMN lvc={0};
- switch(msg)
- {
- case WM_INITDIALOG://initialize dialog, so set properties from db.
- bInit = true;
- TranslateDialogDefault(hwndDlg);//translate miranda function
- LoadSettings();
-
- //fill filter combos
-
- _tcsncpy_s(buff, settingFilterSender, _TRUNCATE);
- while(strptr = _tcschr(buff, TEXT(';'))) {
- TCHAR tmp[512] = TEXT("");
- _tcsncpy_s(tmp, buff, (strptr-buff));
- SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER , CB_ADDSTRING, 0, (LPARAM)tmp);
- _tcsncpy_s(buff, strptr + 1, _TRUNCATE);
- }
-
- _tcsncpy_s(buff, settingFilterSubject, _TRUNCATE);
- while(strptr = _tcschr(buff, TEXT(';'))) {
- TCHAR tmp[512] = TEXT("");
- _tcsncpy_s(tmp, buff, (strptr-buff));
- SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT , CB_ADDSTRING, 0, (LPARAM)tmp);
- _tcsncpy_s(buff, strptr + 1, _TRUNCATE);
- }
-
- _tcsncpy_s(buff, settingFilterTo, _TRUNCATE);
- while(strptr = _tcschr(buff, TEXT(';'))) {
- TCHAR tmp[512] = TEXT("");
- _tcsncpy_s(tmp, buff, (strptr-buff));
- SendDlgItemMessage(hwndDlg, IDC_FILTER_TO , CB_ADDSTRING, 0, (LPARAM)tmp);
- _tcsncpy_s(buff, strptr + 1, _TRUNCATE);
- }
-
- // initialise and fill listbox
- hwndList = GetDlgItem(hwndDlg, IDC_STATUS);
- ListView_DeleteAllItems(hwndList);
-
- SendMessage(hwndList,LVM_SETEXTENDEDLISTVIEWSTYLE, 0,LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
-
- // Initialize the LVCOLUMN structure.
- // The mask specifies that the format, width, text, and
- // subitem members of the structure are valid.
- lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
- lvc.fmt = LVCFMT_LEFT;
-
- lvc.iSubItem = 0;
- lvc.pszText = TranslateT("Status");
- lvc.cx = 120; // width of column in pixels
- ListView_InsertColumn(hwndList, 0, &lvc);
-
- // Some code to create the list-view control.
- // Initialize LVITEM members that are common to all items.
- lvI.mask = LVIF_TEXT;
- for(int i = 0; i < STATUS_COUNT; i++) {
- lvI.pszText = pcli->pfnGetStatusModeDescription(ID_STATUS_ONLINE + i, 0);
- lvI.iItem = i;
- ListView_InsertItem(hwndList, &lvI);
- ListView_SetCheckState(hwndList, i, settingStatus[i]);
- }
-
- bInit = false;
- break;
-
- case WM_COMMAND://user changed something, so get changes to variables
- if (!bInit && (HIWORD(wParam) == EN_CHANGE))
- {
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- switch(LOWORD(wParam))
- {
- case IDC_BUTTON_ADD_SENDER_FILTER:
- GetDlgItemTextA(hwndDlg, IDC_FILTER_SENDER, tmp, _countof(tmp));
- if (strlen(tmp) > 0)
- {
- SendDlgItemMessageA(hwndDlg, IDC_FILTER_SENDER, CB_ADDSTRING, 0, (LPARAM)tmp);
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
- case IDC_BUTTON_REMOVE_SENDER_FILTER:
- index = SendDlgItemMessage(hwndDlg,IDC_FILTER_SENDER ,CB_GETCURSEL,0,0);
- size = SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER, CB_DELETESTRING, index, 0);
- SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER, CB_SETCURSEL, min(index, size-1), 0);
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_BUTTON_ADD_SUBJECT_FILTER:
- GetDlgItemTextA(hwndDlg, IDC_FILTER_SUBJECT, tmp, _countof(tmp));
- if (strlen(tmp) > 0)
- {
- SendDlgItemMessageA(hwndDlg, IDC_FILTER_SUBJECT, CB_ADDSTRING, 0, (LPARAM)tmp);
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
- case IDC_BUTTON_REMOVE_SUBJECT_FILTER:
- index = SendDlgItemMessage(hwndDlg,IDC_FILTER_SUBJECT ,CB_GETCURSEL,0,0);
- size = SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_DELETESTRING, index, 0);
- SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_SETCURSEL, min(index, size-1), 0);
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_BUTTON_ADD_TO_FILTER:
- GetDlgItemTextA(hwndDlg, IDC_FILTER_TO, tmp, _countof(tmp));
- if (strlen(tmp) > 0)
- {
- SendDlgItemMessageA(hwndDlg, IDC_FILTER_TO, CB_ADDSTRING, 0, (LPARAM)tmp);
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
- case IDC_BUTTON_REMOVE_TO_FILTER:
- index = SendDlgItemMessage(hwndDlg,IDC_FILTER_TO ,CB_GETCURSEL,0,0);
- size = SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_DELETESTRING, index, 0);
- SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_SETCURSEL, min(index, size-1), 0);
- PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- break;
-
- case WM_NOTIFY://apply changes so write it to db
- if (bInit)
- {
- break;
- }
- switch(((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_RESET:
- LoadSettings();
- return TRUE;
-
- case PSN_APPLY:
- SaveSettings(hwndDlg);
- return TRUE;
- }
-
- break;
- } //id from
-
- if (GetDlgItem(hwndDlg, IDC_STATUS) == ((LPNMHDR) lParam)->hwndFrom){
- switch (((LPNMHDR) lParam)->code)
- {
- case LVN_ITEMCHANGED:
- {
- NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
- if((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK){
- SendMessage( GetParent(hwndDlg), PSM_CHANGED, 0, 0 );
- }
- break;
-
- }
- break;
- }
- }
- break; //switch(msg)
+ static bool bInit = false;
+
+ HWND hwndList;
+ TCHAR buff[512];
+ char tmp[255];
+ int index, size;
+ TCHAR* strptr;
+ LVITEM lvI = { 0 };
+ LVCOLUMN lvc = { 0 };
+ switch (msg) {
+ case WM_INITDIALOG://initialize dialog, so set properties from db.
+ bInit = true;
+ TranslateDialogDefault(hwndDlg);//translate miranda function
+ LoadSettings();
+
+ //fill filter combos
- }
- return FALSE;
+ _tcsncpy_s(buff, settingFilterSender, _TRUNCATE);
+ while (strptr = _tcschr(buff, TEXT(';'))) {
+ TCHAR tmp[512] = TEXT("");
+ _tcsncpy_s(tmp, buff, (strptr - buff));
+ SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER, CB_ADDSTRING, 0, (LPARAM)tmp);
+ _tcsncpy_s(buff, strptr + 1, _TRUNCATE);
+ }
+
+ _tcsncpy_s(buff, settingFilterSubject, _TRUNCATE);
+ while (strptr = _tcschr(buff, TEXT(';'))) {
+ TCHAR tmp[512] = TEXT("");
+ _tcsncpy_s(tmp, buff, (strptr - buff));
+ SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_ADDSTRING, 0, (LPARAM)tmp);
+ _tcsncpy_s(buff, strptr + 1, _TRUNCATE);
+ }
+
+ _tcsncpy_s(buff, settingFilterTo, _TRUNCATE);
+ while (strptr = _tcschr(buff, TEXT(';'))) {
+ TCHAR tmp[512] = TEXT("");
+ _tcsncpy_s(tmp, buff, (strptr - buff));
+ SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_ADDSTRING, 0, (LPARAM)tmp);
+ _tcsncpy_s(buff, strptr + 1, _TRUNCATE);
+ }
+
+ // initialise and fill listbox
+ hwndList = GetDlgItem(hwndDlg, IDC_STATUS);
+ ListView_DeleteAllItems(hwndList);
+
+ SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
+
+ // Initialize the LVCOLUMN structure.
+ // The mask specifies that the format, width, text, and
+ // subitem members of the structure are valid.
+ lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
+ lvc.fmt = LVCFMT_LEFT;
+
+ lvc.iSubItem = 0;
+ lvc.pszText = TranslateT("Status");
+ lvc.cx = 120; // width of column in pixels
+ ListView_InsertColumn(hwndList, 0, &lvc);
+
+ // Some code to create the list-view control.
+ // Initialize LVITEM members that are common to all items.
+ lvI.mask = LVIF_TEXT;
+ for (int i = 0; i < STATUS_COUNT; i++) {
+ lvI.pszText = pcli->pfnGetStatusModeDescription(ID_STATUS_ONLINE + i, 0);
+ lvI.iItem = i;
+ ListView_InsertItem(hwndList, &lvI);
+ ListView_SetCheckState(hwndList, i, settingStatus[i]);
+ }
+
+ bInit = false;
+ break;
+
+ case WM_COMMAND://user changed something, so get changes to variables
+ if (!bInit && (HIWORD(wParam) == EN_CHANGE)) {
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ switch (LOWORD(wParam)) {
+ case IDC_BUTTON_ADD_SENDER_FILTER:
+ GetDlgItemTextA(hwndDlg, IDC_FILTER_SENDER, tmp, _countof(tmp));
+ if (strlen(tmp) > 0) {
+ SendDlgItemMessageA(hwndDlg, IDC_FILTER_SENDER, CB_ADDSTRING, 0, (LPARAM)tmp);
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+ case IDC_BUTTON_REMOVE_SENDER_FILTER:
+ index = SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER, CB_GETCURSEL, 0, 0);
+ size = SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER, CB_DELETESTRING, index, 0);
+ SendDlgItemMessage(hwndDlg, IDC_FILTER_SENDER, CB_SETCURSEL, min(index, size - 1), 0);
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_BUTTON_ADD_SUBJECT_FILTER:
+ GetDlgItemTextA(hwndDlg, IDC_FILTER_SUBJECT, tmp, _countof(tmp));
+ if (strlen(tmp) > 0) {
+ SendDlgItemMessageA(hwndDlg, IDC_FILTER_SUBJECT, CB_ADDSTRING, 0, (LPARAM)tmp);
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+ case IDC_BUTTON_REMOVE_SUBJECT_FILTER:
+ index = SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_GETCURSEL, 0, 0);
+ size = SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_DELETESTRING, index, 0);
+ SendDlgItemMessage(hwndDlg, IDC_FILTER_SUBJECT, CB_SETCURSEL, min(index, size - 1), 0);
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_BUTTON_ADD_TO_FILTER:
+ GetDlgItemTextA(hwndDlg, IDC_FILTER_TO, tmp, _countof(tmp));
+ if (strlen(tmp) > 0) {
+ SendDlgItemMessageA(hwndDlg, IDC_FILTER_TO, CB_ADDSTRING, 0, (LPARAM)tmp);
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+ case IDC_BUTTON_REMOVE_TO_FILTER:
+ index = SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_GETCURSEL, 0, 0);
+ size = SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_DELETESTRING, index, 0);
+ SendDlgItemMessage(hwndDlg, IDC_FILTER_TO, CB_SETCURSEL, min(index, size - 1), 0);
+ PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
+
+ case WM_NOTIFY://apply changes so write it to db
+ if (bInit) {
+ break;
+ }
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_RESET:
+ LoadSettings();
+ return TRUE;
+
+ case PSN_APPLY:
+ SaveSettings(hwndDlg);
+ return TRUE;
+ }
+
+ break;
+ } //id from
+
+ if (GetDlgItem(hwndDlg, IDC_STATUS) == ((LPNMHDR)lParam)->hwndFrom) {
+ switch (((LPNMHDR)lParam)->code) {
+ case LVN_ITEMCHANGED:
+ {
+ NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
+ if ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK) {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ }
+ break;
+ }
+ }
+ break; //switch(msg)
+
+ }
+ return FALSE;
}
//options page on miranda called
-int LotusNotifyOptInit(WPARAM wParam,LPARAM)
+int LotusNotifyOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
@@ -1480,18 +1457,18 @@ int LotusNotifyOptInit(WPARAM wParam,LPARAM) odp.ptszTitle = LPGENT(__PLUGIN_NAME);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- odp.ptszTab = LPGENT("Connection");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_LOTUS_CONECTION);
- odp.pfnDlgProc = DlgProcLotusNotifyConnectionOpts;
- Options_AddPage(wParam, &odp);
+ odp.ptszTab = LPGENT("Connection");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_LOTUS_CONECTION);
+ odp.pfnDlgProc = DlgProcLotusNotifyConnectionOpts;
+ Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Popup");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_LOTUS_POPUP);
- odp.pfnDlgProc = DlgProcLotusNotifyPopupOpts;
- Options_AddPage(wParam, &odp);
+ odp.ptszTab = LPGENT("Popup");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_LOTUS_POPUP);
+ odp.pfnDlgProc = DlgProcLotusNotifyPopupOpts;
+ Options_AddPage(wParam, &odp);
- odp.ptszTab = LPGENT("Miscellaneous");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_LOTUS_MISC);
+ odp.ptszTab = LPGENT("Miscellaneous");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_LOTUS_MISC);
odp.pfnDlgProc = DlgProcLotusNotifyMiscOpts;
Options_AddPage(wParam, &odp);
return 0;
@@ -1501,11 +1478,11 @@ int LotusNotifyOptInit(WPARAM wParam,LPARAM) //gives protocol avainable statuses
INT_PTR GetCaps(WPARAM wParam, LPARAM)
{
- if(wParam == PFLAGNUM_1)
+ if (wParam == PFLAGNUM_1)
return 0;
- if(wParam == PFLAGNUM_2)
+ if (wParam == PFLAGNUM_2)
return PF2_ONLINE; // add the possible statuses here.
- if(wParam == PFLAGNUM_3)
+ if (wParam == PFLAGNUM_3)
return 0;
return 0;
}
@@ -1524,49 +1501,52 @@ INT_PTR TMLoadIcon(WPARAM wParam, LPARAM lParam) {
UINT id;
- switch(wParam & 0xFFFF) {
- case PLI_ONLINE:
- case PLI_PROTOCOL: id=IDI_ICON1; break; // IDI_TM is the main icon for the protocol
- case PLI_OFFLINE: id=IDI_ICON2; break;
- default: return 0;
+ switch (wParam & 0xFFFF) {
+ case PLI_ONLINE:
+ case PLI_PROTOCOL: id = IDI_ICON1; break; // IDI_TM is the main icon for the protocol
+ case PLI_OFFLINE: id = IDI_ICON2; break;
+ default: return 0;
}
- return (INT_PTR)LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam&PLIF_SMALL?SM_CXSMICON:SM_CXICON), GetSystemMetrics(wParam&PLIF_SMALL?SM_CYSMICON:SM_CYICON), 0);
+ return (INT_PTR)LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam&PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam&PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
}
INT_PTR SetStatus(WPARAM wParam, LPARAM lParam)
{
- if (wParam == ID_STATUS_OFFLINE){
+ if (wParam == ID_STATUS_OFFLINE) {
// the status has been changed to online (maybe run some more code)
Menu_EnableItem(hMenuHandle, FALSE);
diffstat = 0;
- } else if (wParam == ID_STATUS_ONLINE){
+ }
+ else if (wParam == ID_STATUS_ONLINE) {
diffstat = 0;
//Menu_EnableItem(hMenuHandle ,TRUE);
//NotifyEventHooks(hCheckEvent,wParam,lParam);
// the status has been changed to offline (maybe run some more code)
- if (currentStatus != ID_STATUS_ONLINE){
- if(startuperror){
+ if (currentStatus != ID_STATUS_ONLINE) {
+ if (startuperror) {
int cnt;
- for(cnt=0; cnt<=4; cnt++)
- if(startuperror >> cnt & 1)
+ for (cnt = 0; cnt <= 4; cnt++)
+ if (startuperror >> cnt & 1)
ErMsgT(TranslateTS(startuperrors[cnt]));
return 1;
}
- if(check() == 0){
- if(settingInterval != 0)
+ if (check() == 0) {
+ if (settingInterval != 0)
SetTimer(hTimerWnd, TID, settingInterval * 60000, atTime);
Menu_EnableItem(hMenuHandle, TRUE);
- } else {
+ }
+ else {
ProtoBroadcastAck(PLUGINNAME, NULL, ACKTYPE_STATUS, ACKRESULT_FAILED, (HANDLE)currentStatus, wParam);
return -1;
}
}
- } else {
+ }
+ else {
int retv = 0;
- if(settingStatus[wParam - ID_STATUS_ONLINE])
+ if (settingStatus[wParam - ID_STATUS_ONLINE])
retv = SetStatus(ID_STATUS_OFFLINE, lParam);
else
retv = SetStatus(ID_STATUS_ONLINE, lParam);
@@ -1576,8 +1556,8 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam) // the status has been changed to unknown (maybe run some more code)
}
//broadcast the message
- if(currentStatus != wParam)
- ProtoBroadcastAck(PLUGINNAME,NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)currentStatus, wParam);
+ if (currentStatus != wParam)
+ ProtoBroadcastAck(PLUGINNAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)currentStatus, wParam);
currentStatus = wParam;
return 0;
@@ -1587,7 +1567,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam) void checkEnvPath(TCHAR *path)
{
TCHAR *cur;
- TCHAR nowy[2048]={0};
+ TCHAR nowy[2048] = { 0 };
TCHAR *found;
int len;
@@ -1596,16 +1576,16 @@ void checkEnvPath(TCHAR *path) _tcslwr(path);
cur = _tgetenv(_T("PATH"));
_tcslwr(cur);
- found = _tcsstr(cur,path);
+ found = _tcsstr(cur, path);
len = (int)mir_tstrlen(path);
- if(found != NULL && (found[len] == ';' || found[len] == 0 || (found[len] == '\\' && (found[len+1] == ';' || found[len+1] == 0)))) {
+ if (found != NULL && (found[len] == ';' || found[len] == 0 || (found[len] == '\\' && (found[len + 1] == ';' || found[len + 1] == 0)))) {
return;
}
assert(mir_tstrlen(path) + mir_tstrlen(cur) + 1 < _countof(nowy));
_tcsncpy_s(nowy, _T("PATH="), _TRUNCATE);
_tcscat_s(nowy, cur);
- if(cur[mir_tstrlen(cur)-1]!=';')
+ if (cur[mir_tstrlen(cur) - 1] != ';')
_tcscat_s(nowy, _T(";"));
_tcscat_s(nowy, path);
_tcscat_s(nowy, _T(";"));
@@ -1625,38 +1605,40 @@ INT_PTR GetStatus(WPARAM, LPARAM) static int modulesloaded(WPARAM, LPARAM)
{
int cnt;
- TCHAR path[255] = {0};
+ TCHAR path[255] = { 0 };
log(L"Modules loaded, lets start LN...");
GetLotusPath(path, sizeof(path));
checkEnvPath(path);
_tcscat_s(path, _countof(path), _T("nnotes.dll"));
- assert(mir_tstrlen(path)>0);
+ assert(mir_tstrlen(path) > 0);
log_p(L"Loading dll: %s", path);
hLotusDll = LoadLibrary(path);
assert(hLotusDll);
- if(hLotusDll != NULL) {
+ if (hLotusDll != NULL) {
log(L"Loading LN Functions");
- if(!HookLotusFunctions()) {
+ if (!HookLotusFunctions()) {
FreeLibrary(hLotusDll);
startuperror += 1;
- } else {
+ }
+ else {
log(L"Initializing Lotus");
- if((NotesInitExtended1) (0, NULL)){
+ if ((NotesInitExtended1)(0, NULL)) {
//initialize lotus //TODO: Lotus can terminate miranda process here with msgbox "Shared Memory from a previous Notes/Domino run has been detected, this process will exit now"
startuperror += 4;
running = TRUE;
Menu_EnableItem(hMenuHandle, !running);//disable menu cause lotus is not initialized
- } else {
+ }
+ else {
log(L"Checking Notes Ini File");
if (!checkNotesIniFile(FALSE)) {
startuperror += 16;
@@ -1664,14 +1646,14 @@ static int modulesloaded(WPARAM, LPARAM) }
}
- } else {
+ }
+ else {
startuperror += 2;
}
- assert(startuperror==0);
- for(cnt=0; cnt<=4; cnt++)
- {
- if(startuperror >> cnt & 1)
+ assert(startuperror == 0);
+ for (cnt = 0; cnt <= 4; cnt++) {
+ if (startuperror >> cnt & 1)
ErMsgT(TranslateTS(startuperrors[cnt]));
}
@@ -1680,11 +1662,11 @@ static int modulesloaded(WPARAM, LPARAM) //function hooks before unload
-static int preshutdown(WPARAM,LPARAM)
+static int preshutdown(WPARAM, LPARAM)
{
Plugin_Terminated = true;
deleteElements();
- if(hLotusDll){
+ if (hLotusDll) {
(NotesTerm1)();
FreeLibrary(hLotusDll);
}
@@ -1700,28 +1682,28 @@ extern "C" int __declspec(dllexport) Load(void) Plugin_Terminated = false;
//if(pluginLink)//strange, but this function is called by Lotus API Extension Manager (instead of MainEntryPoint) probably always with parameter poiter =1
- if(bMirandaCall){
- STATUS rc = EMRegister1 (EM_GETPASSWORD, EM_REG_BEFORE | EM_REG_AFTER, EMCallBack, 0, &hLotusRegister); //Extension Manager must know that we are here
- if(rc){
+ if (bMirandaCall) {
+ STATUS rc = EMRegister1(EM_GETPASSWORD, EM_REG_BEFORE | EM_REG_AFTER, EMCallBack, 0, &hLotusRegister); //Extension Manager must know that we are here
+ if (rc) {
//Extension magager don't know who we are :(
- startuperror+=8;
+ startuperror += 8;
// Get the info from the .ini file
}
//log_p(L"Load: Registered Ext. Mngr. res=%d", rc);
return rc;
}
- bMirandaCall=TRUE;
+ bMirandaCall = TRUE;
init_pluginname();
logRegister();
log_p(L"Load: Entering LotusNotify.dll Load() bMirandaCall=%d PLUGINNAME=[%S]", bMirandaCall, PLUGINNAME);
- if(!(hCheckEvent = CreateHookableEvent("LotusNotify/Check"))) //check if there is another copy of plugin running
+ if (!(hCheckEvent = CreateHookableEvent("LotusNotify/Check"))) //check if there is another copy of plugin running
second = TRUE;
hCheckHook = HookEvent("LotusNotify/Check", eventCheck); //hook function to menu click event
- if(!second) //if its first plugin instance
+ if (!second) //if its first plugin instance
{
//function that will be called on menu click
hMenuService = CreateServiceFunction("LotusNotify/MenuCommand", PluginMenuCommand);
@@ -1734,7 +1716,7 @@ extern "C" int __declspec(dllexport) Load(void) mi.pszService = "LotusNotify/MenuCommand"; //service name thet listning for menu call
hMenuHandle = Menu_AddMainMenuItem(&mi); //create menu pos.
- Menu_EnableItem(hMenuHandle ,FALSE);
+ Menu_EnableItem(hMenuHandle, FALSE);
}
// create protocol
@@ -1745,7 +1727,7 @@ extern "C" int __declspec(dllexport) Load(void) Proto_RegisterModule(&pd);
// set all contacts to offline
- for(MCONTACT hContact = db_find_first(PLUGINNAME); hContact; hContact = db_find_next(hContact, PLUGINNAME))
+ for (MCONTACT hContact = db_find_first(PLUGINNAME); hContact; hContact = db_find_next(hContact, PLUGINNAME))
db_set_w(hContact, PLUGINNAME, "status", ID_STATUS_OFFLINE);
CreateProtoServiceFunction(PLUGINNAME, PS_GETCAPS, GetCaps);
@@ -1756,7 +1738,7 @@ extern "C" int __declspec(dllexport) Load(void) LoadSettings(); //read from db to variables
- SkinAddNewSoundExT("LotusNotify", LPGENT("Lotus Notify") , LPGENT("New Lotus document detected"));
+ SkinAddNewSoundExT("LotusNotify", LPGENT("Lotus Notify"), LPGENT("New Lotus document detected"));
hOptInit = HookEvent(ME_OPT_INITIALISE, LotusNotifyOptInit); //register service to hook option call
assert(hOptInit);
@@ -1791,19 +1773,17 @@ extern "C" int __declspec(dllexport) Unload() extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
{
#ifdef _WIN64
- #error LotusNotify.dll cannot work with 64bit Miranda. (Lotus client is 32bit only)
+#error LotusNotify.dll cannot work with 64bit Miranda. (Lotus client is 32bit only)
#endif
return &pluginInfo;
}
-
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_LOTUSNOTIFY, MIID_PROTOCOL, MIID_LAST};
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_LOTUSNOTIFY, MIID_PROTOCOL, MIID_LAST };
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
{
- switch (dwReason)
- {
+ switch (dwReason) {
case DLL_PROCESS_ATTACH:
/* Save the instance handle */
Plugin_Terminated = false;
diff --git a/plugins/MirandaG15/MirandaG15.vcxproj b/plugins/MirandaG15/MirandaG15.vcxproj index 91a0db1fb6..55e0d885b6 100644 --- a/plugins/MirandaG15/MirandaG15.vcxproj +++ b/plugins/MirandaG15/MirandaG15.vcxproj @@ -26,6 +26,9 @@ <Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" />
</ImportGroup>
<ItemDefinitionGroup>
+ <ClCompile>
+ <ExceptionHandling>Sync</ExceptionHandling>
+ </ClCompile>
<Link>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 37fa929a4e..8a8e771d45 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -311,7 +311,7 @@ void CAppletManager::OnScreenExpired(CLCDScreen *pScreen) //************************************************************************ // the update timer's callback function //************************************************************************ -VOID CALLBACK CAppletManager::UpdateTimer(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime) +VOID CALLBACK CAppletManager::UpdateTimer(HWND, UINT, UINT_PTR, DWORD) { CAppletManager::GetInstance()->Update(); } @@ -974,10 +974,9 @@ bool CAppletManager::TranslateDBEvent(CEvent *pEvent, WPARAM hContact, LPARAM hd //************************************************************************ tstring CAppletManager::StripIRCFormatting(tstring strText) { - tstring::size_type end = 0, start = 0, i = 0; + tstring::size_type start = 0, i = 0; tstring strEntity = _T(""); tstring strReplace = _T(""); - tstring::size_type len = strText.length(); while(i < strText.length()) { @@ -1147,7 +1146,7 @@ CIRCHistory *CAppletManager::CreateIRCHistoryByName(tstring strProtocol,tstring //************************************************************************ // inbound chat event hook function //************************************************************************ -int CAppletManager::HookChatInbound(WPARAM wParam,LPARAM lParam) +int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) { GCEVENT *gce = (GCEVENT*)lParam; GCDEST *gcd; @@ -1451,7 +1450,7 @@ int CAppletManager::HookChatInbound(WPARAM wParam,LPARAM lParam) //************************************************************************ // message window event hook function //************************************************************************ -int CAppletManager::HookMessageWindowEvent(WPARAM wParam, LPARAM lParam) +int CAppletManager::HookMessageWindowEvent(WPARAM, LPARAM lParam) { MessageWindowEventData *mwed = (MessageWindowEventData*)lParam; CEvent Event; @@ -1601,7 +1600,7 @@ int CAppletManager::HookStatusChanged(WPARAM wParam, LPARAM lParam) //************************************************************************ // protocoll ack hook function //************************************************************************ -int CAppletManager::HookProtoAck(WPARAM wParam, LPARAM lParam) +int CAppletManager::HookProtoAck(WPARAM, LPARAM lParam) { ACKDATA *pAck = (ACKDATA *) lParam; @@ -1705,7 +1704,7 @@ int CAppletManager::HookProtoAck(WPARAM wParam, LPARAM lParam) //************************************************************************ // contact added hook function //************************************************************************ -int CAppletManager::HookContactAdded(WPARAM wParam, LPARAM lParam) +int CAppletManager::HookContactAdded(WPARAM wParam, LPARAM) { CEvent Event; Event.eType = EVENT_CONTACT_ADDED; @@ -1718,7 +1717,7 @@ int CAppletManager::HookContactAdded(WPARAM wParam, LPARAM lParam) //************************************************************************ // contact deleted hook function //************************************************************************ -int CAppletManager::HookContactDeleted(WPARAM wParam, LPARAM lParam) +int CAppletManager::HookContactDeleted(WPARAM wParam, LPARAM) { CEvent Event; Event.eType = EVENT_CONTACT_DELETED; diff --git a/plugins/MirandaG15/src/CChatScreen.cpp b/plugins/MirandaG15/src/CChatScreen.cpp index 0f374d3aa4..c25ce353a2 100644 --- a/plugins/MirandaG15/src/CChatScreen.cpp +++ b/plugins/MirandaG15/src/CChatScreen.cpp @@ -775,7 +775,7 @@ void CChatScreen::OnLCDButtonRepeated(int iButton) //************************************************************************
// Called when an LCD-button is released
//************************************************************************
-void CChatScreen::OnLCDButtonUp(int iButton)
+void CChatScreen::OnLCDButtonUp(int)
{
}
diff --git a/plugins/MirandaG15/src/CConfig.cpp b/plugins/MirandaG15/src/CConfig.cpp index 4d92132a1b..48f9da6346 100644 --- a/plugins/MirandaG15/src/CConfig.cpp +++ b/plugins/MirandaG15/src/CConfig.cpp @@ -246,7 +246,7 @@ void CConfig::OnConnectionChanged() { FillDeviceBox(CConfig::hDeviceBox);
}
-int CConfig::InitOptionsDialog(WPARAM wParam, LPARAM lParam)
+int CConfig::InitOptionsDialog(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 847000000;
diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index 8ce8cb2856..6964d74d59 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -392,7 +392,7 @@ void CContactList::DeleteItem(CContactListEntry *pEntry) //************************************************************************
// Called to delete the specified group
//************************************************************************
-void CContactList::DeleteGroup(CContactListGroup *pGroup)
+void CContactList::DeleteGroup(CContactListGroup*)
{
}
@@ -404,7 +404,6 @@ void CContactList::DrawEntry(CLCDGfx *pGfx,CContactListEntry *pEntry,bool bSelec if(pEntry == NULL)
return;
- int iOffset = 0;
tstring strText = _T("");
if(pEntry->iMessages > 0) {
strText = _T("[");
@@ -805,7 +804,6 @@ void CContactList::OnContactDeleted(MCONTACT hContact) RemoveContact(hContact);
// Decrease the membercount of the old group, and check if it needs to be deleted
- int res = 0;
tstring strGroup = GetContactGroupPath(hContact);
if(!strGroup.empty())
{
@@ -1000,11 +998,8 @@ void CContactList::InitializeGroupObjects() {
UninitializeGroupObjects();
- int res = 0;
CContactListGroup *pGroup = NULL;
-
- HANDLE hMetaContact = NULL;
char *szProto = NULL;
for(MCONTACT hContact = db_find_first();hContact != NULL;hContact = db_find_next(hContact))
{
diff --git a/plugins/MirandaG15/src/CContactlistScreen.cpp b/plugins/MirandaG15/src/CContactlistScreen.cpp index b1b0b962b4..4a3efb282a 100644 --- a/plugins/MirandaG15/src/CContactlistScreen.cpp +++ b/plugins/MirandaG15/src/CContactlistScreen.cpp @@ -149,9 +149,7 @@ void CContactlistScreen::OnConfigChanged() //************************************************************************
void CContactlistScreen::OnEventReceived(CEvent *pEvent)
{
- int iStatus = 0;
- switch(pEvent->eType)
- {
+ switch(pEvent->eType) {
case EVENT_SIGNED_ON:
case EVENT_SIGNED_OFF:
case EVENT_STATUS:
diff --git a/plugins/MirandaG15/src/CCreditsScreen.cpp b/plugins/MirandaG15/src/CCreditsScreen.cpp index 5c3cd9669b..8219e5f353 100644 --- a/plugins/MirandaG15/src/CCreditsScreen.cpp +++ b/plugins/MirandaG15/src/CCreditsScreen.cpp @@ -225,21 +225,21 @@ void CCreditsScreen::OnSizeChanged() //************************************************************************
// Called when an LCD-button is pressed
//************************************************************************
-void CCreditsScreen::OnLCDButtonDown(int iButton)
+void CCreditsScreen::OnLCDButtonDown(int)
{
}
//************************************************************************
// Called when an LCD-button event is repeated
//************************************************************************
-void CCreditsScreen::OnLCDButtonRepeated(int iButton)
+void CCreditsScreen::OnLCDButtonRepeated(int)
{
}
//************************************************************************
// Called when an LCD-button is released
//************************************************************************
-void CCreditsScreen::OnLCDButtonUp(int iButton)
+void CCreditsScreen::OnLCDButtonUp(int)
{
}
diff --git a/plugins/MirandaG15/src/CEventScreen.cpp b/plugins/MirandaG15/src/CEventScreen.cpp index adf244362b..819ec8b3b9 100644 --- a/plugins/MirandaG15/src/CEventScreen.cpp +++ b/plugins/MirandaG15/src/CEventScreen.cpp @@ -211,7 +211,7 @@ void CEventScreen::OnLCDButtonRepeated(int iButton) //************************************************************************
// Called when an LCD-button is released
//************************************************************************
-void CEventScreen::OnLCDButtonUp(int iButton)
+void CEventScreen::OnLCDButtonUp(int)
{
}
diff --git a/plugins/MirandaG15/src/CNotificationScreen.cpp b/plugins/MirandaG15/src/CNotificationScreen.cpp index d950eccac8..0eb1cb3bdc 100644 --- a/plugins/MirandaG15/src/CNotificationScreen.cpp +++ b/plugins/MirandaG15/src/CNotificationScreen.cpp @@ -333,7 +333,7 @@ void CNotificationScreen::OnLCDButtonRepeated(int iButton) //************************************************************************
// Called when an LCD-button is released
//************************************************************************
-void CNotificationScreen::OnLCDButtonUp(int iButton)
+void CNotificationScreen::OnLCDButtonUp(int)
{
}
diff --git a/plugins/MirandaG15/src/CScreen.cpp b/plugins/MirandaG15/src/CScreen.cpp index 1759fa9686..a731ab4d19 100644 --- a/plugins/MirandaG15/src/CScreen.cpp +++ b/plugins/MirandaG15/src/CScreen.cpp @@ -158,7 +158,7 @@ void CScreen::UpdateButtons() //************************************************************************
// Called when an event is received
//************************************************************************
-void CScreen::OnEventReceived(CEvent *pEvent)
+void CScreen::OnEventReceived(CEvent*)
{
}
diff --git a/plugins/MirandaG15/src/CScreensaverScreen.cpp b/plugins/MirandaG15/src/CScreensaverScreen.cpp index 6c8a915a49..a9d418f3e9 100644 --- a/plugins/MirandaG15/src/CScreensaverScreen.cpp +++ b/plugins/MirandaG15/src/CScreensaverScreen.cpp @@ -158,21 +158,21 @@ void CScreensaverScreen::OnSizeChanged() //************************************************************************
// Called when an LCD-button is pressed
//************************************************************************
-void CScreensaverScreen::OnLCDButtonDown(int iButton)
+void CScreensaverScreen::OnLCDButtonDown(int)
{
}
//************************************************************************
// Called when an LCD-button event is repeated
//************************************************************************
-void CScreensaverScreen::OnLCDButtonRepeated(int iButton)
+void CScreensaverScreen::OnLCDButtonRepeated(int)
{
}
//************************************************************************
// Called when an LCD-button is released
//************************************************************************
-void CScreensaverScreen::OnLCDButtonUp(int iButton)
+void CScreensaverScreen::OnLCDButtonUp(int)
{
}
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDConnection.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDConnection.cpp index cee754739c..6b449f5db2 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDConnection.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDConnection.cpp @@ -19,7 +19,7 @@ CLCDConnection::~CLCDConnection() //************************************************************************
// Initializes the connection to the LCD
//************************************************************************
-bool CLCDConnection::Initialize(tstring strAppletName,bool bAutostart, bool bConfigDialog)
+bool CLCDConnection::Initialize(tstring, bool, bool)
{
return false;
}
@@ -51,7 +51,7 @@ int CLCDConnection::GetConnectionState() //************************************************************************
// Returns the state of the specified Button
//************************************************************************
-bool CLCDConnection::GetButtonState(int iButton)
+bool CLCDConnection::GetButtonState(int)
{
return false;
}
@@ -59,7 +59,7 @@ bool CLCDConnection::GetButtonState(int iButton) //************************************************************************
// returns the id of the specified button
//************************************************************************
-int CLCDConnection::GetButtonId(int iButton) {
+int CLCDConnection::GetButtonId(int) {
return 0;
}
@@ -82,14 +82,14 @@ bool CLCDConnection::Draw() //************************************************************************
// Temporarily brings the applet to foreground
//************************************************************************
-void CLCDConnection::SetAlert(bool bAlert)
+void CLCDConnection::SetAlert(bool)
{
}
//************************************************************************
// Activates the applet on the LCD
//************************************************************************
-void CLCDConnection::SetAsForeground(bool bSetAsForeground)
+void CLCDConnection::SetAsForeground(bool)
{
}
@@ -139,7 +139,7 @@ PBYTE CLCDConnection::GetPixelBuffer() //************************************************************************
// Get the pointer to the pixel buffer
//************************************************************************
-CLCDDevice* CLCDConnection::GetAttachedDevice(int iIndex)
+CLCDDevice* CLCDConnection::GetAttachedDevice(int)
{
return NULL;
}
@@ -147,27 +147,31 @@ CLCDDevice* CLCDConnection::GetAttachedDevice(int iIndex) //************************************************************************
// Connects to the specified LCD
//************************************************************************
-bool CLCDConnection::Connect(int iIndex) {
+bool CLCDConnection::Connect(int )
+{
return false;
}
//************************************************************************
// Connects to the specified LCD
//************************************************************************
-bool CLCDConnection::Disconnect() {
+bool CLCDConnection::Disconnect()
+{
return false;
}
//************************************************************************
// Toggles the automatic reconnection
//************************************************************************
-void CLCDConnection::SetReconnect(bool bSet) {
+void CLCDConnection::SetReconnect(bool bSet)
+{
m_bReconnect = bSet;
}
//************************************************************************
// returns a pointer to the current device
//************************************************************************
-CLCDDevice* CLCDConnection::GetConnectedDevice() {
+CLCDDevice* CLCDConnection::GetConnectedDevice()
+{
return NULL;
}
\ No newline at end of file diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp index 00a91a2706..bd882b136f 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDConnectionLogitech.cpp @@ -2,14 +2,14 @@ #include "CLCDConnectionLogitech.h"
#include "CLCDOutputManager.h"
-DWORD WINAPI softButtonCallback(IN int device,
+DWORD WINAPI softButtonCallback(IN int,
IN DWORD dwButtons,
IN const PVOID pContext) {
((CLCDConnectionLogitech*)pContext)->OnSoftButtonCB(dwButtons);
return 0;
}
-DWORD WINAPI notificationCallback(IN int connection,
+DWORD WINAPI notificationCallback(IN int,
IN const PVOID pContext,
IN DWORD notificationCode,
IN DWORD notifyParm1,
@@ -359,7 +359,7 @@ void CLCDConnectionLogitech::OnSoftButtonCB(DWORD state) { m_dwButtonState = state;
}
-void CLCDConnectionLogitech::OnNotificationCB(DWORD notificationCode, DWORD notifyParm1, DWORD notifyParm2, DWORD notifyParm3, DWORD notifyParm4) {
+void CLCDConnectionLogitech::OnNotificationCB(DWORD notificationCode, DWORD notifyParm1, DWORD, DWORD, DWORD) {
CLgLCDDevice *device;
switch (notificationCode) {
@@ -559,12 +559,9 @@ void CLCDConnectionLogitech::SetAlert(bool bAlert) void CLCDConnectionLogitech::SetAsForeground(bool bSetAsForeground)
{
// TODO: Activate when 1.02 is out
- DWORD dwSet = bSetAsForeground ? LGLCD_LCD_FOREGROUND_APP_YES : LGLCD_LCD_FOREGROUND_APP_NO;
m_bSetAsForeground = bSetAsForeground;
if (LGLCD_INVALID_DEVICE != m_hDevice)
- {
lgLcdSetAsLCDForegroundApp(m_hDevice, bSetAsForeground);
- }
}
//************************************************************************
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp index c8e4ed75d5..b258952b16 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp @@ -314,7 +314,6 @@ void CLCDGfx::DrawText(int nX, int nY, LPCTSTR sText) //************************************************************************
void CLCDGfx::DrawText(int nX,int nY,int nWidth,tstring strText)
{
- SIZE sizeChar = {0, 0};
SIZE sizeLine = {0, 0};
SIZE sizeCutOff = {0, 0};
@@ -489,11 +488,8 @@ void CLCDGfx::EndDraw(void) memset(m_pLcdBitmapBits,0x00,m_nHeight * m_nWidth);
SLCDPixel *pPixel = NULL;
vector<SLCDPixel*>::iterator iter = m_LMovingPixels.begin();
- int iPosition = 0;
int iIndex = 0,iMoved = 0;
- double dTest = sin(3.14/2);
-
while(iter != m_LMovingPixels.end())
{
pPixel = *iter;
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp index 773645edac..0239c6b75f 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDInput.cpp @@ -613,7 +613,6 @@ void CLCDInput::UpdateOffsets(int iModified) int iMaxChars = 0;
SIZE sizeWord = {0, 0};
- SIZE sizeChar = {0, 0};
SIZE sizeLine = {0, 0};
SelectObject(hDC, m_hFont);
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp index 7415ea5567..06f4076e83 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDLabel.cpp @@ -137,9 +137,7 @@ void CLCDLabel::UpdateCutOffIndex() return;
int iWidth = GetWidth();
- SIZE sizeChar = {0, 0};
SIZE sizeLine = {0, 0};
- SIZE sizeWord = {0,0};
SIZE sizeCutOff = {0, 0};
int iAvailableLines = GetHeight()/m_iFontHeight;
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDList.h b/plugins/MirandaG15/src/LCDFramework/CLCDList.h index 8afe19e995..0f7006d46d 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDList.h +++ b/plugins/MirandaG15/src/LCDFramework/CLCDList.h @@ -53,12 +53,12 @@ public: return m_pParent->GetPreviousEntry(this); } - virtual CListEntry<T,G> *GetNextEntry(CListEntry<T,G> *pEntry) + virtual CListEntry<T,G> *GetNextEntry(CListEntry<T,G>*) { return NULL; } - virtual CListEntry<T,G> *GetPreviousEntry(CListEntry<T,G> *pEntry) + virtual CListEntry<T,G> *GetPreviousEntry(CListEntry<T,G>*) { return NULL; } @@ -83,11 +83,11 @@ public: m_pRoot = pRoot; } - virtual void DeleteItem(T Entry) + virtual void DeleteItem(T) { } - virtual void DeleteGroup(G Group) + virtual void DeleteGroup(G) { } @@ -170,7 +170,6 @@ public: bool empty() { - bool b = m_Entrys.empty(); return m_Entrys.empty(); } @@ -196,8 +195,6 @@ public: void Clear() { list< CListEntry<T,G>* >::iterator iter = m_Entrys.begin(); - CListItem<T,G> *pItem = NULL; - CListContainer<T,G> *pContainer = NULL; while(iter != m_Entrys.end()) { @@ -605,8 +602,7 @@ public: SelectObject(pGfx->GetHDC(),m_hFont); POINT ptPrevViewportOrg = { 0, 0 }; - HRGN hRgn = NULL; - int iHeight = 0,iLimit=0; + int iHeight = 0; int iYOffset = 0, iXOffset=0; int iColWidth = (GetWidth()- (m_iColumns-1)*3)/m_iColumns; int iSpace = GetHeight() - (GetHeight()/m_iEntryHeight)*m_iEntryHeight; @@ -783,7 +779,6 @@ public: { m_Position = pEntry; - int iPerPage = (GetHeight()/m_iEntryHeight)*m_iColumns; if(m_Position->GetIndex() < m_iStartIndex) m_iStartIndex--; return true; @@ -904,7 +899,7 @@ protected: //************************************************************************ // Called to delete the specified entry //************************************************************************ - virtual void DeleteEntry(T Entry) + virtual void DeleteEntry(T) { } @@ -912,7 +907,7 @@ protected: //************************************************************************ // Called to delete the specified group //************************************************************************ - virtual void DeleteGroup(G Group) + virtual void DeleteGroup(G) { } @@ -920,14 +915,14 @@ protected: //************************************************************************ // Called to draw the specified entry //************************************************************************ - virtual void DrawEntry(CLCDGfx *pGfx,T Entry, bool bSelected) + virtual void DrawEntry(CLCDGfx*, T, bool) { } //************************************************************************ // Called to draw the specified entry //************************************************************************ - virtual void DrawGroup(CLCDGfx *pGfx,G Group, bool bOpen, bool bSelected) + virtual void DrawGroup(CLCDGfx*, G, bool, bool) { } diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp index e21a125906..d7107c888c 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDOutputManager.cpp @@ -197,8 +197,6 @@ bool CLCDOutputManager::Update() { ASSERT(m_bInitialized); - DWORD dwElapsed = GetTickCount() - m_dwLastUpdate; - // Update the active screen if(m_pActiveScreen != NULL) { @@ -379,14 +377,14 @@ void CLCDOutputManager::SetButtonRepeatDelay(DWORD dwDelay) //************************************************************************ // Called when a screen has been deactivated //************************************************************************ -void CLCDOutputManager::OnScreenDeactivated(CLCDScreen *pScreen) +void CLCDOutputManager::OnScreenDeactivated(CLCDScreen*) { } //************************************************************************ // Called when a screen has expired //************************************************************************ -void CLCDOutputManager::OnScreenExpired(CLCDScreen *pScreen) +void CLCDOutputManager::OnScreenExpired(CLCDScreen*) { } @@ -421,7 +419,7 @@ void CLCDOutputManager::OnLCDButtonUp(int iButton) //************************************************************************ // Called when the connection state has changed //************************************************************************ -void CLCDOutputManager::OnConnectionChanged(int iConnectionState) +void CLCDOutputManager::OnConnectionChanged(int) { } @@ -442,12 +440,15 @@ void CLCDOutputManager::OnLCDDisconnected() //************************************************************************ // Called by the LCDManager to open a config dialog //************************************************************************ -DWORD WINAPI CLCDOutputManager::configDialogCallback(IN int connection,IN const PVOID pContext) { - return CLCDOutputManager::GetInstance()->OnConfigDialogRequest(connection,pContext); +DWORD WINAPI CLCDOutputManager::configDialogCallback(IN int connection,IN const PVOID pContext) +{ + return CLCDOutputManager::GetInstance()->OnConfigDialogRequest(connection, pContext); } + //************************************************************************ // Called when a config dialog is requested //************************************************************************ -DWORD CLCDOutputManager::OnConfigDialogRequest(int connection, const PVOID pContext) { +DWORD CLCDOutputManager::OnConfigDialogRequest(int, const PVOID) +{ return 0; }
\ No newline at end of file diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp index fa1a59e49a..d599220b69 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDScreen.cpp @@ -260,7 +260,7 @@ void CLCDScreen::OnExpiration() //************************************************************************
// Called when an LCD-button is pressed
//************************************************************************
-void CLCDScreen::OnLCDButtonDown(int iButton)
+void CLCDScreen::OnLCDButtonDown(int)
{
}
@@ -268,7 +268,7 @@ void CLCDScreen::OnLCDButtonDown(int iButton) //************************************************************************
// Called when an LCD-button event is repeated
//************************************************************************
-void CLCDScreen::OnLCDButtonRepeated(int iButton)
+void CLCDScreen::OnLCDButtonRepeated(int)
{
}
@@ -276,7 +276,7 @@ void CLCDScreen::OnLCDButtonRepeated(int iButton) //************************************************************************
// Called when an LCD-button is released
//************************************************************************
-void CLCDScreen::OnLCDButtonUp(int iButton)
+void CLCDScreen::OnLCDButtonUp(int)
{
}
\ No newline at end of file diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp index 9814f93024..1db6536e08 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDTextLog.cpp @@ -301,8 +301,6 @@ void CLCDTextLog::WrapMessage(CLogEntry *pEntry) int i = 0;
tstring strLine = _T("");
tstring strWord = _T("");
- SIZE sizeWord = {0, 0};
- SIZE sizeChar = {0, 0};
SIZE sizeLine = {0, 0};
int *piExtents = new int[strString.length()];
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp index 9d49c40aa8..bad6b61c75 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp @@ -53,7 +53,7 @@ bool CLCDTextObject::Shutdown() //************************************************************************
// draws the textobject
//************************************************************************
-bool CLCDTextObject::Draw(CLCDGfx *pGfx)
+bool CLCDTextObject::Draw(CLCDGfx*)
{
return true;
}
diff --git a/plugins/MirandaG15/src/LCDFramework/LCDObject.cpp b/plugins/MirandaG15/src/LCDFramework/LCDObject.cpp index 2fe0319ca3..72971bc738 100644 --- a/plugins/MirandaG15/src/LCDFramework/LCDObject.cpp +++ b/plugins/MirandaG15/src/LCDFramework/LCDObject.cpp @@ -123,7 +123,7 @@ bool CLCDObject::Update() //************************************************************************
// Draw the object
//************************************************************************
-bool CLCDObject::Draw(CLCDGfx *pGfx)
+bool CLCDObject::Draw(CLCDGfx*)
{
return true;
}
@@ -131,7 +131,6 @@ bool CLCDObject::Draw(CLCDGfx *pGfx) //************************************************************************
// Called when the size of the object changed
//************************************************************************
-void CLCDObject::OnSizeChanged(SIZE OldSize)
+void CLCDObject::OnSizeChanged(SIZE)
{
-
}
\ No newline at end of file diff --git a/plugins/MirandaG15/src/Miranda.cpp b/plugins/MirandaG15/src/Miranda.cpp index 1515978515..8b3c76e946 100644 --- a/plugins/MirandaG15/src/Miranda.cpp +++ b/plugins/MirandaG15/src/Miranda.cpp @@ -89,7 +89,7 @@ void UnInit(); // Exported Functions
//************************************************************************
-EXTERN_C __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+EXTERN_C __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
@@ -132,7 +132,7 @@ EXTERN_C int __declspec(dllexport) Unload(void) //
// EntryPoint of the DLL
//************************************************************************
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
hInstance = hinstDLL;
return TRUE;
@@ -145,7 +145,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) // This is where the main plugin initialization happens and the
// connection to the LCD is established,
//************************************************************************
-int Init(WPARAM wParam,LPARAM lParam)
+int Init(WPARAM, LPARAM)
{
g_AppletManager = new CAppletManager();
// Memoryleak Detection
diff --git a/plugins/ModernOpt/src/main.cpp b/plugins/ModernOpt/src/main.cpp index c482834ada..fffb2fc1fb 100644 --- a/plugins/ModernOpt/src/main.cpp +++ b/plugins/ModernOpt/src/main.cpp @@ -18,7 +18,7 @@ PLUGININFOEX pluginInfoEx = { {0x621f886b, 0xa7f6, 0x457f, {0x9d, 0x62, 0x8e, 0xe8, 0x4c, 0x27, 0x59, 0x93}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
hInst = hinstDLL;
return TRUE;
diff --git a/plugins/ModernOpt/src/modernopt.cpp b/plugins/ModernOpt/src/modernopt.cpp index c4ff2702f4..12f11758bf 100644 --- a/plugins/ModernOpt/src/modernopt.cpp +++ b/plugins/ModernOpt/src/modernopt.cpp @@ -451,7 +451,7 @@ static void ModernOptUI_SelectSection(HWND hwndDlg, struct ModernOptionsData *da ////////////////////////////////////////////////////////////////////////////////
// Services
-static INT_PTR svcModernOpt_Impl(WPARAM wParam, LPARAM lParam)
+static INT_PTR svcModernOpt_Impl(WPARAM, LPARAM)
{
if (!hwndModernOpt) {
ModernOptionsData *dat = new ModernOptionsData;
diff --git a/plugins/ModernOpt/src/mopt_home.cpp b/plugins/ModernOpt/src/mopt_home.cpp index da340420b5..5023341d62 100644 --- a/plugins/ModernOpt/src/mopt_home.cpp +++ b/plugins/ModernOpt/src/mopt_home.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern HMODULE hInst;
-INT_PTR CALLBACK ModernOptHome_DlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK ModernOptHome_DlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
{
int i;
diff --git a/plugins/ModernOpt/src/mopt_ignore.cpp b/plugins/ModernOpt/src/mopt_ignore.cpp index 0135165ebc..8f38231f40 100644 --- a/plugins/ModernOpt/src/mopt_ignore.cpp +++ b/plugins/ModernOpt/src/mopt_ignore.cpp @@ -30,7 +30,7 @@ static HWND g_hwndModernOptIgnore = NULL; void ModernOptIgnore_AddItem(MODERNOPTOBJECT *obj)
{
- if ( g_hwndModernOptIgnore )
+ if (g_hwndModernOptIgnore)
SendMessage(g_hwndModernOptIgnore, WM_APP, 0, (LPARAM)obj);
}
diff --git a/plugins/MsgPopup/src/main.cpp b/plugins/MsgPopup/src/main.cpp index c04f171573..3bc56ce52c 100644 --- a/plugins/MsgPopup/src/main.cpp +++ b/plugins/MsgPopup/src/main.cpp @@ -174,13 +174,13 @@ void HookAPI() CloseHandle(hModuleSnap);
}
-int HookedInit(WPARAM wParam, LPARAM lParam)
+int HookedInit(WPARAM, LPARAM)
{
HookAPI();
return 0;
}
-int HookedOptions(WPARAM wParam, LPARAM lParam)
+int HookedOptions(WPARAM wParam, LPARAM)
{
if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
OPTIONSDIALOGPAGE odp = { 0 };
@@ -225,12 +225,12 @@ extern "C" __declspec(dllexport) int Unload(void) return 0;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
hInst = hinstDLL;
return TRUE;
diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp index 134c494b3e..d34894cf92 100644 --- a/plugins/NewAwaySysMod/src/AwayOpt.cpp +++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp @@ -333,13 +333,13 @@ COptPage g_MoreOptPage(MOD_NAME, NULL); void EnableMoreOptDlgControls()
{
- g_MoreOptPage.Enable(IDC_MOREOPTDLG_PERSTATUSPERSONAL, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_SAVEPERSONALMSGS));
- int Enabled = g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_RECENTMSGSCOUNT);
+ g_MoreOptPage.Enable(IDC_MOREOPTDLG_PERSTATUSPERSONAL, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_SAVEPERSONALMSGS) != 0);
+ int Enabled = g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_RECENTMSGSCOUNT) != 0;
g_MoreOptPage.Enable(IDC_MOREOPTDLG_PERSTATUSMRM, Enabled);
g_MoreOptPage.Enable(IDC_MOREOPTDLG_USELASTMSG, Enabled);
g_MoreOptPage.Enable(IDC_MOREOPTDLG_USEDEFMSG, Enabled);
- g_MoreOptPage.Enable(IDC_MOREOPTDLG_PERSTATUSPERSONAL, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_SAVEPERSONALMSGS));
- g_MoreOptPage.Enable(IDC_MOREOPTDLG_UPDATEMSGSPERIOD, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_UPDATEMSGS));
+ g_MoreOptPage.Enable(IDC_MOREOPTDLG_PERSTATUSPERSONAL, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_SAVEPERSONALMSGS) != 0);
+ g_MoreOptPage.Enable(IDC_MOREOPTDLG_UPDATEMSGSPERIOD, g_MoreOptPage.GetWndValue(IDC_MOREOPTDLG_UPDATEMSGS) != 0);
InvalidateRect(GetDlgItem(g_MoreOptPage.GetWnd(), IDC_MOREOPTDLG_UPDATEMSGSPERIOD_SPIN), NULL, false); // update spin control
g_MoreOptPage.MemToPage(true);
}
@@ -454,7 +454,7 @@ COptPage g_AutoreplyOptPage(MOD_NAME, NULL); void EnableAutoreplyOptDlgControls()
{
g_AutoreplyOptPage.PageToMem();
- int Autoreply = g_AutoreplyOptPage.GetValue(IDC_REPLYDLG_ENABLEREPLY);
+ int Autoreply = g_AutoreplyOptPage.GetValue(IDC_REPLYDLG_ENABLEREPLY) != 0;
for (int i = 0; i < g_AutoreplyOptPage.Items.GetSize(); i++) {
switch (g_AutoreplyOptPage.Items[i]->GetParam()) {
@@ -944,7 +944,7 @@ __inline int ReplyIconToDBValue(int Value) static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem)
{
- int Icons[EXTRACOLUMNSCOUNT] = { 0xFF, 0xFF, 0xFF };
+ int GroupIcons[EXTRACOLUMNSCOUNT] = { 0xFF, 0xFF, 0xFF };
int FirstItemType = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
HANDLE hItem = (FirstItemType == CLCIT_GROUP) ? hFirstItem : (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
while (hItem) {
@@ -952,30 +952,31 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt if (hChildItem)
SetListGroupIcons(hwndList, hChildItem, hItem);
- for (int i = 0; i < _countof(Icons); i++) {
+ for (int i = 0; i < _countof(GroupIcons); i++) {
int Icon = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0));
- if (Icons[i] == 0xFF)
- Icons[i] = Icon;
- else if (Icon != 0xFF && Icons[i] != Icon)
- Icons[i] = EXTRAICON_INDEFINITE;
+ if (GroupIcons[i] == 0xFF)
+ GroupIcons[i] = Icon;
+ else if (Icon != 0xFF && GroupIcons[i] != Icon)
+ GroupIcons[i] = EXTRAICON_INDEFINITE;
}
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
}
+
hItem = (FirstItemType == CLCIT_CONTACT) ? hFirstItem : (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
while (hItem) {
- for (int i = 0; i < _countof(Icons); i++) {
+ for (int i = 0; i < _countof(GroupIcons); i++) {
int Icon = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0));
- if (Icons[i] == 0xFF)
- Icons[i] = Icon;
- else if (Icon != 0xFF && Icons[i] != Icon)
- Icons[i] = EXTRAICON_INDEFINITE;
+ if (GroupIcons[i] == 0xFF)
+ GroupIcons[i] = Icon;
+ else if (Icon != 0xFF && GroupIcons[i] != Icon)
+ GroupIcons[i] = EXTRAICON_INDEFINITE;
}
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
// set icons
- for (int i = 0; i < _countof(Icons); i++)
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, Icons[i]));
+ for (int i = 0; i < _countof(GroupIcons); i++)
+ SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, GroupIcons[i]));
}
static void SetAllChildIcons(HWND hwndList, HANDLE hFirstItem, int iColumn, int iImage)
@@ -1065,7 +1066,6 @@ static void SetAllContactIcons(HWND hwndList, HANDLE hItemUnknown) do {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
if (hItem) {
- char *szProto = GetContactProto(hContact);
int Ignore = CContactSettings(ID_STATUS_ONLINE, hContact).Ignore;
int Reply = CContactSettings(ID_STATUS_ONLINE, hContact).Autoreply;
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS)) {
@@ -1098,7 +1098,7 @@ static LRESULT CALLBACK ContactsSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, return CallWindowProc(g_OrigContactsProc, hWnd, Msg, wParam, lParam);
}
-INT_PTR CALLBACK ContactsOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK ContactsOptDlg(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
{
HWND hwndList = GetDlgItem(hwndDlg, IDC_CONTACTSDLG_LIST);
static HANDLE hItemAll, hItemUnknown;
@@ -1360,7 +1360,7 @@ void InitOptions() }
// NightFox
-int ModernOptInitialise(WPARAM wParam, LPARAM lParam)
+int ModernOptInitialise(WPARAM wParam, LPARAM)
{
static int iBoldControls[] =
{
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index b67a5b9cfe..12ce7b1df4 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -72,7 +72,7 @@ PLUGININFOEX pluginInfo = { { 0xb2dd9270, 0xce5e, 0x11df, { 0xbd, 0x3d, 0x8, 0x0, 0x20, 0xc, 0x9a, 0x66 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
g_hInstance = hinstDLL;
return TRUE;
@@ -80,7 +80,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SRAWAY, MIID_LAST }; // TODO: add MIID_WHOISREADING here if there'll be any some time in future..
-extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
@@ -200,7 +200,7 @@ static StatusModeList[] = { int StatusChanged(WPARAM wParam, LPARAM lParam)
{
LogMessage("MS_CLIST_SETSTATUSMODE called. szProto=%s, Status=%d", lParam ? (char*)lParam : "NULL", wParam);
- g_ProtoStates[(char*)lParam].Status = wParam;
+ g_ProtoStates[(char*)lParam].m_status = wParam;
// let's check if we handle this thingy
if (g_fNoProcessing) { // we're told not to do anything
g_fNoProcessing = false; // take it off
@@ -272,7 +272,7 @@ int CSStatusChange(WPARAM wParam, LPARAM lParam) // CommonStatus plugins (Startu i + 1, ps[i]->cbSize, ps[i]->szName ? (char*)ps[i]->szName : "NULL", ps[i]->status, ps[i]->lastStatus, ps[i]->szMsg ? ps[i]->szMsg : _T("NULL"));
if (ps[i]->status != ID_STATUS_DISABLED) {
if (ps[i]->status != ID_STATUS_CURRENT)
- g_ProtoStates[ps[i]->szName].Status = (ps[i]->status == ID_STATUS_LAST) ? ps[i]->lastStatus : ps[i]->status;
+ g_ProtoStates[ps[i]->szName].m_status = (ps[i]->status == ID_STATUS_LAST) ? ps[i]->lastStatus : ps[i]->status;
CProtoSettings(ps[i]->szName).SetMsgFormat(SMF_TEMPORARY, ps[i]->szMsg ? ps[i]->szMsg : CProtoSettings(ps[i]->szName).GetMsgFormat(GMF_LASTORDEFAULT));
}
@@ -322,7 +322,7 @@ int PreBuildContactMenu(WPARAM hContact, LPARAM) // if this contact supports sending/receiving messages
if ((Flag1 & PF1_IM) == PF1_IM) {
- int iAutoreply = CContactSettings(g_ProtoStates[szProto].Status, hContact).Autoreply;
+ int iAutoreply = CContactSettings(g_ProtoStates[szProto].m_status, hContact).Autoreply;
HANDLE hIcon;
switch (iAutoreply) {
case VAL_USEDEFAULT: hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DOT)); break;
@@ -373,10 +373,10 @@ static INT_PTR SetContactStatMsg(WPARAM hContact, LPARAM) INT_PTR ToggleSendOnEvent(WPARAM hContact, LPARAM)
{
// used only for the global setting
- CContactSettings(g_ProtoStates[hContact ? GetContactProto(hContact) : NULL].Status, hContact).Autoreply.Toggle();
+ CContactSettings(g_ProtoStates[hContact ? GetContactProto(hContact) : NULL].m_status, hContact).Autoreply.Toggle();
if (hContact == NULL) {
- int SendOnEvent = CContactSettings(g_ProtoStates[(LPSTR)NULL].Status).Autoreply;
+ int SendOnEvent = CContactSettings(g_ProtoStates[(LPSTR)NULL].m_status).Autoreply;
if (SendOnEvent)
Menu_ModifyItem(g_hToggleSOEMenuItem, ENABLE_SOE_COMMAND, iconList[1].hIcolib);
@@ -392,25 +392,25 @@ INT_PTR ToggleSendOnEvent(WPARAM hContact, LPARAM) INT_PTR srvAutoreplyOn(WPARAM hContact, LPARAM)
{
- CContactSettings(g_ProtoStates[GetContactProto(hContact)].Status, hContact).Autoreply = 1;
+ CContactSettings(g_ProtoStates[GetContactProto(hContact)].m_status, hContact).Autoreply = 1;
return 0;
}
INT_PTR srvAutoreplyOff(WPARAM hContact, LPARAM)
{
- CContactSettings(g_ProtoStates[GetContactProto(hContact)].Status, hContact).Autoreply = 0;
+ CContactSettings(g_ProtoStates[GetContactProto(hContact)].m_status, hContact).Autoreply = 0;
return 0;
}
INT_PTR srvAutoreplyUseDefault(WPARAM hContact, LPARAM)
{
- CContactSettings(g_ProtoStates[GetContactProto(hContact)].Status, hContact).Autoreply = VAL_USEDEFAULT;
+ CContactSettings(g_ProtoStates[GetContactProto(hContact)].m_status, hContact).Autoreply = VAL_USEDEFAULT;
return 0;
}
static int Create_TopToolbar(WPARAM, LPARAM)
{
- int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].Status).Autoreply;
+ int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].m_status).Autoreply;
if (ServiceExists(MS_TTB_REMOVEBUTTON)) {
TTBButton ttbb = { 0 };
ttbb.name = LPGEN("Toggle autoreply on/off");;
@@ -470,15 +470,15 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) ai->flags = AIF_DONTPARSE;
TCString Result;
if (!mir_tstrcmp(ai->targv[0], VAR_AWAYSINCE_TIME)) {
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, g_ProtoStates[VarParseData.szProto].AwaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : _T("H:mm"), Result.GetBuffer(256), 256);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, g_ProtoStates[VarParseData.szProto].m_awaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : _T("H:mm"), Result.GetBuffer(256), 256);
Result.ReleaseBuffer();
}
else if (!mir_tstrcmp(ai->targv[0], VAR_AWAYSINCE_DATE)) {
- GetDateFormat(LOCALE_USER_DEFAULT, 0, g_ProtoStates[VarParseData.szProto].AwaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : NULL, Result.GetBuffer(256), 256);
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, g_ProtoStates[VarParseData.szProto].m_awaySince, (ai->argc > 1 && *ai->targv[1]) ? ai->targv[1] : NULL, Result.GetBuffer(256), 256);
Result.ReleaseBuffer();
}
else if (!mir_tstrcmp(ai->targv[0], VAR_STATDESC)) {
- Result = (VarParseData.Flags & VPF_XSTATUS) ? STR_XSTATUSDESC : pcli->pfnGetStatusModeDescription(g_ProtoStates[VarParseData.szProto].Status, 0);
+ Result = (VarParseData.Flags & VPF_XSTATUS) ? STR_XSTATUSDESC : pcli->pfnGetStatusModeDescription(g_ProtoStates[VarParseData.szProto].m_status, 0);
}
else if (!mir_tstrcmp(ai->targv[0], VAR_MYNICK)) {
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_MYNICKPERPROTO) && VarParseData.szProto)
@@ -503,7 +503,7 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) SYSTEMTIME st;
GetLocalTime(&st);
SystemTimeToFileTime(&st, (LPFILETIME)&ul_Now);
- SystemTimeToFileTime(g_ProtoStates[VarParseData.szProto].AwaySince, (LPFILETIME)&ul_AwaySince);
+ SystemTimeToFileTime(g_ProtoStates[VarParseData.szProto].m_awaySince, (LPFILETIME)&ul_AwaySince);
ul_Now.QuadPart -= ul_AwaySince.QuadPart;
ul_Now.QuadPart /= 10000000; // now it's in seconds
Result.GetBuffer(256);
@@ -609,7 +609,7 @@ int MirandaLoaded(WPARAM, LPARAM) g_hReadWndList = WindowList_Create();
- int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].Status).Autoreply;
+ int SendOnEvent = CContactSettings(g_ProtoStates[(char*)NULL].m_status).Autoreply;
CMenuItem mi;
mi.position = 1000020000;
diff --git a/plugins/NewAwaySysMod/src/Client.cpp b/plugins/NewAwaySysMod/src/Client.cpp index bc733d00c6..adc448b232 100644 --- a/plugins/NewAwaySysMod/src/Client.cpp +++ b/plugins/NewAwaySysMod/src/Client.cpp @@ -35,13 +35,13 @@ void __cdecl UpdateMsgsThreadProc(void *) Proto_EnumAccounts(&numAccs, &accs);
while (WaitForSingleObject(g_hTerminateUpdateMsgsThread, 0) == WAIT_TIMEOUT && !Miranda_Terminated()) {
- DWORD MinUpdateTimeDifference = g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_UPDATEMSGSPERIOD) * 1000; // in milliseconds
+ DWORD MinUpdateTimeDifference = (DWORD)g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_UPDATEMSGSPERIOD) * 1000; // in milliseconds
for (int i = 0; i < numAccs; i++) {
PROTOACCOUNT *p = accs[i];
if (CallProtoService(p->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND && !IsAnICQProto(p->szModuleName)) {
int Status = CallProtoService(p->szModuleName, PS_GETSTATUS, 0, 0);
if (Status < ID_STATUS_OFFLINE || Status > ID_STATUS_OUTTOLUNCH) {
- Status = g_ProtoStates[p->szModuleName].Status;
+ Status = g_ProtoStates[p->szModuleName].m_status;
}
if (CallProtoService(p->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(Status) && g_ProtoStates[p->szModuleName].CurStatusMsg.GetUpdateTimeDifference() >= MinUpdateTimeDifference) {
TCString CurMsg(GetDynamicStatMsg(INVALID_CONTACT_ID, p->szModuleName));
@@ -63,7 +63,7 @@ static void __stdcall DummyAPCFunc(ULONG_PTR) void InitUpdateMsgs()
{
- int UpdateMsgs = g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_UPDATEMSGS);
+ int UpdateMsgs = (int)g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_UPDATEMSGS);
if (g_hUpdateMsgsThread && !UpdateMsgs) {
_ASSERT(WaitForSingleObject(g_hUpdateMsgsThread, 0) == WAIT_TIMEOUT);
SetEvent(g_hTerminateUpdateMsgsThread);
@@ -79,7 +79,7 @@ void InitUpdateMsgs() }
-void ChangeProtoMessages(char* szProto, int iMode, TCString &Msg)
+void ChangeProtoMessages(char* szProto, int iMode, const TCString &Msg)
{
TCString CurMsg(Msg);
if (szProto) {
@@ -109,7 +109,8 @@ void ChangeProtoMessages(char* szProto, int iMode, TCString &Msg) {
int Status;
char *Setting;
- } StatusSettings[] = {
+ }
+ StatusDbSettings[] = {
ID_STATUS_OFFLINE, "Off",
ID_STATUS_ONLINE, "On",
ID_STATUS_AWAY, "Away",
@@ -123,10 +124,10 @@ void ChangeProtoMessages(char* szProto, int iMode, TCString &Msg) ID_STATUS_IDLE, "Idl"
};
- for (int i = 0; i < _countof(StatusSettings); i++) {
- if (iMode == StatusSettings[i].Status) {
- db_set_ts(NULL, "SRAway", CString(StatusSettings[i].Setting) + "Msg", CurMsg);
- db_set_ts(NULL, "SRAway", CString(StatusSettings[i].Setting) + "Default", CurMsg); // TODO: make it more accurate, and change not only here, but when changing status messages through UpdateMsgsTimerFunc too; and when changing messages through AutoAway() ?
+ for (int i = 0; i < _countof(StatusDbSettings); i++) {
+ if (iMode == StatusDbSettings[i].Status) {
+ db_set_ts(NULL, "SRAway", CString(StatusDbSettings[i].Setting) + "Msg", CurMsg);
+ db_set_ts(NULL, "SRAway", CString(StatusDbSettings[i].Setting) + "Default", CurMsg); // TODO: make it more accurate, and change not only here, but when changing status messages through UpdateMsgsTimerFunc too; and when changing messages through AutoAway() ?
break;
}
}
diff --git a/plugins/NewAwaySysMod/src/ContactList.cpp b/plugins/NewAwaySysMod/src/ContactList.cpp index a920db8026..355b51e037 100644 --- a/plugins/NewAwaySysMod/src/ContactList.cpp +++ b/plugins/NewAwaySysMod/src/ContactList.cpp @@ -51,7 +51,6 @@ void LoadCListModule() HookEvent(ME_SKIN_ICONSCHANGED, CLIconsChanged);
}
-
static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
CCList *dat = CWndUserData(hWnd).GetCList();
@@ -151,8 +150,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L return CallWindowProc(dat->OrigParentProc, hWnd, Msg, wParam, lParam);
}
-
-static LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
TVITEM tvi;
CCList *dat = CWndUserData(GetParent(hWnd)).GetCList();
@@ -464,7 +462,7 @@ void CCList::SetInfoIcon(HTREEITEM hItem, HICON hIcon) TreeView_SetItem(hTreeView, &tvi);
}
-static int CALLBACK CompareItemsCallback(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
+int CALLBACK CompareItemsCallback(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
CCList *dat = (CCList*)lParamSort;
if (IsHContactInfo(dat->Items[lParam1].hContact)) // Info items precede all other items
@@ -689,13 +687,13 @@ CCLItemData& CCList::GetItemData(HTREEITEM hItem) return Items[tvi.lParam];
}
-HTREEITEM CCList::TreeView_GetLastChild(HWND hTreeView, HTREEITEM hItem)
+HTREEITEM CCList::TreeView_GetLastChild(HWND hTree, HTREEITEM hItem)
{
- HTREEITEM hPrevItem = TreeView_GetChild(hTreeView, hItem);
+ HTREEITEM hPrevItem = TreeView_GetChild(hTree, hItem);
hItem = hPrevItem;
while (hItem) { // find last sibling
hPrevItem = hItem;
- hItem = TreeView_GetNextSibling(hTreeView, hPrevItem);
+ hItem = TreeView_GetNextSibling(hTree, hPrevItem);
}
return hPrevItem;
}
diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index ac2cda974b..50da664b4e 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -173,7 +173,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) return 0;
}
- unsigned int iMode = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
+ int iMode = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
int i;
for (i = _countof(StatusModeList) - 1; i >= 0; i--)
if (iMode == StatusModeList[i].Status)
@@ -217,7 +217,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) if (IsAnICQProto(szProto))
UIN = db_get_dw(hContact, szProto, "UIN", 0);
- int SendCount = AutoreplyOptData.GetValue(IDC_REPLYDLG_SENDCOUNT);
+ int SendCount = (int)AutoreplyOptData.GetValue(IDC_REPLYDLG_SENDCOUNT);
if ((AutoreplyOptData.GetValue(IDC_REPLYDLG_DONTSENDTOICQ) && UIN) || // an icq contact
(SendCount != -1 && db_get_b(hContact, MOD_NAME, DB_SENDCOUNT, 0) >= SendCount))
return 0;
diff --git a/plugins/NewAwaySysMod/src/MsgTree.cpp b/plugins/NewAwaySysMod/src/MsgTree.cpp index f515e7c65b..7263f8a0c6 100644 --- a/plugins/NewAwaySysMod/src/MsgTree.cpp +++ b/plugins/NewAwaySysMod/src/MsgTree.cpp @@ -175,7 +175,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L int iSize = GetSystemMetrics(SM_CXSMICON);
int x = rc.left - iSize - 5;
for (int i = 0; i < _countof(SettingsList); i++) {
- if (lpNMCD->nmcd.lItemlParam == dat->MsgTreePage.GetValue(SettingsList[i].DBSetting)) {
+ if (lpNMCD->nmcd.lItemlParam == (LPARAM)dat->MsgTreePage.GetValue(SettingsList[i].DBSetting)) {
DrawIconEx(lpNMCD->nmcd.hdc, x, rc.top, Skin_LoadProtoIcon(NULL, SettingsList[i].Status), iSize, iSize, 0, GetSysColorBrush(COLOR_WINDOW), DI_NORMAL);
x -= iSize + 1;
}
@@ -256,7 +256,7 @@ static LRESULT CALLBACK ParentSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, L return CallWindowProc(dat->OrigParentProc, hWnd, Msg, wParam, lParam);
}
-static LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
CMsgTree *dat = CWndUserData(GetParent(hWnd)).GetMsgTree();
switch (Msg) {
@@ -390,15 +390,14 @@ static LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, mii.cbSize = sizeof(mii);
mii.fMask = MIIM_BITMAP | MIIM_DATA | MIIM_STATE | MIIM_CHECKMARKS;
mii.hbmpItem = HBMMENU_CALLBACK;
- int i;
- for (i = 0; i < _countof(MenuItems); i++) { // set icons
+ for (int i = 0; i < _countof(MenuItems); i++) { // set icons
mii.dwItemData = MenuItems[i].IconID;
SetMenuItemInfo(hPopupMenu, MenuItems[i].ItemID, false, &mii);
}
mii.fMask = MIIM_STATE;
mii.fState = MFS_CHECKED;
- for (i = 0; i < _countof(SettingsList); i++) // set checkmarks
- if (TreeCtrl->Value[Order].ID == dat->MsgTreePage.GetValue(SettingsList[i].DBSetting))
+ for (int i = 0; i < _countof(SettingsList); i++) // set checkmarks
+ if (TreeCtrl->Value[Order].ID == (int)dat->MsgTreePage.GetValue(SettingsList[i].DBSetting))
SetMenuItemInfo(hPopupMenu, SettingsList[i].MenuItemID, false, &mii);
int MenuResult = TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, ht.pt.x, ht.pt.y, 0, hWnd, NULL);
@@ -515,7 +514,7 @@ int CMsgTree::GetDefMsg(int iMode) {
for (int i = 0; i < _countof(SettingsList); i++)
if (SettingsList[i].Status == iMode)
- return MsgTreePage.GetValue(SettingsList[i].DBSetting);
+ return (int)MsgTreePage.GetValue(SettingsList[i].DBSetting);
return 0;
}
@@ -524,10 +523,10 @@ void CMsgTree::SetDefMsg(int iMode, int ID) {
for (int i = 0; i < _countof(SettingsList); i++) {
if (SettingsList[i].Status == iMode) {
- if (MsgTreePage.GetValue(SettingsList[i].DBSetting) != ID) {
+ if ((int)MsgTreePage.GetValue(SettingsList[i].DBSetting) != ID) {
RECT rc;
COptItem_TreeCtrl *TreeCtrl = GetTreeCtrl();
- int OrderOld = TreeCtrl->IDToOrder(MsgTreePage.GetValue(SettingsList[i].DBSetting));
+ int OrderOld = TreeCtrl->IDToOrder((int)MsgTreePage.GetValue(SettingsList[i].DBSetting));
if (OrderOld >= 0 && TreeView_GetItemRect(hTreeView, TreeCtrl->Value[OrderOld].hItem, &rc, false))
InvalidateRect(hTreeView, &rc, true); // refresh icons of previous default tree item
@@ -652,10 +651,10 @@ CTreeItem* CMsgTree::AddMessage() return TreeItem;
}
-CBaseTreeItem* CMsgTree::GetNextItem(int Flags, CBaseTreeItem* Item) // Item is 'int ID' if MTGN_BYID flag is set; returns CBaseTreeItem* or NULL
+CBaseTreeItem* CMsgTree::GetNextItem(int Flags, CBaseTreeItem *Item) // Item is 'int ID' if MTGN_BYID flag is set; returns CBaseTreeItem* or NULL
{
COptItem_TreeCtrl *TreeCtrl = GetTreeCtrl();
- CBaseTreeItem* TreeItem = Item;
+ CBaseTreeItem *TreeItem = Item;
if (Flags & MTGN_BYID) {
int Order = TreeCtrl->IDToOrder((int)Item);
_ASSERT(Order != -1);
@@ -671,6 +670,7 @@ CBaseTreeItem* CMsgTree::GetNextItem(int Flags, CBaseTreeItem* Item) // Item is case MTGN_PREV: TVFlag = TVGN_PREVIOUS; break;
default: _ASSERT(0);
}
+
int Order = TreeCtrl->hItemToOrder(TreeView_GetNextItem(hTreeView, TreeItem ? TreeItem->hItem : NULL, TVFlag));
if (Order == -1)
return NULL;
diff --git a/plugins/NewAwaySysMod/src/Notification.cpp b/plugins/NewAwaySysMod/src/Notification.cpp index a26b823b27..2d004aa625 100644 --- a/plugins/NewAwaySysMod/src/Notification.cpp +++ b/plugins/NewAwaySysMod/src/Notification.cpp @@ -66,7 +66,7 @@ static VOID CALLBACK ShowContactMenu(MCONTACT hContact) void ShowLog(TCString &LogFilePath)
{
- int Result = (int)ShellExecute(NULL, _T("open"), LogFilePath, NULL, NULL, SW_SHOW);
+ INT_PTR Result = (INT_PTR)ShellExecute(NULL, _T("open"), LogFilePath, NULL, NULL, SW_SHOW);
if (Result <= 32) {
TCHAR szError[64];
mir_sntprintf(szError, _countof(szError), TranslateT("Error #%d"), Result);
diff --git a/plugins/NewAwaySysMod/src/Options.cpp b/plugins/NewAwaySysMod/src/Options.cpp index cce59a1601..3bdb0d2660 100644 --- a/plugins/NewAwaySysMod/src/Options.cpp +++ b/plugins/NewAwaySysMod/src/Options.cpp @@ -114,20 +114,20 @@ COptPage& COptPage::operator = (const COptPage& Page) }
-int COptItem::GetIntDBVal(CString &sModule, int bSigned, CString *sDBSettingPrefix)
+int COptItem::GetIntDBVal(const CString &sModule, int bSigned, CString*)
{ // default procedure for reading value from DB; used only for integral types
if (sDBSetting != NULL) {
_ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD);
DBVARIANT dbv;
if (db_get(NULL, sModule, sDBSetting, &dbv))
- return GetDefValue();
+ return (int)GetDefValue();
return (nValueSize == DBVT_BYTE) ? (bSigned ? (signed char)dbv.bVal : (unsigned char)dbv.bVal) : ((nValueSize == DBVT_WORD) ? (bSigned ? (signed short)dbv.wVal : (unsigned short)dbv.wVal) : dbv.dVal);
}
- return GetDefValue();
+ return (int)GetDefValue();
}
-void COptItem::SetIntDBVal(CString &sModule, int Value, CString *sDBSettingPrefix)
+void COptItem::SetIntDBVal(const CString &sModule, int Value, CString*)
{ // default procedure for writing value to the DB; used only for integral types
if (sDBSetting != NULL && !ReadOnly) {
_ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD);
@@ -139,7 +139,7 @@ void COptItem::SetIntDBVal(CString &sModule, int Value, CString *sDBSettingPrefi }
}
-TCString COptItem::GetStrDBVal(CString &sModule, CString *sDBSettingPrefix)
+TCString COptItem::GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix)
{
if (sDBSetting != NULL) {
_ASSERT(GetDefValue());
@@ -148,14 +148,14 @@ TCString COptItem::GetStrDBVal(CString &sModule, CString *sDBSettingPrefix) return *(TCString*)GetDefValue();
}
-void COptItem::SetStrDBVal(CString &sModule, TCString &Str, CString *sDBSettingPrefix)
+void COptItem::SetStrDBVal(const CString &sModule, TCString &Str, CString *sDBSettingPrefix)
{
if (sDBSetting != NULL && !ReadOnly) {
db_set_ts(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting, Str);
}
}
-void COptItem_Checkbox::DBToMem(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_Checkbox::DBToMem(const CString &sModule, CString *sDBSettingPrefix)
{
if (ValueMask)
Value = (GetIntDBVal(sModule, false, sDBSettingPrefix) & ValueMask) ? BST_CHECKED : BST_UNCHECKED;
@@ -165,7 +165,7 @@ void COptItem_Checkbox::DBToMem(CString &sModule, CString *sDBSettingPrefix) COptItem::DBToMem(sModule, sDBSettingPrefix);
}
-void COptItem_Checkbox::MemToDB(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_Checkbox::MemToDB(const CString &sModule, CString *sDBSettingPrefix)
{
if (ValueMask) {
if (Value == BST_CHECKED)
@@ -192,7 +192,7 @@ void COptItem_Checkbox::MemToWnd(HWND hWnd) COptItem::MemToWnd(hWnd);
}
-void COptItem_BitDBSetting::DBToMem(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_BitDBSetting::DBToMem(const CString &sModule, CString *sDBSettingPrefix)
{
if (ValueMask)
Value = (GetIntDBVal(sModule, false, sDBSettingPrefix) & ValueMask) != 0;
@@ -202,7 +202,7 @@ void COptItem_BitDBSetting::DBToMem(CString &sModule, CString *sDBSettingPrefix) COptItem::DBToMem(sModule, sDBSettingPrefix);
}
-void COptItem_BitDBSetting::MemToDB(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_BitDBSetting::MemToDB(const CString &sModule, CString *sDBSettingPrefix)
{
if (ValueMask) {
if (Value)
@@ -253,51 +253,55 @@ int COptItem_TreeCtrl::GenerateID() return ID;
}
-typedef struct
+struct sTreeReadEnumData
{
+ sTreeReadEnumData(COptItem_TreeCtrl *_p1, const CString &_p2, const CString &_p3) :
+ TreeCtrl(_p1),
+ sModule(_p2),
+ sDBSettingPrefix(_p3)
+ {}
+
COptItem_TreeCtrl *TreeCtrl;
- CString *sModule;
- CString *sDBSettingPrefix;
-} sTreeReadEnumData;
+ const CString &sModule, &sDBSettingPrefix;
+};
int TreeReadEnum(const char *szSetting, LPARAM lParam)
{
- sTreeReadEnumData *TreeReadEnumData = (sTreeReadEnumData*)lParam;
- int Len = TreeReadEnumData->TreeCtrl->sDBSetting.GetLen() + _countof(TREEITEM_DBSTR_TITLE) - 1;
- if (!strncmp(szSetting, TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_TITLE, Len) && isdigit(szSetting[Len])) {
+ sTreeReadEnumData *pData = (sTreeReadEnumData*)lParam;
+ int Len = pData->TreeCtrl->sDBSetting.GetLen() + _countof(TREEITEM_DBSTR_TITLE) - 1;
+ if (!strncmp(szSetting, pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_TITLE, Len) && isdigit(szSetting[Len])) {
int ID = atol(szSetting + Len);
- short ParentID = (TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) ? 0 : db_get_w(NULL, *TreeReadEnumData->sModule,
- *TreeReadEnumData->sDBSettingPrefix + TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_PARENT + (szSetting + Len), -1);
- short Order = db_get_w(NULL, *TreeReadEnumData->sModule,
- *TreeReadEnumData->sDBSettingPrefix + TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_ORDER + (szSetting + Len), -1);
- char Flags = (TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL && !(TreeReadEnumData->TreeCtrl->TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)) ? 0 : db_get_b(NULL, *TreeReadEnumData->sModule,
- *TreeReadEnumData->sDBSettingPrefix + TreeReadEnumData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_FLAGS + (szSetting + Len), 0);
+ short ParentID = (pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) ? 0 : db_get_w(NULL, pData->sModule,
+ pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_PARENT + (szSetting + Len), -1);
+ short Order = db_get_w(NULL, pData->sModule,
+ pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_ORDER + (szSetting + Len), -1);
+ char Flags = (pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL && !(pData->TreeCtrl->TreeFlags & TREECTRL_FLAG_HAS_CHECKBOXES)) ? 0 : db_get_b(NULL, pData->sModule,
+ pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + TREEITEM_DBSTR_FLAGS + (szSetting + Len), 0);
if (ParentID >= 0 && Order >= 0) {
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).ID = ID;
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).ParentID = ParentID;
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).Flags = Flags;
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).hItem = NULL;
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).Title = db_get_s(NULL, *TreeReadEnumData->sModule, *TreeReadEnumData->sDBSettingPrefix + szSetting, _T(""));
- TreeReadEnumData->TreeCtrl->Value.SetAtGrow(Order).User_Str1 = (TreeReadEnumData->TreeCtrl->User_Str1_DBName == NULL) ? NULL :
- db_get_s(NULL, *TreeReadEnumData->sModule,
- *TreeReadEnumData->sDBSettingPrefix + TreeReadEnumData->TreeCtrl->sDBSetting + TreeReadEnumData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (TCHAR*)NULL);
+ CTreeItem &pItem = pData->TreeCtrl->Value.SetAtGrow(Order);
+ pItem.ID = ID;
+ pItem.ParentID = ParentID;
+ pItem.Flags = Flags;
+ pItem.hItem = NULL;
+ pItem.Title = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, _T(""));
+ pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == NULL) ? NULL :
+ db_get_s(NULL, pData->sModule,
+ *pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + pData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (TCHAR*)NULL);
}
}
return 0;
}
-void COptItem_TreeCtrl::DBToMem(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_TreeCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefix)
{
if (!sDBSettingPrefix)
sDBSettingPrefix = &sEmptyString;
Value.RemoveAll();
- sTreeReadEnumData TreeReadEnumData;
- TreeReadEnumData.TreeCtrl = this;
- TreeReadEnumData.sModule = &sModule;
- TreeReadEnumData.sDBSettingPrefix = sDBSettingPrefix;
+ sTreeReadEnumData pData(this, sModule, *sDBSettingPrefix);
+
DBCONTACTENUMSETTINGS dbEnum;
- dbEnum.lParam = (LPARAM)&TreeReadEnumData;
+ dbEnum.lParam = (LPARAM)&pData;
dbEnum.ofsSettings = 0;
dbEnum.pfnEnumProc = TreeReadEnum;
dbEnum.szModule = sModule;
@@ -316,7 +320,7 @@ void COptItem_TreeCtrl::DBToMem(CString &sModule, CString *sDBSettingPrefix) COptItem::DBToMem(sModule, sDBSettingPrefix);
}
-void COptItem_TreeCtrl::MemToDB(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_TreeCtrl::MemToDB(const CString &sModule, CString *sDBSettingPrefix)
{
if (!ReadOnly && Modified) {
if (!sDBSettingPrefix)
@@ -469,7 +473,7 @@ int TreeDeleteEnum(const char *szSetting, LPARAM lParam) return 0;
}
-void COptItem_TreeCtrl::CleanDBSettings(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_TreeCtrl::CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix)
{
if (!sDBSettingPrefix)
sDBSettingPrefix = &sEmptyString;
@@ -638,36 +642,38 @@ void COptItem_TreeCtrl::MoveItem(HWND hWnd, HTREEITEM hItem, HTREEITEM hMoveTo) // ================================================ COptItem_ListCtrl ================================================
-typedef struct
+struct sListReadEnumData
{
+ sListReadEnumData(COptItem_ListCtrl *p1, const CString &p2, const CString &p3) :
+ ListCtrl(p1),
+ sModule(p2),
+ sDBSettingPrefix(p3)
+ {}
+
COptItem_ListCtrl *ListCtrl;
- CString *sModule;
- CString *sDBSettingPrefix;
-} sListReadEnumData;
+ const CString &sModule, &sDBSettingPrefix;
+};
int ListReadEnum(const char *szSetting, LPARAM lParam)
{
- sListReadEnumData *ListReadEnumData = (sListReadEnumData*)lParam;
- int Len = ListReadEnumData->sDBSettingPrefix->GetLen() + ListReadEnumData->ListCtrl->sDBSetting.GetLen() + _countof(LISTITEM_DBSTR_TEXT) - 1;
- if (!strncmp(szSetting, *ListReadEnumData->sDBSettingPrefix + ListReadEnumData->ListCtrl->sDBSetting + LISTITEM_DBSTR_TEXT, Len) && isdigit(szSetting[Len])) {
+ sListReadEnumData *pData = (sListReadEnumData*)lParam;
+ int Len = pData->sDBSettingPrefix.GetLen() + pData->ListCtrl->sDBSetting.GetLen() + _countof(LISTITEM_DBSTR_TEXT) - 1;
+ if (!strncmp(szSetting, pData->sDBSettingPrefix + pData->ListCtrl->sDBSetting + LISTITEM_DBSTR_TEXT, Len) && isdigit(szSetting[Len])) {
int ID = atol(szSetting + Len);
- ListReadEnumData->ListCtrl->Value.SetAtGrow(ID).Text = db_get_s(NULL, *ListReadEnumData->sModule, *ListReadEnumData->sDBSettingPrefix + szSetting, _T(""));
+ pData->ListCtrl->Value.SetAtGrow(ID).Text = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, _T(""));
}
return 0;
}
-void COptItem_ListCtrl::DBToMem(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_ListCtrl::DBToMem(const CString &sModule, CString *sDBSettingPrefix)
{
if (!sDBSettingPrefix)
sDBSettingPrefix = &sEmptyString;
Value.RemoveAll();
- sListReadEnumData ListReadEnumData;
- ListReadEnumData.ListCtrl = this;
- ListReadEnumData.sModule = &sModule;
- ListReadEnumData.sDBSettingPrefix = sDBSettingPrefix;
+ sListReadEnumData pData(this, sModule, *sDBSettingPrefix);
DBCONTACTENUMSETTINGS dbEnum;
- dbEnum.lParam = (LPARAM)&ListReadEnumData;
+ dbEnum.lParam = (LPARAM)&pData;
dbEnum.ofsSettings = 0;
dbEnum.pfnEnumProc = ListReadEnum;
dbEnum.szModule = sModule;
@@ -685,7 +691,7 @@ void COptItem_ListCtrl::DBToMem(CString &sModule, CString *sDBSettingPrefix) COptItem::DBToMem(sModule, sDBSettingPrefix);
}
-void COptItem_ListCtrl::MemToDB(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_ListCtrl::MemToDB(const CString &sModule, CString *sDBSettingPrefix)
{
if (!ReadOnly && Modified) {
if (!sDBSettingPrefix)
@@ -738,7 +744,7 @@ int ListDeleteEnum(const char *szSetting, LPARAM lParam) return 0;
}
-void COptItem_ListCtrl::CleanDBSettings(CString &sModule, CString *sDBSettingPrefix)
+void COptItem_ListCtrl::CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix)
{
if (!sDBSettingPrefix)
sDBSettingPrefix = &sEmptyString;
diff --git a/plugins/NewAwaySysMod/src/Options.h b/plugins/NewAwaySysMod/src/Options.h index 8560b5d705..1e547356cb 100644 --- a/plugins/NewAwaySysMod/src/Options.h +++ b/plugins/NewAwaySysMod/src/Options.h @@ -26,48 +26,50 @@ class COptItem {
public:
COptItem() {}
- COptItem(int DlgItemID, char *szDBSetting, int nValueSize, int lParam = 0, bool ReadOnly = false):
- DlgItemID(DlgItemID), nValueSize(nValueSize), sDBSetting(szDBSetting), lParam(lParam), Enabled(true), ReadOnly(ReadOnly), Modified(false) {}
-/* COptItem(const COptItem &Item): DlgItemID(Item.DlgItemID), nValueSize(Item.nValueSize),
- sDBSetting(Item.szDBSetting), lParam(Item.lParam), Enabled(Item.Enabled) {};*/
+ COptItem(int DlgItemID, char *szDBSetting, int nValueSize, int lParam = 0, bool ReadOnly = false) :
+ DlgItemID(DlgItemID), nValueSize(nValueSize), sDBSetting(szDBSetting), lParam(lParam), Enabled(true), ReadOnly(ReadOnly), Modified(false)
+ {
+ }
+
virtual ~COptItem() {}
- virtual void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Modified = false;}
- virtual void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {Modified = false;}
- virtual void WndToMem(HWND hWnd) {}
- virtual void MemToWnd(HWND hWnd) {EnableWindow(GetDlgItem(hWnd, DlgItemID), Enabled);}
- void DBToMemToWnd(CString &sModule, HWND hWnd, CString *sDBSettingPrefix = NULL) {DBToMem(sModule, sDBSettingPrefix); MemToWnd(hWnd);}
- void WndToMemToDB(HWND hWnd, CString &sModule, CString *sDBSettingPrefix = NULL) {WndToMem(hWnd); MemToDB(sModule, sDBSettingPrefix);}
- virtual void CleanDBSettings(CString &sModule, CString *sDBSettingPrefix = NULL) {db_unset(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting);}; // TODO: also set Value to DefValue?
-
- virtual void SetValue(int Value) {Modified = true;}
- virtual void SetDefValue(int DefValue) {}
- virtual int GetValue() {return 0;}
- virtual int GetDefValue() {return 0;}
- int GetDBValue(CString &sModule, CString *sDBSettingPrefix = NULL) {DBToMem(sModule, sDBSettingPrefix); return GetValue();}
- void SetDBValue(CString &sModule, int Value, CString *sDBSettingPrefix = NULL) {SetValue(Value); MemToDB(sModule, sDBSettingPrefix);}
- int GetDBValueCopy(CString &sModule, CString *sDBSettingPrefix = NULL) {COptItem* Item = Copy(); Item->DBToMem(sModule, sDBSettingPrefix); int Value = Item->GetValue(); delete Item; return Value;} // retrieves DB value, but doesn't affect current page/item state; beware! it doesn't work with string values / other dynamic pointers
- void SetDBValueCopy(CString &sModule, int Value, CString *sDBSettingPrefix = NULL) {COptItem* Item = Copy(); Item->SetValue(Value); Item->MemToDB(sModule, sDBSettingPrefix); delete Item;}
- int GetWndValue(HWND hWnd) {WndToMem(hWnd); return GetValue();}
- void SetWndValue(HWND hWnd, int Value) {SetValue(Value); MemToWnd(hWnd);}
- void SetDlgItemID(int DlgItemID) {this->DlgItemID = DlgItemID;}
- bool GetModified() {return Modified;}
- void SetModified(bool Modified) {this->Modified = Modified;}
-
- void Enable(int Enabled) {this->Enabled = Enabled;}
- int GetParam() {return lParam;}
- int GetID() {return DlgItemID;}
-
-// virtual COptItem& operator = (const COptItem& Item) {return *this;};
- virtual COptItem* Copy() {_ASSERT(0); return NULL;} // Attention! Free Copy() result when it's not needed anymore!
+ virtual void DBToMem(const CString&, CString* = NULL) { Modified = false; }
+ virtual void MemToDB(const CString&, CString* = NULL) { Modified = false; }
+ virtual void WndToMem(HWND) {}
+ virtual void MemToWnd(HWND hWnd) { EnableWindow(GetDlgItem(hWnd, DlgItemID), Enabled); }
+ void DBToMemToWnd(const CString &sModule, HWND hWnd, CString *sDBSettingPrefix = NULL) { DBToMem(sModule, sDBSettingPrefix); MemToWnd(hWnd); }
+ void WndToMemToDB(HWND hWnd, const CString &sModule, CString *sDBSettingPrefix = NULL) { WndToMem(hWnd); MemToDB(sModule, sDBSettingPrefix); }
+ virtual void CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix = NULL) { db_unset(NULL, sModule, sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting); }; // TODO: also set Value to DefValue?
+
+ virtual void SetValue(int) { Modified = true; }
+ virtual void SetDefValue(int) {}
+ virtual int GetValue() { return 0; }
+ virtual int GetDefValue() { return 0; }
+
+ int GetDBValue(const CString &sModule, CString *sDBSettingPrefix = NULL) { DBToMem(sModule, sDBSettingPrefix); return GetValue(); }
+ void SetDBValue(const CString &sModule, int Value, CString *sDBSettingPrefix = NULL) { SetValue(Value); MemToDB(sModule, sDBSettingPrefix); }
+ int GetDBValueCopy(const CString &sModule, CString *sDBSettingPrefix = NULL) { COptItem* Item = Copy(); Item->DBToMem(sModule, sDBSettingPrefix); int Value = Item->GetValue(); delete Item; return Value; } // retrieves DB value, but doesn't affect current page/item state; beware! it doesn't work with string values / other dynamic pointers
+ void SetDBValueCopy(const CString &sModule, int Value, CString *sDBSettingPrefix = NULL) { COptItem* Item = Copy(); Item->SetValue(Value); Item->MemToDB(sModule, sDBSettingPrefix); delete Item; }
+ int GetWndValue(HWND hWnd) { WndToMem(hWnd); return GetValue(); }
+ void SetWndValue(HWND hWnd, int Value) { SetValue(Value); MemToWnd(hWnd); }
+ void SetDlgItemID(int _DlgItemID) { this->DlgItemID = _DlgItemID; }
+ bool GetModified() { return Modified; }
+ void SetModified(bool _Modified) { this->Modified = _Modified; }
+
+ void Enable(int _Enabled) { this->Enabled = _Enabled; }
+ int GetParam() { return lParam; }
+ int GetID() { return DlgItemID; }
+
+ // virtual COptItem& operator = (const COptItem& Item) {return *this;};
+ virtual COptItem* Copy() { _ASSERT(0); return NULL; } // Attention! Free Copy() result when it's not needed anymore!
CString sDBSetting;
protected:
- int GetIntDBVal(CString &sModule, int bSigned = false, CString *sDBSettingPrefix = NULL);
- void SetIntDBVal(CString &sModule, int Value, CString *sDBSettingPrefix = NULL);
- TCString GetStrDBVal(CString &sModule, CString *sDBSettingPrefix = NULL);
- void SetStrDBVal(CString &sModule, TCString &Str, CString *sDBSettingPrefix = NULL);
+ int GetIntDBVal(const CString &sModule, int bSigned = false, CString *sDBSettingPrefix = NULL);
+ void SetIntDBVal(const CString &sModule, int Value, CString *sDBSettingPrefix = NULL);
+ TCString GetStrDBVal(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void SetStrDBVal(const CString &sModule, TCString &Str, CString *sDBSettingPrefix = NULL);
int DlgItemID;
int Enabled;
@@ -77,33 +79,34 @@ protected: int lParam;
};
-
class COptItem_Generic : public COptItem
{
public:
COptItem_Generic() {}
- COptItem_Generic(int DlgItemID, int lParam = 0): COptItem(DlgItemID, NULL, 0, lParam) {}
- virtual COptItem* Copy() {return new COptItem_Generic(*this);}
+ COptItem_Generic(int DlgItemID, int lParam = 0) : COptItem(DlgItemID, NULL, 0, lParam) {}
+ virtual COptItem* Copy() { return new COptItem_Generic(*this); }
};
-
class COptItem_Edit : public COptItem
{
public:
COptItem_Edit() {}
- COptItem_Edit(int DlgItemID, char *szDBSetting, int nMaxLen, TCHAR *szDefValue, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nMaxLen, lParam, ReadOnly), sDefValue(szDefValue) {}
-// COptItem_Edit(const COptItem_Edit &Item): sDefValue(Item.sDefValue), sValue(Item.sValue) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {GetDlgItemText(hWnd, DlgItemID, sValue.GetBuffer(nValueSize), nValueSize); sValue.ReleaseBuffer(); COptItem::MemToWnd(hWnd);}
- void MemToWnd(HWND hWnd) {SetDlgItemText(hWnd, DlgItemID, sValue); COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {sValue = *(TCString*)Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {sDefValue = *(TCString*)DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return (int)&sValue;}
- int GetDefValue() {return (int)&sDefValue;}
-
-// COptItem_Edit& operator = (const COptItem_Edit& Item) {return *this;};
- virtual COptItem* Copy() {return new COptItem_Edit(*this);}
+ COptItem_Edit(int DlgItemID, char *szDBSetting, int nMaxLen, TCHAR *szDefValue, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nMaxLen, lParam, ReadOnly), sDefValue(szDefValue)
+ {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { GetDlgItemText(hWnd, DlgItemID, sValue.GetBuffer(nValueSize), nValueSize); sValue.ReleaseBuffer(); COptItem::MemToWnd(hWnd); }
+ void MemToWnd(HWND hWnd) { SetDlgItemText(hWnd, DlgItemID, sValue); COptItem::MemToWnd(hWnd); }
+ void SetValue(int Value) { sValue = *(TCString*)Value; COptItem::SetValue(Value); }
+ void SetDefValue(int DefValue) { sDefValue = *(TCString*)DefValue; COptItem::SetDefValue(DefValue); }
+
+ virtual int GetValue() { return 1; }
+ virtual int GetDefValue() { return 1; }
+
+ // COptItem_Edit& operator = (const COptItem_Edit& Item) {return *this;};
+ virtual COptItem* Copy() { return new COptItem_Edit(*this); }
TCString sDefValue;
TCString sValue;
@@ -114,16 +117,20 @@ class COptItem_IntEdit : public COptItem {
public:
COptItem_IntEdit() {}
- COptItem_IntEdit(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int bSigned = true, int DefValue = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), bSigned(bSigned) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Value = GetIntDBVal(sModule, bSigned, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {Value = GetDlgItemInt(hWnd, DlgItemID, NULL, bSigned); COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {SetDlgItemInt(hWnd, DlgItemID, Value, bSigned); COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_IntEdit(*this);}
+ COptItem_IntEdit(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int bSigned = true, int DefValue = 0, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), bSigned(bSigned)
+ {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { Value = GetIntDBVal(sModule, bSigned, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { Value = GetDlgItemInt(hWnd, DlgItemID, NULL, bSigned); COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { SetDlgItemInt(hWnd, DlgItemID, Value, bSigned); COptItem::MemToWnd(hWnd); }
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_IntEdit(*this); }
int DefValue;
int Value;
@@ -135,82 +142,89 @@ class COptItem_Checkbox : public COptItem {
public:
COptItem_Checkbox() {}
- COptItem_Checkbox(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int ValueMask = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), ValueMask(ValueMask) {}
+ COptItem_Checkbox(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int ValueMask = 0, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), ValueMask(ValueMask)
+ {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL);
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL);
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL);
void WndToMem(HWND hWnd);
void MemToWnd(HWND hWnd);
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_Checkbox(*this);}
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_Checkbox(*this); }
int Value;
int DefValue;
int ValueMask;
};
-
class COptItem_Radiobutton : public COptItem
{
public:
COptItem_Radiobutton() {}
- COptItem_Radiobutton(int DlgItemID, char *szDBSetting, int nValueSize, int DefValue, int ValueMask, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), ValueMask(ValueMask) {}
+ COptItem_Radiobutton(int DlgItemID, char *szDBSetting, int nValueSize, int DefValue, int ValueMask, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), ValueMask(ValueMask)
+ {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Value = (GetIntDBVal(sModule, false, sDBSettingPrefix) == ValueMask) ? BST_CHECKED : BST_UNCHECKED; COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {if ((Value == BST_CHECKED)) SetIntDBVal(sModule, ValueMask, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {Value = IsDlgButtonChecked(hWnd, DlgItemID); COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {CheckDlgButton(hWnd, DlgItemID, Value ? BST_CHECKED : BST_UNCHECKED); COptItem::MemToWnd(hWnd);}
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { Value = (GetIntDBVal(sModule, false, sDBSettingPrefix) == ValueMask) ? BST_CHECKED : BST_UNCHECKED; COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { if ((Value == BST_CHECKED)) SetIntDBVal(sModule, ValueMask, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { Value = IsDlgButtonChecked(hWnd, DlgItemID); COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { CheckDlgButton(hWnd, DlgItemID, Value ? BST_CHECKED : BST_UNCHECKED); COptItem::MemToWnd(hWnd); }
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_Radiobutton(*this);}
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_Radiobutton(*this); }
int Value;
int DefValue;
int ValueMask;
};
-
class COptItem_Combobox : public COptItem
{
public:
COptItem_Combobox() {}
- COptItem_Combobox(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {Value = SendDlgItemMessage(hWnd, DlgItemID, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hWnd, DlgItemID, CB_GETCURSEL, 0, 0), 0); COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {SendDlgItemMessage(hWnd, DlgItemID, CB_SETCURSEL, Value, 0); COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_Combobox(*this);}
+ COptItem_Combobox(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0)
+ {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { Value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { Value = SendDlgItemMessage(hWnd, DlgItemID, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hWnd, DlgItemID, CB_GETCURSEL, 0, 0), 0); COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { SendDlgItemMessage(hWnd, DlgItemID, CB_SETCURSEL, Value, 0); COptItem::MemToWnd(hWnd); }
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_Combobox(*this); }
int DefValue;
int Value;
};
-
class COptItem_Colourpicker : public COptItem
{
public:
COptItem_Colourpicker() {}
- COptItem_Colourpicker(int DlgItemID, char *szDBSetting, int DefValue = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, DBVT_DWORD, lParam, ReadOnly), DefValue(DefValue), Value(0) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {Value = SendDlgItemMessage(hWnd, DlgItemID, CPM_GETCOLOUR, 0, 0); COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {SendDlgItemMessage(hWnd, DlgItemID, CPM_SETCOLOUR, 0, Value); COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_Colourpicker(*this);}
+ COptItem_Colourpicker(int DlgItemID, char *szDBSetting, int DefValue = 0, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, DBVT_DWORD, lParam, ReadOnly), DefValue(DefValue), Value(0)
+ {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { Value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { Value = SendDlgItemMessage(hWnd, DlgItemID, CPM_GETCOLOUR, 0, 0); COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { SendDlgItemMessage(hWnd, DlgItemID, CPM_SETCOLOUR, 0, Value); COptItem::MemToWnd(hWnd); }
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_Colourpicker(*this); }
DWORD DefValue;
DWORD Value;
@@ -221,16 +235,20 @@ class COptItem_Slider : public COptItem {
public:
COptItem_Slider() {}
- COptItem_Slider(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {Value = SendDlgItemMessage(hWnd, DlgItemID, TBM_GETPOS, 0, 0); COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {SendDlgItemMessage(hWnd, DlgItemID, TBM_SETPOS, true, Value); COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_Slider(*this);}
+ COptItem_Slider(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0)
+ {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { Value = GetIntDBVal(sModule, false, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { Value = SendDlgItemMessage(hWnd, DlgItemID, TBM_GETPOS, 0, 0); COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { SendDlgItemMessage(hWnd, DlgItemID, TBM_SETPOS, true, Value); COptItem::MemToWnd(hWnd); }
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_Slider(*this); }
int DefValue;
int Value;
@@ -241,16 +259,20 @@ class COptItem_IntDBSetting : public COptItem {
public:
COptItem_IntDBSetting() {}
- COptItem_IntDBSetting(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int bSigned = true, int DefValue = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), bSigned(bSigned) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {Value = GetIntDBVal(sModule, bSigned, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_IntDBSetting(*this);}
+ COptItem_IntDBSetting(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int bSigned = true, int DefValue = 0, int lParam = 0, bool ReadOnly = false)
+ : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), bSigned(bSigned)
+ {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { Value = GetIntDBVal(sModule, bSigned, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetIntDBVal(sModule, Value, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { COptItem::MemToWnd(hWnd); }
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
+
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_IntDBSetting(*this); }
int Value;
int DefValue;
@@ -262,18 +284,19 @@ class COptItem_BitDBSetting : public COptItem {
public:
COptItem_BitDBSetting() {}
- COptItem_BitDBSetting(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int ValueMask = 0, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), ValueMask(ValueMask) {}
+ COptItem_BitDBSetting(int DlgItemID, char *szDBSetting, int nValueSize = DBVT_BYTE, int DefValue = 0, int ValueMask = 0, int lParam = 0, bool ReadOnly = false) : COptItem(DlgItemID, szDBSetting, nValueSize, lParam, ReadOnly), DefValue(DefValue), Value(0), ValueMask(ValueMask) {}
+
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void WndToMem(HWND hWnd) { COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { COptItem::MemToWnd(hWnd); }
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL);
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL);
- void WndToMem(HWND hWnd) {COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {COptItem::MemToWnd(hWnd);}
+ void SetValue(int _Value) { this->Value = _Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = _DefValue; COptItem::SetDefValue(_DefValue); }
- void SetValue(int Value) {this->Value = Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return Value;}
- int GetDefValue() {return DefValue;}
- virtual COptItem* Copy() {return new COptItem_BitDBSetting(*this);}
+ virtual int GetValue() { return Value; }
+ virtual int GetDefValue() { return DefValue; }
+ virtual COptItem* Copy() { return new COptItem_BitDBSetting(*this); }
int Value;
int DefValue;
@@ -285,16 +308,17 @@ class COptItem_StrDBSetting : public COptItem {
public:
COptItem_StrDBSetting() {}
- COptItem_StrDBSetting(int DlgItemID, char *szDBSetting, int nMaxLen, TCHAR *szDefValue, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, nMaxLen, lParam, ReadOnly), sDefValue(szDefValue) {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL) {sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix);}
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL) {SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix);}
- void WndToMem(HWND hWnd) {COptItem::WndToMem(hWnd);}
- void MemToWnd(HWND hWnd) {COptItem::MemToWnd(hWnd);}
- void SetValue(int Value) {sValue = *(TCString*)Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {sDefValue = *(TCString*)DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return (int)&sValue;}
- int GetDefValue() {return (int)&sDefValue;}
- virtual COptItem* Copy() {return new COptItem_StrDBSetting(*this);}
+ COptItem_StrDBSetting(int DlgItemID, char *szDBSetting, int nMaxLen, TCHAR *szDefValue, int lParam = 0, bool ReadOnly = false) : COptItem(DlgItemID, szDBSetting, nMaxLen, lParam, ReadOnly), sDefValue(szDefValue) {}
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); }
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); }
+ void WndToMem(HWND hWnd) { COptItem::WndToMem(hWnd); }
+ void MemToWnd(HWND hWnd) { COptItem::MemToWnd(hWnd); }
+ void SetValue(int _Value) { sValue = *(TCString*)_Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { sDefValue = *(TCString*)_DefValue; COptItem::SetDefValue(_DefValue); }
+
+ virtual int GetValue() { return 1; }
+ virtual int GetDefValue() { return 1; }
+ virtual COptItem* Copy() { return new COptItem_StrDBSetting(*this); }
TCString sDefValue;
TCString sValue;
@@ -311,7 +335,7 @@ class CBaseTreeItem {
public:
CBaseTreeItem();
- CBaseTreeItem(TCString Title, int ID, int Flags): Title(Title), ID(ID), Flags(Flags), hItem(NULL) {}
+ CBaseTreeItem(TCString Title, int ID, int Flags) : Title(Title), ID(ID), Flags(Flags), hItem(NULL) {}
TCString Title;
int ID;
@@ -323,8 +347,10 @@ class CTreeItem : public CBaseTreeItem {
public:
CTreeItem();
- CTreeItem(TCString Title, int ParentID, int ID, int Flags = 0, TCString User_Str1 = NULL):
- CBaseTreeItem(Title, ID, Flags & ~TIF_ROOTITEM), ParentID(ParentID), User_Str1(User_Str1) {}
+ CTreeItem(TCString Title, int ParentID, int ID, int Flags = 0, TCString User_Str1 = NULL) :
+ CBaseTreeItem(Title, ID, Flags & ~TIF_ROOTITEM), ParentID(ParentID), User_Str1(User_Str1)
+ {
+ }
int ParentID;
TCString User_Str1;
@@ -334,7 +360,7 @@ class CTreeRootItem : public CBaseTreeItem {
public:
CTreeRootItem();
- CTreeRootItem(TCString Title, int ID, int Flags): CBaseTreeItem(Title, ID, Flags | TIF_ROOTITEM) {}
+ CTreeRootItem(TCString Title, int ID, int Flags) : CBaseTreeItem(Title, ID, Flags | TIF_ROOTITEM) {}
};
typedef TMyArray<CTreeItem> TreeItemArray;
@@ -359,26 +385,26 @@ class COptItem_TreeCtrl : public COptItem {
public:
COptItem_TreeCtrl() {}
- COptItem_TreeCtrl(int DlgItemID, char *szDBSetting, TreeItemArray &DefValue, TreeRootItemArray RootItems, int lParam = 0, CString User_Str1_DBName = NULL, bool ReadOnly = false, int TreeFlags = 0): COptItem(DlgItemID, szDBSetting, DBVT_DWORD, lParam, ReadOnly), DefValue(DefValue), RootItems(RootItems), User_Str1_DBName(User_Str1_DBName), TreeFlags(TreeFlags)
+ COptItem_TreeCtrl(int DlgItemID, char *szDBSetting, TreeItemArray &DefValue, TreeRootItemArray RootItems, int lParam = 0, CString User_Str1_DBName = NULL, bool ReadOnly = false, int TreeFlags = 0) : COptItem(DlgItemID, szDBSetting, DBVT_DWORD, lParam, ReadOnly), DefValue(DefValue), RootItems(RootItems), User_Str1_DBName(User_Str1_DBName), TreeFlags(TreeFlags)
{
- if (TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL)
- {
+ if (TreeFlags & TREECTRL_FLAG_IS_SINGLE_LEVEL) {
_ASSERT(!RootItems.GetSize()); // there can't be any root items when the tree is a plain list
this->RootItems.AddElem(CTreeRootItem(_T(""), 0, TIF_EXPANDED)); // TODO??
this->RootItems[0].hItem = TVI_ROOT;
}
}
~COptItem_TreeCtrl() {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL);
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL);
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL);
void WndToMem(HWND hWnd);
void MemToWnd(HWND hWnd);
- void CleanDBSettings(CString &sModule, CString *sDBSettingPrefix = NULL);
- void SetValue(int Value) {this->Value = *(TreeItemArray*)Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = *(TreeItemArray*)DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return (int)&Value;}
- int GetDefValue() {return (int)&DefValue;}
- virtual COptItem* Copy() {return new COptItem_TreeCtrl(*this);}
+ void CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void SetValue(int _Value) { this->Value = *(TreeItemArray*)_Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = *(TreeItemArray*)_DefValue; COptItem::SetDefValue(_DefValue); }
+
+ virtual int GetValue() { return 1; }
+ virtual int GetDefValue() { return 1; }
+ virtual COptItem* Copy() { return new COptItem_TreeCtrl(*this); }
int IDToOrder(int ID);
int hItemToOrder(HTREEITEM hItem);
@@ -403,7 +429,7 @@ class CListItem {
public:
CListItem();
- CListItem(TCString Text): Text(Text) {}
+ CListItem(TCString Text) : Text(Text) {}
TCString Text;
};
@@ -416,18 +442,19 @@ class COptItem_ListCtrl : public COptItem {
public:
COptItem_ListCtrl() {}
- COptItem_ListCtrl(int DlgItemID, char *szDBSetting, ListItemArray &DefValue, int lParam = 0, bool ReadOnly = false): COptItem(DlgItemID, szDBSetting, DBVT_DWORD, lParam, ReadOnly), DefValue(DefValue) {}
+ COptItem_ListCtrl(int DlgItemID, char *szDBSetting, ListItemArray &DefValue, int lParam = 0, bool ReadOnly = false) : COptItem(DlgItemID, szDBSetting, DBVT_DWORD, lParam, ReadOnly), DefValue(DefValue) {}
~COptItem_ListCtrl() {}
- void DBToMem(CString &sModule, CString *sDBSettingPrefix = NULL);
- void MemToDB(CString &sModule, CString *sDBSettingPrefix = NULL);
+ void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL);
void WndToMem(HWND hWnd);
void MemToWnd(HWND hWnd);
- void CleanDBSettings(CString &sModule, CString *sDBSettingPrefix = NULL);
- void SetValue(int Value) {this->Value = *(ListItemArray*)Value; COptItem::SetValue(Value);}
- void SetDefValue(int DefValue) {this->DefValue = *(ListItemArray*)DefValue; COptItem::SetDefValue(DefValue);}
- int GetValue() {return (int)&Value;}
- int GetDefValue() {return (int)&DefValue;}
- virtual COptItem* Copy() {return new COptItem_ListCtrl(*this);}
+ void CleanDBSettings(const CString &sModule, CString *sDBSettingPrefix = NULL);
+ void SetValue(int _Value) { this->Value = *(ListItemArray*)_Value; COptItem::SetValue(_Value); }
+ void SetDefValue(int _DefValue) { this->DefValue = *(ListItemArray*)_DefValue; COptItem::SetDefValue(_DefValue); }
+
+ virtual int GetValue() { return 1; }
+ virtual int GetDefValue() { return 1; }
+ virtual COptItem* Copy() { return new COptItem_ListCtrl(*this); }
int GetSelectedItemID(HWND hWnd); // returns -1 if there's no selection
int SetSelectedItemID(HWND hWnd, int ID);
@@ -442,8 +469,8 @@ public: class COptPage
{
public:
- COptPage(): hWnd(NULL), sDBSettingPrefix("") {}
- COptPage(char *szModule, HWND hWnd, CString sDBSettingPrefix = ""): sModule(szModule), hWnd(hWnd), sDBSettingPrefix(sDBSettingPrefix) {}
+ COptPage() : hWnd(NULL), sDBSettingPrefix("") {}
+ COptPage(char *szModule, HWND hWnd, CString sDBSettingPrefix = "") : sModule(szModule), hWnd(hWnd), sDBSettingPrefix(sDBSettingPrefix) {}
COptPage(const COptPage &Item);
~COptPage();
@@ -451,22 +478,22 @@ public: void MemToDB();
void MemToPage(int OnlyEnable = 0);
void PageToMem();
- void DBToMemToPage() {DBToMem(); MemToPage();}
- void PageToMemToDB() {PageToMem(); MemToDB();}
+ void DBToMemToPage() { DBToMem(); MemToPage(); }
+ void PageToMemToDB() { PageToMem(); MemToDB(); }
void CleanDBSettings();
- COptItem *Find(int DlgItemID);
- int GetValue(int DlgItemID) {return Find(DlgItemID)->GetValue();}
- void SetValue(int DlgItemID, int Value) {Find(DlgItemID)->SetValue(Value);}
- int GetDBValue(int DlgItemID) {return Find(DlgItemID)->GetDBValue(sModule, &sDBSettingPrefix);}
- void SetDBValue(int DlgItemID, int Value) {Find(DlgItemID)->SetDBValue(sModule, Value, &sDBSettingPrefix);}
- int GetDBValueCopy(int DlgItemID) {return Find(DlgItemID)->GetDBValueCopy(sModule, &sDBSettingPrefix);}
- void SetDBValueCopy(int DlgItemID, int Value) {Find(DlgItemID)->SetDBValueCopy(sModule, Value, &sDBSettingPrefix);}
- int GetWndValue(int DlgItemID) {return Find(DlgItemID)->GetWndValue(hWnd);}
- void SetWndValue(int DlgItemID, int Value) {Find(DlgItemID)->SetWndValue(hWnd, Value);}
- HWND GetWnd() {return hWnd;}
- void SetWnd(HWND hWnd) {_ASSERT(!this->hWnd || !hWnd); this->hWnd = hWnd;}
- void Enable(int DlgItemID, int Enabled) {Find(DlgItemID)->Enable(Enabled);}
+ COptItem* Find(int DlgItemID);
+ int GetValue(int DlgItemID) { return Find(DlgItemID)->GetValue(); }
+ void SetValue(int DlgItemID, int Value) { Find(DlgItemID)->SetValue(Value); }
+ int GetDBValue(int DlgItemID) { return Find(DlgItemID)->GetDBValue(sModule, &sDBSettingPrefix); }
+ void SetDBValue(int DlgItemID, int Value) { Find(DlgItemID)->SetDBValue(sModule, Value, &sDBSettingPrefix); }
+ int GetDBValueCopy(int DlgItemID) { return Find(DlgItemID)->GetDBValueCopy(sModule, &sDBSettingPrefix); }
+ void SetDBValueCopy(int DlgItemID, int Value) { Find(DlgItemID)->SetDBValueCopy(sModule, Value, &sDBSettingPrefix); }
+ int GetWndValue(int DlgItemID) { return Find(DlgItemID)->GetWndValue(hWnd); }
+ void SetWndValue(int DlgItemID, int Value) { Find(DlgItemID)->SetWndValue(hWnd, Value); }
+ HWND GetWnd() { return hWnd; }
+ void SetWnd(HWND _hWnd) { _ASSERT(!this->hWnd || !_hWnd); this->hWnd = _hWnd; }
+ void Enable(int DlgItemID, int Enabled) { Find(DlgItemID)->Enable(Enabled); }
bool GetModified();
void SetModified(bool Modified);
diff --git a/plugins/NewAwaySysMod/src/Properties.cpp b/plugins/NewAwaySysMod/src/Properties.cpp index 70716fdfcb..e921a72096 100644 --- a/plugins/NewAwaySysMod/src/Properties.cpp +++ b/plugins/NewAwaySysMod/src/Properties.cpp @@ -55,26 +55,26 @@ CProtoState::CStatus& CProtoState::CStatus::operator = (int Status) return *this; // ignore status change if the new status is unknown
bool bModified = false;
- if (szProto) {
- if (this->Status != Status) {
- this->Status = Status;
- (*GrandParent)[szProto].AwaySince.Reset();
- ResetSettingsOnStatusChange(szProto, true, Status);
+ if (m_szProto) {
+ if (this->m_status != Status) {
+ this->m_status = Status;
+ (*m_grandParent)[m_szProto].m_awaySince.Reset();
+ ResetSettingsOnStatusChange(m_szProto, true, Status);
bModified = true;
}
- if ((*GrandParent)[szProto].TempMsg.IsSet()) {
- (*GrandParent)[szProto].TempMsg.Unset();
+ if ((*m_grandParent)[m_szProto].TempMsg.IsSet()) {
+ (*m_grandParent)[m_szProto].TempMsg.Unset();
bModified = true;
}
}
else { // global status change
int bStatusModified = false;
- for (int i = 0; i < GrandParent->GetSize(); i++) {
- CProtoState &State = (*GrandParent)[i];
+ for (int i = 0; i < m_grandParent->GetSize(); i++) {
+ CProtoState &State = (*m_grandParent)[i];
if (!db_get_b(NULL, State.GetProto(), "LockMainStatus", 0)) { // if the protocol isn't locked
- if (State.Status != Status) {
- State.Status.Status = Status; // "Status.Status" - changing Status directly to prevent recursive calls to the function
- State.AwaySince.Reset();
+ if (State.m_status != Status) {
+ State.m_status.m_status = Status; // "Status.Status" - changing Status directly to prevent recursive calls to the function
+ State.m_awaySince.Reset();
bModified = true;
bStatusModified = true;
}
@@ -83,24 +83,24 @@ CProtoState::CStatus& CProtoState::CStatus::operator = (int Status) bModified = true;
}
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_RESETPROTOMSGS))
- CProtoSettings(State.szProto, Status).SetMsgFormat(SMF_PERSONAL, NULL);
+ CProtoSettings(State.m_szProto, Status).SetMsgFormat(SMF_PERSONAL, NULL);
}
}
if (bStatusModified)
ResetSettingsOnStatusChange(NULL, true, Status);
}
if (bModified && g_SetAwayMsgPage.GetWnd())
- SendMessage(g_SetAwayMsgPage.GetWnd(), UM_SAM_PROTOSTATUSCHANGED, (WPARAM)(char*)szProto, 0);
+ SendMessage(g_SetAwayMsgPage.GetWnd(), UM_SAM_PROTOSTATUSCHANGED, (WPARAM)(char*)m_szProto, 0);
return *this;
}
void CProtoState::CAwaySince::Reset()
{
- GetLocalTime(&AwaySince);
+ GetLocalTime(&m_awaySince);
- if (GrandParent && !szProto)
- for (int i = 0; i < GrandParent->GetSize(); i++)
- GetLocalTime((*GrandParent)[i].AwaySince);
+ if (m_grandParent && !m_szProto)
+ for (int i = 0; i < m_grandParent->GetSize(); i++)
+ GetLocalTime((*m_grandParent)[i].m_awaySince);
}
@@ -110,16 +110,16 @@ void CContactSettings::SetMsgFormat(int Flags, TCString Message) // if Message == NULL, then the function deletes the message.
CString DBSetting(StatusToDBSetting(Status, DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPERSONAL));
if (g_AutoreplyOptPage.GetDBValueCopy(IDC_REPLYDLG_RESETCOUNTERWHENSAMEICON) && GetMsgFormat(SMF_PERSONAL) != (const TCHAR*)Message)
- ResetContactSettingsOnStatusChange(hContact);
+ ResetContactSettingsOnStatusChange(m_hContact);
if (Message != NULL)
- db_set_ts(hContact, MOD_NAME, DBSetting, Message);
+ db_set_ts(m_hContact, MOD_NAME, DBSetting, Message);
else
- db_unset(hContact, MOD_NAME, DBSetting);
+ db_unset(m_hContact, MOD_NAME, DBSetting);
}
if (Flags & (SMF_LAST | SMF_TEMPORARY)) {
- _ASSERT(!hContact);
+ _ASSERT(!m_hContact);
CProtoSettings().SetMsgFormat(Flags & (SMF_LAST | SMF_TEMPORARY), Message);
}
}
@@ -135,16 +135,16 @@ TCString CContactSettings::GetMsgFormat(int Flags, int *pOrder, char *szProtoOve *pOrder = -1;
if (Flags & GMF_PERSONAL) // try getting personal message (it overrides global)
- Message = db_get_s(hContact, MOD_NAME, StatusToDBSetting(Status, DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPERSONAL), (TCHAR*)NULL);
+ Message = db_get_s(m_hContact, MOD_NAME, StatusToDBSetting(Status, DB_STATUSMSG, IDC_MOREOPTDLG_PERSTATUSPERSONAL), (TCHAR*)NULL);
if (Flags & (GMF_LASTORDEFAULT | GMF_PROTOORGLOBAL | GMF_TEMPORARY) && Message.IsEmpty()) {
- char *szProto = szProtoOverride ? szProtoOverride : (hContact ? GetContactProto(hContact) : NULL);
+ char *szProto = szProtoOverride ? szProtoOverride : (m_hContact ? GetContactProto(m_hContact) : NULL);
// we mustn't pass here by GMF_TEMPORARY flag, as otherwise we'll handle GMF_TEMPORARY | GMF_PERSONAL combination incorrectly,
// which is supposed to get only per-contact messages, and at the same time also may be used with NULL contact to get the global status message
if (Flags & (GMF_LASTORDEFAULT | GMF_PROTOORGLOBAL))
Message = CProtoSettings(szProto).GetMsgFormat(Flags, pOrder);
- else if (!hContact) { // handle global temporary message too
+ else if (!m_hContact) { // handle global temporary message too
if (g_ProtoStates[szProto].TempMsg.IsSet())
Message = g_ProtoStates[szProto].TempMsg;
}
@@ -158,7 +158,7 @@ void CProtoSettings::SetMsgFormat(int Flags, TCString Message) ResetSettingsOnStatusChange(szProto);
if (Flags & SMF_TEMPORARY) {
- _ASSERT(!Status || Status == g_ProtoStates[szProto].Status);
+ _ASSERT(!Status || Status == g_ProtoStates[szProto].m_status);
g_ProtoStates[szProto].TempMsg = (szProto || Message != NULL) ? Message : CProtoSettings(NULL, Status).GetMsgFormat(GMF_LASTORDEFAULT);
}
@@ -259,7 +259,7 @@ TCString CProtoSettings::GetMsgFormat(int Flags, int *pOrder) *pOrder = -1;
if (Flags & GMF_TEMPORARY) {
- _ASSERT(!Status || Status == g_ProtoStates[szProto].Status);
+ _ASSERT(!Status || Status == g_ProtoStates[szProto].m_status);
if (g_ProtoStates[szProto].TempMsg.IsSet()) {
Message = g_ProtoStates[szProto].TempMsg;
Flags &= ~GMF_PERSONAL; // don't allow personal message to overwrite our NULL temporary message
diff --git a/plugins/NewAwaySysMod/src/Properties.h b/plugins/NewAwaySysMod/src/Properties.h index d95e328822..2f03c935a4 100644 --- a/plugins/NewAwaySysMod/src/Properties.h +++ b/plugins/NewAwaySysMod/src/Properties.h @@ -100,7 +100,7 @@ private: #define ILI_SETTINGS 22
#define ILI_STATUS_OTHER 23
-static int Icons[] = {
+static unsigned Icons[] = {
SKINICON_EVENT_MESSAGE | IL_SKINICON, SKINICON_EVENT_URL | IL_SKINICON, SKINICON_EVENT_FILE | IL_SKINICON,
ID_STATUS_ONLINE | IL_PROTOICON, ID_STATUS_AWAY | IL_PROTOICON, ID_STATUS_NA | IL_PROTOICON, ID_STATUS_OCCUPIED | IL_PROTOICON, ID_STATUS_DND | IL_PROTOICON, ID_STATUS_FREECHAT | IL_PROTOICON, ID_STATUS_INVISIBLE | IL_PROTOICON, ID_STATUS_ONTHEPHONE | IL_PROTOICON, ID_STATUS_OUTTOLUNCH | IL_PROTOICON,
IDI_DOT, IDI_MSGICON, IDI_IGNORE, IDI_SOE_ENABLED, IDI_SOE_DISABLED, IDI_NEWMESSAGE, IDI_NEWCATEGORY, IDI_SAVE, IDI_SAVEASNEW, IDI_DELETE, IDI_SETTINGS, IDI_STATUS_OTHER
@@ -148,33 +148,33 @@ class CProtoStates; class CProtoState
{
public:
- CProtoState(const char* szProto, CProtoStates* Parent): szProto(szProto), Parent(Parent), Status(szProto, Parent), AwaySince(szProto, Parent) {}
+ CProtoState(const char* szProto, CProtoStates* Parent): m_szProto(szProto), m_parent(Parent), m_status(szProto, Parent), m_awaySince(szProto, Parent) {}
class CStatus
{
public:
- CStatus(const char* szProto, CProtoStates* GrandParent): szProto(szProto), GrandParent(GrandParent), Status(ID_STATUS_OFFLINE) {}
+ CStatus(const char* szProto, CProtoStates* GrandParent): m_szProto(szProto), m_grandParent(GrandParent), m_status(ID_STATUS_OFFLINE) {}
CStatus& operator = (int Status);
- operator int() {return Status;}
+ operator int() {return m_status;}
friend class CProtoState;
private:
- int Status;
- CString szProto;
- CProtoStates* GrandParent;
- } Status;
+ int m_status;
+ CString m_szProto;
+ CProtoStates* m_grandParent;
+ } m_status;
class CAwaySince
{
public:
- CAwaySince(const char* szProto, CProtoStates* GrandParent): szProto(szProto), GrandParent(GrandParent) {Reset();}
+ CAwaySince(const char* szProto, CProtoStates* GrandParent): m_szProto(szProto), m_grandParent(GrandParent) {Reset();}
void Reset();
- operator LPSYSTEMTIME() {return &AwaySince;}
+ operator LPSYSTEMTIME() {return &m_awaySince;}
friend class CProtoState;
private:
- SYSTEMTIME AwaySince;
- CString szProto;
- CProtoStates* GrandParent;
- } AwaySince;
+ SYSTEMTIME m_awaySince;
+ CString m_szProto;
+ CProtoStates* m_grandParent;
+ } m_awaySince;
class CCurStatusMsg
{
@@ -206,7 +206,7 @@ public: { // we use temporary messages to keep user-defined per-protocol messages intact, when changing messages through MS_NAS_SETSTATE, or when autoaway becomes active etc.. temporary messages are automatically resetted when protocol status changes
public:
CTempMsg(): iIsSet(0) {}
- CTempMsg& operator = (TCString Msg) {this->Msg = Msg; iIsSet = true; return *this;}
+ CTempMsg& operator = (TCString _Msg) {this->Msg = _Msg; iIsSet = true; return *this;}
operator TCString()
{
_ASSERT(iIsSet);
@@ -220,20 +220,20 @@ public: TCString Msg;
} TempMsg;
- void SetParent(CProtoStates* Parent)
+ void SetParent(CProtoStates* _Parent)
{
- this->Parent = Parent;
- Status.GrandParent = Parent;
- AwaySince.GrandParent = Parent;
+ m_parent = _Parent;
+ m_status.m_grandParent = _Parent;
+ m_awaySince.m_grandParent = _Parent;
}
- CString &GetProto() {return szProto;}
+ CString &GetProto() {return m_szProto;}
//NightFox: fix?
//private:
public:
- CString szProto;
- CProtoStates *Parent;
+ CString m_szProto;
+ CProtoStates *m_parent;
};
@@ -361,11 +361,11 @@ public: {
public:
CStatus(int iStatus = 0, const char *szProto = NULL): Status(iStatus), szProto(szProto) {}
- CStatus& operator = (int Status) {this->Status = Status; return *this;}
+ CStatus& operator = (int _Status) {this->Status = _Status; return *this;}
operator int()
{
if (!Status)
- Status = g_ProtoStates[szProto].Status;
+ Status = g_ProtoStates[szProto].m_status;
return Status;
}
private:
@@ -403,10 +403,10 @@ __inline CString ContactStatusToDBSetting(int Status, const char *Prefix, int Mo class CContactSettings
{
- MCONTACT hContact;
+ MCONTACT m_hContact;
public:
- CContactSettings(int iStatus = 0, MCONTACT _hContact = NULL): Status(iStatus, hContact), hContact(_hContact)
+ CContactSettings(int iStatus = 0, MCONTACT _hContact = NULL): Status(iStatus, _hContact), m_hContact(_hContact)
{
Ignore.Parent = this;
Autoreply.Parent = this;
@@ -414,7 +414,7 @@ public: CString ContactStatusToDBSetting(const char *Prefix, int MoreOpt_PerStatusID = 0)
{
- return ::ContactStatusToDBSetting((hContact != INVALID_CONTACT_ID) ? Status : NULL, Prefix, MoreOpt_PerStatusID, hContact);
+ return ::ContactStatusToDBSetting((m_hContact != INVALID_CONTACT_ID) ? Status : NULL, Prefix, MoreOpt_PerStatusID, m_hContact);
}
class CIgnore
@@ -423,7 +423,7 @@ public: CIgnore& operator = (const int Value)
{
CString Setting(Parent->ContactStatusToDBSetting(DB_IGNOREREQUESTS, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS));
- MCONTACT hContact = (Parent->hContact != INVALID_CONTACT_ID) ? Parent->hContact : NULL;
+ MCONTACT hContact = (Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL;
if (Value)
db_set_b(hContact, MOD_NAME, Setting, 1);
else
@@ -433,7 +433,7 @@ public: operator int()
{
- return db_get_b((Parent->hContact != INVALID_CONTACT_ID) ? Parent->hContact : NULL, MOD_NAME,
+ return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MOD_NAME,
Parent->ContactStatusToDBSetting(DB_IGNOREREQUESTS, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), 0);
}
@@ -448,7 +448,7 @@ public: CAutoreply& operator = (const int Value)
{
CString Setting(Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS));
- MCONTACT hContact = (Parent->hContact != INVALID_CONTACT_ID) ? Parent->hContact : NULL;
+ MCONTACT hContact = (Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL;
if (db_get_b(hContact, MOD_NAME, Setting, VAL_USEDEFAULT) == Value)
return *this;
@@ -458,13 +458,13 @@ public: db_unset(hContact, MOD_NAME, Setting);
return *this;
}
- operator int() {return db_get_b((Parent->hContact != INVALID_CONTACT_ID) ? Parent->hContact : NULL, MOD_NAME, Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), Parent->hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY);}
+ operator int() {return db_get_b((Parent->m_hContact != INVALID_CONTACT_ID) ? Parent->m_hContact : NULL, MOD_NAME, Parent->ContactStatusToDBSetting(DB_ENABLEREPLY, IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS), Parent->m_hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY);}
int IncludingParents(const char *szProtoOverride = NULL) // takes into account protocol and global data also, if per-contact setting is not defined
{
- _ASSERT((Parent->hContact && Parent->hContact != INVALID_CONTACT_ID) || szProtoOverride); // we need either correct protocol or a correct hContact to determine its protocol
+ _ASSERT((Parent->m_hContact && Parent->m_hContact != INVALID_CONTACT_ID) || szProtoOverride); // we need either correct protocol or a correct hContact to determine its protocol
int Value = *this;
if (Value == VAL_USEDEFAULT) {
- const char *szProto = (Parent->hContact && Parent->hContact != INVALID_CONTACT_ID) ? GetContactProto(Parent->hContact) : szProtoOverride;
+ const char *szProto = (Parent->m_hContact && Parent->m_hContact != INVALID_CONTACT_ID) ? GetContactProto(Parent->m_hContact) : szProtoOverride;
return CProtoSettings(szProto).Autoreply.IncludingParents();
}
return Value;
@@ -474,7 +474,7 @@ public: switch ((int)*this) {
case VAL_USEDEFAULT: return 0; break;
case 0: return 1; break;
- default: return Parent->hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY; break;
+ default: return Parent->m_hContact ? VAL_USEDEFAULT : AUTOREPLY_DEF_REPLY; break;
}
}
int Toggle() {return *this = GetNextToggleValue();}
@@ -486,14 +486,14 @@ public: class CStatus
{
public:
- CStatus(int iStatus = 0, MCONTACT _hContact = NULL): Status(iStatus), hContact(_hContact) {}
- CStatus& operator = (int Status) {this->Status = Status; return *this;}
+ CStatus(int iStatus = 0, MCONTACT _hContact = NULL): Status(iStatus), m_hContact(_hContact) {}
+ CStatus& operator = (int _Status) {this->Status = _Status; return *this;}
operator int()
{
if (!Status) {
- _ASSERT(hContact != INVALID_CONTACT_ID);
- char *szProto = hContact ? GetContactProto(hContact) : NULL;
- Status = (szProto || !hContact) ? g_ProtoStates[szProto].Status : ID_STATUS_AWAY;
+ _ASSERT(m_hContact != INVALID_CONTACT_ID);
+ char *szProto = m_hContact ? GetContactProto(m_hContact) : NULL;
+ Status = (szProto || !m_hContact) ? g_ProtoStates[szProto].m_status : ID_STATUS_AWAY;
}
return Status;
}
@@ -501,7 +501,7 @@ public: friend class CAutoreply;
private:
int Status;
- MCONTACT hContact;
+ MCONTACT m_hContact;
} Status;
void SetMsgFormat(int Flags, TCString Message);
diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp index 4ea1d3d978..849633183a 100644 --- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp @@ -32,7 +32,7 @@ struct READAWAYMSGDATA MWindowList g_hReadWndList = NULL;
-static int ReadAwayMsgDlgResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
+static int ReadAwayMsgDlgResize(HWND, LPARAM, UTILRESIZECONTROL *urc)
{
switch (urc->wId) {
case IDC_READAWAYMSG_MSG:
diff --git a/plugins/NewAwaySysMod/src/Services.cpp b/plugins/NewAwaySysMod/src/Services.cpp index 1d4b114528..46399f0b97 100644 --- a/plugins/NewAwaySysMod/src/Services.cpp +++ b/plugins/NewAwaySysMod/src/Services.cpp @@ -36,13 +36,13 @@ struct NAS_PROTOINFOv1 __inline void PSSetStatus(char *szProto, WORD Status, int bNoClistSetStatusMode = false) // just a helper function that sets the status and handles szProto==NULL correctly
{
- g_ProtoStates[szProto].Status = Status;
+ g_ProtoStates[szProto].m_status = Status;
if (szProto)
CallProtoService(szProto, PS_SETSTATUS, Status, 0);
else if (!bNoClistSetStatusMode) { // global status
g_fNoProcessing = true;
CallService(MS_CLIST_SETSTATUSMODE, Status, 0);
- _ASSERT(!g_fNoProcessing && g_ProtoStates[(char*)NULL].Status == Status);
+ _ASSERT(!g_fNoProcessing && g_ProtoStates[(char*)NULL].m_status == Status);
g_fNoProcessing = false;
}
}
@@ -66,7 +66,7 @@ INT_PTR SetStatusMode(WPARAM wParam, LPARAM lParam) // called by GamerStatus and g_fNoProcessing = true;
CallService(MS_CLIST_SETSTATUSMODE, wParam, 0);
- _ASSERT(!g_fNoProcessing && g_ProtoStates[(char*)NULL].Status == wParam);
+ _ASSERT(!g_fNoProcessing && g_ProtoStates[(char*)NULL].m_status == wParam);
g_fNoProcessing = false;
CProtoSettings(NULL, wParam).SetMsgFormat(SMF_TEMPORARY, lParam ? (TCHAR*)_A2T((char*)lParam) : CProtoSettings(NULL, wParam).GetMsgFormat(GMF_LASTORDEFAULT));
ChangeProtoMessages(NULL, wParam, TCString());
@@ -97,7 +97,7 @@ int GetState(WPARAM wParam, LPARAM lParam, int Widechar) else pi->szMsg = NULL;
if (!pi->status)
- pi->status = g_ProtoStates[pi->szProto].Status;
+ pi->status = g_ProtoStates[pi->szProto].m_status;
}
else pi->szMsg = NULL;
@@ -134,7 +134,7 @@ int SetState(WPARAM wParam, LPARAM lParam, int Widechar) if (pi->status)
PSSetStatus(pi->szProto, pi->status, Flags & PIF_NO_CLIST_SETSTATUSMODE);
else
- pi->status = g_ProtoStates[pi->szProto].Status;
+ pi->status = g_ProtoStates[pi->szProto].m_status;
CProtoSettings(pi->szProto).SetMsgFormat((Flags & PIF_NOTTEMPORARY) ? SMF_PERSONAL : SMF_TEMPORARY, Widechar ? pi->wszMsg : _A2T(pi->szMsg));
if (pi->szMsg || !(Flags & PIF_NO_CLIST_SETSTATUSMODE))
diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index 6e46c9aaa2..fdceb93f39 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -156,7 +156,7 @@ static LRESULT CALLBACK CListSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LP return CallWindowProc(g_OrigCListProc, hWnd, Msg, wParam, lParam);
}
-static int SetAwayMsgDlgResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
+int SetAwayMsgDlgResize(HWND, LPARAM lParam, UTILRESIZECONTROL *urc)
{
COptPage *SetAwayMsgPage = (COptPage*)lParam;
int bShowMsgTree = SetAwayMsgPage->GetValue(IDS_SAWAYMSG_SHOWMSGTREE), X;
@@ -302,8 +302,7 @@ void SetExtraIcon(CCList *CList, int nColumn, HTREEITEM hItem, int nIcon) CList->SetExtraImage(hItem, nColumn, nIcon);
}
-
-void SetCListGroupIcons(SetAwayMsgData *dat, CCList *CList)
+void SetCListGroupIcons(CCList *CList)
{
_ASSERT(CList);
HTREEITEM hItem = CList->GetNextItem(MCLGN_LAST, NULL); // start from last item, so every item is processed before its parents
@@ -484,7 +483,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA char *szProto = dat->hInitContact ? GetContactProto(dat->hInitContact) : dat->szProtocol;
int Status = 0;
- Status = g_ProtoStates[dat->szProtocol].Status;
+ Status = g_ProtoStates[dat->szProtocol].m_status;
HICON hTitleIcon = Skin_LoadProtoIcon(szProto, Status);
HICON hTitleIconBig = Skin_LoadProtoIcon(szProto, Status, true);
@@ -565,8 +564,8 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA // init message tree
if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_RECENTMSGSCOUNT) && g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_PERSTATUSMRM)) {
- char *szProto = dat->hInitContact ? GetContactProto(dat->hInitContact) : dat->szProtocol;
- int ID = GetRecentGroupID((szProto || !dat->hInitContact) ? g_ProtoStates[szProto].Status : ID_STATUS_AWAY);
+ char *szInitProto = dat->hInitContact ? GetContactProto(dat->hInitContact) : dat->szProtocol;
+ int ID = GetRecentGroupID((szInitProto || !dat->hInitContact) ? g_ProtoStates[szInitProto].m_status : ID_STATUS_AWAY);
CBaseTreeItem* pTreeItem = MsgTree->GetNextItem(MTGN_CHILD | MTGN_BYID, (CBaseTreeItem*)g_Messages_RecentRootID);
while (pTreeItem) {
if (pTreeItem->Flags & TIF_GROUP) {
@@ -661,7 +660,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA hCurItem = CList->GetNextItem(MCLGN_NEXT | MCLGN_ANY | MCLGN_MULTILEVEL, hCurItem);
}
}
- SetCListGroupIcons(dat, CList);
+ SetCListGroupIcons(CList);
UpdateCheckboxesState(CList);
}
}
@@ -669,22 +668,22 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA case MCLN_SELCHANGED:
{
- PNMCLIST nm = (PNMCLIST)lParam;
+ PNMCLIST pnm = (PNMCLIST)lParam;
TCString BtnTitle(TranslateT("OK"));
if (CList)
UpdateCheckboxesState(CList);
bool bOnlyInfo;
- bool bLeaveOldMessage = nm->OldSelection == nm->NewSelection; // OldSelection == NewSelection when we send MCLN_SELCHANGED from UM_SAM_PROTOSTATUSCHANGED; seems that it's better to leave old message then
- int nOldContacts = GetSelContactsNum(CList, nm->OldSelection);
- int nNewContacts = GetSelContactsNum(CList, nm->NewSelection, &bOnlyInfo);
+ bool bLeaveOldMessage = pnm->OldSelection == pnm->NewSelection; // OldSelection == NewSelection when we send MCLN_SELCHANGED from UM_SAM_PROTOSTATUSCHANGED; seems that it's better to leave old message then
+ int nOldContacts = GetSelContactsNum(CList, pnm->OldSelection);
+ int nNewContacts = GetSelContactsNum(CList, pnm->NewSelection, &bOnlyInfo);
EnableWindow(GetDlgItem(hwndDlg, IDC_SAWAYMSG_IGNOREREQ), !bOnlyInfo);
if (CList) {
if (SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_MSGDATA, EM_GETMODIFY, 0, 0)) {
int i, j;
- for (i = nm->OldSelection->GetSize() - 1; i >= 0; i--) {
- for (j = nm->NewSelection->GetSize() - 1; j >= 0; j--)
- if ((*nm->NewSelection)[j] == (*nm->OldSelection)[i])
+ for (i = pnm->OldSelection->GetSize() - 1; i >= 0; i--) {
+ for (j = pnm->NewSelection->GetSize() - 1; j >= 0; j--)
+ if ((*pnm->NewSelection)[j] == (*pnm->OldSelection)[i])
break;
if (j < 0)
break;
@@ -695,14 +694,14 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA // there's at least one item in the old selection that is not present in the new one
if (i >= 0 && nOldContacts) {
if ((nOldContacts == 1) || MessageBox(hwndDlg, TranslateT("Do you want to apply the message?"), TranslateT("New Away System"), MB_ICONQUESTION | MB_YESNO) == IDYES)
- ApplySelContactsMessage(dat, CList, nm->OldSelection);
+ ApplySelContactsMessage(dat, CList, pnm->OldSelection);
}
else if (nOldContacts)
bLeaveOldMessage = true; // don't change the edit control text yet - we're still writing...
}
}
else if (nOldContacts && !nNewContacts)
- ApplySelContactsMessage(dat, CList, nm->OldSelection);
+ ApplySelContactsMessage(dat, CList, pnm->OldSelection);
// determine the right new message and window title for the edit control now
TCString Message;
@@ -710,8 +709,8 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (CList) {
bool MessageDetermined = false;
bool StatusDetermined = false;
- for (int i = 0; i < nm->NewSelection->GetSize(); i++) {
- HTREEITEM hItem = (*nm->NewSelection)[i];
+ for (int i = 0; i < pnm->NewSelection->GetSize(); i++) {
+ HTREEITEM hItem = (*pnm->NewSelection)[i];
MCONTACT hContact;
char *szProto;
int ItemType = CList->GetItemType(hItem);
@@ -725,7 +724,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA szProto = (char*)CList->GetItemParam(hItem);
if (ItemType == MCLCIT_CONTACT || ItemType == MCLCIT_INFO) {
- int CurStatus = g_ProtoStates[szProto].Status;
+ int CurStatus = g_ProtoStates[szProto].m_status;
if (!MessageDetermined) {
TCString CurMessage((ItemType == MCLCIT_CONTACT) ? CContactSettings(0, hContact).GetMsgFormat(GMF_PERSONAL) : CProtoSettings(szProto).GetMsgFormat(GMF_TEMPORARY | GMF_PERSONAL));
if (CurMessage == NULL)
@@ -751,7 +750,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA }
}
else if (nNewContacts) {
- Status = g_ProtoStates[dat->szProtocol].Status;
+ Status = g_ProtoStates[dat->szProtocol].m_status;
Message = dat->hInitContact ? CContactSettings(0, dat->hInitContact).GetMsgFormat(GMF_PERSONAL) : CProtoSettings(dat->szProtocol).GetMsgFormat(GMF_TEMPORARY | GMF_PERSONAL);
}
@@ -767,11 +766,11 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA MCONTACT hContact = NULL;
char *szProto = NULL;
if (CList) {
- for (int i = 0; i < nm->NewSelection->GetSize(); i++) {
- HTREEITEM hItem = (*nm->NewSelection)[i];
+ for (int i = 0; i < pnm->NewSelection->GetSize(); i++) {
+ HTREEITEM hItem = (*pnm->NewSelection)[i];
int ItemType = CList->GetItemType(hItem);
if (ItemType == MCLCIT_CONTACT) {
- hContact = CList->GethContact((*nm->NewSelection)[i]);
+ hContact = CList->GethContact((*pnm->NewSelection)[i]);
break;
}
if (ItemType == MCLCIT_INFO) {
@@ -869,7 +868,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA CList->SetExtraImageList(hil);
HTREEITEM hSelItem;
- HTREEITEM hItem = hSelItem = CList->AddInfo(TranslateT("** All contacts **"), CLC_ROOT, CLC_ROOT, NULL, Skin_LoadProtoIcon(NULL, g_ProtoStates[(char*)NULL].Status));
+ HTREEITEM hItem = hSelItem = CList->AddInfo(TranslateT("** All contacts **"), CLC_ROOT, CLC_ROOT, NULL, Skin_LoadProtoIcon(NULL, g_ProtoStates[(char*)NULL].m_status));
int numAccs;
PROTOACCOUNT **accs;
Proto_EnumAccounts(&numAccs, &accs);
@@ -878,7 +877,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA // don't forget to change Recent Message Save loop in the UM_SAM_APPLYANDCLOSE if you're changing something here
if (CallProtoService(p->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
PROTOACCOUNT * acc = Proto_GetAccount(p->szModuleName);
- hItem = CList->AddInfo(TCString(_T("* ")) + acc->tszAccountName + _T(" *"), CLC_ROOT, hItem, (LPARAM)p->szModuleName, Skin_LoadProtoIcon(p->szModuleName, g_ProtoStates[p->szModuleName].Status));
+ hItem = CList->AddInfo(TCString(_T("* ")) + acc->tszAccountName + _T(" *"), CLC_ROOT, hItem, (LPARAM)p->szModuleName, Skin_LoadProtoIcon(p->szModuleName, g_ProtoStates[p->szModuleName].m_status));
if (dat->szProtocol && !mir_strcmp(p->szModuleName, dat->szProtocol))
hSelItem = hItem;
}
@@ -891,9 +890,9 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (szProto) {
int Flag1 = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if ((Flag1 & PF1_IM) == PF1_IM || Flag1 & PF1_INDIVMODEMSG) { // check if the protocol supports message sending/receiving or individual status messages before adding this contact
- HTREEITEM hItem = CList->AddContact(hContact);
+ HTREEITEM hNewItem = CList->AddContact(hContact);
if (dat->hInitContact == hContact)
- hSelItem = hItem;
+ hSelItem = hNewItem;
}
}
}
@@ -905,7 +904,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SetExtraIcon(CList, EXTRACOLUMN_IGNORE, hItem, -1);
SetExtraIcon(CList, EXTRACOLUMN_REPLY, hItem, -1);
}
- SetCListGroupIcons(dat, CList);
+ SetCListGroupIcons(CList);
CList->SetRedraw(true); // SetRedraw must be before SelectItem - otherwise SelectItem won't change scrollbar position to make the selected contact visible
CList->SelectItem(hSelItem); // must be selected after setting all extra icons, to set checkboxes properly
}
@@ -935,7 +934,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA TCString Message(CProtoSettings(p->szModuleName).GetMsgFormat(GMF_PERSONAL)); // yes, we don't specify GMF_TEMPORARY here, because we don't need to save it
if (Message != NULL)
CProtoSettings(p->szModuleName).SetMsgFormat(SMF_LAST, Message); // if the user set a message for this protocol, save it to the recent messages
- ChangeProtoMessages(p->szModuleName, g_ProtoStates[p->szModuleName].Status, TCString(NULL)); // and actual setting of a status message for the protocol
+ ChangeProtoMessages(p->szModuleName, g_ProtoStates[p->szModuleName].m_status, TCString(NULL)); // and actual setting of a status message for the protocol
}
}
TCString Message(CProtoSettings().GetMsgFormat(GMF_PERSONAL));
@@ -979,7 +978,6 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA }
else { // it's a contact's autoreply setting
while (hItem = CList->GetNextItem(MCLGN_NEXT | MCLGN_CONTACT | MCLGN_MULTILEVEL, hItem)) {
- MCONTACT hContact = CList->GethContact(hItem);
if (CList->GethContact(hItem) == wParam) { // we found the item
SetExtraIcon(CList, EXTRACOLUMN_REPLY, hItem, -1); // update it
break;
@@ -996,14 +994,13 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA while (hItem = CList->GetNextItem(MCLGN_NEXT | MCLGN_CONTACT | MCLGN_INFO | MCLGN_MULTILEVEL, hItem)) {
if (CList->GetItemType(hItem) == MCLCIT_INFO) {
char *szProto = (char*)CList->GetItemParam(hItem);
- if (!wParam || !mir_strcmp(szProto, (char*)wParam)) {
- CList->SetInfoIcon(hItem, Skin_LoadProtoIcon(szProto, g_ProtoStates[szProto].Status));
- }
+ if (!wParam || !mir_strcmp(szProto, (char*)wParam))
+ CList->SetInfoIcon(hItem, Skin_LoadProtoIcon(szProto, g_ProtoStates[szProto].m_status));
}
SetExtraIcon(CList, EXTRACOLUMN_IGNORE, hItem, -1);
SetExtraIcon(CList, EXTRACOLUMN_REPLY, hItem, -1);
}
- SetCListGroupIcons(dat, CList);
+ SetCListGroupIcons(CList);
}
nm.hdr.code = MCLN_SELCHANGED;
nm.hdr.hwndFrom = GetDlgItem(hwndDlg, IDC_SAWAYMSG_CONTACTSTREE);
@@ -1047,7 +1044,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (Selection->GetSize() == 1)
CList->EnsureVisible((*Selection)[0]);
- SetCListGroupIcons(dat, CList);
+ SetCListGroupIcons(CList);
}
break;
@@ -1061,7 +1058,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SetExtraIcon(CList, EXTRACOLUMN_REPLY, (*Selection)[i], ReplyIcon);
if (Selection->GetSize() == 1)
CList->EnsureVisible((*Selection)[0]);
- SetCListGroupIcons(dat, CList);
+ SetCListGroupIcons(CList);
}
break;
@@ -1322,7 +1319,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SetClassLong(hTreeView, GCLP_HCURSOR, NULL);
hCursor = LoadCursor(NULL, IDC_HAND); // set mouse cursor to a hand when hovering over items or their extra images
}
- else SetClassLong(hTreeView, GCLP_HCURSOR, (LONG)LoadCursor(NULL, IDC_ARROW));
+ else SetClassLongPtr(hTreeView, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_ARROW));
if (!hCursor)
hCursor = LoadCursor(NULL, IDC_ARROW);
@@ -1330,7 +1327,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SetCursor(hCursor);
return true;
}
- else SetClassLong(hTreeView, GCLP_HCURSOR, (LONG)LoadCursor(NULL, IDC_ARROW));
+ else SetClassLongPtr(hTreeView, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_ARROW));
}
break;
diff --git a/plugins/NewAwaySysMod/src/stdafx.h b/plugins/NewAwaySysMod/src/stdafx.h index 56a4975ca3..b87211b678 100644 --- a/plugins/NewAwaySysMod/src/stdafx.h +++ b/plugins/NewAwaySysMod/src/stdafx.h @@ -282,7 +282,7 @@ int IsAnICQProto(char *szProto); // Client.cpp
void InitUpdateMsgs();
-void ChangeProtoMessages(char* szProto, int iMode, TCString &Msg);
+void ChangeProtoMessages(char* szProto, int iMode, const TCString &Msg);
int GetRecentGroupID(int iMode);
TCString VariablesEscape(TCString Str);
diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index 68adecd2aa..1a67cb7d77 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -121,7 +121,7 @@ int HookedInit(WPARAM, LPARAM) }
//---Called when an options dialog has to be created
-int HookedOptions(WPARAM wParam, LPARAM lParam)
+int HookedOptions(WPARAM wParam, LPARAM)
{
OptionsAdd(hInst, wParam);
return 0;
@@ -130,7 +130,7 @@ int HookedOptions(WPARAM wParam, LPARAM lParam) //---------------------------
//---Exported Functions
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
@@ -154,7 +154,7 @@ extern "C" __declspec(dllexport) int Unload(void) return 0;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
hInst = hinstDLL;
return TRUE;
diff --git a/plugins/NewEventNotify/src/menuitem.cpp b/plugins/NewEventNotify/src/menuitem.cpp index 0098b1335f..19b4347ea1 100644 --- a/plugins/NewEventNotify/src/menuitem.cpp +++ b/plugins/NewEventNotify/src/menuitem.cpp @@ -27,7 +27,7 @@ HGENMENU hMenuitemNotify;
BOOL bNotify;
-static INT_PTR MenuitemNotifyCmd(WPARAM wParam,LPARAM lParam)
+static INT_PTR MenuitemNotifyCmd(WPARAM, LPARAM)
{
bNotify = !bNotify;
MenuitemUpdate(bNotify);
diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index 7b08d50e2e..794c895f3d 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -43,13 +43,13 @@ PLUGININFOEX pluginInfo = {0xb25e8c7b, 0x292b, 0x495a, {0x9f, 0xb8, 0xa4, 0xc3, 0xd4, 0xee, 0xb0, 0x4b}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
hInst = hinstDLL;
return TRUE;
}
-extern "C" __declspec (dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec (dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
@@ -105,7 +105,7 @@ void RemoveAllEvents(MCONTACT hContact) }
}
-void CALLBACK TimerProc(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
+void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
RemoveReadEvents();
}
@@ -132,7 +132,7 @@ int OnDatabaseEventAdd(WPARAM hContact, LPARAM hDBEvent) return 0;
}
-INT_PTR ServiceClear(WPARAM hContact, LPARAM lParam)
+INT_PTR ServiceClear(WPARAM hContact, LPARAM)
{
if (MessageBox(0, TranslateT("This operation will PERMANENTLY REMOVE all history for this contact.\nAre you sure you want to do this?"), TranslateT("Clear History"), MB_YESNO | MB_ICONWARNING) == IDYES)
RemoveAllEvents(hContact);
@@ -140,7 +140,7 @@ INT_PTR ServiceClear(WPARAM hContact, LPARAM lParam) return 0;
}
-int PrebuildContactMenu(WPARAM hContact, LPARAM lParam)
+int PrebuildContactMenu(WPARAM hContact, LPARAM)
{
bool remove = db_get_b(hContact, MODULE, DBSETTING_REMOVE, 0) != 0;
char *proto = GetContactProto(hContact);
@@ -159,7 +159,7 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM lParam) return 0;
}
-INT_PTR ServiceToggle(WPARAM hContact, LPARAM lParam)
+INT_PTR ServiceToggle(WPARAM hContact, LPARAM)
{
int remove = db_get_b(hContact, MODULE, DBSETTING_REMOVE, 0) != 0;
remove = !remove;
@@ -176,7 +176,7 @@ INT_PTR ServiceToggle(WPARAM hContact, LPARAM lParam) return 0;
}
-int WindowEvent(WPARAM wParam, LPARAM lParam)
+int WindowEvent(WPARAM, LPARAM lParam)
{
MessageWindowEventData *mwd = (MessageWindowEventData *)lParam;
MCONTACT hContact = mwd->hContact;
@@ -242,7 +242,7 @@ void SrmmMenu_Load() HookEvent(ME_MSG_ICONPRESSED, IconPressed);
}
-int ModulesLoaded(WPARAM wParam, LPARAM lParam)
+int ModulesLoaded(WPARAM, LPARAM)
{
// create contact menu item
CMenuItem mi;
diff --git a/plugins/NoHistory/src/icons.cpp b/plugins/NoHistory/src/icons.cpp index ab1f3b9f4c..c718ecd356 100644 --- a/plugins/NoHistory/src/icons.cpp +++ b/plugins/NoHistory/src/icons.cpp @@ -9,7 +9,7 @@ static IconItem iconList[] = { LPGEN("Clear"), "clear", IDI_HCLEAR },
};
-int ReloadIcons(WPARAM wParam, LPARAM lParam)
+int ReloadIcons(WPARAM, LPARAM)
{
hIconRemove = IcoLib_GetIconByHandle(iconList[0].hIcolib);
hIconKeep = IcoLib_GetIconByHandle(iconList[1].hIcolib);
diff --git a/plugins/NoHistory/src/options.cpp b/plugins/NoHistory/src/options.cpp index 4be4ad59d6..b680e150ae 100644 --- a/plugins/NoHistory/src/options.cpp +++ b/plugins/NoHistory/src/options.cpp @@ -216,7 +216,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return 0;
}
-int OptInit(WPARAM wParam, LPARAM lParam)
+int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index 7d2f6a8771..33c9778e0f 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
@@ -479,7 +479,7 @@ void ExportContact(MCONTACT hContact) }
}
-INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam)
+INT_PTR ImportContacts(WPARAM, LPARAM)
{
MCONTACT hContact;
char name[256] = "", program[256] = "", programparam[256] = "", group[256] = "", line[2001] = "";
diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp index e8bcf519c0..5690b5a2f9 100644 --- a/plugins/Non-IM Contact/src/dialog.cpp +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -49,7 +49,6 @@ INT_PTR CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetDlgItemText(hwnd, IDC_TIMER_INT, _T("1"));
}
break;
- return TRUE;
}
break;
@@ -95,7 +94,7 @@ braceList[VARS] = };
int braceOrder[MAX_BRACES] = { 0 };
-INT_PTR CALLBACK HelpWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK HelpWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM)
{
switch (msg) {
case WM_INITDIALOG:
@@ -114,7 +113,7 @@ INT_PTR CALLBACK HelpWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return FALSE;
}
-INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM)
{
switch (msg) {
case WM_INITDIALOG:
@@ -218,7 +217,7 @@ INT_PTR LoadFilesDlg(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
-static int CALLBACK PropSheetProc(HWND hwnd, UINT uMsg, LPARAM lParam)
+static int CALLBACK PropSheetProc(HWND, UINT uMsg, LPARAM lParam)
{
if (uMsg == PSCB_PRECREATE) {
// Remove the DS_CONTEXTHELP style from the
@@ -299,7 +298,7 @@ void DoPropertySheet(MCONTACT hContact, HINSTANCE hInst) PropertySheetA(&psh);
}
-INT_PTR addContact(WPARAM wParam, LPARAM lParam)
+INT_PTR addContact(WPARAM, LPARAM)
{
char tmp[256];
MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
@@ -313,7 +312,7 @@ INT_PTR addContact(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR editContact(WPARAM wParam, LPARAM lParam)
+INT_PTR editContact(WPARAM wParam, LPARAM)
{
MCONTACT hContact = wParam;
char tmp[256];
diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp index 48f85ecd83..0ba3631be1 100644 --- a/plugins/Non-IM Contact/src/files.cpp +++ b/plugins/Non-IM Contact/src/files.cpp @@ -1,6 +1,6 @@ #include "stdafx.h"
-INT_PTR exportContacts(WPARAM wParam, LPARAM lParam)
+INT_PTR exportContacts(WPARAM, LPARAM)
{
char fn[MAX_PATH];
if (!Openfile(fn, 0))
@@ -101,7 +101,7 @@ int savehtml(char* outFile) void readFile(HWND hwnd)
{
- int lineNumber, fileLength = 0, width = 0;
+ int lineNumber, fileLength = 0;
char temp[MAX_STRING_LENGTH], szFileName[512], temp1[MAX_STRING_LENGTH], fn[8];
int fileNumber = SendDlgItemMessage(hwnd, IDC_FILE_LIST, CB_GETCURSEL, 0, 0);
mir_snprintf(fn, "fn%d", fileNumber);
@@ -275,7 +275,6 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case IDCANCEL:
DestroyWindow(hwnd);
break;
- return TRUE;
}
break;
diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp index fa668b55d3..7c431bb8e3 100644 --- a/plugins/Non-IM Contact/src/main.cpp +++ b/plugins/Non-IM Contact/src/main.cpp @@ -24,7 +24,7 @@ PLUGININFOEX pluginInfoEx = { { 0x2e0d2ae3, 0xe123, 0x4607, {0x85, 0x39, 0xd4, 0x44, 0x8d, 0x67, 0x5d, 0xdb} }
};
-INT_PTR doubleClick(WPARAM wParam, LPARAM lParam)
+INT_PTR doubleClick(WPARAM wParam, LPARAM)
{
char program[MAX_PATH], params[MAX_PATH];
int shellEXEerror = 0;
@@ -77,7 +77,7 @@ int NimcOptInit(WPARAM wParam, LPARAM) // Description : Sets plugin info
//=====================================================
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
@@ -89,13 +89,13 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda // Description :
//=====================================================
-BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD, LPVOID)
{
hInst = hinst;
return TRUE;
}
-int ModulesLoaded(WPARAM wParam, LPARAM lParam)
+int ModulesLoaded(WPARAM, LPARAM)
{
NetlibInit();
return 0;
diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp index 49ca6cae90..973d689ee3 100644 --- a/plugins/Non-IM Contact/src/namereplacing.cpp +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -141,7 +141,7 @@ int findLine(char* FileContents[], const char* string, int linesInFile, int star return -1;
}
-int findChar(char* FileContents[], const char* string, int linesInFile, int startLine, int *positionInOldString, int startChar, int startEnd) // 0=start, 1=end for startEnd
+int findChar(char* FileContents[], const char* string, int startLine, int *positionInOldString, int startChar, int startEnd) // 0=start, 1=end for startEnd
{
char tmp[5];
int i = getNumber(&string[*positionInOldString]);
@@ -486,7 +486,7 @@ int stringReplacer(const char *oldString, CMStringA &szNewString, MCONTACT hCont startLine = tempInt;
if (!endChar)
endChar = (int)mir_strlen(fileContents[startLine]);
- tempInt = findChar(fileContents, oldString, linesInFile, startLine, &positionInOldString, startChar, 0);
+ tempInt = findChar(fileContents, oldString, startLine, &positionInOldString, startChar, 0);
if (tempInt == -1)
return ERROR_NO_LINE_AFTER_VAR_F;
startChar = tempInt;
@@ -502,7 +502,7 @@ int stringReplacer(const char *oldString, CMStringA &szNewString, MCONTACT hCont positionInOldString += 2;
endLine = tempInt;
- tempInt = findChar(fileContents, oldString, linesInFile, startLine, &positionInOldString, startChar, 1);
+ tempInt = findChar(fileContents, oldString, startLine, &positionInOldString, startChar, 1);
if (tempInt == -1)
return ERROR_NO_LINE_AFTER_VAR_F;
endChar = tempInt;
diff --git a/plugins/Non-IM Contact/src/services.cpp b/plugins/Non-IM Contact/src/services.cpp index c582f4b7e4..e6fcfb3da3 100644 --- a/plugins/Non-IM Contact/src/services.cpp +++ b/plugins/Non-IM Contact/src/services.cpp @@ -18,7 +18,7 @@ int db_get_static(MCONTACT hContact, const char *szModule, const char *szSetting // GetCaps
//=======================================================
-INT_PTR GetLCCaps(WPARAM wParam, LPARAM lParam)
+INT_PTR GetLCCaps(WPARAM wParam, LPARAM)
{
if (wParam == PFLAGNUM_1)
return 0;
@@ -41,7 +41,7 @@ INT_PTR GetLCName(WPARAM wParam, LPARAM lParam) //=======================================================
// BPLoadIcon
//=======================================================
-INT_PTR LoadLCIcon(WPARAM wParam, LPARAM lParam)
+INT_PTR LoadLCIcon(WPARAM wParam, LPARAM)
{
if (LOWORD(wParam) == PLI_PROTOCOL) {
if (wParam & PLIF_ICOLIBHANDLE)
@@ -63,7 +63,7 @@ INT_PTR LoadLCIcon(WPARAM wParam, LPARAM lParam) // SetFStatus
//=======================================================
-int SetLCStatus(WPARAM wParam, LPARAM lParam)
+int SetLCStatus(WPARAM wParam, LPARAM)
{
int oldStatus = LCStatus;
LCStatus = wParam;
@@ -114,7 +114,7 @@ int SetLCStatus(WPARAM wParam, LPARAM lParam) // GetStatus
//=======================================================
-INT_PTR GetLCStatus(WPARAM wParam, LPARAM lParam)
+INT_PTR GetLCStatus(WPARAM, LPARAM)
{
if ((LCStatus >= ID_STATUS_ONLINE) && (LCStatus <= ID_STATUS_OUTTOLUNCH))
return LCStatus;
diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp index 32afa0ff35..3bf775e6fa 100644 --- a/plugins/Non-IM Contact/src/timer.cpp +++ b/plugins/Non-IM Contact/src/timer.cpp @@ -9,7 +9,7 @@ static UINT_PTR timerId = 0; // Description : called when the timer interval occurs
//=====================================================
-void timerFunc(void *di)
+void timerFunc(void*)
{
char text[512], fn[16], szFileName[MAX_PATH], temp[MAX_PATH];
diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index a79a3baebc..8bc54180a4 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -50,7 +50,7 @@ void AddSessionMark(MCONTACT hContact, int mode, char bit) else pszBuffer = szValue.detach();
char temp_1 = pszBuffer[0];
- for (size_t i = 0; i < g_ses_count; i++) {
+ for (int i = 0; i < g_ses_count; i++) {
char temp_2 = pszBuffer[i + 1];
pszBuffer[i + 1] = temp_1;
temp_1 = temp_2;
diff --git a/plugins/SmileyAdd/src/AniSmileyObject.cpp b/plugins/SmileyAdd/src/AniSmileyObject.cpp index 9411da6b6b..c713f41c66 100644 --- a/plugins/SmileyAdd/src/AniSmileyObject.cpp +++ b/plugins/SmileyAdd/src/AniSmileyObject.cpp @@ -30,9 +30,9 @@ static LIST<CAniSmileyObject> regAniSmileys(10, CompareAniSmiley); static UINT_PTR timerId;
static void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD);
-static void CALLBACK sttMainThreadCallback( PVOID )
+static void CALLBACK sttMainThreadCallback(PVOID)
{
- if (timerId == 0xffffffff)
+ if (timerId == 0xffffffff)
timerId = SetTimer(NULL, 0, 100, (TIMERPROC)timerProc);
}
@@ -40,7 +40,7 @@ static void CALLBACK sttMainThreadCallback( PVOID ) class CAniSmileyObject : public ISmileyBase
{
private:
- typedef enum { animStdOle, animDrctRichEd, animHpp } AnimType;
+ typedef enum { animStdOle, animDrctRichEd, animHpp } AnimType;
POINTL m_rectOrig;
SIZEL m_rectExt;
@@ -53,7 +53,7 @@ private: long m_counter;
unsigned m_richFlags;
- long m_lastObjNum;
+ long m_lastObjNum;
AnimType m_animtype;
bool m_allowAni;
@@ -63,7 +63,7 @@ public: {
m_allowAni = false;
m_animtype = ishpp ? animHpp : animStdOle;
- m_bkg = clr;
+ m_bkg = clr;
m_rectOrig.x = 0;
m_rectOrig.y = 0;
@@ -108,7 +108,7 @@ public: {
regAniSmileys.remove(this);
- if (timerId && (timerId+1) && regAniSmileys.getCount() == 0) {
+ if (timerId && (timerId + 1) && regAniSmileys.getCount() == 0) {
KillTimer(NULL, timerId);
timerId = 0;
}
@@ -124,11 +124,11 @@ public: if (SendMessage(m_hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
return;
- REOBJECT reObj = {0};
- reObj.cbStruct = sizeof(REOBJECT);
+ REOBJECT reObj = { 0 };
+ reObj.cbStruct = sizeof(REOBJECT);
HRESULT hr = RichEditOle->GetObject(m_lastObjNum, &reObj, REO_GETOBJ_NO_INTERFACES);
- if (hr == S_OK && reObj.dwUser == (DWORD)(ISmileyBase*)this && reObj.clsid == CLSID_NULL)
+ if (hr == S_OK && reObj.dwUser == (DWORD)this && reObj.clsid == CLSID_NULL)
m_richFlags = reObj.dwFlags;
else {
long objectCount = RichEditOle->GetObjectCount();
@@ -136,7 +136,7 @@ public: HRESULT hr = RichEditOle->GetObject(i, &reObj, REO_GETOBJ_NO_INTERFACES);
if (FAILED(hr)) continue;
- if (reObj.dwUser == (DWORD)(ISmileyBase*)this && reObj.clsid == CLSID_NULL) {
+ if (reObj.dwUser == (DWORD)this && reObj.clsid == CLSID_NULL) {
m_lastObjNum = i;
m_richFlags = reObj.dwFlags;
break;
@@ -163,20 +163,20 @@ public: HANDLE hOld = SelectObject(hdcMem, hBmp);
RECT rc;
- rc.left = m_rectExt.cx - m_sizeExtent.cx;
- rc.top = m_rectExt.cy - m_sizeExtent.cy;
- rc.right = rc.left + m_sizeExtent.cx;
+ rc.left = m_rectExt.cx - m_sizeExtent.cx;
+ rc.top = m_rectExt.cy - m_sizeExtent.cy;
+ rc.right = rc.left + m_sizeExtent.cx;
rc.bottom = rc.top + m_sizeExtent.cy;
- HBRUSH hbr = CreateSolidBrush(m_bkg);
+ HBRUSH hbr = CreateSolidBrush(m_bkg);
RECT frc = { 0, 0, m_rectExt.cx, m_rectExt.cy };
FillRect(hdcMem, &frc, hbr);
DeleteObject(hbr);
- m_img->DrawInternal(hdcMem, rc.left, rc.top, m_sizeExtent.cx - 1, m_sizeExtent.cy - 1);
+ m_img->DrawInternal(hdcMem, rc.left, rc.top, m_sizeExtent.cx - 1, m_sizeExtent.cy - 1);
if (m_richFlags & REO_SELECTED) {
- HBRUSH hbr = CreateSolidBrush(m_bkg ^ 0xFFFFFF);
+ HBRUSH hbr = CreateSolidBrush(m_bkg ^ 0xFFFFFF);
FrameRect(hdcMem, &rc, hbr);
DeleteObject(hbr);
}
@@ -186,13 +186,13 @@ public: BitBlt(hdc, m_rectOrig.x, m_rectOrig.y, m_rectExt.cx, m_rectExt.cy, hdcMem, 0, 0, SRCCOPY);
- SelectObject(hdcMem, hOld);
- DeleteObject(hBmp);
+ SelectObject(hdcMem, hOld);
+ DeleteObject(hBmp);
DeleteDC(hdcMem);
}
void DrawOnRichEdit(void)
- {
+ {
HDC hdc = GetDC(m_hwnd);
if (RectVisible(hdc, &m_orect)) {
RECT crct;
@@ -201,13 +201,13 @@ public: HRGN hrgnOld = CreateRectRgnIndirect(&crct);
int res = GetClipRgn(hdc, hrgnOld);
- HRGN hrgn = CreateRectRgnIndirect(&crct);
- SelectClipRgn(hdc, hrgn);
+ HRGN hrgn = CreateRectRgnIndirect(&crct);
+ SelectClipRgn(hdc, hrgn);
DeleteObject(hrgn);
DoDirectDraw(hdc);
- SelectClipRgn(hdc, res < 1 ? NULL : hrgnOld);
+ SelectClipRgn(hdc, res < 1 ? NULL : hrgnOld);
DeleteObject(hrgnOld);
}
else {
@@ -220,7 +220,7 @@ public: void DrawOnHPP(void)
{
- FVCNDATA_NMHDR nmh = {0};
+ FVCNDATA_NMHDR nmh = { 0 };
nmh.code = NM_FIREVIEWCHANGE;
nmh.hwndFrom = m_hwnd;
@@ -241,7 +241,7 @@ public: case FVCA_CUSTOMDRAW:
m_rectExt.cy = nmh.rcRect.bottom - nmh.rcRect.top;
m_rectExt.cx = nmh.rcRect.right - nmh.rcRect.left;
- m_rectOrig.x = nmh.rcRect.left;
+ m_rectOrig.x = nmh.rcRect.left;
m_rectOrig.y = nmh.rcRect.top;
m_bkg = nmh.clrBackground;
@@ -328,9 +328,9 @@ public: return ISmileyBase::Close(dwSaveOption);
}
- STDMETHOD(Draw)(DWORD dwAspect, LONG, void*, DVTARGETDEVICE*, HDC,
+ STDMETHOD(Draw)(DWORD dwAspect, LONG, void*, DVTARGETDEVICE*, HDC,
HDC hdc, LPCRECTL pRectBounds, LPCRECTL /* pRectWBounds */,
- BOOL (__stdcall *)(ULONG_PTR), ULONG_PTR)
+ BOOL(__stdcall *)(ULONG_PTR), ULONG_PTR)
{
if (dwAspect != DVASPECT_CONTENT) return DV_E_DVASPECT;
if (pRectBounds == NULL) return E_INVALIDARG;
@@ -339,13 +339,13 @@ public: if (m_img == NULL) return E_FAIL;
- m_sizeExtent.cx = pRectBounds->right - pRectBounds->left;
+ m_sizeExtent.cx = pRectBounds->right - pRectBounds->left;
m_sizeExtent.cy = pRectBounds->bottom - pRectBounds->top;
m_rectExt = m_sizeExtent;
switch (m_animtype) {
- case animDrctRichEd:
+ case animDrctRichEd:
{
m_rectExt.cy = pRectBounds->bottom - m_rectOrig.y;
RECT frc = { 0, 0, m_sizeExtent.cx - 1, m_sizeExtent.cy - 1 };
@@ -354,7 +354,7 @@ public: HDC hdcMem = CreateCompatibleDC(hdc);
HANDLE hOld = SelectObject(hdcMem, hBmp);
- HBRUSH hbr = CreateSolidBrush(m_bkg);
+ HBRUSH hbr = CreateSolidBrush(m_bkg);
FillRect(hdcMem, &frc, hbr);
DeleteObject(hbr);
@@ -362,8 +362,8 @@ public: BitBlt(hdc, pRectBounds->left, pRectBounds->top, frc.right, frc.bottom, hdcMem, 0, 0, SRCCOPY);
- SelectObject(hdcMem, hOld);
- DeleteObject(hBmp);
+ SelectObject(hdcMem, hOld);
+ DeleteObject(hBmp);
DeleteDC(hdcMem);
}
GetDrawingProp();
@@ -373,19 +373,19 @@ public: m_orect = *(LPRECT)pRectBounds;
default:
- m_img->DrawInternal(hdc, pRectBounds->left, pRectBounds->top,
+ m_img->DrawInternal(hdc, pRectBounds->left, pRectBounds->top,
m_sizeExtent.cx - 1, m_sizeExtent.cy - 1);
break;
}
- m_allowAni = true;
+ m_allowAni = true;
m_visible = true;
return S_OK;
}
STDMETHOD(SetExtent)(DWORD dwDrawAspect, SIZEL* psizel)
- {
+ {
HRESULT hr = ISmileyBase::SetExtent(dwDrawAspect, psizel);
if (hr == S_OK) m_rectExt = m_sizeExtent;
return hr;
@@ -400,20 +400,19 @@ ISmileyBase* CreateAniSmileyObject(SmileyType* sml, COLORREF clr, bool ishpp) return obj;
}
-static void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
+static void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD)
{
- for (int i=0; i < regAniSmileys.getCount(); i++)
+ for (int i = 0; i < regAniSmileys.getCount(); i++)
regAniSmileys[i]->ProcessTimerTick();
}
void DestroyAniSmileys(void)
{
- if (timerId && (timerId+1)) {
+ if (timerId && (timerId + 1)) {
KillTimer(NULL, timerId);
timerId = 0;
}
- for (int i=0; i < regAniSmileys.getCount(); i++)
+ for (int i = 0; i < regAniSmileys.getCount(); i++)
delete regAniSmileys[i];
}
-
diff --git a/protocols/Sametime/src/glib/gqsort.c b/protocols/Sametime/src/glib/gqsort.c index f0acecfe89..25508167f9 100644 --- a/protocols/Sametime/src/glib/gqsort.c +++ b/protocols/Sametime/src/glib/gqsort.c @@ -45,33 +45,33 @@ /* Byte-wise swap two items of size SIZE. */ #define SWAP(a, b, size) \ do \ - { \ + { \ register size_t __size = (size); \ register char *__a = (a), *__b = (b); \ do \ - { \ + { \ char __tmp = *__a; \ *__a++ = *__b; \ *__b++ = __tmp; \ - } while (--__size > 0); \ - } while (0) + } while (--__size > 0); \ + } while (0) /* Discontinue quicksort algorithm when partition gets below this size. - This particular magic number was chosen to work best on a Sun 4/260. */ + This particular magic number was chosen to work best on a Sun 4/260. */ #define MAX_THRESH 4 /* Stack node declarations used to store unfulfilled partition obligations. */ typedef struct - { - char *lo; - char *hi; - } stack_node; +{ + char *lo; + char *hi; +} stack_node; /* The next 4 #defines implement a very fast in-line stack abstraction. */ /* The stack needs log (total_elements) entries (we could even subtract - log(MAX_THRESH)). Since total_elements has type size_t, we get as - upper bound for log (total_elements): - bits per byte (CHAR_BIT) * sizeof(size_t). */ + log(MAX_THRESH)). Since total_elements has type size_t, we get as + upper bound for log (total_elements): + bits per byte (CHAR_BIT) * sizeof(size_t). */ #define STACK_SIZE (CHAR_BIT * sizeof(size_t)) #define PUSH(low, high) ((void) ((top->lo = (low)), (top->hi = (high)), ++top)) #define POP(low, high) ((void) (--top, (low = top->lo), (high = top->hi))) @@ -79,28 +79,28 @@ typedef struct /* Order size using quicksort. This implementation incorporates - four optimizations discussed in Sedgewick: + four optimizations discussed in Sedgewick: - 1. Non-recursive, using an explicit stack of pointer that store the - next array partition to sort. To save time, this maximum amount - of space required to store an array of SIZE_MAX is allocated on the - stack. Assuming a 32-bit (64 bit) integer for size_t, this needs - only 32 * sizeof(stack_node) == 256 bytes (for 64 bit: 1024 bytes). - Pretty cheap, actually. + 1. Non-recursive, using an explicit stack of pointer that store the + next array partition to sort. To save time, this maximum amount + of space required to store an array of SIZE_MAX is allocated on the + stack. Assuming a 32-bit (64 bit) integer for size_t, this needs + only 32 * sizeof(stack_node) == 256 bytes (for 64 bit: 1024 bytes). + Pretty cheap, actually. - 2. Chose the pivot element using a median-of-three decision tree. - This reduces the probability of selecting a bad pivot value and - eliminates certain extraneous comparisons. + 2. Chose the pivot element using a median-of-three decision tree. + This reduces the probability of selecting a bad pivot value and + eliminates certain extraneous comparisons. - 3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving - insertion sort to order the MAX_THRESH items within each partition. - This is a big win, since insertion sort is faster for small, mostly - sorted array segments. + 3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving + insertion sort to order the MAX_THRESH items within each partition. + This is a big win, since insertion sort is faster for small, mostly + sorted array segments. - 4. The larger of the two sub-partitions is always pushed onto the - stack first, with the algorithm then concentrating on the - smaller partition. This *guarantees* no more than log (total_elems) - stack size is needed (actually O(1) in this case)! */ + 4. The larger of the two sub-partitions is always pushed onto the + stack first, with the algorithm then concentrating on the + smaller partition. This *guarantees* no more than log (total_elems) + stack size is needed (actually O(1) in this case)! */ /** * g_qsort_with_data: @@ -112,174 +112,160 @@ typedef struct * * This is just like the standard C qsort() function, but * the comparison routine accepts a user data argument. - * + * **/ void -g_qsort_with_data (gconstpointer pbase, - gint total_elems, - gsize size, - GCompareDataFunc compare_func, - gpointer user_data) +g_qsort_with_data(gconstpointer pbase, +gint total_elems, +gsize size, +GCompareDataFunc compare_func, +gpointer user_data) { - register char *base_ptr = (char *) pbase; - - const size_t max_thresh = MAX_THRESH * size; - - g_return_if_fail (total_elems >= 0); - g_return_if_fail (pbase != NULL || total_elems == 0); - g_return_if_fail (compare_func != NULL); - - if (total_elems == 0) - /* Avoid lossage with unsigned arithmetic below. */ - return; - - if (total_elems > MAX_THRESH) - { - char *lo = base_ptr; - char *hi = &lo[size * (total_elems - 1)]; - stack_node stack[STACK_SIZE]; - stack_node *top = stack; - - PUSH (NULL, NULL); - - while (STACK_NOT_EMPTY) - { - char *left_ptr; - char *right_ptr; - - /* Select median value from among LO, MID, and HI. Rearrange - LO and HI so the three values are sorted. This lowers the - probability of picking a pathological pivot value and - skips a comparison for both the LEFT_PTR and RIGHT_PTR in - the while loops. */ - - char *mid = lo + size * ((hi - lo) / size >> 1); - - if ((*compare_func) ((void *) mid, (void *) lo, user_data) < 0) - SWAP (mid, lo, size); - if ((*compare_func) ((void *) hi, (void *) mid, user_data) < 0) - SWAP (mid, hi, size); - else - goto jump_over; - if ((*compare_func) ((void *) mid, (void *) lo, user_data) < 0) - SWAP (mid, lo, size); - jump_over:; - - left_ptr = lo + size; - right_ptr = hi - size; - - /* Here's the famous ``collapse the walls'' section of quicksort. - Gotta like those tight inner loops! They are the main reason - that this algorithm runs much faster than others. */ - do - { - while ((*compare_func) ((void *) left_ptr, (void *) mid, user_data) < 0) - left_ptr += size; - - while ((*compare_func) ((void *) mid, (void *) right_ptr, user_data) < 0) - right_ptr -= size; - - if (left_ptr < right_ptr) - { - SWAP (left_ptr, right_ptr, size); - if (mid == left_ptr) - mid = right_ptr; - else if (mid == right_ptr) - mid = left_ptr; - left_ptr += size; - right_ptr -= size; + register char *base_ptr = (char *)pbase; + + const size_t max_thresh = MAX_THRESH * size; + + g_return_if_fail(total_elems >= 0); + g_return_if_fail(pbase != NULL || total_elems == 0); + g_return_if_fail(compare_func != NULL); + + if (total_elems == 0) + /* Avoid lossage with unsigned arithmetic below. */ + return; + + if (total_elems > MAX_THRESH) { + char *lo = base_ptr; + char *hi = &lo[size * (total_elems - 1)]; + stack_node stack[STACK_SIZE]; + stack_node *top = stack; + + PUSH(NULL, NULL); + + while (STACK_NOT_EMPTY) { + char *left_ptr; + char *right_ptr; + + /* Select median value from among LO, MID, and HI. Rearrange + LO and HI so the three values are sorted. This lowers the + probability of picking a pathological pivot value and + skips a comparison for both the LEFT_PTR and RIGHT_PTR in + the while loops. */ + + char *mid = lo + size * ((hi - lo) / size >> 1); + + if ((*compare_func) ((void *)mid, (void *)lo, user_data) < 0) + SWAP(mid, lo, size); + if ((*compare_func) ((void *)hi, (void *)mid, user_data) < 0) + SWAP(mid, hi, size); + else + goto jump_over; + if ((*compare_func) ((void *)mid, (void *)lo, user_data) < 0) + SWAP(mid, lo, size); + jump_over:; + + left_ptr = lo + size; + right_ptr = hi - size; + + /* Here's the famous ``collapse the walls'' section of quicksort. + Gotta like those tight inner loops! They are the main reason + that this algorithm runs much faster than others. */ + do { + while ((*compare_func) ((void *)left_ptr, (void *)mid, user_data) < 0) + left_ptr += size; + + while ((*compare_func) ((void *)mid, (void *)right_ptr, user_data) < 0) + right_ptr -= size; + + if (left_ptr < right_ptr) { + SWAP(left_ptr, right_ptr, size); + if (mid == left_ptr) + mid = right_ptr; + else if (mid == right_ptr) + mid = left_ptr; + left_ptr += size; + right_ptr -= size; + } + else if (left_ptr == right_ptr) { + left_ptr += size; + right_ptr -= size; + break; + } + } while (left_ptr <= right_ptr); + + /* Set up pointers for next iteration. First determine whether + left and right partitions are below the threshold size. If so, + ignore one or both. Otherwise, push the larger partition's + bounds on the stack and continue sorting the smaller one. */ + + if ((size_t)(right_ptr - lo) <= max_thresh) { + if ((size_t)(hi - left_ptr) <= max_thresh) + /* Ignore both small partitions. */ + POP(lo, hi); + else + /* Ignore small left partition. */ + lo = left_ptr; + } + else if ((size_t)(hi - left_ptr) <= max_thresh) + /* Ignore small right partition. */ + hi = right_ptr; + else if ((right_ptr - lo) > (hi - left_ptr)) { + /* Push larger left partition indices. */ + PUSH(lo, right_ptr); + lo = left_ptr; + } + else { + /* Push larger right partition indices. */ + PUSH(left_ptr, hi); + hi = right_ptr; + } } - else if (left_ptr == right_ptr) - { - left_ptr += size; - right_ptr -= size; - break; + } + + /* Once the BASE_PTR array is partially sorted by quicksort the rest + is completely sorted using insertion sort, since this is efficient + for partitions below MAX_THRESH size. BASE_PTR points to the beginning + of the array to sort, and END_PTR points at the very last element in + the array (*not* one beyond it!). */ + + { + char *const end_ptr = &base_ptr[size * (total_elems - 1)]; + char *tmp_ptr = base_ptr; + char *thresh = min(end_ptr, base_ptr + max_thresh); + register char *run_ptr; + + /* Find smallest element in first threshold and place it at the + array's beginning. This is the smallest array element, + and the operation speeds up insertion sort's inner loop. */ + + for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size) + if ((*compare_func) ((void *)run_ptr, (void *)tmp_ptr, user_data) < 0) + tmp_ptr = run_ptr; + + if (tmp_ptr != base_ptr) + SWAP(tmp_ptr, base_ptr, size); + + /* Insertion sort, running from left-hand-side up to right-hand-side. */ + + run_ptr = base_ptr + size; + while ((run_ptr += size) <= end_ptr) { + tmp_ptr = run_ptr - size; + while ((*compare_func) ((void *)run_ptr, (void *)tmp_ptr, user_data) < 0) + tmp_ptr -= size; + + tmp_ptr += size; + if (tmp_ptr != run_ptr) { + char *trav; + + trav = run_ptr + size; + while (--trav >= run_ptr) { + char c = *trav; + char *hi, *lo; + + for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo) + *hi = *lo; + *hi = c; + } + } } - } - while (left_ptr <= right_ptr); - - /* Set up pointers for next iteration. First determine whether - left and right partitions are below the threshold size. If so, - ignore one or both. Otherwise, push the larger partition's - bounds on the stack and continue sorting the smaller one. */ - - if ((size_t) (right_ptr - lo) <= max_thresh) - { - if ((size_t) (hi - left_ptr) <= max_thresh) - /* Ignore both small partitions. */ - POP (lo, hi); - else - /* Ignore small left partition. */ - lo = left_ptr; - } - else if ((size_t) (hi - left_ptr) <= max_thresh) - /* Ignore small right partition. */ - hi = right_ptr; - else if ((right_ptr - lo) > (hi - left_ptr)) - { - /* Push larger left partition indices. */ - PUSH (lo, right_ptr); - lo = left_ptr; - } - else - { - /* Push larger right partition indices. */ - PUSH (left_ptr, hi); - hi = right_ptr; - } - } - } - - /* Once the BASE_PTR array is partially sorted by quicksort the rest - is completely sorted using insertion sort, since this is efficient - for partitions below MAX_THRESH size. BASE_PTR points to the beginning - of the array to sort, and END_PTR points at the very last element in - the array (*not* one beyond it!). */ - -#define min(x, y) ((x) < (y) ? (x) : (y)) - - { - char *const end_ptr = &base_ptr[size * (total_elems - 1)]; - char *tmp_ptr = base_ptr; - char *thresh = min(end_ptr, base_ptr + max_thresh); - register char *run_ptr; - - /* Find smallest element in first threshold and place it at the - array's beginning. This is the smallest array element, - and the operation speeds up insertion sort's inner loop. */ - - for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size) - if ((*compare_func) ((void *) run_ptr, (void *) tmp_ptr, user_data) < 0) - tmp_ptr = run_ptr; - - if (tmp_ptr != base_ptr) - SWAP (tmp_ptr, base_ptr, size); - - /* Insertion sort, running from left-hand-side up to right-hand-side. */ - - run_ptr = base_ptr + size; - while ((run_ptr += size) <= end_ptr) - { - tmp_ptr = run_ptr - size; - while ((*compare_func) ((void *) run_ptr, (void *) tmp_ptr, user_data) < 0) - tmp_ptr -= size; - - tmp_ptr += size; - if (tmp_ptr != run_ptr) - { - char *trav; - - trav = run_ptr + size; - while (--trav >= run_ptr) - { - char c = *trav; - char *hi, *lo; - - for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo) - *hi = *lo; - *hi = c; - } - } - } - } + } } |