Move the sources to trunk
[opencv] / apps / LkDemo / LkDemo.cpp
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 //  By downloading, copying, installing or using the software you agree to this license.
6 //  If you do not agree to this license, do not download, install,
7 //  copy or use the software.
8 //
9 //
10 //                        Intel License Agreement
11 //                For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
14 // Third party copyrights are property of their respective owners.
15 //
16 // Redistribution and use in source and binary forms, with or without modification,
17 // are permitted provided that the following conditions are met:
18 //
19 //   * Redistribution's of source code must retain the above copyright notice,
20 //     this list of conditions and the following disclaimer.
21 //
22 //   * Redistribution's in binary form must reproduce the above copyright notice,
23 //     this list of conditions and the following disclaimer in the documentation
24 //     and/or other materials provided with the distribution.
25 //
26 //   * The name of Intel Corporation may not be used to endorse or promote products
27 //     derived from this software without specific prior written permission.
28 //
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the Intel Corporation or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
39 //
40 //M*/// LkDemo.cpp : Defines the class behaviors for the application.
41 //
42
43 #include "stdafx.h"
44 #include "LkDemo.h"
45
46 #include "MainFrm.h"
47 #include "LkDemoDoc.h"
48 #include "LkDemoView.h"
49
50 #ifdef _DEBUG
51 #define new DEBUG_NEW
52 #undef THIS_FILE
53 static char THIS_FILE[] = __FILE__;
54 #endif
55
56 /////////////////////////////////////////////////////////////////////////////
57 // CLkDemoApp
58
59 BEGIN_MESSAGE_MAP(CLkDemoApp, CWinApp)
60         //{{AFX_MSG_MAP(CLkDemoApp)
61         ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
62                 // NOTE - the ClassWizard will add and remove mapping macros here.
63                 //    DO NOT EDIT what you see in these blocks of generated code!
64         //}}AFX_MSG_MAP
65         // Standard file based document commands
66         ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
67         ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
68 END_MESSAGE_MAP()
69
70 /////////////////////////////////////////////////////////////////////////////
71 // CLkDemoApp construction
72
73 CLkDemoApp::CLkDemoApp()
74 {
75         // TODO: add construction code here,
76         // Place all significant initialization in InitInstance
77 }
78
79 /////////////////////////////////////////////////////////////////////////////
80 // The one and only CLkDemoApp object
81
82 CLkDemoApp theApp;
83
84 /////////////////////////////////////////////////////////////////////////////
85 // CLkDemoApp initialization
86
87 BOOL CLkDemoApp::InitInstance()
88 {
89         AfxEnableControlContainer();
90
91         // Standard initialization
92         // If you are not using these features and wish to reduce the size
93         //  of your final executable, you should remove from the following
94         //  the specific initialization routines you do not need.
95
96 #ifdef _AFXDLL
97         Enable3dControls();                     // Call this when using MFC in a shared DLL
98 #else
99         Enable3dControlsStatic();       // Call this when linking to MFC statically
100 #endif
101
102         // Change the registry key under which our settings are stored.
103         // TODO: You should modify this string to be something appropriate
104         // such as the name of your company or organization.
105         SetRegistryKey(_T("Local AppWizard-Generated Applications"));
106
107         LoadStdProfileSettings();  // Load standard INI file options (including MRU)
108
109         // Register the application's document templates.  Document templates
110         //  serve as the connection between documents, frame windows and views.
111
112         CSingleDocTemplate* pDocTemplate;
113         pDocTemplate = new CSingleDocTemplate(
114                 IDR_MAINFRAME,
115                 RUNTIME_CLASS(CLkDemoDoc),
116                 RUNTIME_CLASS(CMainFrame),       // main SDI frame window
117                 RUNTIME_CLASS(CLkDemoView));
118         AddDocTemplate(pDocTemplate);
119
120         // Parse command line for standard shell commands, DDE, file open
121         CCommandLineInfo cmdInfo;
122         ParseCommandLine(cmdInfo);
123
124         // Dispatch commands specified on the command line
125         if (!ProcessShellCommand(cmdInfo))
126                 return FALSE;
127
128         // The one and only window has been initialized, so show and update it.
129         m_pMainWnd->ShowWindow(SW_SHOW);
130         m_pMainWnd->UpdateWindow();
131
132         return TRUE;
133 }
134
135
136 /////////////////////////////////////////////////////////////////////////////
137 // CAboutDlg dialog used for App About
138
139 class CAboutDlg : public CDialog
140 {
141 public:
142         CAboutDlg();
143
144 // Dialog Data
145         //{{AFX_DATA(CAboutDlg)
146         enum { IDD = IDD_ABOUTBOX };
147         //}}AFX_DATA
148
149         // ClassWizard generated virtual function overrides
150         //{{AFX_VIRTUAL(CAboutDlg)
151         protected:
152         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
153         //}}AFX_VIRTUAL
154
155 // Implementation
156 protected:
157         //{{AFX_MSG(CAboutDlg)
158                 // No message handlers
159         //}}AFX_MSG
160         DECLARE_MESSAGE_MAP()
161 };
162
163 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
164 {
165         //{{AFX_DATA_INIT(CAboutDlg)
166         //}}AFX_DATA_INIT
167 }
168
169 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
170 {
171         CDialog::DoDataExchange(pDX);
172         //{{AFX_DATA_MAP(CAboutDlg)
173         //}}AFX_DATA_MAP
174 }
175
176 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
177         //{{AFX_MSG_MAP(CAboutDlg)
178                 // No message handlers
179         //}}AFX_MSG_MAP
180 END_MESSAGE_MAP()
181
182 // App command to run the dialog
183 void CLkDemoApp::OnAppAbout()
184 {
185         CAboutDlg aboutDlg;
186         aboutDlg.DoModal();
187 }
188
189 /////////////////////////////////////////////////////////////////////////////
190 // CLkDemoApp message handlers
191