diff options
author | Mataes <mataes2007@gmail.com> | 2018-05-16 22:58:35 +0300 |
---|---|---|
committer | Mataes <mataes2007@gmail.com> | 2018-05-16 22:58:35 +0300 |
commit | 56239fcddd46400d812d83e38597d593b5c0356d (patch) | |
tree | 9e8d35c9a990c2ff6b687ca53065d0c5a4bd3ac1 | |
parent | 650fc5a2103cedfe149500ade9c684ecf381d348 (diff) |
HistoryLinkList, HistoryStats, historysweeperlight, httpserver, HwHotKeys: cmplugin adaptation
31 files changed, 1044 insertions, 1081 deletions
diff --git a/plugins/HTTPServer/src/Glob.h b/plugins/HTTPServer/src/Glob.h index 24a1ab9268..0509444dfc 100644 --- a/plugins/HTTPServer/src/Glob.h +++ b/plugins/HTTPServer/src/Glob.h @@ -27,7 +27,6 @@ #include <string>
using namespace std;
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
#include <newpluginapi.h>
#include <m_database.h>
@@ -59,7 +58,12 @@ using namespace std; #define SplitIpAddress( p ) (BYTE)(p>>24),(BYTE)(p>>16),(BYTE)(p>>8),(BYTE)(p)
-extern HINSTANCE hInstance;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE)
+ {}
+};
extern HNETLIBUSER hNetlibUser;
@@ -84,6 +88,6 @@ extern bool bIsOnline; extern bool bLimitOnlyWhenOnline;
extern void* (*MirandaMalloc)(size_t);
-extern void (*MirandaFree)(void*);
+extern void(*MirandaFree)(void*);
#endif
\ No newline at end of file diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 11b179b4b6..edc0c5ceac 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -105,7 +105,7 @@ string DBGetString(MCONTACT hContact, const char *szModule, const char *szSettin else ret = dbv.pszVal;
}
else ret = pszError;
-
+
db_free(&dbv);
return ret;
}
@@ -248,7 +248,7 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( UINT uiMsg, // message identifier
WPARAM wParam, // message parameter
LPARAM lParam // message parameter
- )
+)
{
static const char* pszShareDirStr = Translate("Share Current Directory");
@@ -272,152 +272,152 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( return false;
case WM_NOTIFY:
+ {
+ OFNOTIFY * pNotify = (OFNOTIFY*)lParam;
+ switch (pNotify->hdr.code) {
+ case CDN_FOLDERCHANGE:
+ case CDN_SELCHANGE:
{
- OFNOTIFY * pNotify = (OFNOTIFY*)lParam;
- switch (pNotify->hdr.code) {
- case CDN_FOLDERCHANGE:
- case CDN_SELCHANGE:
- {
- static char szSelection[MAX_PATH] = "";
- HWND hWndFileDlg = GetParent(hDlg);
-
- *szSelection = '/';
- CommDlg_OpenSave_GetSpec(hWndFileDlg, (LPARAM)&szSelection[1], _MAX_PATH);
-
- HWND hFileName = GetDlgItem(hWndFileDlg, edt1);
- char pszFileName[MAX_PATH];
- GetWindowText(hFileName, pszFileName, _countof(pszFileName));
-
- if (mir_strcmp(pstShare->pszSrvPath, szSelection) &&
- mir_strcmp(pszFileName, pszShareDirStr)) {
- // a file was selected
-
- // only reenable windows / set default values when a folder was selected before
- if (pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath) - 1] == '/') {
- pNotify->lpOFN->Flags |= OFN_FILEMUSTEXIST;
- EnableWindow(hFileName, TRUE);
- EnableWindow(GetDlgItem(hDlg, IDC_MAX_DOWNLOADS), TRUE);
- SetDlgItemInt(hDlg, IDC_MAX_DOWNLOADS, nDefaultDownloadLimit, true);
- }
- }
- else {
- // a directory was selected
- pNotify->lpOFN->Flags &= ~OFN_FILEMUSTEXIST;
- mir_strcpy(pNotify->lpOFN->lpstrFile, pszShareDirStr);
- CommDlg_OpenSave_SetControlText(hWndFileDlg, edt1, pszShareDirStr);
- EnableWindow(hFileName, FALSE);
- EnableWindow(GetDlgItem(hDlg, IDC_MAX_DOWNLOADS), FALSE);
- SetDlgItemInt(hDlg, IDC_MAX_DOWNLOADS, (UINT)-1, true);
-
- CommDlg_OpenSave_GetFolderPath(hWndFileDlg, szSelection, MAX_PATH);
- char* pszFolder = szSelection;
- char* pszTmp = szSelection;
- while (*pszTmp != '\0') {
- if (*pszTmp == '\\' && *(pszTmp + 1))
- pszFolder = pszTmp + 1;
- pszTmp++;
- }
+ static char szSelection[MAX_PATH] = "";
+ HWND hWndFileDlg = GetParent(hDlg);
+
+ *szSelection = '/';
+ CommDlg_OpenSave_GetSpec(hWndFileDlg, (LPARAM)&szSelection[1], _MAX_PATH);
+
+ HWND hFileName = GetDlgItem(hWndFileDlg, edt1);
+ char pszFileName[MAX_PATH];
+ GetWindowText(hFileName, pszFileName, _countof(pszFileName));
+
+ if (mir_strcmp(pstShare->pszSrvPath, szSelection) &&
+ mir_strcmp(pszFileName, pszShareDirStr)) {
+ // a file was selected
+
+ // only reenable windows / set default values when a folder was selected before
+ if (pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath) - 1] == '/') {
+ pNotify->lpOFN->Flags |= OFN_FILEMUSTEXIST;
+ EnableWindow(hFileName, TRUE);
+ EnableWindow(GetDlgItem(hDlg, IDC_MAX_DOWNLOADS), TRUE);
+ SetDlgItemInt(hDlg, IDC_MAX_DOWNLOADS, nDefaultDownloadLimit, true);
+ }
+ }
+ else {
+ // a directory was selected
+ pNotify->lpOFN->Flags &= ~OFN_FILEMUSTEXIST;
+ mir_strcpy(pNotify->lpOFN->lpstrFile, pszShareDirStr);
+ CommDlg_OpenSave_SetControlText(hWndFileDlg, edt1, pszShareDirStr);
+ EnableWindow(hFileName, FALSE);
+ EnableWindow(GetDlgItem(hDlg, IDC_MAX_DOWNLOADS), FALSE);
+ SetDlgItemInt(hDlg, IDC_MAX_DOWNLOADS, (UINT)-1, true);
+
+ CommDlg_OpenSave_GetFolderPath(hWndFileDlg, szSelection, MAX_PATH);
+ char* pszFolder = szSelection;
+ char* pszTmp = szSelection;
+ while (*pszTmp != '\0') {
+ if (*pszTmp == '\\' && *(pszTmp + 1))
+ pszFolder = pszTmp + 1;
+ pszTmp++;
+ }
- pszTmp = strchr(szSelection, ':');
- if (pszTmp != nullptr)
- *pszTmp = '\0';
+ pszTmp = strchr(szSelection, ':');
+ if (pszTmp != nullptr)
+ *pszTmp = '\0';
- memmove(&szSelection[1], pszFolder, mir_strlen(pszFolder) + 1);
- szSelection[0] = '/';
- if (szSelection[mir_strlen(szSelection) - 1] != '/')
- mir_strcat(szSelection, "/");
+ memmove(&szSelection[1], pszFolder, mir_strlen(pszFolder) + 1);
+ szSelection[0] = '/';
+ if (szSelection[mir_strlen(szSelection) - 1] != '/')
+ mir_strcat(szSelection, "/");
- // only write to IDC_SHARE_NAME when a file / other folder was selected before
- if (!mir_strcmp(szSelection, pstShare->pszSrvPath))
- return false;
- }
+ // only write to IDC_SHARE_NAME when a file / other folder was selected before
+ if (!mir_strcmp(szSelection, pstShare->pszSrvPath))
+ return false;
+ }
- if (nInit != 0) {
- // when the dialog is created a CDN_FOLDERCHANGE and a CDN_SELCHANGE message
- // is posted. When the dialog is used for editting make sure the right server
- // path (not the auto generated) is written to IDC_SHARE_NAME
- if (nInit == 2)
- SetDlgItemText(hDlg, IDC_SHARE_NAME, pstShare->pszSrvPath);
+ if (nInit != 0) {
+ // when the dialog is created a CDN_FOLDERCHANGE and a CDN_SELCHANGE message
+ // is posted. When the dialog is used for editting make sure the right server
+ // path (not the auto generated) is written to IDC_SHARE_NAME
+ if (nInit == 2)
+ SetDlgItemText(hDlg, IDC_SHARE_NAME, pstShare->pszSrvPath);
- nInit--;
- }
- else {
- SetDlgItemText(hDlg, IDC_SHARE_NAME, szSelection);
- }
+ nInit--;
+ }
+ else {
+ SetDlgItemText(hDlg, IDC_SHARE_NAME, szSelection);
+ }
- mir_strcpy(pstShare->pszSrvPath, szSelection);
+ mir_strcpy(pstShare->pszSrvPath, szSelection);
- return false;
- }
+ return false;
+ }
- case CDN_FILEOK:
- {
- GetDlgItemText(hDlg, IDC_SHARE_NAME, pstShare->pszSrvPath, _MAX_PATH);
+ case CDN_FILEOK:
+ {
+ GetDlgItemText(hDlg, IDC_SHARE_NAME, pstShare->pszSrvPath, _MAX_PATH);
- char* pszTmp = strstr(pstShare->pszRealPath, pszShareDirStr);
- if (pszTmp) {
- *pszTmp = '\0';
- if (pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath) - 1] != '/')
- mir_strcat(pstShare->pszSrvPath, "/");
- }
- else {
- if (pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath) - 1] == '/')
- pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath) - 1] = '\0';
- }
+ char* pszTmp = strstr(pstShare->pszRealPath, pszShareDirStr);
+ if (pszTmp) {
+ *pszTmp = '\0';
+ if (pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath) - 1] != '/')
+ mir_strcat(pstShare->pszSrvPath, "/");
+ }
+ else {
+ if (pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath) - 1] == '/')
+ pstShare->pszSrvPath[mir_strlen(pstShare->pszSrvPath) - 1] = '\0';
+ }
- BOOL bTranslated = false;
- pstShare->nMaxDownloads = GetDlgItemInt(hDlg, IDC_MAX_DOWNLOADS, &bTranslated, true);
- if (pstShare->nMaxDownloads <= 0 && pstShare->nMaxDownloads != -1)
- bTranslated = false;
+ BOOL bTranslated = false;
+ pstShare->nMaxDownloads = GetDlgItemInt(hDlg, IDC_MAX_DOWNLOADS, &bTranslated, true);
+ if (pstShare->nMaxDownloads <= 0 && pstShare->nMaxDownloads != -1)
+ bTranslated = false;
- SendDlgItemMessage(hDlg, IDC_ALLOWED_IPADDRESS, IPM_GETADDRESS, 0, (LPARAM)&(pstShare->dwAllowedIP));
- SendDlgItemMessage(hDlg, IDC_ALLOWED_IP_MASK, IPM_GETADDRESS, 0, (LPARAM)&(pstShare->dwAllowedMask));
+ SendDlgItemMessage(hDlg, IDC_ALLOWED_IPADDRESS, IPM_GETADDRESS, 0, (LPARAM)&(pstShare->dwAllowedIP));
+ SendDlgItemMessage(hDlg, IDC_ALLOWED_IP_MASK, IPM_GETADDRESS, 0, (LPARAM)&(pstShare->dwAllowedMask));
- //if( ! (pstShare->dwAllowedIP & pstShare->dwAllowedMask)
+ //if( ! (pstShare->dwAllowedIP & pstShare->dwAllowedMask)
- if (!bTranslated || (mir_strlen(pstShare->pszSrvPath) <= 0)) {
- SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 1);
- return true;
- }
- return false;
- }
+ if (!bTranslated || (mir_strlen(pstShare->pszSrvPath) <= 0)) {
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 1);
+ return true;
}
- break;
+ return false;
+ }
}
+ break;
+ }
case WM_DROPFILES:
- {
- HDROP hDrop = (HDROP)wParam;
- char szDropedFile[MAX_PATH];
- int nLen = DragQueryFile(hDrop, 0, szDropedFile, sizeof(szDropedFile));
- if (nLen > 0) {
- char * psz = strrchr(szDropedFile, '\\');
- if (psz) {
- char oldNext = psz[1];
- psz[1] = '\0';
- // Fill in the directory
- SendMessage(GetParent(hDlg), CDM_SETCONTROLTEXT, edt1, (LPARAM)szDropedFile);
- // click on the OK button. to move to dir
- SendMessage(GetParent(hDlg), WM_COMMAND, IDOK, 0);
- psz[1] = oldNext;
- // Fill in the file name this will cause a call to the CDN_SELCHANGE
- // and there by set the share name
- SendMessage(GetParent(hDlg), CDM_SETCONTROLTEXT, edt1, (LPARAM)&psz[1]);
- }
+ {
+ HDROP hDrop = (HDROP)wParam;
+ char szDropedFile[MAX_PATH];
+ int nLen = DragQueryFile(hDrop, 0, szDropedFile, sizeof(szDropedFile));
+ if (nLen > 0) {
+ char * psz = strrchr(szDropedFile, '\\');
+ if (psz) {
+ char oldNext = psz[1];
+ psz[1] = '\0';
+ // Fill in the directory
+ SendMessage(GetParent(hDlg), CDM_SETCONTROLTEXT, edt1, (LPARAM)szDropedFile);
+ // click on the OK button. to move to dir
+ SendMessage(GetParent(hDlg), WM_COMMAND, IDOK, 0);
+ psz[1] = oldNext;
+ // Fill in the file name this will cause a call to the CDN_SELCHANGE
+ // and there by set the share name
+ SendMessage(GetParent(hDlg), CDM_SETCONTROLTEXT, edt1, (LPARAM)&psz[1]);
}
- DragFinish(hDrop);
- return 0;
}
+ DragFinish(hDrop);
+ return 0;
+ }
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_TOGGLE_MASK:
- {
- DWORD dwCur;
- SendDlgItemMessage(hDlg, IDC_ALLOWED_IP_MASK, IPM_GETADDRESS, 0, (LPARAM)&dwCur);
- SendDlgItemMessage(hDlg, IDC_ALLOWED_IP_MASK, IPM_SETADDRESS, 0, (LPARAM)dwCur == 0xFFFFFFFF ? 0 : 0xFFFFFFFF);
- return TRUE;
- }
+ {
+ DWORD dwCur;
+ SendDlgItemMessage(hDlg, IDC_ALLOWED_IP_MASK, IPM_GETADDRESS, 0, (LPARAM)&dwCur);
+ SendDlgItemMessage(hDlg, IDC_ALLOWED_IP_MASK, IPM_SETADDRESS, 0, (LPARAM)dwCur == 0xFFFFFFFF ? 0 : 0xFFFFFFFF);
+ return TRUE;
+ }
}
}
return false;
@@ -461,7 +461,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) | OFN_ENABLEHOOK | OFN_ENABLETEMPLATE | OFN_EXPLORER | OFN_ENABLESIZING
| OFN_ALLOWMULTISELECT;
ofn.hwndOwner = hwndOwner;
- ofn.hInstance = hInstance;
+ ofn.hInstance = g_plugin.getInst();
ofn.lpstrTitle = Translate("Specify a file to share");
ofn.lpTemplateName = MAKEINTRESOURCE(IDD_NEW_SHARE_PROPERTIES);
ofn.lpfnHook = ShareNewFileDialogHook;
@@ -699,70 +699,70 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara {
switch (msg) {
case WM_INITDIALOG:
- {
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG,
- (LPARAM)LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)));
-
- TranslateDialogDefault(hwndDlg);
+ {
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG,
+ (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)));
- HWND hShareList = GetDlgItem(hwndDlg, IDC_CURRENT_SHARES);
- HWND hUserList = GetDlgItem(hwndDlg, IDC_CURRENT_USERS);
+ TranslateDialogDefault(hwndDlg);
- { // init adv. win styles
- DWORD dw = ListView_GetExtendedListViewStyle(hShareList);
- dw |= LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT;
- ListView_SetExtendedListViewStyle(hShareList, dw /*| LVS_EX_LABELTIP*/);
- }
- { // init adv. win styles
- DWORD dw = ListView_GetExtendedListViewStyle(hUserList);
- dw |= LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT;
- ListView_SetExtendedListViewStyle(hUserList, dw /*| LVS_EX_LABELTIP*/);
- }
+ HWND hShareList = GetDlgItem(hwndDlg, IDC_CURRENT_SHARES);
+ HWND hUserList = GetDlgItem(hwndDlg, IDC_CURRENT_USERS);
- LVCOLUMN cCol = { 0 };
- cCol.mask = LVCF_TEXT | LVCF_WIDTH;
- cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx1", 126);
- cCol.pszText = Translate("Share name");
- ListView_InsertColumn(hShareList, 0, &cCol);
- cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx2", 48);
- cCol.pszText = Translate("Max Downloads");
- ListView_InsertColumn(hShareList, 1, &cCol);
- cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx3", 96);
- cCol.pszText = Translate("Allowed IP");
- ListView_InsertColumn(hShareList, 2, &cCol);
- cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx4", 104);
- cCol.pszText = Translate("Allowed Mask");
- ListView_InsertColumn(hShareList, 3, &cCol);
- cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx5", 252);
- cCol.pszText = Translate("Real path");
- ListView_InsertColumn(hShareList, 4, &cCol);
-
- cCol.mask = LVCF_TEXT | LVCF_WIDTH;
- cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx6", 142);
- cCol.pszText = Translate("Share name");
- ListView_InsertColumn(hUserList, 0, &cCol);
- cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx7", 111);
- cCol.pszText = Translate("User");
- ListView_InsertColumn(hUserList, 1, &cCol);
- cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx8", 100);
- cCol.pszText = Translate("Agent");
- ListView_InsertColumn(hUserList, 2, &cCol);
- cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx9", 100);
- cCol.pszText = Translate("Completed");
- ListView_InsertColumn(hUserList, 3, &cCol);
- cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx10", 100);
- cCol.pszText = Translate("Speed");
- ListView_InsertColumn(hUserList, 4, &cCol);
-
- bool b = db_get_b(NULL, MODULE, "StatWnd_ShowHidden", 0) != 0;
- CheckDlgButton(hwndDlg, IDC_SHOWHIDDENSHARES, b ? BST_CHECKED : BST_UNCHECKED);
-
- bLastAutoRefress = false;
- UpdateStatisticView(hwndDlg);
- Utils_RestoreWindowPosition(hwndDlg, 0, MODULE, "StatWnd_");
- SetWindowsCtrls(hwndDlg);
+ { // init adv. win styles
+ DWORD dw = ListView_GetExtendedListViewStyle(hShareList);
+ dw |= LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT;
+ ListView_SetExtendedListViewStyle(hShareList, dw /*| LVS_EX_LABELTIP*/);
+ }
+ { // init adv. win styles
+ DWORD dw = ListView_GetExtendedListViewStyle(hUserList);
+ dw |= LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT;
+ ListView_SetExtendedListViewStyle(hUserList, dw /*| LVS_EX_LABELTIP*/);
}
- return TRUE;
+
+ LVCOLUMN cCol = { 0 };
+ cCol.mask = LVCF_TEXT | LVCF_WIDTH;
+ cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx1", 126);
+ cCol.pszText = Translate("Share name");
+ ListView_InsertColumn(hShareList, 0, &cCol);
+ cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx2", 48);
+ cCol.pszText = Translate("Max Downloads");
+ ListView_InsertColumn(hShareList, 1, &cCol);
+ cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx3", 96);
+ cCol.pszText = Translate("Allowed IP");
+ ListView_InsertColumn(hShareList, 2, &cCol);
+ cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx4", 104);
+ cCol.pszText = Translate("Allowed Mask");
+ ListView_InsertColumn(hShareList, 3, &cCol);
+ cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx5", 252);
+ cCol.pszText = Translate("Real path");
+ ListView_InsertColumn(hShareList, 4, &cCol);
+
+ cCol.mask = LVCF_TEXT | LVCF_WIDTH;
+ cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx6", 142);
+ cCol.pszText = Translate("Share name");
+ ListView_InsertColumn(hUserList, 0, &cCol);
+ cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx7", 111);
+ cCol.pszText = Translate("User");
+ ListView_InsertColumn(hUserList, 1, &cCol);
+ cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx8", 100);
+ cCol.pszText = Translate("Agent");
+ ListView_InsertColumn(hUserList, 2, &cCol);
+ cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx9", 100);
+ cCol.pszText = Translate("Completed");
+ ListView_InsertColumn(hUserList, 3, &cCol);
+ cCol.cx = db_get_w(NULL, MODULE, "StatWnd_cx10", 100);
+ cCol.pszText = Translate("Speed");
+ ListView_InsertColumn(hUserList, 4, &cCol);
+
+ bool b = db_get_b(NULL, MODULE, "StatWnd_ShowHidden", 0) != 0;
+ CheckDlgButton(hwndDlg, IDC_SHOWHIDDENSHARES, b ? BST_CHECKED : BST_UNCHECKED);
+
+ bLastAutoRefress = false;
+ UpdateStatisticView(hwndDlg);
+ Utils_RestoreWindowPosition(hwndDlg, 0, MODULE, "StatWnd_");
+ SetWindowsCtrls(hwndDlg);
+ }
+ return TRUE;
case WM_SIZE:
case WM_SIZING:
@@ -782,178 +782,178 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara return 0;
case WM_DROPFILES:
- {
- HDROP hDrop = (HDROP)wParam;
- char szDropedFile[MAX_PATH];
- char szServPath[MAX_PATH] = { 0 };
-
- int nLen = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0);
- for (int i = 0; i < nLen; i++) {
- DragQueryFile(hDrop, i, szDropedFile, sizeof(szDropedFile));
-
- STFileShareInfo stNewShare = { 0 };
- stNewShare.lStructSize = sizeof(STFileShareInfo);
- stNewShare.nMaxDownloads = nDefaultDownloadLimit;
- stNewShare.pszRealPath = szDropedFile;
- stNewShare.dwMaxRealPath = sizeof(szDropedFile);
- stNewShare.pszSrvPath = szServPath;
- stNewShare.dwMaxSrvPath = sizeof(szServPath);
-
- szServPath[0] = '/';
- char* fileName = strrchr(szDropedFile, '\\');
- if (fileName)
- strncpy(&szServPath[1], fileName + 1, MAX_PATH - 2);
-
- if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)&stNewShare)) {
- MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
- return false;
- }
+ {
+ HDROP hDrop = (HDROP)wParam;
+ char szDropedFile[MAX_PATH];
+ char szServPath[MAX_PATH] = { 0 };
+
+ int nLen = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0);
+ for (int i = 0; i < nLen; i++) {
+ DragQueryFile(hDrop, i, szDropedFile, sizeof(szDropedFile));
+
+ STFileShareInfo stNewShare = { 0 };
+ stNewShare.lStructSize = sizeof(STFileShareInfo);
+ stNewShare.nMaxDownloads = nDefaultDownloadLimit;
+ stNewShare.pszRealPath = szDropedFile;
+ stNewShare.dwMaxRealPath = sizeof(szDropedFile);
+ stNewShare.pszSrvPath = szServPath;
+ stNewShare.dwMaxSrvPath = sizeof(szServPath);
+
+ szServPath[0] = '/';
+ char* fileName = strrchr(szDropedFile, '\\');
+ if (fileName)
+ strncpy(&szServPath[1], fileName + 1, MAX_PATH - 2);
+
+ if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)&stNewShare)) {
+ MessageBox(nullptr, Translate("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
+ return false;
}
-
- UpdateStatisticsView();
- DragFinish(hDrop);
- return 0;
}
+ UpdateStatisticsView();
+ DragFinish(hDrop);
+ return 0;
+ }
+
case WM_CONTEXTMENU:
- {
- if (wParam != (WPARAM)GetDlgItem(hwndDlg, IDC_CURRENT_SHARES))
- return FALSE;
-
- HWND hShareList = GetDlgItem(hwndDlg, IDC_CURRENT_SHARES);
- if (ListView_GetNextItem(hShareList, -1, LVIS_SELECTED) == -1)
- return FALSE;
-
- HMENU hMainMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1));
- if (hMainMenu) {
- HMENU hMenu = GetSubMenu(hMainMenu, 0);
-
- POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
- if (pt.x == -1 && pt.y == -1) {
- HWND hMapUser = GetDlgItem(hwndDlg, IDC_CURRENT_SHARES);
- int nFirst = ListView_GetNextItem(hMapUser, -1, LVNI_FOCUSED);
- if (nFirst >= 0) {
- ListView_GetItemPosition(hMapUser, nFirst, &pt);
- }
+ {
+ if (wParam != (WPARAM)GetDlgItem(hwndDlg, IDC_CURRENT_SHARES))
+ return FALSE;
- if (pt.y < 16)
- pt.y = 16;
- else {
- RECT rUserList;
- GetClientRect(hMapUser, &rUserList);
- if (pt.y > rUserList.bottom - 16)
- pt.y = rUserList.bottom - 16;
- else
- pt.y += 8;
- }
- pt.x = 8;
- ClientToScreen(hMapUser, &pt);
+ HWND hShareList = GetDlgItem(hwndDlg, IDC_CURRENT_SHARES);
+ if (ListView_GetNextItem(hShareList, -1, LVIS_SELECTED) == -1)
+ return FALSE;
+
+ HMENU hMainMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU1));
+ if (hMainMenu) {
+ HMENU hMenu = GetSubMenu(hMainMenu, 0);
+
+ POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
+ if (pt.x == -1 && pt.y == -1) {
+ HWND hMapUser = GetDlgItem(hwndDlg, IDC_CURRENT_SHARES);
+ int nFirst = ListView_GetNextItem(hMapUser, -1, LVNI_FOCUSED);
+ if (nFirst >= 0) {
+ ListView_GetItemPosition(hMapUser, nFirst, &pt);
}
- TranslateMenu(hMenu);
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON,
- pt.x, pt.y, 0, hwndDlg, nullptr);
-
- DestroyMenu(hMainMenu);
+ if (pt.y < 16)
+ pt.y = 16;
+ else {
+ RECT rUserList;
+ GetClientRect(hMapUser, &rUserList);
+ if (pt.y > rUserList.bottom - 16)
+ pt.y = rUserList.bottom - 16;
+ else
+ pt.y += 8;
+ }
+ pt.x = 8;
+ ClientToScreen(hMapUser, &pt);
}
- return TRUE;
+
+ TranslateMenu(hMenu);
+ TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON,
+ pt.x, pt.y, 0, hwndDlg, nullptr);
+
+ DestroyMenu(hMainMenu);
}
+ return TRUE;
+ }
case WM_COMMAND:
+ {
+ HWND hShareList = GetDlgItem(hwndDlg, IDC_CURRENT_SHARES);
+ char szTmp[MAX_PATH];
+ LVITEM sItem = { 0 };
+ sItem.mask = LVIF_TEXT;
+ sItem.pszText = szTmp;
+ sItem.cchTextMax = _countof(szTmp);
+
+ switch (LOWORD(wParam)) {
+ case IDC_SHOWHIDDENSHARES:
{
- HWND hShareList = GetDlgItem(hwndDlg, IDC_CURRENT_SHARES);
- char szTmp[MAX_PATH];
- LVITEM sItem = { 0 };
- sItem.mask = LVIF_TEXT;
- sItem.pszText = szTmp;
- sItem.cchTextMax = _countof(szTmp);
+ UpdateStatisticView(hwndDlg);
+ return TRUE;
+ }
- switch (LOWORD(wParam)) {
- case IDC_SHOWHIDDENSHARES:
- {
- UpdateStatisticView(hwndDlg);
- return TRUE;
- }
+ case ID_SHARELIST_NEWSHARE:
+ {
+ CallService(MS_SHARE_NEW_FILE, 0, (LPARAM)hwndDlg);
+ return TRUE;
+ }
- case ID_SHARELIST_NEWSHARE:
- {
- CallService(MS_SHARE_NEW_FILE, 0, (LPARAM)hwndDlg);
- return TRUE;
+ case ID_SHARELIST_EDITSHARE:
+ case ID_SHARELIST_REMOVESHARE:
+ {
+ STFileShareInfo stShareInfo = { 0 };
+ stShareInfo.lStructSize = sizeof(STFileShareInfo);
+ stShareInfo.pszSrvPath = szTmp;
+ stShareInfo.dwMaxSrvPath = sizeof(szTmp);
+
+ sItem.iItem = ListView_GetNextItem(hShareList, -1, LVIS_SELECTED);
+ while (sItem.iItem != -1) {
+ if (ListView_GetItem(hShareList, &sItem)) {
+ if (LOWORD(wParam) == ID_SHARELIST_REMOVESHARE)
+ CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)&stShareInfo);
+ else {
+ char szRealPath[MAX_PATH];
+ stShareInfo.pszRealPath = szRealPath;
+ stShareInfo.dwMaxRealPath = sizeof(szRealPath);
+ CallService(MS_HTTP_GET_SHARE, 0, (LPARAM)&stShareInfo);
+ bShowShareNewFileDlg(hwndDlg, &stShareInfo);
+ }
}
+ sItem.iItem = ListView_GetNextItem(hShareList, sItem.iItem, LVIS_SELECTED);
+ }
+ UpdateStatisticView(hwndDlg);
+ return TRUE;
+ }
- case ID_SHARELIST_EDITSHARE:
- case ID_SHARELIST_REMOVESHARE:
- {
- STFileShareInfo stShareInfo = { 0 };
- stShareInfo.lStructSize = sizeof(STFileShareInfo);
- stShareInfo.pszSrvPath = szTmp;
- stShareInfo.dwMaxSrvPath = sizeof(szTmp);
-
- sItem.iItem = ListView_GetNextItem(hShareList, -1, LVIS_SELECTED);
- while (sItem.iItem != -1) {
- if (ListView_GetItem(hShareList, &sItem)) {
- if (LOWORD(wParam) == ID_SHARELIST_REMOVESHARE)
- CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)&stShareInfo);
- else {
- char szRealPath[MAX_PATH];
- stShareInfo.pszRealPath = szRealPath;
- stShareInfo.dwMaxRealPath = sizeof(szRealPath);
- CallService(MS_HTTP_GET_SHARE, 0, (LPARAM)&stShareInfo);
- bShowShareNewFileDlg(hwndDlg, &stShareInfo);
- }
- }
- sItem.iItem = ListView_GetNextItem(hShareList, sItem.iItem, LVIS_SELECTED);
+ case ID_SHARELIST_OPEN:
+ case ID_SHARELIST_COPYLINK:
+ sItem.iItem = ListView_GetNextItem(hShareList, -1, LVIS_SELECTED);
+ if (sItem.iItem != -1) {
+ if (ListView_GetItem(hShareList, &sItem)) {
+ string sLink = sCreateLink(sItem.pszText);
+ if (sLink.size() <= 0) {
+ MessageBox(hwndDlg, Translate("Selected link size is 0"), MSG_BOX_TITEL, MB_OK);
+ return TRUE;
}
- UpdateStatisticView(hwndDlg);
- return TRUE;
- }
- case ID_SHARELIST_OPEN:
- case ID_SHARELIST_COPYLINK:
- sItem.iItem = ListView_GetNextItem(hShareList, -1, LVIS_SELECTED);
- if (sItem.iItem != -1) {
- if (ListView_GetItem(hShareList, &sItem)) {
- string sLink = sCreateLink(sItem.pszText);
- if (sLink.size() <= 0) {
- MessageBox(hwndDlg, Translate("Selected link size is 0"), MSG_BOX_TITEL, MB_OK);
+ if (LOWORD(wParam) == ID_SHARELIST_COPYLINK) {
+ if (!OpenClipboard(hwndDlg)) {
+ MessageBox(hwndDlg, Translate("Failed to get access to clipboard"), MSG_BOX_TITEL, MB_OK);
return TRUE;
}
- if (LOWORD(wParam) == ID_SHARELIST_COPYLINK) {
- if (!OpenClipboard(hwndDlg)) {
- MessageBox(hwndDlg, Translate("Failed to get access to clipboard"), MSG_BOX_TITEL, MB_OK);
- return TRUE;
- }
-
- if (!EmptyClipboard()) {
- MessageBox(hwndDlg, Translate("Failed to get close the clipboard"), MSG_BOX_TITEL, MB_OK);
- return TRUE;
- }
+ if (!EmptyClipboard()) {
+ MessageBox(hwndDlg, Translate("Failed to get close the clipboard"), MSG_BOX_TITEL, MB_OK);
+ return TRUE;
+ }
- HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, sLink.size() + 1);
- // Lock the handle and copy the text to the buffer.
- char * lptstrCopy = (char *)GlobalLock(hglbCopy);
- mir_strcpy(lptstrCopy, sLink.c_str());
- GlobalUnlock(hglbCopy);
+ HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, sLink.size() + 1);
+ // Lock the handle and copy the text to the buffer.
+ char * lptstrCopy = (char *)GlobalLock(hglbCopy);
+ mir_strcpy(lptstrCopy, sLink.c_str());
+ GlobalUnlock(hglbCopy);
- // Place the handle on the clipboard.
+ // Place the handle on the clipboard.
- HANDLE hMyData = SetClipboardData(CF_TEXT, hglbCopy);
- if (!hMyData)
- MessageBox(hwndDlg, Translate("Failed to set clipboard data"), MSG_BOX_TITEL, MB_OK);
+ HANDLE hMyData = SetClipboardData(CF_TEXT, hglbCopy);
+ if (!hMyData)
+ MessageBox(hwndDlg, Translate("Failed to set clipboard data"), MSG_BOX_TITEL, MB_OK);
- CloseClipboard();
- }
- else Utils_OpenUrl(sLink.c_str());
+ CloseClipboard();
}
- else MessageBox(hwndDlg, Translate("ListView_GetItem failed"), MSG_BOX_TITEL, MB_OK);
+ else Utils_OpenUrl(sLink.c_str());
}
- else MessageBox(hwndDlg, Translate("No share selected"), MSG_BOX_TITEL, MB_OK);
-
- return TRUE;
+ else MessageBox(hwndDlg, Translate("ListView_GetItem failed"), MSG_BOX_TITEL, MB_OK);
}
- break;
+ else MessageBox(hwndDlg, Translate("No share selected"), MSG_BOX_TITEL, MB_OK);
+
+ return TRUE;
}
+ break;
+ }
case WM_CLOSE:
HWND hShareList = GetDlgItem(hwndDlg, IDC_CURRENT_SHARES);
@@ -1077,7 +1077,7 @@ static INT_PTR nShowStatisticsView(WPARAM /*wParam*/, LPARAM /*lParam*/) BringWindowToTop(hwndStatsticView);
return 0;
}
- hwndStatsticView = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_STATISTICS_VIEW), nullptr, DlgProcStatsticView, (LPARAM)NULL);
+ hwndStatsticView = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_STATISTICS_VIEW), nullptr, DlgProcStatsticView, (LPARAM)NULL);
ShowWindow(hwndStatsticView, SW_SHOWNORMAL);
return 0;
}
@@ -1102,72 +1102,72 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
switch (msg) {
case WM_INITDIALOG:
- {
- string sDefExt = DBGetString(NULL, MODULE, "ExternalSrvName", szDefaultExternalSrvName);
- SetDlgItemText(hwndDlg, IDC_EXTERNAL_SRV_NAME, sDefExt.c_str());
+ {
+ string sDefExt = DBGetString(NULL, MODULE, "ExternalSrvName", szDefaultExternalSrvName);
+ SetDlgItemText(hwndDlg, IDC_EXTERNAL_SRV_NAME, sDefExt.c_str());
- bool b = db_get_b(NULL, MODULE, "AddStatisticsMenuItem", 1) != 0;
- CheckDlgButton(hwndDlg, IDC_ADD_STATISTICS_MENU_ITEM, b ? BST_CHECKED : BST_UNCHECKED);
+ bool b = db_get_b(NULL, MODULE, "AddStatisticsMenuItem", 1) != 0;
+ CheckDlgButton(hwndDlg, IDC_ADD_STATISTICS_MENU_ITEM, b ? BST_CHECKED : BST_UNCHECKED);
- b = db_get_b(NULL, MODULE, "AddAcceptConMenuItem", 1) != 0;
- CheckDlgButton(hwndDlg, IDC_ACCEPT_COM_MENU_ITEM, b ? BST_CHECKED : BST_UNCHECKED);
+ b = db_get_b(NULL, MODULE, "AddAcceptConMenuItem", 1) != 0;
+ CheckDlgButton(hwndDlg, IDC_ACCEPT_COM_MENU_ITEM, b ? BST_CHECKED : BST_UNCHECKED);
- b = db_get_b(NULL, MODULE, "WriteLogFile", 0) != 0;
- CheckDlgButton(hwndDlg, IDC_WRITE_LOG_FILE, b ? BST_CHECKED : BST_UNCHECKED);
+ b = db_get_b(NULL, MODULE, "WriteLogFile", 0) != 0;
+ CheckDlgButton(hwndDlg, IDC_WRITE_LOG_FILE, b ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOW_POPUPS, bShowPopups ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LIMIT_ONLY_WHEN_ONLINE, bLimitOnlyWhenOnline ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOW_POPUPS, bShowPopups ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LIMIT_ONLY_WHEN_ONLINE, bLimitOnlyWhenOnline ? BST_CHECKED : BST_UNCHECKED);
- {// Url Address
- SetDlgItemText(hwndDlg, IDC_URL_ADDRESS, sUrlAddress.c_str());
- HWND hComboBox = GetDlgItem(hwndDlg, IDC_URL_ADDRESS);
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://checkip.dyndns.org");
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://checkip.dyndns.org:8245/");
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://dynamic.zoneedit.com/checkip.html");
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://ipdetect.dnspark.com/");
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://update.dynu.com/basic/ipcheck.asp");
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://www.dnsart.com/myip.php");
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://www.dnsart.com:7777/myip.php");
- }
+ {// Url Address
+ SetDlgItemText(hwndDlg, IDC_URL_ADDRESS, sUrlAddress.c_str());
+ HWND hComboBox = GetDlgItem(hwndDlg, IDC_URL_ADDRESS);
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://checkip.dyndns.org");
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://checkip.dyndns.org:8245/");
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://dynamic.zoneedit.com/checkip.html");
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://ipdetect.dnspark.com/");
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://update.dynu.com/basic/ipcheck.asp");
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://www.dnsart.com/myip.php");
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"http://www.dnsart.com:7777/myip.php");
+ }
- {// Page keyword
- SetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, sPageKeyword.c_str());
- HWND hComboBox = GetDlgItem(hwndDlg, IDC_PAGE_KEYWORD);
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"");
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)LPGEN("Current IP Address: "));
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)LPGEN("Current Address: "));
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)LPGEN("IP Address: "));
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)LPGEN("You are browsing from"));
- SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"<HTML><BODY>");
- }
+ {// Page keyword
+ SetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, sPageKeyword.c_str());
+ HWND hComboBox = GetDlgItem(hwndDlg, IDC_PAGE_KEYWORD);
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"");
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)LPGEN("Current IP Address: "));
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)LPGEN("Current Address: "));
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)LPGEN("IP Address: "));
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)LPGEN("You are browsing from"));
+ SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM)"<HTML><BODY>");
+ }
- SetDlgItemInt(hwndDlg, IDC_MAX_SPEED, nMaxUploadSpeed >> 10, true);
- SetDlgItemInt(hwndDlg, IDC_MAX_CONN_TOTAL, nMaxConnectionsTotal, true);
- SetDlgItemInt(hwndDlg, IDC_MAX_CONN_PER_USER, nMaxConnectionsPerUser, true);
- SetDlgItemInt(hwndDlg, IDC_DEFAULT_DOWNLOAD_LIMIT, nDefaultDownloadLimit, true);
-
- indexCreationMode =
- (eIndexCreationMode)db_get_b(NULL, MODULE, "IndexCreationMode", 3);
-
- switch (indexCreationMode) {
- case INDEX_CREATION_HTML:
- CheckRadioButton(hwndDlg, IDC_INDEX_OFF, IDC_INDEX_DETECT, IDC_INDEX_HTML);
- break;
- case INDEX_CREATION_XML:
- CheckRadioButton(hwndDlg, IDC_INDEX_OFF, IDC_INDEX_DETECT, IDC_INDEX_XML);
- break;
- case INDEX_CREATION_DETECT:
- CheckRadioButton(hwndDlg, IDC_INDEX_OFF, IDC_INDEX_DETECT, IDC_INDEX_DETECT);
- break;
- default: // INDEX_CREATION_DISABLE
- CheckRadioButton(hwndDlg, IDC_INDEX_OFF, IDC_INDEX_DETECT, IDC_INDEX_OFF);
- break;
- }
+ SetDlgItemInt(hwndDlg, IDC_MAX_SPEED, nMaxUploadSpeed >> 10, true);
+ SetDlgItemInt(hwndDlg, IDC_MAX_CONN_TOTAL, nMaxConnectionsTotal, true);
+ SetDlgItemInt(hwndDlg, IDC_MAX_CONN_PER_USER, nMaxConnectionsPerUser, true);
+ SetDlgItemInt(hwndDlg, IDC_DEFAULT_DOWNLOAD_LIMIT, nDefaultDownloadLimit, true);
- TranslateDialogDefault(hwndDlg);
+ indexCreationMode =
+ (eIndexCreationMode)db_get_b(NULL, MODULE, "IndexCreationMode", 3);
+
+ switch (indexCreationMode) {
+ case INDEX_CREATION_HTML:
+ CheckRadioButton(hwndDlg, IDC_INDEX_OFF, IDC_INDEX_DETECT, IDC_INDEX_HTML);
+ break;
+ case INDEX_CREATION_XML:
+ CheckRadioButton(hwndDlg, IDC_INDEX_OFF, IDC_INDEX_DETECT, IDC_INDEX_XML);
+ break;
+ case INDEX_CREATION_DETECT:
+ CheckRadioButton(hwndDlg, IDC_INDEX_OFF, IDC_INDEX_DETECT, IDC_INDEX_DETECT);
+ break;
+ default: // INDEX_CREATION_DISABLE
+ CheckRadioButton(hwndDlg, IDC_INDEX_OFF, IDC_INDEX_DETECT, IDC_INDEX_OFF);
+ break;
}
- return TRUE;
+
+ TranslateDialogDefault(hwndDlg);
+ }
+ return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
@@ -1229,94 +1229,94 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP NMHDR * p = ((LPNMHDR)lParam);
switch (p->code) {
case PSN_APPLY:
- {
- char szTemp[500];
- if (GetDlgItemText(hwndDlg, IDC_EXTERNAL_SRV_NAME, szTemp, _countof(szTemp)))
- db_set_s(NULL, MODULE, "ExternalSrvName", szTemp);
-
- bool b = db_get_b(NULL, MODULE, "AddStatisticsMenuItem", 1) != 0;
- bool bNew = IsDlgButtonChecked(hwndDlg, IDC_ADD_STATISTICS_MENU_ITEM) == BST_CHECKED;
- if (b != bNew) {
- db_set_b(NULL, MODULE, "AddStatisticsMenuItem", bNew);
- MessageBox(hwndDlg, Translate("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
- }
+ {
+ char szTemp[500];
+ if (GetDlgItemText(hwndDlg, IDC_EXTERNAL_SRV_NAME, szTemp, _countof(szTemp)))
+ db_set_s(NULL, MODULE, "ExternalSrvName", szTemp);
- b = db_get_b(NULL, MODULE, "AddAcceptConMenuItem", 1) != 0;
- bNew = IsDlgButtonChecked(hwndDlg, IDC_ACCEPT_COM_MENU_ITEM) == BST_CHECKED;
- if (b != bNew) {
- db_set_b(NULL, MODULE, "AddAcceptConMenuItem", bNew);
- MessageBox(hwndDlg, Translate("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
- }
+ bool b = db_get_b(NULL, MODULE, "AddStatisticsMenuItem", 1) != 0;
+ bool bNew = IsDlgButtonChecked(hwndDlg, IDC_ADD_STATISTICS_MENU_ITEM) == BST_CHECKED;
+ if (b != bNew) {
+ db_set_b(NULL, MODULE, "AddStatisticsMenuItem", bNew);
+ MessageBox(hwndDlg, Translate("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
+ }
- bNew = IsDlgButtonChecked(hwndDlg, IDC_WRITE_LOG_FILE) == BST_CHECKED;
- db_set_b(NULL, MODULE, "WriteLogFile", bNew);
+ b = db_get_b(NULL, MODULE, "AddAcceptConMenuItem", 1) != 0;
+ bNew = IsDlgButtonChecked(hwndDlg, IDC_ACCEPT_COM_MENU_ITEM) == BST_CHECKED;
+ if (b != bNew) {
+ db_set_b(NULL, MODULE, "AddAcceptConMenuItem", bNew);
+ MessageBox(hwndDlg, Translate("You need to restart Miranda to change the main menu"), MSG_BOX_TITEL, MB_OK);
+ }
- bShowPopups = IsDlgButtonChecked(hwndDlg, IDC_SHOW_POPUPS) == BST_CHECKED;
- db_set_b(NULL, MODULE, "ShowPopups", bShowPopups);
+ bNew = IsDlgButtonChecked(hwndDlg, IDC_WRITE_LOG_FILE) == BST_CHECKED;
+ db_set_b(NULL, MODULE, "WriteLogFile", bNew);
- GetDlgItemText(hwndDlg, IDC_URL_ADDRESS, szTemp, _countof(szTemp));
- sUrlAddress = szTemp;
- db_set_s(NULL, MODULE, "UrlAddress", sUrlAddress.c_str());
+ bShowPopups = IsDlgButtonChecked(hwndDlg, IDC_SHOW_POPUPS) == BST_CHECKED;
+ db_set_b(NULL, MODULE, "ShowPopups", bShowPopups);
- GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szTemp, _countof(szTemp));
- sPageKeyword = szTemp;
- db_set_s(NULL, MODULE, "PageKeyword", sPageKeyword.c_str());
- dwExternalIpAddress = 0;
+ GetDlgItemText(hwndDlg, IDC_URL_ADDRESS, szTemp, _countof(szTemp));
+ sUrlAddress = szTemp;
+ db_set_s(NULL, MODULE, "UrlAddress", sUrlAddress.c_str());
- BOOL bTranslated = false;
- int nTemp = GetDlgItemInt(hwndDlg, IDC_MAX_SPEED, &bTranslated, true);
- if (bTranslated) {
- nMaxUploadSpeed = nTemp << 10;
- db_set_dw(NULL, MODULE, "MaxUploadSpeed", nMaxUploadSpeed);
- }
+ GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szTemp, _countof(szTemp));
+ sPageKeyword = szTemp;
+ db_set_s(NULL, MODULE, "PageKeyword", sPageKeyword.c_str());
+ dwExternalIpAddress = 0;
- nTemp = GetDlgItemInt(hwndDlg, IDC_MAX_CONN_TOTAL, &bTranslated, true);
- if (bTranslated) {
- nMaxConnectionsTotal = nTemp;
- db_set_dw(NULL, MODULE, "MaxConnectionsTotal", nMaxConnectionsTotal);
- }
+ BOOL bTranslated = false;
+ int nTemp = GetDlgItemInt(hwndDlg, IDC_MAX_SPEED, &bTranslated, true);
+ if (bTranslated) {
+ nMaxUploadSpeed = nTemp << 10;
+ db_set_dw(NULL, MODULE, "MaxUploadSpeed", nMaxUploadSpeed);
+ }
- nTemp = GetDlgItemInt(hwndDlg, IDC_MAX_CONN_PER_USER, &bTranslated, true);
- if (bTranslated) {
- nMaxConnectionsPerUser = nTemp;
- db_set_dw(NULL, MODULE, "MaxConnectionsPerUser", nMaxConnectionsPerUser);
- }
+ nTemp = GetDlgItemInt(hwndDlg, IDC_MAX_CONN_TOTAL, &bTranslated, true);
+ if (bTranslated) {
+ nMaxConnectionsTotal = nTemp;
+ db_set_dw(NULL, MODULE, "MaxConnectionsTotal", nMaxConnectionsTotal);
+ }
- nTemp = GetDlgItemInt(hwndDlg, IDC_DEFAULT_DOWNLOAD_LIMIT, &bTranslated, true);
- if (bTranslated) {
- nDefaultDownloadLimit = nTemp;
- db_set_dw(NULL, MODULE, "DefaultDownloadLimit", nDefaultDownloadLimit);
- }
+ nTemp = GetDlgItemInt(hwndDlg, IDC_MAX_CONN_PER_USER, &bTranslated, true);
+ if (bTranslated) {
+ nMaxConnectionsPerUser = nTemp;
+ db_set_dw(NULL, MODULE, "MaxConnectionsPerUser", nMaxConnectionsPerUser);
+ }
- bLimitOnlyWhenOnline = IsDlgButtonChecked(hwndDlg, IDC_LIMIT_ONLY_WHEN_ONLINE) == BST_CHECKED;
- db_set_b(NULL, MODULE, "LimitOnlyWhenOnline", bLimitOnlyWhenOnline);
+ nTemp = GetDlgItemInt(hwndDlg, IDC_DEFAULT_DOWNLOAD_LIMIT, &bTranslated, true);
+ if (bTranslated) {
+ nDefaultDownloadLimit = nTemp;
+ db_set_dw(NULL, MODULE, "DefaultDownloadLimit", nDefaultDownloadLimit);
+ }
- if (IsDlgButtonChecked(hwndDlg, IDC_INDEX_HTML) == BST_CHECKED ||
- IsDlgButtonChecked(hwndDlg, IDC_INDEX_DETECT) == BST_CHECKED) {
- if (IsDlgButtonChecked(hwndDlg, IDC_INDEX_HTML) == BST_CHECKED)
- indexCreationMode = INDEX_CREATION_HTML;
- else
- indexCreationMode = INDEX_CREATION_DETECT;
+ bLimitOnlyWhenOnline = IsDlgButtonChecked(hwndDlg, IDC_LIMIT_ONLY_WHEN_ONLINE) == BST_CHECKED;
+ db_set_b(NULL, MODULE, "LimitOnlyWhenOnline", bLimitOnlyWhenOnline);
- if (!LoadIndexHTMLTemplate()) {
- CheckRadioButton(hwndDlg, IDC_INDEX_OFF, IDC_INDEX_XML, IDC_INDEX_OFF);
- indexCreationMode = INDEX_CREATION_DISABLE;
- }
- }
- else if (IsDlgButtonChecked(hwndDlg, IDC_INDEX_XML) == BST_CHECKED) {
- FreeIndexHTMLTemplate();
- indexCreationMode = INDEX_CREATION_XML;
- }
- else {
- FreeIndexHTMLTemplate();
+ if (IsDlgButtonChecked(hwndDlg, IDC_INDEX_HTML) == BST_CHECKED ||
+ IsDlgButtonChecked(hwndDlg, IDC_INDEX_DETECT) == BST_CHECKED) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_INDEX_HTML) == BST_CHECKED)
+ indexCreationMode = INDEX_CREATION_HTML;
+ else
+ indexCreationMode = INDEX_CREATION_DETECT;
+
+ if (!LoadIndexHTMLTemplate()) {
+ CheckRadioButton(hwndDlg, IDC_INDEX_OFF, IDC_INDEX_XML, IDC_INDEX_OFF);
indexCreationMode = INDEX_CREATION_DISABLE;
}
+ }
+ else if (IsDlgButtonChecked(hwndDlg, IDC_INDEX_XML) == BST_CHECKED) {
+ FreeIndexHTMLTemplate();
+ indexCreationMode = INDEX_CREATION_XML;
+ }
+ else {
+ FreeIndexHTMLTemplate();
+ indexCreationMode = INDEX_CREATION_DISABLE;
+ }
- db_set_b(NULL, MODULE, "IndexCreationMode", (BYTE)indexCreationMode);
+ db_set_b(NULL, MODULE, "IndexCreationMode", (BYTE)indexCreationMode);
- return TRUE;
- }
- break;
+ return TRUE;
+ }
+ break;
}
}
return FALSE;
@@ -1340,7 +1340,7 @@ int OptionsInitialize(WPARAM wParam, LPARAM /*lParam*/) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 900000000;
- odp.hInstance = hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_HTTP_SERVER);
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
odp.szTitle.w = LPGENW("HTTP Server");
@@ -1432,7 +1432,7 @@ void ShowPopupWindow(const char * pszName, const char * pszText, COLORREF ColorB POPUPDATAT *pclData = new POPUPDATAT;
memset(pclData, 0, sizeof(POPUPDATAT));
- pclData->lchIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE));
+ pclData->lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SHARE_NEW_FILE));
strncpy(pclData->lpzContactName, pszName, sizeof(pclData->lpzContactName) - 1); // -1 so that there aways will be a null termination !!
strncpy(pclData->lpzText, pszText, sizeof(pclData->lpzText) - 1);
pclData->colorBack = ColorBack;
@@ -1476,7 +1476,7 @@ void InitGuiElements() CMenuItem mi;
mi.flags = CMIF_UNICODE;
SET_UID(mi, 0xb30a6ab5, 0x17a8, 0x4e2e, 0x84, 0x52, 0x5f, 0xbc, 0x83, 0x35, 0xf2, 0x6);
- mi.hIcolibItem = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SHARE_NEW_FILE));
mi.position = -2000019955;
mi.name.w = LPGENW("HTTP Share new file");
mi.pszService = MS_SHARE_NEW_FILE;
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index 5409b6f430..d66eb04dc9 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -48,7 +48,6 @@ int PreShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/); HNETLIBUSER hNetlibUser;
HANDLE hDirectBoundPort;
-HINSTANCE hInstance = nullptr;
CLIST_INTERFACE *pcli;
string sLogFilePath;
@@ -83,6 +82,7 @@ bool bLimitOnlyWhenOnline = true; bool bShutdownInProgress = false;
+CMPlugin g_plugin;
int hLangpack = 0;
extern HWND hwndStatsticView;
@@ -654,12 +654,12 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) dwLocalPortUsed = nlb.wPort;
dwLocalIpAddress = nlb.dwInternalIP;
- Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENW("Disable HTTP server"), LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DISABLE_SERVER)));
+ Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENW("Disable HTTP server"), LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_DISABLE_SERVER)));
}
else if (hDirectBoundPort && wparam == 0) {
Netlib_CloseHandle(hDirectBoundPort);
hDirectBoundPort = nullptr;
- Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENW("Enable HTTP server"), LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)));
+ Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENW("Enable HTTP server"), LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)));
}
else return 0; // no changes;
@@ -670,27 +670,6 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) }
/////////////////////////////////////////////////////////////////////
-// Member Function : DllMain
-// Type : Global
-// Parameters : hinst - ?
-// fdwReason - ?
-// lpvReserved - ?
-// Returns : BOOL WINAPI
-// Description :
-//
-// References : -
-// Remarks : -
-// Created : 020422, 22 April 2002
-// Developer : KN
-/////////////////////////////////////////////////////////////////////
-
-BOOL WINAPI DllMain(HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lpvReserved*/)
-{
- hInstance = hinst;
- return 1;
-}
-
-/////////////////////////////////////////////////////////////////////
// Member Function : MainInit
// Type : Global
// Parameters : wparam - ?
@@ -740,7 +719,7 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) nlu.flags = NUF_OUTGOING | NUF_INCOMING;
nlu.szSettingsModule = MODULE;
nlu.szDescriptiveName.a = Translate("HTTP Server");
- hNetlibUser = Netlib_RegisterUser(& nlu);
+ hNetlibUser = Netlib_RegisterUser(&nlu);
if (!hNetlibUser) {
MessageBox(nullptr, "Failed to register NetLib user", MSG_BOX_TITEL, MB_OK);
return 0;
@@ -920,7 +899,7 @@ extern "C" __declspec(dllexport) int Load() CMenuItem mi;
SET_UID(mi, 0xf0a68784, 0xc30e, 0x4245, 0xb6, 0x2b, 0xb8, 0x71, 0x7e, 0xe6, 0xe1, 0x73);
mi.flags = CMIF_UNICODE;
- mi.hIcolibItem = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SHARE_NEW_FILE));
mi.position = 1000085000;
mi.name.a = LPGEN("Enable HTTP server");
mi.pszService = MS_HTTP_ACCEPT_CONNECTIONS;
diff --git a/plugins/HistoryLinkListPlus/src/linklist.cpp b/plugins/HistoryLinkListPlus/src/linklist.cpp index f834250c3f..b022b48871 100644 --- a/plugins/HistoryLinkListPlus/src/linklist.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist.cpp @@ -17,11 +17,9 @@ #include "stdafx.h"
-// Global variables
-HINSTANCE hInst;
-
MWindowList hWindowList;
HCURSOR splitCursor;
+CMPlugin g_plugin;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -37,12 +35,6 @@ PLUGININFOEX pluginInfo = { {0xDA0B09F5, 0x9C66, 0x488C, {0xAE, 0x37, 0x8A, 0x5F, 0x19, 0x1C, 0x90, 0x79}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
@@ -52,7 +44,7 @@ extern "C" __declspec(dllexport) int Load(void) CMenuItem mi;
SET_UID(mi, 0x2964dc6c, 0x9cf9, 0x4f20, 0x8f, 0x8a, 0xc6, 0xfe, 0xe2, 0x65, 0xac, 0xc9);
mi.flags = CMIF_UNICODE;
- mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LINKLISTICON));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_LINKLISTICON));
mi.name.w = LPGENW("&Create Linklist");
mi.pszService = "Linklist/MenuCommand";
Menu_AddContactMenuItem(&mi);
@@ -62,8 +54,8 @@ extern "C" __declspec(dllexport) int Load(void) WNDCLASS wndclass = { 0 };
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = ProgressBarDlg;
- wndclass.hInstance = hInst;
- wndclass.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LINKLISTICON));
+ wndclass.hInstance = g_plugin.getInst();
+ wndclass.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_LINKLISTICON));
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wndclass.lpszClassName = L"Progressbar";
@@ -92,7 +84,7 @@ extern "C" __declspec(dllexport) int Unload(void) int InitOptionsDlg(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("History");
odp.szTitle.a = LPGEN("History Linklist");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_DLG);
@@ -111,8 +103,8 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) int len = GetWindowTextLength(GetDlgItem(hWnd, IDC_MAIN));
PostMessage(GetDlgItem(hWnd, IDC_MAIN), EM_SETSEL, (WPARAM)len, (LPARAM)len);
return 0;
- }
-
+ }
+
MEVENT hEvent = db_event_first(hContact);
if (hEvent == NULL) {
MessageBox(nullptr, TXT_EMPTYHISTORY, TXT_PLUGINNAME, (MB_OK | MB_ICONINFORMATION));
@@ -129,10 +121,10 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) RECT DesktopRect;
GetWindowRect(GetDesktopWindow(), &DesktopRect);
- HWND hWndProgress = CreateWindow(L"Progressbar", TranslateT("Processing history..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, nullptr, nullptr, hInst, nullptr);
+ HWND hWndProgress = CreateWindow(L"Progressbar", TranslateT("Processing history..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, nullptr, nullptr, g_plugin.getInst(), nullptr);
if (hWndProgress == nullptr) {
mir_free(dbe.pBlob);
- MessageBox(nullptr, TranslateT("Could not create window!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION );
+ MessageBox(nullptr, TranslateT("Could not create window!"), TranslateT("Error"), MB_OK | MB_ICONEXCLAMATION);
return -1;
}
SetWindowPos(hWndProgress, HWND_TOP, (int)((DesktopRect.right / 2) - 175), (int)((DesktopRect.bottom / 2) - 22), 0, 0, SWP_NOSIZE);
@@ -152,10 +144,10 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) return -1;
}
}
- actCount ++;
+ actCount++;
if (((int)(((float)actCount / histCount) * 100.00)) % 10 == 0)
SendMessage(hWndProgress, WM_COMMAND, 100, ((int)(((float)actCount / histCount) * 100.00)));
-
+
hEvent = db_event_next(hContact, hEvent);
if (hEvent == NULL)
break;
@@ -167,7 +159,7 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) }
mir_free(dbe.pBlob);
SendMessage(hWndProgress, WM_CLOSE, 0, 0);
- if (ListCount(listStart) <= 0) {
+ if (ListCount(listStart) <= 0) {
RemoveList(listStart);
MessageBox(nullptr, TXT_NOLINKINHISTORY, TXT_PLUGINNAME, (MB_OK | MB_ICONINFORMATION));
return 0;
@@ -180,7 +172,7 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) DlgParam->chrg.cpMax = -1;
DlgParam->chrg.cpMin = -1;
- HWND hWndMain = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN_DLG), nullptr, MainDlgProc, (LPARAM)DlgParam);
+ HWND hWndMain = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MAIN_DLG), nullptr, MainDlgProc, (LPARAM)DlgParam);
if (hWndMain == nullptr) {
mir_free(DlgParam);
RemoveList(listStart);
@@ -188,6 +180,6 @@ static INT_PTR LinkList_Main(WPARAM hContact, LPARAM) return -1;
}
- ShowWindow(hWndMain, SW_SHOW);
+ ShowWindow(hWndMain, SW_SHOW);
return 0;
}
diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp index a450c3ef7d..c11b45f9dd 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp @@ -18,7 +18,6 @@ #include "stdafx.h"
-extern HINSTANCE hInst;
extern MWindowList hWindowList;
extern HCURSOR splitCursor;
@@ -74,7 +73,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) Utils_RestoreWindowPosition(hDlg, hContact, LINKLIST_MODULE, "Linklist");
- SetClassLongPtr(hDlg, GCLP_HICON, (LONG_PTR)LoadIcon(hInst, MAKEINTRESOURCE(IDI_LINKLISTICON)));
+ SetClassLongPtr(hDlg, GCLP_HICON, (LONG_PTR)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_LINKLISTICON)));
WindowList_Add(hWindowList, hDlg, DlgParam->hContact);
mir_snwprintf(title, L"%s [%s]", TranslateT("Linklist plugin"), Clist_GetContactDisplayName(DlgParam->hContact));
SetWindowText(hDlg, title);
@@ -129,7 +128,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) case WM_RBUTTONDOWN:
HMENU hPopup, hSubMenu;
- hPopup = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU2));
+ hPopup = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU2));
hSubMenu = GetSubMenu(hPopup, 0);
// Disable Menuoption if "mouse over" events are active
@@ -192,30 +191,30 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) switch (wParam) {
case IDM_SEARCH: // open Search Box
if (DlgParam != nullptr) {
- HWND hWndSearchDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEARCH_DLG), hDlg, SearchDlgProc, (LPARAM)DlgParam);
+ HWND hWndSearchDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SEARCH_DLG), hDlg, SearchDlgProc, (LPARAM)DlgParam);
EnableMenuItem(listMenu, IDM_SEARCH, (MF_BYCOMMAND | MF_DISABLED | MF_GRAYED));
ShowWindow(hWndSearchDlg, SW_SHOW);
SetFocus(GetDlgItem(hWndSearchDlg, IDC_SEARCHSTRING));
}
break;
-
+
case IDM_CLEARSEARCH: // clear search results
GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
SetDlgItemText(hDlg, IDC_MAIN, L"");
WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, 0);
break;
-
+
case IDM_SAVE: // save button
SaveEditAsStream(hDlg);
SetFocus(GetDlgItem(hDlg, IDC_MAIN));
break;
-
+
case IDCANCEL: // Esc or Close pressed
case IDM_CLOSE:
SendMessage(hDlg, WM_CLOSE, 0, 0);
break;
-
+
case IDM_DIR_IN: // view only incoming messages
GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
@@ -234,7 +233,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) GetFilterText(GetMenu(hDlg), filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
break;
-
+
case IDM_DIR_OUT: // view only outgoing messages
GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
@@ -253,7 +252,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
break;
-
+
case IDM_TYPE_WEB: // view only e-mail addresses
GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
@@ -273,7 +272,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) GetFilterText(listMenu, filter, _countof(filter));
SetDlgItemText(hDlg, IDC_STATUS, filter);
break;
-
+
case IDM_TYPE_MAIL: // view only URLs
if ((GetMenuState(listMenu, IDM_SEARCH, MF_BYCOMMAND) & MF_DISABLED))
break; // not possible if search dialog is open
@@ -292,7 +291,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) break;
}
break;
-
+
// Taken from srmm.
// Btw: The longer I searched the source of this plugin
// to learn how things work, the more I became a fan of
@@ -307,9 +306,9 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) mmi->ptMinTrackSize.y = rcWindow.bottom - rcWindow.top - ((rcMain.bottom - rcMain.top) - DlgParam->minSize.cy);
}
break;
-
+
case WM_SIZE:
- Utils_ResizeDialog(hDlg, hInst, MAKEINTRESOURCEA(IDD_MAIN_DLG), LinklistResizer, (LPARAM)DlgParam);
+ Utils_ResizeDialog(hDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_MAIN_DLG), LinklistResizer, (LPARAM)DlgParam);
// To get some scrollbars if needed...
RedrawWindow(GetDlgItem(hDlg, IDC_MAIN), nullptr, nullptr, RDW_INVALIDATE);
RedrawWindow(GetDlgItem(hDlg, IDC_MESSAGE), nullptr, nullptr, RDW_INVALIDATE);
@@ -335,11 +334,11 @@ INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) DlgParam->splitterPosNew = splitPosOld - DlgParam->minSize.cy + (rc.bottom - rc.top);
SendMessage(hDlg, WM_SIZE, 0, 0);
break;
-
+
case WM_CLOSE:
DestroyWindow(hDlg);
break;
-
+
case WM_DESTROY:
if (DlgParam != nullptr) {
hContact = ((db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0) == 0) ? NULL : DlgParam->hContact);
@@ -388,7 +387,7 @@ INT_PTR CALLBACK SearchDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam HWND hListDlg = WindowList_Find(hWindowList, DlgParam->hContact);
if (hListDlg == nullptr)
break;
-
+
SetDlgItemText(hListDlg, IDC_MAIN, L"");
if (IsDlgButtonChecked(hDlg, IDC_TYPE_WEB) == BST_UNCHECKED)
flags |= WLL_MAIL;
@@ -733,7 +732,7 @@ LRESULT CALLBACK ProgressBarDlg(HWND hwnd, UINT message, WPARAM wParam, LPARAM l switch (message) {
case WM_CREATE:
- hwndPB = CreateWindowEx(0, PROGRESS_CLASS, L"", WS_CHILD | WS_VISIBLE, 0, 2, 343, 17, hwnd, nullptr, hInst, nullptr);
+ hwndPB = CreateWindowEx(0, PROGRESS_CLASS, L"", WS_CHILD | WS_VISIBLE, 0, 2, 343, 17, hwnd, nullptr, g_plugin.getInst(), nullptr);
SendMessage(hwndPB, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
return 0;
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index 21ad54c0a2..65189573a0 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -18,13 +18,12 @@ #include "stdafx.h"
-extern HINSTANCE hInst;
extern MWindowList hWindowList;
/*
The hyperlink detection in this function is taken from the
-Miranda core. It looks a bit sophisticated. I'd made a few
-changes but I didn't really understand what these guys did!
+Miranda core. It looks a bit sophisticated. I'd made a few
+changes but I didn't really understand what these guys did!
Great job! It works! ;-)
*/
int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart)
@@ -70,28 +69,29 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) // support for files
if (msg[i] == '\\' && msg[i + 1] == '\\' && iswalnum(msg[i + 2]))
break;
- if(IsDBCSLeadByte(msg[i]) && msg[i + 1])
- i ++;
- i ++;
+ if (IsDBCSLeadByte(msg[i]) && msg[i + 1])
+ i++;
+ i++;
if (msg[i] != '\n')
- charCount ++;
+ charCount++;
}
if (msg[i] == '\0')
break;
cpWordStart = charCount;
wordStart = i;
-
+
while (msg[i] && !iswspace(msg[i])) {
if (IsDBCSLeadByte(msg[i]) && msg[i + 1]) {
- i ++;
- } else {
- if (iswalnum(msg[i]) || msg[i]=='/') {
- cpLastAlphaNum = charCount;
+ i++;
+ }
+ else {
+ if (iswalnum(msg[i]) || msg[i] == '/') {
+ cpLastAlphaNum = charCount;
iLastAlphaNum = i;
}
}
- charCount ++;
- i ++;
+ charCount++;
+ i++;
}
charCount = cpLastAlphaNum + 1;
@@ -115,25 +115,26 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) wcsncpy_s(wordsearch, wordlen, msg + wordStart, (wordlen - 1));
CharLower(wordsearch);
- for (j = 0; j < _countof(hyperlinkPrefixes); j ++) {
+ for (j = 0; j < _countof(hyperlinkPrefixes); j++) {
if (!wcsncmp(wordsearch, hyperlinkPrefixes[j], mir_wstrlen(hyperlinkPrefixes[j]))) {
isLink = 1;
break;
}
}
if (!isLink) {
- for (j = 0; j < _countof(hyperlinkSubstrings); j ++) {
- if (wcsstr(wordsearch + 1,hyperlinkSubstrings[j])) {
+ for (j = 0; j < _countof(hyperlinkSubstrings); j++) {
+ if (wcsstr(wordsearch + 1, hyperlinkSubstrings[j])) {
isLink = 1;
break;
}
}
}
- if (wcschr(wordsearch,'@') && wcschr(wordsearch,'.') && !wcschr(wordsearch,':') && !wcschr(wordsearch,'/')) {
+ if (wcschr(wordsearch, '@') && wcschr(wordsearch, '.') && !wcschr(wordsearch, ':') && !wcschr(wordsearch, '/')) {
isLink = 1; //e-mail addresses
type = LINK_MAIL;
- } else if (isLink) {
+ }
+ else if (isLink) {
type = LINK_URL;
}
@@ -141,7 +142,8 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) if (wcsstr(wordsearch, L"www.") != nullptr && wcsstr(wordsearch, L"http://") == nullptr && wcsstr(wordsearch, L"https://") == nullptr) {
wcsncpy_s(link, L"http://", LINK_MAX);
wcsncat_s(link, word, LINK_MAX);
- } else {
+ }
+ else {
wcsncpy_s(link, word, LINK_MAX);
}
@@ -175,14 +177,14 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) wcsncpy_s(newElement->time, time, _TRUNCATE);
wcsncpy_s(newElement->link, link, _TRUNCATE);
newElement->hEvent = hEvent;
-
+
actualElement = listStart;
while (actualElement->nextElement != nullptr) {
- actualElement = actualElement->nextElement;
+ actualElement = actualElement->nextElement;
}
-
+
actualElement->nextElement = newElement;
- linkFound ++;
+ linkFound++;
}
mir_free(word);
mir_free(wordsearch);
@@ -200,11 +202,11 @@ int RemoveList(LISTELEMENT *listStart) {
LISTELEMENT *actualElement, *tempElement;
- if ( listStart == nullptr )
+ if (listStart == nullptr)
return -1;
actualElement = listStart->nextElement;
- while ( actualElement != nullptr )
+ while (actualElement != nullptr)
{
tempElement = actualElement->nextElement;
mir_free(actualElement);
@@ -223,11 +225,11 @@ int ListCount(LISTELEMENT *listStart) LISTELEMENT *actualElement;
int count = 0;
- if ( listStart == nullptr )
+ if (listStart == nullptr)
return -1;
-
+
actualElement = listStart->nextElement;
- while ( actualElement != nullptr )
+ while (actualElement != nullptr)
{
count++;
actualElement = actualElement->nextElement;
@@ -250,52 +252,52 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc MYCOLOURSET colourSet;
wchar_t textLine[LINK_MAX + DIR_SIZE + TIME_SIZE + TYPE_SIZE + 6];
wchar_t searchText[320];
- wchar_t lastDate[11] = {0};
+ wchar_t lastDate[11] = { 0 };
wchar_t filter1, filter2, filter3;
- size_t lineLen, listCount=0, realListCount=0, actCount=0, len, appCount = 0;
+ size_t lineLen, listCount = 0, realListCount = 0, actCount = 0, len, appCount = 0;
int linePos = -1;
LISTELEMENT *actualElement;
LISTOPTIONS options;
- CHARRANGE sel;
+ CHARRANGE sel;
GETTEXTLENGTHEX gtl;
GetListInfo(params, listStart, searchString, &lineLen, &listCount, &realListCount);
GetColour(&colourSet);
GetListOptions(&options);
-
- if ( append == 0 )
+
+ if (append == 0)
ShowWindow(GetDlgItem(hDlg, IDC_MAIN), SW_HIDE);
-
- if ( (append > 0) && (GetMenuState(GetMenu(hDlg), IDM_SEARCH, MF_BYCOMMAND) & MF_DISABLED))
+
+ if ((append > 0) && (GetMenuState(GetMenu(hDlg), IDM_SEARCH, MF_BYCOMMAND) & MF_DISABLED))
return;
- if ( GetDlgItem(hDlg, IDC_MAIN) && GetDlgItem(hDlg, IDC_MESSAGE))
+ if (GetDlgItem(hDlg, IDC_MAIN) && GetDlgItem(hDlg, IDC_MESSAGE))
{
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETEVENTMASK, 0, (LPARAM)ENM_LINK);
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_AUTOURLDETECT, TRUE, 0 );
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETBKGNDCOLOR, FALSE, colourSet.background);
-
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_SETEVENTMASK, 0, (LPARAM)ENM_LINK);
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_AUTOURLDETECT, TRUE, 0);
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_SETBKGNDCOLOR, FALSE, colourSet.background);
+
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_COLOR;
cf.crTextColor = colourSet.text;
- SendDlgItemMessage( hDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
- SendDlgItemMessage( hDlg, IDC_MESSAGE, EM_AUTOURLDETECT, TRUE, 0 );
- SendDlgItemMessage( hDlg, IDC_MESSAGE, EM_SETBKGNDCOLOR, FALSE, colourSet.background);
+ SendDlgItemMessage(hDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
+ SendDlgItemMessage(hDlg, IDC_MESSAGE, EM_AUTOURLDETECT, TRUE, 0);
+ SendDlgItemMessage(hDlg, IDC_MESSAGE, EM_SETBKGNDCOLOR, FALSE, colourSet.background);
- if ( append == 0 )
+ if (append == 0)
{
ClearLinePos(listStart);
-
+
// How to set RTF colour, font, etc.... found at
// http://www.winehq.com/hypermail/wine-devel/2004/08/0608.html
memset(&pf, 0, sizeof(pf));
pf.cbSize = sizeof(pf);
pf.dwMask = PFM_ALIGNMENT;
pf.wAlignment = PFA_LEFT;
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETPARAFORMAT, FALSE, (LPARAM) &pf);
-
- if ( searchString != nullptr )
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_SETPARAFORMAT, FALSE, (LPARAM)&pf);
+
+ if (searchString != nullptr)
{
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
@@ -303,123 +305,123 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc cf.dwEffects = CFE_BOLD;
cf.crTextColor = colourSet.text;
wcscpy_s(cf.szFaceName, L"Arial");
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf);
-
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+
mir_snwprintf(searchText, L"%s '%s': %d\n\n", TranslateT("Matches for searchtext"), searchString, listCount);
SendDlgItemMessage(hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)searchText);
linePos += 2;
}
-
+
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_FACE | CFM_BOLD;
wcscpy_s(cf.szFaceName, L"Courier");
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
actualElement = listStart->nextElement;
-
- if ( append > 0 )
+
+ if (append > 0)
{
linePos = GetLastLinePos(listStart);
if ((realListCount - append) == 1)
wcscpy_s(lastDate, actualElement->date);
- for(appCount = 1; appCount <= (realListCount - append); appCount++)
+ for (appCount = 1; appCount <= (realListCount - append); appCount++)
{
actualElement = actualElement->nextElement;
- if(appCount == (realListCount - append - 1))
+ if (appCount == (realListCount - append - 1))
wcscpy_s(lastDate, actualElement->date);
}
- gtl.flags = GTL_PRECISE;
- gtl.codepage = CP_ACP;
- sel.cpMin = sel.cpMax = SendDlgItemMessage(hDlg, IDC_MAIN, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0);
- SendDlgItemMessage(hDlg, IDC_MAIN, EM_EXSETSEL, 0, (LPARAM) &sel);
+ gtl.flags = GTL_PRECISE;
+ gtl.codepage = CP_ACP;
+ sel.cpMin = sel.cpMax = SendDlgItemMessage(hDlg, IDC_MAIN, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0);
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_EXSETSEL, 0, (LPARAM)&sel);
}
- if ( append == 0 )
+ if (append == 0)
{
// Create Progressbar
GetWindowRect(GetDesktopWindow(), &DesktopRect);
- hwndProgress = CreateWindow(L"Progressbar", TranslateT("Processing list..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, nullptr, nullptr, hInst, nullptr);
- SetWindowPos(hwndProgress,HWND_TOP,(int)(DesktopRect.right*0.5)-175,(int)(DesktopRect.bottom*0.5)-22,0,0,SWP_NOSIZE);
-
- if ( hwndProgress != nullptr )
+ hwndProgress = CreateWindow(L"Progressbar", TranslateT("Processing list..."), WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, 350, 45, nullptr, nullptr, g_plugin.getInst(), nullptr);
+ SetWindowPos(hwndProgress, HWND_TOP, (int)(DesktopRect.right*0.5) - 175, (int)(DesktopRect.bottom*0.5) - 22, 0, 0, SWP_NOSIZE);
+
+ if (hwndProgress != nullptr)
{
ShowWindow(hwndProgress, SW_SHOW);
SetForegroundWindow(hwndProgress);
}
}
- while ( actualElement != nullptr )
+ while (actualElement != nullptr)
{
filter1 = 0;
filter2 = 0;
filter3 = 0;
-
- if ( (params & WLL_IN) && (actualElement->direction == DIRECTION_IN))
+
+ if ((params & WLL_IN) && (actualElement->direction == DIRECTION_IN))
filter1 = 1;
- else if ( (params & WLL_OUT) && (actualElement->direction == DIRECTION_OUT))
+ else if ((params & WLL_OUT) && (actualElement->direction == DIRECTION_OUT))
filter1 = 1;
-
- if ( (params & WLL_MAIL) && (actualElement->type == LINK_MAIL))
+
+ if ((params & WLL_MAIL) && (actualElement->type == LINK_MAIL))
filter2 = 1;
- else if ( (params & WLL_URL) && (actualElement->type == LINK_URL))
+ else if ((params & WLL_URL) && (actualElement->type == LINK_URL))
filter2 = 1;
- else if ( (params & WLL_FILE) && (actualElement->type == LINK_FILE))
+ else if ((params & WLL_FILE) && (actualElement->type == LINK_FILE))
filter2 = 1;
- if ( searchString != nullptr )
+ if (searchString != nullptr)
{
- if ( params & SLL_DEEP )
- {
+ if (params & SLL_DEEP)
+ {
// Perform deep scan
- if ( actualElement->hEvent != NULL )
+ if (actualElement->hEvent != NULL)
{
DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(actualElement->hEvent);
- dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob+1);
+ dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob + 1);
db_event_get(actualElement->hEvent, &dbe);
dbe.pBlob[dbe.cbBlob] = 0;
LPTSTR msg = DbEvent_GetTextW(&dbe, CP_ACP);
- if ( wcsstr(msg, searchString))
- filter3 = 1;
-
+ if (wcsstr(msg, searchString))
+ filter3 = 1;
+
mir_free(dbe.pBlob);
mir_free(msg);
}
else filter3 = 0;
}
- else if ( wcsstr(actualElement->link, searchString))
+ else if (wcsstr(actualElement->link, searchString))
filter3 = 1;
}
else filter3 = 1;
- if ( (filter1 == 1) && (filter2 == 1) && (filter3 == 1))
+ if ((filter1 == 1) && (filter2 == 1) && (filter3 == 1))
{
LPCTSTR type;
- if ( mir_wstrcmp(actualElement->date, lastDate) != 0 )
+ if (mir_wstrcmp(actualElement->date, lastDate) != 0)
{
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_COLOR;
cf.crTextColor = colourSet.text;
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- if ( options.showLine != 0 )
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ if (options.showLine != 0)
DrawLine(hDlg, lineLen);
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_ITALIC | CFM_BOLD | CFM_FACE;
cf.dwEffects = CFE_BOLD;
wcscpy_s(cf.szFaceName, L"Arial");
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf);
- if ( options.showDate != 0 )
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ if (options.showDate != 0)
{
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM) actualElement->date);
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM) L"\n\n");
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)actualElement->date);
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)L"\n\n");
linePos += 3;
}
wcscpy_s(lastDate, actualElement->date);
@@ -427,20 +429,20 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc cf.cbSize = sizeof cf;
cf.dwMask = CFM_ITALIC | CFM_BOLD | CFM_UNDERLINE | CFM_FACE;
wcscpy_s(cf.szFaceName, L"Courier");
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf);
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_COLOR;
-
- if ( actualElement->direction == DIRECTION_OUT )
+
+ if (actualElement->direction == DIRECTION_OUT)
{
cf.crTextColor = colourSet.incoming;
}
else
cf.crTextColor = colourSet.outgoing;
-
- switch( actualElement->type ) {
+
+ switch (actualElement->type) {
case LINK_MAIL:
type = L"[mail]";
break;
@@ -455,48 +457,48 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc }
mir_snwprintf(textLine, L"%s%s%s%s%s%s%s\n",
- options.showDirection ? (actualElement->direction==DIRECTION_IN?L"[in ]":L"[out]") : L"",
- options.showDirection? L" " : L"",
+ options.showDirection ? (actualElement->direction == DIRECTION_IN ? L"[in ]" : L"[out]") : L"",
+ options.showDirection ? L" " : L"",
options.showType ? type : L"",
options.showType ? L" " : L"",
options.showTime ? actualElement->time : L"",
options.showTime ? L" " : L"",
actualElement->link);
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf);
- SendDlgItemMessage(hDlg, IDC_MAIN, EM_REPLACESEL, FALSE,(LPARAM)textLine);
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)textLine);
linePos++;
actualElement->linePos = linePos;
actCount++;
- if ( hwndProgress && ( ((int)(((float)actCount/listCount)*100.00)) % 10 == 0 ))
- SendMessage(hwndProgress, WM_COMMAND, 100,((int)(((float)actCount/listCount)*100.00)));
+ if (hwndProgress && (((int)(((float)actCount / listCount)*100.00)) % 10 == 0))
+ SendMessage(hwndProgress, WM_COMMAND, 100, ((int)(((float)actCount / listCount)*100.00)));
}
actualElement = actualElement->nextElement;
}
- if ( listCount > 0 )
+ if (listCount > 0)
{
if ((actCount < listCount) && (append == 0) && (options.showLine != 0))
DrawLine(hDlg, lineLen);
}
- else if ( searchString == nullptr )
- {
+ else if (searchString == nullptr)
+ {
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_ITALIC | CFM_BOLD | CFM_FACE;
cf.dwEffects = CFE_BOLD;
wcscpy_s(cf.szFaceName, L"Arial");
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf);
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)TranslateT("No messages found!\nPlease change current filter options."));
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)L"\n");
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)TranslateT("No messages found!\nPlease change current filter options."));
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)L"\n");
}
-
+
}
- if ( append == 0 )
+ if (append == 0)
{
SendMessage(hwndProgress, WM_CLOSE, 0, 0);
- ShowWindow(GetDlgItem(hDlg, IDC_MAIN), SW_SHOW);
+ ShowWindow(GetDlgItem(hDlg, IDC_MAIN), SW_SHOW);
}
-
+
PostMessage(GetDlgItem(hDlg, IDC_MAIN), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
len = GetWindowTextLength(GetDlgItem(hDlg, IDC_MAIN));
PostMessage(GetDlgItem(hDlg, IDC_MAIN), EM_SETSEL, len, len);
@@ -510,7 +512,7 @@ int WriteOptionExample(HWND hDlg, DWORD InColourSel, DWORD OutColourSel, DWORD B {
CHARFORMAT cf;
PARAFORMAT pf;
-
+
memset(&pf, 0, sizeof(pf));
pf.cbSize = sizeof(pf);
pf.dwMask = PFM_ALIGNMENT;
@@ -526,30 +528,30 @@ int WriteOptionExample(HWND hDlg, DWORD InColourSel, DWORD OutColourSel, DWORD B cf.dwMask = CFM_FACE | CFM_BOLD | CFM_ITALIC | CFM_COLOR;
wcscpy_s(cf.szFaceName, L"Courier");
cf.crTextColor = TxtColourSel;
- SendDlgItemMessage( hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf);
- if ( options->showLine == 1 )
- SendDlgItemMessage( hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"___________________________________________\n");
+ SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+ if (options->showLine == 1)
+ SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"___________________________________________\n");
else
- SendDlgItemMessage( hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"\n");
-
+ SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"\n");
+
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_BOLD | CFM_FACE | CFM_COLOR;
cf.dwEffects = CFE_BOLD;
wcscpy_s(cf.szFaceName, L"Arial");
cf.crTextColor = TxtColourSel;
- SendDlgItemMessage( hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf);
+ SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+
+ if (options->showDate == 1)
+ SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)TXT_DATE);
- if(options->showDate == 1)
- SendDlgItemMessage( hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)TXT_DATE);
-
- SendDlgItemMessage( hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM) L"\n");
+ SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"\n");
memset(&cf, 0, sizeof(cf));
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_ITALIC | CFM_BOLD | CFM_UNDERLINE | CFM_FACE;
wcscpy_s(cf.szFaceName, L"Courier");
- SendDlgItemMessage( hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf);
+ SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
// incoming
memset(&cf, 0, sizeof(cf));
@@ -557,19 +559,19 @@ int WriteOptionExample(HWND hDlg, DWORD InColourSel, DWORD OutColourSel, DWORD B cf.dwMask = CFM_COLOR | CFM_FACE;
cf.crTextColor = InColourSel;
wcscpy_s(cf.szFaceName, L"Courier");
- SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
-
- if ( options->showDirection == 1 )
+ SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+
+ if (options->showDirection == 1)
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"\n[in ] ");
else
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"\n");
-
- if ( options->showType == 1 )
+
+ if (options->showType == 1)
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"URL ");
else
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"");
-
- if ( options->showTime == 1 )
+
+ if (options->showTime == 1)
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"08:15 https://miranda-ng.org\n");
else
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"https://miranda-ng.org\n");
@@ -582,22 +584,22 @@ int WriteOptionExample(HWND hDlg, DWORD InColourSel, DWORD OutColourSel, DWORD B wcscpy_s(cf.szFaceName, L"Courier");
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
-
- if ( options->showDirection == 1 )
+
+ if (options->showDirection == 1)
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"[out] ");
else
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"");
-
- if(options->showType == 1)
+
+ if (options->showType == 1)
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"URL ");
else
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"");
-
- if(options->showTime == 1)
+
+ if (options->showTime == 1)
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"08:16 https://miranda-ng.org\n");
else
SendDlgItemMessage(hDlg, IDC_OPTIONS_RE, EM_REPLACESEL, FALSE, (LPARAM)L"https://miranda-ng.org\n");
-
+
return 0;
}
@@ -611,10 +613,10 @@ void WriteMessage(HWND hDlg, LISTELEMENT *listStart, int actLinePos) while (actualElement != nullptr) {
if (actualElement->linePos == actLinePos) {
MEVENT hEvent = actualElement->hEvent;
- if (hEvent != NULL ) {
+ if (hEvent != NULL) {
DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(hEvent);
- dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob+1);
+ dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob + 1);
db_event_get(hEvent, &dbe);
dbe.pBlob[dbe.cbBlob] = 0;
LPCTSTR msg = DbEvent_GetTextW(&dbe, CP_ACP);
@@ -636,33 +638,33 @@ user options. BYTE GetFlags(HMENU listMenu)
{
BYTE returnflags = 0x00;
-
- if ( GetMenuState(listMenu, IDM_TYPE_WEB, MF_BYCOMMAND) == MF_UNCHECKED )
+
+ if (GetMenuState(listMenu, IDM_TYPE_WEB, MF_BYCOMMAND) == MF_UNCHECKED)
returnflags = returnflags | WLL_MAIL;
-
- if ( GetMenuState(listMenu, IDM_TYPE_MAIL, MF_BYCOMMAND) == MF_UNCHECKED )
+
+ if (GetMenuState(listMenu, IDM_TYPE_MAIL, MF_BYCOMMAND) == MF_UNCHECKED)
returnflags = returnflags | WLL_URL;
-
- if ( GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_UNCHECKED )
+
+ if (GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_UNCHECKED)
returnflags = returnflags | WLL_OUT;
-
- if ( GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_UNCHECKED )
+
+ if (GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_UNCHECKED)
returnflags = returnflags | WLL_IN;
-
+
return returnflags;
}
void GetFilterText(HMENU listMenu, LPTSTR filter, size_t max_len)
{
- if ( GetMenuState(listMenu, IDM_TYPE_WEB, MF_BYCOMMAND) == MF_CHECKED )
+ if (GetMenuState(listMenu, IDM_TYPE_WEB, MF_BYCOMMAND) == MF_CHECKED)
{
- if ( GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_CHECKED )
+ if (GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_CHECKED)
{
//incoming URLs
mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_INCOMING, TXT_URLSONLY);
}
- else if ( GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_CHECKED )
+ else if (GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_CHECKED)
{
//outgoing URLs
mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_OUTGOING, TXT_URLSONLY);
@@ -673,14 +675,14 @@ void GetFilterText(HMENU listMenu, LPTSTR filter, size_t max_len) mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, "", TXT_URLSONLY);
}
}
- else if ( GetMenuState(listMenu, IDM_TYPE_MAIL, MF_BYCOMMAND) == MF_CHECKED )
+ else if (GetMenuState(listMenu, IDM_TYPE_MAIL, MF_BYCOMMAND) == MF_CHECKED)
{
- if ( GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_CHECKED )
+ if (GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_CHECKED)
{
//incoming mail
mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_INCOMING, TXT_MAILSONLY);
}
- else if ( GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_CHECKED )
+ else if (GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_CHECKED)
{
//outgoing mail
mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_OUTGOING, TXT_MAILSONLY);
@@ -693,12 +695,12 @@ void GetFilterText(HMENU listMenu, LPTSTR filter, size_t max_len) }
else
{
- if ( GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_CHECKED )
+ if (GetMenuState(listMenu, IDM_DIR_IN, MF_BYCOMMAND) == MF_CHECKED)
{
//incoming (both)
mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_INCOMING, "");
}
- else if ( GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_CHECKED )
+ else if (GetMenuState(listMenu, IDM_DIR_OUT, MF_BYCOMMAND) == MF_CHECKED)
{
//outgoing (both)
mir_snwprintf(filter, max_len, L"%s: %s %s", TXT_FILTER, TXT_OUTGOING, "");
@@ -719,13 +721,13 @@ void DrawLine(HWND hDlg, size_t lineLen) {
wchar_t line[LINK_MAX + 18];
size_t i;
- for (i=0; (i<lineLen+18)&&(i<LINK_MAX+18); i++ )
+ for (i = 0; (i < lineLen + 18) && (i < LINK_MAX + 18); i++)
{
line[i] = '_';
}
- line[lineLen+18] = '\0';
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)line);
- SendDlgItemMessage( hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)L"\n");
+ line[lineLen + 18] = '\0';
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)line);
+ SendDlgItemMessage(hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)L"\n");
return;
}
@@ -733,9 +735,9 @@ void DrawLine(HWND hDlg, size_t lineLen) /*
Little helper function to get informations about the linked list, such as number of links, etc
*/
-void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, size_t *maxLen, size_t *elementCount, size_t *realElementCount)
+void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, size_t *maxLen, size_t *elementCount, size_t *realElementCount)
{
- size_t tempLen;
+ size_t tempLen;
LISTELEMENT *actualElement;
char filter1, filter2, filter3;
@@ -743,40 +745,40 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, siz *elementCount = 0;
*realElementCount = 0;
actualElement = listStart->nextElement;
-
- while ( actualElement != nullptr )
+
+ while (actualElement != nullptr)
{
(*realElementCount)++;
filter1 = 0;
filter2 = 0;
filter3 = 0;
-
- if ( (params & WLL_IN) && (actualElement->direction == DIRECTION_IN))
+
+ if ((params & WLL_IN) && (actualElement->direction == DIRECTION_IN))
filter1 = 1;
- else if ( (params & WLL_OUT) && (actualElement->direction == DIRECTION_OUT))
+ else if ((params & WLL_OUT) && (actualElement->direction == DIRECTION_OUT))
filter1 = 1;
-
- if ( (params & WLL_MAIL) && (actualElement->type == LINK_MAIL))
+
+ if ((params & WLL_MAIL) && (actualElement->type == LINK_MAIL))
filter2 = 1;
- else if ( (params & WLL_URL) && (actualElement->type == LINK_URL))
+ else if ((params & WLL_URL) && (actualElement->type == LINK_URL))
filter2 = 1;
-
- if ( searchString != nullptr )
+
+ if (searchString != nullptr)
{
- if ( params & SLL_DEEP )
- {
+ if (params & SLL_DEEP)
+ {
// Perform deep scan
- if ( actualElement->hEvent != NULL )
+ if (actualElement->hEvent != NULL)
{
DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(actualElement->hEvent);
- dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob+1);
+ dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob + 1);
db_event_get(actualElement->hEvent, &dbe);
dbe.pBlob[dbe.cbBlob] = 0;
- if ( wcsstr((LPTSTR)dbe.pBlob, searchString))
- filter3 = 1;
-
+ if (wcsstr((LPTSTR)dbe.pBlob, searchString))
+ filter3 = 1;
+
mir_free(dbe.pBlob);
}
else
@@ -784,14 +786,14 @@ void GetListInfo(BYTE params, LISTELEMENT *listStart, LPCTSTR searchString, siz }
else
{
- if(wcsstr(actualElement->link, searchString))
+ if (wcsstr(actualElement->link, searchString))
filter3 = 1;
}
}
else
filter3 = 1;
- if ((filter1 == 1) && (filter2 == 1) && (filter3 == 1))
+ if ((filter1 == 1) && (filter2 == 1) && (filter3 == 1))
{
(*elementCount)++;
@@ -810,16 +812,16 @@ void GetListOptions(LISTOPTIONS *options) {
options->openNewWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0xFF);
- if(options->openNewWindow == 0xFF)
+ if (options->openNewWindow == 0xFF)
{
// No DB entry for this Plugin
db_set_b(NULL, LINKLIST_MODULE, LINKLIST_OPEN_WINDOW, 0x00);
options->openNewWindow = 0x00;
}
-
+
options->updateWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0xFF);
- if(options->updateWindow == 0xFF)
+ if (options->updateWindow == 0xFF)
{
// No DB entry for this Plugin
db_set_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0x00);
@@ -827,7 +829,7 @@ void GetListOptions(LISTOPTIONS *options) }
options->mouseEvent = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0xFF);
- if(options->mouseEvent == 0xFF)
+ if (options->mouseEvent == 0xFF)
{
// No DB entry for this Plugin
db_set_b(NULL, LINKLIST_MODULE, LINKLIST_MOUSE_EVENT, 0x00);
@@ -835,7 +837,7 @@ void GetListOptions(LISTOPTIONS *options) }
options->saveSpecial = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0xFF);
- if(options->saveSpecial == 0xFF)
+ if (options->saveSpecial == 0xFF)
{
// No DB entry for this Plugin
db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0x00);
@@ -844,7 +846,7 @@ void GetListOptions(LISTOPTIONS *options) options->showDate = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DATE, 0xFF);
- if(options->showDate == 0xFF)
+ if (options->showDate == 0xFF)
{
// No DB entry for this Plugin
db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DATE, 0x01);
@@ -852,7 +854,7 @@ void GetListOptions(LISTOPTIONS *options) }
options->showLine = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_LINE, 0xFF);
- if(options->showLine == 0xFF)
+ if (options->showLine == 0xFF)
{
// No DB entry for this Plugin
db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_LINE, 0x01);
@@ -860,7 +862,7 @@ void GetListOptions(LISTOPTIONS *options) }
options->showTime = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, 0xFF);
- if(options->showTime == 0xFF)
+ if (options->showTime == 0xFF)
{
// No DB entry for this Plugin
db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TIME, 0x01);
@@ -868,7 +870,7 @@ void GetListOptions(LISTOPTIONS *options) }
options->showDirection = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, 0xFF);
- if(options->showDirection == 0xFF)
+ if (options->showDirection == 0xFF)
{
// No DB entry for this Plugin
db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_DIRECTION, 0x01);
@@ -876,7 +878,7 @@ void GetListOptions(LISTOPTIONS *options) }
options->showType = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, 0xFF);
- if(options->showType == 0xFF)
+ if (options->showType == 0xFF)
{
// No DB entry for this Plugin
db_set_b(NULL, LINKLIST_MODULE, LINKLIST_SHOW_TYPE, 0x01);
@@ -906,11 +908,11 @@ void ClearLinePos(LISTELEMENT *listStart) {
LISTELEMENT *actualElement;
- if ( listStart == nullptr )
+ if (listStart == nullptr)
return;
actualElement = listStart->nextElement;
- while ( actualElement != nullptr )
+ while (actualElement != nullptr)
{
actualElement->linePos = -1;
actualElement = actualElement->nextElement;
@@ -922,13 +924,13 @@ int GetLastLinePos(LISTELEMENT *listStart) LISTELEMENT *actualElement;
int maxPos = -1;
- if ( listStart == nullptr )
+ if (listStart == nullptr)
return -1;
actualElement = listStart->nextElement;
- while ( actualElement != nullptr )
+ while (actualElement != nullptr)
{
- if ( actualElement->linePos > maxPos )
+ if (actualElement->linePos > maxPos)
maxPos = actualElement->linePos;
actualElement = actualElement->nextElement;
@@ -945,25 +947,25 @@ void GetColour(MYCOLOURSET *colourSet) BYTE useDefault;
useDefault = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0xFF);
- if ( useDefault == 0xFF )
+ if (useDefault == 0xFF)
{
// No DB entry for this Plugin
db_set_b(NULL, LINKLIST_MODULE, LINKLIST_USE_DEF, 0x01);
useDefault = 0x01;
}
- if ( useDefault == 0x01 )
+ if (useDefault == 0x01)
{
// Use Miranda-IM Default colours
// CHANGED AT MIRANDA 0.4!!!!
// Use SRMM... if it is not there try SRMsg (older Miranda Versions)
colour = db_get_dw(NULL, "SRMM", "SRMFont1Col", 0xFF000000);
- if ( colour != 0xFF000000 )
+ if (colour != 0xFF000000)
colourSet->incoming = colour;
else
{
colour = db_get_dw(NULL, "SRMsg", "Font3Col", 0xFF000000);
- if ( colour != 0xFF000000 )
+ if (colour != 0xFF000000)
colourSet->incoming = colour;
else
{
@@ -971,16 +973,16 @@ void GetColour(MYCOLOURSET *colourSet) useDefault = 0x00;
}
}
-
+
// SRMM
colour = db_get_dw(NULL, "SRMM", "SRMFont0Col", 0xFF000000);
- if ( colour != 0xFF000000 )
+ if (colour != 0xFF000000)
colourSet->outgoing = colour;
else
{
// SRMsg
colour = db_get_dw(NULL, "SRMsg", "Font0Col", 0xFF000000);
- if ( colour != 0xFF000000 )
+ if (colour != 0xFF000000)
colourSet->outgoing = colour;
else
{
@@ -991,13 +993,13 @@ void GetColour(MYCOLOURSET *colourSet) // SRMM
colour = db_get_dw(NULL, "SRMM", "BkgColour", 0xFF000000);
- if ( colour != 0xFF000000 )
+ if (colour != 0xFF000000)
colourSet->background = colour;
else
- {
+ {
// SRMsg
colour = db_get_dw(NULL, "SRMsg", "BkgColour", 0xFF000000);
- if ( colour != 0xFF000000 )
+ if (colour != 0xFF000000)
colourSet->background = colour;
else
{
@@ -1008,29 +1010,29 @@ void GetColour(MYCOLOURSET *colourSet) colourSet->text = MAKE_TXT_COL(colourSet->background);
}
- if ( useDefault == 0x00 )
+ if (useDefault == 0x00)
{
// Use Plugin user defined or default colours
colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, 0xFF000000);
- if ( colour != 0xFF000000 )
+ if (colour != 0xFF000000)
colourSet->incoming = colour;
else
colourSet->incoming = IN_COL_DEF;
-
+
colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, 0xFF000000);
- if ( colour != 0xFF000000 )
+ if (colour != 0xFF000000)
colourSet->outgoing = colour;
else
colourSet->outgoing = OUT_COL_DEF;
-
+
colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, 0xFF000000);
- if ( colour != 0xFF000000 )
+ if (colour != 0xFF000000)
colourSet->background = colour;
else
colourSet->background = BG_COL_DEF;
colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, 0xFF000000);
- if ( colour != 0xFF000000 )
+ if (colour != 0xFF000000)
colourSet->text = colour;
else
colourSet->text = TXT_COL_DEF;
@@ -1047,7 +1049,7 @@ void GetDBColour(MYCOLOURSET *colourSet) // Use Plugin user defined or default colours
colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_IN_COL, 0xFF000000);
- if(colour != 0xFF000000)
+ if (colour != 0xFF000000)
colourSet->incoming = colour;
else
{
@@ -1056,16 +1058,16 @@ void GetDBColour(MYCOLOURSET *colourSet) }
colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, 0xFF000000);
- if(colour != 0xFF000000)
+ if (colour != 0xFF000000)
colourSet->outgoing = colour;
else
- {
+ {
db_set_dw(NULL, LINKLIST_MODULE, LINKLIST_OUT_COL, OUT_COL_DEF);
colourSet->outgoing = OUT_COL_DEF;
}
colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_BG_COL, 0xFF000000);
- if(colour != 0xFF000000)
+ if (colour != 0xFF000000)
colourSet->background = colour;
else
{
@@ -1074,7 +1076,7 @@ void GetDBColour(MYCOLOURSET *colourSet) }
colour = db_get_dw(NULL, LINKLIST_MODULE, LINKLIST_TXT_COL, 0xFF000000);
- if(colour != 0xFF000000)
+ if (colour != 0xFF000000)
colourSet->text = colour;
else
{
@@ -1093,37 +1095,37 @@ int GetMirandaColour(MYCOLOURSET *colourSet) // Use Miranda-IM Default colours
// Try SRMM (Miranda 0.4) .... or SRMsg... for older versions
colour = db_get_dw(NULL, "SRMM", "SRMFont1Col", 0xFF000000);
- if(colour != 0xFF000000)
+ if (colour != 0xFF000000)
colourSet->incoming = colour;
else
{
colour = db_get_dw(NULL, "SRMsg", "Font3Col", 0xFF000000);
- if(colour != 0xFF000000)
+ if (colour != 0xFF000000)
colourSet->incoming = colour;
else
- return 1;
+ return 1;
}
-
+
colour = db_get_dw(NULL, "SRMM", "SRMFont0Col", 0xFF000000);
- if(colour != 0xFF000000)
+ if (colour != 0xFF000000)
colourSet->outgoing = colour;
else
{
colour = db_get_dw(NULL, "SRMsg", "Font0Col", 0xFF000000);
- if(colour != 0xFF000000)
+ if (colour != 0xFF000000)
colourSet->outgoing = colour;
else
return 1;
}
colour = db_get_dw(NULL, "SRMM", "BkgColour", 0xFF000000);
- if(colour != 0xFF000000)
+ if (colour != 0xFF000000)
colourSet->background = colour;
else
- {
+ {
colour = db_get_dw(NULL, "SRMsg", "BkgColour", 0xFF000000);
- if(colour != 0xFF000000)
+ if (colour != 0xFF000000)
colourSet->background = colour;
else
return 1;
@@ -1148,15 +1150,15 @@ void SetDBColour(MYCOLOURSET *colourSet) BYTE GetUpdateSetting(void)
{
BYTE updateWindow;
-
+
updateWindow = db_get_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0xFF);
- if ( updateWindow == 0xFF )
+ if (updateWindow == 0xFF)
{
// No DB entry for this Plugin
db_set_b(NULL, LINKLIST_MODULE, LINKLIST_UPDATE_WINDOW, 0x00);
return 0;
}
- if ( updateWindow == 0x00 )
+ if (updateWindow == 0x00)
return 0;
else
return 1;
@@ -1172,22 +1174,22 @@ int DBUpdate(WPARAM wParam, LPARAM hEvent) DIALOGPARAM *DlgParam;
HMENU listMenu = GetMenu(hDlg);
int linkNum = 0;
-
+
DlgParam = (DIALOGPARAM *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
- if(GetUpdateSetting() != 1)
+ if (GetUpdateSetting() != 1)
return 0;
- if(hDlg) {
+ if (hDlg) {
DBEVENTINFO dbe = {};
dbe.cbBlob = db_event_getBlobSize(hEvent);
- dbe.pBlob = (PBYTE)mir_alloc((size_t)dbe.cbBlob+1);
+ dbe.pBlob = (PBYTE)mir_alloc((size_t)dbe.cbBlob + 1);
db_event_get(hEvent, &dbe);
if (dbe.eventType == EVENTTYPE_URL || dbe.eventType == EVENTTYPE_MESSAGE) {
// Call function to find URIs
linkNum = ExtractURI(&dbe, hEvent, DlgParam->listStart);
- if ( linkNum > 0 )
- WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, linkNum);
+ if (linkNum > 0)
+ WriteLinkList(hDlg, GetFlags(listMenu), DlgParam->listStart, nullptr, linkNum);
}
mir_free(dbe.pBlob);
}
@@ -1198,40 +1200,40 @@ int DBUpdate(WPARAM wParam, LPARAM hEvent) /*
Little resize helper
*/
-int LinklistResizer(HWND hDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
+int LinklistResizer(HWND hDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
{
DIALOGPARAM *DlgParam = (DIALOGPARAM*)lParam;
UNREFERENCED_PARAMETER(hDlg);
-
- switch(urc->wId)
+
+ switch (urc->wId)
{
- case IDC_MAIN:
- urc->rcItem.bottom -= DlgParam->splitterPosNew - DlgParam->splitterPosOld;
- return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT;
-
- case IDC_MESSAGE:
- urc->rcItem.top -= DlgParam->splitterPosNew - DlgParam->splitterPosOld;
- return RD_ANCHORX_WIDTH|RD_ANCHORY_BOTTOM;
-
- case IDC_STATUS:
- return RD_ANCHORX_WIDTH|RD_ANCHORY_BOTTOM;
-
- case IDC_SPLITTER:
- urc->rcItem.top -= DlgParam->splitterPosNew - DlgParam->splitterPosOld;
- urc->rcItem.bottom -= DlgParam->splitterPosNew - DlgParam->splitterPosOld;
- return RD_ANCHORX_WIDTH|RD_ANCHORY_BOTTOM;
+ case IDC_MAIN:
+ urc->rcItem.bottom -= DlgParam->splitterPosNew - DlgParam->splitterPosOld;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
+
+ case IDC_MESSAGE:
+ urc->rcItem.top -= DlgParam->splitterPosNew - DlgParam->splitterPosOld;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
+
+ case IDC_STATUS:
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
+
+ case IDC_SPLITTER:
+ urc->rcItem.top -= DlgParam->splitterPosNew - DlgParam->splitterPosOld;
+ urc->rcItem.bottom -= DlgParam->splitterPosNew - DlgParam->splitterPosOld;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
}
- return RD_ANCHORX_LEFT|RD_ANCHORY_TOP;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
}
/*
-Next both functions are taken from a example projekt, found at
+Next both functions are taken from a example projekt, found at
http://www.programmersheaven.com/zone15/cat236/2405.htm
The author is unknown, but this peace of code made my work much easier!
*/
-BOOL SaveEditAsStream( HWND hDlg )
+BOOL SaveEditAsStream(HWND hDlg)
{
EDITSTREAM es;
LONG lOut;
@@ -1243,9 +1245,9 @@ BOOL SaveEditAsStream( HWND hDlg ) wcscpy_s(szFilename, L"*.rtf");
// Fill in OPENFILENAME struct
memset(&ofn, 0, sizeof(OPENFILENAME));
- ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hDlg;
- wchar_t temp[MAX_PATH];
+ wchar_t temp[MAX_PATH];
mir_snwprintf(temp, L"%s (*.rtf)%c*.rtf%c%s (*.*)%c*.*%c%c", TranslateT("RTF file"), 0, 0, TranslateT("All files"), 0, 0, 0);
ofn.lpstrFilter = temp;
ofn.lpstrFile = szFilename;
@@ -1253,21 +1255,21 @@ BOOL SaveEditAsStream( HWND hDlg ) ofn.lpstrTitle = TranslateT("Save RTF File");
ofn.Flags = OFN_OVERWRITEPROMPT;
// Get a filename or quit
- if ( ! GetSaveFileName( &ofn ))
+ if (!GetSaveFileName(&ofn))
return FALSE;
// Create the specified file
- hFile = CreateFile( szFilename, GENERIC_WRITE, 0, nullptr,
- CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr );
+ hFile = CreateFile(szFilename, GENERIC_WRITE, 0, nullptr,
+ CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
// Quit if file creation fails
- if ( hFile == INVALID_HANDLE_VALUE )
+ if (hFile == INVALID_HANDLE_VALUE)
return FALSE;
// Pass file handle to callback
// so the callback can do the file write
es.dwCookie = (DWORD_PTR)hFile;
- es.dwError = 0;
+ es.dwError = 0;
es.pfnCallback = (EDITSTREAMCALLBACK)RTFSaveStreamCallback;
// Start the callback proc
- lOut = SendDlgItemMessage( hDlg, IDC_MAIN, EM_STREAMOUT, SF_RTF, (LPARAM)&es );
+ lOut = SendDlgItemMessage(hDlg, IDC_MAIN, EM_STREAMOUT, SF_RTF, (LPARAM)&es);
// Close file handle and exit
CloseHandle(hFile);
return TRUE;
@@ -1276,12 +1278,12 @@ BOOL SaveEditAsStream( HWND hDlg ) DWORD CALLBACK RTFSaveStreamCallback(DWORD_PTR dwCookie, LPBYTE lpBuffer, LONG lSize, LONG *plRead)
{
// Sanity check...exit if nothing passed
- if ( ! lSize )
+ if (!lSize)
return 1;
// Initialize "amount read" variable for WriteFile()
- *plRead = 0;
+ *plRead = 0;
// dwCookie is the file handle
- WriteFile( (HANDLE)dwCookie, lpBuffer, lSize, (LPDWORD)plRead, nullptr );
+ WriteFile((HANDLE)dwCookie, lpBuffer, lSize, (LPDWORD)plRead, nullptr);
// Continue, if needed
return 0;
}
diff --git a/plugins/HistoryLinkListPlus/src/stdafx.h b/plugins/HistoryLinkListPlus/src/stdafx.h index b334a6326d..c164f59b98 100644 --- a/plugins/HistoryLinkListPlus/src/stdafx.h +++ b/plugins/HistoryLinkListPlus/src/stdafx.h @@ -25,8 +25,6 @@ #include <commctrl.h>
#include <crtdbg.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_clist.h>
#include <m_database.h>
@@ -84,7 +82,7 @@ struct LISTELEMENT { MEVENT hEvent;
int linePos;
struct LISTELEMENT *nextElement;
-} ;
+};
typedef struct {
BYTE openNewWindow;
@@ -129,6 +127,12 @@ typedef struct { #define LINKLIST_SHOW_DIRECTION "ShowMessageDirection"
#define LINKLIST_SHOW_TYPE "ShowMessageType"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(LINKLIST_MODULE)
+ {}
+};
#define _mstrlen(x) (_countof(x) - 1)
#define MAKE_TXT_COL(BGCol) ((DWORD)~BGCol & 0x00FFFFFF)
diff --git a/plugins/HistoryStats/src/bandctrlimpl.cpp b/plugins/HistoryStats/src/bandctrlimpl.cpp index 129668d1f5..2c8f0286d3 100644 --- a/plugins/HistoryStats/src/bandctrlimpl.cpp +++ b/plugins/HistoryStats/src/bandctrlimpl.cpp @@ -170,7 +170,7 @@ bool BandCtrlImpl::registerClass() staticWndProc, // lpfnWndProc
0, // cbClsExtra
sizeof(BandCtrlImpl*), // cbWndExtra
- g_hInst, // hInstance
+ g_plugin.getInst(), // hInstance
nullptr, // hIcon
nullptr, // hCursor
nullptr, // hbrBackground
@@ -187,7 +187,7 @@ bool BandCtrlImpl::registerClass() void BandCtrlImpl::unregisterClass()
{
- UnregisterClass(m_ClassName, g_hInst);
+ UnregisterClass(m_ClassName, g_plugin.getInst());
}
BandCtrlImpl::BandCtrlImpl(HWND hWnd, UINT_PTR nOwnId) :
@@ -197,7 +197,7 @@ BandCtrlImpl::BandCtrlImpl(HWND hWnd, UINT_PTR nOwnId) : m_nLayout(0), m_nDDWidth(12), m_hDDIcon(nullptr)
{
m_IconSize.cx = m_IconSize.cy;
- m_hDDIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_DROPDOWN), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0));
+ m_hDDIcon = reinterpret_cast<HICON>(LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_DROPDOWN), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0));
reloadTheme();
}
@@ -626,9 +626,9 @@ void BandCtrlImpl::recalcButtonRects() else if (m_Items[i].uTTId == -1 && m_Items[i].bVisible && !m_Items[i].tooltip.empty()) {
// add a tooltip, if we don't have a tooltip but are now visible
if (!m_hTooltip)
- m_hTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, g_hInst, nullptr);
+ m_hTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, g_plugin.getInst(), nullptr);
- TOOLINFO ti = { sizeof(TOOLINFO), TTF_SUBCLASS, m_hWnd, UINT_PTR(i+1), m_Items[i].rItem, nullptr,
+ TOOLINFO ti = { sizeof(TOOLINFO), TTF_SUBCLASS, m_hWnd, UINT_PTR(i + 1), m_Items[i].rItem, nullptr,
const_cast<wchar_t*>(m_Items[i].tooltip.c_str()), // lpszText
};
diff --git a/plugins/HistoryStats/src/dlgconfigure.cpp b/plugins/HistoryStats/src/dlgconfigure.cpp index 6aaa746b35..d8e8fc0994 100644 --- a/plugins/HistoryStats/src/dlgconfigure.cpp +++ b/plugins/HistoryStats/src/dlgconfigure.cpp @@ -70,7 +70,7 @@ INT_PTR CALLBACK DlgConfigure::staticConfigureProc(HWND hDlg, UINT msg, WPARAM w pMMI->ptMinTrackSize = sizeMin;
}
- return TRUE;
+ return TRUE;
}
return FALSE;
@@ -99,17 +99,17 @@ void DlgConfigure::showModal() if (IsWindow(m_hCfgWnd))
SetForegroundWindow(m_hCfgWnd);
else
- CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_CONFIGURE), nullptr, staticConfigureProc);
+ CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONFIGURE), nullptr, staticConfigureProc);
}
void DlgConfigure::onWMInitDialog()
{
TranslateDialogDefault(m_hWnd);
utils::centerDialog(m_hWnd);
- SendMessage(m_hWnd, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
+ SendMessage(m_hWnd, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_HISTORYSTATS))));
EnableWindow(GetDlgItem(m_hWnd, IDC_APPLY), FALSE);
- m_hOptWnd = CreateDialogA(g_hInst, MAKEINTRESOURCEA(IDD_OPTIONS), m_hWnd, DlgOption::staticDlgProc);
+ m_hOptWnd = CreateDialogA(g_plugin.getInst(), MAKEINTRESOURCEA(IDD_OPTIONS), m_hWnd, DlgOption::staticDlgProc);
ShowWindow(m_hOptWnd, SW_SHOW);
SetFocus(m_hOptWnd);
diff --git a/plugins/HistoryStats/src/dlgfilterwords.cpp b/plugins/HistoryStats/src/dlgfilterwords.cpp index aea8892a06..954b277688 100644 --- a/plugins/HistoryStats/src/dlgfilterwords.cpp +++ b/plugins/HistoryStats/src/dlgfilterwords.cpp @@ -39,13 +39,13 @@ INT_PTR CALLBACK DlgFilterWords::staticDlgProc(HWND hDlg, UINT msg, WPARAM wPara case WM_NOTIFY:
switch (reinterpret_cast<NMHDR*>(lParam)->idFrom) {
case IDC_BAND:
- {
- BandCtrl::NMBANDCTRL* pNM = reinterpret_cast<BandCtrl::NMBANDCTRL*>(lParam);
+ {
+ BandCtrl::NMBANDCTRL* pNM = reinterpret_cast<BandCtrl::NMBANDCTRL*>(lParam);
- if (pNM->hdr.code == BandCtrl::BCN_CLICKED)
- pDlg->onBandClicked(pNM->hButton, pNM->dwData);
- }
- break;
+ if (pNM->hdr.code == BandCtrl::BCN_CLICKED)
+ pDlg->onBandClicked(pNM->hButton, pNM->dwData);
+ }
+ break;
case IDC_SETS:
OptionsCtrl::NMOPTIONSCTRL * pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
@@ -68,7 +68,7 @@ void DlgFilterWords::onWMInitDialog() {
TranslateDialogDefault(m_hWnd);
- SendMessage(m_hWnd, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
+ SendMessage(m_hWnd, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_HISTORYSTATS))));
utils::centerDialog(m_hWnd);
@@ -87,7 +87,7 @@ void DlgFilterWords::onWMInitDialog() array_each_(i, columnBand)
{
- HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(columnBand[i].iconId), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0));
+ HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(columnBand[i].iconId), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0));
DWORD dwFlags = (columnBand[i].bDisabled ? BandCtrl::BCF_DISABLED : 0);
m_hActionButtons[i] = m_Band.addButton(dwFlags, hIcon, i, TranslateW(columnBand[i].szTooltip));
@@ -308,7 +308,7 @@ DlgFilterWords::~DlgFilterWords() bool DlgFilterWords::showModal(HWND hParent)
{
- return (DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_FILTERWORDS), hParent, staticDlgProc, reinterpret_cast<LPARAM>(this)) == 1);
+ return (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILTERWORDS), hParent, staticDlgProc, reinterpret_cast<LPARAM>(this)) == 1);
}
void DlgFilterWords::setFilters(const FilterSet& Filters)
diff --git a/plugins/HistoryStats/src/dlgoption.cpp b/plugins/HistoryStats/src/dlgoption.cpp index 07c9e3ac47..9a89cdf9c5 100644 --- a/plugins/HistoryStats/src/dlgoption.cpp +++ b/plugins/HistoryStats/src/dlgoption.cpp @@ -30,7 +30,7 @@ INT_PTR CALLBACK DlgOption::staticDlgProc(HWND hDlg, UINT msg, WPARAM, LPARAM lP return TRUE;
case WM_NOTIFY:
- NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
+ NMHDR * p = reinterpret_cast<NMHDR*>(lParam);
switch (p->idFrom) {
case 0:
if (p->code == PSN_APPLY)
@@ -109,7 +109,7 @@ void DlgOption::onWMInitDialog() array_each_(i, pageBand)
{
- HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(pageBand[i].iconId), IMAGE_ICON, 32, 32, 0));
+ HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(pageBand[i].iconId), IMAGE_ICON, 32, 32, 0));
DWORD dwFlags = 0;
dwFlags |= pageBand[i].bRight ? BandCtrl::BCF_RIGHT : 0;
@@ -159,8 +159,8 @@ void DlgOption::onRunStats() {
if (m_bSettingsModified) {
int svar = MessageBox(m_hWnd,
- TranslateT("You have unsaved settings. Do you want to save before running HistoryStats?"),
- TranslateT("HistoryStats"), MB_YESNOCANCEL);
+ TranslateT("You have unsaved settings. Do you want to save before running HistoryStats?"),
+ TranslateT("HistoryStats"), MB_YESNOCANCEL);
if (svar == IDYES)
saveSettings();
@@ -168,7 +168,7 @@ void DlgOption::onRunStats() return;
}
- Statistic::run(*g_pSettings, Statistic::fromOptions, g_hInst, m_hWnd);
+ Statistic::run(*g_pSettings, Statistic::fromOptions, g_plugin.getInst(), m_hWnd);
}
void DlgOption::onBandClicked(HANDLE hButton, INT_PTR dwData)
diff --git a/plugins/HistoryStats/src/dlgoption_subbase.cpp b/plugins/HistoryStats/src/dlgoption_subbase.cpp index fca95cf406..813f01a8c6 100644 --- a/plugins/HistoryStats/src/dlgoption_subbase.cpp +++ b/plugins/HistoryStats/src/dlgoption_subbase.cpp @@ -44,7 +44,7 @@ void DlgOption::SubBase::createWindow(DlgOption* pParent, WORD nDlgResource, con m_pParent = pParent;
CreateDialogParam(
- g_hInst,
+ g_plugin.getInst(),
MAKEINTRESOURCE(nDlgResource),
m_pParent->getHWnd(),
staticDlgProc,
diff --git a/plugins/HistoryStats/src/dlgoption_subcolumns.cpp b/plugins/HistoryStats/src/dlgoption_subcolumns.cpp index 54484d1877..6d6a28f9db 100644 --- a/plugins/HistoryStats/src/dlgoption_subcolumns.cpp +++ b/plugins/HistoryStats/src/dlgoption_subcolumns.cpp @@ -17,7 +17,7 @@ INT_PTR CALLBACK DlgOption::SubColumns::staticAddProc(HWND hDlg, UINT msg, WPARA case WM_INITDIALOG:
TranslateDialogDefault(hDlg);
- SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
+ SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_HISTORYSTATS))));
utils::centerDialog(hDlg);
@@ -37,11 +37,11 @@ INT_PTR CALLBACK DlgOption::SubColumns::staticAddProc(HWND hDlg, UINT msg, WPARA case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
- {
- int nIndex = SendMessage(hWndList, LB_GETCURSEL, 0, 0);
- EndDialog(hDlg, nIndex);
- }
- return TRUE;
+ {
+ int nIndex = SendMessage(hWndList, LB_GETCURSEL, 0, 0);
+ EndDialog(hDlg, nIndex);
+ }
+ return TRUE;
case IDCANCEL:
EndDialog(hDlg, -1);
@@ -95,52 +95,52 @@ BOOL DlgOption::SubColumns::handleMsg(UINT msg, WPARAM wParam, LPARAM lParam) case WM_NOTIFY:
switch (reinterpret_cast<NMHDR*>(lParam)->idFrom) {
case IDC_BAND:
- {
- BandCtrl::NMBANDCTRL* pNM = reinterpret_cast<BandCtrl::NMBANDCTRL*>(lParam);
- if (pNM->hdr.code == BandCtrl::BCN_CLICKED)
- onBandClicked(pNM->hButton, pNM->dwData);
- else if (pNM->hdr.code == BandCtrl::BCN_DROP_DOWN)
- onBandDropDown(pNM->hButton, pNM->dwData);
- }
- break;
+ {
+ BandCtrl::NMBANDCTRL* pNM = reinterpret_cast<BandCtrl::NMBANDCTRL*>(lParam);
+ if (pNM->hdr.code == BandCtrl::BCN_CLICKED)
+ onBandClicked(pNM->hButton, pNM->dwData);
+ else if (pNM->hdr.code == BandCtrl::BCN_DROP_DOWN)
+ onBandDropDown(pNM->hButton, pNM->dwData);
+ }
+ break;
case IDC_COLUMNS:
- {
- OptionsCtrl::NMOPTIONSCTRL* pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
- if (pNM->hdr.code == OptionsCtrl::OCN_MODIFIED) {
- getParent()->settingsChanged();
- getParent()->updateProblemInfo();
- }
- else if (pNM->hdr.code == OptionsCtrl::OCN_SELCHANGED) {
- onColSelChanged(pNM->hItem, pNM->dwData);
- }
- else if (pNM->hdr.code == OptionsCtrl::OCN_SELCHANGING) {
- onColSelChanging(pNM->hItem, pNM->dwData);
- }
- else if (pNM->hdr.code == OptionsCtrl::OCN_ITEMDROPPED) {
- OptionsCtrl::NMOPTIONSCTRLDROP* pNM2 = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRLDROP*>(pNM);
+ {
+ OptionsCtrl::NMOPTIONSCTRL* pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
+ if (pNM->hdr.code == OptionsCtrl::OCN_MODIFIED) {
+ getParent()->settingsChanged();
+ getParent()->updateProblemInfo();
+ }
+ else if (pNM->hdr.code == OptionsCtrl::OCN_SELCHANGED) {
+ onColSelChanged(pNM->hItem, pNM->dwData);
+ }
+ else if (pNM->hdr.code == OptionsCtrl::OCN_SELCHANGING) {
+ onColSelChanging(pNM->hItem, pNM->dwData);
+ }
+ else if (pNM->hdr.code == OptionsCtrl::OCN_ITEMDROPPED) {
+ OptionsCtrl::NMOPTIONSCTRLDROP* pNM2 = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRLDROP*>(pNM);
- onColItemDropped(pNM2->hItem, pNM2->hDropTarget, pNM2->bAbove);
- }
+ onColItemDropped(pNM2->hItem, pNM2->hDropTarget, pNM2->bAbove);
}
- break;
+ }
+ break;
case IDC_OPTIONS:
- {
- OptionsCtrl::NMOPTIONSCTRL * pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
+ {
+ OptionsCtrl::NMOPTIONSCTRL * pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
- if (pNM->hdr.code == OptionsCtrl::OCN_MODIFIED)
- getParent()->settingsChanged();
- else if (pNM->hdr.code == OptionsCtrl::OCN_CLICKED)
- onColumnButton(pNM->hItem, pNM->dwData);
- }
- break;
+ if (pNM->hdr.code == OptionsCtrl::OCN_MODIFIED)
+ getParent()->settingsChanged();
+ else if (pNM->hdr.code == OptionsCtrl::OCN_CLICKED)
+ onColumnButton(pNM->hItem, pNM->dwData);
+ }
+ break;
case IDC_INFO:
- NMTREEVIEW* pNM = reinterpret_cast<NMTREEVIEW*>(lParam);
+ NMTREEVIEW * pNM = reinterpret_cast<NMTREEVIEW*>(lParam);
if (pNM->hdr.code == TVN_ITEMEXPANDING) {
if (pNM->action == TVE_COLLAPSE || pNM->action == TVE_COLLAPSERESET ||
- (pNM->action == TVE_TOGGLE && pNM->itemNew.state & TVIS_EXPANDED)) {
+ (pNM->action == TVE_TOGGLE && pNM->itemNew.state & TVIS_EXPANDED)) {
SetWindowLongPtr(getHWnd(), DWLP_MSGRESULT, TRUE);
return TRUE;
}
@@ -177,7 +177,7 @@ void DlgOption::SubColumns::onWMInitDialog() array_each_(i, columnBand)
{
- HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(columnBand[i].iconId), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0));
+ HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(columnBand[i].iconId), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0));
DWORD dwFlags =
(columnBand[i].bRight ? BandCtrl::BCF_RIGHT : 0) |
(columnBand[i].bDropDown ? BandCtrl::BCF_DROPDOWN : 0) |
@@ -561,7 +561,7 @@ void DlgOption::SubColumns::onBandDropDown(HANDLE hButton, INT_PTR dwData) void DlgOption::SubColumns::onAdd()
{
- int nCol = DialogBox(g_hInst, MAKEINTRESOURCE(IDD_COLADD), getHWnd(), staticAddProc);
+ int nCol = DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_COLADD), getHWnd(), staticAddProc);
addCol(nCol);
}
@@ -662,7 +662,7 @@ bool DlgOption::SubColumns::configHasConflicts(HelpVec* pHelp) // sanity check: either HTML or PNG has to be fully supported
if ((restrictions & Column::crHTMLMask) != Column::crHTMLFull &&
- (restrictions & Column::crPNGMask) != Column::crPNGFull) {
+ (restrictions & Column::crPNGMask) != Column::crPNGFull) {
MessageBox(nullptr,
TranslateT("An internal column configuration error occurred. Please contact the author of this plugin."),
TranslateT("HistoryStats - Error"), MB_ICONERROR | MB_OK);
@@ -688,9 +688,9 @@ bool DlgOption::SubColumns::configHasConflicts(HelpVec* pHelp) // PNG output but only partial PNG support (enforce mode) -or-
// PNG output with alternative full HTML-only support (fallback mode)
if (bPNGOutput &&
- (restrictions & Column::crPNGMask) == Column::crPNGPartial &&
- (restrictions & Column::crHTMLMask) == Column::crHTMLFull &&
- nPNGMode != Settings::pmPreferHTML) {
+ (restrictions & Column::crPNGMask) == Column::crPNGPartial &&
+ (restrictions & Column::crHTMLMask) == Column::crHTMLFull &&
+ nPNGMode != Settings::pmPreferHTML) {
if (pHelp) {
pHelp->push_back(HelpPair());
@@ -708,8 +708,7 @@ bool DlgOption::SubColumns::configHasConflicts(HelpVec* pHelp) ++nConflicts;
break;
}
- }
- while (false);
+ } while (false);
}
}
diff --git a/plugins/HistoryStats/src/dlgoption_subglobal.cpp b/plugins/HistoryStats/src/dlgoption_subglobal.cpp index 5f340c857e..0b3d16c9e3 100644 --- a/plugins/HistoryStats/src/dlgoption_subglobal.cpp +++ b/plugins/HistoryStats/src/dlgoption_subglobal.cpp @@ -14,7 +14,7 @@ INT_PTR CALLBACK DlgOption::SubGlobal::staticInfoProc(HWND hDlg, UINT msg, WPARA TranslateDialogDefault(hDlg);
{
- SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
+ SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_HISTORYSTATS))));
utils::centerDialog(hDlg);
@@ -165,7 +165,7 @@ BOOL DlgOption::SubGlobal::handleMsg(UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_NOTIFY:
- NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
+ NMHDR * p = reinterpret_cast<NMHDR*>(lParam);
if (p->idFrom == IDC_INFO) {
NMTREEVIEW* pNM = reinterpret_cast<NMTREEVIEW*>(lParam);
@@ -190,7 +190,7 @@ BOOL DlgOption::SubGlobal::handleMsg(UINT msg, WPARAM wParam, LPARAM lParam) }
else if (p->code == TVN_ITEMEXPANDING) {
if (pNM->action == TVE_COLLAPSE || pNM->action == TVE_COLLAPSERESET ||
- (pNM->action == TVE_TOGGLE && pNM->itemNew.state & TVIS_EXPANDED)) {
+ (pNM->action == TVE_TOGGLE && pNM->itemNew.state & TVIS_EXPANDED)) {
SetWindowLongPtr(getHWnd(), DWLP_MSGRESULT, TRUE);
return TRUE;
}
@@ -387,5 +387,5 @@ void DlgOption::SubGlobal::toggleInfo() void DlgOption::SubGlobal::onShowSupportInfo(const SupportInfo& info)
{
- DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_SUPPORTINFO), getHWnd(), staticInfoProc, reinterpret_cast<LPARAM>(&info));
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SUPPORTINFO), getHWnd(), staticInfoProc, reinterpret_cast<LPARAM>(&info));
}
diff --git a/plugins/HistoryStats/src/iconlib.cpp b/plugins/HistoryStats/src/iconlib.cpp index 0fa5d6a40e..e8241df759 100644 --- a/plugins/HistoryStats/src/iconlib.cpp +++ b/plugins/HistoryStats/src/iconlib.cpp @@ -60,7 +60,7 @@ void IconLib::init() char szModule[MAX_PATH];
- GetModuleFileNameA(g_hInst, szModule, MAX_PATH);
+ GetModuleFileNameA(g_plugin.getInst(), szModule, MAX_PATH);
m_Section = L"HistoryStats";
m_IconName = "historystats_";
@@ -98,7 +98,7 @@ void IconLib::init() array_each_(i, m_IconInfo)
{
m_IconInfo[i].hIcon = reinterpret_cast<HICON>(LoadImage(
- g_hInst,
+ g_plugin.getInst(),
MAKEINTRESOURCE(m_IconInfo[i].wID),
IMAGE_ICON,
OS::smIconCX(),
diff --git a/plugins/HistoryStats/src/main.cpp b/plugins/HistoryStats/src/main.cpp index 432ae9ce7e..1ac0efb40e 100644 --- a/plugins/HistoryStats/src/main.cpp +++ b/plugins/HistoryStats/src/main.cpp @@ -11,7 +11,7 @@ #include "iconlib.h"
#include "dlgconfigure.h"
-HINSTANCE g_hInst;
+CMPlugin g_plugin;
int hLangpack;
static const int g_pluginFileListID = 2535;
@@ -31,20 +31,20 @@ PLUGININFOEX g_pluginInfoEx = { SettingsSerializer* g_pSettings = nullptr;
-bool g_bMainMenuExists = false;
+bool g_bMainMenuExists = false;
bool g_bContactMenuExists = false;
-bool g_bExcludeLock = false;
-bool g_bConfigureLock = false;
+bool g_bExcludeLock = false;
+bool g_bConfigureLock = false;
static HGENMENU g_hMenuCreateStatistics = nullptr;
-static HGENMENU g_hMenuShowStatistics = nullptr;
-static HGENMENU g_hMenuConfigure = nullptr;
-static HGENMENU g_hMenuToggleExclude = nullptr;
+static HGENMENU g_hMenuShowStatistics = nullptr;
+static HGENMENU g_hMenuConfigure = nullptr;
+static HGENMENU g_hMenuToggleExclude = nullptr;
#if defined(HISTORYSTATS_HISTORYCOPY)
- static HGENMENU g_hMenuHistoryCopy = NULL;
- static HGENMENU g_hMenuHistoryPaste = NULL;
- static HGENMENU g_hHistoryCopyContact = NULL;
+static HGENMENU g_hMenuHistoryCopy = NULL;
+static HGENMENU g_hMenuHistoryPaste = NULL;
+static HGENMENU g_hHistoryCopyContact = NULL;
#endif
/////////////////////////////////////////////////////////////////////////////////////////
@@ -108,7 +108,7 @@ static void MenuIconsChanged(LPARAM) static INT_PTR MenuCreateStatistics(WPARAM, LPARAM)
{
- Statistic::run(*g_pSettings, Statistic::fromMenu, g_hInst);
+ Statistic::run(*g_pSettings, Statistic::fromMenu, g_plugin.getInst());
return 0;
}
@@ -202,64 +202,64 @@ static INT_PTR MenuHistoryPaste(WPARAM wParam, LPARAM lParam) % L"#{target_name}" * mu::clist::getContactDisplayName(hTarget)
% L"#{target_proto}" * utils::fromA(GetContactProto(hTarget)));
- if (MessageBox(0, strConfirm.c_str(), TranslateT("HistoryStats - Confirm")), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2) != IDYES)
+ if (MessageBox(0, strConfirm.c_str(), TranslateT("HistoryStats - Confirm")), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2) != IDYES)
{
- return 0;
+ return 0;
}
- // turn off safety mode
- mu::db::setSafetyMode(false);
+ // turn off safety mode
+ mu::db::setSafetyMode(false);
- // copy history
- DWORD dwCountSuccess = 0, dwCountFailRead = 0, dwCountFailAdd = 0;
- DBEVENTINFO dbe;
- int blobBuffer = 4096;
- HANDLE hEvent = mu::db_event::findFirst(g_hHistoryCopyContact);
+ // copy history
+ DWORD dwCountSuccess = 0, dwCountFailRead = 0, dwCountFailAdd = 0;
+ DBEVENTINFO dbe;
+ int blobBuffer = 4096;
+ HANDLE hEvent = mu::db_event::findFirst(g_hHistoryCopyContact);
- memset(&dbe, 0, sizeof(dbe));
- dbe.cbSize = sizeof(dbe);
- dbe.pBlob = reinterpret_cast<BYTE*>(malloc(blobBuffer));
+ memset(&dbe, 0, sizeof(dbe));
+ dbe.cbSize = sizeof(dbe);
+ dbe.pBlob = reinterpret_cast<BYTE*>(malloc(blobBuffer));
- while (hEvent)
- {
- dbe.cbBlob = db_event_getBlobSize(hEvent);
-
- if (blobBuffer < dbe.cbBlob)
+ while (hEvent)
{
- blobBuffer = 4096 * ((4095 + dbe.cbBlob) / 4096);
- dbe.pBlob = reinterpret_cast<BYTE*>(realloc(dbe.pBlob, blobBuffer));
- }
+ dbe.cbBlob = db_event_getBlobSize(hEvent);
- if (db_event_get(hEvent, &dbe) == 0) {
- ++dwCountSuccess;
+ if (blobBuffer < dbe.cbBlob)
+ {
+ blobBuffer = 4096 * ((4095 + dbe.cbBlob) / 4096);
+ dbe.pBlob = reinterpret_cast<BYTE*>(realloc(dbe.pBlob, blobBuffer));
+ }
- // clear "first" flag
- dbe.flags &= ~DBEF_FIRST;
+ if (db_event_get(hEvent, &dbe) == 0) {
+ ++dwCountSuccess;
- if (mu::db_event::add(hTarget, &dbe) == NULL)
- ++dwCountFailAdd;
- }
- else ++dwCountFailRead;
+ // clear "first" flag
+ dbe.flags &= ~DBEF_FIRST;
- hEvent = db_event_findNext(hEvent);
- }
+ if (mu::db_event::add(hTarget, &dbe) == NULL)
+ ++dwCountFailAdd;
+ }
+ else ++dwCountFailRead;
- free(dbe.pBlob);
+ hEvent = db_event_findNext(hEvent);
+ }
- // turn safety mode back on
- mu::db::setSafetyMode(true);
+ free(dbe.pBlob);
- // output summary
- ext::string strSummary = ext::str(ext::kformat(TranslateT("Successfully read #{success} events of which #{fail_add} couldn't be added to the target history. #{fail} events couldn't be read from the source history.")))
- % L"#{success}" * dwCountSuccess
- % L"#{fail}" * dwCountFailRead
- % L"#{fail_add}" * dwCountFailAdd);
+ // turn safety mode back on
+ mu::db::setSafetyMode(true);
- MessageBox(0, strSummary.c_str(), TranslateT("HistoryStats - Information")), MB_ICONINFORMATION);
+ // output summary
+ ext::string strSummary = ext::str(ext::kformat(TranslateT("Successfully read #{success} events of which #{fail_add} couldn't be added to the target history. #{fail} events couldn't be read from the source history.")))
+ % L"#{success}" * dwCountSuccess
+ % L"#{fail}" * dwCountFailRead
+ % L"#{fail_add}" * dwCountFailAdd);
- g_hHistoryCopyContact = NULL;
+ MessageBox(0, strSummary.c_str(), TranslateT("HistoryStats - Information")), MB_ICONINFORMATION);
- return 0;
+ g_hHistoryCopyContact = NULL;
+
+ return 0;
}
#endif
@@ -317,15 +317,15 @@ void AddContactMenu() NULL,
con::SvcHistoryCopy);
- g_hMenuHistoryPaste = mu::clist::addContactMenuItem(
- LPGENW("Paste history...")), // MEMO: implicit translation
- 0,
- 800002,
- NULL,
- con::SvcHistoryPaste);
+ g_hMenuHistoryPaste = mu::clist::addContactMenuItem(
+ LPGENW("Paste history...")), // MEMO: implicit translation
+ 0,
+ 800002,
+ NULL,
+ con::SvcHistoryPaste);
#endif
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, EventPreBuildContactMenu);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, EventPreBuildContactMenu);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -340,7 +340,7 @@ static int EventOptInitialise(WPARAM wParam, LPARAM) nullptr,
DlgOption::staticDlgProc,
MAKEINTRESOURCEA(IDD_OPTIONS),
- g_hInst);
+ g_plugin.getInst());
return 0;
}
@@ -370,7 +370,7 @@ static int EventModulesLoaded(WPARAM, LPARAM) // create statistics on startup, if activated
if (g_pSettings->m_OnStartup)
- Statistic::run(*g_pSettings, Statistic::fromStartup, g_hInst);
+ Statistic::run(*g_pSettings, Statistic::fromStartup, g_plugin.getInst());
return 0;
}
@@ -378,18 +378,6 @@ static int EventModulesLoaded(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
// external interface
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID)
-{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(hinstDLL);
- g_hInst = hinstDLL;
- break;
- }
-
- return TRUE;
-}
-
extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
OutputDebugString(L"HistoryStats: MirandaPluginInfoEx() was called.\n");
@@ -416,7 +404,7 @@ extern "C" __declspec(dllexport) int Load() return 1;
}
-
+
// load "mu" system (includes version check)
if (!mu::load())
{
@@ -437,7 +425,7 @@ extern "C" __declspec(dllexport) int Load() // load rtfconv.dll if available
RTFFilter::init();
-
+
// init global variables
g_bMainMenuExists = false;
g_bContactMenuExists = false;
diff --git a/plugins/HistoryStats/src/main.h b/plugins/HistoryStats/src/main.h index 7f34285023..a2dffb20c6 100644 --- a/plugins/HistoryStats/src/main.h +++ b/plugins/HistoryStats/src/main.h @@ -7,8 +7,6 @@ #include "settingsserializer.h"
#include "statistic.h"
-extern HINSTANCE g_hInst;
-
extern PLUGININFOEX g_pluginInfoEx;
extern SettingsSerializer* g_pSettings;
diff --git a/plugins/HistoryStats/src/optionsctrlimpl.cpp b/plugins/HistoryStats/src/optionsctrlimpl.cpp index 9b4a1333e8..1c6c0149a2 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl.cpp @@ -18,17 +18,17 @@ LRESULT CALLBACK OptionsCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wPar switch (msg) {
case WM_NCCREATE:
- {
- CREATESTRUCT* pCS = reinterpret_cast<CREATESTRUCT*>(lParam);
+ {
+ CREATESTRUCT* pCS = reinterpret_cast<CREATESTRUCT*>(lParam);
- pCS->style &= ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
- pCS->style |= WS_CHILD;
- pCS->dwExStyle &= ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE | WS_EX_WINDOWEDGE);
+ pCS->style &= ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
+ pCS->style |= WS_CHILD;
+ pCS->dwExStyle &= ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE | WS_EX_WINDOWEDGE);
- pCtrl = new OptionsCtrlImpl(hWnd, reinterpret_cast<INT_PTR>(pCS->hMenu));
- SetWindowLongPtr(hWnd, 0, reinterpret_cast<INT_PTR>(pCtrl));
- }
- return pCtrl ? TRUE : FALSE;
+ pCtrl = new OptionsCtrlImpl(hWnd, reinterpret_cast<INT_PTR>(pCS->hMenu));
+ SetWindowLongPtr(hWnd, 0, reinterpret_cast<INT_PTR>(pCtrl));
+ }
+ return pCtrl ? TRUE : FALSE;
case WM_CREATE:
return pCtrl->onWMCreate(reinterpret_cast<CREATESTRUCT*>(lParam));
@@ -54,69 +54,69 @@ LRESULT CALLBACK OptionsCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wPar return SendMessage(pCtrl->m_hTree, WM_SETFONT, wParam, lParam);
case WM_WINDOWPOSCHANGED:
- {
- WINDOWPOS* pWP = reinterpret_cast<WINDOWPOS*>(lParam);
- SetWindowPos(pCtrl->m_hTree, nullptr, 0, 0, pWP->cx, pWP->cy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
- }
- return 0;
+ {
+ WINDOWPOS* pWP = reinterpret_cast<WINDOWPOS*>(lParam);
+ SetWindowPos(pCtrl->m_hTree, nullptr, 0, 0, pWP->cx, pWP->cy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
+ }
+ return 0;
case WM_SETREDRAW:
return SendMessage(pCtrl->m_hTree, WM_SETREDRAW, wParam, lParam);
case WM_NOTIFY:
- {
- NMHDR* pNM = reinterpret_cast<NMHDR*>(lParam);
- if (pNM->hwndFrom == pCtrl->m_hTree) {
- switch (pNM->code) {
- case NM_CLICK:
- pCtrl->onNMClick();
- return 0;
-
- case NM_CUSTOMDRAW:
- return pCtrl->onNMCustomDraw(reinterpret_cast<NMTVCUSTOMDRAW*>(pNM));
-
- case NM_KILLFOCUS:
- pCtrl->onNMKillFocus();
- return 0;
-
- case TVN_ITEMEXPANDING:
- return pCtrl->onTVNItemExpanding(reinterpret_cast<NMTREEVIEW*>(pNM));
-
- case TVN_DELETEITEM:
- pCtrl->onTVNDeleteItem(reinterpret_cast<NMTREEVIEW*>(pNM));
- return 0;
-
- case TVN_SELCHANGING:
- pCtrl->onTVNSelChanging(reinterpret_cast<NMTREEVIEW*>(pNM));
- return 0;
-
- case TVN_SELCHANGED:
- pCtrl->onTVNSelChanged(reinterpret_cast<NMTREEVIEW*>(pNM));
- return 0;
-
- case TVN_BEGINDRAG:
- pCtrl->onTVNBeginDrag(reinterpret_cast<NMTREEVIEW*>(pNM));
- return 0;
- }
+ {
+ NMHDR* pNM = reinterpret_cast<NMHDR*>(lParam);
+ if (pNM->hwndFrom == pCtrl->m_hTree) {
+ switch (pNM->code) {
+ case NM_CLICK:
+ pCtrl->onNMClick();
+ return 0;
+
+ case NM_CUSTOMDRAW:
+ return pCtrl->onNMCustomDraw(reinterpret_cast<NMTVCUSTOMDRAW*>(pNM));
+
+ case NM_KILLFOCUS:
+ pCtrl->onNMKillFocus();
+ return 0;
+
+ case TVN_ITEMEXPANDING:
+ return pCtrl->onTVNItemExpanding(reinterpret_cast<NMTREEVIEW*>(pNM));
+
+ case TVN_DELETEITEM:
+ pCtrl->onTVNDeleteItem(reinterpret_cast<NMTREEVIEW*>(pNM));
+ return 0;
+
+ case TVN_SELCHANGING:
+ pCtrl->onTVNSelChanging(reinterpret_cast<NMTREEVIEW*>(pNM));
+ return 0;
+
+ case TVN_SELCHANGED:
+ pCtrl->onTVNSelChanged(reinterpret_cast<NMTREEVIEW*>(pNM));
+ return 0;
+
+ case TVN_BEGINDRAG:
+ pCtrl->onTVNBeginDrag(reinterpret_cast<NMTREEVIEW*>(pNM));
+ return 0;
}
}
- break;
+ }
+ break;
case WM_MOUSEMOVE:
- {
- POINTS pts = MAKEPOINTS(lParam);
- POINT pt = { pts.x, pts.y };
- pCtrl->onWMMouseMove(pt);
- }
- return 0;
+ {
+ POINTS pts = MAKEPOINTS(lParam);
+ POINT pt = { pts.x, pts.y };
+ pCtrl->onWMMouseMove(pt);
+ }
+ return 0;
case WM_LBUTTONUP:
- {
- POINTS pts = MAKEPOINTS(lParam);
- POINT pt = { pts.x, pts.y };
- pCtrl->onWMLButtonUp(pt);
- }
- return 0;
+ {
+ POINTS pts = MAKEPOINTS(lParam);
+ POINT pt = { pts.x, pts.y };
+ pCtrl->onWMLButtonUp(pt);
+ }
+ return 0;
case OCM_INSERTGROUP:
return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertGroup(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCGROUP*>(lParam)));
@@ -315,7 +315,7 @@ LRESULT CALLBACK OptionsCtrlImpl::staticTreeProc(HWND hTree, UINT msg, WPARAM wP break;
case WM_NOTIFY:
- NMHDR* pNM = reinterpret_cast<NMHDR*>(lParam);
+ NMHDR * pNM = reinterpret_cast<NMHDR*>(lParam);
if (pNM->idFrom == ccDateTime) {
if (pNM->code == DTN_DATETIMECHANGE)
@@ -389,7 +389,7 @@ bool OptionsCtrlImpl::registerClass() staticWndProc, // lpfnWndProc
0, // cbClsExtra
sizeof(OptionsCtrlImpl*), // cbWndExtra
- g_hInst, // hInstance
+ g_plugin.getInst(), // hInstance
nullptr, // hIcon
nullptr, // hCursor
nullptr, // hbrBackground
@@ -412,7 +412,7 @@ bool OptionsCtrlImpl::registerClass() void OptionsCtrlImpl::unregisterClass()
{
- UnregisterClass(m_ClassName, g_hInst);
+ UnregisterClass(m_ClassName, g_plugin.getInst());
}
OptionsCtrlImpl::OptionsCtrlImpl(HWND hWnd, UINT_PTR nOwnId) :
@@ -442,7 +442,7 @@ LRESULT OptionsCtrlImpl::onWMCreate(CREATESTRUCT* pCS) pCS->cy,
m_hWnd,
reinterpret_cast<HMENU>(ccTree),
- g_hInst,
+ g_plugin.getInst(),
nullptr);
if (!m_hTree)
@@ -497,7 +497,7 @@ LRESULT OptionsCtrlImpl::onNMCustomDraw(NMTVCUSTOMDRAW* pNMCustomDraw) return CDRF_NOTIFYITEMDRAW;
case CDDS_ITEMPREPAINT:
- Item* pItem = reinterpret_cast<Item*>(pNMCustomDraw->nmcd.lItemlParam);
+ Item * pItem = reinterpret_cast<Item*>(pNMCustomDraw->nmcd.lItemlParam);
if (pItem)
if (!pItem->m_bEnabled)
pNMCustomDraw->clrText = GetSysColor(COLOR_GRAYTEXT);
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_button.cpp b/plugins/HistoryStats/src/optionsctrlimpl_button.cpp index ebf47ae9ba..3c29971d7e 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_button.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_button.cpp @@ -47,7 +47,7 @@ void OptionsCtrlImpl::Button::onSelect() if (hTempWnd = CreateWindowEx(
0, WC_BUTTON, m_strButton.c_str(), dwStyle,
r.left, r.top, r.right - r.left, r.bottom - r.top,
- m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccButton), g_hInst, nullptr))
+ m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccButton), g_plugin.getInst(), nullptr))
{
SendMessage(hTempWnd, WM_SETFONT, reinterpret_cast<WPARAM>(hTreeFront), MAKELPARAM(TRUE, 0));
@@ -116,7 +116,7 @@ void OptionsCtrlImpl::Button::childAdded(Item* pChild) void OptionsCtrlImpl::Button::setLabel(const wchar_t* szLabel)
{
m_strLabel = szLabel;
-
+
// only if not showing button (otherwise update when button disappears)
if (!m_hButtonWnd)
{
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_color.cpp b/plugins/HistoryStats/src/optionsctrlimpl_color.cpp index b7ff993eed..171945b028 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_color.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_color.cpp @@ -16,7 +16,7 @@ OptionsCtrlImpl::Color::Color(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar : Item(pCtrl, itColor, szLabel, dwFlags, dwData)
, m_hColorWnd(nullptr)
, m_crColor(crColor)
-{
+{
m_pCtrl->insertItem(pParent, this, m_strLabel.c_str(), dwFlags, m_bEnabled ? siColor : siColorG);
if (pParent)
@@ -56,7 +56,7 @@ void OptionsCtrlImpl::Color::onSelect() if (hTempWnd = CreateWindowEx(
0, _A2W(WNDCLASS_COLOURPICKER), nullptr, dwStyle,
r.left, r.top, r.right - r.left, r.bottom - r.top,
- m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccColor), g_hInst, nullptr))
+ m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccColor), g_plugin.getInst(), nullptr))
{
SendMessage(hTempWnd, CPM_SETCOLOUR, 0, m_crColor);
@@ -133,7 +133,7 @@ void OptionsCtrlImpl::Color::childAdded(Item* pChild) void OptionsCtrlImpl::Color::setLabel(const wchar_t* szLabel)
{
m_strLabel = szLabel;
-
+
// only if not showing button (otherwise update when button disappears)
if (!m_hColorWnd)
{
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp b/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp index 5e8aa5bad6..8affd38574 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp @@ -88,7 +88,7 @@ void OptionsCtrlImpl::Combo::onSelect() if (hTempWnd = CreateWindowEx(
WS_EX_CLIENTEDGE, WC_COMBOBOX, L"", dwStyle,
r.left, r.top, r.right - r.left, (r.bottom - r.top) * 20,
- m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccCombo), g_hInst, nullptr))
+ m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccCombo), g_plugin.getInst(), nullptr))
{
vector_each_(i, m_Items)
{
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp b/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp index 9a089fc886..54c3ee7380 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp @@ -181,7 +181,7 @@ ext::string OptionsCtrlImpl::DateTime::getCombinedText() }
OptionsCtrlImpl::DateTime::DateTime(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, const wchar_t* szFormat, time_t timestamp, DWORD dwFlags, INT_PTR dwData)
-: Item(pCtrl, itDateTime, szLabel, dwFlags, dwData), m_hDateTimeWnd(nullptr), m_strFormat(szFormat), m_timestamp(timestamp)
+ : Item(pCtrl, itDateTime, szLabel, dwFlags, dwData), m_hDateTimeWnd(nullptr), m_strFormat(szFormat), m_timestamp(timestamp)
{
m_bDisableChildsOnNone = bool_(dwFlags & OCF_DISABLECHILDSONNONE);
m_bAllowNone = bool_(dwFlags & OCF_ALLOWNONE);
@@ -221,7 +221,7 @@ void OptionsCtrlImpl::DateTime::onSelect() if (hTempWnd = CreateWindowEx(
WS_EX_CLIENTEDGE, DATETIMEPICK_CLASS, L"", dwStyle,
r.left, r.top, r.right - r.left, r.bottom - r.top,
- m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccDateTime), g_hInst, nullptr)) {
+ m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccDateTime), g_plugin.getInst(), nullptr)) {
// restrict to dates a timestamp can hold (with 1 day less to avoid timezone issues)
SYSTEMTIME stMinMax[2] = { toSystemTime(0x00000000 + 24 * 60 * 60), toSystemTime(0x7FFFFFFF - 24 * 60 * 60) };
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp b/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp index df4991990b..d44346a126 100644 --- a/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp +++ b/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp @@ -43,7 +43,7 @@ OptionsCtrlImpl::Edit::Edit(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t {
m_strEdit = szEdit;
m_bNumber = bool_(dwFlags & OCF_NUMBER);
-
+
m_pCtrl->insertItem(pParent, this, getCombinedText().c_str(), dwFlags, m_bEnabled ? siEdit : siEditG);
if (pParent)
@@ -85,7 +85,7 @@ void OptionsCtrlImpl::Edit::onSelect() if (hTempWnd = CreateWindowEx(
WS_EX_CLIENTEDGE, WC_EDIT, m_strEdit.c_str(), dwStyle,
r.left, r.top, r.right - r.left, r.bottom - r.top,
- m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccEdit), g_hInst, nullptr))
+ m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccEdit), g_plugin.getInst(), nullptr))
{
SendMessage(hTempWnd, WM_SETFONT, reinterpret_cast<WPARAM>(hTreeFront), MAKELPARAM(TRUE, 0));
diff --git a/plugins/HistoryStats/src/statistic.cpp b/plugins/HistoryStats/src/statistic.cpp index 321ad138a7..aa131b3a91 100644 --- a/plugins/HistoryStats/src/statistic.cpp +++ b/plugins/HistoryStats/src/statistic.cpp @@ -200,7 +200,7 @@ ext::string Statistic::createFile(const ext::string& desiredName) if (!utils::pathExists(desiredPath)) {
if (!utils::createPath(desiredPath)) {
m_ErrorText = ext::str(ext::kformat(TranslateT("HistoryStats couldn't create a required folder (#{folder}).\r\n\r\nPlease check the output filename and additional output folder you have chosen for correctness. Additionally, please check whether the file, folder, and/or disk is writable."))
- % L"#{folder}" * desiredPath);
+ % L"#{folder}" * desiredPath);
}
}
@@ -231,7 +231,7 @@ bool Statistic::newFilePNG(Canvas& canvas, ext::string& finalURL) if (i == m_Images.end()) {
ext::string writeFile;
- if (!newFilePNG(writeFile, finalURL))
+ if (!newFilePNG(writeFile, finalURL))
return false;
canvas.writePNG(writeFile.c_str());
@@ -272,7 +272,7 @@ INT_PTR CALLBACK Statistic::staticProgressProc(HWND hDlg, UINT msg, WPARAM wPara switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hDlg);
- SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
+ SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_HISTORYSTATS))));
return TRUE;
case WM_DESTROY:
@@ -926,7 +926,7 @@ bool Statistic::stepWriteHTML() if (!ofs.good()) {
m_ErrorText = ext::str(ext::kformat(TranslateT("HistoryStats couldn't open the output file (#{file}) for write access.\r\n\r\nPlease check the output filename you have chosen for correctness. Additionally, please check whether the file, folder, and/or disk is writable."))
- % L"#{file}" * m_OutputFile);
+ % L"#{file}" * m_OutputFile);
return false;
}
@@ -1337,7 +1337,7 @@ INT_PTR CALLBACK Statistic::staticConflictProc(HWND hDlg, UINT uMsg, WPARAM wPar if (uMsg == WM_INITDIALOG) {
TranslateDialogDefault(hDlg);
- SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
+ SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_HISTORYSTATS))));
utils::centerDialog(hDlg);
diff --git a/plugins/HistoryStats/src/stdafx.h b/plugins/HistoryStats/src/stdafx.h index 6641d87c67..55e11acbb8 100644 --- a/plugins/HistoryStats/src/stdafx.h +++ b/plugins/HistoryStats/src/stdafx.h @@ -31,8 +31,6 @@ #define MIRANDA_VER 0x0A00
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_awaymsg.h> // not used
@@ -75,23 +73,23 @@ #include "version.h"
-/*
- * some patterns and similar stuff we want to use everywhere
- */
+ /*
+ * some patterns and similar stuff we want to use everywhere
+ */
#include "utils/pattern.h"
-/*
- * some language 'extensions' (people will hate me because of this) and useful classes
- */
+ /*
+ * some language 'extensions' (people will hate me because of this) and useful classes
+ */
#include "_langext.h"
#include "_strfunc.h"
#include "_format.h"
-/*
- * convenience typedefs
- */
+ /*
+ * convenience typedefs
+ */
namespace ext
{
@@ -126,4 +124,11 @@ namespace ext using namespace t;
}
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>("HistoryStats")
+ {}
+};
+
#endif // HISTORYSTATS_GUARD__GLOABLS_H
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index e73fb24e0c..176a87087e 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -169,7 +169,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke item = (BEventData*)bsearch(&ev, books, bookcnt, sizeof(BEventData), CompareBookmarks);
if (item != nullptr && item->Timestamp == dbei.timestamp) {
doDelete = FALSE;
- btshift = (--bookcnt - (item - books))*sizeof(BEventData);
+ btshift = (--bookcnt - (item - books)) * sizeof(BEventData);
if (btshift)
memmove(item, item + 1, btshift);
}
diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index e0fee84c71..84937354a5 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -21,8 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-HINSTANCE hInst;
-
+CMPlugin g_plugin;
int hLangpack;
LIST<void> g_hWindows(5, PtrKeySortT);
@@ -41,12 +40,6 @@ static PLUGININFOEX pluginInfoEx = { 0x1d9bf74a, 0x44a8, 0x4b3f, { 0xa6, 0xe5, 0x73, 0x6, 0x9d, 0x3a, 0x89, 0x79 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
int OnIconPressed(WPARAM hContact, LPARAM lParam)
{
StatusIconClickData *sicd = (StatusIconClickData *)lParam;
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index b6826d4c57..af1f911fb9 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -56,7 +56,7 @@ static HANDLE hIconLibItem[_countof(iconList)]; void InitIcons(void)
{
- Icon_Register(hInst, ModuleName, iconList, _countof(iconList), ModuleName);
+ Icon_Register(g_plugin.getInst(), ModuleName, iconList, _countof(iconList), ModuleName);
}
HICON LoadIconEx(const char* name)
@@ -228,7 +228,7 @@ INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) return TRUE;
case WM_NOTIFY:
- NMCLISTCONTROL *nmc = (NMCLISTCONTROL*)lParam;
+ NMCLISTCONTROL * nmc = (NMCLISTCONTROL*)lParam;
if (nmc->hdr.idFrom == 0 && nmc->hdr.code == (unsigned)PSN_APPLY)
SaveSettings(hwndDlg);
else if (nmc->hdr.idFrom == IDC_LIST) {
@@ -270,7 +270,7 @@ INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) int HSOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HISTORYSWEEPER);
odp.szTitle.a = ModuleName;
odp.szGroup.a = LPGEN("History");
diff --git a/plugins/HistorySweeperLight/src/stdafx.h b/plugins/HistorySweeperLight/src/stdafx.h index 1293f4ad9f..27d77a69d2 100644 --- a/plugins/HistorySweeperLight/src/stdafx.h +++ b/plugins/HistorySweeperLight/src/stdafx.h @@ -22,14 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __HISTORYSWEEPERLIGHT_H__
#if !defined( _WIN64 )
- #define _USE_32BIT_TIME_T
+#define _USE_32BIT_TIME_T
#endif
#include <windows.h>
#include <time.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <win2k.h>
#include <newpluginapi.h>
#include <m_database.h>
@@ -46,8 +44,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Plugin name
#define ModuleName "History Sweeper Light"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(ModuleName)
+ {}
+};
+
// main.c
-extern HINSTANCE hInst;
extern LIST<void> g_hWindows;
// options.c
diff --git a/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp b/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp index dce4f52a75..7910ed2219 100644 --- a/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp +++ b/plugins/HwHotKeys/src/HwHotKeys_DllMain.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 - 1307, USA. #include "stdafx.h"
-HINSTANCE hInstance;
+CMPlugin g_plugin;
int hLangpack;
HWND hDialogWnd = nullptr; // хэндл окна настроек, он глобально используется для вывода туда в реалтайме сканкодов клавы из хука
HHOOK hHook;
@@ -67,14 +67,6 @@ CHAR key_name_buffer[150]; // буфер куда печатается имя к // ============================================================================
-BOOL APIENTRY DllMain( HMODULE hModule, DWORD, LPVOID)
-{
- hInstance = hModule;
- return TRUE;
-}
-
-// ============================================================================
-
PLUGININFOEX PluginInfoEx = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -112,10 +104,10 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_OPT_INITIALISE, initializeOptions);
// установка хука для низкоуровневой обработки хоткеев
- hHook = SetWindowsHookExA(WH_KEYBOARD_LL, key_hook, hInstance, 0);
+ hHook = SetWindowsHookExA(WH_KEYBOARD_LL, key_hook, g_plugin.getInst(), 0);
-// StringCbPrintfA(key_name_buffer, 100, "hHook = 0x%x, Err = %u", hHook, GetLastError);
-// MessageBoxA(0, key_name_buffer, 0, 0);
+ // StringCbPrintfA(key_name_buffer, 100, "hHook = 0x%x, Err = %u", hHook, GetLastError);
+ // MessageBoxA(0, key_name_buffer, 0, 0);
return 0;
}
@@ -126,7 +118,7 @@ int initializeOptions(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE OptDlgPg = { sizeof(OptDlgPg) };
OptDlgPg.position = 100000000;
- OptDlgPg.hInstance = hInstance;
+ OptDlgPg.hInstance = g_plugin.getInst();
OptDlgPg.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
OptDlgPg.pszTemplate = MAKEINTRESOURCEA(dlg_options);
OptDlgPg.szGroup.w = LPGENW("Customize");
diff --git a/plugins/HwHotKeys/src/stdafx.h b/plugins/HwHotKeys/src/stdafx.h index 7c2ecb0b64..192862500f 100644 --- a/plugins/HwHotKeys/src/stdafx.h +++ b/plugins/HwHotKeys/src/stdafx.h @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 - 1307, USA. #include <SDKDDKVer.h>
#include <windows.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_langpack.h>
#include <m_database.h>
@@ -43,7 +41,13 @@ LRESULT CALLBACK key_hook(INT, WPARAM, LPARAM); extern CLIST_INTERFACE *pcli;
-extern HINSTANCE hInstance;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(__DbModName)
+ {}
+};
+
extern INT hLangpack;
extern HWND hDialogWnd; // глобально используется для вывода туда в реалтайме сканкодов клавы, из хука
extern HHOOK hHook;
|