source: eviacam/trunk/fuentes/src/newtrackerinformationdlg.cpp @ 567

Last change on this file since 567 was 567, checked in by mabarracus, 4 years ago

updated sources to version 2.0.3

File size: 8.4 KB
Line 
1/////////////////////////////////////////////////////////////////////////////
2// Name:        newtrackerinformationdlg.cpp
3// Purpose:     
4// Author:      C�sar Mauri Loba
5// Modified by:
6// Created:     21/12/2014 14:03:05
7// RCS-ID:     
8// Copyright:   (C) 2008 Cesar Mauri from CREA Sistemes Informatics
9// Licence:     
10/////////////////////////////////////////////////////////////////////////////
11
12// For compilers that support precompilation, includes "wx/wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
16#pragma hdrstop
17#endif
18
19#ifndef WX_PRECOMP
20#include "wx/wx.h"
21#endif
22
23////@begin includes
24////@end includes
25
26#include "eviacamapp.h"
27#include "viacamcontroller.h"
28#include "newtrackerinformationdlg.h"
29#include "configmanager.h"
30#include "pointeraction.h"
31
32////@begin XPM images
33////@end XPM images
34
35
36/*!
37 * NewTrackerInformationDlg type definition
38 */
39
40IMPLEMENT_DYNAMIC_CLASS( NewTrackerInformationDlg, wxDialog )
41
42
43/*!
44 * NewTrackerInformationDlg event table definition
45 */
46
47BEGIN_EVENT_TABLE( NewTrackerInformationDlg, wxDialog )
48
49////@begin NewTrackerInformationDlg event table entries
50    EVT_RADIOBUTTON( ID_RADIOBUTTON_LEGACY_TRACKER, NewTrackerInformationDlg::OnRadiobuttonLegacyTrackerSelected )
51    EVT_CHECKBOX( ID_CHECKBOX_SHOW_ON_STARTUP, NewTrackerInformationDlg::OnCheckboxShowOnStartupClick )
52    EVT_BUTTON( wxID_OK, NewTrackerInformationDlg::OnOkClick )
53////@end NewTrackerInformationDlg event table entries
54
55END_EVENT_TABLE()
56
57
58/*!
59 * NewTrackerInformationDlg constructors
60 */
61
62NewTrackerInformationDlg::NewTrackerInformationDlg()
63{
64    Init();
65}
66
67NewTrackerInformationDlg::NewTrackerInformationDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
68{
69    Init();
70    Create(parent, id, caption, pos, size, style);
71}
72
73
74/*!
75 * NewTrackerInformationDlg creator
76 */
77
78bool NewTrackerInformationDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
79{
80////@begin NewTrackerInformationDlg creation
81    SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
82    wxDialog::Create( parent, id, caption, pos, size, style );
83
84    CreateControls();
85    if (GetSizer())
86    {
87        GetSizer()->SetSizeHints(this);
88    }
89    Centre();
90////@end NewTrackerInformationDlg creation
91    return true;
92}
93
94
95/*!
96 * NewTrackerInformationDlg destructor
97 */
98
99NewTrackerInformationDlg::~NewTrackerInformationDlg()
100{
101////@begin NewTrackerInformationDlg destruction
102////@end NewTrackerInformationDlg destruction
103}
104
105
106/*!
107 * Member initialisation
108 */
109
110void NewTrackerInformationDlg::Init()
111{
112        m_useLegacyTracker = false;
113        m_showOnStartup = false;
114////@begin NewTrackerInformationDlg member initialisation
115    m_chkShowOnStartup = NULL;
116////@end NewTrackerInformationDlg member initialisation
117}
118
119
120/*!
121 * Control creation for NewTrackerInformationDlg
122 */
123
124void NewTrackerInformationDlg::CreateControls()
125{   
126////@begin NewTrackerInformationDlg content construction
127    NewTrackerInformationDlg* itemDialog1 = this;
128
129    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
130    itemDialog1->SetSizer(itemBoxSizer2);
131
132    wxStaticText* itemStaticText3 = new wxStaticText( itemDialog1, wxID_STATIC, _("Improved face tracker"), wxDefaultPosition, wxDefaultSize, 0 );
133    itemStaticText3->SetFont(wxFont(-1, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Sans")));
134    itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_LEFT|wxALL, 5);
135
136    wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("This version of Enable Viacam includes an improved face tracking algorithm. We still provide the old algorithm, but it will most likely be removed in future versions."), wxDefaultPosition, wxDefaultSize, 0 );
137    itemStaticText4->Wrap(400);
138    itemBoxSizer2->Add(itemStaticText4, 0, wxALIGN_LEFT|wxALL, 5);
139
140    wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _("Do you want to use the new face tracker?"), wxDefaultPosition, wxDefaultSize, 0 );
141    itemStaticText5->Wrap(400);
142    itemBoxSizer2->Add(itemStaticText5, 0, wxALIGN_LEFT|wxALL, 5);
143
144    wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
145    itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_LEFT|wxALL, 5);
146
147    wxRadioButton* itemRadioButton7 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON_NEW_TRACKER, _("Yes and adjust some settings automatically (recommended)"), wxDefaultPosition, wxDefaultSize, 0 );
148    itemRadioButton7->SetValue(true);
149    itemBoxSizer6->Add(itemRadioButton7, 0, wxALIGN_LEFT|wxALL, 5);
150
151    wxRadioButton* itemRadioButton8 = new wxRadioButton( itemDialog1, ID_RADIOBUTTON_LEGACY_TRACKER, _("No, use the legacy tracker"), wxDefaultPosition, wxDefaultSize, 0 );
152    itemRadioButton8->SetValue(false);
153    itemBoxSizer6->Add(itemRadioButton8, 0, wxALIGN_LEFT|wxALL, 5);
154
155    wxStaticText* itemStaticText9 = new wxStaticText( itemDialog1, wxID_STATIC, _("You could also change the tracker configuration under:\nConfiguration -> Options... -> Advanced -> Face localization and tracking"), wxDefaultPosition, wxDefaultSize, 0 );
156    itemStaticText9->SetFont(wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_NORMAL, false, wxT("Sans")));
157    itemBoxSizer2->Add(itemStaticText9, 0, wxALIGN_LEFT|wxALL, 5);
158
159    itemBoxSizer2->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
160
161    m_chkShowOnStartup = new wxCheckBox( itemDialog1, ID_CHECKBOX_SHOW_ON_STARTUP, _("Show this message on startup"), wxDefaultPosition, wxDefaultSize, 0 );
162    m_chkShowOnStartup->SetValue(false);
163    itemBoxSizer2->Add(m_chkShowOnStartup, 0, wxALIGN_LEFT|wxALL, 5);
164
165    wxStaticLine* itemStaticLine12 = new wxStaticLine( itemDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
166    itemBoxSizer2->Add(itemStaticLine12, 0, wxGROW|wxALL, 5);
167
168    wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxHORIZONTAL);
169    itemBoxSizer2->Add(itemBoxSizer13, 0, wxALIGN_RIGHT|wxALL, 5);
170
171    wxStdDialogButtonSizer* itemStdDialogButtonSizer14 = new wxStdDialogButtonSizer;
172
173    itemBoxSizer13->Add(itemStdDialogButtonSizer14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
174    wxButton* itemButton15 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
175    itemButton15->SetDefault();
176    itemStdDialogButtonSizer14->AddButton(itemButton15);
177
178    itemStdDialogButtonSizer14->Realize();
179
180////@end NewTrackerInformationDlg content construction
181}
182
183
184/*!
185 * Should we show tooltips?
186 */
187
188bool NewTrackerInformationDlg::ShowToolTips()
189{
190    return true;
191}
192
193/*!
194 * Get bitmap resources
195 */
196
197wxBitmap NewTrackerInformationDlg::GetBitmapResource( const wxString& name )
198{
199    // Bitmap retrieval
200////@begin NewTrackerInformationDlg bitmap retrieval
201    wxUnusedVar(name);
202    return wxNullBitmap;
203////@end NewTrackerInformationDlg bitmap retrieval
204}
205
206/*!
207 * Get icon resources
208 */
209
210wxIcon NewTrackerInformationDlg::GetIconResource( const wxString& name )
211{
212    // Icon retrieval
213////@begin NewTrackerInformationDlg icon retrieval
214    wxUnusedVar(name);
215    return wxNullIcon;
216////@end NewTrackerInformationDlg icon retrieval
217}
218
219
220/*!
221 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RADIOBUTTON_LEGACY_TRACKER
222 */
223
224void NewTrackerInformationDlg::OnRadiobuttonLegacyTrackerSelected( wxCommandEvent& event )
225{
226        m_useLegacyTracker = true;
227        m_showOnStartup = true;
228        m_chkShowOnStartup->SetValue(true);
229    event.Skip(false);
230}
231
232
233/*!
234 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_SHOW_ON_STARTUP
235 */
236
237void NewTrackerInformationDlg::OnCheckboxShowOnStartupClick( wxCommandEvent& event )
238{
239        m_showOnStartup = event.GetInt() != 0;
240    event.Skip(false);
241}
242
243
244/*!
245 * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
246 */
247
248void NewTrackerInformationDlg::OnOkClick( wxCommandEvent& event )
249{
250        if (m_useLegacyTracker) {
251                wxGetApp().GetController().GetVisionPipeline().SetUseLegacyTracker(true);
252        }
253        else {
254                wxGetApp().GetController().GetVisionPipeline().SetUseLegacyTracker(false);
255                wxGetApp().GetController().GetVisionPipeline().SetTrackFace(true);
256                wxGetApp().GetController().GetVisionPipeline().SetCpuUsage(CVisionPipeline::CPU_NORMAL);
257                wxGetApp().GetController().GetPointerAction().SetXSpeed(10);
258                wxGetApp().GetController().GetPointerAction().SetYSpeed(10);
259                wxGetApp().GetController().GetPointerAction().SetAcceleration(2);
260                wxGetApp().GetController().GetPointerAction().SetSmoothness(2);
261        }
262        wxGetApp().GetController().SetNewTrackerDialogAtStartup(m_showOnStartup);
263        wxGetApp().GetController().GetConfigManager().WriteAll();
264       
265    event.Skip();
266}
267
Note: See TracBrowser for help on using the repository browser.