diff options
author | Kitware Robot <kwrobot@kitware.com> | 2016-05-16 14:34:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-16 20:05:19 (GMT) |
commit | d9fd2f5402eeaa345691313658e02b51038f570b (patch) | |
tree | dca71b9a7e267f4c6300da3eb770415381726785 /Tests/MFC | |
parent | 82df6deaafb36cbbfd450202bb20b320f637751a (diff) | |
download | CMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2 |
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
Diffstat (limited to 'Tests/MFC')
-rw-r--r-- | Tests/MFC/mfc1/ChildFrm.cpp | 20 | ||||
-rw-r--r-- | Tests/MFC/mfc1/ChildFrm.h | 28 | ||||
-rw-r--r-- | Tests/MFC/mfc1/MainFrm.cpp | 80 | ||||
-rw-r--r-- | Tests/MFC/mfc1/MainFrm.h | 35 | ||||
-rw-r--r-- | Tests/MFC/mfc1/Resource.h | 18 | ||||
-rw-r--r-- | Tests/MFC/mfc1/mfc1.cpp | 157 | ||||
-rw-r--r-- | Tests/MFC/mfc1/mfc1.h | 18 | ||||
-rw-r--r-- | Tests/MFC/mfc1/mfc1Doc.cpp | 37 | ||||
-rw-r--r-- | Tests/MFC/mfc1/mfc1Doc.h | 32 | ||||
-rw-r--r-- | Tests/MFC/mfc1/mfc1View.cpp | 47 | ||||
-rw-r--r-- | Tests/MFC/mfc1/mfc1View.h | 45 | ||||
-rw-r--r-- | Tests/MFC/mfc1/stdafx.h | 49 |
12 files changed, 267 insertions, 299 deletions
diff --git a/Tests/MFC/mfc1/ChildFrm.cpp b/Tests/MFC/mfc1/ChildFrm.cpp index 889cceb..ddb19c6 100644 --- a/Tests/MFC/mfc1/ChildFrm.cpp +++ b/Tests/MFC/mfc1/ChildFrm.cpp @@ -11,7 +11,6 @@ #define new DEBUG_NEW #endif - // CChildFrame IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) @@ -19,43 +18,40 @@ IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) END_MESSAGE_MAP() - // CChildFrame construction/destruction CChildFrame::CChildFrame() { - // TODO: add member initialization code here + // TODO: add member initialization code here } CChildFrame::~CChildFrame() { } - BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) { - // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs - if( !CMDIChildWnd::PreCreateWindow(cs) ) - return FALSE; + // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT + // cs + if (!CMDIChildWnd::PreCreateWindow(cs)) + return FALSE; - return TRUE; + return TRUE; } - // CChildFrame diagnostics #ifdef _DEBUG void CChildFrame::AssertValid() const { - CMDIChildWnd::AssertValid(); + CMDIChildWnd::AssertValid(); } void CChildFrame::Dump(CDumpContext& dc) const { - CMDIChildWnd::Dump(dc); + CMDIChildWnd::Dump(dc); } #endif //_DEBUG - // CChildFrame message handlers diff --git a/Tests/MFC/mfc1/ChildFrm.h b/Tests/MFC/mfc1/ChildFrm.h index 34b80f1..eedf4d1 100644 --- a/Tests/MFC/mfc1/ChildFrm.h +++ b/Tests/MFC/mfc1/ChildFrm.h @@ -1,34 +1,30 @@ // ChildFrm.h : interface of the CChildFrame class // - #pragma once - class CChildFrame : public CMDIChildWnd { - DECLARE_DYNCREATE(CChildFrame) + DECLARE_DYNCREATE(CChildFrame) public: - CChildFrame(); + CChildFrame(); -// Attributes + // Attributes public: - -// Operations + // Operations public: + // Overrides + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); -// Overrides - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - -// Implementation + // Implementation public: - virtual ~CChildFrame(); + virtual ~CChildFrame(); #ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; #endif -// Generated message map functions + // Generated message map functions protected: - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() }; diff --git a/Tests/MFC/mfc1/MainFrm.cpp b/Tests/MFC/mfc1/MainFrm.cpp index 222c3da..c551065 100644 --- a/Tests/MFC/mfc1/MainFrm.cpp +++ b/Tests/MFC/mfc1/MainFrm.cpp @@ -11,89 +11,81 @@ #define new DEBUG_NEW #endif - // CMainFrame IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) - ON_WM_CREATE() +ON_WM_CREATE() END_MESSAGE_MAP() -static UINT indicators[] = -{ - ID_SEPARATOR, // status line indicator - ID_INDICATOR_CAPS, - ID_INDICATOR_NUM, - ID_INDICATOR_SCRL, +static UINT indicators[] = { + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; - // CMainFrame construction/destruction CMainFrame::CMainFrame() { - // TODO: add member initialization code here + // TODO: add member initialization code here } CMainFrame::~CMainFrame() { } - int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { - if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) - return -1; - - if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP - | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || - !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) - { - TRACE0("Failed to create toolbar\n"); - return -1; // fail to create - } - - if (!m_wndStatusBar.Create(this) || - !m_wndStatusBar.SetIndicators(indicators, - sizeof(indicators)/sizeof(UINT))) - { - TRACE0("Failed to create status bar\n"); - return -1; // fail to create - } - // TODO: Delete these three lines if you don't want the toolbar to be dockable - m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); - EnableDocking(CBRS_ALIGN_ANY); - DockControlBar(&m_wndToolBar); - - return 0; + if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | + CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | + CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators) / sizeof(UINT))) { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + // TODO: Delete these three lines if you don't want the toolbar to be + // dockable + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar); + + return 0; } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { - if( !CMDIFrameWnd::PreCreateWindow(cs) ) - return FALSE; - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs + if (!CMDIFrameWnd::PreCreateWindow(cs)) + return FALSE; + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs - return TRUE; + return TRUE; } - // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { - CMDIFrameWnd::AssertValid(); + CMDIFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { - CMDIFrameWnd::Dump(dc); + CMDIFrameWnd::Dump(dc); } #endif //_DEBUG - // CMainFrame message handlers diff --git a/Tests/MFC/mfc1/MainFrm.h b/Tests/MFC/mfc1/MainFrm.h index 1039ac5..3b965c9 100644 --- a/Tests/MFC/mfc1/MainFrm.h +++ b/Tests/MFC/mfc1/MainFrm.h @@ -1,38 +1,35 @@ // MainFrm.h : interface of the CMainFrame class // - #pragma once class CMainFrame : public CMDIFrameWnd { - DECLARE_DYNAMIC(CMainFrame) + DECLARE_DYNAMIC(CMainFrame) public: - CMainFrame(); + CMainFrame(); -// Attributes + // Attributes public: - -// Operations + // Operations public: - -// Overrides + // Overrides public: - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); -// Implementation + // Implementation public: - virtual ~CMainFrame(); + virtual ~CMainFrame(); #ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; #endif -protected: // control bar embedded members - CStatusBar m_wndStatusBar; - CToolBar m_wndToolBar; +protected: // control bar embedded members + CStatusBar m_wndStatusBar; + CToolBar m_wndToolBar; -// Generated message map functions + // Generated message map functions protected: - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - DECLARE_MESSAGE_MAP() + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + DECLARE_MESSAGE_MAP() }; diff --git a/Tests/MFC/mfc1/Resource.h b/Tests/MFC/mfc1/Resource.h index 0a9c13f..7184e30 100644 --- a/Tests/MFC/mfc1/Resource.h +++ b/Tests/MFC/mfc1/Resource.h @@ -2,19 +2,19 @@ // Microsoft Visual C++ generated include file. // Used by mfc1.rc // -#define IDD_ABOUTBOX 100 -#define IDP_OLE_INIT_FAILED 100 -#define IDR_MAINFRAME 128 -#define IDR_mfc1TYPE 129 -#define IDR_MANIFEST CREATEPROCESS_MANIFEST_RESOURCE_ID +#define IDD_ABOUTBOX 100 +#define IDP_OLE_INIT_FAILED 100 +#define IDR_MAINFRAME 128 +#define IDR_mfc1TYPE 129 +#define IDR_MANIFEST CREATEPROCESS_MANIFEST_RESOURCE_ID // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 130 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 32771 #endif #endif diff --git a/Tests/MFC/mfc1/mfc1.cpp b/Tests/MFC/mfc1/mfc1.cpp index 1777d7f..664c6c4 100644 --- a/Tests/MFC/mfc1/mfc1.cpp +++ b/Tests/MFC/mfc1/mfc1.cpp @@ -14,28 +14,25 @@ #define new DEBUG_NEW #endif - // Cmfc1App BEGIN_MESSAGE_MAP(Cmfc1App, CWinApp) - ON_COMMAND(ID_APP_ABOUT, OnAppAbout) - // Standard file based document commands - ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) - ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) - // Standard print setup command - ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) +ON_COMMAND(ID_APP_ABOUT, OnAppAbout) +// Standard file based document commands +ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) +ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) +// Standard print setup command +ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) END_MESSAGE_MAP() - // Cmfc1App construction Cmfc1App::Cmfc1App() { - // TODO: add construction code here, - // Place all significant initialization in InitInstance + // TODO: add construction code here, + // Place all significant initialization in InitInstance } - // The one and only Cmfc1App object Cmfc1App theApp; @@ -44,91 +41,92 @@ Cmfc1App theApp; BOOL Cmfc1App::InitInstance() { - // InitCommonControls() is required on Windows XP if an application - // manifest specifies use of ComCtl32.dll version 6 or later to enable - // visual styles. Otherwise, any window creation will fail. - InitCommonControls(); - - CWinApp::InitInstance(); - - // Initialize OLE libraries - if (!AfxOleInit()) - { - AfxMessageBox(IDP_OLE_INIT_FAILED); - return FALSE; - } - AfxEnableControlContainer(); - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need - // Change the registry key under which our settings are stored - // TODO: You should modify this string to be something appropriate - // such as the name of your company or organization - SetRegistryKey(_T("Local AppWizard-Generated Applications")); - LoadStdProfileSettings(4); // Load standard INI file options (including MRU) - // Register the application's document templates. Document templates - // serve as the connection between documents, frame windows and views - CMultiDocTemplate* pDocTemplate; - pDocTemplate = new CMultiDocTemplate(IDR_mfc1TYPE, - RUNTIME_CLASS(Cmfc1Doc), - RUNTIME_CLASS(CChildFrame), // custom MDI child frame - RUNTIME_CLASS(Cmfc1View)); - if (!pDocTemplate) - return FALSE; - AddDocTemplate(pDocTemplate); - // create main MDI Frame window - CMainFrame* pMainFrame = new CMainFrame; - if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) - return FALSE; - m_pMainWnd = pMainFrame; - // call DragAcceptFiles only if there's a suffix - // In an MDI app, this should occur immediately after setting m_pMainWnd - // Enable drag/drop open - m_pMainWnd->DragAcceptFiles(); - // Enable DDE Execute open - EnableShellOpen(); - RegisterShellFileTypes(TRUE); - // Parse command line for standard shell commands, DDE, file open - CCommandLineInfo cmdInfo; - ParseCommandLine(cmdInfo); - // Dispatch commands specified on the command line. Will return FALSE if - // app was launched with /RegServer, /Register, /Unregserver or /Unregister. - if (!ProcessShellCommand(cmdInfo)) - return FALSE; - // The main window has been initialized, so show and update it - pMainFrame->ShowWindow(m_nCmdShow); - pMainFrame->UpdateWindow(); - return TRUE; + // InitCommonControls() is required on Windows XP if an application + // manifest specifies use of ComCtl32.dll version 6 or later to enable + // visual styles. Otherwise, any window creation will fail. + InitCommonControls(); + + CWinApp::InitInstance(); + + // Initialize OLE libraries + if (!AfxOleInit()) { + AfxMessageBox(IDP_OLE_INIT_FAILED); + return FALSE; + } + AfxEnableControlContainer(); + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need + // Change the registry key under which our settings are stored + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + LoadStdProfileSettings(4); // Load standard INI file options (including MRU) + // Register the application's document templates. Document templates + // serve as the connection between documents, frame windows and views + CMultiDocTemplate* pDocTemplate; + pDocTemplate = + new CMultiDocTemplate(IDR_mfc1TYPE, RUNTIME_CLASS(Cmfc1Doc), + RUNTIME_CLASS(CChildFrame), // custom MDI child frame + RUNTIME_CLASS(Cmfc1View)); + if (!pDocTemplate) + return FALSE; + AddDocTemplate(pDocTemplate); + // create main MDI Frame window + CMainFrame* pMainFrame = new CMainFrame; + if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) + return FALSE; + m_pMainWnd = pMainFrame; + // call DragAcceptFiles only if there's a suffix + // In an MDI app, this should occur immediately after setting m_pMainWnd + // Enable drag/drop open + m_pMainWnd->DragAcceptFiles(); + // Enable DDE Execute open + EnableShellOpen(); + RegisterShellFileTypes(TRUE); + // Parse command line for standard shell commands, DDE, file open + CCommandLineInfo cmdInfo; + ParseCommandLine(cmdInfo); + // Dispatch commands specified on the command line. Will return FALSE if + // app was launched with /RegServer, /Register, /Unregserver or /Unregister. + if (!ProcessShellCommand(cmdInfo)) + return FALSE; + // The main window has been initialized, so show and update it + pMainFrame->ShowWindow(m_nCmdShow); + pMainFrame->UpdateWindow(); + return TRUE; } - - // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: - CAboutDlg(); + CAboutDlg(); -// Dialog Data - enum { IDD = IDD_ABOUTBOX }; + // Dialog Data + enum + { + IDD = IDD_ABOUTBOX + }; protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support -// Implementation + // Implementation protected: - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() }; -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +CAboutDlg::CAboutDlg() + : CDialog(CAboutDlg::IDD) { } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { - CDialog::DoDataExchange(pDX); + CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) @@ -137,9 +135,8 @@ END_MESSAGE_MAP() // App command to run the dialog void Cmfc1App::OnAppAbout() { - CAboutDlg aboutDlg; - aboutDlg.DoModal(); + CAboutDlg aboutDlg; + aboutDlg.DoModal(); } - // Cmfc1App message handlers diff --git a/Tests/MFC/mfc1/mfc1.h b/Tests/MFC/mfc1/mfc1.h index c273601..15e970b 100644 --- a/Tests/MFC/mfc1/mfc1.h +++ b/Tests/MFC/mfc1/mfc1.h @@ -3,11 +3,10 @@ #pragma once #ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH +#error include 'stdafx.h' before including this file for PCH #endif -#include "resource.h" // main symbols - +#include "resource.h" // main symbols // Cmfc1App: // See mfc1.cpp for the implementation of this class @@ -16,16 +15,15 @@ class Cmfc1App : public CWinApp { public: - Cmfc1App(); - + Cmfc1App(); -// Overrides + // Overrides public: - virtual BOOL InitInstance(); + virtual BOOL InitInstance(); -// Implementation - afx_msg void OnAppAbout(); - DECLARE_MESSAGE_MAP() + // Implementation + afx_msg void OnAppAbout(); + DECLARE_MESSAGE_MAP() }; extern Cmfc1App theApp; diff --git a/Tests/MFC/mfc1/mfc1Doc.cpp b/Tests/MFC/mfc1/mfc1Doc.cpp index db76b06..08ab158 100644 --- a/Tests/MFC/mfc1/mfc1Doc.cpp +++ b/Tests/MFC/mfc1/mfc1Doc.cpp @@ -11,7 +11,6 @@ #define new DEBUG_NEW #endif - // Cmfc1Doc IMPLEMENT_DYNCREATE(Cmfc1Doc, CDocument) @@ -19,13 +18,11 @@ IMPLEMENT_DYNCREATE(Cmfc1Doc, CDocument) BEGIN_MESSAGE_MAP(Cmfc1Doc, CDocument) END_MESSAGE_MAP() - // Cmfc1Doc construction/destruction Cmfc1Doc::Cmfc1Doc() { - // TODO: add one-time construction code here - + // TODO: add one-time construction code here } Cmfc1Doc::~Cmfc1Doc() @@ -34,46 +31,38 @@ Cmfc1Doc::~Cmfc1Doc() BOOL Cmfc1Doc::OnNewDocument() { - if (!CDocument::OnNewDocument()) - return FALSE; + if (!CDocument::OnNewDocument()) + return FALSE; - // TODO: add reinitialization code here - // (SDI documents will reuse this document) + // TODO: add reinitialization code here + // (SDI documents will reuse this document) - return TRUE; + return TRUE; } - - - // Cmfc1Doc serialization void Cmfc1Doc::Serialize(CArchive& ar) { - if (ar.IsStoring()) - { - // TODO: add storing code here - } - else - { - // TODO: add loading code here - } + if (ar.IsStoring()) { + // TODO: add storing code here + } else { + // TODO: add loading code here + } } - // Cmfc1Doc diagnostics #ifdef _DEBUG void Cmfc1Doc::AssertValid() const { - CDocument::AssertValid(); + CDocument::AssertValid(); } void Cmfc1Doc::Dump(CDumpContext& dc) const { - CDocument::Dump(dc); + CDocument::Dump(dc); } #endif //_DEBUG - // Cmfc1Doc commands diff --git a/Tests/MFC/mfc1/mfc1Doc.h b/Tests/MFC/mfc1/mfc1Doc.h index 92d8e35..fb43cba 100644 --- a/Tests/MFC/mfc1/mfc1Doc.h +++ b/Tests/MFC/mfc1/mfc1Doc.h @@ -1,37 +1,33 @@ // mfc1Doc.h : interface of the Cmfc1Doc class // - #pragma once class Cmfc1Doc : public CDocument { protected: // create from serialization only - Cmfc1Doc(); - DECLARE_DYNCREATE(Cmfc1Doc) + Cmfc1Doc(); + DECLARE_DYNCREATE(Cmfc1Doc) -// Attributes + // Attributes public: - -// Operations + // Operations public: + // Overrides +public: + virtual BOOL OnNewDocument(); + virtual void Serialize(CArchive& ar); -// Overrides - public: - virtual BOOL OnNewDocument(); - virtual void Serialize(CArchive& ar); - -// Implementation + // Implementation public: - virtual ~Cmfc1Doc(); + virtual ~Cmfc1Doc(); #ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; #endif protected: - -// Generated message map functions + // Generated message map functions protected: - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() }; diff --git a/Tests/MFC/mfc1/mfc1View.cpp b/Tests/MFC/mfc1/mfc1View.cpp index 8000302..6169ce5 100644 --- a/Tests/MFC/mfc1/mfc1View.cpp +++ b/Tests/MFC/mfc1/mfc1View.cpp @@ -12,24 +12,22 @@ #define new DEBUG_NEW #endif - // Cmfc1View IMPLEMENT_DYNCREATE(Cmfc1View, CView) BEGIN_MESSAGE_MAP(Cmfc1View, CView) - // Standard printing commands - ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) - ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) - ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) +// Standard printing commands +ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) +ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) +ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) END_MESSAGE_MAP() // Cmfc1View construction/destruction Cmfc1View::Cmfc1View() { - // TODO: add construction code here - + // TODO: add construction code here } Cmfc1View::~Cmfc1View() @@ -38,63 +36,60 @@ Cmfc1View::~Cmfc1View() BOOL Cmfc1View::PreCreateWindow(CREATESTRUCT& cs) { - // TODO: Modify the Window class or styles here by modifying - // the CREATESTRUCT cs + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs - return CView::PreCreateWindow(cs); + return CView::PreCreateWindow(cs); } // Cmfc1View drawing void Cmfc1View::OnDraw(CDC* /*pDC*/) { - Cmfc1Doc* pDoc = GetDocument(); - ASSERT_VALID(pDoc); - if (!pDoc) - return; + Cmfc1Doc* pDoc = GetDocument(); + ASSERT_VALID(pDoc); + if (!pDoc) + return; - // TODO: add draw code for native data here + // TODO: add draw code for native data here } - // Cmfc1View printing BOOL Cmfc1View::OnPreparePrinting(CPrintInfo* pInfo) { - // default preparation - return DoPreparePrinting(pInfo); + // default preparation + return DoPreparePrinting(pInfo); } void Cmfc1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { - // TODO: add extra initialization before printing + // TODO: add extra initialization before printing } void Cmfc1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { - // TODO: add cleanup after printing + // TODO: add cleanup after printing } - // Cmfc1View diagnostics #ifdef _DEBUG void Cmfc1View::AssertValid() const { - CView::AssertValid(); + CView::AssertValid(); } void Cmfc1View::Dump(CDumpContext& dc) const { - CView::Dump(dc); + CView::Dump(dc); } Cmfc1Doc* Cmfc1View::GetDocument() const // non-debug version is inline { - ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(Cmfc1Doc))); - return (Cmfc1Doc*)m_pDocument; + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(Cmfc1Doc))); + return (Cmfc1Doc*)m_pDocument; } #endif //_DEBUG - // Cmfc1View message handlers diff --git a/Tests/MFC/mfc1/mfc1View.h b/Tests/MFC/mfc1/mfc1View.h index 4244653..8c827bb 100644 --- a/Tests/MFC/mfc1/mfc1View.h +++ b/Tests/MFC/mfc1/mfc1View.h @@ -1,48 +1,47 @@ // mfc1View.h : interface of the Cmfc1View class // - #pragma once - class Cmfc1View : public CView { protected: // create from serialization only - Cmfc1View(); - DECLARE_DYNCREATE(Cmfc1View) + Cmfc1View(); + DECLARE_DYNCREATE(Cmfc1View) -// Attributes + // Attributes public: - Cmfc1Doc* GetDocument() const; + Cmfc1Doc* GetDocument() const; -// Operations + // Operations +public: + // Overrides public: + virtual void OnDraw(CDC* pDC); // overridden to draw this view + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); -// Overrides - public: - virtual void OnDraw(CDC* pDC); // overridden to draw this view -virtual BOOL PreCreateWindow(CREATESTRUCT& cs); protected: - virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); - virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); - virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); + virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); + virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); + virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); -// Implementation + // Implementation public: - virtual ~Cmfc1View(); + virtual ~Cmfc1View(); #ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; #endif protected: - -// Generated message map functions + // Generated message map functions protected: - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() }; -#ifndef _DEBUG // debug version in mfc1View.cpp +#ifndef _DEBUG // debug version in mfc1View.cpp inline Cmfc1Doc* Cmfc1View::GetDocument() const - { return reinterpret_cast<Cmfc1Doc*>(m_pDocument); } +{ + return reinterpret_cast<Cmfc1Doc*>(m_pDocument); +} #endif diff --git a/Tests/MFC/mfc1/stdafx.h b/Tests/MFC/mfc1/stdafx.h index 654a23f..56f8a6a 100644 --- a/Tests/MFC/mfc1/stdafx.h +++ b/Tests/MFC/mfc1/stdafx.h @@ -5,52 +5,65 @@ #pragma once #ifndef VC_EXTRALEAN -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif // See http://msdn.microsoft.com/en-us/library/6sehtctf.aspx for more info // on WINVER and _WIN32_WINNT -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later. +// Modify the following defines if you have to target a platform prior to the +// ones specified below. +// Refer to MSDN for the latest info on corresponding values for different +// platforms. +#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 + // or later. #if _MSC_VER < 1600 -#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#define WINVER \ + 0x0400 // Change this to the appropriate value to target Windows 98 and + // Windows 2000 or later. #else -#define WINVER 0x0501 // Target Windows XP and later with VS 10 and later +#define WINVER 0x0501 // Target Windows XP and later with VS 10 and later #endif #endif -#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later. +#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or + // later. #if _MSC_VER < 1600 -#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#define _WIN32_WINNT \ + 0x0400 // Change this to the appropriate value to target Windows 98 and + // Windows 2000 or later. #else -#define _WIN32_WINNT 0x0501 // Target Windows XP and later with VS 10 and later +#define _WIN32_WINNT 0x0501 // Target Windows XP and later with VS 10 and later #endif #endif -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or + // later. #if _MSC_VER < 1600 -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#define _WIN32_WINDOWS \ + 0x0410 // Change this to the appropriate value to target Windows Me or later. #endif #endif -#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. +#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. #if _MSC_VER < 1600 -#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later. +#define _WIN32_IE \ + 0x0400 // Change this to the appropriate value to target IE 5.0 or later. #endif #endif -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be + // explicit -// turns off MFC's hiding of some common and often safely ignored warning messages +// turns off MFC's hiding of some common and often safely ignored warning +// messages #define _AFX_ALL_WARNINGS #include <afxdisp.h> // MFC Automation classes #include <afxext.h> // MFC extensions #include <afxwin.h> // MFC core and standard components -#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls +#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls #ifndef _AFX_NO_AFXCMN_SUPPORT -#include <afxcmn.h> // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT +#include <afxcmn.h> // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT |