Merge pull request #1533 from shygoo2/wine-fix-settings
Hack to get settings window working in wine
This commit is contained in:
commit
d7810035ca
|
@ -9,7 +9,8 @@ CSettingConfig::CSettingConfig(bool bJustGameSetting /* = false */) :
|
|||
m_GeneralOptionsPage(NULL),
|
||||
m_AdvancedPage(NULL),
|
||||
m_DefaultsPage(NULL),
|
||||
m_GameConfig(bJustGameSetting)
|
||||
m_GameConfig(bJustGameSetting),
|
||||
m_bTVNSelChangedSupported(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -291,9 +292,50 @@ void CSettingConfig::ApplySettings(bool UpdateScreen)
|
|||
|
||||
LRESULT CSettingConfig::OnPageListItemChanged(NMHDR* /*phdr*/)
|
||||
{
|
||||
m_bTVNSelChangedSupported = true;
|
||||
|
||||
HTREEITEM hItem = m_PagesTreeList.GetSelectedItem();
|
||||
CSettingsPage * Page = (CSettingsPage *)m_PagesTreeList.GetItemData(hItem);
|
||||
|
||||
if (Page)
|
||||
{
|
||||
if (m_CurrentPage)
|
||||
{
|
||||
m_CurrentPage->HidePage();
|
||||
}
|
||||
m_CurrentPage = Page;
|
||||
m_CurrentPage->ShowPage();
|
||||
::EnableWindow(GetDlgItem(IDC_RESET_PAGE), m_CurrentPage->EnableReset());
|
||||
}
|
||||
|
||||
return 0; // retval ignored
|
||||
}
|
||||
|
||||
// fallback to using HitTest if TVN_SELCHANGED isn't working
|
||||
LRESULT CSettingConfig::OnPageListClicked(NMHDR*)
|
||||
{
|
||||
if (m_bTVNSelChangedSupported)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD dwClickPos = GetMessagePos();
|
||||
CPoint clickPt = CPoint(dwClickPos);
|
||||
ScreenToClient(&clickPt);
|
||||
|
||||
CRect treeRect;
|
||||
m_PagesTreeList.GetWindowRect(treeRect);
|
||||
ScreenToClient(&treeRect);
|
||||
|
||||
clickPt.x -= treeRect.left;
|
||||
clickPt.y -= treeRect.top;
|
||||
clickPt.y -= 2;
|
||||
|
||||
UINT uFlags;
|
||||
HTREEITEM hItem = m_PagesTreeList.HitTest(clickPt, &uFlags);
|
||||
|
||||
CSettingsPage * Page = (CSettingsPage *)m_PagesTreeList.GetItemData(hItem);
|
||||
|
||||
if (Page)
|
||||
{
|
||||
if (m_CurrentPage)
|
||||
|
|
|
@ -13,6 +13,7 @@ public:
|
|||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||
NOTIFY_HANDLER_EX(IDC_PAGELIST, TVN_SELCHANGED, OnPageListItemChanged)
|
||||
NOTIFY_HANDLER_EX(IDC_PAGELIST, NM_CLICK, OnPageListClicked)
|
||||
MESSAGE_HANDLER_EX(PSM_CHANGED, OnSettingPageChanged)
|
||||
REFLECT_NOTIFICATIONS()
|
||||
END_MSG_MAP()
|
||||
|
@ -22,6 +23,7 @@ public:
|
|||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||
LRESULT OnPageListItemChanged(NMHDR* phdr);
|
||||
LRESULT OnPageListClicked(NMHDR* phdr);
|
||||
LRESULT OnSettingPageChanged(UINT /*uMsg*/, WPARAM wPage, LPARAM /*lParam*/);
|
||||
|
||||
public:
|
||||
|
@ -42,4 +44,5 @@ private:
|
|||
SETTING_SECTIONS m_Sections;
|
||||
CSettingsPage * m_CurrentPage, *m_GeneralOptionsPage, *m_AdvancedPage, *m_DefaultsPage;
|
||||
bool m_GameConfig;
|
||||
bool m_bTVNSelChangedSupported;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue