From 56239fcddd46400d812d83e38597d593b5c0356d Mon Sep 17 00:00:00 2001 From: Mataes Date: Wed, 16 May 2018 22:58:35 +0300 Subject: HistoryLinkList, HistoryStats, historysweeperlight, httpserver, HwHotKeys: cmplugin adaptation --- plugins/HistoryStats/src/bandctrlimpl.cpp | 10 +- plugins/HistoryStats/src/dlgconfigure.cpp | 8 +- plugins/HistoryStats/src/dlgfilterwords.cpp | 18 +-- plugins/HistoryStats/src/dlgoption.cpp | 10 +- plugins/HistoryStats/src/dlgoption_subbase.cpp | 2 +- plugins/HistoryStats/src/dlgoption_subcolumns.cpp | 97 +++++++-------- plugins/HistoryStats/src/dlgoption_subglobal.cpp | 8 +- plugins/HistoryStats/src/iconlib.cpp | 4 +- plugins/HistoryStats/src/main.cpp | 138 ++++++++++----------- plugins/HistoryStats/src/main.h | 2 - plugins/HistoryStats/src/optionsctrlimpl.cpp | 132 ++++++++++---------- .../HistoryStats/src/optionsctrlimpl_button.cpp | 4 +- plugins/HistoryStats/src/optionsctrlimpl_color.cpp | 6 +- plugins/HistoryStats/src/optionsctrlimpl_combo.cpp | 2 +- .../HistoryStats/src/optionsctrlimpl_datetime.cpp | 4 +- plugins/HistoryStats/src/optionsctrlimpl_edit.cpp | 4 +- plugins/HistoryStats/src/statistic.cpp | 10 +- plugins/HistoryStats/src/stdafx.h | 27 ++-- 18 files changed, 238 insertions(+), 248 deletions(-) (limited to 'plugins/HistoryStats/src') 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(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_DROPDOWN), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0)); + m_hDDIcon = reinterpret_cast(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(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(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS)))); + SendMessage(m_hWnd, WM_SETICON, ICON_BIG, reinterpret_cast(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(lParam)->idFrom) { case IDC_BAND: - { - BandCtrl::NMBANDCTRL* pNM = reinterpret_cast(lParam); + { + BandCtrl::NMBANDCTRL* pNM = reinterpret_cast(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(lParam); @@ -68,7 +68,7 @@ void DlgFilterWords::onWMInitDialog() { TranslateDialogDefault(m_hWnd); - SendMessage(m_hWnd, WM_SETICON, ICON_BIG, reinterpret_cast(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS)))); + SendMessage(m_hWnd, WM_SETICON, ICON_BIG, reinterpret_cast(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(LoadImage(g_hInst, MAKEINTRESOURCE(columnBand[i].iconId), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0)); + HICON hIcon = reinterpret_cast(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(this)) == 1); + return (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILTERWORDS), hParent, staticDlgProc, reinterpret_cast(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(lParam); + NMHDR * p = reinterpret_cast(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(LoadImage(g_hInst, MAKEINTRESOURCE(pageBand[i].iconId), IMAGE_ICON, 32, 32, 0)); + HICON hIcon = reinterpret_cast(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(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS)))); + SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast(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(lParam)->idFrom) { case IDC_BAND: - { - BandCtrl::NMBANDCTRL* pNM = reinterpret_cast(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(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(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(pNM); + { + OptionsCtrl::NMOPTIONSCTRL* pNM = reinterpret_cast(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(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(lParam); + { + OptionsCtrl::NMOPTIONSCTRL * pNM = reinterpret_cast(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(lParam); + NMTREEVIEW * pNM = reinterpret_cast(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(LoadImage(g_hInst, MAKEINTRESOURCE(columnBand[i].iconId), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0)); + HICON hIcon = reinterpret_cast(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(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS)))); + SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast(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(lParam); + NMHDR * p = reinterpret_cast(lParam); if (p->idFrom == IDC_INFO) { NMTREEVIEW* pNM = reinterpret_cast(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(&info)); + DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SUPPORTINFO), getHWnd(), staticInfoProc, reinterpret_cast(&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(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(malloc(blobBuffer)); + memset(&dbe, 0, sizeof(dbe)); + dbe.cbSize = sizeof(dbe); + dbe.pBlob = reinterpret_cast(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(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(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(lParam); + { + CREATESTRUCT* pCS = reinterpret_cast(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(pCS->hMenu)); - SetWindowLongPtr(hWnd, 0, reinterpret_cast(pCtrl)); - } - return pCtrl ? TRUE : FALSE; + pCtrl = new OptionsCtrlImpl(hWnd, reinterpret_cast(pCS->hMenu)); + SetWindowLongPtr(hWnd, 0, reinterpret_cast(pCtrl)); + } + return pCtrl ? TRUE : FALSE; case WM_CREATE: return pCtrl->onWMCreate(reinterpret_cast(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(lParam); - SetWindowPos(pCtrl->m_hTree, nullptr, 0, 0, pWP->cx, pWP->cy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); - } - return 0; + { + WINDOWPOS* pWP = reinterpret_cast(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(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(pNM)); - - case NM_KILLFOCUS: - pCtrl->onNMKillFocus(); - return 0; - - case TVN_ITEMEXPANDING: - return pCtrl->onTVNItemExpanding(reinterpret_cast(pNM)); - - case TVN_DELETEITEM: - pCtrl->onTVNDeleteItem(reinterpret_cast(pNM)); - return 0; - - case TVN_SELCHANGING: - pCtrl->onTVNSelChanging(reinterpret_cast(pNM)); - return 0; - - case TVN_SELCHANGED: - pCtrl->onTVNSelChanged(reinterpret_cast(pNM)); - return 0; - - case TVN_BEGINDRAG: - pCtrl->onTVNBeginDrag(reinterpret_cast(pNM)); - return 0; - } + { + NMHDR* pNM = reinterpret_cast(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(pNM)); + + case NM_KILLFOCUS: + pCtrl->onNMKillFocus(); + return 0; + + case TVN_ITEMEXPANDING: + return pCtrl->onTVNItemExpanding(reinterpret_cast(pNM)); + + case TVN_DELETEITEM: + pCtrl->onTVNDeleteItem(reinterpret_cast(pNM)); + return 0; + + case TVN_SELCHANGING: + pCtrl->onTVNSelChanging(reinterpret_cast(pNM)); + return 0; + + case TVN_SELCHANGED: + pCtrl->onTVNSelChanged(reinterpret_cast(pNM)); + return 0; + + case TVN_BEGINDRAG: + pCtrl->onTVNBeginDrag(reinterpret_cast(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(pCtrl->onOCMInsertGroup(reinterpret_cast(wParam), reinterpret_cast(lParam))); @@ -315,7 +315,7 @@ LRESULT CALLBACK OptionsCtrlImpl::staticTreeProc(HWND hTree, UINT msg, WPARAM wP break; case WM_NOTIFY: - NMHDR* pNM = reinterpret_cast(lParam); + NMHDR * pNM = reinterpret_cast(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(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(pNMCustomDraw->nmcd.lItemlParam); + Item * pItem = reinterpret_cast(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(ccButton), g_hInst, nullptr)) + m_pCtrl->m_hTree, reinterpret_cast(ccButton), g_plugin.getInst(), nullptr)) { SendMessage(hTempWnd, WM_SETFONT, reinterpret_cast(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(ccColor), g_hInst, nullptr)) + m_pCtrl->m_hTree, reinterpret_cast(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(ccCombo), g_hInst, nullptr)) + m_pCtrl->m_hTree, reinterpret_cast(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(ccDateTime), g_hInst, nullptr)) { + m_pCtrl->m_hTree, reinterpret_cast(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(ccEdit), g_hInst, nullptr)) + m_pCtrl->m_hTree, reinterpret_cast(ccEdit), g_plugin.getInst(), nullptr)) { SendMessage(hTempWnd, WM_SETFONT, reinterpret_cast(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(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS)))); + SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast(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(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS)))); + SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast(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 #include // 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() : + PLUGIN("HistoryStats") + {} +}; + #endif // HISTORYSTATS_GUARD__GLOABLS_H -- cgit v1.2.3