Filter Library Camera Interface Physics

CFilterDlg_Null Class Reference
[Null Filter]

#include <FilterDlg_Null.h>

Inheritance diagram for CFilterDlg_Null:

CFilterDlg List of all members.

Detailed Description

This is the dialog class for the Null Filter. Its purpose is twofold:
  1. document the features common to all filter dialogs
  2. be a template to create new filter dialogs from (see Developing a New Filter)

The dialog box of this filter lets you enter the factor and the offset value.

The dialog class contains methods to exchange the filter parameters between the dialog fields and the filter object ( DoDataExchange() ), and it contains methods to update the filter's output buffer when a filter parameter on the dialog changed, for example OnChangeEditFactor().

Todo:
change "stdafx.h" in .cpp to <cfl/stdafx.h> when all filters have been adapted. "stdafx.h" is used to determine the contents of the precompiled headers; see prj settings C/C++, precompiled headers, through header "stdafx.h")

Definition at line 56 of file FilterDlg_Null.h.

Protected Member Functions

virtual void DoDataExchange (CDataExchange *pDX)
 Dialog Data Exchange (DDX) / Dialog Data Validation (DDV) support.
afx_msg void OnChangeEditFactor ()
 change the factor
afx_msg void OnChangeEditOffset ()
 change the offset
virtual BOOL OnInitDialog ()
 initialize the dialog
afx_msg void OnCheckAlgorithm ()
 check the algorithm
afx_msg void OnTimeAlgorithm ()
 time performance

Private Types

enum  { IDD = IDD_FILTERDLG_NULL }

Private Attributes

CRealEdit c_Factor
 factor
CRealEdit c_Offset
 offset
CString m_csAlgorithm
 algorithm related output


Constructor & Destructor Documentation

CFilterDlg_Null::CFilterDlg_Null ( CWnd *  pParent = NULL  ) 

The constructor initializes the class' datamembers from the filter's default parameters values.

Here is an example of the constructor.

 CFilterDlg_Null::CFilterDlg_Null(
    CWnd* pParent // = NULL
 ) : CFilterDlg( pParent  ),
     c_Factor     ( true  ),  // signed
     c_Offset     ( true  ),  // signed
     m_csAlgorithm( _T(""))
 {
    //{{AFX_DATA_INIT(CFilterDlg_Null)
    ; // do nothing
    //}}AFX_DATA_INIT
 }

Definition at line 58 of file FilterDlg_Null.cpp.

CFilterDlg_Null::CFilterDlg_Null ( CWnd *  pParent = NULL  ) 

The constructor initializes the class' datamembers from the filter's default parameters values.

Here is an example of the constructor.

 CFilterDlg_Null::CFilterDlg_Null(
    CWnd* pParent // = NULL
 ) : CFilterDlg( pParent  ),
     c_Factor     ( true  ),  // signed
     c_Offset     ( true  ),  // signed
     m_csAlgorithm( _T(""))
 {
    //{{AFX_DATA_INIT(CFilterDlg_Null)
    ; // do nothing
    //}}AFX_DATA_INIT
 }

Definition at line 58 of file FilterDlg_Null.cpp.


Member Function Documentation

void CFilterDlg_Null::DoDataExchange ( CDataExchange *  pDX  )  [protected, virtual]

Method DoDataExchange() is called by the framework to exchange and validate dialog data. Never call this function directly. It is called by the UpdateData member function. Call UpdateData to initialize a dialog box’s controls or retrieve data from a dialog box.

See also:
MSDN CWnd::DoDataExchange()
Here is an example of this method.
 void CFilterDlg_Null::DoDataExchange( CDataExchange* pDX )
 {
    CFilterDlg::DoDataExchange( pDX );
    //{{AFX_DATA_MAP(CFilterDlg_Null)
    DDX_Control( pDX, IDC_NULL_FACTOR, c_Factor );
    DDX_Control( pDX, IDC_NULL_OFFSET, c_Offset );
    DDX_Text   ( pDX, IDC_ALGORITHMOUT, m_csAlgorithm );
    //}}AFX_DATA_MAP
 }

Reimplemented from CFilterDlg.

Definition at line 94 of file FilterDlg_Null.cpp.

References c_Factor, c_Offset, CFilterDlg::DoDataExchange(), and m_csAlgorithm.

void CFilterDlg_Null::OnChangeEditFactor (  )  [protected]

Event handler OnChangeEditFactor() is called when a value has been entered in the Factor entry field of the dialog. Unless the value entered for factor is equal to the filter's factor setting, this method updates the filter's factor setting and applies the filter to the input buffer.

Here is an example of an entry-field-changed event handler.

 void CFilterDlg_Null::OnChangeEditFactor()
 {
    //
    // ensure dialog has been initialized:
    //

    if ( !m_bInitialized )
    {
       return ;
    }

    //
    //  Transfer data from controls to variables:
    //

    Q_ASSERT( 0 != UpdateData() );

    //
    // update filter value and re-apply filter and update view,
    // unless data is unchanged:
    //

    CScanFilterNullPtr pFilter = dynamic_cast<CScanFilterNullPtr>( m_pFilter );

    if ( Q_INVALID( 0 == pFilter ) )
    {
       return ;                          // dynamic_cast failed
    }

    if ( c_Factor.GetValue() != pFilter->GetFactor() )
    {
       pFilter->SetFactor( c_Factor );

       if ( Q_ASSERT( FALSE != pFilter->Apply() ) )
       {
          UpdateView();                  // (void) method
       }
    }
 }

Definition at line 287 of file FilterDlg_Null.cpp.

References c_Factor, CRealEdit::GetValue(), CFilterDlg::m_bInitialized, CFilterDlg::m_pFilter, Q_ASSERT, Q_INVALID, CScanFilterNull::SetFactor(), and CFilterDlg::UpdateView().

void CFilterDlg_Null::OnChangeEditOffset (  )  [protected]

Event handler OnChangeEditOffset() is called when a value has been entered in the Offset entry field of the dialog. Unless the value entered for offset is equal to the filter's offset setting, this method updates the filter's offset setting and applies the filter to the input buffer.

Here is aother example of an entry-field-changed event handler.

 void CFilterDlg_Null::OnChangeEditOffset()
 {
    //
    // ensure dialog has been initialized:
    //

    if ( !m_bInitialized )
    {
       return ;
    }

    //
    //  Transfer data from controls to variables:
    //

    Q_ASSERT( 0 != UpdateData() );

    //
    // update filter value and re-apply filter and update view, 
    // unless data is unchanged:
    //

    CScanFilterNullPtr pFilter = dynamic_cast<CScanFilterNullPtr>( m_pFilter );

    if ( Q_INVALID( 0 == pFilter ) )
    {
       return ;                          // dynamic_cast failed
    }

    if ( c_Offset.GetValue() != pFilter->GetOffset() )
    {
       pFilter->SetOffset( c_Offset );

       if ( Q_ASSERT( FALSE != pFilter->Apply() ) )
       {
          UpdateView();                  // (void)
       }
    }
 }

Definition at line 384 of file FilterDlg_Null.cpp.

References c_Offset, CRealEdit::GetValue(), CFilterDlg::m_bInitialized, CFilterDlg::m_pFilter, Q_ASSERT, Q_INVALID, CScanFilterNull::SetOffset(), and CFilterDlg::UpdateView().

BOOL CFilterDlg_Null::OnInitDialog (  )  [protected, virtual]

Event handler OnInitDialog() initializes the filter's dialog. It creates a filter object, fills the entry fields with the filters (default) settings and focuses one of the dialog's entry fields.

Returns:
0 (dialog successfully initialized and focused), !0 (Failure).
Here is an example of the OnInitDialog() handler.
 BOOL CFilterDlg_Null::OnInitDialog()
 {
    //
    // disregard return value (see MSDN):
    //

    (void) CFilterDlg::OnInitDialog();

    //
    // set the dialog's values from the filter:
    //

    CScanFilterNullPtr pFilter = dynamic_cast<CScanFilterNullPtr>( m_pFilter );

    if ( Q_INVALID( NULL == pFilter ) )
       return 1;

    c_Factor = pFilter->GetFactor();
    c_Offset = pFilter->GetOffset();

    //
    // focus the dialog's first edit field and show updated values:
    //

    c_Factor.Select();

    if ( Q_INVALID( 0 == UpdateData( FALSE ) ) )
       return 1;

    //
    // dialog initialized, we set the focus:
    //

    m_bInitialized = true;

    return 0;
 }

Reimplemented from CFilterDlg.

Definition at line 187 of file FilterDlg_Null.cpp.

References CScanFilterNull::GetFactor(), CFilterDlg::OnInitDialog(), and Q_INVALID.

void CFilterDlg_Null::OnTimeAlgorithm (  )  [protected]

Event handler OnTimeAlgorithm() is called when the Time button is pressed.

Here is an example of it's code.

 void CFilterDlg_Null::OnTimeAlgorithm()
 {
 //   Q_LOG( _T("CFilterDlg_Null::OnTimeAlgorithm()") );

    //
    // ensure dialog has been initialized:
    //

    if ( !m_bInitialized )
    {
       return ;
    }

    CScanFilterNullPtr pFilter = dynamic_cast<CScanFilterNullPtr>( m_pFilter );

    if ( Q_INVALID( 0 == pFilter ) )
    {
       return ;                          // dynamic_cast failed
    }

    //
    // measure performance:
    //

    SetDlgItemText( IDC_ALGORITHMOUT, _T( "measuring performance..." ) );

    SPerformanceTestResult result = pFilter->GetPerformanceTestResult();

    //
    // report result:
    //

    m_csAlgorithm.Format(
       _T( "Processing buffer (%ss): %ss (%d%% buffer)" ),
          CharCptr( CStringPrefix( result.timeBuffer , "%.3lg " ) ),
          CharCptr( CStringPrefix( result.totalTime  , "%.3lg " ) ),
          static_cast<int>( 100 * result.timeBuffer / result.totalTime ) );

    UpdateData( FALSE );
 }

Definition at line 512 of file FilterDlg_Null.cpp.

References CFilterDlg::m_bInitialized, m_csAlgorithm, CFilterDlg::m_pFilter, Q_INVALID, SPerformanceTestResult::timeBuffer, and SPerformanceTestResult::totalTime.


The documentation for this class was generated from the following files:
Camera Filter Library documentation © 2004-2007 by Leiden Probe Microscopy