Update the changelog
[opencv] / apps / CamShiftDemo / CamShiftDemo.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*/
41 // CamShiftDemo.cpp : Defines the class behaviors for the application.
42 //
43
44 #include "stdafx.h"
45 #include "math.h"
46 #include "CamShiftDemo.h"
47
48 #include "MainFrm.h"
49 #include "CamShiftDemoDoc.h"
50 #include "CamShiftDemoView.h"
51
52 #ifdef _DEBUG
53 #define new DEBUG_NEW
54 #undef THIS_FILE
55 static char THIS_FILE[] = __FILE__;
56 #endif
57
58 /////////////////////////////////////////////////////////////////////////////
59 // CCamShiftDemoApp
60
61 BEGIN_MESSAGE_MAP(CCamShiftDemoApp, CWinApp)
62         //{{AFX_MSG_MAP(CCamShiftDemoApp)
63         ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
64                 // NOTE - the ClassWizard will add and remove mapping macros here.
65                 //    DO NOT EDIT what you see in these blocks of generated code!
66         //}}AFX_MSG_MAP
67         // Standard file based document commands
68         ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
69         ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
70 END_MESSAGE_MAP()
71
72 /////////////////////////////////////////////////////////////////////////////
73 // CCamShiftDemoApp construction
74
75 CCamShiftDemoApp::CCamShiftDemoApp()
76 {
77         // TODO: add construction code here,
78         // Place all significant initialization in InitInstance
79 }
80
81 /////////////////////////////////////////////////////////////////////////////
82 // The one and only CCamShiftDemoApp object
83
84 CCamShiftDemoApp theApp;
85
86 /////////////////////////////////////////////////////////////////////////////
87 // CCamShiftDemoApp initialization
88
89 BOOL CCamShiftDemoApp::InitInstance()
90 {
91         AfxEnableControlContainer();
92     
93         // Standard initialization
94         // If you are not using these features and wish to reduce the size
95         //  of your final executable, you should remove from the following
96         //  the specific initialization routines you do not need.
97
98 #ifdef _AFXDLL
99         Enable3dControls();                     // Call this when using MFC in a shared DLL
100 #else
101         Enable3dControlsStatic();       // Call this when linking to MFC statically
102 #endif
103
104         // Change the registry key under which our settings are stored.
105         // TODO: You should modify this string to be something appropriate
106         // such as the name of your company or organization.
107         SetRegistryKey(_T("Local AppWizard-Generated Applications"));
108
109         LoadStdProfileSettings();  // Load standard INI file options (including MRU)
110
111         // Register the application's document templates.  Document templates
112         //  serve as the connection between documents, frame windows and views.
113
114         CSingleDocTemplate* pDocTemplate;
115         pDocTemplate = new CSingleDocTemplate(
116                 IDR_MAINFRAME,
117                 RUNTIME_CLASS(CCamShiftDemoDoc),
118                 RUNTIME_CLASS(CMainFrame),       // main SDI frame window
119                 RUNTIME_CLASS(CCamShiftDemoView));
120         AddDocTemplate(pDocTemplate);
121
122         // Parse command line for standard shell commands, DDE, file open
123         CCommandLineInfo cmdInfo;
124         ParseCommandLine(cmdInfo);
125
126         // Dispatch commands specified on the command line
127         if (!ProcessShellCommand(cmdInfo))
128                 return FALSE;
129
130         // The one and only window has been initialized, so show and update it.
131         m_pMainWnd->ShowWindow(SW_SHOW);
132         m_pMainWnd->UpdateWindow();
133
134         return TRUE;
135 }
136
137
138 /////////////////////////////////////////////////////////////////////////////
139 // CAboutDlg dialog used for App About
140
141 class CAboutDlg : public CDialog
142 {
143 public:
144         CAboutDlg();
145
146 // Dialog Data
147         //{{AFX_DATA(CAboutDlg)
148         enum { IDD = IDD_ABOUTBOX };
149         //}}AFX_DATA
150
151         // ClassWizard generated virtual function overrides
152         //{{AFX_VIRTUAL(CAboutDlg)
153         protected:
154         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
155         //}}AFX_VIRTUAL
156
157 // Implementation
158 protected:
159         //{{AFX_MSG(CAboutDlg)
160                 // No message handlers
161         //}}AFX_MSG
162         DECLARE_MESSAGE_MAP()
163 };
164
165 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
166 {
167         //{{AFX_DATA_INIT(CAboutDlg)
168         //}}AFX_DATA_INIT
169 }
170
171 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
172 {
173         CDialog::DoDataExchange(pDX);
174         //{{AFX_DATA_MAP(CAboutDlg)
175         //}}AFX_DATA_MAP
176 }
177
178 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
179         //{{AFX_MSG_MAP(CAboutDlg)
180                 // No message handlers
181         //}}AFX_MSG_MAP
182 END_MESSAGE_MAP()
183
184 // App command to run the dialog
185 void CCamShiftDemoApp::OnAppAbout()
186 {
187         CAboutDlg aboutDlg;
188         aboutDlg.DoModal();
189 }
190
191 /////////////////////////////////////////////////////////////////////////////
192 // CCamShiftDemoApp message handlers
193
194
195 /* End of file. */