summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-18 14:17:28 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-18 14:17:28 +0300
commit81c8606dd9aa39067353354aa4523be84ef51fd1 (patch)
tree3f157c302093074552d0f792c481c741277cd531 /src
parent73d12d0f6eb5c673a951eec94ddf5cdeeacde369 (diff)
CDlgBase::CDlgBase now receives a reference to CMPlugin instead of HINSTANCE
Diffstat (limited to 'src')
-rw-r--r--src/core/stdidle/src/options.cpp2
-rw-r--r--src/core/stdmsg/src/chat_options.cpp6
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp8
-rw-r--r--src/core/stdmsg/src/msgs.cpp2
-rw-r--r--src/core/stdmsg/src/tabs.cpp2
-rw-r--r--src/mir_app/src/mir_app.def4
-rw-r--r--src/mir_app/src/mir_app64.def4
-rw-r--r--src/mir_app/src/options.cpp14
-rw-r--r--src/mir_core/src/CDlgBase.cpp14
9 files changed, 26 insertions, 30 deletions
diff --git a/src/core/stdidle/src/options.cpp b/src/core/stdidle/src/options.cpp
index 6f8732223b..5da1144b09 100644
--- a/src/core/stdidle/src/options.cpp
+++ b/src/core/stdidle/src/options.cpp
@@ -57,7 +57,7 @@ class COptionsDlg : public CPluginDlgBase
public:
COptionsDlg() :
- CPluginDlgBase(g_plugin.getInst(), IDD_OPT_IDLE, IDLEMOD),
+ CPluginDlgBase(g_plugin, IDD_OPT_IDLE, IDLEMOD),
edt1sttime(this, IDC_IDLE1STTIME),
spinIdle(this, IDC_IDLESPIN),
cmbAAStatus(this, IDC_AASTATUS),
diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp
index 6f9dcc88db..778d8f1af8 100644
--- a/src/core/stdmsg/src/chat_options.cpp
+++ b/src/core/stdmsg/src/chat_options.cpp
@@ -332,7 +332,7 @@ class COptMainDlg : public CDlgBase
public:
COptMainDlg()
- : CDlgBase(g_plugin.getInst(), IDD_OPTIONS1),
+ : CDlgBase(g_plugin, IDD_OPTIONS1),
checkBoxes(this, IDC_CHECKBOXES)
{
checkBoxes.OnItemChanged = Callback(this, &COptMainDlg::onChange_Tree);
@@ -433,7 +433,7 @@ class COptLogDlg : public CDlgBase
public:
COptLogDlg() :
- CDlgBase(g_plugin.getInst(), IDD_OPTIONS2),
+ CDlgBase(g_plugin, IDD_OPTIONS2),
spin2(this, IDC_SPIN2),
spin3(this, IDC_SPIN3),
spin4(this, IDC_SPIN4),
@@ -596,7 +596,7 @@ class COptPopupDlg : public CDlgBase
public:
COptPopupDlg()
- : CDlgBase(g_plugin.getInst(), IDD_OPTIONSPOPUP),
+ : CDlgBase(g_plugin, IDD_OPTIONSPOPUP),
chkRadio1(this, IDC_RADIO1),
chkRadio2(this, IDC_RADIO2),
chkRadio3(this, IDC_RADIO3)
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp
index 101c07cf46..204f34eaff 100644
--- a/src/core/stdmsg/src/msgoptions.cpp
+++ b/src/core/stdmsg/src/msgoptions.cpp
@@ -193,7 +193,7 @@ class COptionMainDlg : public CPluginDlgBase
public:
COptionMainDlg() :
- CPluginDlgBase(g_plugin.getInst(), IDD_OPT_MSGDLG, SRMMMOD),
+ CPluginDlgBase(g_plugin, IDD_OPT_MSGDLG, SRMMMOD),
tree(this, IDC_POPLIST),
edtSecs(this, IDC_SECONDS),
edtNFlash(this, IDC_NFLASHES),
@@ -315,7 +315,7 @@ class COptionLogDlg : public CPluginDlgBase
public:
COptionLogDlg() :
- CPluginDlgBase(g_plugin.getInst(), IDD_OPT_MSGLOG, SRMMMOD),
+ CPluginDlgBase(g_plugin, IDD_OPT_MSGLOG, SRMMMOD),
chkSecs(this, IDC_SHOWSECS),
chkDate(this, IDC_SHOWDATES),
chkTime(this, IDC_SHOWTIMES),
@@ -418,7 +418,7 @@ class COptionTypingDlg : public CPluginDlgBase
public:
COptionTypingDlg() :
- CPluginDlgBase(g_plugin.getInst(), IDD_OPT_MSGTYPE, SRMMMOD),
+ CPluginDlgBase(g_plugin, IDD_OPT_MSGTYPE, SRMMMOD),
clist(this, IDC_CLIST),
chkType(this, IDC_SHOWNOTIFY),
chkTypeWin(this, IDC_TYPEWIN),
@@ -529,7 +529,7 @@ class COptionsTabDlg : public CDlgBase
public:
COptionsTabDlg() :
- CDlgBase(g_plugin.getInst(), IDD_OPT_TABS),
+ CDlgBase(g_plugin, IDD_OPT_TABS),
m_chkTabs(this, IDC_USETABS),
m_chkTabsBottom(this, IDC_TABSBOTTOM),
m_chkTabsClose(this, IDC_CLOSETABS),
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 9b9ad4fe75..0b982e5892 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/////////////////////////////////////////////////////////////////////////////////////////
CMsgDialog::CMsgDialog(int iDialogId, SESSION_INFO *si)
- : CSuper(g_plugin.getInst(), iDialogId, si),
+ : CSuper(g_plugin, iDialogId, si),
m_btnOk(this, IDOK)
{
m_autoClose = 0;
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index 234ff9a657..a1d28f215a 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -163,7 +163,7 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
/////////////////////////////////////////////////////////////////////////////////////////
CTabbedWindow::CTabbedWindow() :
- CDlgBase(g_plugin.getInst(), IDD_CONTAINER),
+ CDlgBase(g_plugin, IDD_CONTAINER),
m_tab(this, IDC_TAB)
{
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 6fa1d98644..e6e2e8f009 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -27,7 +27,6 @@ Skin_GetIconName @24
??0CProtoIntDlgBase@@QAE@PAUPROTO_INTERFACE@@H@Z @26 NONAME
??0PROTO_INTERFACE@@QAE@ABU0@@Z @27 NONAME
??1CProtoIntDlgBase@@UAE@XZ @29 NONAME
-??4CProtoIntDlgBase@@QAEAAV0@ABV0@@Z @30 NONAME
??4PROTO_INTERFACE@@QAEAAU0@ABU0@@Z @31 NONAME
??_7CProtoIntDlgBase@@6B@ @32 NONAME
??_7PROTO_INTERFACE@@6B@ @33 NONAME
@@ -384,7 +383,7 @@ Chat_UnescapeTags @399 NONAME
ProtoGetAvatarFormatByMimeType @400
ProtoGetAvatarMimeType @401
?set_uin@DB_AUTH_BLOB@@QAEXK@Z @402 NONAME
-??0CSrmmBaseDialog@@IAE@PAUHINSTANCE__@@HPAUSESSION_INFO@@@Z @403 NONAME
+??0CSrmmBaseDialog@@IAE@AAVCMPluginBase@@HPAUSESSION_INFO@@@Z @403 NONAME
??1CSrmmBaseDialog@@UAE@XZ @405 NONAME
??_7CSrmmBaseDialog@@6B@ @407 NONAME
?DlgProc@CSrmmBaseDialog@@MAEHIIJ@Z @408 NONAME
@@ -449,7 +448,6 @@ Clist_SetStatusMode @464
??0MIDatabase@@QAE@ABU0@@Z @470 NONAME
??0MIDatabase@@QAE@XZ @471 NONAME
??1MDatabaseCommon@@UAE@XZ @472 NONAME
-??4CProtoIntDlgBase@@QAEAAV0@$$QAV0@@Z @474 NONAME
??4MDatabaseCommon@@QAEAAV0@ABV0@@Z @476 NONAME
??4MIDatabase@@QAEAAU0@$$QAU0@@Z @477 NONAME
??4MIDatabase@@QAEAAU0@ABU0@@Z @478 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 109b032808..dc486e6845 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -27,7 +27,6 @@ Skin_GetIconName @24
??0CProtoIntDlgBase@@QEAA@PEAUPROTO_INTERFACE@@H@Z @26 NONAME
??0PROTO_INTERFACE@@QEAA@AEBU0@@Z @27 NONAME
??1CProtoIntDlgBase@@UEAA@XZ @29 NONAME
-??4CProtoIntDlgBase@@QEAAAEAV0@AEBV0@@Z @30 NONAME
??4PROTO_INTERFACE@@QEAAAEAU0@AEBU0@@Z @31 NONAME
??_7CProtoIntDlgBase@@6B@ @32 NONAME
??_7PROTO_INTERFACE@@6B@ @33 NONAME
@@ -384,7 +383,7 @@ Chat_UnescapeTags @399 NONAME
ProtoGetAvatarFormatByMimeType @400
ProtoGetAvatarMimeType @401
?set_uin@DB_AUTH_BLOB@@QEAAXK@Z @402 NONAME
-??0CSrmmBaseDialog@@IEAA@PEAUHINSTANCE__@@HPEAUSESSION_INFO@@@Z @403 NONAME
+??0CSrmmBaseDialog@@IEAA@AEAVCMPluginBase@@HPEAUSESSION_INFO@@@Z @403 NONAME
??1CSrmmBaseDialog@@UEAA@XZ @405 NONAME
??_7CSrmmBaseDialog@@6B@ @407 NONAME
?DlgProc@CSrmmBaseDialog@@MEAA_JI_K_J@Z @408 NONAME
@@ -449,7 +448,6 @@ Clist_SetStatusMode @464
??0MIDatabase@@QEAA@AEBU0@@Z @470 NONAME
??0MIDatabase@@QEAA@XZ @471 NONAME
??1MDatabaseCommon@@UEAA@XZ @472 NONAME
-??4CProtoIntDlgBase@@QEAAAEAV0@$$QEAV0@@Z @474 NONAME
??4MDatabaseCommon@@QEAAAEAV0@AEBV0@@Z @476 NONAME
??4MIDatabase@@QEAAAEAU0@$$QEAU0@@Z @477 NONAME
??4MIDatabase@@QEAAAEAU0@AEBU0@@Z @478 NONAME
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp
index 0cc0f87a49..92002dca6e 100644
--- a/src/mir_app/src/options.cpp
+++ b/src/mir_app/src/options.cpp
@@ -172,8 +172,8 @@ class COptionPageDialog : public CDlgBase
LPARAM m_lParam;
public:
- COptionPageDialog(HINSTANCE hInst, int idDialog, DLGPROC pProc, LPARAM lParam) :
- CDlgBase(hInst, idDialog),
+ COptionPageDialog(CMPluginBase &pPlug, int idDialog, DLGPROC pProc, LPARAM lParam) :
+ CDlgBase(pPlug, idDialog),
m_wndProc(pProc),
m_lParam(lParam)
{
@@ -200,7 +200,7 @@ struct OptionsPageData : public MZeroedObject
OptionsPageData(const OPTIONSDIALOGPAGE &src)
{
if (src.hInstance != nullptr && src.pszTemplate != nullptr)
- pDialog = new COptionPageDialog(src.hInstance, (INT_PTR)src.pszTemplate, src.pfnDlgProc, src.dwInitParam);
+ pDialog = new COptionPageDialog(::GetPluginByInstance(src.hInstance), (INT_PTR)src.pszTemplate, src.pfnDlgProc, src.dwInitParam);
else
pDialog = src.pDialog;
assert(pDialog != nullptr);
@@ -438,13 +438,13 @@ class COptionsDlg : public CDlgBase
int countKnownInst = 0;
m_keywordFilter.ResetContent();
m_keywordFilter.AddString(ALL_MODULES_FILTER, 0);
- m_keywordFilter.AddString(CORE_MODULES_FILTER, (LPARAM)g_hInst);
+ m_keywordFilter.AddString(CORE_MODULES_FILTER, (LPARAM)g_plugin.getInst());
for (auto &opd : m_arOpd) {
opd->FindFilterStrings(false, 0, m_hwnd); // only modules name (fast enougth)
HINSTANCE inst = opd->getInst();
- if (inst == g_hInst)
+ if (inst == g_plugin.getInst())
continue;
int j;
@@ -512,7 +512,7 @@ class COptionsDlg : public CDlgBase
else if (mir_wstrcmp(m_szFilterString, CORE_MODULES_FILTER) == 0) {
// replace string with process name - that will show core settings
wchar_t szFileName[300];
- GetModuleFileName(g_hInst, szFileName, _countof(szFileName));
+ GetModuleFileName(g_plugin.getInst(), szFileName, _countof(szFileName));
wchar_t *pos = wcsrchr(szFileName, '\\');
if (pos)
pos++;
@@ -685,7 +685,7 @@ class COptionsDlg : public CDlgBase
public:
COptionsDlg(const wchar_t *pszCaption, const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, bool bSinglePage, const OptionsPageList &arPages) :
- CDlgBase(g_hInst, bSinglePage ? IDD_OPTIONSPAGE : IDD_OPTIONS),
+ CDlgBase(g_plugin, bSinglePage ? IDD_OPTIONSPAGE : IDD_OPTIONS),
m_btnApply(this, IDC_APPLY),
m_btnCancel(this, IDCANCEL),
m_pageTree(this, IDC_PAGETREE),
diff --git a/src/mir_core/src/CDlgBase.cpp b/src/mir_core/src/CDlgBase.cpp
index ed3de8d553..ab21be6a15 100644
--- a/src/mir_core/src/CDlgBase.cpp
+++ b/src/mir_core/src/CDlgBase.cpp
@@ -45,11 +45,11 @@ static int CompareTimerId(const CTimer *t1, const CTimer *t2)
return t1->GetEventId() - t2->GetEventId();
}
-CDlgBase::CDlgBase(HINSTANCE hInst, int idDialog)
+CDlgBase::CDlgBase(CMPluginBase &pPlug, int idDialog)
: m_controls(1, CompareControlId),
- m_timers(1, CompareTimerId)
+ m_timers(1, CompareTimerId),
+ m_pPlugin(pPlug)
{
- m_hInst = hInst;
m_idDialog = idDialog;
m_hwnd = m_hwndParent = nullptr;
m_isModal = m_initialized = m_bExiting = false;
@@ -74,13 +74,13 @@ void CDlgBase::Close()
void CDlgBase::Create()
{
- CreateDialogParam(m_hInst, MAKEINTRESOURCE(m_idDialog), m_hwndParent, GlobalDlgProc, (LPARAM)this);
+ CreateDialogParam(GetInst(), MAKEINTRESOURCE(m_idDialog), m_hwndParent, GlobalDlgProc, (LPARAM)this);
}
int CDlgBase::DoModal()
{
m_isModal = true;
- return DialogBoxParam(m_hInst, MAKEINTRESOURCE(m_idDialog), m_hwndParent, GlobalDlgProc, (LPARAM)this);
+ return DialogBoxParam(GetInst(), MAKEINTRESOURCE(m_idDialog), m_hwndParent, GlobalDlgProc, (LPARAM)this);
}
void CDlgBase::EndModal(INT_PTR nResult)
@@ -159,7 +159,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
switch (msg) {
case WM_INITDIALOG:
m_initialized = false;
- TranslateDialog_LP(m_hwnd, GetPluginLangByInstance(m_hInst));
+ TranslateDialog_LP(m_hwnd, GetPluginLangByInstance(m_pPlugin.getInst()));
::EnumChildWindows(m_hwnd, &GlobalFieldEnum, LPARAM(this));
@@ -286,7 +286,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SIZE:
if (m_forceResizable || (GetWindowLongPtr(m_hwnd, GWL_STYLE) & WS_THICKFRAME))
- Utils_ResizeDialog(m_hwnd, m_hInst, MAKEINTRESOURCEA(m_idDialog), GlobalDlgResizer);
+ Utils_ResizeDialog(m_hwnd, m_pPlugin.getInst(), MAKEINTRESOURCEA(m_idDialog), GlobalDlgResizer);
return TRUE;
case WM_TIMER: