From 6bb048378e2b73c908f4512d9a925e736bd44fda Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 11 May 2021 13:26:56 +0300 Subject: CCtrlCombo::GetCurData = suitable helper for combo boxes --- include/m_gui.h | 5 ++- libs/win32/mir_core.lib | Bin 477644 -> 477920 bytes libs/win64/mir_core.lib | Bin 482802 -> 483088 bytes plugins/Import/src/miranda.cpp | 7 +--- plugins/New_GPG/src/ui.cpp | 2 +- plugins/NotesAndReminders/src/reminders.cpp | 18 +++++----- plugins/PluginUpdater/src/Options.cpp | 2 +- plugins/StatusManager/src/ss_options.cpp | 12 +++---- plugins/TabSRMM/src/sendlater.cpp | 7 ++-- plugins/XSoundNotify/src/options.cpp | 15 ++++----- protocols/CloudFile/src/options.cpp | 3 +- protocols/Gadu-Gadu/src/options.cpp | 11 ++---- protocols/ICQ-WIM/src/options.cpp | 4 +-- protocols/IRCG/src/options.cpp | 50 +++++++++++++--------------- protocols/JabberG/src/jabber_chat.cpp | 8 ++--- protocols/JabberG/src/jabber_opt.cpp | 13 +++----- protocols/JabberG/src/jabber_privacy.cpp | 4 +-- protocols/SkypeWeb/src/skype_chatrooms.cpp | 2 +- protocols/VKontakte/src/vk_dialogs.cpp | 2 +- protocols/VKontakte/src/vk_options.cpp | 6 ++-- src/core/stdclist/src/clistopts.cpp | 2 +- src/core/stdfile/src/fileopts.cpp | 2 +- src/mir_app/src/MDatabaseCommonCrypt.cpp | 2 +- src/mir_app/src/addcontact.cpp | 6 ++-- src/mir_app/src/lpopts.cpp | 6 ++-- src/mir_app/src/options.cpp | 5 ++- src/mir_app/src/profilemanager.cpp | 9 ++--- src/mir_core/src/CCtrlCombo.cpp | 5 +++ src/mir_core/src/mir_core.def | 1 + src/mir_core/src/mir_core64.def | 1 + 30 files changed, 95 insertions(+), 115 deletions(-) diff --git a/include/m_gui.h b/include/m_gui.h index 25bd775638..d5fd8ebf98 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -949,8 +949,11 @@ public: bool OnApply() override; void OnReset() override; + // returns item data associated with the selected item or -1 + LPARAM GetCurData() const; + // selects line with userdata passed. returns index of this line or -1 - int SelectData(LPARAM data); + int SelectData(LPARAM data); // Control interface int AddString(const wchar_t *text, LPARAM data = 0); diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib index 4d5c4ef62e..22bc892e44 100644 Binary files a/libs/win32/mir_core.lib and b/libs/win32/mir_core.lib differ diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib index 311f996f66..b4c632d51f 100644 Binary files a/libs/win64/mir_core.lib and b/libs/win64/mir_core.lib differ diff --git a/plugins/Import/src/miranda.cpp b/plugins/Import/src/miranda.cpp index 3209f7ec24..12c0255c83 100644 --- a/plugins/Import/src/miranda.cpp +++ b/plugins/Import/src/miranda.cpp @@ -181,13 +181,8 @@ void CMirandaPageDlg::onClick_Path(CCtrlButton*) void CMirandaPageDlg::onChange_Pattern(CCtrlCombo*) { - m_iFileType = -1; - int iCur = m_cmbFileType.GetCurSel(); - if (iCur == -1) - return; - // standard import for Miranda - m_iFileType = m_cmbFileType.GetItemData(iCur); + m_iFileType = m_cmbFileType.GetCurData(); if (m_iFileType == -1) { g_pBatch->m_pPattern = nullptr; btnPath.Hide(); diff --git a/plugins/New_GPG/src/ui.cpp b/plugins/New_GPG/src/ui.cpp index ee7cc2e65a..fb4b67d348 100755 --- a/plugins/New_GPG/src/ui.cpp +++ b/plugins/New_GPG/src/ui.cpp @@ -789,7 +789,7 @@ public: CMStringW keyinfo = TranslateT("key ID"); keyinfo += ": "; - m_szCurrAcc = (const char *)pCombo->GetItemData(pCombo->GetCurSel()); + m_szCurrAcc = (const char *)pCombo->GetCurData(); if (m_szCurrAcc == nullptr) { keyinfo += g_plugin.getMStringW("KeyID", TranslateT("not set")); } diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index bf47810ee1..d09ff0cd3b 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -669,7 +669,7 @@ protected: // absolute time specified in combobox item data if (!m_bManualTime) { // use preset value - UINT nDeltaSeconds = cmbTime.GetItemData(cmbTime.GetCurSel()); + UINT nDeltaSeconds = cmbTime.GetCurData(); if (m_bRelativeCombo) { // combine date from pDate (local) and time from savedLi (utc) SYSTEMTIME st, st2; @@ -1204,7 +1204,7 @@ public: ULONGLONG li; SystemTimeToFileTime(&tm, (FILETIME*)&li); - int TT = cmbRemindAgainIn.GetItemData(cmbRemindAgainIn.GetCurSel()) * 60; + int TT = cmbRemindAgainIn.GetCurData() * 60; if (TT >= 24 * 3600) { // selection is 1 day or more, take daylight saving boundaries into consideration // (ie. 24 hour might actually be 23 or 25, in order for reminder to pop up at the @@ -1421,10 +1421,8 @@ public: if (!GetTriggerTime(m_savedLi, Date)) return; - int RepeatSound = cmbRepeat.GetCurSel(); - if (RepeatSound != -1) - RepeatSound = cmbRepeat.GetItemData(RepeatSound); - else + int RepeatSound = cmbRepeat.GetCurData(); + if (RepeatSound == -1) RepeatSound = 0; bool bClose = g_plugin.bCloseAfterAddReminder || m_pReminder; @@ -1435,7 +1433,7 @@ public: SystemTimeToFileTime(&Date, (FILETIME*)&TempRem->When); TempRem->wszText = ptrW(edtText.GetText()); TempRem->bRepeat = chkRepeat.GetState(); - TempRem->SoundSel = cmbSound.GetItemData(cmbSound.GetCurSel()); + TempRem->SoundSel = cmbSound.GetCurData(); TempRem->RepeatSound = TempRem->SoundSel < 0 ? 0 : (UINT)RepeatSound; InsertReminder(TempRem); } @@ -1446,7 +1444,7 @@ public: m_pReminder->wszText = ptrW(edtText.GetText()); m_pReminder->bRepeat = chkRepeat.GetState(); - m_pReminder->SoundSel = cmbSound.GetItemData(cmbSound.GetCurSel()); + m_pReminder->SoundSel = cmbSound.GetCurData(); m_pReminder->RepeatSound = m_pReminder->SoundSel < 0 ? 0 : (UINT)RepeatSound; // re-insert tree item sorted @@ -1470,7 +1468,7 @@ public: void onClick_PlaySound(CCtrlButton*) { - int n = cmbSound.GetItemData(cmbSound.GetCurSel()); + int n = cmbSound.GetCurData(); switch (n) { case 0: Skin_PlaySound("AlertReminder"); @@ -1486,7 +1484,7 @@ public: void onChange_Sound(CCtrlCombo*) { - int n = cmbSound.GetItemData(cmbSound.GetCurSel()); + int n = cmbSound.GetCurData(); btnPlaySound.Enable(n >= 0); cmbRepeat.Enable(n >= 0); } diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index bf015eccb3..b03bad8cd2 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -223,7 +223,7 @@ public: bool OnApply() override { - g_plugin.iPeriodMeasure = cmbPeriod.GetItemData(cmbPeriod.GetCurSel()); + g_plugin.iPeriodMeasure = cmbPeriod.GetCurData(); wchar_t buffer[3] = { 0 }; Edit_GetText(GetDlgItem(m_hwnd, IDC_PERIOD), buffer, _countof(buffer)); diff --git a/plugins/StatusManager/src/ss_options.cpp b/plugins/StatusManager/src/ss_options.cpp index e49263197a..b68398d1dc 100644 --- a/plugins/StatusManager/src/ss_options.cpp +++ b/plugins/StatusManager/src/ss_options.cpp @@ -364,7 +364,7 @@ public: SSPlugin.setDword(SETTING_SETPROFILEDELAY, GetDlgItemInt(m_hwnd, IDC_SETPROFILEDELAY, nullptr, FALSE)); if (bChecked || chkShowDialog.GetState()) - SSPlugin.setWord(SETTING_DEFAULTPROFILE, (WORD)profiles.GetItemData(profiles.GetCurSel())); + SSPlugin.setWord(SETTING_DEFAULTPROFILE, (WORD)profiles.GetCurData()); SSPlugin.setByte(SETTING_OVERRIDE, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_OVERRIDE)); SSPlugin.setByte(SETTING_SHOWDIALOG, bChecked = chkShowDialog.GetState()); @@ -411,7 +411,7 @@ public: void onClick_Show(CCtrlButton*) { - CCmdlDlg *pDlg = new CCmdlDlg(profiles.GetItemData(profiles.GetCurSel())); + CCmdlDlg *pDlg = new CCmdlDlg(profiles.GetCurData()); pDlg->Show(); } @@ -541,7 +541,7 @@ class CSSAdvancedOptDlg : public CDlgBase void SetProfile() { - int sel = cmbProfile.GetItemData(cmbProfile.GetCurSel()); + int sel = cmbProfile.GetCurData(); chkCreateTTB.SetState(arProfiles[sel].createTtb); chkShowDialog.SetState(arProfiles[sel].showDialog); chkCreateMMI.SetState(arProfiles[sel].createMmi); @@ -756,7 +756,7 @@ public: void onClick_Delete(CCtrlButton*) { // wparam == profile no - int sel = cmbProfile.GetItemData(cmbProfile.GetCurSel()); + int sel = cmbProfile.GetCurData(); if (arProfiles.getCount() == 1) { MessageBox(nullptr, TranslateT("At least one profile must exist"), TranslateT("Status manager"), MB_OK); return; @@ -817,7 +817,7 @@ public: void onChange_Hotkey(CCtrlEdit*) { - int sel = cmbProfile.GetItemData(cmbProfile.GetCurSel()); + int sel = cmbProfile.GetCurData(); arProfiles[sel].hotKey = edtHotkey.SendMsg(HKM_GETHOTKEY, 0, 0); } @@ -850,7 +850,7 @@ public: void onChange_Option(CCtrlCheck*) { - int sel = cmbProfile.GetItemData(cmbProfile.GetCurSel()); + int sel = cmbProfile.GetCurData(); PROFILEOPTIONS &po = arProfiles[sel]; po.createMmi = chkCreateMMI.GetState(); po.inSubMenu = chkInSubmenu.GetState(); diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index f2490ce868..c850592ec7 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -361,11 +361,8 @@ public: void onSelChange_filter(CCtrlCombo*) { - LRESULT lr = m_filter.GetCurSel(); - if (lr != CB_ERR) { - m_hFilter = m_filter.GetItemData(lr); - FillList(); - } + m_hFilter = m_filter.GetCurData(); + FillList(); } void onMenu_list(CCtrlListView::TEventInfo*) diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp index c720c8ecb4..bab5567543 100644 --- a/plugins/XSoundNotify/src/options.cpp +++ b/plugins/XSoundNotify/src/options.cpp @@ -32,9 +32,9 @@ class COptionsDlg : public CDlgBase XSN_Data* ObtainData() { - LPARAM hContact = comboUser.GetItemData(comboUser.GetCurSel()); + LPARAM hContact = comboUser.GetCurData(); if (hContact == -1) { - PROTOACCOUNT *pa = (PROTOACCOUNT *)comboAcc.GetItemData(comboAcc.GetCurSel()); + PROTOACCOUNT *pa = (PROTOACCOUNT *)comboAcc.GetCurData(); XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName); if (p == nullptr) XSN_Users.insert(p = new XSN_Data(pa->szModuleName, chkIgnore.GetState())); @@ -114,8 +114,7 @@ public: chkIgnore.SetState(false); label.SetText(TranslateT("Not set")); - int cursel = comboAcc.GetCurSel(); - PROTOACCOUNT *pa = (PROTOACCOUNT *)comboAcc.GetItemData(cursel); + PROTOACCOUNT *pa = (PROTOACCOUNT *)comboAcc.GetCurData(); comboUser.AddString(TranslateT("All contacts"), -1); for (auto &hContact : Contacts(pa->szModuleName)) { @@ -130,9 +129,9 @@ public: btnChoose.Enable(); chkIgnore.Enable(); - LPARAM hContact = comboUser.GetItemData(comboUser.GetCurSel()); + LPARAM hContact = comboUser.GetCurData(); if (hContact == -1) { - PROTOACCOUNT *pa = (PROTOACCOUNT *)comboAcc.GetItemData(comboAcc.GetCurSel()); + PROTOACCOUNT *pa = (PROTOACCOUNT *)comboAcc.GetCurData(); ptrW wszText(g_plugin.getWStringA(pa->szModuleName)); if (wszText) { btnTest.Enable(); @@ -226,9 +225,9 @@ public: chkIgnore.SetState(false); label.SetText(TranslateT("Not set")); - LPARAM hContact = comboUser.GetItemData(comboUser.GetCurSel()); + LPARAM hContact = comboUser.GetCurData(); if (hContact == -1) { - PROTOACCOUNT *pa = (PROTOACCOUNT *)comboAcc.GetItemData(comboAcc.GetCurSel()); + PROTOACCOUNT *pa = (PROTOACCOUNT *)comboAcc.GetCurData(); XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName); if (p != nullptr) { XSN_Users.remove(p); diff --git a/protocols/CloudFile/src/options.cpp b/protocols/CloudFile/src/options.cpp index 0ac7c120a0..de961a314a 100644 --- a/protocols/CloudFile/src/options.cpp +++ b/protocols/CloudFile/src/options.cpp @@ -55,8 +55,7 @@ bool COptionsMainDlg::OnInitDialog() bool COptionsMainDlg::OnApply() { - int iItem = m_defaultService.GetCurSel(); - CCloudService *service = (CCloudService*)m_defaultService.GetItemData(iItem); + CCloudService *service = (CCloudService*)m_defaultService.GetCurData(); if (service) g_plugin.setString("DefaultService", service->GetAccountName()); else diff --git a/protocols/Gadu-Gadu/src/options.cpp b/protocols/Gadu-Gadu/src/options.cpp index ca3b411b79..2b2a3cc4c3 100644 --- a/protocols/Gadu-Gadu/src/options.cpp +++ b/protocols/Gadu-Gadu/src/options.cpp @@ -56,14 +56,9 @@ bool GaduOptionsDlgConference::OnInitDialog() bool GaduOptionsDlgConference::OnApply() { - int selectionIndex = cmbPolicyForAllChatParticipants.GetCurSel(); - m_proto->setWord(GG_KEY_GC_POLICY_TOTAL, cmbPolicyForAllChatParticipants.GetItemData(selectionIndex)); - - selectionIndex = cmbPolicyForUnknownChatParticipants.GetCurSel(); - m_proto->setWord(GG_KEY_GC_POLICY_UNKNOWN, cmbPolicyForUnknownChatParticipants.GetItemData(selectionIndex)); - - selectionIndex = cmbDefaultChatPolicy.GetCurSel(); - m_proto->setWord(GG_KEY_GC_POLICY_DEFAULT, cmbDefaultChatPolicy.GetItemData(selectionIndex)); + m_proto->setWord(GG_KEY_GC_POLICY_TOTAL, cmbPolicyForAllChatParticipants.GetCurData()); + m_proto->setWord(GG_KEY_GC_POLICY_UNKNOWN, cmbPolicyForUnknownChatParticipants.GetCurData()); + m_proto->setWord(GG_KEY_GC_POLICY_DEFAULT, cmbDefaultChatPolicy.GetCurData()); return true; } diff --git a/protocols/ICQ-WIM/src/options.cpp b/protocols/ICQ-WIM/src/options.cpp index 9272a5ef28..3191a92164 100644 --- a/protocols/ICQ-WIM/src/options.cpp +++ b/protocols/ICQ-WIM/src/options.cpp @@ -336,8 +336,8 @@ public: bool OnApply() override { if (cmbStatus1.GetHwnd()) { - m_proto->m_iStatus1 = cmbStatus1.GetItemData(cmbStatus1.GetCurSel()); - m_proto->m_iStatus2 = cmbStatus2.GetItemData(cmbStatus2.GetCurSel()); + m_proto->m_iStatus1 = cmbStatus1.GetCurData(); + m_proto->m_iStatus2 = cmbStatus2.GetCurData(); } return true; diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index a4af457627..dff900a683 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -704,8 +704,7 @@ public: m_proto->m_alias = m_alias.GetText(); m_quitMessage.GetText(m_proto->m_quitMessage, _countof(m_proto->m_quitMessage)); - int curSel = m_codepage.GetCurSel(); - m_proto->m_codepage = m_codepage.GetItemData(curSel); + m_proto->m_codepage = m_codepage.GetCurData(); if (m_proto->IsConnected()) m_proto->setCodepage(m_proto->m_codepage); @@ -746,11 +745,10 @@ public: void OnPerformCombo(CCtrlData *) { - int i = m_performCombo.GetCurSel(); - if (i == CB_ERR) + PERFORM_INFO *pPerf = (PERFORM_INFO *)m_performCombo.GetCurData(); + if (pPerf == INVALID_HANDLE_VALUE) return; - PERFORM_INFO *pPerf = (PERFORM_INFO *)m_performCombo.GetItemData(i); if (pPerf == nullptr) m_pertormEdit.SetTextA(""); else @@ -764,8 +762,7 @@ public: void OnCodePage(CCtrlData *) { - int curSel = m_codepage.GetCurSel(); - m_autodetect.Enable(m_codepage.GetItemData(curSel) != CP_UTF8); + m_autodetect.Enable(m_codepage.GetCurData() != CP_UTF8); } void OnPerformEdit(CCtrlData *) @@ -788,38 +785,37 @@ public: void OnAdd(CCtrlButton *) { - wchar_t *temp = m_pertormEdit.GetText(); + ptrW temp(m_pertormEdit.GetText()); if (my_strstri(temp, L"/away")) MessageBox(nullptr, TranslateT("The usage of /AWAY in your perform buffer is restricted\n as IRC sends this command automatically."), TranslateT("IRC Error"), MB_OK); else { - int i = m_performCombo.GetCurSel(); - if (i != CB_ERR) { - PERFORM_INFO *pPerf = (PERFORM_INFO *)m_performCombo.GetItemData(i); - if (pPerf != nullptr) - pPerf->mText = temp; + PERFORM_INFO *pPerf = (PERFORM_INFO *)m_performCombo.GetCurData(); + if (pPerf == INVALID_HANDLE_VALUE) + return; - m_add.Disable(); - m_performlistModified = true; - } + if (pPerf != nullptr) + pPerf->mText = temp; + + m_add.Disable(); + m_performlistModified = true; } - mir_free(temp); } void OnDelete(CCtrlButton *) { - int i = m_performCombo.GetCurSel(); - if (i != CB_ERR) { - PERFORM_INFO *pPerf = (PERFORM_INFO *)m_performCombo.GetItemData(i); - if (pPerf != nullptr) { - pPerf->mText = L""; - m_pertormEdit.SetTextA(""); - m_delete.Disable(); - m_add.Disable(); - } + PERFORM_INFO *pPerf = (PERFORM_INFO *)m_performCombo.GetCurData(); + if (pPerf == INVALID_HANDLE_VALUE) + return; - m_performlistModified = true; + if (pPerf != nullptr) { + pPerf->mText = L""; + m_pertormEdit.SetTextA(""); + m_delete.Disable(); + m_add.Disable(); } + + m_performlistModified = true; } }; diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 8946a65c78..8f1cbf7b50 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -865,13 +865,13 @@ public: void onSelChange_Affiliation(CCtrlCombo*) { - int value = cmbAffiliation.GetItemData(cmbAffiliation.GetCurSel()); + int value = cmbAffiliation.GetCurData(); btnAffiliation.Enable(m_him->m_affiliation != value); } void onClick_Affiliation(CCtrlButton *) { - int value = cmbAffiliation.GetItemData(cmbAffiliation.GetCurSel()); + int value = cmbAffiliation.GetCurData(); if (m_him->m_affiliation == value) return; @@ -907,13 +907,13 @@ public: void onSelChange_Role(CCtrlCombo *) { - int value = cmbRole.GetItemData(cmbRole.GetCurSel()); + int value = cmbRole.GetCurData(); btnRole.Enable(m_him->m_role != value); } void onClick_Role(CCtrlButton*) { - int value = cmbRole.GetItemData(cmbRole.GetCurSel()); + int value = cmbRole.GetCurData(); if (m_him->m_role == value) return; diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index ebc3eba2fd..fcd78fc404 100755 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -488,13 +488,10 @@ protected: else m_proto->delSetting("Password"); - int index = m_cbLocale.GetCurSel(); - if (index >= 0) { - char *szLanguageCode = (char*)m_cbLocale.GetItemData(index); - if (szLanguageCode) { - m_proto->setString("XmlLang", szLanguageCode); - replaceStr(m_proto->m_tszSelectedLang, szLanguageCode); - } + char *szLanguageCode = (char*)m_cbLocale.GetCurData(); + if (szLanguageCode && szLanguageCode != INVALID_HANDLE_VALUE) { + m_proto->setString("XmlLang", szLanguageCode); + replaceStr(m_proto->m_tszSelectedLang, szLanguageCode); } if (m_cbMam.Enabled() && m_cbMam.GetCurSel() != m_proto->m_iMamMode) @@ -1272,7 +1269,7 @@ private: void cbType_OnChange(CCtrlData *sender) { CCtrlCombo *chk = (CCtrlCombo *)sender; - setupConnection(chk->GetItemData(chk->GetCurSel())); + setupConnection(chk->GetCurData()); CheckRegistration(); } diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index a9f4888c88..a92d005d29 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -364,7 +364,7 @@ public: bool OnApply() override { - int nCurSel, nItemData = m_cbType.GetItemData(m_cbType.GetCurSel()); + int nCurSel, nItemData = m_cbType.GetCurData(); switch (nItemData) { case Jid: @@ -419,7 +419,7 @@ public: { if (!m_pRule) return; - switch (m_cbType.GetItemData(m_cbType.GetCurSel())) { + switch (m_cbType.GetCurData()) { case Jid: ShowWindow(GetDlgItem(m_hwnd, IDC_COMBO_VALUES), SW_SHOW); ShowWindow(GetDlgItem(m_hwnd, IDC_COMBO_VALUE), SW_HIDE); diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 64760e026f..779afbb63a 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -99,7 +99,7 @@ public: bool OnApply() override { - m_hContact = m_combo.GetItemData(m_combo.GetCurSel()); + m_hContact = m_combo.GetCurData(); return true; } }; diff --git a/protocols/VKontakte/src/vk_dialogs.cpp b/protocols/VKontakte/src/vk_dialogs.cpp index d2e5c5b111..9668e3f2cd 100644 --- a/protocols/VKontakte/src/vk_dialogs.cpp +++ b/protocols/VKontakte/src/vk_dialogs.cpp @@ -162,7 +162,7 @@ bool CVkInviteChatForm::OnInitDialog() bool CVkInviteChatForm::OnApply() { - m_hContact = m_cbxCombo.GetItemData(m_cbxCombo.GetCurSel()); + m_hContact = m_cbxCombo.GetCurData(); return true; } diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 502cf17f84..898d7da17c 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -209,9 +209,9 @@ bool CVkOptionAccountForm::OnInitDialog() bool CVkOptionAccountForm::OnApply() { - m_proto->m_vkOptions.iSyncHistoryMetod = m_cbxSyncHistory.GetItemData(m_cbxSyncHistory.GetCurSel()); - m_proto->m_vkOptions.iMarkMessageReadOn = m_cbxMarkAsRead.GetItemData(m_cbxMarkAsRead.GetCurSel()); - m_proto->m_vkOptions.pwszVKLang = (wchar_t *)m_cbxVKLang.GetItemData(m_cbxVKLang.GetCurSel()); + m_proto->m_vkOptions.iSyncHistoryMetod = m_cbxSyncHistory.GetCurData(); + m_proto->m_vkOptions.iMarkMessageReadOn = m_cbxMarkAsRead.GetCurData(); + m_proto->m_vkOptions.pwszVKLang = (wchar_t *)m_cbxVKLang.GetCurData(); ptrW pwszGroupName(m_edtGroupName.GetText()); if (mir_wstrcmp(m_pwszOldGroup, pwszGroupName)) { diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp index fa86e449df..623f3b6700 100644 --- a/src/core/stdclist/src/clistopts.cpp +++ b/src/core/stdclist/src/clistopts.cpp @@ -96,7 +96,7 @@ public: g_plugin.setWord("IconFlashTime", blink.GetPosition()); g_plugin.setByte("DisableTrayFlash", IsDlgButtonChecked(m_hwnd, IDC_DISABLEBLINK)); - PROTOACCOUNT *pa = (PROTOACCOUNT *)status.GetItemData(status.GetCurSel()); + PROTOACCOUNT *pa = (PROTOACCOUNT *)status.GetCurData(); if (pa == nullptr) g_plugin.delSetting("PrimaryStatus"); else diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index 34185f2312..006273dfd1 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -169,7 +169,7 @@ public: void onSelChanged_Combo(CCtrlCombo*) { - int iScanner = cmbScanCmdLine.GetItemData(cmbScanCmdLine.GetCurSel()); + int iScanner = cmbScanCmdLine.GetCurData(); if (iScanner >= _countof(virusScanners) || iScanner < 0) return; diff --git a/src/mir_app/src/MDatabaseCommonCrypt.cpp b/src/mir_app/src/MDatabaseCommonCrypt.cpp index 1e0258a318..baa0ade9f5 100644 --- a/src/mir_app/src/MDatabaseCommonCrypt.cpp +++ b/src/mir_app/src/MDatabaseCommonCrypt.cpp @@ -36,7 +36,7 @@ class CSelectCryptoDialog : public CDlgBase CRYPTO_PROVIDER *getCurrent() { - return (CRYPTO_PROVIDER*)m_combo.GetItemData(m_combo.GetCurSel()); + return (CRYPTO_PROVIDER*)m_combo.GetCurData(); } bool OnInitDialog() override diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index 3146974a23..c4520d37ba 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -119,9 +119,9 @@ public: if (mir_wstrlen(szHandle)) db_set_ws(hContact, "CList", "MyHandle", szHandle); - int item = m_group.GetCurSel(); - if (item > 0) - Clist_ContactChangeGroup(hContact, m_group.GetItemData(item)); + MGROUP iGroup = m_group.GetCurData(); + if (iGroup >= 0) + Clist_ContactChangeGroup(hContact, iGroup); Contact_PutOnList(hContact); diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp index 7439de1e08..a397dad825 100644 --- a/src/mir_app/src/lpopts.cpp +++ b/src/mir_app/src/lpopts.cpp @@ -197,8 +197,7 @@ void CLangpackDlg::DisplayPackInfo(const LANGPACK_INFO *pack) void CLangpackDlg::Languages_OnChange(CCtrlBase*) { - int idx = m_languages.GetCurSel(); - LANGPACK_INFO *pack = (LANGPACK_INFO*)m_languages.GetItemData(idx); + LANGPACK_INFO *pack = (LANGPACK_INFO*)m_languages.GetCurData(); DisplayPackInfo(pack); if (!(pack->flags & LPF_ENABLED)) SendMessage(GetParent(GetHwnd()), PSM_CHANGED, 0, 0); @@ -208,8 +207,7 @@ void CLangpackDlg::Languages_OnChange(CCtrlBase*) void CLangpackDlg::Reload_OnClick(CCtrlBase*) { m_reload.Enable(FALSE); - int idx = m_languages.GetCurSel(); - LANGPACK_INFO *pack = (LANGPACK_INFO*)m_languages.GetItemData(idx); + LANGPACK_INFO *pack = (LANGPACK_INFO*)m_languages.GetCurData(); ReloadLangpack(pack->tszFullPath); DisplayPackInfo(pack); m_reload.Enable(TRUE); diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 3e34f00092..be2c96b67b 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -527,9 +527,8 @@ class COptionsDlg : public CDlgBase wcsncpy_s(m_szFilterString, pos, _TRUNCATE); } else { - int sel = m_keywordFilter.GetCurSel(); - if (sel != -1) { - HINSTANCE hinst = (HINSTANCE)m_keywordFilter.GetItemData(sel); + HINSTANCE hinst = (HINSTANCE)m_keywordFilter.GetCurData(); + if (hinst != INVALID_HANDLE_VALUE) { wchar_t szFileName[300]; GetModuleFileName(hinst, szFileName, _countof(szFileName)); wchar_t *pos = wcsrchr(szFileName, '\\'); diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index 5c4453cb45..e87673aee7 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -648,12 +648,9 @@ public: void OnDestroy() { if (m_chkSmEnabled.GetState()) { - LRESULT curSel = m_servicePlugs.GetCurSel(); - if (curSel != -1) { - int idx = m_servicePlugs.GetItemData(curSel); - if (idx != -1) - plugin_service = servicePlugins[idx]; - } + int idx = m_servicePlugs.GetCurData(); + if (idx != -1) + plugin_service = servicePlugins[idx]; } DestroyIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, 0)); diff --git a/src/mir_core/src/CCtrlCombo.cpp b/src/mir_core/src/CCtrlCombo.cpp index a7abf1d707..4a67f14720 100644 --- a/src/mir_core/src/CCtrlCombo.cpp +++ b/src/mir_core/src/CCtrlCombo.cpp @@ -76,6 +76,11 @@ void CCtrlCombo::OnReset() SetInt(LoadInt()); } +LPARAM CCtrlCombo::GetCurData() const +{ + return GetItemData(GetCurSel()); +} + // selects line with userdata passed int CCtrlCombo::SelectData(LPARAM data) { diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index a895c2f6c6..3702d84864 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1504,3 +1504,4 @@ TimeZone_GetSystemTime @1692 ?MoveItem@CCtrlListView@@QAEHHH@Z @1727 NONAME ?SelectData@CCtrlCombo@@QAEHJ@Z @1728 NONAME ?SetCurSel@CCtrlListView@@QAEXH@Z @1729 NONAME +?GetCurData@CCtrlCombo@@QBEJXZ @1730 NONAME diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 9e6cf832e4..ae7037fbdd 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1504,3 +1504,4 @@ TimeZone_GetSystemTime @1692 ?MoveItem@CCtrlListView@@QEAAHHH@Z @1727 NONAME ?SelectData@CCtrlCombo@@QEAAH_J@Z @1728 NONAME ?SetCurSel@CCtrlListView@@QEAAXH@Z @1729 NONAME +?GetCurData@CCtrlCombo@@QEBA_JXZ @1730 NONAME -- cgit v1.2.3