commit af22e7a5cdc842a15ab705e94951d0e87446c9ad Author: Xi Xu Date: Tue Sep 10 23:03:29 2024 +0800 Initial commit diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..638b9b9 --- /dev/null +++ b/.clang-format @@ -0,0 +1,39 @@ +AccessModifierOffset: -4 +AlignAfterOpenBracket: DontAlign +AllowShortBlocksOnASingleLine: true +AllowShortFunctionsOnASingleLine: All +BasedOnStyle: LLVM +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterStruct: false + AfterUnion: false + BeforeCatch: true + BeforeElse: true + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true +BreakBeforeBraces: Custom +ColumnLimit: 0 +Cpp11BracedListStyle: false +FixNamespaceComments: false +IndentCaseLabels: false +IndentPPDirectives: None +IndentWidth: 4 +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +PointerAlignment: Right +SortIncludes: false +SortUsingDeclarations: false +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +TabWidth: 4 +UseTab: true diff --git a/Test/.vs/Test/FileContentIndex/7cc99843-d2d6-4cf3-92bd-08c971fb6468.vsidx b/Test/.vs/Test/FileContentIndex/7cc99843-d2d6-4cf3-92bd-08c971fb6468.vsidx new file mode 100644 index 0000000..2a6aaf3 Binary files /dev/null and b/Test/.vs/Test/FileContentIndex/7cc99843-d2d6-4cf3-92bd-08c971fb6468.vsidx differ diff --git a/Test/.vs/Test/v17/.suo b/Test/.vs/Test/v17/.suo new file mode 100644 index 0000000..e29b165 Binary files /dev/null and b/Test/.vs/Test/v17/.suo differ diff --git a/Test/.vs/Test/v17/Browse.VC.db b/Test/.vs/Test/v17/Browse.VC.db new file mode 100644 index 0000000..af120a1 Binary files /dev/null and b/Test/.vs/Test/v17/Browse.VC.db differ diff --git a/Test/.vs/Test/v17/DocumentLayout.json b/Test/.vs/Test/v17/DocumentLayout.json new file mode 100644 index 0000000..928b43f --- /dev/null +++ b/Test/.vs/Test/v17/DocumentLayout.json @@ -0,0 +1,12 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\xixu\\Desktop\\Computer-Graphics\\Test\\", + "Documents": [], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [] + } + ] +} \ No newline at end of file diff --git a/Test/.vs/Test/v17/fileList.bin b/Test/.vs/Test/v17/fileList.bin new file mode 100644 index 0000000..a080e96 Binary files /dev/null and b/Test/.vs/Test/v17/fileList.bin differ diff --git a/Test/.vscode/launch.json b/Test/.vscode/launch.json new file mode 100644 index 0000000..850ce87 --- /dev/null +++ b/Test/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + "configurations": [ + { + "name": "Visual Studio: Start Debugging", + "type": "cppvsdbg", + "request": "launch", + "program": "${workspaceFolder}\\x64\\Debug\\${workspaceFolderBasename}.exe", + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "console": "integratedTerminal", + "preLaunchTask": "Visual Studio: Build Solution", + "internalConsoleOptions": "neverOpen" + } + ], + "version": "0.2.0" +} \ No newline at end of file diff --git a/Test/.vscode/settings.json b/Test/.vscode/settings.json new file mode 100644 index 0000000..d47ab15 --- /dev/null +++ b/Test/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "git.openRepositoryInParentFolders": "never" +} \ No newline at end of file diff --git a/Test/.vscode/tasks.json b/Test/.vscode/tasks.json new file mode 100644 index 0000000..6e0a647 --- /dev/null +++ b/Test/.vscode/tasks.json @@ -0,0 +1,23 @@ +{ + "tasks": [ + { + "type": "shell", + "label": "Visual Studio: Build Solution", + "command": "msbuild", + "args": [ + "${workspaceFolder}\\${workspaceFolderBasename}.sln", + "/p:Configuration=Debug", + "/p:Platform=x64" + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [ + "$msCompile" + ], + "group": "build", + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/Test/Test.sln b/Test/Test.sln new file mode 100644 index 0000000..17892a5 --- /dev/null +++ b/Test/Test.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test\Test.vcxproj", "{61C69A24-AFCE-489B-B0B9-CF00D8F0C6D3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {61C69A24-AFCE-489B-B0B9-CF00D8F0C6D3}.Debug|x64.ActiveCfg = Debug|x64 + {61C69A24-AFCE-489B-B0B9-CF00D8F0C6D3}.Debug|x64.Build.0 = Debug|x64 + {61C69A24-AFCE-489B-B0B9-CF00D8F0C6D3}.Debug|x86.ActiveCfg = Debug|Win32 + {61C69A24-AFCE-489B-B0B9-CF00D8F0C6D3}.Debug|x86.Build.0 = Debug|Win32 + {61C69A24-AFCE-489B-B0B9-CF00D8F0C6D3}.Release|x64.ActiveCfg = Release|x64 + {61C69A24-AFCE-489B-B0B9-CF00D8F0C6D3}.Release|x64.Build.0 = Release|x64 + {61C69A24-AFCE-489B-B0B9-CF00D8F0C6D3}.Release|x86.ActiveCfg = Release|Win32 + {61C69A24-AFCE-489B-B0B9-CF00D8F0C6D3}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4572A883-0B15-4A35-8CFA-98F7FC74ABEA} + EndGlobalSection +EndGlobal diff --git a/Test/Test/MainFrm.cpp b/Test/Test/MainFrm.cpp new file mode 100644 index 0000000..26cb927 --- /dev/null +++ b/Test/Test/MainFrm.cpp @@ -0,0 +1,96 @@ + +// MainFrm.cpp : implementation of the CMainFrame class +// + +#include "pch.h" +#include "framework.h" +#include "Test.h" + +#include "MainFrm.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +// CMainFrame + +IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) + +BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) + ON_WM_CREATE() +END_MESSAGE_MAP() + +static UINT indicators[] = +{ + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, +}; + +// CMainFrame construction/destruction + +CMainFrame::CMainFrame() noexcept +{ + // TODO: add member initialization code here +} + +CMainFrame::~CMainFrame() +{ +} + +int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CFrameWnd::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)) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); + + // 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( !CFrameWnd::PreCreateWindow(cs) ) + return FALSE; + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return TRUE; +} + +// CMainFrame diagnostics + +#ifdef _DEBUG +void CMainFrame::AssertValid() const +{ + CFrameWnd::AssertValid(); +} + +void CMainFrame::Dump(CDumpContext& dc) const +{ + CFrameWnd::Dump(dc); +} +#endif //_DEBUG + + +// CMainFrame message handlers + diff --git a/Test/Test/MainFrm.h b/Test/Test/MainFrm.h new file mode 100644 index 0000000..976d34b --- /dev/null +++ b/Test/Test/MainFrm.h @@ -0,0 +1,43 @@ + +// MainFrm.h : interface of the CMainFrame class +// + +#pragma once + +class CMainFrame : public CFrameWnd +{ + +protected: // create from serialization only + CMainFrame() noexcept; + DECLARE_DYNCREATE(CMainFrame) + +// Attributes +public: + +// Operations +public: + +// Overrides +public: + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + +// Implementation +public: + virtual ~CMainFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: // control bar embedded members + CToolBar m_wndToolBar; + CStatusBar m_wndStatusBar; + +// Generated message map functions +protected: + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + DECLARE_MESSAGE_MAP() + +}; + + diff --git a/Test/Test/Resource.h b/Test/Test/Resource.h new file mode 100644 index 0000000..321619f --- /dev/null +++ b/Test/Test/Resource.h @@ -0,0 +1,19 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Test.rc +// +#define IDD_ABOUTBOX 100 +#define IDP_OLE_INIT_FAILED 100 +#define IDR_MAINFRAME 128 +#define IDR_TestTYPE 130 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 310 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 310 +#define _APS_NEXT_COMMAND_VALUE 32771 +#endif +#endif diff --git a/Test/Test/Test.cpp b/Test/Test/Test.cpp new file mode 100644 index 0000000..f84c26a --- /dev/null +++ b/Test/Test/Test.cpp @@ -0,0 +1,184 @@ + +// Test.cpp : Defines the class behaviors for the application. +// + +#include "pch.h" +#include "framework.h" +#include "afxwinappex.h" +#include "afxdialogex.h" +#include "Test.h" +#include "MainFrm.h" + +#include "TestDoc.h" +#include "TestView.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CTestApp + +BEGIN_MESSAGE_MAP(CTestApp, CWinApp) + ON_COMMAND(ID_APP_ABOUT, &CTestApp::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() + + +// CTestApp construction + +CTestApp::CTestApp() noexcept +{ + + // support Restart Manager + m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS; +#ifdef _MANAGED + // If the application is built using Common Language Runtime support (/clr): + // 1) This additional setting is needed for Restart Manager support to work properly. + // 2) In your project, you must add a reference to System.Windows.Forms in order to build. + System::Windows::Forms::Application::SetUnhandledExceptionMode(System::Windows::Forms::UnhandledExceptionMode::ThrowException); +#endif + + // TODO: replace application ID string below with unique ID string; recommended + // format for string is CompanyName.ProductName.SubProduct.VersionInformation + SetAppID(_T("Test.AppID.NoVersion")); + + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +// The one and only CTestApp object + +CTestApp theApp; + + +// CTestApp initialization + +BOOL CTestApp::InitInstance() +{ + // InitCommonControlsEx() 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. + INITCOMMONCONTROLSEX InitCtrls; + InitCtrls.dwSize = sizeof(InitCtrls); + // Set this to include all the common control classes you want to use + // in your application. + InitCtrls.dwICC = ICC_WIN95_CLASSES; + InitCommonControlsEx(&InitCtrls); + + CWinApp::InitInstance(); + + + // Initialize OLE libraries + if (!AfxOleInit()) + { + AfxMessageBox(IDP_OLE_INIT_FAILED); + return FALSE; + } + + AfxEnableControlContainer(); + + EnableTaskbarInteraction(FALSE); + + // AfxInitRichEdit2() is required to use RichEdit control + // AfxInitRichEdit2(); + + // 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 + CSingleDocTemplate* pDocTemplate; + pDocTemplate = new CSingleDocTemplate( + IDR_MAINFRAME, + RUNTIME_CLASS(CTestDoc), + RUNTIME_CLASS(CMainFrame), // main SDI frame window + RUNTIME_CLASS(CTestView)); + if (!pDocTemplate) + return FALSE; + AddDocTemplate(pDocTemplate); + + + // 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 one and only window has been initialized, so show and update it + m_pMainWnd->ShowWindow(SW_SHOW); + m_pMainWnd->UpdateWindow(); + return TRUE; +} + +int CTestApp::ExitInstance() +{ + //TODO: handle additional resources you may have added + AfxOleTerm(FALSE); + + return CWinApp::ExitInstance(); +} + +// CTestApp message handlers + + +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialogEx +{ +public: + CAboutDlg() noexcept; + +// Dialog Data +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_ABOUTBOX }; +#endif + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + +// Implementation +protected: + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() noexcept : CDialogEx(IDD_ABOUTBOX) +{ +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx) +END_MESSAGE_MAP() + +// App command to run the dialog +void CTestApp::OnAppAbout() +{ + CAboutDlg aboutDlg; + aboutDlg.DoModal(); +} + +// CTestApp message handlers + + + diff --git a/Test/Test/Test.h b/Test/Test/Test.h new file mode 100644 index 0000000..f7e63ba --- /dev/null +++ b/Test/Test/Test.h @@ -0,0 +1,33 @@ + +// Test.h : main header file for the Test application +// +#pragma once + +#ifndef __AFXWIN_H__ + #error "include 'pch.h' before including this file for PCH" +#endif + +#include "resource.h" // main symbols + + +// CTestApp: +// See Test.cpp for the implementation of this class +// + +class CTestApp : public CWinApp +{ +public: + CTestApp() noexcept; + + +// Overrides +public: + virtual BOOL InitInstance(); + virtual int ExitInstance(); + +// Implementation + afx_msg void OnAppAbout(); + DECLARE_MESSAGE_MAP() +}; + +extern CTestApp theApp; diff --git a/Test/Test/Test.rc b/Test/Test/Test.rc new file mode 100644 index 0000000..5a2ee18 Binary files /dev/null and b/Test/Test/Test.rc differ diff --git a/Test/Test/Test.vcxproj b/Test/Test/Test.vcxproj new file mode 100644 index 0000000..016abf5 --- /dev/null +++ b/Test/Test/Test.vcxproj @@ -0,0 +1,221 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + {61C69A24-AFCE-489B-B0B9-CF00D8F0C6D3} + MFCProj + Test + 10.0 + + + + Application + true + v143 + Unicode + Dynamic + + + Application + false + v143 + true + Unicode + Dynamic + + + Application + true + v143 + Unicode + Dynamic + + + Application + false + v143 + true + Unicode + Dynamic + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Use + Level3 + true + _WINDOWS;_DEBUG;%(PreprocessorDefinitions) + pch.h + + + Windows + + + false + true + _DEBUG;%(PreprocessorDefinitions) + + + 0x0409 + _DEBUG;%(PreprocessorDefinitions) + $(IntDir);%(AdditionalIncludeDirectories) + + + + + Use + Level3 + true + WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) + pch.h + + + Windows + + + false + true + _DEBUG;%(PreprocessorDefinitions) + + + 0x0409 + _DEBUG;%(PreprocessorDefinitions) + $(IntDir);%(AdditionalIncludeDirectories) + + + + + Use + Level3 + true + true + true + WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) + pch.h + + + Windows + true + true + + + false + true + NDEBUG;%(PreprocessorDefinitions) + + + 0x0409 + NDEBUG;%(PreprocessorDefinitions) + $(IntDir);%(AdditionalIncludeDirectories) + + + + + Use + Level3 + true + true + true + _WINDOWS;NDEBUG;%(PreprocessorDefinitions) + pch.h + + + Windows + true + true + + + false + true + NDEBUG;%(PreprocessorDefinitions) + + + 0x0409 + NDEBUG;%(PreprocessorDefinitions) + $(IntDir);%(AdditionalIncludeDirectories) + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Test/Test/Test.vcxproj.filters b/Test/Test/Test.vcxproj.filters new file mode 100644 index 0000000..af4317e --- /dev/null +++ b/Test/Test/Test.vcxproj.filters @@ -0,0 +1,81 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + + + Resource Files + + + + + Resource Files + + + Resource Files + + + Resource Files + + + \ No newline at end of file diff --git a/Test/Test/Test.vcxproj.user b/Test/Test/Test.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/Test/Test/Test.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Test/Test/TestDoc.cpp b/Test/Test/TestDoc.cpp new file mode 100644 index 0000000..fc38b88 --- /dev/null +++ b/Test/Test/TestDoc.cpp @@ -0,0 +1,138 @@ + +// TestDoc.cpp : implementation of the CTestDoc class +// + +#include "pch.h" +#include "framework.h" +// SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail +// and search filter handlers and allows sharing of document code with that project. +#ifndef SHARED_HANDLERS +#include "Test.h" +#endif + +#include "TestDoc.h" + +#include + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +// CTestDoc + +IMPLEMENT_DYNCREATE(CTestDoc, CDocument) + +BEGIN_MESSAGE_MAP(CTestDoc, CDocument) +END_MESSAGE_MAP() + + +// CTestDoc construction/destruction + +CTestDoc::CTestDoc() noexcept +{ + // TODO: add one-time construction code here + +} + +CTestDoc::~CTestDoc() +{ +} + +BOOL CTestDoc::OnNewDocument() +{ + if (!CDocument::OnNewDocument()) + return FALSE; + + // TODO: add reinitialization code here + // (SDI documents will reuse this document) + + return TRUE; +} + + + + +// CTestDoc serialization + +void CTestDoc::Serialize(CArchive& ar) +{ + if (ar.IsStoring()) + { + // TODO: add storing code here + } + else + { + // TODO: add loading code here + } +} + +#ifdef SHARED_HANDLERS + +// Support for thumbnails +void CTestDoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds) +{ + // Modify this code to draw the document's data + dc.FillSolidRect(lprcBounds, RGB(255, 255, 255)); + + CString strText = _T("TODO: implement thumbnail drawing here"); + LOGFONT lf; + + CFont* pDefaultGUIFont = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)); + pDefaultGUIFont->GetLogFont(&lf); + lf.lfHeight = 36; + + CFont fontDraw; + fontDraw.CreateFontIndirect(&lf); + + CFont* pOldFont = dc.SelectObject(&fontDraw); + dc.DrawText(strText, lprcBounds, DT_CENTER | DT_WORDBREAK); + dc.SelectObject(pOldFont); +} + +// Support for Search Handlers +void CTestDoc::InitializeSearchContent() +{ + CString strSearchContent; + // Set search contents from document's data. + // The content parts should be separated by ";" + + // For example: strSearchContent = _T("point;rectangle;circle;ole object;"); + SetSearchContent(strSearchContent); +} + +void CTestDoc::SetSearchContent(const CString& value) +{ + if (value.IsEmpty()) + { + RemoveChunk(PKEY_Search_Contents.fmtid, PKEY_Search_Contents.pid); + } + else + { + CMFCFilterChunkValueImpl *pChunk = nullptr; + ATLTRY(pChunk = new CMFCFilterChunkValueImpl); + if (pChunk != nullptr) + { + pChunk->SetTextValue(PKEY_Search_Contents, value, CHUNK_TEXT); + SetChunkValue(pChunk); + } + } +} + +#endif // SHARED_HANDLERS + +// CTestDoc diagnostics + +#ifdef _DEBUG +void CTestDoc::AssertValid() const +{ + CDocument::AssertValid(); +} + +void CTestDoc::Dump(CDumpContext& dc) const +{ + CDocument::Dump(dc); +} +#endif //_DEBUG + + +// CTestDoc commands diff --git a/Test/Test/TestDoc.h b/Test/Test/TestDoc.h new file mode 100644 index 0000000..90a4857 --- /dev/null +++ b/Test/Test/TestDoc.h @@ -0,0 +1,48 @@ + +// TestDoc.h : interface of the CTestDoc class +// + + +#pragma once + + +class CTestDoc : public CDocument +{ +protected: // create from serialization only + CTestDoc() noexcept; + DECLARE_DYNCREATE(CTestDoc) + +// Attributes +public: + +// Operations +public: + +// Overrides +public: + virtual BOOL OnNewDocument(); + virtual void Serialize(CArchive& ar); +#ifdef SHARED_HANDLERS + virtual void InitializeSearchContent(); + virtual void OnDrawThumbnail(CDC& dc, LPRECT lprcBounds); +#endif // SHARED_HANDLERS + +// Implementation +public: + virtual ~CTestDoc(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + DECLARE_MESSAGE_MAP() + +#ifdef SHARED_HANDLERS + // Helper function that sets search content for a Search Handler + void SetSearchContent(const CString& value); +#endif // SHARED_HANDLERS +}; diff --git a/Test/Test/TestView.cpp b/Test/Test/TestView.cpp new file mode 100644 index 0000000..d324646 --- /dev/null +++ b/Test/Test/TestView.cpp @@ -0,0 +1,105 @@ + +// TestView.cpp : implementation of the CTestView class +// + +#include "pch.h" +#include "framework.h" +// SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail +// and search filter handlers and allows sharing of document code with that project. +#ifndef SHARED_HANDLERS +#include "Test.h" +#endif + +#include "TestDoc.h" +#include "TestView.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CTestView + +IMPLEMENT_DYNCREATE(CTestView, CView) + +BEGIN_MESSAGE_MAP(CTestView, 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) +END_MESSAGE_MAP() + +// CTestView construction/destruction + +CTestView::CTestView() noexcept +{ + // TODO: add construction code here + +} + +CTestView::~CTestView() +{ +} + +BOOL CTestView::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return CView::PreCreateWindow(cs); +} + +// CTestView drawing + +void CTestView::OnDraw(CDC* /*pDC*/) +{ + CTestDoc* pDoc = GetDocument(); + ASSERT_VALID(pDoc); + if (!pDoc) + return; + + // TODO: add draw code for native data here +} + + +// CTestView printing + +BOOL CTestView::OnPreparePrinting(CPrintInfo* pInfo) +{ + // default preparation + return DoPreparePrinting(pInfo); +} + +void CTestView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) +{ + // TODO: add extra initialization before printing +} + +void CTestView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) +{ + // TODO: add cleanup after printing +} + + +// CTestView diagnostics + +#ifdef _DEBUG +void CTestView::AssertValid() const +{ + CView::AssertValid(); +} + +void CTestView::Dump(CDumpContext& dc) const +{ + CView::Dump(dc); +} + +CTestDoc* CTestView::GetDocument() const // non-debug version is inline +{ + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTestDoc))); + return (CTestDoc*)m_pDocument; +} +#endif //_DEBUG + + +// CTestView message handlers diff --git a/Test/Test/TestView.h b/Test/Test/TestView.h new file mode 100644 index 0000000..14c192e --- /dev/null +++ b/Test/Test/TestView.h @@ -0,0 +1,49 @@ + +// TestView.h : interface of the CTestView class +// + +#pragma once + + +class CTestView : public CView +{ +protected: // create from serialization only + CTestView() noexcept; + DECLARE_DYNCREATE(CTestView) + +// Attributes +public: + CTestDoc* GetDocument() const; + +// Operations +public: + +// 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); + +// Implementation +public: + virtual ~CTestView(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + DECLARE_MESSAGE_MAP() +}; + +#ifndef _DEBUG // debug version in TestView.cpp +inline CTestDoc* CTestView::GetDocument() const + { return reinterpret_cast(m_pDocument); } +#endif + diff --git a/Test/Test/framework.h b/Test/Test/framework.h new file mode 100644 index 0000000..36afc12 --- /dev/null +++ b/Test/Test/framework.h @@ -0,0 +1,49 @@ +#pragma once + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +#include "targetver.h" + +#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 +#define _AFX_ALL_WARNINGS + +#include // MFC core and standard components +#include // MFC extensions + + +#include // MFC Automation classes + + + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC support for Internet Explorer 4 Common Controls +#endif +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#include // MFC support for ribbons and control bars + + + + + + + + + +#ifdef _UNICODE +#if defined _M_IX86 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") +#elif defined _M_X64 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") +#else +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") +#endif +#endif + + diff --git a/Test/Test/pch.cpp b/Test/Test/pch.cpp new file mode 100644 index 0000000..64b7eef --- /dev/null +++ b/Test/Test/pch.cpp @@ -0,0 +1,5 @@ +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/Test/Test/pch.h b/Test/Test/pch.h new file mode 100644 index 0000000..885d5d6 --- /dev/null +++ b/Test/Test/pch.h @@ -0,0 +1,13 @@ +// pch.h: This is a precompiled header file. +// Files listed below are compiled only once, improving build performance for future builds. +// This also affects IntelliSense performance, including code completion and many code browsing features. +// However, files listed here are ALL re-compiled if any one of them is updated between builds. +// Do not add files here that you will be updating frequently as this negates the performance advantage. + +#ifndef PCH_H +#define PCH_H + +// add headers that you want to pre-compile here +#include "framework.h" + +#endif //PCH_H diff --git a/Test/Test/res/Test.ico b/Test/Test/res/Test.ico new file mode 100644 index 0000000..d56fbcd Binary files /dev/null and b/Test/Test/res/Test.ico differ diff --git a/Test/Test/res/Test.rc2 b/Test/Test/res/Test.rc2 new file mode 100644 index 0000000..2655c50 Binary files /dev/null and b/Test/Test/res/Test.rc2 differ diff --git a/Test/Test/res/TestDoc.ico b/Test/Test/res/TestDoc.ico new file mode 100644 index 0000000..96365d4 Binary files /dev/null and b/Test/Test/res/TestDoc.ico differ diff --git a/Test/Test/res/Toolbar.bmp b/Test/Test/res/Toolbar.bmp new file mode 100644 index 0000000..d501723 Binary files /dev/null and b/Test/Test/res/Toolbar.bmp differ diff --git a/Test/Test/targetver.h b/Test/Test/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/Test/Test/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include