Hugin trunk 0.1
Loading...
Searching...
No Matches
PreferencesDialog.cpp
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
2
27#include "hugin_config.h"
28#include "panoinc_WX.h"
29#include "wx/listbook.h"
30#include <wx/stdpaths.h>
31#include "panoinc.h"
32
33#include "base_wx/wxPlatform.h"
34#include "base_wx/LensTools.h"
35#include "base_wx/wxutils.h"
36
37#include "hugin/huginApp.h"
41#include "hugin/MainFrame.h"
43#include "base_wx/huginConfig.h"
44
45// validators are working different somehow...
46//#define MY_STR_VAL(id, filter) { XRCCTRL(*this, "prefs_" #id, wxTextCtrl)->SetValidator(wxTextValidator(filter, &id)); }
47//#define MY_SPIN_VAL(id) { XRCCTRL(*this, "prefs_" #id, wxSpinCtrl)->SetValidator(wxGenericValidator(&id)); }
48
49#define MY_STR_VAL(id, val) { XRCCTRL(*this, id, wxTextCtrl)->SetValue(val); };
50#define MY_SPIN_VAL(id, val) { XRCCTRL(*this, id, wxSpinCtrl)->SetValue(val); };
51#define MY_BOOL_VAL(id, val) { XRCCTRL(*this, id, wxCheckBox)->SetValue(val); };
52#define MY_CHOICE_VAL(id, val) { XRCCTRL(*this, id, wxChoice)->SetSelection(val); };
53#define MY_STATIC_VAL(id, val) { XRCCTRL(*this, id, wxStaticText)->SetLabel(val); };
54
55#define MY_G_STR_VAL(id) XRCCTRL(*this, id, wxTextCtrl)->GetValue()
56#define MY_G_SPIN_VAL(id) XRCCTRL(*this, id, wxSpinCtrl)->GetValue()
57#define MY_G_BOOL_VAL(id) XRCCTRL(*this, id, wxCheckBox)->GetValue()
58#define MY_G_CHOICE_VAL(id) XRCCTRL(*this, id, wxChoice)->GetSelection()
59
61//: wxDialog(parent, -1, _("Preferences - hugin"))
62{
63 DEBUG_TRACE("");
64 // load our children. some children might need special
65 // initialization. this will be done later.
66 wxXmlResource::Get()->LoadDialog(this, parent, "pref_dialog");
67
68 // Custom setup ( stuff that can not be done in XRC )
69 XRCCTRL(*this, "prefs_ft_RotationStartAngle", wxSpinCtrl)->SetRange(-180,0);
70 XRCCTRL(*this, "prefs_ft_RotationStopAngle", wxSpinCtrl)->SetRange(0,180);
71 XRCCTRL(*this, "prefs_ass_nControlPoints", wxSpinCtrl)->SetRange(3,3000);
72
73 wxChoice* lang_choice = XRCCTRL(*this, "prefs_gui_language", wxChoice);
74 // add languages to choice
75 long* lp = new long;
77 lang_choice->Append(_("System default"), lp);
78 lp = new long;
80 lang_choice->Append(_("Basque"), lp);
86 lp = new long;
88 lang_choice->Append(_("Catalan"), lp);
89 lp = new long;
91 lang_choice->Append(_("Chinese (Simplified)"), lp);
92 lp = new long;
94 lang_choice->Append(_("Chinese (Traditional)"), lp);
95 lp = new long;
97 lang_choice->Append(_("Czech"), lp);
98 lp = new long;
100 lang_choice->Append(_("Danish"), lp);
101 lp = new long;
103 lang_choice->Append(_("Dutch"), lp);
104 lp = new long;
106 lang_choice->Append(_("English"), lp);
107 lp = new long;
109 lang_choice->Append(_("French"), lp);
110 lp = new long;
112 lang_choice->Append(_("German"), lp);
113 lp = new long;
115 lang_choice->Append(_("Hungarian"), lp);
116 lp = new long;
118 lang_choice->Append(_("Italian"), lp);
119 lp = new long;
121 lang_choice->Append(_("Japanese"), lp);
127 lp = new long;
129 lang_choice->Append(_("Polish"), lp);
130 lp = new long;
132 lang_choice->Append(_("Portuguese (Brazilian)"), lp);
133 lp = new long;
135 lang_choice->Append(_("Russian"), lp);
136 lp = new long;
138 lang_choice->Append(_("Slovak"), lp);
144 lp = new long;
146 lang_choice->Append(_("Spanish"), lp);
147 lp = new long;
149 lang_choice->Append(_("Swedish"), lp);
155 lp = new long;
157 lang_choice->Append(_("Finnish"), lp);
158 lp = new long;
160 lang_choice->Append(_("Valencian (Southern Catalan)"), lp);
161 lang_choice->SetSelection(0);
162
163 // enable auto completion on raw converter executables
164 XRCCTRL(*this, "pref_raw_dcraw_exe", wxTextCtrl)->AutoCompleteFileNames();
165 XRCCTRL(*this, "pref_raw_rt_exe", wxTextCtrl)->AutoCompleteFileNames();
166 XRCCTRL(*this, "pref_raw_darktable_exe", wxTextCtrl)->AutoCompleteFileNames();
167
168 // default blender settings
169 FillBlenderList(XRCCTRL(*this, "pref_default_blender", wxChoice));
170
171 wxStaticText* preview=XRCCTRL(*this, "prefs_project_filename_preview", wxStaticText);
172 preview->SetWindowStyle(preview->GetWindowStyle() | wxST_ELLIPSIZE_START);
173 preview=XRCCTRL(*this, "prefs_output_filename_preview", wxStaticText);
174 preview->SetWindowStyle(preview->GetWindowStyle() | wxST_ELLIPSIZE_START);
175 // enable auto-completion
176 XRCCTRL(*this, "prefs_misc_tempdir", wxTextCtrl)->AutoCompleteDirectories();
177 XRCCTRL(*this, "pref_exiftool_argfile", wxTextCtrl)->AutoCompleteFileNames();
178 XRCCTRL(*this, "pref_exiftool_argfile2", wxTextCtrl)->AutoCompleteFileNames();
179 XRCCTRL(*this, "prefs_enblend_EnblendExe", wxTextCtrl)->AutoCompleteFileNames();
180 XRCCTRL(*this, "prefs_enblend_EnfuseExe", wxTextCtrl)->AutoCompleteFileNames();
181 // load autopano settings
182 wxConfigBase* cfg = wxConfigBase::Get();
183 m_CPDetectorList = XRCCTRL(*this, "pref_cpdetector_list", wxListBox);
185 wxCommandEvent evt; this->OnCPDetectorEdit(evt); });
187
188#if defined __APPLE__ && defined __aarch64__
189 {
190 // disable GPU remapping checkbox on ARM Macs, GPU code is not working on these systems
191 wxCheckBox* gpuCheckBox = XRCCTRL(*this, "prefs_nona_useGpu", wxCheckBox);
192 gpuCheckBox->Disable();
193 gpuCheckBox->SetValue(false);
194 cfg->Write("/Nona/UseGPU", false);
195 gpuCheckBox->Hide();
196 }
197#endif
198
199 // Load configuration values from wxConfig
201
202 Update();
203 GetSizer()->SetSizeHints(this);
204 // bind all event handler for buttons and boxes
205 Bind(wxEVT_BUTTON, &PreferencesDialog::OnEnblendExe, this, XRCID("prefs_enblend_select"));
206 Bind(wxEVT_BUTTON, &PreferencesDialog::OnEnfuseExe, this, XRCID("prefs_enblend_enfuse_select"));
207 Bind(wxEVT_BUTTON, &PreferencesDialog::OnDcrawExe, this, XRCID("pref_raw_dcraw_exe_select"));
208 Bind(wxEVT_BUTTON, &PreferencesDialog::OnRawTherapeeExe, this, XRCID("pref_raw_rt_exe_select"));
209 Bind(wxEVT_BUTTON, &PreferencesDialog::OnDarktableExe, this, XRCID("pref_raw_darktable_exe_select"));
210 Bind(wxEVT_BUTTON, &PreferencesDialog::OnExifArgfileChoose, this, XRCID("pref_exiftool_argfile_choose"));
211 Bind(wxEVT_BUTTON, &PreferencesDialog::OnExifArgfileEdit, this, XRCID("pref_exiftool_argfile_edit"));
212 Bind(wxEVT_BUTTON, &PreferencesDialog::OnExifArgfile2Choose, this, XRCID("pref_exiftool_argfile2_choose"));
213 Bind(wxEVT_BUTTON, &PreferencesDialog::OnExifArgfile2Edit, this, XRCID("pref_exiftool_argfile2_edit"));
214 Bind(wxEVT_CHECKBOX, &PreferencesDialog::OnExifTool, this, XRCID("pref_exiftool_metadata"));
215 Bind(wxEVT_CHECKBOX, &PreferencesDialog::OnRotationCheckBox, this, XRCID("prefs_ft_RotationSearch"));
216 Bind(wxEVT_CHECKBOX, &PreferencesDialog::OnCustomEnblend, this, XRCID("prefs_enblend_Custom"));
217 Bind(wxEVT_CHECKBOX, &PreferencesDialog::OnCustomEnfuse, this, XRCID("prefs_enblend_enfuseCustom"));
219 Bind(wxEVT_BUTTON, &PreferencesDialog::OnChangeUserDefinedOutputOptions, this, XRCID("pref_ass_change_output"));
220 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorAdd, this, XRCID("pref_cpdetector_new"));
221 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorEdit, this, XRCID("pref_cpdetector_edit"));
222 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorDelete, this, XRCID("pref_cpdetector_del"));
223 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorMoveUp, this, XRCID("pref_cpdetector_moveup"));
224 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorMoveDown, this, XRCID("pref_cpdetector_movedown"));
225 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorDefault, this, XRCID("pref_cpdetector_default"));
226 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorLoad, this, XRCID("pref_cpdetector_load"));
227 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorSave, this, XRCID("pref_cpdetector_save"));
228 Bind(wxEVT_CHOICE, &PreferencesDialog::OnFileFormatChanged, this, XRCID("pref_ldr_output_file_format"));
229 Bind(wxEVT_CHOICE, &PreferencesDialog::OnProcessorChanged, this, XRCID("pref_processor_gui"));
230 Bind(wxEVT_CHOICE, &PreferencesDialog::OnBlenderChanged, this, XRCID("pref_default_blender"));
231 Bind(wxEVT_TEXT, &PreferencesDialog::OnUpdateProjectFilename, this, XRCID("prefs_project_filename"));
232 Bind(wxEVT_TEXT, &PreferencesDialog::OnUpdateOutputFilename, this, XRCID("prefs_output_filename"));
233
234 // only enable bundled if the build is actually bundled.
235#if defined __WXMSW__ || defined MAC_SELF_CONTAINED_BUNDLE
236
237#else
238 MY_BOOL_VAL("prefs_enblend_Custom", HUGIN_ENBLEND_EXE_CUSTOM);
239 XRCCTRL(*this, "prefs_enblend_Custom", wxCheckBox)->Hide();
240 cfg->Write("/Enblend/Custom", HUGIN_ENBLEND_EXE_CUSTOM);
241
242 MY_BOOL_VAL("prefs_enblend_enfuseCustom", HUGIN_ENFUSE_EXE_CUSTOM);
243 XRCCTRL(*this, "prefs_enblend_enfuseCustom", wxCheckBox)->Hide();
244 cfg->Write("/Enfuse/Custom", HUGIN_ENFUSE_EXE_CUSTOM);
245#endif
246
247 hugin_utils::RestoreFramePosition(this, "PreferencesDialog");
248 // event handler for default buttons
251 Bind(wxEVT_BUTTON, &PreferencesDialog::OnRestoreDefaults, this, XRCID("prefs_defaults"));
252}
253
254
256{
257 DEBUG_TRACE("begin dtor");
258
259 hugin_utils::StoreFramePosition(this, "PreferencesDialog");
260
261 // delete custom list data
262 wxChoice* lang_choice = XRCCTRL(*this, "prefs_gui_language", wxChoice);
263 for (int i = 0; i < (int) lang_choice->GetCount(); i++)
264 {
265 delete static_cast<long*>(lang_choice->GetClientData(i));
266 }
267
268 DEBUG_TRACE("end dtor");
269}
270
271void PreferencesDialog::OnOk(wxCommandEvent& e)
272{
274 this->EndModal(wxOK);
275}
276
277void PreferencesDialog::OnHelp(wxCommandEvent& e)
278{
279 MainFrame::Get()->DisplayHelp("Hugin_Preferences.html");
280};
281
283{
284 EnableRotationCtrls(e.IsChecked());
285}
286
287void PreferencesDialog::OnEnblendExe(wxCommandEvent& e)
288{
289 wxFileDialog dlg(this,_("Select Enblend"),
292 _("Executables (*.exe)|*.exe"),
293#else
294 "*",
295#endif
297 if (dlg.ShowModal() == wxID_OK)
298 {
299 XRCCTRL(*this, "prefs_enblend_EnblendExe", wxTextCtrl)->SetValue(
300 dlg.GetPath());
301 }
302}
303
304void PreferencesDialog::OnEnfuseExe(wxCommandEvent& e)
305{
306 wxFileDialog dlg(this,_("Select Enfuse"),
309 _("Executables (*.exe)|*.exe"),
310#else
311 "*",
312#endif
314 if (dlg.ShowModal() == wxID_OK)
315 {
316 XRCCTRL(*this, "prefs_enblend_EnfuseExe", wxTextCtrl)->SetValue(
317 dlg.GetPath());
318 }
319}
320
321void PreferencesDialog::OnDcrawExe(wxCommandEvent & e)
322{
323 wxTextCtrl* ctrl = XRCCTRL(*this, "pref_raw_dcraw_exe", wxTextCtrl);
324 wxFileDialog dlg(this, _("Select dcraw"), "", ctrl->GetValue(),
326 _("Executables (*.exe)|*.exe"),
327#else
328 "*",
329#endif
331 if (dlg.ShowModal() == wxID_OK)
332 {
333 ctrl->SetValue(dlg.GetPath());
334 };
335};
336
338{
339 wxTextCtrl* ctrl = XRCCTRL(*this, "pref_raw_rt_exe", wxTextCtrl);
340 wxFileDialog dlg(this, _("Select RawTherapee-cli"), "", ctrl->GetValue(),
342 _("Executables (*.exe)|*.exe"),
343#else
344 "*",
345#endif
347 if (dlg.ShowModal() == wxID_OK)
348 {
349 ctrl->SetValue(dlg.GetPath());
350 };
351};
352
353void PreferencesDialog::OnDarktableExe(wxCommandEvent & e)
354{
355 wxTextCtrl* ctrl = XRCCTRL(*this, "pref_raw_darktable_exe", wxTextCtrl);
356 wxFileDialog dlg(this, _("Select Darktable-cli"), "", ctrl->GetValue(),
358 _("Executables (*.exe)|*.exe"),
359#else
360 "*",
361#endif
363 if (dlg.ShowModal() == wxID_OK)
364 {
365 ctrl->SetValue(dlg.GetPath());
366 };
367};
368
369
371{
372 XRCCTRL(*this, "prefs_enblend_EnblendExe", wxTextCtrl)->Enable(e.IsChecked());
373 XRCCTRL(*this, "prefs_enblend_select", wxButton)->Enable(e.IsChecked());
374}
375
377{
378 XRCCTRL(*this, "prefs_enblend_EnfuseExe", wxTextCtrl)->Enable(e.IsChecked());
379 XRCCTRL(*this, "prefs_enblend_enfuse_select", wxButton)->Enable(e.IsChecked());
380}
381
383{
384 wxFileDialog dlg(this,_("Select ExifTool argfile"),
385 wxEmptyString, XRCCTRL(*this, "pref_exiftool_argfile", wxTextCtrl)->GetValue(),
386 _("ExifTool Argfiles (*.arg)|*.arg|All Files(*)|*"),
388 if (dlg.ShowModal() == wxID_OK)
389 {
390 XRCCTRL(*this, "pref_exiftool_argfile", wxTextCtrl)->SetValue(
391 dlg.GetPath());
392 }
393}
394
396{
398 defaultFile.Open();
400 newFile.Create();
401 if (defaultFile.IsOpened())
402 {
403 for (size_t i = 0; i < defaultFile.GetLineCount(); ++i)
404 {
405 newFile.AddLine(defaultFile[i]);
406 };
407 };
408 newFile.Write();
409 defaultFile.Close();
410 newFile.Close();
411};
412
414{
415 wxString filename=XRCCTRL(*this, "pref_exiftool_argfile", wxTextCtrl)->GetValue();
416 if(!filename.empty())
417 {
418 wxFileName file(filename);
420 if(!file.Exists())
421 {
422 if (hugin_utils::HuginMessageBox(wxString::Format(_("Argfile %s does not exist.\nShould the argfile be created with default tags?"), filename),
423 _("Hugin"), wxYES_NO | wxICON_EXCLAMATION, this) != wxYES)
424 {
425 return;
426 };
427 filename = file.GetFullPath();
428 CreateNewArgFile(filename, MainFrame::Get()->GetDataPath() + "hugin_exiftool_copy.arg");
429 }
430 else
431 {
432 filename = file.GetFullPath();
433 };
434 }
435 else
436 {
437 if (hugin_utils::HuginMessageBox(_("No file selected.\nShould an argfile be created with default tags?"),
438 _("Hugin"), wxYES_NO | wxICON_EXCLAMATION, this) != wxYES)
439 {
440 return;
441 };
442 wxFileDialog dlg(this,_("Select new ExifTool argfile"),
443 wxStandardPaths::Get().GetUserConfigDir(), wxEmptyString,
444 _("ExifTool Argfiles (*.arg)|*.arg|All Files(*)|*"),
446 if (dlg.ShowModal() != wxID_OK)
447 {
448 return;
449 };
450 filename=dlg.GetPath();
451 CreateNewArgFile(filename, MainFrame::Get()->GetDataPath() + "hugin_exiftool_copy.arg");
452 };
453 XRCCTRL(*this, "pref_exiftool_argfile", wxTextCtrl)->SetValue(filename);
454 wxDialog edit_dlg;
455 wxXmlResource::Get()->LoadDialog(&edit_dlg, this, "pref_edit_argfile");
457 wxTextCtrl* argfileControl=XRCCTRL(edit_dlg, "pref_edit_textcontrol", wxTextCtrl);
458 argfileControl->LoadFile(filename);
459 if(edit_dlg.ShowModal() == wxID_OK)
460 {
461 if(!argfileControl->SaveFile(filename))
462 {
463 hugin_utils::HuginMessageBox(wxString::Format(_("Could not save file \"%s\"."), filename),
464 _("Hugin"), wxOK | wxICON_ERROR, this);
465 };
467 };
468};
469
471{
472 wxFileDialog dlg(this, _("Select ExifTool argfile"),
473 wxEmptyString, XRCCTRL(*this, "pref_exiftool_argfile2", wxTextCtrl)->GetValue(),
474 _("ExifTool Argfiles (*.arg)|*.arg|All Files(*)|*"),
476 if (dlg.ShowModal() == wxID_OK)
477 {
478 XRCCTRL(*this, "pref_exiftool_argfile2", wxTextCtrl)->SetValue(
479 dlg.GetPath());
480 }
481}
482
484{
485 wxString filename = XRCCTRL(*this, "pref_exiftool_argfile2", wxTextCtrl)->GetValue();
486 if (!filename.empty())
487 {
488 wxFileName file(filename);
490 if (!file.Exists())
491 {
492 if (hugin_utils::HuginMessageBox(wxString::Format(_("File %s does not exist.\nShould an example argfile be created?"), filename),
493 _("Hugin"), wxYES_NO | wxICON_EXCLAMATION, this) != wxYES)
494 {
495 return;
496 };
497 filename = file.GetFullPath();
498 CreateNewArgFile(filename, MainFrame::Get()->GetDataPath() + "hugin_exiftool_final_example.arg");
499 }
500 else
501 {
502 filename = file.GetFullPath();
503 };
504 }
505 else
506 {
507 if (hugin_utils::HuginMessageBox(_("No file selected.\nShould an example argfile be created?"),
508 _("Hugin"), wxYES_NO | wxICON_EXCLAMATION, this) != wxYES)
509 {
510 return;
511 };
512 wxFileDialog dlg(this, _("Select new ExifTool argfile"),
513 wxStandardPaths::Get().GetUserConfigDir(), wxEmptyString,
514 _("ExifTool Argfiles (*.arg)|*.arg|All Files(*)|*"),
516 if (dlg.ShowModal() != wxID_OK)
517 {
518 return;
519 };
520 filename = dlg.GetPath();
521 CreateNewArgFile(filename, MainFrame::Get()->GetDataPath() + "hugin_exiftool_final_example.arg");
522 };
523 XRCCTRL(*this, "pref_exiftool_argfile2", wxTextCtrl)->SetValue(filename);
524 wxDialog edit_dlg;
525 wxXmlResource::Get()->LoadDialog(&edit_dlg, this, "pref_edit_argfile_placeholders");
526 hugin_utils::RestoreFramePosition(&edit_dlg, "EditArgfilePlaceholders");
527 wxTextCtrl* argfileControl = XRCCTRL(edit_dlg, "pref_edit_textcontrol", wxTextCtrl);
528 argfileControl->LoadFile(filename);
529 if (edit_dlg.ShowModal() == wxID_OK)
530 {
531 if (!argfileControl->SaveFile(filename))
532 {
533 hugin_utils::HuginMessageBox(wxString::Format(_("Could not save file \"%s\"."), filename),
534 _("Hugin"), wxOK | wxICON_ERROR, this);
535 };
536 hugin_utils::StoreFramePosition(&edit_dlg, "EditArgfilePlaceholders");
537 };
538};
539
540void PreferencesDialog::OnExifTool(wxCommandEvent & e)
541{
542 bool copyMetadata=XRCCTRL(*this, "pref_exiftool_metadata", wxCheckBox)->GetValue();
543 XRCCTRL(*this, "pref_exiftool_argfile_general_label", wxStaticText)->Enable(copyMetadata);
544 XRCCTRL(*this, "pref_exiftool_argfile_intermediate_label", wxStaticText)->Enable(copyMetadata);
545 XRCCTRL(*this, "pref_exiftool_argfile_label", wxStaticText)->Enable(copyMetadata);
546 XRCCTRL(*this, "pref_exiftool_argfile", wxTextCtrl)->Enable(copyMetadata);
547 XRCCTRL(*this, "pref_exiftool_argfile_choose", wxButton)->Enable(copyMetadata);
548 XRCCTRL(*this, "pref_exiftool_argfile_edit", wxButton)->Enable(copyMetadata);
549 XRCCTRL(*this, "pref_exiftool_argfile_final_label", wxStaticText)->Enable(copyMetadata);
550 XRCCTRL(*this, "pref_exiftool_argfile2_label", wxStaticText)->Enable(copyMetadata);
551 XRCCTRL(*this, "pref_exiftool_argfile2", wxTextCtrl)->Enable(copyMetadata);
552 XRCCTRL(*this, "pref_exiftool_argfile2_choose", wxButton)->Enable(copyMetadata);
553 XRCCTRL(*this, "pref_exiftool_argfile2_edit", wxButton)->Enable(copyMetadata);
554 XRCCTRL(*this, "pref_exiftool_gpano", wxCheckBox)->Enable(copyMetadata);
555};
556
558{
559 XRCCTRL(*this, "prefs_ft_rot_panel", wxPanel)->Enable(enable);
560}
561
563{
564 DEBUG_DEBUG("Updating display data");
565
566 double d;
567 bool t;
569 wxConfigBase* cfg = wxConfigBase::Get();
570
571 if (panel==0 || panel == 1)
572 {
573 // memory setting
574 unsigned long long mem = cfg->Read("/ImageCache/UpperBound", HUGIN_IMGCACHE_UPPERBOUND);
575#ifdef __WXMSW__
576 unsigned long mem_low = cfg->Read("/ImageCache/UpperBound", HUGIN_IMGCACHE_UPPERBOUND);
577 unsigned long mem_high = cfg->Read("/ImageCache/UpperBoundHigh", (long) 0);
578 if (mem_high > 0)
579 {
580 mem = ((unsigned long long) mem_high << 32) + mem_low;
581 }
582 else
583 {
584 mem = mem_low;
585 }
586#endif
587 MY_SPIN_VAL("prefs_cache_UpperBound", mem >> 20);
588
589 // language
590 // check if current language is in list and activate it then.
591 wxChoice* lang_choice = XRCCTRL(*this, "prefs_gui_language", wxChoice);
592 int curlang = cfg->Read("language", HUGIN_LANGUAGE);
593 bool found = false;
594 int idx = 0;
595 int idxDefault = 0;
596 for (int i = 0; i < (int)lang_choice->GetCount(); i++)
597 {
598 long lang = * static_cast<long*>(lang_choice->GetClientData(i));
599 if (curlang == lang)
600 {
601 found = true;
602 idx = i;
603 }
605 {
607 }
608 }
609 if (found)
610 {
611 DEBUG_DEBUG("wxChoice language updated:" << curlang);
612 // update language
613 lang_choice->SetSelection(idx);
614 }
615 else
616 {
617 // unknown language selected..
618 DEBUG_WARN("Unknown language configured");
619 // select default language
620 lang_choice->SetSelection(idxDefault);
621 }
622
623 // smart undo
624 t = cfg->Read("smartUndo", HUGIN_SMART_UNDO) == 1;
625 MY_BOOL_VAL("prefs_smart_undo", t);
626
627 // copy log to clipboard
628 t = cfg->Read("CopyLogToClipboard", 0l) == 1;
629 MY_BOOL_VAL("prefs_copy_log", t);
630
631 t = cfg->Read("/GLPreviewFrame/ShowProjectionHints", HUGIN_SHOW_PROJECTION_HINTS) == 1;
632 MY_BOOL_VAL("pref_show_projection_hints", t);
633 // auto-rotate
634 t = cfg->Read("/CPEditorPanel/AutoRot", 1l) == 1;
635 MY_BOOL_VAL("pref_autorotate", t);
636
637 // raw converter programs paths
638 MY_STR_VAL("pref_raw_dcraw_exe", cfg->Read("/RawImportDialog/dcrawExe", ""));
639 MY_STR_VAL("pref_raw_rt_exe", cfg->Read("/RawImportDialog/RTExe", ""));
640 MY_STR_VAL("pref_raw_darktable_exe", cfg->Read("/RawImportDialog/DarktableExe", ""));
641 };
642
643 // filename panel
644 if(panel==0 || panel==2)
645 {
646 // tempdir
647 MY_STR_VAL("prefs_misc_tempdir", cfg->Read("tempDir",wxEmptyString));
648 // default filenames
649 wxString filename=cfg->Read("ProjectFilename", HUGIN_DEFAULT_PROJECT_NAME);
650#ifdef __WXMSW__
651 filename.Replace("/","\\",true);
652#endif
653 MY_STR_VAL("prefs_project_filename", filename);
654 filename=cfg->Read("OutputFilename", HUGIN_DEFAULT_OUTPUT_NAME);
655#ifdef __WXMSW__
656 filename.Replace("/","\\",true);
657#endif
658 MY_STR_VAL("prefs_output_filename", filename);
659 }
660
661 if (panel==0 || panel == 3)
662 {
663 // Assistant settings
664 t = cfg->Read("/Assistant/autoAlign", HUGIN_ASS_AUTO_ALIGN) == 1;
665 MY_BOOL_VAL("prefs_ass_autoAlign", t);
666 t = cfg->Read("/General/IgnoreFovRectilinearOnAdd", 1l) == 1l;
667 MY_BOOL_VAL("prefs_ass_loadFovRectilinear", !t);
668 MY_SPIN_VAL("prefs_ass_nControlPoints",
669 cfg->Read("/Assistant/nControlPoints", HUGIN_ASS_NCONTROLPOINTS));
670 double factor = HUGIN_ASS_PANO_DOWNSIZE_FACTOR;
671 cfg->Read("/Assistant/panoDownsizeFactor", &factor);
672 MY_SPIN_VAL("prefs_ass_panoDownsizeFactor",(int)(factor*100.0));
673 t = cfg->Read("/Assistant/Linefind", HUGIN_ASS_LINEFIND) == 1;
674 MY_BOOL_VAL("prefs_ass_linefind", t);
675 t = cfg->Read("/Celeste/Auto", HUGIN_CELESTE_AUTO) == 1;
676 MY_BOOL_VAL("prefs_celeste_auto", t);
677 t = cfg->Read("/Assistant/AutoCPClean", HUGIN_ASS_AUTO_CPCLEAN) == 1;
678 MY_BOOL_VAL("prefs_auto_cpclean", t);
679 t = cfg->Read("/Assistant/UserDefinedOutputOption", 0l) == 1;
680 MY_BOOL_VAL("pref_ass_output", t);
681 wxCommandEvent dummy;
683 }
684 // Fine tune settings
685
686 if (panel==0 || panel == 4)
687 {
688 // hdr display settings
689 MY_CHOICE_VAL("prefs_misc_hdr_mapping", cfg->Read("/ImageCache/Mapping", HUGIN_IMGCACHE_MAPPING_FLOAT));
690 //MY_CHOICE_VAL("prefs_misc_hdr_range", cfg->Read("/ImageCache/Range", HUGIN_IMGCACHE_RANGE));
691
692 int val = wxConfigBase::Get()->Read("/CPEditorPanel/MagnifierWidth", 61l);
693 val = hugin_utils::floori((val - 61) / 20);
694 val = std::min(val, 3);
695 XRCCTRL(*this, "prefs_misc_magnifier_width", wxChoice)->SetSelection(val);
696
697
698 MY_SPIN_VAL("prefs_ft_TemplateSize",
699 cfg->Read("/Finetune/TemplateSize",HUGIN_FT_TEMPLATE_SIZE));
700 MY_SPIN_VAL("prefs_ft_SearchAreaPercent",cfg->Read("/Finetune/SearchAreaPercent",
702 MY_SPIN_VAL("prefs_ft_LocalSearchWidth", cfg->Read("/Finetune/LocalSearchWidth",
704
706 cfg->Read("/Finetune/CorrThreshold", &d, HUGIN_FT_CORR_THRESHOLD);
708 MY_STR_VAL("prefs_ft_CorrThreshold", tstr);
709
710 cfg->Read("/Finetune/CurvThreshold", &d, HUGIN_FT_CURV_THRESHOLD);
712 MY_STR_VAL("prefs_ft_CurvThreshold", tstr);
713
714 t = cfg->Read("/Finetune/RotationSearch", HUGIN_FT_ROTATION_SEARCH) == 1;
715 MY_BOOL_VAL("prefs_ft_RotationSearch", t);
717
719 cfg->Read("/Finetune/RotationStartAngle",&d,HUGIN_FT_ROTATION_START_ANGLE);
720 MY_SPIN_VAL("prefs_ft_RotationStartAngle", hugin_utils::roundi(d))
721
723 cfg->Read("/Finetune/RotationStopAngle", &d, HUGIN_FT_ROTATION_STOP_ANGLE);
724 MY_SPIN_VAL("prefs_ft_RotationStopAngle", hugin_utils::roundi(d));
725
726 MY_SPIN_VAL("prefs_ft_RotationSteps", cfg->Read("/Finetune/RotationSteps",
728 }
729
732
735
736 if (panel==0 || panel == 5)
737 {
739 }
740
741 if (panel == 0 || panel == 6)
742 {
745 MY_CHOICE_VAL("pref_ldr_output_file_format", cfg->Read("/output/ldr_format", HUGIN_LDR_OUTPUT_FORMAT));
747 // MY_CHOICE_VAL("pref_hdr_output_file_format", cfg->Read("/output/hdr_format", HUGIN_HDR_OUTPUT_FORMAT));
748 MY_CHOICE_VAL("pref_tiff_compression", cfg->Read("/output/tiff_compression", HUGIN_TIFF_COMPRESSION));
749 MY_SPIN_VAL("pref_jpeg_quality", cfg->Read("/output/jpeg_quality", HUGIN_JPEG_QUALITY));
751
752 // default blender
753 SelectListValue(XRCCTRL(*this, "pref_default_blender", wxChoice), cfg->Read("/default_blender", HUGIN_DEFAULT_BLENDER));
754 // default verdandi parameters
755 const wxString defaultVerdandiArgs = cfg->Read("/VerdandiDefaultArgs", wxEmptyString);
756 if (defaultVerdandiArgs.Find("--seam=blend") != wxNOT_FOUND)
757 {
758 XRCCTRL(*this, "pref_internal_blender_seam", wxChoice)->SetSelection(1);
759 }
760 else
761 {
762 XRCCTRL(*this, "pref_internal_blender_seam", wxChoice)->SetSelection(0);
763 };
765
768 MY_CHOICE_VAL("pref_processor_gui", cfg->Read("/Processor/gui", HUGIN_PROCESSOR_GUI));
769 t = cfg->Read("/Processor/start", HUGIN_PROCESSOR_START) == 1;
770 MY_BOOL_VAL("pref_processor_start", t);
771 t = cfg->Read("/Processor/overwrite", HUGIN_PROCESSOR_OVERWRITE) == 1;
772 MY_BOOL_VAL("pref_processor_overwrite", t);
773 t = cfg->Read("/Processor/verbose", HUGIN_PROCESSOR_VERBOSE) == 1;
774 MY_BOOL_VAL("pref_processor_verbose", t);
776 }
777
778 if (panel == 0 || panel == 7)
779 {
780 // stitching (2) panel
781 t = cfg->Read("/output/useExiftool", HUGIN_USE_EXIFTOOL) == 1;
782 MY_BOOL_VAL("pref_exiftool_metadata", t);
783 MY_STR_VAL("pref_exiftool_argfile", cfg->Read("/output/CopyArgfile", wxEmptyString));
784 MY_STR_VAL("pref_exiftool_argfile2", cfg->Read("/output/FinalArgfile", wxEmptyString));
785 t = cfg->Read("/output/writeGPano", HUGIN_EXIFTOOL_CREATE_GPANO) == 1;
786 MY_BOOL_VAL("pref_exiftool_gpano", t);
787 wxCommandEvent dummy;
789 // number of threads
790 int nThreads = cfg->Read("/output/NumberOfThreads", 0l);
791 MY_SPIN_VAL("prefs_output_NumberOfThreads", nThreads);
792 }
793
794 if (panel==0 || panel == 8)
795 {
796
799 MY_CHOICE_VAL("prefs_nona_interpolator", cfg->Read("/Nona/Interpolator", HUGIN_NONA_INTERPOLATOR));
800 t = cfg->Read("/Nona/CroppedImages", HUGIN_NONA_CROPPEDIMAGES) == 1;
801 MY_BOOL_VAL("prefs_nona_createCroppedImages", t);
802 t = cfg->Read("/Nona/UseGPU", HUGIN_NONA_USEGPU) == 1;
803 MY_BOOL_VAL("prefs_nona_useGpu", t);
804
807 MY_STR_VAL("prefs_enblend_EnblendExe", cfg->Read("/Enblend/Exe",
810 cfg->Read("/Enblend/Custom", &customEnblendExe);
811 MY_BOOL_VAL("prefs_enblend_Custom", customEnblendExe);
812 XRCCTRL(*this, "prefs_enblend_EnblendExe", wxTextCtrl)->Enable(customEnblendExe);
813 XRCCTRL(*this, "prefs_enblend_select", wxButton)->Enable(customEnblendExe);
814 MY_STR_VAL("prefs_enblend_EnblendArgs", cfg->Read("/Enblend/Args",
818 MY_STR_VAL("prefs_enblend_EnfuseExe", cfg->Read("/Enfuse/Exe",
821 cfg->Read("/Enfuse/Custom", &customEnfuseExe);
822 MY_BOOL_VAL("prefs_enblend_enfuseCustom", customEnfuseExe);
823 XRCCTRL(*this, "prefs_enblend_EnfuseExe", wxTextCtrl)->Enable(customEnfuseExe);
824 XRCCTRL(*this, "prefs_enblend_enfuse_select", wxButton)->Enable(customEnfuseExe);
825 MY_STR_VAL("prefs_enblend_EnfuseArgs", cfg->Read("/Enfuse/Args",
827 }
828
829 if (panel==0 || panel == 9)
830 {
831 // Celeste settings
833 cfg->Read("/Celeste/Threshold", &d, HUGIN_CELESTE_THRESHOLD);
835 MY_STR_VAL("prefs_celeste_threshold", tstr);
836 MY_CHOICE_VAL("prefs_celeste_filter", cfg->Read("/Celeste/Filter", HUGIN_CELESTE_FILTER));
837 // photometric optimizer settings
838 MY_SPIN_VAL("prefs_photo_optimizer_nr_points", cfg->Read("/OptimizePhotometric/nRandomPointsPerImage", HUGIN_PHOTOMETRIC_OPTIMIZER_NRPOINTS));
839 // warnings
840 t = cfg->Read("/ShowSaveMessage", 1l) == 1;
841 MY_BOOL_VAL("prefs_warning_save", t);
842 t = cfg->Read("/ShowExposureWarning", 1l) == 1;
843 MY_BOOL_VAL("prefs_warning_exposure", t);
844 t = cfg->Read("/ShowFisheyeCropHint", 1l) == 1;
845 MY_BOOL_VAL("prefs_warning_fisheye_crop", t);
846 MY_CHOICE_VAL("pref_editcp_action", cfg->Read("/EditCPAfterAction", 0l));
847 }
848}
849
851{
852 DEBUG_TRACE("");
853 wxConfigBase* cfg = wxConfigBase::Get();
854 // check which tab is enabled
855 wxNotebook* noteb = XRCCTRL(*this, "prefs_tab", wxNotebook);
856 if (hugin_utils::HuginMessageBox(_("Really reset displayed preferences to default values?"), _("Hugin"), wxYES_NO | wxICON_QUESTION, this) == wxYES)
857 {
858 if (noteb->GetSelection() == 0)
859 {
860 // MISC
861 // cache
862 /*
863 * special treatment for windows not necessary here since we know the value of
864 * HUGIN_IMGCACHE_UPPERBOUND must fit into 32bit to be compatible with 32bit systems.
865 * However, just as a reminder:
866 #ifdef __WXMSW__
867 cfg->Write("/ImageCache/UpperBoundHigh", HUGIN_IMGCACHE_UPPERBOUND >> 32);
868 #endif
869 */
870 cfg->Write("/ImageCache/UpperBound", HUGIN_IMGCACHE_UPPERBOUND);
871 // locale
872 cfg->Write("language", int(HUGIN_LANGUAGE));
873 // smart undo
874 cfg->Write("smartUndo", HUGIN_SMART_UNDO);
875 cfg->Write("CopyLogToClipboard", 0l);
876 // projection hints
877 cfg->Write("/GLPreviewFrame/ShowProjectionHints", HUGIN_SHOW_PROJECTION_HINTS);
878 cfg->Write("/CPEditorPanel/AutoRot", 1l);
879 // raw converter
880 cfg->Write("/RawImportDialog/dcrawExe", "");
881 cfg->Write("/RawImportDialog/RTExe", "");
882 cfg->Write("/RawImportDialog/DarktableExe", "");
883 }
884 if(noteb->GetSelection() == 1)
885 {
886 cfg->Write("tempDir", wxEmptyString);
887 cfg->Write("ProjectFilename", HUGIN_DEFAULT_PROJECT_NAME);
888 cfg->Write("OutputFilename", HUGIN_DEFAULT_OUTPUT_NAME);
889 };
890 if (noteb->GetSelection() == 2)
891 {
892 cfg->Write("/Assistant/autoAlign", HUGIN_ASS_AUTO_ALIGN);
893 cfg->Write("/General/IgnoreFovRectilinearOnAdd", 1l);
894 cfg->Write("/Assistant/nControlPoints", HUGIN_ASS_NCONTROLPOINTS);
895 cfg->Write("/Assistant/panoDownsizeFactor",HUGIN_ASS_PANO_DOWNSIZE_FACTOR);
896 cfg->Write("/Assistant/Linefind", HUGIN_ASS_LINEFIND);
897 cfg->Write("/Celeste/Auto", HUGIN_CELESTE_AUTO);
898 cfg->Write("/Assistant/AutoCPClean", HUGIN_ASS_AUTO_CPCLEAN);
899 cfg->Write("/Assistant/UserDefinedOutputOption", 0l);
900 }
901 if (noteb->GetSelection() == 3)
902 {
903 // hdr
904 cfg->Write("/ImageCache/Mapping", HUGIN_IMGCACHE_MAPPING_FLOAT);
905 //cfg->Write("/ImageCache/Range", HUGIN_IMGCACHE_RANGE);
906 cfg->Write("/CPEditorPanel/MagnifierWidth", 61l);
907 // Fine tune settings
908 cfg->Write("/Finetune/SearchAreaPercent", HUGIN_FT_SEARCH_AREA_PERCENT);
909 cfg->Write("/Finetune/TemplateSize", HUGIN_FT_TEMPLATE_SIZE);
910 cfg->Write("/Finetune/LocalSearchWidth", HUGIN_FT_LOCAL_SEARCH_WIDTH);
911
912 cfg->Write("/Finetune/CorrThreshold", HUGIN_FT_CORR_THRESHOLD);
913 cfg->Write("/Finetune/CurvThreshold", HUGIN_FT_CURV_THRESHOLD);
914
915 cfg->Write("/Finetune/RotationSearch", HUGIN_FT_ROTATION_SEARCH);
916 cfg->Write("/Finetune/RotationStartAngle", HUGIN_FT_ROTATION_START_ANGLE);
917 cfg->Write("/Finetune/RotationStopAngle", HUGIN_FT_ROTATION_STOP_ANGLE);
918 cfg->Write("/Finetune/RotationSteps", HUGIN_FT_ROTATION_STEPS);
919 }
920 if (noteb->GetSelection() == 4)
921 {
926 }
927 if (noteb->GetSelection() == 5)
928 {
930 cfg->Write("/output/ldr_format", HUGIN_LDR_OUTPUT_FORMAT);
932 // cfg->Write("/output/hdr_format", HUGIN_HDR_OUTPUT_FORMAT);
933 cfg->Write("/output/tiff_compression", HUGIN_TIFF_COMPRESSION);
934 cfg->Write("/output/jpeg_quality", HUGIN_JPEG_QUALITY);
935 // default blender
936 cfg->Write("/default_blender", static_cast<long>(HUGIN_DEFAULT_BLENDER));
937 cfg->Write("/VerdandiDefaultArgs", wxEmptyString);
938 // stitching engine
939 cfg->Write("/Processor/gui", HUGIN_PROCESSOR_GUI);
940 cfg->Write("/Processor/start", HUGIN_PROCESSOR_START);
941 cfg->Write("/Processor/overwrite", HUGIN_PROCESSOR_OVERWRITE);
942 cfg->Write("/Processor/verbose", HUGIN_PROCESSOR_VERBOSE);
943 }
944 if (noteb->GetSelection() == 6)
945 {
946 cfg->Write("/output/useExiftool", HUGIN_USE_EXIFTOOL);
947 cfg->Write("/output/CopyArgfile", wxEmptyString);
948 cfg->Write("/output/FinalArgfile", wxEmptyString);
949 cfg->Write("/output/writeGPano", HUGIN_EXIFTOOL_CREATE_GPANO);
950 cfg->Write("/output/NumberOfThreads", 0l);
951 }
952 if (noteb->GetSelection() == 7)
953 {
955 cfg->Write("/Enblend/Exe", HUGIN_ENBLEND_EXE);
956 cfg->Write("/Enblend/Custom", HUGIN_ENBLEND_EXE_CUSTOM);
957 cfg->Write("/Enblend/Args", HUGIN_ENBLEND_ARGS);
958
959 cfg->Write("/Enfuse/Exe", HUGIN_ENFUSE_EXE);
960 cfg->Write("/Enfuse/Custom", HUGIN_ENFUSE_EXE_CUSTOM);
961 cfg->Write("/Enfuse/Args", HUGIN_ENFUSE_ARGS);
962 }
963
964 if (noteb->GetSelection() == 8)
965 {
967 cfg->Write("/Celeste/Threshold", HUGIN_CELESTE_THRESHOLD);
968 cfg->Write("/Celeste/Filter", HUGIN_CELESTE_FILTER);
969 cfg->Write("/OptimizePhotometric/nRandomPointsPerImage", HUGIN_PHOTOMETRIC_OPTIMIZER_NRPOINTS);
970 cfg->Write("/ShowSaveMessage", 1l);
971 cfg->Write("/ShowExposureWarning", 1l);
972 cfg->Write("/ShowFisheyeCropHint", 1l);
973 cfg->Write("/EditCPAfterAction", 0l);
974 }
975
976 /*
977 if (noteb->GetSelection() == 5) {
978 cfg->Write("/PTmender/Exe", HUGIN_PT_MENDER_EXE );
979 cfg->Write("/PTmender/Custom",HUGIN_PT_MENDER_EXE_CUSTOM);
980 cfg->Write("/PanoTools/ScriptFile", "PT_script.txt");
981 }
982 */
983 UpdateDisplayData(noteb->GetSelection() + 1);
984 }
985}
986
988{
989 DEBUG_TRACE("");
990 wxConfigBase* cfg = wxConfigBase::Get();
991 // Assistant
992 cfg->Write("/Assistant/autoAlign",MY_G_BOOL_VAL("prefs_ass_autoAlign"));
993 cfg->Write("/General/IgnoreFovRectilinearOnAdd", !MY_G_BOOL_VAL("prefs_ass_loadFovRectilinear"));
994 cfg->Write("/Assistant/nControlPoints", MY_G_SPIN_VAL("prefs_ass_nControlPoints"));
995 cfg->Write("/Assistant/panoDownsizeFactor", MY_G_SPIN_VAL("prefs_ass_panoDownsizeFactor") / 100.0);
996 cfg->Write("/Assistant/Linefind", MY_G_BOOL_VAL("prefs_ass_linefind"));
997 cfg->Write("/Celeste/Auto", MY_G_BOOL_VAL("prefs_celeste_auto"));
998 cfg->Write("/Assistant/AutoCPClean", MY_G_BOOL_VAL("prefs_auto_cpclean"));
999 cfg->Write("/Assistant/UserDefinedOutputOption", MY_G_BOOL_VAL("pref_ass_output"));
1000
1001 // hdr display
1002 cfg->Write("/ImageCache/Mapping",MY_G_CHOICE_VAL("prefs_misc_hdr_mapping"));
1003 //cfg->Write("/ImageCache/Range",MY_G_CHOICE_VAL("prefs_misc_hdr_range"));
1004 cfg->Write("/CPEditorPanel/MagnifierWidth", MY_G_CHOICE_VAL("prefs_misc_magnifier_width") * 20 + 61l);
1005
1006 // Fine tune settings
1007 cfg->Write("/Finetune/SearchAreaPercent", MY_G_SPIN_VAL("prefs_ft_SearchAreaPercent"));
1008 cfg->Write("/Finetune/TemplateSize", MY_G_SPIN_VAL("prefs_ft_TemplateSize"));
1009 cfg->Write("/Finetune/LocalSearchWidth", MY_G_SPIN_VAL("prefs_ft_LocalSearchWidth"));
1010 wxString t = MY_G_STR_VAL("prefs_ft_CorrThreshold");
1012 hugin_utils::stringToDouble(std::string(t.mb_str(wxConvLocal)), td);
1013 cfg->Write("/Finetune/CorrThreshold", td);
1014
1015 t = MY_G_STR_VAL("prefs_ft_CurvThreshold");
1017 hugin_utils::stringToDouble(std::string(t.mb_str(wxConvLocal)), td);
1018 cfg->Write("/Finetune/CurvThreshold", td);
1019
1020 cfg->Write("/Finetune/RotationSearch", MY_G_BOOL_VAL("prefs_ft_RotationSearch"));
1021 cfg->Write("/Finetune/RotationStartAngle", (double) MY_G_SPIN_VAL("prefs_ft_RotationStartAngle"));
1022 cfg->Write("/Finetune/RotationStopAngle", (double) MY_G_SPIN_VAL("prefs_ft_RotationStopAngle"));
1023 cfg->Write("/Finetune/RotationSteps", MY_G_SPIN_VAL("prefs_ft_RotationSteps"));
1024
1027 // cache
1028#ifdef __WXMSW__
1029 // shifting only 12 bits rights: 32-20=12 and the prefs_cache_UpperBound is in GB
1030 cfg->Write("/ImageCache/UpperBoundHigh", (long) MY_G_SPIN_VAL("prefs_cache_UpperBound") >> 12);
1031#endif
1032 cfg->Write("/ImageCache/UpperBound", (long) MY_G_SPIN_VAL("prefs_cache_UpperBound") << 20);
1033 // locale
1034 // language
1035 wxChoice* lang = XRCCTRL(*this, "prefs_gui_language", wxChoice);
1036 // DEBUG_TRACE("Language Selection Name: " << huginApp::Get()->GetLocale().GetLanguageName((int) lang->GetClientData(lang->GetSelection())).mb_str(wxConvLocal));
1037 //DEBUG_INFO("Language Selection locale: " << ((huginApp::Get()->GetLocale().GetLanguageInfo((int) lang->GetClientData(lang->GetSelection())))->CanonicalName).mb_str(wxConvLocal));
1038 //DEBUG_INFO("Current System Language ID: " << huginApp::Get()->GetLocale().GetSystemLanguage());
1039
1040 void* tmplp = lang->GetClientData(lang->GetSelection());
1041 long templ = * static_cast<long*>(tmplp);
1042 cfg->Write("language", templ);
1043 DEBUG_INFO("Language Selection ID: " << templ);
1044 // smart undo
1045 cfg->Write("smartUndo", MY_G_BOOL_VAL("prefs_smart_undo"));
1046 cfg->Write("CopyLogToClipboard", MY_G_BOOL_VAL("prefs_copy_log"));
1047 // show projections hints
1048 cfg->Write("/GLPreviewFrame/ShowProjectionHints", MY_G_BOOL_VAL("pref_show_projection_hints"));
1049 //auto-rotate
1050 cfg->Write("/CPEditorPanel/AutoRot", MY_G_BOOL_VAL("pref_autorotate"));
1051 // raw converter
1052 cfg->Write("/RawImportDialog/dcrawExe", MY_G_STR_VAL("pref_raw_dcraw_exe"));
1053 cfg->Write("/RawImportDialog/RTExe", MY_G_STR_VAL("pref_raw_rt_exe"));
1054 cfg->Write("/RawImportDialog/DarktableExe", MY_G_STR_VAL("pref_raw_darktable_exe"));;
1055 // tempdir
1056 cfg->Write("tempDir",MY_G_STR_VAL("prefs_misc_tempdir"));
1057 // filename templates
1058 wxString filename=XRCCTRL(*this, "prefs_project_filename", wxTextCtrl)->GetValue();
1059#ifdef __WXMSW__
1060 filename.Replace("\\", "/", true);
1061#endif
1062 cfg->Write("ProjectFilename", filename);
1063 filename=XRCCTRL(*this, "prefs_output_filename", wxTextCtrl)->GetValue();
1064#ifdef __WXMSW__
1065 filename.Replace("\\", "/", true);
1066#endif
1067 cfg->Write("OutputFilename", filename);
1071
1074 cfg->Write("/output/ldr_format", MY_G_CHOICE_VAL("pref_ldr_output_file_format"));
1076 // cfg->Write("/output/hdr_format", MY_G_CHOICE_VAL("pref_hdr_output_file_format"));
1077 cfg->Write("/output/tiff_compression", MY_G_CHOICE_VAL("pref_tiff_compression"));
1078 cfg->Write("/output/jpeg_quality", MY_G_SPIN_VAL("pref_jpeg_quality"));
1079
1080 cfg->Write("/default_blender", static_cast<long>(GetSelectedValue(XRCCTRL(*this, "pref_default_blender", wxChoice))));
1081 if (XRCCTRL(*this, "pref_internal_blender_seam", wxChoice)->GetSelection() == 1)
1082 {
1083 cfg->Write("/VerdandiDefaultArgs", "--seam=blend");
1084 }
1085 else
1086 {
1087 cfg->Write("/VerdandiDefaultArgs", wxEmptyString);
1088 };
1089
1092 cfg->Write("/Processor/gui", MY_G_CHOICE_VAL("pref_processor_gui"));
1093 cfg->Write("/Processor/start", MY_G_BOOL_VAL("pref_processor_start"));
1094 cfg->Write("/Processor/overwrite", MY_G_BOOL_VAL("pref_processor_overwrite"));
1095 cfg->Write("/Processor/verbose", MY_G_BOOL_VAL("pref_processor_verbose"));
1096
1097 cfg->Write("/output/useExiftool", MY_G_BOOL_VAL("pref_exiftool_metadata"));
1098 cfg->Write("/output/CopyArgfile", MY_G_STR_VAL("pref_exiftool_argfile"));
1099 cfg->Write("/output/FinalArgfile", MY_G_STR_VAL("pref_exiftool_argfile2"));
1100 cfg->Write("/output/writeGPano", MY_G_BOOL_VAL("pref_exiftool_gpano"));
1101 cfg->Write("/output/NumberOfThreads", MY_G_SPIN_VAL("prefs_output_NumberOfThreads"));
1104 cfg->Write("/Nona/Interpolator", MY_G_CHOICE_VAL("prefs_nona_interpolator"));
1105 cfg->Write("/Nona/CroppedImages", MY_G_BOOL_VAL("prefs_nona_createCroppedImages"));
1106 cfg->Write("/Nona/UseGPU", MY_G_BOOL_VAL("prefs_nona_useGpu"));
1107
1110 cfg->Write("/Enblend/Custom", MY_G_BOOL_VAL("prefs_enblend_Custom"));
1111 cfg->Write("/Enblend/Exe", MY_G_STR_VAL("prefs_enblend_EnblendExe"));
1112 cfg->Write("/Enblend/Args", MY_G_STR_VAL("prefs_enblend_EnblendArgs"));
1113
1114 cfg->Write("/Enfuse/Custom", MY_G_BOOL_VAL("prefs_enblend_enfuseCustom"));
1115 cfg->Write("/Enfuse/Exe", MY_G_STR_VAL("prefs_enblend_EnfuseExe"));
1116 cfg->Write("/Enfuse/Args", MY_G_STR_VAL("prefs_enblend_EnfuseArgs"));
1117
1118 // Celeste
1119 t = MY_G_STR_VAL("prefs_celeste_threshold");
1121 hugin_utils::stringToDouble(std::string(t.mb_str(wxConvLocal)), td);
1122 cfg->Write("/Celeste/Threshold", td);
1123 cfg->Write("/Celeste/Filter", MY_G_CHOICE_VAL("prefs_celeste_filter"));
1124 //photometric optimizer
1125 cfg->Write("/OptimizePhotometric/nRandomPointsPerImage", MY_G_SPIN_VAL("prefs_photo_optimizer_nr_points"));
1126 cfg->Write("/ShowSaveMessage", MY_G_BOOL_VAL("prefs_warning_save"));
1127 cfg->Write("/ShowExposureWarning", MY_G_BOOL_VAL("prefs_warning_exposure"));
1128 cfg->Write("/ShowFisheyeCropHint", MY_G_BOOL_VAL("prefs_warning_fisheye_crop"));
1129 cfg->Write("/EditCPAfterAction", MY_G_CHOICE_VAL("pref_editcp_action"));
1130
1131 cfg->Flush();
1133}
1134
1146
1148{
1150 int selection=m_CPDetectorList->GetSelection();
1151 if (selection == wxNOT_FOUND)
1152 {
1153 hugin_utils::HuginMessageBox(_("Please select an entry first"), _("Hugin"), wxOK | wxICON_EXCLAMATION, this);
1154 }
1155 else
1156 {
1157 autopano_dlg.UpdateFields(&cpdetector_config_edit, selection);
1158 if(autopano_dlg.ShowModal()==wxOK)
1159 {
1160 autopano_dlg.UpdateSettings(&cpdetector_config_edit, selection);
1162 m_CPDetectorList->SetSelection(selection);
1163 };
1164 }
1165};
1166
1168{
1169 unsigned int selection=m_CPDetectorList->GetSelection();
1170 if(m_CPDetectorList->GetCount()==1)
1171 {
1172 hugin_utils::HuginMessageBox(_("You can't delete the last setting.\nAt least one setting is required."), _("Hugin"), wxOK | wxICON_EXCLAMATION, this);
1173 }
1174 else
1175 {
1176 if (hugin_utils::HuginMessageBox(wxString::Format(_("Do you really want to remove control point detector setting \"%s\"?"), cpdetector_config_edit.settings[selection].GetCPDetectorDesc()),
1177 _("Hugin"), wxYES_NO | wxICON_QUESTION, this) == wxYES)
1178 {
1180 {
1182 }
1183 cpdetector_config_edit.settings.RemoveAt(selection);
1185 if(selection>=m_CPDetectorList->GetCount())
1186 {
1187 selection=m_CPDetectorList->GetCount()-1;
1188 }
1189 m_CPDetectorList->SetSelection(selection);
1190 };
1191 };
1192};
1193
1195{
1196 unsigned int selection=m_CPDetectorList->GetSelection();
1197 if(selection>0)
1198 {
1199 cpdetector_config_edit.Swap(selection-1);
1201 m_CPDetectorList->SetSelection(selection-1);
1202 };
1203};
1204
1206{
1207 unsigned int selection=m_CPDetectorList->GetSelection();
1208 if(selection<m_CPDetectorList->GetCount()-1)
1209 {
1210 cpdetector_config_edit.Swap(selection);
1212 m_CPDetectorList->SetSelection(selection+1);
1213 };
1214};
1215
1217{
1218 unsigned int selection=m_CPDetectorList->GetSelection();
1220 {
1223 m_CPDetectorList->SetSelection(selection);
1224 };
1225};
1226
1228{
1229 wxFileDialog dlg(this,_("Load control point detector settings"),
1230 wxConfigBase::Get()->Read("/actualPath",wxEmptyString), wxEmptyString,
1231 _("Control point detector settings (*.setting)|*.setting"),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
1232 if (dlg.ShowModal() == wxID_OK)
1233 {
1234 wxConfig::Get()->Write("/actualPath", dlg.GetDirectory()); // remember for later
1235 wxString fn = dlg.GetPath();
1239 };
1240};
1241
1243{
1244 wxFileDialog dlg(this,_("Save control point detector settings"),
1245 wxConfigBase::Get()->Read("/actualPath",wxEmptyString), wxEmptyString,
1246 _("Control point detector settings (*.setting)|*.setting"),wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
1247 if (dlg.ShowModal() == wxID_OK)
1248 {
1249 wxConfig::Get()->Write("/actualPath", dlg.GetDirectory()); // remember for later
1250 wxString fn = dlg.GetPath();
1251#ifndef __WXMSW__
1252 //append extension if not given
1253 //not necessary on Windows, the wxFileDialog appends it automatic
1254 if(fn.Right(8)!=".setting")
1255 {
1256 fn.Append(".setting");
1257 };
1258#endif
1260 };
1261};
1262
1264{
1266};
1267
1269{
1270 int i=MY_G_CHOICE_VAL("pref_ldr_output_file_format");
1271 XRCCTRL(*this,"pref_tiff_compression_label",wxStaticText)->Show(i==0);
1272 XRCCTRL(*this,"pref_tiff_compression",wxChoice)->Show(i==0);
1273 XRCCTRL(*this,"pref_jpeg_quality_label",wxStaticText)->Show(i==1);
1274 XRCCTRL(*this,"pref_jpeg_quality",wxSpinCtrl)->Show(i==1);
1275 XRCCTRL(*this,"pref_tiff_compression",wxChoice)->GetParent()->Layout();
1276};
1277
1279{
1281};
1282
1284{
1285 int i=MY_G_CHOICE_VAL("pref_processor_gui");
1286 XRCCTRL(*this,"pref_processor_start",wxCheckBox)->Enable(i==0);
1287 XRCCTRL(*this,"pref_processor_verbose",wxCheckBox)->Enable(i==0);
1288 switch(i)
1289 {
1290 case 0:
1291 //PTBatcherGUI
1292 {
1293 wxConfigBase* config=wxConfigBase::Get();
1294 XRCCTRL(*this,"pref_processor_start",wxCheckBox)->SetValue(config->Read("/Processor/start", HUGIN_PROCESSOR_START) == 1);
1295 XRCCTRL(*this,"pref_processor_verbose",wxCheckBox)->SetValue(config->Read("/Processor/verbose", HUGIN_PROCESSOR_VERBOSE) == 1);
1296 }
1297 break;
1298 case 1:
1299 //Hugin_stitch_project
1300 XRCCTRL(*this,"pref_processor_start",wxCheckBox)->SetValue(true);
1301 XRCCTRL(*this,"pref_processor_verbose",wxCheckBox)->SetValue(true);
1302 break;
1303 };
1304};
1305
1307{
1309};
1310
1312{
1313 const int blender = MY_G_CHOICE_VAL("pref_default_blender");
1314 XRCCTRL(*this, "pref_internal_blender_seam_label", wxStaticText)->Show(blender == 1);
1315 wxChoice* seamChoice = XRCCTRL(*this, "pref_internal_blender_seam", wxChoice);
1316 seamChoice->Show(blender == 1);
1317 seamChoice->Enable(blender == 1);
1318};
1319
1321{
1322 XRCCTRL(*this, "prefs_project_filename_preview", wxStaticText)->SetLabel(
1323 getDefaultProjectName(MainFrame::Get()->getPanorama(), XRCCTRL(*this, "prefs_project_filename", wxTextCtrl)->GetValue())
1324 );
1325};
1326
1328{
1329 XRCCTRL(*this, "prefs_output_filename_preview", wxStaticText)->SetLabel(
1330 getDefaultOutputName(MainFrame::Get()->getProjectName(), MainFrame::Get()->getPanorama(), XRCCTRL(*this, "prefs_output_filename", wxTextCtrl)->GetValue())
1331 );
1332};
1333
1335{
1336 //enable/disable button related to user defined output options of assistant
1337 XRCCTRL(*this, "pref_ass_change_output", wxButton)->Enable(XRCCTRL(*this, "pref_ass_output", wxCheckBox)->IsChecked());
1338}
1339
1341{
1342 // show dialog to change user defined output options of assistant
1344 dlg.ShowModal();
1345}
declaration of CPDetectorDialog class, which are for storing and changing settings of different autop...
wxString GetDataPath()
return path to data directory, it depends on operating system
Definition of dialog for editing user-defined output ini file.
void FillBlenderList(wxControlWithItems *list)
Fills a wxControlWithItem with all possible blender options, the client data contains the associated ...
Definition LensTools.cpp:82
size_t GetSelectedValue(wxControlWithItems *list)
Returns the client value of the selected item from list.
void SelectListValue(wxControlWithItems *list, size_t newValue)
Selects the given value (stored in the client data) in the given list item.
Definition LensTools.cpp:90
some helper classes for graphes
#define MY_CHOICE_VAL(id, val)
#define MY_G_CHOICE_VAL(id)
#define MY_G_SPIN_VAL(id)
#define MY_G_STR_VAL(id)
#define MY_STR_VAL(id, val)
#define MY_BOOL_VAL(id, val)
#define MY_G_BOOL_VAL(id)
#define MY_SPIN_VAL(id, val)
void CreateNewArgFile(const wxString &newFilename, const wxString &sourceFile)
unsigned int GetCount()
return counts of cp detector settings
void FillControl(wxControlWithItems *control, bool select_default=false, bool show_default=false)
fills a wxControlWithItems with the available generators
unsigned int GetDefaultGenerator()
return index of default generator (this one is used for assistent)
void Read(wxConfigBase *config=wxConfigBase::Get(), wxString loadFromFile=wxEmptyString)
read the settings of different cp generators from config
void ReadFromFile(wxString filename)
import the cp detector settings from external file
void Write(wxConfigBase *config=wxConfigBase::Get())
writes the settings of different cp generators to config
ArraySettings settings
array which stores the different autopano settings
void SetDefaultGenerator(unsigned int new_default_generator)
sets new default generator, which is used by assistent
void WriteToFile(wxString filename)
exporth the cp detector settings to external file
void Swap(int index)
swaps setting which index and index+1
dialog for input settings of one autopano generator
class, which stores all settings of one cp detector
Dialog for editing user defined output settings (ini file)
static MainFrame * Get()
hack.. kind of a pseudo singleton...
void DisplayHelp(wxString section=wxEmptyString)
call help browser with given file
void OnExifArgfile2Edit(wxCommandEvent &e)
void OnUpdateOutputFilename(wxCommandEvent &e)
event handler to update preview for project filename
virtual ~PreferencesDialog()
dtor.
void OnExifTool(wxCommandEvent &e)
void OnBlenderChanged(wxCommandEvent &e)
event handler if blender was changed
void OnExifArgfileEdit(wxCommandEvent &e)
void OnHelp(wxCommandEvent &e)
void OnRotationCheckBox(wxCommandEvent &e)
void OnDcrawExe(wxCommandEvent &e)
void OnEnfuseExe(wxCommandEvent &e)
void OnChangeUserDefinedOutputOptions(wxCommandEvent &e)
void OnProcessorChanged(wxCommandEvent &e)
event handler if processor was changed
void OnFileFormatChanged(wxCommandEvent &e)
event handler if default file format was changed
void OnCPDetectorSave(wxCommandEvent &e)
event handler for saving cp detector settings
void EnableRotationCtrls(bool enable)
void OnCPDetectorEdit(wxCommandEvent &e)
PreferencesDialog(wxWindow *parent)
ctor.
void UpdateDisplayData(int panel)
Config to Window.
void OnCPDetectorAdd(wxCommandEvent &e)
void OnUpdateProjectFilename(wxCommandEvent &e)
event handler to update preview for project filename
void OnExifArgfile2Choose(wxCommandEvent &e)
void OnCustomEnblend(wxCommandEvent &e)
void OnEnblendExe(wxCommandEvent &e)
void OnCPDetectorMoveUp(wxCommandEvent &e)
void OnExifArgfileChoose(wxCommandEvent &e)
void OnCPDetectorLoad(wxCommandEvent &e)
event handler for loading cp detector settings
void OnCPDetectorMoveDown(wxCommandEvent &e)
void OnCPDetectorDefault(wxCommandEvent &e)
void OnRawTherapeeExe(wxCommandEvent &e)
void OnOk(wxCommandEvent &e)
CPDetectorConfig cpdetector_config_edit
void OnCPDetectorDelete(wxCommandEvent &e)
wxListBox * m_CPDetectorList
void OnRestoreDefaults(wxCommandEvent &e)
void UpdateConfigData()
Window to Config.
void OnUserDefinedOutputOptionsCheckBox(wxCommandEvent &e)
void OnCustomEnfuse(wxCommandEvent &e)
void OnDarktableExe(wxCommandEvent &e)
static huginApp * Get()
hack.. kind of a pseudo singleton...
Definition huginApp.cpp:651
#define HUGIN_FT_TEMPLATE_SIZE
#define HUGIN_FT_ROTATION_START_ANGLE
#define HUGIN_PROCESSOR_VERBOSE
#define HUGIN_USE_EXIFTOOL
#define HUGIN_PROCESSOR_GUI
#define HUGIN_DEFAULT_OUTPUT_NAME
#define HUGIN_JPEG_QUALITY
#define HUGIN_IMGCACHE_UPPERBOUND
#define HUGIN_ENBLEND_ARGS
#define HUGIN_FT_ROTATION_STEPS
#define HUGIN_PROCESSOR_START
#define HUGIN_EXIFTOOL_CREATE_GPANO
#define HUGIN_SMART_UNDO
#define HUGIN_NONA_USEGPU
#define HUGIN_NONA_CROPPEDIMAGES
#define HUGIN_FT_ROTATION_SEARCH
#define HUGIN_ENBLEND_EXE_CUSTOM
#define HUGIN_TIFF_COMPRESSION
#define HUGIN_DEFAULT_PROJECT_NAME
#define HUGIN_FT_CURV_THRESHOLD
#define HUGIN_FT_LOCAL_SEARCH_WIDTH
#define HUGIN_ENFUSE_ARGS
#define HUGIN_CELESTE_FILTER
#define HUGIN_DEFAULT_BLENDER
#define HUGIN_ENFUSE_EXE
#define HUGIN_ENBLEND_EXE
#define HUGIN_ASS_AUTO_ALIGN
#define HUGIN_ASS_LINEFIND
#define HUGIN_ASS_PANO_DOWNSIZE_FACTOR
#define HUGIN_ASS_AUTO_CPCLEAN
#define HUGIN_FT_ROTATION_STOP_ANGLE
#define HUGIN_NONA_INTERPOLATOR
#define HUGIN_ENFUSE_EXE_CUSTOM
#define HUGIN_PROCESSOR_OVERWRITE
#define HUGIN_LDR_OUTPUT_FORMAT
#define HUGIN_ASS_NCONTROLPOINTS
#define HUGIN_PHOTOMETRIC_OPTIMIZER_NRPOINTS
#define HUGIN_CELESTE_AUTO
#define HUGIN_CELESTE_THRESHOLD
#define HUGIN_SHOW_PROJECTION_HINTS
#define HUGIN_FT_SEARCH_AREA_PERCENT
#define HUGIN_LANGUAGE
#define HUGIN_IMGCACHE_MAPPING_FLOAT
#define HUGIN_FT_CORR_THRESHOLD
wxString getDefaultOutputName(const wxString projectname, const HuginBase::Panorama &pano, const wxString filenameTemplate)
gets the default output prefix, based on filename and images in project the setting is read from the ...
wxString getDefaultProjectName(const HuginBase::Panorama &pano, const wxString filenameTemplate)
gets the default project name, as defined in the preferences
functions for interaction with the hugin configuration file
#define DEBUG_DEBUG(msg)
Definition utils.h:68
#define DEBUG_TRACE(msg)
Definition utils.h:67
#define DEBUG_WARN(msg)
Definition utils.h:74
#define DEBUG_INFO(msg)
Definition utils.h:69
wxString doubleTowxString(double d, int digits)
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
Definition wxutils.cpp:176
int floori(double x)
Definition hugin_math.h:65
int roundi(T x)
Definition hugin_math.h:73
bool stringToDouble(const STR &str_, double &dest)
convert a string to a double, ignore localisation.
Definition utils.h:114
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
Definition wxutils.cpp:106
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
Definition wxutils.cpp:67
include file for the hugin project
include file for the hugin project
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41
platform/compiler specific stuff.