BOOL CPPageInternalFilters::OnInitDialog() { __super::OnInitDialog(); const CAppSettings& s = AfxGetAppSettings(); m_listSrc.InsertColumn(0, _T("")); m_listTra.InsertColumn(0, _T("")); m_listSrc.SetExtendedStyle(m_listSrc.GetExtendedStyle() | LVS_EX_CHECKBOXES | LVS_EX_DOUBLEBUFFER); m_listTra.SetExtendedStyle(m_listTra.GetExtendedStyle() | LVS_EX_CHECKBOXES | LVS_EX_DOUBLEBUFFER); InitFiltersList(); for (int i = 0; i < m_filters.GetCount(); i++) { CPPageInternalFiltersListBox* l; bool checked; switch (m_filters[i].type) { case SOURCE_FILTER: l = &m_listSrc; checked = s.SrcFilters[m_filters[i].flag]; break; case AUDIO_DECODER: case VIDEO_DECODER: l = &m_listTra; checked = s.TraFilters[m_filters[i].flag]; break; default: l = nullptr; checked = false; } if (l) { l->AddFilter(&m_filters[i], checked); } } m_listSrc.UpdateCheckState(); m_listTra.UpdateCheckState(); m_listSrc.SetColumnWidth(0, LVSCW_AUTOSIZE); m_listTra.SetColumnWidth(0, LVSCW_AUTOSIZE); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CPPageInternalFilters::OnInitDialog() { __super::OnInitDialog(); const CAppSettings& s = AfxGetAppSettings(); for (int i = 0; i < _countof(s_filters) - 1; i++) { CPPageInternalFiltersListBox* l; bool checked; switch (s_filters[i].type) { case SOURCE_FILTER: l = &m_listSrc; checked = s.SrcFilters[s_filters[i].flag]; break; case DECODER: l = &m_listTra; checked = s.TraFilters[s_filters[i].flag]; break; case DXVA_DECODER: l = &m_listTra; checked = s.DXVAFilters[s_filters[i].flag]; break; case FFMPEG_DECODER: l = &m_listTra; checked = s.FFmpegFilters[s_filters[i].flag]; break; default: l = NULL; checked = false; } if (l) { l->AddFilter(&s_filters[i], checked); } } m_listSrc.UpdateCheckState(); m_listTra.UpdateCheckState(); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }