📄 mainfrm.h
字号:
//-----------------------------------------------------------------------------
// (c) 2002 by Basler Vision Technologies
// Section: Vision Components
// Project: BCAM
// $Header: MainFrm.h, 2, 19.09.2002 15:32:50, Nebelung, H.$
//-----------------------------------------------------------------------------
/**
\file MainFrm.h
\brief Interface of the CMainFrame class.
*/
#pragma once
#include "ChildView.h"
#include "Utilities.h"
#include <queue>
#include <bcam.h>
using namespace std;
using namespace Bcam;
//! Use OneShot (=true) or ContinuousShot(=false) for grabbing
const bool USE_ONESHOT = false;
//! Number of buffers used for grabbing
const unsigned int NUM_BUFFERS = 3;
//! Message fired by the GrabThread if the grab is finshed
const UINT WM_GRAB_FINISHED = WM_USER;
//! Message fired by the GrabThread if the user stops the grabbing
const UINT WM_GRAB_STOPPED = WM_USER + 1;
//! Message fired by the GrabThread if something has gone wrong
const UINT WM_ERROR = WM_USER + 2;
//! Main window of the SDI application. Handles commands.
class CMainFrame : public CFrameWnd
{
public:
//! Default constructor
CMainFrame();
protected:
DECLARE_DYNAMIC(CMainFrame)
// Attributes
public:
// Operations
public:
// Overrides
//{{AFX_VIRTUAL(CMainFrame)
//! Called before the window is created
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//! Dispatches WM_COMMAND
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
//}}AFX_VIRTUAL
// Implementation
public:
//! Called by the applicaition object if the message loop runs dry
BOOL OnIdle( LONG lCount );
//! Destructor
virtual ~CMainFrame();
protected:
//! The status bar
CStatusBar m_wndStatusBar;
//! The tool bar
CToolBar m_wndToolBar;
//!The view showing the bitmap
CChildView m_wndView;
//! The camera
CBcam m_Bcam;
//! True if live grabbing is under way
bool m_LiveGrabbing;
//! Index of the buffer which is currently displayed (-1 = none)
int m_DisplayedBufferIndex;
//! Two images for double-buffering
CDibPtr m_ptrBitmaps[NUM_BUFFERS];
//! Queue holding the buffers recwived
queue<unsigned int> m_BufferQueue;
//! Thread waiting for grab commands to succeed
CThread m_GrabThread;
//! The function of the thread waiting for grab commands to succeed
static DWORD WINAPI GrabThreadProc(void* pParameter);
//! Set true by OnGrabFinished; reset by OnIdle
bool m_GrabFinished;
//! Used to measure the frame rate
CStopWatch m_StopWatch;
//! Frame rate
CMovingAvg<double> m_Fps;
//! True if the Mono8 format of the camera is in fact Bayer8
bool m_IsBayerImage;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
//! Creates the window
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//! Check if someonewants us to die
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
//! Fired if the application should exit
afx_msg void OnAppExit();
//! Fired if grab is to be started
afx_msg void OnGrabLive();
//! Fired if the GrabThread sends a messages indicating that the grab is finished
afx_msg LRESULT OnGrabFinished(WPARAM wParam, LPARAM lParam);
//! Fired if grab is to be finished
afx_msg void OnGrabStop();
//! Fired if the GrabThread sends a messages indicating that it has terminated
afx_msg LRESULT OnGrabStopped(WPARAM wParam, LPARAM lParam);
//! Fired if an error in a thread occurred
afx_msg LRESULT OnError(WPARAM wParam, LPARAM lParam);
//! Fired if the currently shown bitmap should be cleared
afx_msg void OnFileNew();
//! Fired if a bitmap is to be loaded
afx_msg void OnFileOpen();
//! Fired if a bitmap is to be saved
afx_msg void OnFileSave();
//! Fired if the imageshould be copied to the clipboard
afx_msg void OnEditCopy();
//! Fired if the window gets the focus
afx_msg void OnSetFocus(CWnd* pOldWnd);
//! Updates Enable status for FileSave
afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
//! Updates Enable status for FileNew
afx_msg void OnUpdateFileNew(CCmdUI* pCmdUI);
//! Updates Enable status for FileOpen
afx_msg void OnUpdateFileOpen(CCmdUI* pCmdUI);
//! Updates Enable status for GrabLive
afx_msg void OnUpdateGrabLive(CCmdUI* pCmdUI);
//! Updates Enable status for GrabStop
afx_msg void OnUpdateGrabStop(CCmdUI* pCmdUI);
//! Updates Enable status for EditCopy
afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -