Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ResetDialog.cpp
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
2 
11 /* This is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This software is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public
22  * License along with this software. If not, see
23  * <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #include "hugin/ResetDialog.h"
28 #include "base_wx/wxPlatform.h"
29 #include "panoinc.h"
30 
31 #include "hugin/huginApp.h"
32 
33 ResetDialog::ResetDialog(wxWindow *parent, GuiLevel guiLevel)
34 {
35  // load our children. some children might need special
36  // initialization. this will be done later.
37  wxXmlResource::Get()->LoadDialog(this, parent, wxT("reset_dialog"));
38 
39  //set parameters
40  wxConfigBase * cfg = wxConfigBase::Get();
41  bool check;
42  cfg->Read(wxT("/ResetDialog/ResetPosition"),&check,true);
43  XRCCTRL(*this,"reset_pos",wxCheckBox)->SetValue(check);
44  cfg->Read(wxT("/ResetDialog/ResetTranslation"), &check, true);
45  wxCheckBox* reset_translation=XRCCTRL(*this,"reset_translation",wxCheckBox);
46  reset_translation->SetValue(check);
47  if(guiLevel<GUI_EXPERT)
48  {
49  reset_translation->Hide();
50  };
51  cfg->Read(wxT("/ResetDialog/ResetFOV"),&check,true);
52  XRCCTRL(*this,"reset_fov",wxCheckBox)->SetValue(check);
53  cfg->Read(wxT("/ResetDialog/ResetLens"),&check,true);
54  XRCCTRL(*this,"reset_lens",wxCheckBox)->SetValue(check);
55  cfg->Read(wxT("/ResetDialog/ResetExposure"),&check,true);
56  wxCheckBox* checkbox = XRCCTRL(*this, "reset_exposure", wxCheckBox);
57  checkbox->SetValue(check);
58  checkbox->Bind(wxEVT_CHECKBOX, &ResetDialog::OnSelectExposure, this);
59  int exp_param;
60  cfg->Read(wxT("/ResetDialog/ResetExposureParam"),&exp_param,0);
61  XRCCTRL(*this,"combo_exposure",wxComboBox)->Select(exp_param);
62  wxCommandEvent dummy;
63  OnSelectExposure(dummy);
64  cfg->Read(wxT("/ResetDialog/ResetColor"),&check,true);
65  checkbox = XRCCTRL(*this, "reset_color", wxCheckBox);
66  checkbox->SetValue(check);
67  checkbox->Bind(wxEVT_CHECKBOX, &ResetDialog::OnSelectColor, this);
68  cfg->Read(wxT("/ResetDialog/ResetColorParam"),&exp_param,0);
69  OnSelectColor(dummy);
70  XRCCTRL(*this,"combo_color",wxComboBox)->Select(exp_param);
71  cfg->Read(wxT("/ResetDialog/ResetVignetting"),&check,true);
72  XRCCTRL(*this,"reset_vignetting",wxCheckBox)->SetValue(check);
73  cfg->Read(wxT("/ResetDialog/ResetResponse"),&check,true);
74  XRCCTRL(*this,"reset_response",wxCheckBox)->SetValue(check);
75  GetSizer()->Fit(this);
76  //position
77  int x = cfg->Read(wxT("/ResetDialog/positionX"),-1l);
78  int y = cfg->Read(wxT("/ResetDialog/positionY"),-1l);
79  if ( y >= 0 && x >= 0)
80  {
81  this->Move(x, y);
82  }
83  else
84  {
85  this->Move(0, 44);
86  };
87  Bind(wxEVT_BUTTON, &ResetDialog::OnOk, this, wxID_OK);
88 };
89 
91 {
92  XRCCTRL(*this,"reset_exposure",wxCheckBox)->Show(false);
93  XRCCTRL(*this,"combo_exposure",wxComboBox)->Show(false);
94  XRCCTRL(*this,"reset_color",wxCheckBox)->Show(false);
95  XRCCTRL(*this,"combo_color",wxComboBox)->Show(false);
96  XRCCTRL(*this,"reset_vignetting",wxCheckBox)->Show(false);
97  XRCCTRL(*this,"reset_response",wxCheckBox)->Show(false);
98  GetSizer()->Fit(this);
99 };
100 
102 {
103  XRCCTRL(*this,"reset_pos",wxCheckBox)->Show(false);
104  XRCCTRL(*this,"reset_translation",wxCheckBox)->Show(false);
105  XRCCTRL(*this,"reset_fov",wxCheckBox)->Show(false);
106  XRCCTRL(*this,"reset_lens",wxCheckBox)->Show(false);
107  GetSizer()->Fit(this);
108 };
109 
110 void ResetDialog::OnOk(wxCommandEvent & e)
111 {
112  wxConfigBase * cfg = wxConfigBase::Get();
113  wxPoint ps = this->GetPosition();
114  cfg->Write(wxT("/ResetDialog/positionX"), ps.x);
115  cfg->Write(wxT("/ResetDialog/positionY"), ps.y);
116  cfg->Write(wxT("/ResetDialog/ResetPosition"),GetResetPos());
117  cfg->Write(wxT("/ResetDialog/ResetTranslation"), GetResetTranslation());
118  cfg->Write(wxT("/ResetDialog/ResetFOV"),GetResetFOV());
119  cfg->Write(wxT("/ResetDialog/ResetLens"),GetResetLens());
120  cfg->Write(wxT("/ResetDialog/ResetExposure"),GetResetExposure());
121  int exp_param;
122  exp_param=XRCCTRL(*this,"combo_exposure",wxComboBox)->GetSelection();
123  cfg->Write(wxT("/ResetDialog/ResetExposureParam"),exp_param);
124  cfg->Write(wxT("/ResetDialog/ResetColor"),GetResetColor());
125  exp_param=XRCCTRL(*this,"combo_color",wxComboBox)->GetSelection();
126  cfg->Write(wxT("/ResetDialog/ResetColorParam"), exp_param);
127  cfg->Write(wxT("/ResetDialog/ResetVignetting"),GetResetVignetting());
128  cfg->Write(wxT("/ResetDialog/ResetResponse"),GetResetResponse());
129  cfg->Flush();
130  e.Skip();
131 };
132 
133 void ResetDialog::OnSelectExposure(wxCommandEvent & e)
134 {
135  XRCCTRL(*this,"combo_exposure",wxComboBox)->Enable(XRCCTRL(*this, "reset_exposure", wxCheckBox)->GetValue());
136 };
137 
138 void ResetDialog::OnSelectColor(wxCommandEvent & e)
139 {
140  XRCCTRL(*this,"combo_color",wxComboBox)->Enable(XRCCTRL(*this, "reset_color", wxCheckBox)->GetValue());
141 };
142 
144 {
145  return XRCCTRL(*this, "reset_pos", wxCheckBox)->GetValue();
146 };
147 
149 {
150  return XRCCTRL(*this, "reset_translation", wxCheckBox)->GetValue();
151 };
152 
154 {
155  return XRCCTRL(*this, "reset_fov", wxCheckBox)->GetValue();
156 };
157 
159 {
160  return XRCCTRL(*this, "reset_lens", wxCheckBox)->GetValue();
161 };
162 
164 {
165  return XRCCTRL(*this, "reset_exposure", wxCheckBox)->GetValue();
166 };
167 
169 {
170  if(!GetResetExposure())
171  return false;
172  return XRCCTRL(*this, "combo_exposure", wxComboBox)->GetSelection()==0;
173 };
174 
176 {
177  return XRCCTRL(*this, "reset_color", wxCheckBox)->GetValue();
178 };
179 
181 {
182  if(!GetResetColor())
183  return false;
184  return XRCCTRL(*this, "combo_color", wxComboBox)->GetSelection()==0;
185 };
186 
188 {
189  return XRCCTRL(*this, "reset_vignetting", wxCheckBox)->GetValue();
190 };
191 
193 {
194  return XRCCTRL(*this, "reset_response", wxCheckBox)->GetValue();
195 };
bool GetResetLens()
Return TRUE, when user selected &quot;Reset lens&quot;.
void OnOk(wxCommandEvent &e)
Saves current state of all checkboxes when closing dialog with Ok.
bool GetResetExposure()
Return TRUE, when user selected &quot;Reset exposure&quot;.
void LimitToPhotometric()
limits the displayed parameters to photometric parameters
include file for the hugin project
bool GetResetFOV()
Return TRUE, when user selected &quot;Reset FOV&quot;.
Definition of ResetDialog class.
bool GetResetExposureToExif()
Return TRUE, when user selected &quot;Reset exposure to EXIF&quot;, Return FALSE, when user selected &quot;Reset exp...
bool GetResetColor()
Return TRUE, when user selected &quot;Reset color&quot;.
bool GetResetVignetting()
Return TRUE, when user selected &quot;Reset vignetting&quot;.
ResetDialog(wxWindow *parent, GuiLevel guiLevel)
Constructor, read from xrc ressource; restore last uses settings, size and position.
Definition: ResetDialog.cpp:33
void LimitToGeometric()
limits the displayed parameters to geometric parameters
Definition: ResetDialog.cpp:90
bool GetResetColorToExif()
Return TRUE, when user selected &quot;Reset color to EXIF&quot;, Return FALSE, when user selected &quot;Reset color ...
void OnSelectColor(wxCommandEvent &e)
Method for enabling/disable combobox to select reset color to EXIF or ONE depending on state of &quot;Rese...
platform/compiler specific stuff.
GuiLevel
Definition: GuiLevel.h:31
bool GetResetTranslation()
Return TRUE, when user selected &quot;Reset translation&quot;.
bool GetResetResponse()
Return TRUE, when user selected &quot;Reset Camera Response&quot;.
void OnSelectExposure(wxCommandEvent &e)
Method for enabling/disable combobox to select reset exposure to EXIF or ZERO depending on state of &quot;...
bool GetResetPos()
Return TRUE, when user selected &quot;Reset position&quot;.