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 "base_wx/wxutils.h"
30 #include "panoinc.h"
31 
32 #include "hugin/huginApp.h"
33 
34 ResetDialog::ResetDialog(wxWindow *parent, GuiLevel guiLevel)
35 {
36  // load our children. some children might need special
37  // initialization. this will be done later.
38  wxXmlResource::Get()->LoadDialog(this, parent, "reset_dialog");
39 
40  //set parameters
41  wxConfigBase * cfg = wxConfigBase::Get();
42  bool check;
43  cfg->Read("/ResetDialog/ResetPosition",&check,true);
44  XRCCTRL(*this,"reset_pos",wxCheckBox)->SetValue(check);
45  cfg->Read("/ResetDialog/ResetTranslation", &check, true);
46  wxCheckBox* reset_translation=XRCCTRL(*this,"reset_translation",wxCheckBox);
47  reset_translation->SetValue(check);
48  if(guiLevel<GUI_EXPERT)
49  {
50  reset_translation->Hide();
51  };
52  cfg->Read("/ResetDialog/ResetFOV",&check,true);
53  XRCCTRL(*this,"reset_fov",wxCheckBox)->SetValue(check);
54  cfg->Read("/ResetDialog/ResetLens",&check,true);
55  XRCCTRL(*this,"reset_lens",wxCheckBox)->SetValue(check);
56  cfg->Read("/ResetDialog/ResetExposure",&check,true);
57  wxCheckBox* checkbox = XRCCTRL(*this, "reset_exposure", wxCheckBox);
58  checkbox->SetValue(check);
59  checkbox->Bind(wxEVT_CHECKBOX, &ResetDialog::OnSelectExposure, this);
60  int exp_param;
61  cfg->Read("/ResetDialog/ResetExposureParam",&exp_param,0);
62  XRCCTRL(*this,"combo_exposure",wxComboBox)->Select(exp_param);
63  wxCommandEvent dummy;
64  OnSelectExposure(dummy);
65  cfg->Read("/ResetDialog/ResetColor",&check,true);
66  checkbox = XRCCTRL(*this, "reset_color", wxCheckBox);
67  checkbox->SetValue(check);
68  checkbox->Bind(wxEVT_CHECKBOX, &ResetDialog::OnSelectColor, this);
69  cfg->Read("/ResetDialog/ResetColorParam",&exp_param,0);
70  OnSelectColor(dummy);
71  XRCCTRL(*this,"combo_color",wxComboBox)->Select(exp_param);
72  cfg->Read("/ResetDialog/ResetVignetting",&check,true);
73  XRCCTRL(*this,"reset_vignetting",wxCheckBox)->SetValue(check);
74  cfg->Read("/ResetDialog/ResetResponse",&check,true);
75  XRCCTRL(*this,"reset_response",wxCheckBox)->SetValue(check);
76  GetSizer()->Fit(this);
77  //position
78  hugin_utils::RestoreFramePositionOnly(this, "ResetDialog");
79  Bind(wxEVT_BUTTON, &ResetDialog::OnOk, this, wxID_OK);
80 };
81 
83 {
84  XRCCTRL(*this,"reset_exposure",wxCheckBox)->Show(false);
85  XRCCTRL(*this,"combo_exposure",wxComboBox)->Show(false);
86  XRCCTRL(*this,"reset_color",wxCheckBox)->Show(false);
87  XRCCTRL(*this,"combo_color",wxComboBox)->Show(false);
88  XRCCTRL(*this,"reset_vignetting",wxCheckBox)->Show(false);
89  XRCCTRL(*this,"reset_response",wxCheckBox)->Show(false);
90  GetSizer()->Fit(this);
91 };
92 
94 {
95  XRCCTRL(*this,"reset_pos",wxCheckBox)->Show(false);
96  XRCCTRL(*this,"reset_translation",wxCheckBox)->Show(false);
97  XRCCTRL(*this,"reset_fov",wxCheckBox)->Show(false);
98  XRCCTRL(*this,"reset_lens",wxCheckBox)->Show(false);
99  GetSizer()->Fit(this);
100 };
101 
102 void ResetDialog::OnOk(wxCommandEvent & e)
103 {
104  wxConfigBase * cfg = wxConfigBase::Get();
105  hugin_utils::StoreFramePositionOnly(this, "ResetDialog");
106  cfg->Write("/ResetDialog/ResetPosition",GetResetPos());
107  cfg->Write("/ResetDialog/ResetTranslation", GetResetTranslation());
108  cfg->Write("/ResetDialog/ResetFOV",GetResetFOV());
109  cfg->Write("/ResetDialog/ResetLens",GetResetLens());
110  cfg->Write("/ResetDialog/ResetExposure",GetResetExposure());
111  int exp_param;
112  exp_param=XRCCTRL(*this,"combo_exposure",wxComboBox)->GetSelection();
113  cfg->Write("/ResetDialog/ResetExposureParam",exp_param);
114  cfg->Write("/ResetDialog/ResetColor",GetResetColor());
115  exp_param=XRCCTRL(*this,"combo_color",wxComboBox)->GetSelection();
116  cfg->Write("/ResetDialog/ResetColorParam", exp_param);
117  cfg->Write("/ResetDialog/ResetVignetting",GetResetVignetting());
118  cfg->Write("/ResetDialog/ResetResponse",GetResetResponse());
119  cfg->Flush();
120  e.Skip();
121 };
122 
123 void ResetDialog::OnSelectExposure(wxCommandEvent & e)
124 {
125  XRCCTRL(*this,"combo_exposure",wxComboBox)->Enable(XRCCTRL(*this, "reset_exposure", wxCheckBox)->GetValue());
126 };
127 
128 void ResetDialog::OnSelectColor(wxCommandEvent & e)
129 {
130  XRCCTRL(*this,"combo_color",wxComboBox)->Enable(XRCCTRL(*this, "reset_color", wxCheckBox)->GetValue());
131 };
132 
134 {
135  return XRCCTRL(*this, "reset_pos", wxCheckBox)->GetValue();
136 };
137 
139 {
140  return XRCCTRL(*this, "reset_translation", wxCheckBox)->GetValue();
141 };
142 
144 {
145  return XRCCTRL(*this, "reset_fov", wxCheckBox)->GetValue();
146 };
147 
149 {
150  return XRCCTRL(*this, "reset_lens", wxCheckBox)->GetValue();
151 };
152 
154 {
155  return XRCCTRL(*this, "reset_exposure", wxCheckBox)->GetValue();
156 };
157 
159 {
160  if(!GetResetExposure())
161  return false;
162  return XRCCTRL(*this, "combo_exposure", wxComboBox)->GetSelection()==0;
163 };
164 
166 {
167  return XRCCTRL(*this, "reset_color", wxCheckBox)->GetValue();
168 };
169 
171 {
172  if(!GetResetColor())
173  return false;
174  return XRCCTRL(*this, "combo_color", wxComboBox)->GetSelection()==0;
175 };
176 
178 {
179  return XRCCTRL(*this, "reset_vignetting", wxCheckBox)->GetValue();
180 };
181 
183 {
184  return XRCCTRL(*this, "reset_response", wxCheckBox)->GetValue();
185 };
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
Definition: ResetDialog.cpp:93
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:34
void LimitToGeometric()
limits the displayed parameters to geometric parameters
Definition: ResetDialog.cpp:82
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;.
void StoreFramePositionOnly(wxTopLevelWindow *frame, const wxString &basename)
Definition: wxutils.cpp:163
void RestoreFramePositionOnly(wxTopLevelWindow *frame, const wxString &basename)
Definition: wxutils.cpp:143