⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propertydlg.h

📁 BCAM 1394 Driver
💻 H
字号:
//-----------------------------------------------------------------------------
//  (c) 2002 by Basler Vision Technologies
//  Section:  Vision Components
//  Project:  BCAM
//  $Header: PropertyDlg.h, 6, 07.01.2003 16:57:34, Happe, A.$
//-----------------------------------------------------------------------------
/**
  \file     PropertyDlg.h
 *
  \brief   The property pages of the camera's properties dialog
 */
//-----------------------------------------------------------------------------


#if !defined(AFX_PROPERTYDLG_H__496DD926_9BBE_11D5_9232_0090278E5E96__INCLUDED_)
#define AFX_PROPERTYDLG_H__496DD926_9BBE_11D5_9232_0090278E5E96__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

//------------------------------------------------------------------------------
// class CInfoPropertyPage
// Author: 
//------------------------------------------------------------------------------
/**
 * \brief   The info tab of the camera properties
 *
 */
//------------------------------------------------------------------------------

class CInfoPropertyPage 
: public CPropertyPageImpl<CInfoPropertyPage>,
  public CWinDataExchange<CInfoPropertyPage>
{
  typedef CPropertyPageImpl<CInfoPropertyPage> dlgBase;
  
public:
  enum { IDD = IDD_INFOPROPERTYPAGE };

  CInfoPropertyPage(CCamera& Camera)  :
    m_strModel("N/A"),
      m_strVendor("N/A"),
      m_strNodeId("N/A"),
      m_strDriverVersion("N/A"),
      m_strCameraVersion("N/A"),
      m_strDeviceName("N/A")

  {
    try
    {
      m_strModel = Camera.Info.ModelName();
    }
    catch ( BcamException& ) { /* NOP */ }

    try
    {
      m_strVendor = Camera.Info.VendorName();
    }
    catch ( BcamException& ) { /* NOP */ }

    try
    {
      m_strNodeId = Camera.Info.NodeId();
    }
    catch ( BcamException& ) { /* NOP */ }

    try
    {
      m_strDriverVersion = Camera.Info.DriverSoftwareVersion();
    }
    catch ( BcamException& ) { /* NOP */ }

    try
    {
      m_strCameraVersion = Camera.Info.CameraFirmwareVersion();
    }
    catch ( BcamException& ) { /* NOP */ }

    try
    {
      m_strDeviceName = Camera.Info.DeviceName();
    }
    catch ( BcamException& ) { /* NOP */ }
  }

  
  BEGIN_MSG_MAP(CInfoPropertyPage)
    COMMAND_HANDLER(IDC_BUTTON_COPYINFO2CLIPPBOARD, BN_CLICKED, OnEditCopy)
    CHAIN_MSG_MAP(dlgBase)
  END_MSG_MAP()

  BEGIN_DDX_MAP(CInfoPropertyPage)
    DDX_TEXT(IDC_STATIC_MODEL, m_strModel)
    DDX_TEXT(IDC_STATIC_VENDOR, m_strVendor)
    DDX_TEXT(IDC_STATIC_NODEID, m_strNodeId)
    DDX_TEXT(IDC_STATIC_DRIVERVERSION, m_strDriverVersion)
    DDX_TEXT(IDC_STATIC_CAMERAVERSION, m_strCameraVersion)
    DDX_TEXT(IDC_STATIC_DEVICENAME, m_strDeviceName)
  END_DDX_MAP()


  BOOL OnSetActive() { return DoDataExchange(FALSE); }


private:
  CString m_strModel;
  CString m_strVendor;
  CString m_strNodeId;
  CString m_strDriverVersion; 
  CString m_strCameraVersion;
  CString m_strDeviceName;

  LRESULT OnEditCopy(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
  {
    if (! OpenClipboard() )
      return 1; 
    EmptyClipboard(); 
    
    CString clpboardString = "Model: " + m_strModel + "\r\nVendor: " + m_strVendor + "\r\nNode ID: " + m_strNodeId + "\r\nDriver Version: " 
      + m_strDriverVersion + "\r\nFirmware Version: " + m_strCameraVersion + "\r\nDevice Name: " + m_strDeviceName + "\r\n";
    
    HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, ( clpboardString.GetLength() + 1) * sizeof(TCHAR)); 
    
    if (hglbCopy == NULL) 
    { 
      CloseClipboard(); 
      return 1; 
    } 
    LPTSTR  lptstrCopy = (LPTSTR) GlobalLock(hglbCopy); 
    memcpy(lptstrCopy, (LPCTSTR) clpboardString, clpboardString.GetLength() + 1);
    GlobalUnlock(hglbCopy);
    SetClipboardData(CF_TEXT, hglbCopy);
    CloseClipboard();
    return 0;
  }

};

//------------------------------------------------------------------------------
// class CFormatPropertyPage
// Author: 
// Date: 20.09.2002
//------------------------------------------------------------------------------
/**
 * \brief   The Video Format tab
 *
 */
//------------------------------------------------------------------------------

class CFormatPropertyPage : public CPropertyPageImpl<CFormatPropertyPage>
{
  typedef CPropertyPageImpl<CFormatPropertyPage> dlgBase;
  
public:

  CFormatPropertyPage(CCamera& Camera) : m_Camera(Camera) { }
  enum { IDD = IDD_FORMATPROPERTYPAGE };
  
  BEGIN_MSG_MAP(CFormatPropertyPage)
    MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
    COMMAND_HANDLER(IDC_COMBO_FORMAT, CBN_SELCHANGE, OnFormatChanged)
    COMMAND_HANDLER(IDC_COMBO_MODE, CBN_SELCHANGE, OnModeChanged)
    COMMAND_HANDLER(IDC_COMBO_FRAMERATE, CBN_SELCHANGE, OnRate_ColorChanged)
    CHAIN_MSG_MAP(dlgBase)
  END_MSG_MAP()

  LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
  LRESULT OnFormatChanged(WORD /*code*/, WORD /*id*/, HWND /*hWnd*/,  BOOL& bHandled);
  LRESULT OnModeChanged(WORD /*code*/, WORD /*id*/, HWND /*hWnd*/,  BOOL& bHandled);
  LRESULT OnRate_ColorChanged(WORD /*code*/, WORD /*id*/, HWND /*hWnd*/,  BOOL& bHandled);

  BOOL OnKillActive();


private:
  void GetFormats();
  void GetModes();
  void GetFramerates_Colors();

  typedef map<int, DCSVideoFormat>       Idx2Format_t;
  typedef map<int, DCSVideoMode>         Idx2Mode_t;
  typedef map<int, DCSVideoFrameRate>    Idx2FrameRate_t;
  typedef map<int, DCSColorCode>         Idx2Color_t;

  CCamera&            m_Camera;

  CComboBox           m_cbFormat;
  CComboBox           m_cbMode;
  CComboBox           m_cbFrame_Color;

  Idx2Format_t        m_Idx2Format;
  Idx2Mode_t          m_Idx2Mode;
  Idx2Color_t         m_Idx2Color;
  Idx2FrameRate_t     m_Idx2FrameRate;

  DCSVideoFormat      m_CurrentFormat;
  DCSVideoMode        m_CurrentMode;
  DCSVideoFrameRate   m_CurrentFrameRate;
  DCSColorCode        m_CurrentColorCode;

  DCSVideoFormat      m_OrigFormat;
  DCSVideoMode        m_OrigMode;
  DCSVideoFrameRate   m_OrigFrameRate;
  DCSColorCode        m_OrigColorCode;

    
};

//------------------------------------------------------------------------------
// class CTriggerPropertyPage
// Author: 
//------------------------------------------------------------------------------
/**
 * \brief   The trigger tab
 *
 */
//------------------------------------------------------------------------------
class CTriggerPropertyPage : public CPropertyPageImpl<CTriggerPropertyPage>
{
  typedef CPropertyPageImpl<CTriggerPropertyPage> dlgBase;
  
public:
  enum { IDD = IDD_TRIGGERPROPERTYPAGE };

  CTriggerPropertyPage(CCamera& Camera) : m_Camera(Camera) { }


// message handler
  
  BEGIN_MSG_MAP(CTriggerPropertyPage)
    MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
    COMMAND_HANDLER(IDC_CHECKENABLE, BN_CLICKED, OnEnable)
    COMMAND_HANDLER(IDC_COMBOMODE, CBN_SELCHANGE, OnSelChange)
    COMMAND_HANDLER(IDC_COMBOPOLARITY, CBN_SELCHANGE, OnSelChange)
    CHAIN_MSG_MAP(dlgBase)
  END_MSG_MAP()

  LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
  LRESULT OnEnable(WORD /*code*/, WORD /*id*/, HWND /*hWnd*/,  BOOL& bHandled);
  LRESULT OnSelChange(WORD /*code*/, WORD /*id*/, HWND /*hWnd*/,  BOOL& bHandled);

  BOOL OnKillActive();

private:

  CComboBox       m_ComboBoxMode;
  CComboBox       m_ComboBoxPolarity;
  CCamera&        m_Camera;
    
};

//------------------------------------------------------------------------------
// class CAdvancedPropertyPage
// Author: 
//------------------------------------------------------------------------------
/**
 * \brief   The Advanced Features tab
 *
 */
//------------------------------------------------------------------------------
class CAdvancedPropertyPage : public CPropertyPageImpl<CAdvancedPropertyPage>
{
  typedef CPropertyPageImpl<CAdvancedPropertyPage> dlgBase;
  
public:
  enum { IDD = IDD_ADVANCEDPROPERTYPAGE };

  CAdvancedPropertyPage(CCamera& Camera) : m_Camera(Camera) { }


// message handler
  
  BEGIN_MSG_MAP(CAdvancedPropertyPage)
    MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
    COMMAND_HANDLER(IDC_COMBOTESTIMAGEMODE, CBN_SELCHANGE, OnSelChange)
    COMMAND_HANDLER(IDC_COMBOSHADINGMODE, CBN_SELCHANGE, OnSelChange)
    COMMAND_HANDLER(IDC_UPLOAD_CURRENT, BN_CLICKED, OnClickedUploadCurrent)
    CHAIN_MSG_MAP(dlgBase)
  END_MSG_MAP()

  LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
  LRESULT OnSelChange(WORD /*code*/, WORD /*id*/, HWND /*hWnd*/,  BOOL& bHandled);
  LRESULT OnClickedUploadCurrent(WORD /*code*/, WORD /*id*/, HWND /*hWnd*/,  BOOL& bHandled);

  BOOL OnKillActive();

private:
  BOOL UploadShadingTable(CBcamBitmap& bitmap);

  CComboBox       m_ComboBoxTestImageMode;
  CComboBox       m_ComboBoxShadingMode;
  CCamera&        m_Camera;
    
};


//------------------------------------------------------------------------------
// class CPropertyDlg
// Author: 
// Date: 20.09.2002
//------------------------------------------------------------------------------
/**
 * \brief   The camera properties property dialog
 *
 */
//------------------------------------------------------------------------------
class CPropertyDlg : public CPropertySheetImpl<CPropertyDlg>
{
  typedef CPropertySheetImpl<CPropertyDlg> dlgBase;



public:
  CPropertyDlg(CCamera& Camera);
  virtual ~CPropertyDlg();

  BEGIN_MSG_MAP(CPropertyDlg)
    CHAIN_MSG_MAP(dlgBase)
  END_MSG_MAP()

private:
  CInfoPropertyPage       m_InfoPropertyPage;
  CFormatPropertyPage     m_FormatPropertyPage;
  CTriggerPropertyPage    m_TriggerPropertyPage;
  CAdvancedPropertyPage   m_AdvancedPropertyPage;
};

#endif // !defined(AFX_PROPERTYDLG_H__496DD926_9BBE_11D5_9232_0090278E5E96__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -