source: eviacam/trunk/fuentes/src/wconfiguration.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: 80.6 KB
Line 
1/////////////////////////////////////////////////////////////////////////////
2// Name:        wconfiguration.cpp
3// Purpose:     
4// Author:      César Mauri Loba
5// Modified by:
6// Created:     29/12/2008 16:35:20
7// RCS-ID:     
8// Copyright:   (C) 2008-14 Cesar Mauri from CREA Sistemes Informatics
9//
10//  This program is free software: you can redistribute it and/or modify
11//  it under the terms of the GNU General Public License as published by
12//  the Free Software Foundation, either version 3 of the License, or
13//  (at your option) any later version.
14//
15//  This program is distributed in the hope that it will be useful,
16//  but WITHOUT ANY WARRANTY; without even the implied warranty of
17//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18//  GNU General Public License for more details.
19//
20//  You should have received a copy of the GNU General Public License
21//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
22/////////////////////////////////////////////////////////////////////////////
23
24#include "wconfiguration.h"
25
26////@begin includes
27#include "wx/imaglist.h"
28////@end includes
29#include <wx/sizer.h>
30#include <wx/msgdlg.h>
31#include <wx/textdlg.h>
32#include <wx/filedlg.h>
33#include <wx/panel.h>
34
35#include "eviacamapp.h"
36#include "viacamcontroller.h"
37#include "visionpipeline.h"
38#include "clickwindowcontroller.h"
39#include "pointeraction.h"
40
41#include "cautostart.h"
42#include "configmanager.h"
43
44#include "wgetkey.h"
45#include "dwellclick.h"
46#include "gestureclick.h"
47
48////@begin XPM images
49#include "icons/eviacam_mini.xpm"
50#include "icons/user.xpm"
51#include "icons/eviacam_small.xpm"
52////@end XPM images
53#define FIRST_CONTROL_ID 12000
54
55#include "langnames-utf8.h"
56
57/*!
58 * WConfiguration type definition
59 */
60
61IMPLEMENT_DYNAMIC_CLASS( WConfiguration, wxDialog )
62
63
64/*!
65 * WConfiguration event table definition
66 */
67
68BEGIN_EVENT_TABLE( WConfiguration, wxDialog )
69
70////@begin WConfiguration event table entries
71    EVT_SPINCTRL( ID_SPINCTRL_XSPEED, WConfiguration::OnSpinctrlXspeedUpdated )
72    EVT_SPINCTRL( ID_SPINCTRL_YSPEED, WConfiguration::OnSpinctrlYspeedUpdated )
73    EVT_SPINCTRL( ID_SPINCTRL_ACCELERATION, WConfiguration::OnSpinctrlAccelerationUpdated )
74    EVT_SPINCTRL( ID_SPINCTRL_SMOOTHNESS, WConfiguration::OnSpinctrlSmoothnessUpdated )
75    EVT_SPINCTRL( ID_SPINCTRL_EASYSTOP, WConfiguration::OnSpinctrlEasystopUpdated )
76    EVT_BUTTON( ID_BUTTON, WConfiguration::OnButtonClick )
77    EVT_CHECKBOX( ID_CHECKBOX_WORKSPACE_LIMIT, WConfiguration::OnCheckboxWorkspaceLimitClick )
78    EVT_SPINCTRL( ID_SPINCTRL_TOP_WORKSPACE, WConfiguration::OnSpinctrlTopWorkspaceUpdated )
79    EVT_SPINCTRL( ID_SPINCTRL_LEFT_WORKSPACE, WConfiguration::OnSpinctrlLeftWorkspaceUpdated )
80    EVT_SPINCTRL( ID_SPINCTRL_RIGHT_WORKSPACE, WConfiguration::OnSpinctrlRightWorkspaceUpdated )
81    EVT_SPINCTRL( ID_SPINCTRL_BOTTOM_WORKSPACE, WConfiguration::OnSpinctrlBottomWorkspaceUpdated )
82    EVT_CHECKBOX( ID_CHECKBOX2, WConfiguration::OnCheckboxWrapPointer )
83    EVT_CHECKBOX( ID_CHECKBOX_ENABLE_DWELL, WConfiguration::OnCheckboxEnableDwellClick )
84    EVT_SPINCTRL( ID_SPINCTRL_DWELL_TIME, WConfiguration::OnSpinctrlDwellTimeUpdated )
85    EVT_SPINCTRL( ID_SPINCTRL_DWELL_AREA, WConfiguration::OnSpinctrlDwellAreaUpdated )
86    EVT_CHECKBOX( ID_CHECKBOX_ALLOW_CONSECUTIVE, WConfiguration::OnCheckboxAllowConsecutiveClick )
87    EVT_CHECKBOX( ID_CHECKBOX_BEEP_ON_CLICK, WConfiguration::OnCheckboxBeepOnClickClick )
88#if defined(__WXGTK__)
89    EVT_CHECKBOX( ID_CHECKBOX_ALLOW_VISUAL_ALERTS, WConfiguration::OnCheckboxAllowVisualAlertsClick )
90#endif
91
92    EVT_CHECKBOX( ID_CHECKBOX_SHOW_CLICKWIN, WConfiguration::OnCheckboxShowClickwinClick )
93    EVT_CHOICE( ID_CHOICE_DESIGN, WConfiguration::OnChoiceDesignSelected )
94    EVT_CHOICE( ID_CHOICE_BEHAVIOUR, WConfiguration::OnChoiceBehaviourSelected )
95#if defined(__WXGTK__)
96    EVT_CHOICE( ID_CHOICE5, WConfiguration::OnChoiceClickWindowModeSelected )
97#endif
98
99#if defined(__WXGTK__)
100    EVT_CHECKBOX( ID_CHECKBOX_AUTOHIDE, WConfiguration::OnCheckboxAutohideClick )
101#endif
102
103#if defined(__WXGTK__)
104    EVT_CHECKBOX( ID_CHECKBOX, WConfiguration::OnCheckboxEnableGestureClick )
105#endif
106
107#if defined(__WXGTK__)
108    EVT_CHOICE( ID_CHOICE, WConfiguration::OnLeftGestureChoiceSelected )
109#endif
110
111#if defined(__WXGTK__)
112    EVT_CHOICE( ID_CHOICE1, WConfiguration::OnRightGestureChoiceSelected )
113#endif
114
115#if defined(__WXGTK__)
116    EVT_CHOICE( ID_CHOICE2, WConfiguration::OnUpGestureChoiceSelected )
117#endif
118
119#if defined(__WXGTK__)
120    EVT_CHOICE( ID_CHOICE3, WConfiguration::OnDownGestureChoiceSelected )
121#endif
122
123#if defined(__WXGTK__)
124    EVT_CHECKBOX( ID_CHECKBOX_STARTUP, WConfiguration::OnCheckboxStartupClick )
125#endif
126
127    EVT_CHECKBOX( ID_CHECKBOX_ENABLE_AT_STARTUP, WConfiguration::OnCheckboxEnableAtStartupClick )
128    EVT_TEXT( ID_TEXTCTRL_ONSCREENKEYBOARDCOMMAND, WConfiguration::OnTextctrlOnscreenkeyboardcommandTextUpdated )
129    EVT_BUTTON( ID_BUTTON_ONSCREENKEYBOARDCOMMAND, WConfiguration::OnButtonOnscreenkeyboardcommandClick )
130    EVT_CHECKBOX( ID_CHECKBO_LEGACY_TRACKER, WConfiguration::OnCheckboLegacyTrackerClick )
131    EVT_CHECKBOX( ID_CHECKBOX_AUTO_LOCATE_FACE, WConfiguration::OnCheckboxAutoLocateFaceClick )
132    EVT_CHOICE( ID_CHOICE4, WConfiguration::OnChoCpuUsageSelected )
133    EVT_CHECKBOX( ID_CHECKBOX_ENABLE_WHEN_FACE_DETECTED, WConfiguration::OnCheckboxEnableWhenFaceDetectedClick )
134    EVT_SPINCTRL( ID_SPINCTRL2, WConfiguration::OnSpinLocateFaceTimeoutUpdated )
135    EVT_SPINCTRL( ID_SPIN_SEND_ACTION_WAIT, WConfiguration::OnSpinSendActionWaitUpdated )
136    EVT_CHOICE( ID_CHOICE_PROFILE, WConfiguration::OnChoiceProfileSelected )
137    EVT_BUTTON( ID_BUTTON_ADD_PROFILE, WConfiguration::OnButtonAddProfileClick )
138    EVT_BUTTON( ID_BUTTON_DEL_PROFILE, WConfiguration::OnButtonDelProfileClick )
139    EVT_BUTTON( ID_BUTTON_CAMERA_SETTINGS, WConfiguration::OnButtonCameraSettingsClick )
140    EVT_BUTTON( ID_BUTTON_CHANGE_CAMERA, WConfiguration::OnButtonChangeCameraClick )
141    EVT_CHOICE( ID_CHOICE_LANGUAGE, WConfiguration::OnChoiceLanguageSelected )
142    EVT_CHECKBOX( ID_CHECKBOX_CHECK_UPDATES, WConfiguration::OnCheckboxCheckUpdatesClick )
143    EVT_BUTTON( wxID_OK, WConfiguration::OnOkClick )
144    EVT_BUTTON( wxID_CANCEL, WConfiguration::OnCancelClick )
145////@end WConfiguration event table entries
146    EVT_COMBOBOX( ID_COMBOBOX_LEFT, WConfiguration::OnComboboxLeftSelected )
147
148    EVT_COMBOBOX( ID_COMBOBOX_RIGHT, WConfiguration::OnComboboxRightSelected )
149
150    EVT_COMBOBOX( ID_COMBOBOX_TOP, WConfiguration::OnComboboxTopSelected )
151
152    EVT_COMBOBOX( ID_COMBOBOX_BOTTOM, WConfiguration::OnComboboxBottomSelected )
153
154
155END_EVENT_TABLE()
156
157
158/*!
159 * WConfiguration constructors
160 */
161
162WConfiguration::WConfiguration()
163{
164    Init();
165}
166
167WConfiguration::WConfiguration( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
168{
169    Init();
170    Create(parent, id, caption, pos, size, style);
171}
172
173/*!
174 * WConfiguration creator
175 */
176
177bool WConfiguration::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
178{
179////@begin WConfiguration creation
180    SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
181    wxDialog::Create( parent, id, caption, pos, size, style );
182
183    CreateControls();
184    SetIcon(GetIconResource(wxT("icons/eviacam_mini.xpm")));
185    if (GetSizer())
186    {
187        GetSizer()->SetSizeHints(this);
188    }
189////@end WConfiguration creation
190
191        InitializeData ();
192
193    return true;
194}
195
196
197/*!
198 * WConfiguration destructor
199 */
200
201WConfiguration::~WConfiguration()
202{
203////@begin WConfiguration destruction
204////@end WConfiguration destruction
205}
206
207
208/*!
209 * Member initialisation
210 */
211
212void WConfiguration::Init()
213{
214////@begin WConfiguration member initialisation
215    m_spinXSpeed = NULL;
216    m_spinYSpeed = NULL;
217    m_spinAcceleration = NULL;
218    m_spinSmoothness = NULL;
219    m_spinEasyStop = NULL;
220    m_buttonCalibrateMotion = NULL;
221    m_chkEnabledWorkspace = NULL;
222    m_spin_top_workspace = NULL;
223    m_spin_left_workspace = NULL;
224    m_spin_right_workspace = NULL;
225    m_spin_bottom_workspace = NULL;
226    m_chkWrapPointer = NULL;
227    m_panelClick = NULL;
228    m_chkDwellClickEnabled = NULL;
229    m_stDwellTime = NULL;
230    m_spinDwellTime = NULL;
231    m_stDwellArea = NULL;
232    m_spinDwellArea = NULL;
233    m_chkAllowConsecutiveClick = NULL;
234    m_chkBeepOnClick = NULL;
235#if defined(__WXGTK__)
236    m_chkAllowVisualAlerts = NULL;
237#endif
238    m_sboxClickWin = NULL;
239    m_chkShowClickWin = NULL;
240    m_stDesign = NULL;
241    m_choClickWindowDesign = NULL;
242    m_stBehaviour = NULL;
243    m_choClickWindowBehaviour = NULL;
244#if defined(__WXGTK__)
245    m_stDocking = NULL;
246#endif
247#if defined(__WXGTK__)
248    m_choDockingMode = NULL;
249#endif
250#if defined(__WXGTK__)
251    m_chkAutohide = NULL;
252#endif
253#if defined(__WXGTK__)
254    m_sboxGestureClick = NULL;
255#endif
256#if defined(__WXGTK__)
257    m_chkEnableGestureClick = NULL;
258#endif
259#if defined(__WXGTK__)
260    m_stMoveLeft = NULL;
261#endif
262#if defined(__WXGTK__)
263    m_choLeft = NULL;
264#endif
265#if defined(__WXGTK__)
266    m_stMoveRight = NULL;
267#endif
268#if defined(__WXGTK__)
269    m_choRight = NULL;
270#endif
271#if defined(__WXGTK__)
272    m_stMoveUp = NULL;
273#endif
274#if defined(__WXGTK__)
275    m_choUp = NULL;
276#endif
277#if defined(__WXGTK__)
278    m_stMoveDown = NULL;
279#endif
280#if defined(__WXGTK__)
281    m_choDown = NULL;
282#endif
283#if defined(__WXGTK__)
284    m_panelKeys = NULL;
285#endif
286#if defined(__WXGTK__)
287    m_hotkeysSizer = NULL;
288#endif
289#if defined(__WXGTK__)
290    m_chkStartup = NULL;
291#endif
292    m_chkEnabledAtStartup = NULL;
293    m_txtOnScreenKeyboardCommand = NULL;
294    m_btntOnScreenKeyboardCommand = NULL;
295    m_sizerFaceLocalization = NULL;
296    m_chkLegacyTracker = NULL;
297    m_chkAutoLocateFace = NULL;
298    m_staticCpuUsage = NULL;
299    m_choCpuUsage = NULL;
300    m_chkEnableWhenFaceDetected = NULL;
301    m_staticLocateFaceTimeout2 = NULL;
302    m_spinLocateFaceTimeout = NULL;
303    m_staticLocateFaceTimeout = NULL;
304    m_spinSendActionWait = NULL;
305    m_choProfile = NULL;
306    m_btnAddProfile = NULL;
307    m_btnDeleteProfile = NULL;
308    m_txtSelectedCamera = NULL;
309    m_btnCameraSettings = NULL;
310    m_choLanguage = NULL;
311    m_chkCheckUpdatesAtStartup = NULL;
312    m_btnCancel = NULL;
313////@end WConfiguration member initialisation
314    m_cmbLeft = NULL;
315    m_cmbRight = NULL;
316    m_cmbTop = NULL;
317    m_cmbBottom = NULL;
318
319        m_lastId = FIRST_CONTROL_ID;
320        m_dirty= false;
321}
322
323
324/*!
325 * Control creation for WConfiguration
326 */
327
328void WConfiguration::CreateControls()
329{   
330////@begin WConfiguration content construction
331    WConfiguration* itemDialog1 = this;
332
333    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
334    itemDialog1->SetSizer(itemBoxSizer2);
335
336    wxListbook* itemListbook3 = new wxListbook( itemDialog1, ID_LISTBOOK, wxDefaultPosition, wxDefaultSize, wxBK_DEFAULT );
337    wxImageList* itemListbook3ImageList = new wxImageList(32, 32, true, 2);
338    {
339        wxIcon itemListbook3Icon0(itemDialog1->GetIconResource(wxT("icons/user.xpm")));
340        itemListbook3ImageList->Add(itemListbook3Icon0);
341        wxIcon itemListbook3Icon1(itemDialog1->GetIconResource(wxT("icons/eviacam_small.xpm")));
342        itemListbook3ImageList->Add(itemListbook3Icon1);
343    }
344    itemListbook3->AssignImageList(itemListbook3ImageList);
345
346    wxNotebook* itemNotebook4 = new wxNotebook( itemListbook3, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxBK_DEFAULT );
347
348    wxPanel* itemPanel5 = new wxPanel( itemNotebook4, ID_PANEL_MOTION, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
349    wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
350    itemPanel5->SetSizer(itemBoxSizer6);
351
352    wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(itemPanel5, wxID_ANY, _("Motion calibration"));
353    wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL);
354    itemBoxSizer6->Add(itemStaticBoxSizer7, 0, wxGROW|wxALL, 5);
355    wxFlexGridSizer* itemFlexGridSizer8 = new wxFlexGridSizer(0, 4, 0, 0);
356    itemStaticBoxSizer7->Add(itemFlexGridSizer8, 0, wxGROW, 5);
357    wxStaticText* itemStaticText9 = new wxStaticText( itemPanel5, wxID_STATIC, _("X axis speed"), wxDefaultPosition, wxDefaultSize, 0 );
358    itemFlexGridSizer8->Add(itemStaticText9, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
359
360    m_spinXSpeed = new wxSpinCtrl( itemPanel5, ID_SPINCTRL_XSPEED, wxT("0"), wxDefaultPosition, wxSize(45, 25), wxSP_ARROW_KEYS, 0, 30, 0 );
361    if (WConfiguration::ShowToolTips())
362        m_spinXSpeed->SetToolTip(_("Sets response sensitivity for the X axis."));
363    itemFlexGridSizer8->Add(m_spinXSpeed, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
364
365    wxStaticText* itemStaticText11 = new wxStaticText( itemPanel5, wxID_STATIC, _("Y axis speed"), wxDefaultPosition, wxDefaultSize, 0 );
366    itemFlexGridSizer8->Add(itemStaticText11, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
367
368    m_spinYSpeed = new wxSpinCtrl( itemPanel5, ID_SPINCTRL_YSPEED, wxT("0"), wxDefaultPosition, wxSize(45, 25), wxSP_ARROW_KEYS, 0, 30, 0 );
369    if (WConfiguration::ShowToolTips())
370        m_spinYSpeed->SetToolTip(_("Sets response sensitivity for the Y axis."));
371    itemFlexGridSizer8->Add(m_spinYSpeed, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
372
373    wxStaticText* itemStaticText13 = new wxStaticText( itemPanel5, wxID_STATIC, _("Acceleration"), wxDefaultPosition, wxDefaultSize, 0 );
374    itemFlexGridSizer8->Add(itemStaticText13, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
375
376    m_spinAcceleration = new wxSpinCtrl( itemPanel5, ID_SPINCTRL_ACCELERATION, wxT("0"), wxDefaultPosition, wxSize(45, 25), wxSP_ARROW_KEYS, 0, 5, 0 );
377    if (WConfiguration::ShowToolTips())
378        m_spinAcceleration->SetToolTip(_("Sets pointer's acceleration.\n0 means no acceleration and\n5 maximum acceleration."));
379    itemFlexGridSizer8->Add(m_spinAcceleration, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
380
381    wxStaticText* itemStaticText15 = new wxStaticText( itemPanel5, wxID_STATIC, _("Smoothness"), wxDefaultPosition, wxDefaultSize, 0 );
382    itemFlexGridSizer8->Add(itemStaticText15, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
383
384    m_spinSmoothness = new wxSpinCtrl( itemPanel5, ID_SPINCTRL_SMOOTHNESS, wxT("0"), wxDefaultPosition, wxSize(45, 25), wxSP_ARROW_KEYS, 0, 8, 0 );
385    if (WConfiguration::ShowToolTips())
386        m_spinSmoothness->SetToolTip(_("Tremor reduction filter.\n0 means no filter and \n8 maximum filtering."));
387    itemFlexGridSizer8->Add(m_spinSmoothness, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
388
389    wxStaticText* itemStaticText17 = new wxStaticText( itemPanel5, wxID_STATIC, _("Motion threshold"), wxDefaultPosition, wxDefaultSize, 0 );
390    itemFlexGridSizer8->Add(itemStaticText17, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
391
392    m_spinEasyStop = new wxSpinCtrl( itemPanel5, ID_SPINCTRL_EASYSTOP, wxT("0"), wxDefaultPosition, wxSize(45, 25), wxSP_ARROW_KEYS, 0, 10, 0 );
393    if (WConfiguration::ShowToolTips())
394        m_spinEasyStop->SetToolTip(_("Minimum displacement (in pixels)\nto start moving pointer."));
395    itemFlexGridSizer8->Add(m_spinEasyStop, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
396
397    itemFlexGridSizer8->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
398
399    itemFlexGridSizer8->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
400
401    itemFlexGridSizer8->AddGrowableCol(0);
402    itemFlexGridSizer8->AddGrowableCol(1);
403    itemFlexGridSizer8->AddGrowableCol(2);
404    itemFlexGridSizer8->AddGrowableCol(3);
405
406    m_buttonCalibrateMotion = new wxButton( itemPanel5, ID_BUTTON, _("Assisted calibration"), wxDefaultPosition, wxDefaultSize, 0 );
407    itemStaticBoxSizer7->Add(m_buttonCalibrateMotion, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
408
409    itemNotebook4->AddPage(itemPanel5, _("Motion"));
410
411    wxPanel* itemPanel22 = new wxPanel( itemNotebook4, ID_PANEL_WORKSPACE, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
412    wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxVERTICAL);
413    itemPanel22->SetSizer(itemBoxSizer23);
414
415    wxStaticBox* itemStaticBoxSizer24Static = new wxStaticBox(itemPanel22, wxID_ANY, _("Workspace limit"));
416    wxStaticBoxSizer* itemStaticBoxSizer24 = new wxStaticBoxSizer(itemStaticBoxSizer24Static, wxVERTICAL);
417    itemBoxSizer23->Add(itemStaticBoxSizer24, 0, wxGROW|wxALL, 5);
418    m_chkEnabledWorkspace = new wxCheckBox( itemPanel22, ID_CHECKBOX_WORKSPACE_LIMIT, _("Enable workspace limit"), wxDefaultPosition, wxDefaultSize, 0 );
419    m_chkEnabledWorkspace->SetValue(false);
420    if (WConfiguration::ShowToolTips())
421        m_chkEnabledWorkspace->SetToolTip(_("Confines the mouse pointer\nto the selected area."));
422    itemStaticBoxSizer24->Add(m_chkEnabledWorkspace, 0, wxALIGN_LEFT|wxALL, 5);
423
424    wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxHORIZONTAL);
425    itemStaticBoxSizer24->Add(itemBoxSizer26, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, 5);
426    wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxVERTICAL);
427    itemBoxSizer26->Add(itemBoxSizer27, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5);
428    wxGridSizer* itemGridSizer28 = new wxGridSizer(0, 3, 0, 0);
429    itemBoxSizer27->Add(itemGridSizer28, 0, wxALIGN_CENTER_HORIZONTAL, 5);
430    wxStaticText* itemStaticText29 = new wxStaticText( itemPanel22, wxID_STATIC, _("Top"), wxDefaultPosition, wxDefaultSize, 0 );
431    itemGridSizer28->Add(itemStaticText29, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
432
433    m_spin_top_workspace = new wxSpinCtrl( itemPanel22, ID_SPINCTRL_TOP_WORKSPACE, wxT("1"), wxDefaultPosition, wxSize(45, 25), wxSP_ARROW_KEYS, 0, 50, 1 );
434    if (WConfiguration::ShowToolTips())
435        m_spin_top_workspace->SetToolTip(_("Top limit workspace."));
436    m_spin_top_workspace->Enable(false);
437    itemGridSizer28->Add(m_spin_top_workspace, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
438
439    wxStaticText* itemStaticText31 = new wxStaticText( itemPanel22, wxID_STATIC, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
440    itemGridSizer28->Add(itemStaticText31, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
441
442    wxGridSizer* itemGridSizer32 = new wxGridSizer(0, 6, 0, 0);
443    itemBoxSizer27->Add(itemGridSizer32, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
444    wxStaticText* itemStaticText33 = new wxStaticText( itemPanel22, wxID_STATIC, _("Left"), wxDefaultPosition, wxDefaultSize, 0 );
445    itemGridSizer32->Add(itemStaticText33, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
446
447    m_spin_left_workspace = new wxSpinCtrl( itemPanel22, ID_SPINCTRL_LEFT_WORKSPACE, wxT("1"), wxDefaultPosition, wxSize(45, 25), wxSP_ARROW_KEYS, 0, 50, 1 );
448    if (WConfiguration::ShowToolTips())
449        m_spin_left_workspace->SetToolTip(_("Left limit workspace."));
450    m_spin_left_workspace->Enable(false);
451    itemGridSizer32->Add(m_spin_left_workspace, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
452
453    wxStaticText* itemStaticText35 = new wxStaticText( itemPanel22, wxID_STATIC, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
454    itemGridSizer32->Add(itemStaticText35, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
455
456    wxStaticText* itemStaticText36 = new wxStaticText( itemPanel22, wxID_STATIC, _("Right"), wxDefaultPosition, wxDefaultSize, 0 );
457    itemGridSizer32->Add(itemStaticText36, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
458
459    m_spin_right_workspace = new wxSpinCtrl( itemPanel22, ID_SPINCTRL_RIGHT_WORKSPACE, wxT("1"), wxDefaultPosition, wxSize(45, 25), wxSP_ARROW_KEYS, 0, 50, 1 );
460    if (WConfiguration::ShowToolTips())
461        m_spin_right_workspace->SetToolTip(_("Right limit workspace."));
462    m_spin_right_workspace->Enable(false);
463    itemGridSizer32->Add(m_spin_right_workspace, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
464
465    wxStaticText* itemStaticText38 = new wxStaticText( itemPanel22, wxID_STATIC, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
466    itemGridSizer32->Add(itemStaticText38, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
467
468    wxGridSizer* itemGridSizer39 = new wxGridSizer(0, 3, 0, 0);
469    itemBoxSizer27->Add(itemGridSizer39, 0, wxALIGN_CENTER_HORIZONTAL, 5);
470    wxStaticText* itemStaticText40 = new wxStaticText( itemPanel22, wxID_STATIC, _("Bottom"), wxDefaultPosition, wxDefaultSize, 0 );
471    itemGridSizer39->Add(itemStaticText40, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
472
473    m_spin_bottom_workspace = new wxSpinCtrl( itemPanel22, ID_SPINCTRL_BOTTOM_WORKSPACE, wxT("1"), wxDefaultPosition, wxSize(45, 25), wxSP_ARROW_KEYS, 0, 50, 1 );
474    if (WConfiguration::ShowToolTips())
475        m_spin_bottom_workspace->SetToolTip(_("Bottom limit workspace."));
476    m_spin_bottom_workspace->Enable(false);
477    itemGridSizer39->Add(m_spin_bottom_workspace, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
478
479    wxStaticText* itemStaticText42 = new wxStaticText( itemPanel22, wxID_STATIC, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
480    itemGridSizer39->Add(itemStaticText42, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
481
482    wxStaticBox* itemStaticBoxSizer43Static = new wxStaticBox(itemPanel22, wxID_ANY, _("Pointer wrapping"));
483    wxStaticBoxSizer* itemStaticBoxSizer43 = new wxStaticBoxSizer(itemStaticBoxSizer43Static, wxVERTICAL);
484    itemBoxSizer23->Add(itemStaticBoxSizer43, 0, wxGROW|wxALL, 5);
485    m_chkWrapPointer = new wxCheckBox( itemPanel22, ID_CHECKBOX2, _("Allow wrapping the pointer around the working area"), wxDefaultPosition, wxDefaultSize, 0 );
486    m_chkWrapPointer->SetValue(false);
487    itemStaticBoxSizer43->Add(m_chkWrapPointer, 0, wxALIGN_LEFT|wxALL, 5);
488
489    itemNotebook4->AddPage(itemPanel22, _("Workspace"));
490
491    m_panelClick = new wxPanel( itemNotebook4, ID_PANEL_CLICK, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
492    wxBoxSizer* itemBoxSizer46 = new wxBoxSizer(wxVERTICAL);
493    m_panelClick->SetSizer(itemBoxSizer46);
494
495    wxStaticBox* itemStaticBoxSizer47Static = new wxStaticBox(m_panelClick, wxID_ANY, _("Dwell click"));
496    wxStaticBoxSizer* itemStaticBoxSizer47 = new wxStaticBoxSizer(itemStaticBoxSizer47Static, wxVERTICAL);
497    itemBoxSizer46->Add(itemStaticBoxSizer47, 0, wxGROW|wxALL, 5);
498    m_chkDwellClickEnabled = new wxCheckBox( m_panelClick, ID_CHECKBOX_ENABLE_DWELL, _("Enable dwell click"), wxDefaultPosition, wxDefaultSize, 0 );
499    m_chkDwellClickEnabled->SetValue(false);
500    if (WConfiguration::ShowToolTips())
501        m_chkDwellClickEnabled->SetToolTip(_("Enable/Disable automatic (dwell)\nclick generation mechanism."));
502    itemStaticBoxSizer47->Add(m_chkDwellClickEnabled, 0, wxALIGN_LEFT|wxALL, 5);
503
504    wxGridSizer* itemGridSizer49 = new wxGridSizer(0, 2, 0, 0);
505    itemStaticBoxSizer47->Add(itemGridSizer49, 0, wxGROW, 5);
506    wxFlexGridSizer* itemFlexGridSizer50 = new wxFlexGridSizer(0, 2, 0, 0);
507    itemGridSizer49->Add(itemFlexGridSizer50, 0, wxGROW|wxALIGN_TOP|wxALL, 0);
508    m_stDwellTime = new wxStaticText( m_panelClick, ID_STATIC_DWELL_TIME, _("Dwell time (ds)"), wxDefaultPosition, wxDefaultSize, 0 );
509    itemFlexGridSizer50->Add(m_stDwellTime, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
510
511    m_spinDwellTime = new wxSpinCtrl( m_panelClick, ID_SPINCTRL_DWELL_TIME, wxT("2"), wxDefaultPosition, wxSize(45, 25), wxSP_ARROW_KEYS, 2, 50, 2 );
512    if (WConfiguration::ShowToolTips())
513        m_spinDwellTime->SetToolTip(_("Time to wait (deciseconds) \nbefore sending a click."));
514    itemFlexGridSizer50->Add(m_spinDwellTime, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5);
515
516    m_stDwellArea = new wxStaticText( m_panelClick, ID_STATIC_DWELL_AREA, _("Dwell area"), wxDefaultPosition, wxDefaultSize, 0 );
517    itemFlexGridSizer50->Add(m_stDwellArea, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
518
519    m_spinDwellArea = new wxSpinCtrl( m_panelClick, ID_SPINCTRL_DWELL_AREA, wxT("0"), wxDefaultPosition, wxSize(45, 25), wxSP_ARROW_KEYS, 0, 5, 0 );
520    if (WConfiguration::ShowToolTips())
521        m_spinDwellArea->SetToolTip(_("Maximum allowed displacement\nbefore restarting the dwell time\ncountdown."));
522    itemFlexGridSizer50->Add(m_spinDwellArea, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
523
524    wxBoxSizer* itemBoxSizer55 = new wxBoxSizer(wxVERTICAL);
525    itemGridSizer49->Add(itemBoxSizer55, 0, wxGROW|wxALIGN_TOP|wxLEFT|wxRIGHT, 5);
526    m_chkAllowConsecutiveClick = new wxCheckBox( m_panelClick, ID_CHECKBOX_ALLOW_CONSECUTIVE, _("Allow consecutive clicks"), wxDefaultPosition, wxDefaultSize, 0 );
527    m_chkAllowConsecutiveClick->SetValue(false);
528    if (WConfiguration::ShowToolTips())
529        m_chkAllowConsecutiveClick->SetToolTip(_("Send multiple clicks\nwhen the pointer is stopped."));
530    itemBoxSizer55->Add(m_chkAllowConsecutiveClick, 0, wxALIGN_LEFT|wxALL, 5);
531
532    m_chkBeepOnClick = new wxCheckBox( m_panelClick, ID_CHECKBOX_BEEP_ON_CLICK, _("Beep on click"), wxDefaultPosition, wxDefaultSize, 0 );
533    m_chkBeepOnClick->SetValue(false);
534    if (WConfiguration::ShowToolTips())
535        m_chkBeepOnClick->SetToolTip(_("Play sound when click generated."));
536    itemBoxSizer55->Add(m_chkBeepOnClick, 0, wxALIGN_LEFT|wxALL, 5);
537
538#if defined(__WXGTK__)
539    m_chkAllowVisualAlerts = new wxCheckBox( m_panelClick, ID_CHECKBOX_ALLOW_VISUAL_ALERTS, _("Allow visual alerts"), wxDefaultPosition, wxDefaultSize, 0 );
540    m_chkAllowVisualAlerts->SetValue(false);
541    itemBoxSizer55->Add(m_chkAllowVisualAlerts, 0, wxALIGN_LEFT|wxALL, 5);
542#endif
543
544    m_sboxClickWin = new wxStaticBox(m_panelClick, ID_STATICBOX_CLICK_WIN, _("Click window"));
545    wxStaticBoxSizer* itemStaticBoxSizer59 = new wxStaticBoxSizer(m_sboxClickWin, wxVERTICAL);
546    itemStaticBoxSizer47->Add(itemStaticBoxSizer59, 0, wxGROW|wxALL, 5);
547    m_chkShowClickWin = new wxCheckBox( m_panelClick, ID_CHECKBOX_SHOW_CLICKWIN, _("Show Click Window"), wxDefaultPosition, wxDefaultSize, 0 );
548    m_chkShowClickWin->SetValue(false);
549    itemStaticBoxSizer59->Add(m_chkShowClickWin, 0, wxALIGN_LEFT|wxALL, 5);
550
551    wxFlexGridSizer* itemFlexGridSizer61 = new wxFlexGridSizer(0, 4, 0, 0);
552    itemStaticBoxSizer59->Add(itemFlexGridSizer61, 0, wxGROW, 5);
553    m_stDesign = new wxStaticText( m_panelClick, ID_STATIC_DESIGN, _("Design:"), wxDefaultPosition, wxDefaultSize, 0 );
554    itemFlexGridSizer61->Add(m_stDesign, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5);
555
556    wxArrayString m_choClickWindowDesignStrings;
557    m_choClickWindowDesignStrings.Add(_("Normal"));
558    m_choClickWindowDesignStrings.Add(_("Thin"));
559    m_choClickWindowDesign = new wxChoice( m_panelClick, ID_CHOICE_DESIGN, wxDefaultPosition, wxDefaultSize, m_choClickWindowDesignStrings, 0 );
560    itemFlexGridSizer61->Add(m_choClickWindowDesign, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
561
562    m_stBehaviour = new wxStaticText( m_panelClick, ID_STATIC_BEHAVIOUR, _("Behaviour:"), wxDefaultPosition, wxDefaultSize, 0 );
563    itemFlexGridSizer61->Add(m_stBehaviour, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5);
564
565    wxArrayString m_choClickWindowBehaviourStrings;
566    m_choClickWindowBehaviourStrings.Add(_("Normal mode"));
567    m_choClickWindowBehaviourStrings.Add(_("Fast mode"));
568    m_choClickWindowBehaviour = new wxChoice( m_panelClick, ID_CHOICE_BEHAVIOUR, wxDefaultPosition, wxDefaultSize, m_choClickWindowBehaviourStrings, 0 );
569    if (WConfiguration::ShowToolTips())
570        m_choClickWindowBehaviour->SetToolTip(_("Fast mode enables click type\nselection by hovering the mouse\npointer over the click window\nbuttons."));
571    itemFlexGridSizer61->Add(m_choClickWindowBehaviour, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5);
572
573#if defined(__WXGTK__)
574    m_stDocking = new wxStaticText( m_panelClick, wxID_STATIC, _("Location:"), wxDefaultPosition, wxDefaultSize, 0 );
575    itemFlexGridSizer61->Add(m_stDocking, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
576#endif
577
578#if defined(__WXGTK__)
579    wxArrayString m_choDockingModeStrings;
580    m_choDockingModeStrings.Add(_("Floating horizontal"));
581    m_choDockingModeStrings.Add(_("Floating vertical"));
582    m_choDockingModeStrings.Add(_("Top docked"));
583    m_choDockingModeStrings.Add(_("Bottom docked"));
584    m_choDockingModeStrings.Add(_("Left docked"));
585    m_choDockingModeStrings.Add(_("Right docked"));
586    m_choDockingMode = new wxChoice( m_panelClick, ID_CHOICE5, wxDefaultPosition, wxDefaultSize, m_choDockingModeStrings, 0 );
587    itemFlexGridSizer61->Add(m_choDockingMode, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
588#endif
589
590#if defined(__WXGTK__)
591    m_chkAutohide = new wxCheckBox( m_panelClick, ID_CHECKBOX_AUTOHIDE, _("Auto-hide"), wxDefaultPosition, wxDefaultSize, 0 );
592    m_chkAutohide->SetValue(false);
593    itemFlexGridSizer61->Add(m_chkAutohide, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
594#endif
595
596    itemFlexGridSizer61->AddGrowableCol(1);
597    itemFlexGridSizer61->AddGrowableCol(3);
598
599#if defined(__WXGTK__)
600    m_sboxGestureClick = new wxStaticBox(m_panelClick, ID_STATICBOX_GESTURE_CLICK, _("Gesture click"));
601    wxStaticBoxSizer* itemStaticBoxSizer69 = new wxStaticBoxSizer(m_sboxGestureClick, wxVERTICAL);
602    itemStaticBoxSizer47->Add(itemStaticBoxSizer69, 0, wxGROW|wxALL, 5);
603    m_chkEnableGestureClick = new wxCheckBox( m_panelClick, ID_CHECKBOX, _("Enable gesture click"), wxDefaultPosition, wxDefaultSize, 0 );
604    m_chkEnableGestureClick->SetValue(false);
605    itemStaticBoxSizer69->Add(m_chkEnableGestureClick, 0, wxALIGN_LEFT|wxALL, 5);
606
607    wxFlexGridSizer* itemFlexGridSizer71 = new wxFlexGridSizer(0, 4, 0, 0);
608    itemStaticBoxSizer69->Add(itemFlexGridSizer71, 0, wxGROW, 5);
609    m_stMoveLeft = new wxStaticText( m_panelClick, ID_STATIC_MOVE_LEFT, _("Move left:"), wxDefaultPosition, wxDefaultSize, 0 );
610    itemFlexGridSizer71->Add(m_stMoveLeft, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
611
612    wxArrayString m_choLeftStrings;
613    m_choLeftStrings.Add(_("Disable"));
614    m_choLeftStrings.Add(_("Left click"));
615    m_choLeftStrings.Add(_("Middle click"));
616    m_choLeftStrings.Add(_("Right click"));
617    m_choLeftStrings.Add(_("Double click"));
618    m_choLeftStrings.Add(_("Drag click"));
619    m_choLeft = new wxChoice( m_panelClick, ID_CHOICE, wxDefaultPosition, wxDefaultSize, m_choLeftStrings, 0 );
620    itemFlexGridSizer71->Add(m_choLeft, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
621
622    m_stMoveRight = new wxStaticText( m_panelClick, ID_STATIC_MOVE_RIGHT, _("Move right:"), wxDefaultPosition, wxDefaultSize, 0 );
623    itemFlexGridSizer71->Add(m_stMoveRight, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
624
625    wxArrayString m_choRightStrings;
626    m_choRightStrings.Add(_("Disable"));
627    m_choRightStrings.Add(_("Left click"));
628    m_choRightStrings.Add(_("Middle click"));
629    m_choRightStrings.Add(_("Right click"));
630    m_choRightStrings.Add(_("Double click"));
631    m_choRightStrings.Add(_("Drag click"));
632    m_choRight = new wxChoice( m_panelClick, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, m_choRightStrings, 0 );
633    itemFlexGridSizer71->Add(m_choRight, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
634
635    m_stMoveUp = new wxStaticText( m_panelClick, ID_STATIC_MOVE_UP, _("Move up:"), wxDefaultPosition, wxDefaultSize, 0 );
636    itemFlexGridSizer71->Add(m_stMoveUp, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
637
638    wxArrayString m_choUpStrings;
639    m_choUpStrings.Add(_("Disable"));
640    m_choUpStrings.Add(_("Left click"));
641    m_choUpStrings.Add(_("Middle click"));
642    m_choUpStrings.Add(_("Right click"));
643    m_choUpStrings.Add(_("Double click"));
644    m_choUpStrings.Add(_("Drag click"));
645    m_choUp = new wxChoice( m_panelClick, ID_CHOICE2, wxDefaultPosition, wxDefaultSize, m_choUpStrings, 0 );
646    itemFlexGridSizer71->Add(m_choUp, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
647
648    m_stMoveDown = new wxStaticText( m_panelClick, ID_STATIC_MOVE_DOWN, _("Move down:"), wxDefaultPosition, wxDefaultSize, 0 );
649    itemFlexGridSizer71->Add(m_stMoveDown, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
650
651    wxArrayString m_choDownStrings;
652    m_choDownStrings.Add(_("Disable"));
653    m_choDownStrings.Add(_("Left click"));
654    m_choDownStrings.Add(_("Middle click"));
655    m_choDownStrings.Add(_("Right click"));
656    m_choDownStrings.Add(_("Double click"));
657    m_choDownStrings.Add(_("Drag click"));
658    m_choDown = new wxChoice( m_panelClick, ID_CHOICE3, wxDefaultPosition, wxDefaultSize, m_choDownStrings, 0 );
659    itemFlexGridSizer71->Add(m_choDown, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
660
661    itemFlexGridSizer71->AddGrowableCol(1);
662    itemFlexGridSizer71->AddGrowableCol(3);
663
664#endif
665
666    itemNotebook4->AddPage(m_panelClick, _("Click"));
667
668#if defined(__WXGTK__)
669    m_panelKeys = new wxPanel( itemNotebook4, ID_PANEL_KEYS, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
670    wxBoxSizer* itemBoxSizer81 = new wxBoxSizer(wxVERTICAL);
671    m_panelKeys->SetSizer(itemBoxSizer81);
672
673    wxStaticBox* itemStaticBoxSizer82Static = new wxStaticBox(m_panelKeys, wxID_ANY, _("Hotkeys"));
674    wxStaticBoxSizer* itemStaticBoxSizer82 = new wxStaticBoxSizer(itemStaticBoxSizer82Static, wxVERTICAL);
675    itemBoxSizer81->Add(itemStaticBoxSizer82, 0, wxGROW|wxALL, 5);
676    wxStaticText* itemStaticText83 = new wxStaticText( m_panelKeys, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
677    itemStaticBoxSizer82->Add(itemStaticText83, 0, wxALIGN_LEFT|wxALL, 5);
678
679    m_hotkeysSizer = new wxFlexGridSizer(0, 4, 0, 0);
680    itemStaticBoxSizer82->Add(m_hotkeysSizer, 0, wxGROW|wxALL, 5);
681    m_hotkeysSizer->AddGrowableCol(0);
682    m_hotkeysSizer->AddGrowableCol(1);
683    m_hotkeysSizer->AddGrowableCol(2);
684    m_hotkeysSizer->AddGrowableCol(3);
685
686#endif
687
688#if defined(__WXGTK__)
689    itemNotebook4->AddPage(m_panelKeys, _("Hotkeys"));
690#endif
691
692    wxPanel* itemPanel85 = new wxPanel( itemNotebook4, ID_PANEL_ADVANCED, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
693    wxBoxSizer* itemBoxSizer86 = new wxBoxSizer(wxVERTICAL);
694    itemPanel85->SetSizer(itemBoxSizer86);
695
696    wxStaticBox* itemStaticBoxSizer87Static = new wxStaticBox(itemPanel85, wxID_ANY, _("Startup"));
697    wxStaticBoxSizer* itemStaticBoxSizer87 = new wxStaticBoxSizer(itemStaticBoxSizer87Static, wxVERTICAL);
698    itemBoxSizer86->Add(itemStaticBoxSizer87, 0, wxGROW|wxALL, 5);
699#if defined(__WXGTK__)
700    m_chkStartup = new wxCheckBox( itemPanel85, ID_CHECKBOX_STARTUP, _("Start eViacam at user logon"), wxDefaultPosition, wxDefaultSize, 0 );
701    m_chkStartup->SetValue(false);
702    itemStaticBoxSizer87->Add(m_chkStartup, 0, wxALIGN_LEFT|wxALL, 5);
703#endif
704
705    m_chkEnabledAtStartup = new wxCheckBox( itemPanel85, ID_CHECKBOX_ENABLE_AT_STARTUP, _("Enable eViacam at startup"), wxDefaultPosition, wxDefaultSize, 0 );
706    m_chkEnabledAtStartup->SetValue(false);
707    if (WConfiguration::ShowToolTips())
708        m_chkEnabledAtStartup->SetToolTip(_("If checked the program automatically \nenables cursor control at startup."));
709    itemStaticBoxSizer87->Add(m_chkEnabledAtStartup, 0, wxALIGN_LEFT|wxALL, 5);
710
711    wxStaticBox* itemStaticBoxSizer90Static = new wxStaticBox(itemPanel85, wxID_ANY, _("On-screen keyboard command"));
712    wxStaticBoxSizer* itemStaticBoxSizer90 = new wxStaticBoxSizer(itemStaticBoxSizer90Static, wxVERTICAL);
713    itemBoxSizer86->Add(itemStaticBoxSizer90, 0, wxGROW|wxALL, 5);
714    wxFlexGridSizer* itemFlexGridSizer91 = new wxFlexGridSizer(0, 2, 0, 0);
715    itemStaticBoxSizer90->Add(itemFlexGridSizer91, 0, wxGROW, 5);
716    m_txtOnScreenKeyboardCommand = new wxTextCtrl( itemPanel85, ID_TEXTCTRL_ONSCREENKEYBOARDCOMMAND, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
717    if (WConfiguration::ShowToolTips())
718        m_txtOnScreenKeyboardCommand->SetToolTip(_("Command to run an external on-screen keyboard application."));
719    itemFlexGridSizer91->Add(m_txtOnScreenKeyboardCommand, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
720
721    m_btntOnScreenKeyboardCommand = new wxButton( itemPanel85, ID_BUTTON_ONSCREENKEYBOARDCOMMAND, _("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
722    itemFlexGridSizer91->Add(m_btntOnScreenKeyboardCommand, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
723
724    itemFlexGridSizer91->AddGrowableCol(0);
725
726    m_sizerFaceLocalization = new wxStaticBox(itemPanel85, wxID_ANY, _("Face localization and tracking"));
727    wxStaticBoxSizer* itemStaticBoxSizer94 = new wxStaticBoxSizer(m_sizerFaceLocalization, wxVERTICAL);
728    itemBoxSizer86->Add(itemStaticBoxSizer94, 0, wxGROW|wxALL, 5);
729    wxFlexGridSizer* itemFlexGridSizer95 = new wxFlexGridSizer(0, 2, 0, 0);
730    itemStaticBoxSizer94->Add(itemFlexGridSizer95, 0, wxGROW|wxALL, 0);
731    m_chkLegacyTracker = new wxCheckBox( itemPanel85, ID_CHECKBO_LEGACY_TRACKER, _("Use legacy face tracking algorithm"), wxDefaultPosition, wxDefaultSize, 0 );
732    m_chkLegacyTracker->SetValue(false);
733    if (WConfiguration::ShowToolTips())
734        m_chkLegacyTracker->SetToolTip(_("Use old face tracking method\n(not recommended)."));
735    itemFlexGridSizer95->Add(m_chkLegacyTracker, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
736
737    itemFlexGridSizer95->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
738
739    m_chkAutoLocateFace = new wxCheckBox( itemPanel85, ID_CHECKBOX_AUTO_LOCATE_FACE, _("Locate face automatically"), wxDefaultPosition, wxDefaultSize, 0 );
740    m_chkAutoLocateFace->SetValue(false);
741    if (WConfiguration::ShowToolTips())
742        m_chkAutoLocateFace->SetToolTip(_("When enabled tries to automatically\ndetect your face and center the\ntracking area."));
743    itemFlexGridSizer95->Add(m_chkAutoLocateFace, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
744
745    wxFlexGridSizer* itemFlexGridSizer99 = new wxFlexGridSizer(0, 2, 0, 0);
746    itemFlexGridSizer95->Add(itemFlexGridSizer99, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 0);
747    m_staticCpuUsage = new wxStaticText( itemPanel85, wxID_STATIC, _("CPU usage"), wxDefaultPosition, wxDefaultSize, 0 );
748    itemFlexGridSizer99->Add(m_staticCpuUsage, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
749
750    wxArrayString m_choCpuUsageStrings;
751    m_choCpuUsageStrings.Add(_("Lowest"));
752    m_choCpuUsageStrings.Add(_("Low"));
753    m_choCpuUsageStrings.Add(_("Normal"));
754    m_choCpuUsageStrings.Add(_("High"));
755    m_choCpuUsageStrings.Add(_("Highest"));
756    m_choCpuUsage = new wxChoice( itemPanel85, ID_CHOICE4, wxDefaultPosition, wxDefaultSize, m_choCpuUsageStrings, 0 );
757    itemFlexGridSizer99->Add(m_choCpuUsage, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
758
759    m_chkEnableWhenFaceDetected = new wxCheckBox( itemPanel85, ID_CHECKBOX_ENABLE_WHEN_FACE_DETECTED, _("Stop pointer when face not detected"), wxDefaultPosition, wxDefaultSize, 0 );
760    m_chkEnableWhenFaceDetected->SetValue(false);
761    if (WConfiguration::ShowToolTips())
762        m_chkEnableWhenFaceDetected->SetToolTip(_("eViacam is only enabled when face is detected."));
763    m_chkEnableWhenFaceDetected->Enable(false);
764    itemFlexGridSizer95->Add(m_chkEnableWhenFaceDetected, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
765
766    wxBoxSizer* itemBoxSizer103 = new wxBoxSizer(wxHORIZONTAL);
767    itemFlexGridSizer95->Add(itemBoxSizer103, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0);
768    m_staticLocateFaceTimeout2 = new wxStaticText( itemPanel85, wxID_STATIC, _("After"), wxDefaultPosition, wxDefaultSize, 0 );
769    itemBoxSizer103->Add(m_staticLocateFaceTimeout2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
770
771    m_spinLocateFaceTimeout = new wxSpinCtrl( itemPanel85, ID_SPINCTRL2, wxT("1"), wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 1, 59, 1 );
772    itemBoxSizer103->Add(m_spinLocateFaceTimeout, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
773
774    m_staticLocateFaceTimeout = new wxStaticText( itemPanel85, wxID_STATIC, _("seconds"), wxDefaultPosition, wxDefaultSize, 0 );
775    itemBoxSizer103->Add(m_staticLocateFaceTimeout, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
776
777    itemFlexGridSizer95->AddGrowableRow(0);
778    itemFlexGridSizer95->AddGrowableCol(0);
779    itemFlexGridSizer95->AddGrowableCol(1);
780
781    wxStaticBox* itemStaticBoxSizer107Static = new wxStaticBox(itemPanel85, wxID_ANY, _("Mouse actions"));
782    wxStaticBoxSizer* itemStaticBoxSizer107 = new wxStaticBoxSizer(itemStaticBoxSizer107Static, wxVERTICAL);
783    itemBoxSizer86->Add(itemStaticBoxSizer107, 0, wxGROW|wxALL, 5);
784    wxBoxSizer* itemBoxSizer108 = new wxBoxSizer(wxHORIZONTAL);
785    itemStaticBoxSizer107->Add(itemBoxSizer108, 0, wxALIGN_LEFT|wxALL, 0);
786    m_spinSendActionWait = new wxSpinCtrl( itemPanel85, ID_SPIN_SEND_ACTION_WAIT, wxT("0"), wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 0, 50, 0 );
787    if (WConfiguration::ShowToolTips())
788        m_spinSendActionWait->SetToolTip(_("Increase this value if some application ignores click events."));
789    itemBoxSizer108->Add(m_spinSendActionWait, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
790
791    wxStaticText* itemStaticText110 = new wxStaticText( itemPanel85, wxID_STATIC, _("ms delay between up and down events"), wxDefaultPosition, wxDefaultSize, 0 );
792    itemBoxSizer108->Add(itemStaticText110, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
793
794    itemNotebook4->AddPage(itemPanel85, _("Advanced"));
795
796    itemListbook3->AddPage(itemNotebook4, _("Profile options"), false, 0);
797
798    wxPanel* itemPanel111 = new wxPanel( itemListbook3, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
799    wxBoxSizer* itemBoxSizer112 = new wxBoxSizer(wxVERTICAL);
800    itemPanel111->SetSizer(itemBoxSizer112);
801
802    wxStaticBox* itemStaticBoxSizer113Static = new wxStaticBox(itemPanel111, wxID_ANY, _("Profile management"));
803    wxStaticBoxSizer* itemStaticBoxSizer113 = new wxStaticBoxSizer(itemStaticBoxSizer113Static, wxVERTICAL);
804    itemBoxSizer112->Add(itemStaticBoxSizer113, 0, wxGROW|wxALL, 5);
805    wxFlexGridSizer* itemFlexGridSizer114 = new wxFlexGridSizer(0, 4, 0, 0);
806    itemStaticBoxSizer113->Add(itemFlexGridSizer114, 0, wxGROW, 5);
807    wxStaticText* itemStaticText115 = new wxStaticText( itemPanel111, wxID_STATIC, _("Select profile:"), wxDefaultPosition, wxDefaultSize, 0 );
808    if (WConfiguration::ShowToolTips())
809        itemStaticText115->SetToolTip(_("Chooses desired active profile"));
810    itemFlexGridSizer114->Add(itemStaticText115, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
811
812    wxArrayString m_choProfileStrings;
813    m_choProfile = new wxChoice( itemPanel111, ID_CHOICE_PROFILE, wxDefaultPosition, wxDefaultSize, m_choProfileStrings, 0 );
814    if (WConfiguration::ShowToolTips())
815        m_choProfile->SetToolTip(_("Chooses desired active profile"));
816    itemFlexGridSizer114->Add(m_choProfile, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
817
818    m_btnAddProfile = new wxButton( itemPanel111, ID_BUTTON_ADD_PROFILE, _("Add profile"), wxDefaultPosition, wxDefaultSize, 0 );
819    itemFlexGridSizer114->Add(m_btnAddProfile, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
820
821    m_btnDeleteProfile = new wxButton( itemPanel111, ID_BUTTON_DEL_PROFILE, _("Delete profile"), wxDefaultPosition, wxDefaultSize, 0 );
822    itemFlexGridSizer114->Add(m_btnDeleteProfile, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
823
824    itemFlexGridSizer114->AddGrowableCol(1);
825
826    wxStaticBox* itemStaticBoxSizer119Static = new wxStaticBox(itemPanel111, wxID_ANY, _("Camera"));
827    wxStaticBoxSizer* itemStaticBoxSizer119 = new wxStaticBoxSizer(itemStaticBoxSizer119Static, wxVERTICAL);
828    itemBoxSizer112->Add(itemStaticBoxSizer119, 0, wxGROW|wxALL, 5);
829    wxFlexGridSizer* itemFlexGridSizer120 = new wxFlexGridSizer(0, 3, 0, 0);
830    itemStaticBoxSizer119->Add(itemFlexGridSizer120, 0, wxGROW, 5);
831    m_txtSelectedCamera = new wxTextCtrl( itemPanel111, ID_TEXTCTRL_SELECTED_CAMERA, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
832    m_txtSelectedCamera->Enable(false);
833    itemFlexGridSizer120->Add(m_txtSelectedCamera, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
834
835    m_btnCameraSettings = new wxButton( itemPanel111, ID_BUTTON_CAMERA_SETTINGS, _("Settings..."), wxDefaultPosition, wxDefaultSize, 0 );
836    itemFlexGridSizer120->Add(m_btnCameraSettings, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
837
838    wxButton* itemButton123 = new wxButton( itemPanel111, ID_BUTTON_CHANGE_CAMERA, _("Change"), wxDefaultPosition, wxDefaultSize, 0 );
839    itemFlexGridSizer120->Add(itemButton123, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
840
841    itemFlexGridSizer120->AddGrowableCol(0);
842
843    wxStaticBox* itemStaticBoxSizer124Static = new wxStaticBox(itemPanel111, wxID_ANY, _("Language"));
844    wxStaticBoxSizer* itemStaticBoxSizer124 = new wxStaticBoxSizer(itemStaticBoxSizer124Static, wxVERTICAL);
845    itemBoxSizer112->Add(itemStaticBoxSizer124, 0, wxGROW|wxALL, 5);
846    wxFlexGridSizer* itemFlexGridSizer125 = new wxFlexGridSizer(0, 2, 0, 0);
847    itemStaticBoxSizer124->Add(itemFlexGridSizer125, 0, wxALIGN_LEFT, 5);
848    wxStaticText* itemStaticText126 = new wxStaticText( itemPanel111, wxID_STATIC, _("Language:"), wxDefaultPosition, wxDefaultSize, 0 );
849    itemFlexGridSizer125->Add(itemStaticText126, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
850
851    wxArrayString m_choLanguageStrings;
852    m_choLanguage = new wxChoice( itemPanel111, ID_CHOICE_LANGUAGE, wxDefaultPosition, wxDefaultSize, m_choLanguageStrings, 0 );
853    itemFlexGridSizer125->Add(m_choLanguage, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
854
855    wxStaticBox* itemStaticBoxSizer128Static = new wxStaticBox(itemPanel111, wxID_ANY, _("Check for updates"));
856    wxStaticBoxSizer* itemStaticBoxSizer128 = new wxStaticBoxSizer(itemStaticBoxSizer128Static, wxVERTICAL);
857    itemBoxSizer112->Add(itemStaticBoxSizer128, 0, wxGROW|wxALL, 5);
858    m_chkCheckUpdatesAtStartup = new wxCheckBox( itemPanel111, ID_CHECKBOX_CHECK_UPDATES, _("Automatically check for updates at startup"), wxDefaultPosition, wxDefaultSize, 0 );
859    m_chkCheckUpdatesAtStartup->SetValue(false);
860    itemStaticBoxSizer128->Add(m_chkCheckUpdatesAtStartup, 0, wxALIGN_LEFT|wxALL, 5);
861
862    itemListbook3->AddPage(itemPanel111, _("General options"), false, 1);
863
864    itemBoxSizer2->Add(itemListbook3, 0, wxALIGN_LEFT|wxALL, 5);
865
866    wxStdDialogButtonSizer* itemStdDialogButtonSizer130 = new wxStdDialogButtonSizer;
867
868    itemBoxSizer2->Add(itemStdDialogButtonSizer130, 0, wxALIGN_RIGHT|wxALL, 5);
869    wxButton* itemButton131 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
870    itemStdDialogButtonSizer130->AddButton(itemButton131);
871
872    m_btnCancel = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
873    m_btnCancel->Enable(false);
874    itemStdDialogButtonSizer130->AddButton(m_btnCancel);
875
876    itemStdDialogButtonSizer130->Realize();
877
878////@end WConfiguration content construction
879#if defined(__WXGTK__)
880        for (unsigned int i=0; i<wxGetApp().GetController().GetPointerAction().GetGestureClick().GetKeyEventsCount(); i++) {
881                m_choLeft->Append(_("Key:") + wxString(wxGetApp().GetController().GetPointerAction().GetGestureClick().GetKeyboardCode(i).GetName(), wxConvLocal));
882                m_choRight->Append(_("Key:") + wxString(wxGetApp().GetController().GetPointerAction().GetGestureClick().GetKeyboardCode(i).GetName(), wxConvLocal));
883                m_choUp->Append(_("Key:") + wxString(wxGetApp().GetController().GetPointerAction().GetGestureClick().GetKeyboardCode(i).GetName(), wxConvLocal));
884                m_choDown->Append(_("Key:") + wxString(wxGetApp().GetController().GetPointerAction().GetGestureClick().GetKeyboardCode(i).GetName(), wxConvLocal));
885        }
886       
887        //Add hotkeys.
888        for (unsigned int j=0; j<wxGetApp().GetController().getHotkeyManager().GetKeyCommands().size(); j++) {
889                CreateHotkey (wxGetApp().GetController().getHotkeyManager().GetKeyCommands()[j], m_panelKeys, m_hotkeysSizer);
890        }
891       
892#endif
893
894}
895
896
897void WConfiguration::CreateHotkey (const CKeyCommand* kc, wxWindow* parent, wxSizer* sizer)
898{
899        wxStaticText* itemStaticText = new wxStaticText( parent, m_lastId, wxString((const wxChar*)kc->GetDescription(),wxConvUTF8), wxDefaultPosition, wxDefaultSize, 0 );
900        sizer->Add(itemStaticText, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
901        m_controlList.push_back((wxControl*) itemStaticText);
902
903        wxTextCtrl* itemTextCtrl = new wxTextCtrl( parent, m_lastId+1, wxString(kc->GetKey().GetName(),wxConvUTF8), wxDefaultPosition, wxDefaultSize, 0 );
904        itemTextCtrl->SetEditable(false);
905        sizer->Add(itemTextCtrl, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
906        m_controlList.push_back((wxControl*) itemTextCtrl);
907
908        wxCheckBox* itemCheckBox = new wxCheckBox( parent, m_lastId+2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
909        itemCheckBox->SetValue(kc->IsEnabled());
910        sizer->Add(itemCheckBox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
911        m_controlList.push_back((wxControl*) itemCheckBox);
912
913        wxButton* itemButton = new wxButton( parent, m_lastId+3, _("Set key"), wxDefaultPosition, wxDefaultSize, 0 );
914        sizer->Add(itemButton, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
915        m_controlList.push_back((wxControl*) itemButton);
916       
917        itemCheckBox->Connect(m_lastId+2, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(WConfiguration::OnHotkeyCheckboxClick), NULL, this);                                           
918        itemButton->Connect(m_lastId+3, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(WConfiguration::OnHotkeyButtonClick), NULL, this);                                         
919       
920        m_lastId += 4;
921}
922
923
924/*!
925 * Should we show tooltips?
926 */
927
928bool WConfiguration::ShowToolTips()
929{
930    return true;
931}
932
933/*!
934 * Get bitmap resources
935 */
936
937wxBitmap WConfiguration::GetBitmapResource( const wxString& name )
938{
939    // Bitmap retrieval
940////@begin WConfiguration bitmap retrieval
941    wxUnusedVar(name);
942    return wxNullBitmap;
943////@end WConfiguration bitmap retrieval
944}
945
946/*!
947 * Get icon resources
948 */
949
950wxIcon WConfiguration::GetIconResource( const wxString& name )
951{
952    // Icon retrieval
953////@begin WConfiguration icon retrieval
954    wxUnusedVar(name);
955    if (name == wxT("icons/eviacam_mini.xpm"))
956    {
957        wxIcon icon(eviacam_mini);
958        return icon;
959    }
960    else if (name == wxT("icons/user.xpm"))
961    {
962        wxIcon icon(user);
963        return icon;
964    }
965    else if (name == wxT("icons/eviacam_small.xpm"))
966    {
967        wxIcon icon(eviacam_small);
968        return icon;
969    }
970    return wxNullIcon;
971////@end WConfiguration icon retrieval
972}
973
974void WConfiguration::InitializeData ()
975{
976        //
977        // Profile data
978        //
979       
980        // Motion options
981        m_spinXSpeed->SetValue (
982                wxGetApp().GetController().GetPointerAction().GetXSpeed());
983        m_spinYSpeed->SetValue (
984                wxGetApp().GetController().GetPointerAction().GetYSpeed());
985        m_spinAcceleration->SetValue (
986                wxGetApp().GetController().GetPointerAction().GetAcceleration());
987        m_spinSmoothness->SetValue (
988                wxGetApp().GetController().GetPointerAction().GetSmoothness());
989        m_spinEasyStop->SetValue (
990                wxGetApp().GetController().GetPointerAction().GetEasyStopValue());
991               
992        // Workspace
993        m_chkEnabledWorkspace->SetValue (
994                wxGetApp().GetController().GetPointerAction().GetRestrictedWorkingArea());
995        if (wxGetApp().GetController().GetPointerAction().GetRestrictedWorkingArea()) {
996                m_spin_top_workspace->Enable(true);
997                m_spin_left_workspace->Enable(true);
998                m_spin_right_workspace->Enable(true);
999                m_spin_bottom_workspace->Enable(true);
1000        }
1001        m_spin_top_workspace->SetValue (
1002                wxGetApp().GetController().GetPointerAction().GetTopWorkspace());
1003        m_spin_left_workspace->SetValue (
1004                wxGetApp().GetController().GetPointerAction().GetLeftWorkspace());
1005        m_spin_right_workspace->SetValue (
1006                wxGetApp().GetController().GetPointerAction().GetRightWorkspace());
1007        m_spin_bottom_workspace->SetValue (
1008                wxGetApp().GetController().GetPointerAction().GetBottomWorkspace());
1009        m_chkWrapPointer->SetValue (
1010                wxGetApp().GetController().GetPointerAction().GetWrapPointer());       
1011       
1012        // Clic
1013        m_chkDwellClickEnabled->SetValue (
1014                wxGetApp().GetController().GetPointerAction().GetClickMode()!= CPointerAction::NONE);
1015#if defined(__WXGTK__)
1016        m_chkEnableGestureClick->SetValue (
1017                wxGetApp().GetController().GetPointerAction().GetClickMode()== CPointerAction::GESTURE);
1018#endif
1019        m_chkAllowConsecutiveClick->SetValue (
1020                wxGetApp().GetController().GetPointerAction().GetDwellClick().GetConsecutiveClicksAllowed());
1021        m_chkBeepOnClick->SetValue (
1022                wxGetApp().GetController().GetPointerAction().GetBeepOnClick());
1023        m_spinDwellTime->SetValue (
1024                wxGetApp().GetController().GetPointerAction().GetDwellTime());
1025        m_spinDwellArea->SetValue (
1026                wxGetApp().GetController().GetPointerAction().GetDwellToleranceArea () );
1027        m_chkShowClickWin->SetValue (
1028                wxGetApp().GetController().GetPointerAction().GetDwellClick().GetUseClickWindow());             
1029        m_choClickWindowBehaviour->Select (
1030                wxGetApp().GetController().GetPointerAction().GetDwellClick().GetClickWindowController().GetFastMode() ? 1 : 0);
1031        m_choClickWindowDesign->Select (
1032                wxGetApp().GetController().GetPointerAction().GetDwellClick().GetClickWindowController().GetDesign());
1033#if defined(__WXGTK__)
1034        m_choDockingMode->Select (
1035                wxGetApp().GetController().GetPointerAction().GetDwellClick().GetClickWindowController().GetLocation());
1036        m_chkAutohide->SetValue (
1037                wxGetApp().GetController().GetPointerAction().GetDwellClick().GetClickWindowController().GetAutohide() ? 1 : 0);       
1038        m_choLeft->Select (
1039                wxGetApp().GetController().GetPointerAction().GetGestureClick().GetActionLeft());
1040        m_choRight->Select (
1041                wxGetApp().GetController().GetPointerAction().GetGestureClick().GetActionRight());
1042        m_choUp->Select (
1043                wxGetApp().GetController().GetPointerAction().GetGestureClick().GetActionTop());
1044        m_choDown->Select (
1045                wxGetApp().GetController().GetPointerAction().GetGestureClick().GetActionBottom());
1046        m_chkAllowVisualAlerts->SetValue (
1047                wxGetApp().GetController().GetPointerAction().GetVisualAlerts());
1048#endif
1049        UpdateGUIClickOptions();
1050
1051        // Startup
1052        m_chkEnabledAtStartup->SetValue (
1053                wxGetApp().GetController().GetEnabledAtStartup());
1054       
1055        // Advanced
1056        m_chkAutoLocateFace->SetValue (
1057                wxGetApp().GetController().GetVisionPipeline().GetTrackFace());
1058        m_chkEnableWhenFaceDetected->Enable (m_chkAutoLocateFace->GetValue());
1059        m_chkEnableWhenFaceDetected->SetValue (
1060                wxGetApp().GetController().GetVisionPipeline().GetEnableWhenFaceDetected());
1061        m_spinLocateFaceTimeout->SetValue(wxGetApp().GetController().GetVisionPipeline().GetTimeout());
1062        m_spinLocateFaceTimeout->Enable(m_chkAutoLocateFace->GetValue() && m_chkEnableWhenFaceDetected->GetValue());
1063        m_choCpuUsage->Select(wxGetApp().GetController().GetVisionPipeline().GetCpuUsage());
1064        m_choCpuUsage->Enable(m_chkAutoLocateFace->GetValue());
1065        if (!wxGetApp().GetController().GetVisionPipeline().IsTrackFaceAllowed()) {
1066                m_sizerFaceLocalization->Enable(false);
1067                m_chkAutoLocateFace->Enable(false);
1068                m_chkEnableWhenFaceDetected->Enable(false);
1069                m_staticCpuUsage->Enable(false);
1070                m_choCpuUsage->Enable(false);
1071                m_staticLocateFaceTimeout->Enable(false);
1072                m_staticLocateFaceTimeout2->Enable(false);     
1073                m_spinLocateFaceTimeout->Enable(false);
1074        }
1075        m_chkLegacyTracker->SetValue(wxGetApp().GetController().GetVisionPipeline().GetUseLegacyTracker());
1076        m_txtOnScreenKeyboardCommand->SetValue(
1077                wxGetApp().GetController().GetOnScreenKeyboardCommand());
1078        m_spinSendActionWait->SetValue(wxGetApp().GetController().GetPointerAction().GetSendActionWait());
1079#if defined(__WXGTK__)
1080
1081           
1082        //
1083        // App data
1084        //
1085
1086        m_chkStartup->SetValue(wxGetApp().GetController().GetAutostart().IsEnabled());
1087#endif
1088        // Profile combo
1089        m_choProfile->Clear();
1090        m_choProfile->Append (
1091                wxGetApp().GetController().GetConfigManager().GetProfileList());
1092        m_choProfile->Select (
1093                wxGetApp().GetController().GetConfigManager().GetCurrentProfile());
1094
1095        // Profile buttons
1096        if (wxGetApp().GetController().GetConfigManager().GetCurrentProfile()== 0)
1097                m_btnDeleteProfile->Enable (false);
1098        else
1099                m_btnDeleteProfile->Enable (true);
1100
1101        // Fill and set language combo
1102        m_choLanguage->Clear();
1103        m_choLanguage->Append (wxGetTranslation(g_languages[0].name));
1104        for (unsigned int i= 1; i< WXSIZEOF(g_languages); i++) {
1105                m_choLanguage->Append (g_languages[i].name);
1106        }               
1107        // Select current language
1108        for (unsigned int i= 0; i< WXSIZEOF(g_languages); i++)
1109                if (g_languages[i].lang== wxGetApp().GetController().GetLanguage())
1110                        m_choLanguage->SetSelection(i);
1111       
1112        // Camera
1113        m_txtSelectedCamera->SetValue (wxGetApp().GetController().GetCameraName());
1114        if (wxGetApp().GetController().CameraHasSettingsDialog ())
1115                m_btnCameraSettings->Enable (true);
1116        else
1117                m_btnCameraSettings->Enable (false);
1118
1119        // Check updates at startup
1120        m_chkCheckUpdatesAtStartup->SetValue(wxGetApp().GetController().GetCheckUpdatesAtStartup());
1121}
1122
1123void WConfiguration::UpdateGUIClickOptions()
1124{
1125        if (m_chkDwellClickEnabled->IsChecked()) {
1126                EnableGUIGeneralClickOptions(true);
1127#if defined(__WXGTK__)
1128                if (m_chkEnableGestureClick->IsChecked()) {
1129                        EnableGUIGestureOptions (true);
1130                        EnableGUIClickWindowOptions(false);
1131                }
1132                else {
1133                        EnableGUIGestureOptions (false);
1134                        EnableGUIClickWindowOptions(true);
1135                }
1136#else
1137                EnableGUIClickWindowOptions(true);     
1138#endif
1139        }               
1140        else {
1141                EnableGUIGeneralClickOptions(false);
1142                EnableGUIGestureOptions (false);
1143                EnableGUIClickWindowOptions(false);
1144        }
1145}
1146
1147void WConfiguration::EnableGUIGeneralClickOptions (bool enable)
1148{
1149        m_spinDwellTime->Enable(enable);
1150        m_spinDwellArea->Enable(enable);
1151        m_chkAllowConsecutiveClick->Enable(enable);
1152        m_chkBeepOnClick->Enable(enable);
1153        m_chkShowClickWin->Enable(enable);
1154        m_choClickWindowDesign->Enable(enable);
1155        m_choClickWindowBehaviour->Enable(enable);
1156        m_stDwellTime->Enable(enable);
1157        m_stDwellArea->Enable(enable);
1158        m_stDesign->Enable(enable);
1159        m_stBehaviour->Enable(enable);
1160#if defined(__WXGTK__)
1161        m_chkAllowVisualAlerts->Enable(enable);
1162        m_chkEnableGestureClick->Enable(enable);
1163#endif
1164}
1165
1166void WConfiguration::EnableGUIGestureOptions (bool enable)
1167{
1168#if defined(__WXGTK__)
1169        m_choLeft->Enable(enable);
1170        m_choRight->Enable(enable);                     
1171        m_choUp->Enable(enable);                       
1172        m_choDown->Enable(enable);
1173        m_stMoveLeft->Enable(enable);
1174        m_stMoveRight->Enable(enable);
1175        m_stMoveUp->Enable(enable);
1176        m_stMoveDown->Enable(enable);
1177#else
1178        wxUnusedVar(enable);
1179#endif
1180}
1181
1182void WConfiguration::EnableGUIClickWindowOptions(bool enable)
1183{
1184        m_chkShowClickWin->Enable(enable);
1185        m_choClickWindowDesign->Enable(enable);
1186        m_choClickWindowBehaviour->Enable(enable);
1187    m_stDesign->Enable(enable);
1188        m_stBehaviour->Enable(enable);
1189#if defined(__WXGTK__)
1190    m_stDocking->Enable(enable);
1191    m_choDockingMode->Enable(enable);
1192        m_chkAutohide->Enable(enable);
1193#endif
1194       
1195        if (enable) {
1196                m_stDesign->Enable(m_chkShowClickWin->IsChecked());
1197                m_choClickWindowDesign->Enable(m_chkShowClickWin->IsChecked());
1198                m_stBehaviour->Enable(m_chkShowClickWin->IsChecked());
1199                m_choClickWindowBehaviour->Enable(m_chkShowClickWin->IsChecked());
1200#if defined(__WXGTK__)
1201                m_stDocking->Enable(m_chkShowClickWin->IsChecked());
1202                m_choDockingMode->Enable(m_chkShowClickWin->IsChecked());
1203                m_chkAutohide->Enable(m_chkShowClickWin->IsChecked());
1204#endif       
1205        }
1206#if defined(__WXGTK__) 
1207        if (    m_choDockingMode->GetCurrentSelection()== CClickWindowController::FLOATING_VERTICAL ||
1208                m_choDockingMode->GetCurrentSelection()== CClickWindowController::FLOATING_HORIZONTAL) {
1209               
1210                m_chkAutohide->Enable(false);
1211        }
1212#endif
1213}
1214
1215void WConfiguration::Changed ()
1216{
1217        if (!m_dirty)
1218        {
1219                m_dirty= true;
1220                m_btnCancel->Enable (true);
1221        }
1222}
1223
1224void WConfiguration::UnChanged ()
1225{
1226        if (m_dirty)
1227        {
1228                m_dirty= false;
1229                m_btnCancel->Enable (false);
1230        }
1231}
1232
1233/*!
1234 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_ENABLE_AT_STARTUP
1235 */
1236
1237void WConfiguration::OnCheckboxEnableAtStartupClick( wxCommandEvent& event )
1238{
1239        wxGetApp().GetController().SetEnabledAtStartup (m_chkEnabledAtStartup->GetValue());
1240        event.Skip(false);
1241        Changed ();
1242}
1243
1244
1245
1246
1247/*!
1248 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL_XSPEED
1249 */
1250
1251void WConfiguration::OnSpinctrlXspeedUpdated( wxSpinEvent& event )
1252{
1253        wxGetApp().GetController().GetPointerAction().SetXSpeed(m_spinXSpeed->GetValue());
1254        event.Skip(false);
1255        Changed ();
1256}
1257
1258
1259/*!
1260 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL_YSPEED
1261 */
1262
1263void WConfiguration::OnSpinctrlYspeedUpdated( wxSpinEvent& event )
1264{
1265        wxGetApp().GetController().GetPointerAction().SetYSpeed(m_spinYSpeed->GetValue());
1266        event.Skip(false);
1267        Changed ();
1268}
1269
1270
1271/*!
1272 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL_ACCELERATION
1273 */
1274
1275void WConfiguration::OnSpinctrlAccelerationUpdated( wxSpinEvent& event )
1276{
1277        wxGetApp().GetController().GetPointerAction().SetAcceleration(m_spinAcceleration->GetValue());
1278        event.Skip(false);
1279        Changed ();
1280}
1281
1282/*!
1283 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL_SMOOTHNESS
1284 */
1285
1286void WConfiguration::OnSpinctrlSmoothnessUpdated( wxSpinEvent& event )
1287{
1288        wxGetApp().GetController().GetPointerAction().SetSmoothness(m_spinSmoothness->GetValue());
1289        event.Skip(false);
1290        Changed ();
1291}
1292
1293
1294/*!
1295 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL_EASYSTOP
1296 */
1297
1298void WConfiguration::OnSpinctrlEasystopUpdated( wxSpinEvent& event )
1299{
1300        wxGetApp().GetController().GetPointerAction().SetEasyStopValue(m_spinEasyStop->GetValue());
1301        event.Skip(false);
1302        Changed ();
1303}
1304
1305
1306/*!
1307 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_ENABLE_DWELL
1308 */
1309
1310void WConfiguration::OnCheckboxEnableDwellClick( wxCommandEvent& event )
1311{
1312        if (!m_chkDwellClickEnabled->GetValue()) {
1313                if (wxGetApp().GetController().GetPointerAction().SetClickMode(CPointerAction::NONE, false, this)) {
1314                        EnableGUIGeneralClickOptions(false);
1315                        EnableGUIGestureOptions(false);
1316                        EnableGUIClickWindowOptions(false);
1317                        Changed();
1318                }
1319        }
1320        else {
1321                // Enabling click generation, which modality?
1322#if defined(__WXGTK__)
1323                if (m_chkEnableGestureClick->IsChecked()) {
1324                        // Gesture click
1325                        if (wxGetApp().GetController().GetPointerAction().SetClickMode(CPointerAction::GESTURE, false, this)) {
1326                                EnableGUIGeneralClickOptions(true);
1327                                EnableGUIGestureOptions(true);
1328                                EnableGUIClickWindowOptions(false);
1329                                Changed ();
1330                        }
1331                }
1332                else
1333#endif
1334                        if (wxGetApp().GetController().GetPointerAction().SetClickMode(CPointerAction::DWELL, false, this)) {
1335                                EnableGUIGeneralClickOptions(true);
1336                                EnableGUIGestureOptions(false);
1337                                EnableGUIClickWindowOptions(true);
1338                                Changed ();
1339                        }
1340        }               
1341        m_chkDwellClickEnabled->SetValue (wxGetApp().GetController().GetPointerAction().GetClickMode()!= CPointerAction::NONE);
1342        event.Skip(false);     
1343}
1344
1345#if defined(__WXGTK__)
1346/*!
1347 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX
1348 */
1349
1350void WConfiguration::OnCheckboxEnableGestureClick( wxCommandEvent& event )
1351{
1352        if (m_chkEnableGestureClick->IsChecked())
1353        {
1354                if (wxGetApp().GetController().GetPointerAction().SetClickMode(CPointerAction::GESTURE, false, this)) {
1355                        EnableGUIGestureOptions(true);
1356                        EnableGUIClickWindowOptions(false);
1357                }
1358                else {
1359                        m_chkEnableGestureClick->SetValue(false);
1360                }
1361        }
1362        else {
1363                if (wxGetApp().GetController().GetPointerAction().SetClickMode(CPointerAction::DWELL, false, this)) {
1364                        EnableGUIGestureOptions(false);
1365                        EnableGUIClickWindowOptions(true);
1366                }
1367                else
1368                        m_chkEnableGestureClick->SetValue(true);
1369        }
1370}
1371#endif
1372
1373/*!
1374 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_ALLOW_CONSECUTIVE
1375 */
1376
1377void WConfiguration::OnCheckboxAllowConsecutiveClick( wxCommandEvent& event )
1378{
1379        wxGetApp().GetController().GetPointerAction().GetDwellClick().
1380                SetConsecutiveClicksAllowed (m_chkAllowConsecutiveClick->GetValue());
1381        Changed ();
1382        event.Skip(false);     
1383}
1384
1385
1386/*!
1387 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_BEEP_ON_CLICK
1388 */
1389
1390void WConfiguration::OnCheckboxBeepOnClickClick( wxCommandEvent& event )
1391{
1392        wxGetApp().GetController().GetPointerAction().SetBeepOnClick (m_chkBeepOnClick->GetValue());
1393        event.Skip(false);
1394        Changed ();
1395}
1396
1397
1398/*!
1399 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL_DWELL_TIME
1400 */
1401
1402void WConfiguration::OnSpinctrlDwellTimeUpdated( wxSpinEvent& event )
1403{
1404        wxGetApp().GetController().GetPointerAction().SetDwellTime (m_spinDwellTime->GetValue());
1405        event.Skip(false);
1406        Changed ();
1407}
1408
1409
1410/*!
1411 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL_DWELL_AREA
1412 */
1413
1414void WConfiguration::OnSpinctrlDwellAreaUpdated( wxSpinEvent& event )
1415{
1416        wxGetApp().GetController().GetPointerAction().SetDwellToleranceArea (m_spinDwellArea->GetValue());             
1417        event.Skip(false);
1418        Changed ();
1419}
1420
1421
1422/*!
1423 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_SHOW_CLICKWIN
1424 */
1425
1426void WConfiguration::OnCheckboxShowClickwinClick( wxCommandEvent& event )
1427{
1428        m_stDesign->Enable(m_chkShowClickWin->IsChecked());
1429        m_choClickWindowDesign->Enable(m_chkShowClickWin->IsChecked());
1430        m_stBehaviour->Enable(m_chkShowClickWin->IsChecked());
1431        m_choClickWindowBehaviour->Enable(m_chkShowClickWin->IsChecked());
1432#if defined(__WXGTK__)
1433        m_stDocking->Enable(m_chkShowClickWin->IsChecked());
1434        m_choDockingMode->Enable(m_chkShowClickWin->IsChecked());
1435        m_chkAutohide->Enable(m_chkShowClickWin->IsChecked()); 
1436        if (    m_choDockingMode->GetCurrentSelection()== CClickWindowController::FLOATING_VERTICAL ||
1437                m_choDockingMode->GetCurrentSelection()== CClickWindowController::FLOATING_HORIZONTAL)
1438        {
1439                m_chkAutohide->Enable(false);
1440        }
1441#endif
1442               
1443        wxGetApp().GetController().GetPointerAction().GetDwellClick().SetUseClickWindow(
1444                !wxGetApp().GetController().GetPointerAction().GetDwellClick().GetUseClickWindow()
1445        );
1446        event.Skip(false);
1447        Changed ();
1448}
1449
1450/*!
1451 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_AUTO_LOCATE_FACE
1452 */
1453
1454void WConfiguration::OnCheckboxAutoLocateFaceClick( wxCommandEvent& event )
1455{
1456        wxGetApp().GetController().GetVisionPipeline().SetTrackFace (m_chkAutoLocateFace->GetValue());
1457        wxGetApp().GetController().GetVisionPipeline().SetDegradation(0);
1458        m_chkEnableWhenFaceDetected->Enable (m_chkAutoLocateFace->GetValue());
1459        m_spinLocateFaceTimeout->Enable(m_chkAutoLocateFace->GetValue() && m_chkEnableWhenFaceDetected->GetValue());
1460        m_staticLocateFaceTimeout->Enable(m_chkAutoLocateFace->GetValue());
1461        m_staticLocateFaceTimeout2->Enable(m_chkAutoLocateFace->GetValue());
1462        m_choCpuUsage->Enable(m_chkAutoLocateFace->GetValue());
1463        m_staticCpuUsage->Enable(m_chkAutoLocateFace->GetValue());
1464        event.Skip(false);
1465        Changed ();
1466}
1467
1468
1469/*!
1470 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_SHOW_LOCATE_FACE_FILTER
1471 */
1472
1473void WConfiguration::OnCheckboxEnableWhenFaceDetectedClick( wxCommandEvent& event )
1474{
1475        wxGetApp().GetController().GetVisionPipeline().SetEnableWhenFaceDetected(m_chkEnableWhenFaceDetected->GetValue());
1476        m_spinLocateFaceTimeout->Enable (m_chkEnableWhenFaceDetected->GetValue());
1477        event.Skip(false);
1478        Changed ();
1479}
1480
1481
1482/*!
1483 * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE_LANGUAGE
1484 */
1485
1486void WConfiguration::OnChoiceLanguageSelected( wxCommandEvent& event )
1487{
1488        int index= m_choLanguage->GetCurrentSelection();
1489        if (index!= wxNOT_FOUND)
1490        {
1491                wxGetApp().GetController().SetLanguage (g_languages[index].lang);
1492                wxMessageDialog dlg (NULL, _("You should restart the application to apply this change"), 
1493                        _T("Enable Viacam"), wxICON_INFORMATION );
1494                dlg.ShowModal ();
1495        }
1496        event.Skip(false);
1497        Changed ();
1498}
1499
1500
1501
1502/*!
1503 * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE_PROFILE
1504 */
1505
1506void WConfiguration::OnChoiceProfileSelected( wxCommandEvent& event )
1507{
1508        bool fail= false;
1509        wxString msg;
1510
1511        if (m_dirty)
1512        {
1513                wxMessageDialog dlg (NULL, _("Current profile has unsaved changes.\nContinue anyway?"), _T("Enable Viacam"), wxICON_EXCLAMATION | wxYES_NO );
1514                if (dlg.ShowModal()== wxID_NO) fail= true;                     
1515        }
1516
1517        if (!fail)
1518        {
1519                msg.sprintf (_("This action will load %s profile settings.\nAre you sure you want to continue?"), event.GetString().c_str());
1520                wxMessageDialog dlg (NULL, msg, _T("Enable Viacam"), wxICON_EXCLAMATION | wxYES_NO );
1521                if (dlg.ShowModal()== wxID_NO) fail= true;
1522        }
1523
1524        if (fail)
1525                // Restore old selection
1526                m_choProfile->Select (wxGetApp().GetController().GetConfigManager().GetCurrentProfile());               
1527        else
1528        {
1529                // Change profile
1530                wxGetApp().GetController().GetConfigManager().ChangeCurrentProfile (event.GetSelection());
1531
1532                // Refresh dialog values
1533                InitializeData ();             
1534
1535                UnChanged ();
1536        }
1537
1538        event.Skip(false);
1539}
1540
1541
1542/*!
1543 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_DEL_PROFILE
1544 */
1545
1546void WConfiguration::OnButtonDelProfileClick( wxCommandEvent& event )
1547{
1548        wxString msg;
1549
1550        msg.sprintf (_("This action will delete %s profile.\nAre you sure you want to continue?"), m_choProfile->GetStringSelection().c_str());
1551        wxMessageDialog dlg (NULL, msg, _T("Enable Viacam"), wxICON_EXCLAMATION | wxYES_NO );
1552        if (dlg.ShowModal()== wxID_YES)
1553        {
1554                wxGetApp().GetController().GetConfigManager().DeleteCurrentProfile();
1555                InitializeData ();
1556                UnChanged ();
1557        }
1558        event.Skip(false);
1559}
1560
1561
1562/*!
1563 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_ADD_PROFILE
1564 */
1565
1566void WConfiguration::OnButtonAddProfileClick( wxCommandEvent& event )
1567{
1568        wxTextEntryDialog dlg (this, _("Enter new profile name"), _("Add profile"));
1569        if (dlg.ShowModal()== wxID_OK)
1570        {
1571                switch (wxGetApp().GetController().GetConfigManager().AddNewProfile (dlg.GetValue()))
1572                {
1573                case 0:
1574                        InitializeData ();
1575                        UnChanged ();
1576                        break;
1577                case 1:
1578                        {
1579                                wxMessageDialog errDlg (NULL, _("Profile already exists."), _T("Enable Viacam"), wxICON_ERROR );
1580                                errDlg.ShowModal ();
1581                        }
1582                        break;
1583                case 2:
1584                        {
1585                                wxMessageDialog errDlg (NULL, _("Invalid profile name."), _T("Enable Viacam"), wxICON_ERROR );
1586                                errDlg.ShowModal ();
1587                        }
1588                        break;
1589                default:
1590                        assert (false);
1591                }               
1592        }
1593
1594    event.Skip(false);
1595}
1596
1597/*!
1598 * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE_BEHAVIOUR
1599 */
1600
1601void WConfiguration::OnChoiceBehaviourSelected( wxCommandEvent& event )
1602{
1603        wxGetApp().GetController().GetPointerAction().GetDwellClick().
1604                GetClickWindowController().SetFastMode ( event.GetSelection()!= 0);
1605        event.Skip(false);
1606}
1607
1608
1609/*!
1610 * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE_DESIGN
1611 */
1612
1613void WConfiguration::OnChoiceDesignSelected( wxCommandEvent& event )
1614{
1615        CClickWindowController::EDesign design= 
1616                (CClickWindowController::EDesign) event.GetSelection();
1617
1618        wxGetApp().GetController().GetPointerAction().GetDwellClick().
1619                GetClickWindowController().SetDesign (design);
1620
1621        event.Skip(false);
1622}
1623
1624/*!
1625 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_ONSCREENKEYBOARDCOMMAND
1626 */
1627
1628void WConfiguration::OnButtonOnscreenkeyboardcommandClick( wxCommandEvent& event )
1629{
1630#if defined(__WXMSW__)
1631        wxFileDialog dlg (this, _("Choose on-screen keyboard command"), _T(""), _T(""),
1632                _("Executable files|*.exe"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
1633#else
1634        wxFileDialog dlg (this, _("Choose on-screen keyboard command"), 
1635                _T(""), _T(""), _T("*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
1636#endif
1637
1638        if (dlg.ShowModal()== wxID_OK) m_txtOnScreenKeyboardCommand->SetValue(dlg.GetPath());
1639
1640        event.Skip(false);
1641}
1642
1643
1644/*!
1645 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_TEXTCTRL_ONSCREENKEYBOARDCOMMAND
1646 */
1647
1648void WConfiguration::OnTextctrlOnscreenkeyboardcommandTextUpdated( wxCommandEvent& event )
1649{
1650        if (event.GetString().Cmp(wxGetApp().GetController().GetOnScreenKeyboardCommand()))
1651        {
1652                wxGetApp().GetController().SetOnScreenKeyboardCommand   (event.GetString());
1653                Changed ();
1654        }
1655        event.Skip(false);
1656       
1657}
1658
1659
1660/*!
1661 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_CAMERA_SETTINGS
1662 */
1663
1664void WConfiguration::OnButtonCameraSettingsClick( wxCommandEvent& event )
1665{
1666        wxGetApp().GetController().ShowCameraSettingsDialog ();
1667
1668        event.Skip (false);
1669}
1670
1671
1672/*!
1673 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_CHANGE_CAMERA
1674 */
1675
1676void WConfiguration::OnButtonChangeCameraClick( wxCommandEvent& event )
1677{
1678    wxGetApp().GetController().ChangeCamera ();
1679        wxMessageDialog dlg (NULL, _("You should restart the application to apply this change"), 
1680                _T("Enable Viacam"), wxICON_INFORMATION );
1681        dlg.ShowModal ();
1682
1683        event.Skip(false);
1684        Changed ();
1685}
1686
1687
1688/*!
1689 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL_TOP_WORKSPACE
1690 */
1691
1692void WConfiguration::OnSpinctrlTopWorkspaceUpdated( wxSpinEvent& event )
1693{
1694    wxGetApp().GetController().GetPointerAction().SetTopWorkspace(m_spin_top_workspace->GetValue());
1695        m_spin_top_workspace->SetValue (wxGetApp().GetController().GetPointerAction().GetTopWorkspace());
1696        event.Skip(false);
1697        Changed ();
1698}
1699
1700
1701/*!
1702 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL_RIGHT_WORKSPACE
1703 */
1704
1705void WConfiguration::OnSpinctrlRightWorkspaceUpdated( wxSpinEvent& event )
1706{
1707    wxGetApp().GetController().GetPointerAction().SetRightWorkspace(m_spin_right_workspace->GetValue());
1708        m_spin_right_workspace->SetValue (wxGetApp().GetController().GetPointerAction().GetRightWorkspace());
1709        event.Skip(false);
1710        Changed ();
1711}
1712
1713
1714/*!
1715 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL_LEFT_WORKSPACE
1716 */
1717
1718void WConfiguration::OnSpinctrlLeftWorkspaceUpdated( wxSpinEvent& event )
1719{
1720    wxGetApp().GetController().GetPointerAction().SetLeftWorkspace(m_spin_left_workspace->GetValue());
1721        m_spin_left_workspace->SetValue (wxGetApp().GetController().GetPointerAction().GetLeftWorkspace());
1722        event.Skip(false);
1723        Changed ();
1724}
1725
1726
1727/*!
1728 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL_BOTTOM_WORKSPACE
1729 */
1730
1731void WConfiguration::OnSpinctrlBottomWorkspaceUpdated( wxSpinEvent& event )
1732{
1733    wxGetApp().GetController().GetPointerAction().SetBottomWorkspace(m_spin_bottom_workspace->GetValue());
1734        m_spin_bottom_workspace->SetValue (wxGetApp().GetController().GetPointerAction().GetBottomWorkspace());
1735        event.Skip(false);
1736        Changed ();
1737}
1738
1739/*!
1740 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_WORKSPACE_LIMIT
1741 */
1742
1743void WConfiguration::OnCheckboxWorkspaceLimitClick( wxCommandEvent& event )
1744{
1745    if(m_chkEnabledWorkspace->GetValue()) {
1746        m_chkEnabledWorkspace->SetValue(false);
1747        wxMessageDialog dlg (NULL, _("This action could make you lose the control of the computer.\nDo you want to continue?"), _("eViacam warning"), wxICON_EXCLAMATION | wxYES_NO );
1748        if (dlg.ShowModal()== wxID_YES)
1749        {
1750            m_chkEnabledWorkspace->SetValue(true);
1751            wxGetApp().GetController().GetPointerAction().SetRestrictedWorkingArea(m_chkEnabledWorkspace->GetValue());
1752            m_spin_top_workspace->Enable(m_chkEnabledWorkspace->GetValue());
1753            m_spin_left_workspace->Enable(m_chkEnabledWorkspace->GetValue());
1754            m_spin_right_workspace->Enable(m_chkEnabledWorkspace->GetValue());
1755            m_spin_bottom_workspace->Enable(m_chkEnabledWorkspace->GetValue());
1756        }               
1757        } else {
1758        wxGetApp().GetController().GetPointerAction().SetRestrictedWorkingArea(m_chkEnabledWorkspace->GetValue());
1759        m_spin_top_workspace->Enable(m_chkEnabledWorkspace->GetValue());
1760        m_spin_left_workspace->Enable(m_chkEnabledWorkspace->GetValue());
1761        m_spin_right_workspace->Enable(m_chkEnabledWorkspace->GetValue());
1762        m_spin_bottom_workspace->Enable(m_chkEnabledWorkspace->GetValue());
1763    }
1764
1765   
1766        event.Skip(false);
1767        Changed ();
1768}
1769
1770
1771#if defined(__WXGTK__)
1772/*!
1773 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_STARTUP
1774 */
1775
1776void WConfiguration::OnCheckboxStartupClick( wxCommandEvent& event )
1777{
1778        wxGetApp().GetController().GetAutostart().Enable(m_chkStartup->GetValue());
1779    event.Skip();
1780    Changed ();
1781}
1782#endif
1783
1784
1785/*!
1786 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON
1787 */
1788
1789void WConfiguration::OnButtonClick( wxCommandEvent& event )
1790{
1791        if (wxGetApp().GetController().StartMotionCalibration()) {
1792                InitializeData();
1793                Changed ();     
1794        }       
1795        event.Skip();
1796       
1797}
1798
1799
1800/*!
1801 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_COMBOBOX_LEFT
1802 */
1803
1804void WConfiguration::OnComboboxLeftSelected( wxCommandEvent& event )
1805{
1806        wxGetApp().GetController().GetPointerAction().GetGestureClick().
1807                SetActionLeft ((CGestureClick::EAction) event.GetInt());
1808        event.Skip(false);
1809}
1810
1811
1812/*!
1813 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_COMBOBOX_RIGHT
1814 */
1815
1816void WConfiguration::OnComboboxRightSelected( wxCommandEvent& event )
1817{
1818        wxGetApp().GetController().GetPointerAction().GetGestureClick().
1819                SetActionRight ((CGestureClick::EAction) event.GetInt());
1820        event.Skip(false);
1821}
1822
1823
1824/*!
1825 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_COMBOBOX_TOP
1826 */
1827
1828void WConfiguration::OnComboboxTopSelected( wxCommandEvent& event )
1829{
1830        wxGetApp().GetController().GetPointerAction().GetGestureClick().
1831                SetActionTop ((CGestureClick::EAction) event.GetInt());
1832        event.Skip(false);
1833}
1834
1835
1836/*!
1837 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_COMBOBOX_BOTTOM
1838 */
1839
1840void WConfiguration::OnComboboxBottomSelected( wxCommandEvent& event )
1841{
1842        wxGetApp().GetController().GetPointerAction().GetGestureClick().
1843                SetActionBottom ((CGestureClick::EAction) event.GetInt());
1844        event.Skip(false);
1845}
1846
1847#if defined(__WXGTK__)
1848/*!
1849 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_ALLOW_VISUAL_ALERTS
1850 */
1851
1852void WConfiguration::OnCheckboxAllowVisualAlertsClick( wxCommandEvent& event )
1853{
1854        wxGetApp().GetController().GetPointerAction().SetVisualAlerts(m_chkAllowVisualAlerts->IsChecked());
1855        Changed ();
1856        event.Skip(false);     
1857}
1858#endif
1859
1860/*!
1861 * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
1862 */
1863
1864void WConfiguration::OnOkClick( wxCommandEvent& event )
1865{
1866        // Save changes and destroy window
1867        wxGetApp().GetController().GetConfigManager().WriteAll();
1868        Destroy();
1869        event.Skip(false);
1870}
1871
1872
1873/*!
1874 * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
1875 */
1876
1877void WConfiguration::OnCancelClick( wxCommandEvent& event )
1878{
1879        bool shouldClose= true;
1880
1881        if (m_dirty) {
1882                wxMessageDialog dlg (NULL, _("Discard changes?"), _("eViacam warning"), wxICON_EXCLAMATION | wxYES_NO );
1883                if (dlg.ShowModal()!= wxID_YES) shouldClose= false;
1884                else 
1885                        // Discard changes
1886                        wxGetApp().GetController().GetConfigManager().ReadAll();       
1887        }
1888       
1889        if (shouldClose) Destroy();
1890
1891        event.Skip(false);
1892}
1893
1894
1895
1896#if defined(__WXGTK__)
1897
1898/*!
1899 * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE
1900 */
1901
1902void WConfiguration::OnLeftGestureChoiceSelected( wxCommandEvent& event )
1903{
1904        wxGetApp().GetController().GetPointerAction().GetGestureClick().
1905                SetActionLeft ( (CGestureClick::EAction) event.GetInt());
1906        Changed();
1907        event.Skip(false);
1908}
1909#endif
1910
1911#if defined(__WXGTK__)
1912
1913/*!
1914 * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE1
1915 */
1916
1917void WConfiguration::OnRightGestureChoiceSelected( wxCommandEvent& event )
1918{
1919        wxGetApp().GetController().GetPointerAction().GetGestureClick().
1920                SetActionRight ((CGestureClick::EAction) event.GetInt());
1921        Changed();
1922        event.Skip(false);
1923}
1924#endif
1925
1926#if defined(__WXGTK__)
1927
1928/*!
1929 * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE2
1930 */
1931
1932void WConfiguration::OnUpGestureChoiceSelected( wxCommandEvent& event )
1933{
1934        wxGetApp().GetController().GetPointerAction().GetGestureClick().
1935                SetActionTop ((CGestureClick::EAction) event.GetInt());
1936        Changed();
1937        event.Skip(false);
1938}
1939#endif
1940
1941#if defined(__WXGTK__)
1942
1943/*!
1944 * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE3
1945 */
1946
1947void WConfiguration::OnDownGestureChoiceSelected( wxCommandEvent& event )
1948{
1949        wxGetApp().GetController().GetPointerAction().GetGestureClick().
1950                SetActionBottom ((CGestureClick::EAction) event.GetInt());
1951        Changed();
1952        event.Skip(false);
1953}
1954#endif
1955
1956
1957/*!
1958 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL2
1959 */
1960
1961void WConfiguration::OnSpinLocateFaceTimeoutUpdated( wxSpinEvent& event )
1962{
1963        wxGetApp().GetController().GetVisionPipeline().SetTimeout(m_spinLocateFaceTimeout->GetValue());
1964    event.Skip();
1965}
1966
1967
1968
1969
1970/*!
1971 * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE4
1972 */
1973
1974void WConfiguration::OnChoCpuUsageSelected( wxCommandEvent& event )
1975{
1976        wxGetApp().GetController().GetVisionPipeline().SetCpuUsage(m_choCpuUsage->GetCurrentSelection());
1977    event.Skip();
1978}
1979
1980
1981/*!
1982 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for Hotkeys
1983 */
1984
1985void WConfiguration::OnHotkeyCheckboxClick( wxCommandEvent& event )
1986{
1987        wxGetApp().GetController().getHotkeyManager().GetKeyCommands()[(event.GetId()-FIRST_CONTROL_ID-2)/4]->SetEnabled((event.GetInt()? true : false));
1988        event.Skip(false);
1989}
1990
1991
1992/*!
1993 * wxEVT_COMMAND_BUTTON_CLICKED event handler for Hotkeys
1994 */
1995
1996void WConfiguration::OnHotkeyButtonClick( wxCommandEvent& event )
1997{
1998        WGetKey dlgGetKey(this);
1999        bool isFinished;
2000
2001        do {
2002                isFinished = true;
2003                if (dlgGetKey.ShowModal()== wxID_YES) {
2004                        CKeyboardCode kc= dlgGetKey.GetKeyCode();
2005                        if (wxGetApp().GetController().getHotkeyManager().SetKeyCommand((event.GetId()-FIRST_CONTROL_ID-3)/4, kc)) {
2006                                ((wxTextCtrl*)m_controlList[event.GetId()-FIRST_CONTROL_ID-2])->SetValue(wxString(kc.GetName(),wxConvUTF8));           
2007                        } else {
2008                                wxMessageDialog dlg (NULL, _("This key is used by another command.\nDo you want to try another key?"), _("eViacam warning"), wxICON_EXCLAMATION | wxYES_NO );
2009                                if (dlg.ShowModal()== wxID_YES) isFinished= false;
2010                        }
2011                }
2012        } while (!isFinished);
2013        event.Skip(false);
2014}
2015
2016
2017
2018/*!
2019 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX2
2020 */
2021
2022void WConfiguration::OnCheckboxWrapPointer( wxCommandEvent& event )
2023{
2024        wxGetApp().GetController().GetPointerAction().SetWrapPointer(m_chkWrapPointer->GetValue());
2025    event.Skip();
2026}
2027
2028#if defined(__WXGTK__)
2029/*!
2030 * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE5
2031 */
2032
2033void WConfiguration::OnChoiceClickWindowModeSelected( wxCommandEvent& event )
2034{
2035        wxGetApp().GetController().GetPointerAction().GetDwellClick().GetClickWindowController().
2036                SetLocation( (CClickWindowController::ELocation) event.GetSelection() );
2037       
2038        if (    m_choDockingMode->GetCurrentSelection()== CClickWindowController::FLOATING_VERTICAL ||
2039                m_choDockingMode->GetCurrentSelection()== CClickWindowController::FLOATING_HORIZONTAL)
2040               
2041                m_chkAutohide->Enable(false);
2042        else
2043                m_chkAutohide->Enable(true);
2044       
2045        event.Skip(false);
2046}
2047#endif
2048
2049
2050#if defined(__WXGTK__)
2051/*!
2052 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_AUTOHIDE
2053 */
2054
2055void WConfiguration::OnCheckboxAutohideClick( wxCommandEvent& event )
2056{
2057        wxGetApp().GetController().GetPointerAction().GetDwellClick().
2058        GetClickWindowController().SetAutohide(m_chkAutohide->IsChecked());
2059       
2060        event.Skip(false);
2061}
2062#endif
2063
2064
2065/*!
2066 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPIN_SEND_ACTION_WAIT
2067 */
2068
2069void WConfiguration::OnSpinSendActionWaitUpdated( wxSpinEvent& event )
2070{
2071        wxGetApp().GetController().GetPointerAction().SetSendActionWait(event.GetInt());
2072        Changed();
2073    event.Skip(false);
2074}
2075
2076
2077/*!
2078 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBO_LEGACY_TRACKER
2079 */
2080
2081void WConfiguration::OnCheckboLegacyTrackerClick( wxCommandEvent& event )
2082{
2083        wxGetApp().GetController().GetVisionPipeline().SetUseLegacyTracker(m_chkLegacyTracker->GetValue());
2084        event.Skip(false);
2085        Changed();
2086}
2087
2088
2089/*!
2090 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_CHECK_UPDATES
2091 */
2092
2093void WConfiguration::OnCheckboxCheckUpdatesClick(wxCommandEvent& event)
2094{
2095        wxGetApp().GetController().SetCheckUpdatesAtStartup(m_chkCheckUpdatesAtStartup->GetValue());
2096        event.Skip(false);
2097        Changed();
2098}
2099
2100
Note: See TracBrowser for help on using the repository browser.