/**
- * @file PropLineFilter.cpp
+ * @file LineFiltersDlg.cpp
*
* @brief Implementation of Line Filter dialog
*/
/////////////////////////////////////////////////////////////////////////////
// CPropLineFilter property page
-IMPLEMENT_DYNAMIC(CPropLineFilter, CPropertyPage)
+IMPLEMENT_DYNAMIC(LineFiltersDlg, CPropertyPage)
-CPropLineFilter::CPropLineFilter()
-: CPropertyPage(CPropLineFilter::IDD)
+/**
+ * @brief Constructor.
+ */
+LineFiltersDlg::LineFiltersDlg()
+: CPropertyPage(LineFiltersDlg::IDD)
, m_pList(NULL)
, m_bEditing(FALSE)
{
- //{{AFX_DATA_INIT(CPropLineFilter)
+ //{{AFX_DATA_INIT(LineFiltersDlg)
m_bIgnoreRegExp = FALSE;
//}}AFX_DATA_INIT
m_strCaption = theApp.LoadDialogCaption(m_lpszTemplateName).c_str();
m_psp.dwFlags |= PSP_USEHICON;
}
-CPropLineFilter::~CPropLineFilter()
-{
-}
-
-void CPropLineFilter::DoDataExchange(CDataExchange* pDX)
+void LineFiltersDlg::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CPropLineFilter)
+ //{{AFX_DATA_MAP(LineFiltersDlg)
DDX_Check(pDX, IDC_IGNOREREGEXP, m_bIgnoreRegExp);
//}}AFX_DATA_MAP
DDX_Control(pDX, IDC_LFILTER_LIST, m_filtersList);
}
-BEGIN_MESSAGE_MAP(CPropLineFilter, CPropertyPage)
- //{{AFX_MSG_MAP(CPropLineFilter)
+BEGIN_MESSAGE_MAP(LineFiltersDlg, CPropertyPage)
+ //{{AFX_MSG_MAP(LineFiltersDlg)
ON_BN_CLICKED(IDC_IGNOREREGEXP, OnIgnoreregexp)
ON_COMMAND(ID_HELP, OnHelp)
//}}AFX_MSG_MAP
/////////////////////////////////////////////////////////////////////////////
// CPropLineFilter message handlers
-BOOL CPropLineFilter::OnInitDialog()
+/**
+ * @brief Initialize the dialog.
+ */
+BOOL LineFiltersDlg::OnInitDialog()
{
theApp.TranslateDialog(m_hWnd);
CPropertyPage::OnInitDialog();
// EXCEPTION: OCX Property Pages should return FALSE
}
-void CPropLineFilter::InitList()
+/**
+ * @brief Initialize the filter list in the dialog.
+ * This function adds current line filters to the filter list.
+ */
+void LineFiltersDlg::InitList()
{
// Show selection across entire row.
DWORD newstyle = LVS_EX_CHECKBOXES | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT |
UpdateData(FALSE);
}
-/// User clicked the ignore checkbox
-void CPropLineFilter::OnIgnoreregexp()
+/**
+ * @brief User clicked filter enable/disable checkbox.
+ */
+void LineFiltersDlg::OnIgnoreregexp()
{
UpdateData();
}
-/** @brief Open help from mainframe when user presses F1*/
-void CPropLineFilter::OnHelp()
+/**
+ * @brief Open help from mainframe when user presses F1.
+ */
+void LineFiltersDlg::OnHelp()
{
GetMainFrame()->ShowHelp(FilterHelpLocation);
}
* @param [in] enabled Is filter enabled?
* @return Index of added row.
*/
-int CPropLineFilter::AddRow(LPCTSTR filter /*= NULL*/, BOOL enabled /*=FALSE*/)
+int LineFiltersDlg::AddRow(LPCTSTR filter /*= NULL*/, BOOL enabled /*=FALSE*/)
{
int items = m_filtersList.GetItemCount();
int ind = m_filtersList.InsertItem(items + 1, filter);
/**
* @brief Edit currently selected filter.
*/
-void CPropLineFilter::EditSelectedFilter()
+void LineFiltersDlg::EditSelectedFilter()
{
int sel =- 1;
m_filtersList.SetFocus();
/**
* @brief Called when Add-button is clicked.
*/
-void CPropLineFilter::OnBnClickedLfilterAddBtn()
+void LineFiltersDlg::OnBnClickedLfilterAddBtn()
{
int ind = AddRow(_T(""));
if (ind >= -1)
/**
* @brief Called when Edit button is clicked.
*/
-void CPropLineFilter::OnBnClickedLfilterEditbtn()
+void LineFiltersDlg::OnBnClickedLfilterEditbtn()
{
EditSelectedFilter();
}
/**
* @brief Save filters to list when exiting the dialog.
*/
-void CPropLineFilter::OnOK()
+void LineFiltersDlg::OnOK()
{
m_pList->Empty();
* @brief Sets external filter list.
* @param [in] list External filter list.
*/
-void CPropLineFilter::SetList(LineFiltersList * list)
+void LineFiltersDlg::SetList(LineFiltersList * list)
{
m_pList = list;
}
/**
* @brief Called when Remove button is clicked.
*/
-void CPropLineFilter::OnBnClickedLfilterRemovebtn()
+void LineFiltersDlg::OnBnClickedLfilterRemovebtn()
{
int sel =- 1;
sel = m_filtersList.GetNextItem(sel, LVNI_SELECTED);
/**
* @brief Called when Save button is clicked.
*/
-void CPropLineFilter::OnBnClickedLfilterEditsave()
+void LineFiltersDlg::OnBnClickedLfilterEditsave()
{
SaveItem();
}
/**
* @brief Cancel editing of filter when ESC is pressed.
*/
-BOOL CPropLineFilter::PreTranslateMessage(MSG* pMsg)
+BOOL LineFiltersDlg::PreTranslateMessage(MSG* pMsg)
{
if (m_bEditing)
{
/**
* @brief Called when selected item in list changes.
*/
-void CPropLineFilter::OnLvnItemActivateLfilterList(NMHDR *pNMHDR, LRESULT *pResult)
+void LineFiltersDlg::OnLvnItemActivateLfilterList(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMITEMACTIVATE pNMIA = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
int item = pNMIA->iItem;
/**
* @brief Save the current filter in edit box.
*/
-void CPropLineFilter::SaveItem()
+void LineFiltersDlg::SaveItem()
{
if (m_bEditing)
{
/**
* @brief Called when filter edit box loses its focus.
*/
-void CPropLineFilter::OnEnKillfocusLfilterEditbox()
+void LineFiltersDlg::OnEnKillfocusLfilterEditbox()
{
SaveItem();
}
/**
- * @file PropLineFilter.h
+ * @file LineFiltersDlg.h
*
* @brief Declaration file for Line Filter dialog
*
// ID line follows -- this is updated by SVN
// $Id$
-#include "afxcmn.h"
-#include "afxwin.h"
#if !defined(AFX_PROPFILTER_H__73E79E13_34DD_4C86_A3EC_A1044B721CCA__INCLUDED_)
#define AFX_PROPFILTER_H__73E79E13_34DD_4C86_A3EC_A1044B721CCA__INCLUDED_
class LineFiltersList;
-/// Class for Line filter propertypage
-class CPropLineFilter : public CPropertyPage
+/**
+ * @brief A dialog for editing and selecting used line filters.
+ * This dialog allows user to add, edit and remove line filters. Currently
+ * active filters are selected by enabling their checkbox.
+ */
+class LineFiltersDlg : public CPropertyPage
{
- DECLARE_DYNAMIC(CPropLineFilter)
+ DECLARE_DYNAMIC(LineFiltersDlg)
// Construction
public:
- CPropLineFilter();
- ~CPropLineFilter();
+ LineFiltersDlg();
void SetList(LineFiltersList * list);
// Dialog Data
- //{{AFX_DATA(CPropLineFilter)
+ //{{AFX_DATA(LineFiltersDlg)
enum { IDD = IDD_PROPPAGE_FILTER };
BOOL m_bIgnoreRegExp;
//}}AFX_DATA
-// Implementation
-
// Overrides
// ClassWizard generate virtual function overrides
- //{{AFX_VIRTUAL(CPropLineFilter)
+ //{{AFX_VIRTUAL(LineFiltersDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
protected:
// Generated message map functions
- //{{AFX_MSG(CPropLineFilter)
+ //{{AFX_MSG(LineFiltersDlg)
virtual BOOL OnInitDialog();
afx_msg void OnIgnoreregexp();
afx_msg void OnHelp();
{
String title = theApp.LoadString(IDS_FILTER_TITLE);
CPropertySheet sht(title.c_str());
- CPropLineFilter filter;
+ LineFiltersDlg lineFiltersDlg;
FileFiltersDlg fileFiltersDlg;
FILEFILTER_INFOLIST fileFilters;
LineFiltersList * lineFilters = new LineFiltersList();
CString selectedFilter;
sht.AddPage(&fileFiltersDlg);
- sht.AddPage(&filter);
+ sht.AddPage(&lineFiltersDlg);
sht.m_psh.dwFlags |= PSH_NOAPPLYNOW; // Hide 'Apply' button since we don't need it
// Make sure all filters are up-to-date
theApp.m_globalFileFilter.GetFileFilters(&fileFilters, selectedFilter);
fileFiltersDlg.SetFilterArray(&fileFilters);
fileFiltersDlg.SetSelected(selectedFilter);
- filter.m_bIgnoreRegExp = GetOptionsMgr()->GetBool(OPT_LINEFILTER_ENABLED);
+ lineFiltersDlg.m_bIgnoreRegExp = GetOptionsMgr()->GetBool(OPT_LINEFILTER_ENABLED);
lineFilters->CloneFrom(m_pLineFilters);
- filter.SetList(lineFilters);
+ lineFiltersDlg.SetList(lineFilters);
if (sht.DoModal() == IDOK)
{
CString sFilter = theApp.m_globalFileFilter.GetFilterNameOrMask();
GetOptionsMgr()->SaveOption(OPT_FILEFILTER_CURRENT, sFilter);
}
- GetOptionsMgr()->SaveOption(OPT_LINEFILTER_ENABLED, filter.m_bIgnoreRegExp == TRUE);
+ GetOptionsMgr()->SaveOption(OPT_LINEFILTER_ENABLED, lineFiltersDlg.m_bIgnoreRegExp == TRUE);
m_pLineFilters->CloneFrom(lineFilters);
m_pLineFilters->SaveFilters();