27 #include "hugin_config.h"
29 #include "wx/listbook.h"
30 #include <wx/stdpaths.h>
48 #define MY_STR_VAL(id, val) { XRCCTRL(*this, id, wxTextCtrl)->SetValue(val); };
49 #define MY_SPIN_VAL(id, val) { XRCCTRL(*this, id, wxSpinCtrl)->SetValue(val); };
50 #define MY_BOOL_VAL(id, val) { XRCCTRL(*this, id, wxCheckBox)->SetValue(val); };
51 #define MY_CHOICE_VAL(id, val) { XRCCTRL(*this, id, wxChoice)->SetSelection(val); };
52 #define MY_STATIC_VAL(id, val) { XRCCTRL(*this, id, wxStaticText)->SetLabel(val); };
54 #define MY_G_STR_VAL(id) XRCCTRL(*this, id, wxTextCtrl)->GetValue()
55 #define MY_G_SPIN_VAL(id) XRCCTRL(*this, id, wxSpinCtrl)->GetValue()
56 #define MY_G_BOOL_VAL(id) XRCCTRL(*this, id, wxCheckBox)->GetValue()
57 #define MY_G_CHOICE_VAL(id) XRCCTRL(*this, id, wxChoice)->GetSelection()
65 wxXmlResource::Get()->LoadDialog(
this, parent, wxT(
"pref_dialog"));
68 XRCCTRL(*
this,
"prefs_ft_RotationStartAngle", wxSpinCtrl)->SetRange(-180,0);
69 XRCCTRL(*
this,
"prefs_ft_RotationStopAngle", wxSpinCtrl)->SetRange(0,180);
70 XRCCTRL(*
this,
"prefs_ass_nControlPoints", wxSpinCtrl)->SetRange(3,3000);
72 wxChoice* lang_choice = XRCCTRL(*
this,
"prefs_gui_language", wxChoice);
75 *lp = wxLANGUAGE_DEFAULT;
76 lang_choice->Append(_(
"System default"), lp);
78 *lp = wxLANGUAGE_BASQUE;
79 lang_choice->Append(_(
"Basque"), lp);
86 *lp = wxLANGUAGE_CATALAN;
87 lang_choice->Append(_(
"Catalan"), lp);
89 *lp = wxLANGUAGE_CHINESE_SIMPLIFIED;
90 lang_choice->Append(_(
"Chinese (Simplified)"), lp);
92 *lp = wxLANGUAGE_CHINESE_TRADITIONAL;
93 lang_choice->Append(_(
"Chinese (Traditional)"), lp);
95 *lp = wxLANGUAGE_CZECH;
96 lang_choice->Append(_(
"Czech"), lp);
98 *lp = wxLANGUAGE_DANISH;
99 lang_choice->Append(_(
"Danish"), lp);
101 *lp = wxLANGUAGE_DUTCH;
102 lang_choice->Append(_(
"Dutch"), lp);
104 *lp = wxLANGUAGE_ENGLISH;
105 lang_choice->Append(_(
"English"), lp);
107 *lp = wxLANGUAGE_FRENCH;
108 lang_choice->Append(_(
"French"), lp);
110 *lp = wxLANGUAGE_GERMAN;
111 lang_choice->Append(_(
"German"), lp);
113 *lp = wxLANGUAGE_HUNGARIAN;
114 lang_choice->Append(_(
"Hungarian"), lp);
116 *lp = wxLANGUAGE_ITALIAN;
117 lang_choice->Append(_(
"Italian"), lp);
119 *lp = wxLANGUAGE_JAPANESE;
120 lang_choice->Append(_(
"Japanese"), lp);
127 *lp = wxLANGUAGE_POLISH;
128 lang_choice->Append(_(
"Polish"), lp);
130 *lp = wxLANGUAGE_PORTUGUESE_BRAZILIAN;
131 lang_choice->Append(_(
"Portuguese (Brazilian)"), lp);
133 *lp = wxLANGUAGE_RUSSIAN;
134 lang_choice->Append(_(
"Russian"), lp);
136 *lp = wxLANGUAGE_SLOVAK;
137 lang_choice->Append(_(
"Slovak"), lp);
144 *lp = wxLANGUAGE_SPANISH;
145 lang_choice->Append(_(
"Spanish"), lp);
147 *lp = wxLANGUAGE_SWEDISH;
148 lang_choice->Append(_(
"Swedish"), lp);
155 *lp = wxLANGUAGE_FINNISH;
156 lang_choice->Append(_(
"Finnish"), lp);
158 *lp = wxLANGUAGE_VALENCIAN;
159 lang_choice->Append(_(
"Valencian (Southern Catalan)"), lp);
160 lang_choice->SetSelection(0);
163 XRCCTRL(*
this,
"pref_raw_dcraw_exe", wxTextCtrl)->AutoCompleteFileNames();
164 XRCCTRL(*
this,
"pref_raw_rt_exe", wxTextCtrl)->AutoCompleteFileNames();
165 XRCCTRL(*
this,
"pref_raw_darktable_exe", wxTextCtrl)->AutoCompleteFileNames();
170 wxStaticText* preview=XRCCTRL(*
this,
"prefs_project_filename_preview", wxStaticText);
171 preview->SetWindowStyle(preview->GetWindowStyle() | wxST_ELLIPSIZE_START);
172 preview=XRCCTRL(*
this,
"prefs_output_filename_preview", wxStaticText);
173 preview->SetWindowStyle(preview->GetWindowStyle() | wxST_ELLIPSIZE_START);
175 XRCCTRL(*
this,
"prefs_misc_tempdir", wxTextCtrl)->AutoCompleteDirectories();
176 XRCCTRL(*
this,
"pref_exiftool_argfile", wxTextCtrl)->AutoCompleteFileNames();
177 XRCCTRL(*
this,
"pref_exiftool_argfile2", wxTextCtrl)->AutoCompleteFileNames();
178 XRCCTRL(*
this,
"prefs_enblend_EnblendExe", wxTextCtrl)->AutoCompleteFileNames();
179 XRCCTRL(*
this,
"prefs_enblend_EnfuseExe", wxTextCtrl)->AutoCompleteFileNames();
181 wxConfigBase* cfg = wxConfigBase::Get();
187 #if defined __APPLE__ && defined __aarch64__
190 wxCheckBox* gpuCheckBox = XRCCTRL(*
this,
"prefs_nona_useGpu", wxCheckBox);
191 gpuCheckBox->Disable();
192 gpuCheckBox->SetValue(
false);
193 cfg->Write(
"/Nona/UseGPU",
false);
202 GetSizer()->SetSizeHints(
this);
234 #if defined __WXMSW__ || defined MAC_SELF_CONTAINED_BUNDLE
238 XRCCTRL(*
this,
"prefs_enblend_Custom", wxCheckBox)->Hide();
242 XRCCTRL(*
this,
"prefs_enblend_enfuseCustom", wxCheckBox)->Hide();
261 wxChoice* lang_choice = XRCCTRL(*
this,
"prefs_gui_language", wxChoice);
262 for (
int i = 0; i < (int) lang_choice->GetCount(); i++)
264 delete static_cast<long*
>(lang_choice->GetClientData(i));
273 this->EndModal(wxOK);
288 wxFileDialog dlg(
this,_(
"Select Enblend"),
291 _(
"Executables (*.exe)|*.exe"),
295 wxFD_OPEN, wxDefaultPosition);
296 if (dlg.ShowModal() == wxID_OK)
298 XRCCTRL(*
this,
"prefs_enblend_EnblendExe", wxTextCtrl)->SetValue(
305 wxFileDialog dlg(
this,_(
"Select Enfuse"),
308 _(
"Executables (*.exe)|*.exe"),
312 wxFD_OPEN, wxDefaultPosition);
313 if (dlg.ShowModal() == wxID_OK)
315 XRCCTRL(*
this,
"prefs_enblend_EnfuseExe", wxTextCtrl)->SetValue(
322 wxTextCtrl* ctrl = XRCCTRL(*
this,
"pref_raw_dcraw_exe", wxTextCtrl);
323 wxFileDialog dlg(
this, _(
"Select dcraw"),
"", ctrl->GetValue(),
325 _(
"Executables (*.exe)|*.exe"),
329 wxFD_OPEN, wxDefaultPosition);
330 if (dlg.ShowModal() == wxID_OK)
332 ctrl->SetValue(dlg.GetPath());
338 wxTextCtrl* ctrl = XRCCTRL(*
this,
"pref_raw_rt_exe", wxTextCtrl);
339 wxFileDialog dlg(
this, _(
"Select RawTherapee-cli"),
"", ctrl->GetValue(),
341 _(
"Executables (*.exe)|*.exe"),
345 wxFD_OPEN, wxDefaultPosition);
346 if (dlg.ShowModal() == wxID_OK)
348 ctrl->SetValue(dlg.GetPath());
354 wxTextCtrl* ctrl = XRCCTRL(*
this,
"pref_raw_darktable_exe", wxTextCtrl);
355 wxFileDialog dlg(
this, _(
"Select Darktable-cli"),
"", ctrl->GetValue(),
357 _(
"Executables (*.exe)|*.exe"),
361 wxFD_OPEN, wxDefaultPosition);
362 if (dlg.ShowModal() == wxID_OK)
364 ctrl->SetValue(dlg.GetPath());
371 XRCCTRL(*
this,
"prefs_enblend_EnblendExe", wxTextCtrl)->Enable(e.IsChecked());
372 XRCCTRL(*
this,
"prefs_enblend_select", wxButton)->Enable(e.IsChecked());
377 XRCCTRL(*
this,
"prefs_enblend_EnfuseExe", wxTextCtrl)->Enable(e.IsChecked());
378 XRCCTRL(*
this,
"prefs_enblend_enfuse_select", wxButton)->Enable(e.IsChecked());
383 wxFileDialog dlg(
this,_(
"Select ExifTool argfile"),
384 wxT(
""), XRCCTRL(*
this,
"pref_exiftool_argfile", wxTextCtrl)->GetValue(),
385 _(
"ExifTool Argfiles (*.arg)|*.arg|All Files(*)|*"),
386 wxFD_OPEN, wxDefaultPosition);
387 if (dlg.ShowModal() == wxID_OK)
389 XRCCTRL(*
this,
"pref_exiftool_argfile", wxTextCtrl)->SetValue(
396 wxTextFile defaultFile(sourceFile);
398 wxTextFile newFile(newFilename);
400 if (defaultFile.IsOpened())
402 for (
size_t i = 0; i < defaultFile.GetLineCount(); ++i)
404 newFile.AddLine(defaultFile[i]);
414 wxString filename=XRCCTRL(*
this,
"pref_exiftool_argfile", wxTextCtrl)->GetValue();
415 if(!filename.empty())
417 wxFileName file(filename);
418 file.Normalize(wxPATH_NORM_ABSOLUTE | wxPATH_NORM_DOTS | wxPATH_NORM_TILDE | wxPATH_NORM_SHORTCUT);
421 if( wxMessageBox(wxString::Format(_(
"File %s does not exist.\nShould the argfile be created with default tags?"),filename.c_str()),
422 _(
"Exiftool argfile"), wxYES_NO | wxICON_EXCLAMATION,
this)!=wxYES)
426 filename = file.GetFullPath();
431 filename = file.GetFullPath();
436 if( wxMessageBox(_(
"No file selected.\nShould an argfile be created with default tags?"),
437 _(
"Exiftool argfile"), wxYES_NO | wxICON_EXCLAMATION,
this)!=wxYES)
441 wxFileDialog dlg(
this,_(
"Select new ExifTool argfile"),
442 wxStandardPaths::Get().GetUserConfigDir(), wxT(
""),
443 _(
"ExifTool Argfiles (*.arg)|*.arg|All Files(*)|*"),
444 wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition);
445 if (dlg.ShowModal() != wxID_OK)
449 filename=dlg.GetPath();
452 XRCCTRL(*
this,
"pref_exiftool_argfile", wxTextCtrl)->SetValue(filename);
454 wxXmlResource::Get()->LoadDialog(&edit_dlg,
this, wxT(
"pref_edit_argfile"));
456 wxTextCtrl* argfileControl=XRCCTRL(edit_dlg,
"pref_edit_textcontrol", wxTextCtrl);
457 argfileControl->LoadFile(filename);
458 if(edit_dlg.ShowModal() == wxID_OK)
460 if(!argfileControl->SaveFile(filename))
462 wxMessageBox(wxString::Format(_(
"Could not save file \"%s\"."), filename.c_str()),
463 _(
"Error"), wxOK | wxICON_ERROR);
471 wxFileDialog dlg(
this, _(
"Select ExifTool argfile"),
472 wxT(
""), XRCCTRL(*
this,
"pref_exiftool_argfile2", wxTextCtrl)->GetValue(),
473 _(
"ExifTool Argfiles (*.arg)|*.arg|All Files(*)|*"),
474 wxFD_OPEN, wxDefaultPosition);
475 if (dlg.ShowModal() == wxID_OK)
477 XRCCTRL(*
this,
"pref_exiftool_argfile2", wxTextCtrl)->SetValue(
484 wxString filename = XRCCTRL(*
this,
"pref_exiftool_argfile2", wxTextCtrl)->GetValue();
485 if (!filename.empty())
487 wxFileName file(filename);
488 file.Normalize(wxPATH_NORM_ABSOLUTE | wxPATH_NORM_DOTS | wxPATH_NORM_TILDE | wxPATH_NORM_SHORTCUT);
491 if (wxMessageBox(wxString::Format(_(
"File %s does not exist.\nShould an example argfile be created?"), filename.c_str()),
492 _(
"Exiftool argfile"), wxYES_NO | wxICON_EXCLAMATION,
this) != wxYES)
496 filename = file.GetFullPath();
501 filename = file.GetFullPath();
506 if (wxMessageBox(_(
"No file selected.\nShould an example argfile be created?"),
507 _(
"Exiftool argfile"), wxYES_NO | wxICON_EXCLAMATION,
this) != wxYES)
511 wxFileDialog dlg(
this, _(
"Select new ExifTool argfile"),
512 wxStandardPaths::Get().GetUserConfigDir(), wxT(
""),
513 _(
"ExifTool Argfiles (*.arg)|*.arg|All Files(*)|*"),
514 wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition);
515 if (dlg.ShowModal() != wxID_OK)
519 filename = dlg.GetPath();
522 XRCCTRL(*
this,
"pref_exiftool_argfile2", wxTextCtrl)->SetValue(filename);
524 wxXmlResource::Get()->LoadDialog(&edit_dlg,
this, wxT(
"pref_edit_argfile_placeholders"));
526 wxTextCtrl* argfileControl = XRCCTRL(edit_dlg,
"pref_edit_textcontrol", wxTextCtrl);
527 argfileControl->LoadFile(filename);
528 if (edit_dlg.ShowModal() == wxID_OK)
530 if (!argfileControl->SaveFile(filename))
532 wxMessageBox(wxString::Format(_(
"Could not save file \"%s\"."), filename.c_str()),
533 _(
"Error"), wxOK | wxICON_ERROR);
541 bool copyMetadata=XRCCTRL(*
this,
"pref_exiftool_metadata", wxCheckBox)->GetValue();
542 XRCCTRL(*
this,
"pref_exiftool_argfile_general_label", wxStaticText)->Enable(copyMetadata);
543 XRCCTRL(*
this,
"pref_exiftool_argfile_intermediate_label", wxStaticText)->Enable(copyMetadata);
544 XRCCTRL(*
this,
"pref_exiftool_argfile_label", wxStaticText)->Enable(copyMetadata);
545 XRCCTRL(*
this,
"pref_exiftool_argfile", wxTextCtrl)->Enable(copyMetadata);
546 XRCCTRL(*
this,
"pref_exiftool_argfile_choose", wxButton)->Enable(copyMetadata);
547 XRCCTRL(*
this,
"pref_exiftool_argfile_edit", wxButton)->Enable(copyMetadata);
548 XRCCTRL(*
this,
"pref_exiftool_argfile_final_label", wxStaticText)->Enable(copyMetadata);
549 XRCCTRL(*
this,
"pref_exiftool_argfile2_label", wxStaticText)->Enable(copyMetadata);
550 XRCCTRL(*
this,
"pref_exiftool_argfile2", wxTextCtrl)->Enable(copyMetadata);
551 XRCCTRL(*
this,
"pref_exiftool_argfile2_choose", wxButton)->Enable(copyMetadata);
552 XRCCTRL(*
this,
"pref_exiftool_argfile2_edit", wxButton)->Enable(copyMetadata);
553 XRCCTRL(*
this,
"pref_exiftool_gpano", wxCheckBox)->Enable(copyMetadata);
558 XRCCTRL(*
this,
"prefs_ft_rot_panel", wxPanel)->Enable(enable);
568 wxConfigBase* cfg = wxConfigBase::Get();
570 if (panel==0 || panel == 1)
576 unsigned long mem_high = cfg->Read(wxT(
"/ImageCache/UpperBoundHigh"), (
long) 0);
579 mem = ((
unsigned long long) mem_high << 32) + mem_low;
590 wxChoice* lang_choice = XRCCTRL(*
this,
"prefs_gui_language", wxChoice);
594 for (
int i = 0; i < (int)lang_choice->GetCount(); i++)
596 long lang = *
static_cast<long*
>(lang_choice->GetClientData(i));
605 DEBUG_DEBUG(
"wxChoice language updated:" << curlang);
607 lang_choice->SetSelection(idx);
620 t = cfg->Read(wxT(
"CopyLogToClipboard"), 0l) == 1;
626 t = cfg->Read(
"/CPEditorPanel/AutoRot", 1l) == 1;
630 MY_STR_VAL(
"pref_raw_dcraw_exe", cfg->Read(
"/RawImportDialog/dcrawExe",
""));
631 MY_STR_VAL(
"pref_raw_rt_exe", cfg->Read(
"/RawImportDialog/RTExe",
""));
632 MY_STR_VAL(
"pref_raw_darktable_exe", cfg->Read(
"/RawImportDialog/DarktableExe",
""));
636 if(panel==0 || panel==2)
639 MY_STR_VAL(
"prefs_misc_tempdir", cfg->Read(wxT(
"tempDir"),wxT(
"")));
643 filename.Replace(wxT(
"/"),wxT(
"\\"),
true);
645 MY_STR_VAL(
"prefs_project_filename", filename);
648 filename.Replace(wxT(
"/"),wxT(
"\\"),
true);
650 MY_STR_VAL(
"prefs_output_filename", filename);
653 if (panel==0 || panel == 3)
658 t = cfg->Read(wxT(
"/General/IgnoreFovRectilinearOnAdd"), 1l) == 1l;
663 cfg->Read(wxT(
"/Assistant/panoDownsizeFactor"), &factor);
664 MY_SPIN_VAL(
"prefs_ass_panoDownsizeFactor",(
int)(factor*100.0));
671 t = cfg->Read(wxT(
"/Assistant/UserDefinedOutputOption"), 0l) == 1;
673 wxCommandEvent dummy;
678 if (panel==0 || panel == 4)
684 int val = wxConfigBase::Get()->Read(wxT(
"/CPEditorPanel/MagnifierWidth"), 61l);
687 XRCCTRL(*
this,
"prefs_misc_magnifier_width", wxChoice)->SetSelection(val);
692 MY_SPIN_VAL(
"prefs_ft_SearchAreaPercent",cfg->Read(wxT(
"/Finetune/SearchAreaPercent"),
694 MY_SPIN_VAL(
"prefs_ft_LocalSearchWidth", cfg->Read(wxT(
"/Finetune/LocalSearchWidth"),
718 MY_SPIN_VAL(
"prefs_ft_RotationSteps", cfg->Read(wxT(
"/Finetune/RotationSteps"),
728 if (panel==0 || panel == 5)
733 if (panel == 0 || panel == 6)
747 const wxString defaultVerdandiArgs = cfg->Read(wxT(
"/VerdandiDefaultArgs"), wxEmptyString);
748 if (defaultVerdandiArgs.Find(wxT(
"--seam=blend")) != wxNOT_FOUND)
750 XRCCTRL(*
this,
"pref_internal_blender_seam", wxChoice)->SetSelection(1);
754 XRCCTRL(*
this,
"pref_internal_blender_seam", wxChoice)->SetSelection(0);
770 if (panel == 0 || panel == 7)
775 MY_STR_VAL(
"pref_exiftool_argfile", cfg->Read(wxT(
"/output/CopyArgfile"), wxT(
"")));
776 MY_STR_VAL(
"pref_exiftool_argfile2", cfg->Read(wxT(
"/output/FinalArgfile"), wxT(
"")));
779 wxCommandEvent dummy;
782 int nThreads = cfg->Read(wxT(
"/output/NumberOfThreads"), 0l);
783 MY_SPIN_VAL(
"prefs_output_NumberOfThreads", nThreads);
786 if (panel==0 || panel == 8)
799 MY_STR_VAL(
"prefs_enblend_EnblendExe", cfg->Read(wxT(
"/Enblend/Exe"),
802 cfg->Read(wxT(
"/Enblend/Custom"), &customEnblendExe);
803 MY_BOOL_VAL(
"prefs_enblend_Custom", customEnblendExe);
804 XRCCTRL(*
this,
"prefs_enblend_EnblendExe", wxTextCtrl)->Enable(customEnblendExe);
805 XRCCTRL(*
this,
"prefs_enblend_select", wxButton)->Enable(customEnblendExe);
806 MY_STR_VAL(
"prefs_enblend_EnblendArgs", cfg->Read(wxT(
"/Enblend/Args"),
810 MY_STR_VAL(
"prefs_enblend_EnfuseExe", cfg->Read(wxT(
"/Enfuse/Exe"),
813 cfg->Read(wxT(
"/Enfuse/Custom"), &customEnfuseExe);
814 MY_BOOL_VAL(
"prefs_enblend_enfuseCustom", customEnfuseExe);
815 XRCCTRL(*
this,
"prefs_enblend_EnfuseExe", wxTextCtrl)->Enable(customEnfuseExe);
816 XRCCTRL(*
this,
"prefs_enblend_enfuse_select", wxButton)->Enable(customEnfuseExe);
817 MY_STR_VAL(
"prefs_enblend_EnfuseArgs", cfg->Read(wxT(
"/Enfuse/Args"),
821 if (panel==0 || panel == 9)
832 t = cfg->Read(wxT(
"/ShowSaveMessage"), 1l) == 1;
834 t = cfg->Read(wxT(
"/ShowExposureWarning"), 1l) == 1;
836 t = cfg->Read(wxT(
"/ShowFisheyeCropHint"), 1l) == 1;
838 MY_CHOICE_VAL(
"pref_editcp_action", cfg->Read(wxT(
"/EditCPAfterAction"), 0l));
845 wxConfigBase* cfg = wxConfigBase::Get();
847 wxNotebook* noteb = XRCCTRL(*
this,
"prefs_tab", wxNotebook);
848 int really = wxMessageBox(_(
"Really reset displayed preferences to default values?"), _(
"Load Defaults"),
850 if ( really == wxYES)
852 if (noteb->GetSelection() == 0)
869 cfg->Write(wxT(
"CopyLogToClipboard"), 0l);
872 cfg->Write(
"/CPEditorPanel/AutoRot", 1l);
874 cfg->Write(
"/RawImportDialog/dcrawExe",
"");
875 cfg->Write(
"/RawImportDialog/RTExe",
"");
876 cfg->Write(
"/RawImportDialog/DarktableExe",
"");
878 if(noteb->GetSelection() == 1)
880 cfg->Write(wxT(
"tempDir"), wxT(
""));
884 if (noteb->GetSelection() == 2)
887 cfg->Write(wxT(
"/General/IgnoreFovRectilinearOnAdd"), 1l);
893 cfg->Write(wxT(
"/Assistant/UserDefinedOutputOption"), 0l);
895 if (noteb->GetSelection() == 3)
900 cfg->Write(wxT(
"/CPEditorPanel/MagnifierWidth"), 61l);
914 if (noteb->GetSelection() == 4)
921 if (noteb->GetSelection() == 5)
931 cfg->Write(wxT(
"/VerdandiDefaultArgs"), wxEmptyString);
938 if (noteb->GetSelection() == 6)
941 cfg->Write(wxT(
"/output/CopyArgfile"), wxT(
""));
942 cfg->Write(wxT(
"/output/FinalArgfile"), wxT(
""));
944 cfg->Write(wxT(
"/output/NumberOfThreads"), 0l);
946 if (noteb->GetSelection() == 7)
958 if (noteb->GetSelection() == 8)
964 cfg->Write(wxT(
"/ShowSaveMessage"), 1l);
965 cfg->Write(wxT(
"/ShowExposureWarning"), 1l);
966 cfg->Write(wxT(
"/ShowFisheyeCropHint"), 1l);
967 cfg->Write(wxT(
"/EditCPAfterAction"), 0l);
984 wxConfigBase* cfg = wxConfigBase::Get();
986 cfg->Write(wxT(
"/Assistant/autoAlign"),
MY_G_BOOL_VAL(
"prefs_ass_autoAlign"));
987 cfg->Write(wxT(
"/General/IgnoreFovRectilinearOnAdd"), !
MY_G_BOOL_VAL(
"prefs_ass_loadFovRectilinear"));
988 cfg->Write(wxT(
"/Assistant/nControlPoints"),
MY_G_SPIN_VAL(
"prefs_ass_nControlPoints"));
989 cfg->Write(wxT(
"/Assistant/panoDownsizeFactor"),
MY_G_SPIN_VAL(
"prefs_ass_panoDownsizeFactor") / 100.0);
990 cfg->Write(wxT(
"/Assistant/Linefind"),
MY_G_BOOL_VAL(
"prefs_ass_linefind"));
991 cfg->Write(wxT(
"/Celeste/Auto"),
MY_G_BOOL_VAL(
"prefs_celeste_auto"));
992 cfg->Write(wxT(
"/Assistant/AutoCPClean"),
MY_G_BOOL_VAL(
"prefs_auto_cpclean"));
993 cfg->Write(wxT(
"/Assistant/UserDefinedOutputOption"),
MY_G_BOOL_VAL(
"pref_ass_output"));
996 cfg->Write(wxT(
"/ImageCache/Mapping"),
MY_G_CHOICE_VAL(
"prefs_misc_hdr_mapping"));
998 cfg->Write(wxT(
"/CPEditorPanel/MagnifierWidth"),
MY_G_CHOICE_VAL(
"prefs_misc_magnifier_width") * 20 + 61l);
1001 cfg->Write(wxT(
"/Finetune/SearchAreaPercent"),
MY_G_SPIN_VAL(
"prefs_ft_SearchAreaPercent"));
1002 cfg->Write(wxT(
"/Finetune/TemplateSize"),
MY_G_SPIN_VAL(
"prefs_ft_TemplateSize"));
1003 cfg->Write(wxT(
"/Finetune/LocalSearchWidth"),
MY_G_SPIN_VAL(
"prefs_ft_LocalSearchWidth"));
1007 cfg->Write(wxT(
"/Finetune/CorrThreshold"), td);
1012 cfg->Write(wxT(
"/Finetune/CurvThreshold"), td);
1014 cfg->Write(wxT(
"/Finetune/RotationSearch"),
MY_G_BOOL_VAL(
"prefs_ft_RotationSearch"));
1015 cfg->Write(wxT(
"/Finetune/RotationStartAngle"), (
double)
MY_G_SPIN_VAL(
"prefs_ft_RotationStartAngle"));
1016 cfg->Write(wxT(
"/Finetune/RotationStopAngle"), (
double)
MY_G_SPIN_VAL(
"prefs_ft_RotationStopAngle"));
1017 cfg->Write(wxT(
"/Finetune/RotationSteps"),
MY_G_SPIN_VAL(
"prefs_ft_RotationSteps"));
1024 cfg->Write(wxT(
"/ImageCache/UpperBoundHigh"), (
long)
MY_G_SPIN_VAL(
"prefs_cache_UpperBound") >> 12);
1026 cfg->Write(wxT(
"/ImageCache/UpperBound"), (
long)
MY_G_SPIN_VAL(
"prefs_cache_UpperBound") << 20);
1029 wxChoice* lang = XRCCTRL(*
this,
"prefs_gui_language", wxChoice);
1034 void* tmplp = lang->GetClientData(lang->GetSelection());
1035 long templ = *
static_cast<long*
>(tmplp);
1036 cfg->Write(wxT(
"language"), templ);
1037 DEBUG_INFO(
"Language Selection ID: " << templ);
1039 cfg->Write(wxT(
"smartUndo"),
MY_G_BOOL_VAL(
"prefs_smart_undo"));
1040 cfg->Write(wxT(
"CopyLogToClipboard"),
MY_G_BOOL_VAL(
"prefs_copy_log"));
1042 cfg->Write(wxT(
"/GLPreviewFrame/ShowProjectionHints"),
MY_G_BOOL_VAL(
"pref_show_projection_hints"));
1044 cfg->Write(
"/CPEditorPanel/AutoRot",
MY_G_BOOL_VAL(
"pref_autorotate"));
1046 cfg->Write(
"/RawImportDialog/dcrawExe",
MY_G_STR_VAL(
"pref_raw_dcraw_exe"));
1047 cfg->Write(
"/RawImportDialog/RTExe",
MY_G_STR_VAL(
"pref_raw_rt_exe"));
1048 cfg->Write(
"/RawImportDialog/DarktableExe",
MY_G_STR_VAL(
"pref_raw_darktable_exe"));;
1050 cfg->Write(wxT(
"tempDir"),
MY_G_STR_VAL(
"prefs_misc_tempdir"));
1052 wxString filename=XRCCTRL(*
this,
"prefs_project_filename", wxTextCtrl)->GetValue();
1054 filename.Replace(wxT(
"\\"), wxT(
"/"),
true);
1056 cfg->Write(wxT(
"ProjectFilename"), filename);
1057 filename=XRCCTRL(*
this,
"prefs_output_filename", wxTextCtrl)->GetValue();
1059 filename.Replace(wxT(
"\\"), wxT(
"/"),
true);
1061 cfg->Write(wxT(
"OutputFilename"), filename);
1068 cfg->Write(wxT(
"/output/ldr_format"),
MY_G_CHOICE_VAL(
"pref_ldr_output_file_format"));
1071 cfg->Write(wxT(
"/output/tiff_compression"),
MY_G_CHOICE_VAL(
"pref_tiff_compression"));
1072 cfg->Write(wxT(
"/output/jpeg_quality"),
MY_G_SPIN_VAL(
"pref_jpeg_quality"));
1074 cfg->Write(wxT(
"/default_blender"), static_cast<long>(
GetSelectedValue(XRCCTRL(*
this,
"pref_default_blender", wxChoice))));
1075 if (XRCCTRL(*
this,
"pref_internal_blender_seam", wxChoice)->GetSelection() == 1)
1077 cfg->Write(wxT(
"/VerdandiDefaultArgs"), wxT(
"--seam=blend"));
1081 cfg->Write(wxT(
"/VerdandiDefaultArgs"), wxEmptyString);
1086 cfg->Write(wxT(
"/Processor/gui"),
MY_G_CHOICE_VAL(
"pref_processor_gui"));
1087 cfg->Write(wxT(
"/Processor/start"),
MY_G_BOOL_VAL(
"pref_processor_start"));
1088 cfg->Write(wxT(
"/Processor/overwrite"),
MY_G_BOOL_VAL(
"pref_processor_overwrite"));
1089 cfg->Write(wxT(
"/Processor/verbose"),
MY_G_BOOL_VAL(
"pref_processor_verbose"));
1091 cfg->Write(wxT(
"/output/useExiftool"),
MY_G_BOOL_VAL(
"pref_exiftool_metadata"));
1092 cfg->Write(wxT(
"/output/CopyArgfile"),
MY_G_STR_VAL(
"pref_exiftool_argfile"));
1093 cfg->Write(wxT(
"/output/FinalArgfile"),
MY_G_STR_VAL(
"pref_exiftool_argfile2"));
1094 cfg->Write(wxT(
"/output/writeGPano"),
MY_G_BOOL_VAL(
"pref_exiftool_gpano"));
1095 cfg->Write(wxT(
"/output/NumberOfThreads"),
MY_G_SPIN_VAL(
"prefs_output_NumberOfThreads"));
1098 cfg->Write(wxT(
"/Nona/Interpolator"),
MY_G_CHOICE_VAL(
"prefs_nona_interpolator"));
1099 cfg->Write(wxT(
"/Nona/CroppedImages"),
MY_G_BOOL_VAL(
"prefs_nona_createCroppedImages"));
1100 cfg->Write(wxT(
"/Nona/UseGPU"),
MY_G_BOOL_VAL(
"prefs_nona_useGpu"));
1104 cfg->Write(wxT(
"/Enblend/Custom"),
MY_G_BOOL_VAL(
"prefs_enblend_Custom"));
1105 cfg->Write(wxT(
"/Enblend/Exe"),
MY_G_STR_VAL(
"prefs_enblend_EnblendExe"));
1106 cfg->Write(wxT(
"/Enblend/Args"),
MY_G_STR_VAL(
"prefs_enblend_EnblendArgs"));
1108 cfg->Write(wxT(
"/Enfuse/Custom"),
MY_G_BOOL_VAL(
"prefs_enblend_enfuseCustom"));
1109 cfg->Write(wxT(
"/Enfuse/Exe"),
MY_G_STR_VAL(
"prefs_enblend_EnfuseExe"));
1110 cfg->Write(wxT(
"/Enfuse/Args"),
MY_G_STR_VAL(
"prefs_enblend_EnfuseArgs"));
1116 cfg->Write(wxT(
"/Celeste/Threshold"), td);
1117 cfg->Write(wxT(
"/Celeste/Filter"),
MY_G_CHOICE_VAL(
"prefs_celeste_filter"));
1119 cfg->Write(wxT(
"/OptimizePhotometric/nRandomPointsPerImage"),
MY_G_SPIN_VAL(
"prefs_photo_optimizer_nr_points"));
1120 cfg->Write(wxT(
"/ShowSaveMessage"),
MY_G_BOOL_VAL(
"prefs_warning_save"));
1121 cfg->Write(wxT(
"/ShowExposureWarning"),
MY_G_BOOL_VAL(
"prefs_warning_exposure"));
1122 cfg->Write(wxT(
"/ShowFisheyeCropHint"),
MY_G_BOOL_VAL(
"prefs_warning_fisheye_crop"));
1123 cfg->Write(wxT(
"/EditCPAfterAction"),
MY_G_CHOICE_VAL(
"pref_editcp_action"));
1132 if(cpdetector_dlg.ShowModal()==wxOK)
1145 if (selection == wxNOT_FOUND)
1147 wxMessageBox(_(
"Please select an entry first"),_(
"Select Entry"),wxOK |
1148 wxICON_EXCLAMATION,
this);
1153 if(autopano_dlg.ShowModal()==wxOK)
1167 wxMessageBox(_(
"You can't delete the last setting.\nAt least one setting is required."),_(
"Warning"),wxOK | wxICON_EXCLAMATION,
this);
1171 if(wxMessageBox(wxString::Format(_(
"Do you really want to remove control point detector setting \"%s\"?"),
cpdetector_config_edit.
settings[selection].GetCPDetectorDesc().c_str())
1172 ,_(
"Delete control point detector setting"),wxYES_NO | wxICON_QUESTION,
this)==wxYES)
1203 if(selection<m_CPDetectorList->GetCount()-1)
1224 wxFileDialog dlg(
this,_(
"Load control point detector settings"),
1225 wxConfigBase::Get()->Read(wxT(
"/actualPath"),wxT(
"")), wxEmptyString,
1226 _(
"Control point detector settings (*.setting)|*.setting"),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
1227 if (dlg.ShowModal() == wxID_OK)
1229 wxConfig::Get()->Write(wxT(
"/actualPath"), dlg.GetDirectory());
1230 wxString fn = dlg.GetPath();
1239 wxFileDialog dlg(
this,_(
"Save control point detector settings"),
1240 wxConfigBase::Get()->Read(wxT(
"/actualPath"),wxT(
"")), wxEmptyString,
1241 _(
"Control point detector settings (*.setting)|*.setting"),wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
1242 if (dlg.ShowModal() == wxID_OK)
1244 wxConfig::Get()->Write(wxT(
"/actualPath"), dlg.GetDirectory());
1245 wxString fn = dlg.GetPath();
1249 if(fn.Right(8)!=wxT(
".setting"))
1251 fn.Append(wxT(
".setting"));
1266 XRCCTRL(*
this,
"pref_tiff_compression_label",wxStaticText)->Show(i==0);
1267 XRCCTRL(*
this,
"pref_tiff_compression",wxChoice)->Show(i==0);
1268 XRCCTRL(*
this,
"pref_jpeg_quality_label",wxStaticText)->Show(i==1);
1269 XRCCTRL(*
this,
"pref_jpeg_quality",wxSpinCtrl)->Show(i==1);
1270 XRCCTRL(*
this,
"pref_tiff_compression",wxChoice)->GetParent()->Layout();
1281 XRCCTRL(*
this,
"pref_processor_start",wxCheckBox)->Enable(i==0);
1282 XRCCTRL(*
this,
"pref_processor_verbose",wxCheckBox)->Enable(i==0);
1288 wxConfigBase* config=wxConfigBase::Get();
1289 XRCCTRL(*
this,
"pref_processor_start",wxCheckBox)->SetValue(config->Read(wxT(
"/Processor/start"),
HUGIN_PROCESSOR_START) == 1);
1290 XRCCTRL(*
this,
"pref_processor_verbose",wxCheckBox)->SetValue(config->Read(wxT(
"/Processor/verbose"),
HUGIN_PROCESSOR_VERBOSE) == 1);
1295 XRCCTRL(*
this,
"pref_processor_start",wxCheckBox)->SetValue(
true);
1296 XRCCTRL(*
this,
"pref_processor_verbose",wxCheckBox)->SetValue(
true);
1309 XRCCTRL(*
this,
"pref_internal_blender_seam_label", wxStaticText)->Show(blender == 1);
1310 wxChoice* seamChoice = XRCCTRL(*
this,
"pref_internal_blender_seam", wxChoice);
1311 seamChoice->Show(blender == 1);
1312 seamChoice->Enable(blender == 1);
1317 XRCCTRL(*
this,
"prefs_project_filename_preview", wxStaticText)->SetLabel(
1324 XRCCTRL(*
this,
"prefs_output_filename_preview", wxStaticText)->SetLabel(
1332 XRCCTRL(*
this,
"pref_ass_change_output", wxButton)->Enable(XRCCTRL(*
this,
"pref_ass_output", wxCheckBox)->IsChecked());
void DisplayHelp(wxString section=wxEmptyString)
call help browser with given file
void UpdateFields(CPDetectorConfig *cpdet_config, int index)
updates edit fields with values from settings
#define HUGIN_SHOW_PROJECTION_HINTS
Definition of dialog for editing user-defined output ini file.
wxString GetDataPath()
return path to data directory, it depends on operating system
void OnExifArgfileChoose(wxCommandEvent &e)
virtual ~PreferencesDialog()
dtor.
void OnHelp(wxCommandEvent &e)
#define HUGIN_NONA_CROPPEDIMAGES
#define HUGIN_DEFAULT_OUTPUT_NAME
void Read(wxConfigBase *config=wxConfigBase::Get(), wxString loadFromFile=wxEmptyString)
read the settings of different cp generators from config
void Swap(int index)
swaps setting which index and index+1
#define HUGIN_FT_LOCAL_SEARCH_WIDTH
#define HUGIN_FT_SEARCH_AREA_PERCENT
#define MY_G_BOOL_VAL(id)
void OnEnfuseExe(wxCommandEvent &e)
#define MY_BOOL_VAL(id, val)
#define HUGIN_JPEG_QUALITY
#define HUGIN_FT_CURV_THRESHOLD
#define HUGIN_FT_ROTATION_STEPS
#define HUGIN_EXIFTOOL_CREATE_GPANO
unsigned int GetCount()
return counts of cp detector settings
void OnUpdateProjectFilename(wxCommandEvent &e)
event handler to update preview for project filename
void OnCPDetectorDelete(wxCommandEvent &e)
wxString doubleTowxString(double d, int digits)
#define HUGIN_USE_EXIFTOOL
void OnExifArgfile2Edit(wxCommandEvent &e)
void OnCustomEnblend(wxCommandEvent &e)
include file for the hugin project
#define HUGIN_ENBLEND_EXE_CUSTOM
void OnEnblendExe(wxCommandEvent &e)
void UpdateBlenderControls()
static huginApp * Get()
hack.. kind of a pseudo singleton...
dialog for input settings of one autopano generator
PreferencesDialog(wxWindow *parent)
ctor.
void UpdateDisplayData(int panel)
Config to Window.
ArraySettings settings
array which stores the different autopano settings
void FillControl(wxControlWithItems *control, bool select_default=false, bool show_default=false)
fills a wxControlWithItems with the available generators
void OnCPDetectorMoveDown(wxCommandEvent &e)
#define HUGIN_IMGCACHE_UPPERBOUND
void OnExifTool(wxCommandEvent &e)
#define HUGIN_FT_TEMPLATE_SIZE
class, which stores all settings of one cp detector
void OnCPDetectorDefault(wxCommandEvent &e)
void CreateNewArgFile(const wxString &newFilename, const wxString &sourceFile)
CPDetectorConfig cpdetector_config_edit
static MainFrame * Get()
hack.. kind of a pseudo singleton...
void OnCPDetectorEdit(wxCommandEvent &e)
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Store window size and position in configfile/registry.
#define HUGIN_CELESTE_FILTER
#define HUGIN_CELESTE_THRESHOLD
#define HUGIN_NONA_INTERPOLATOR
#define HUGIN_TIFF_COMPRESSION
void OnRestoreDefaults(wxCommandEvent &e)
void UpdateFileFormatControls()
void OnChangeUserDefinedOutputOptions(wxCommandEvent &e)
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Restore window size and position from configfile/registry.
#define HUGIN_NONA_USEGPU
Dialog for editing user defined output settings (ini file)
#define HUGIN_PROCESSOR_START
void WriteToFile(wxString filename)
exporth the cp detector settings to external file
#define MY_STR_VAL(id, val)
bool stringToDouble(const STR &str_, double &dest)
convert a string to a double, ignore localisation.
#define HUGIN_DEFAULT_PROJECT_NAME
void UpdateProcessorControls()
#define HUGIN_ENFUSE_EXE_CUSTOM
#define HUGIN_LDR_OUTPUT_FORMAT
#define HUGIN_ASS_AUTO_ALIGN
void ReadFromFile(wxString filename)
import the cp detector settings from external file
void UpdateConfigData()
Window to Config.
void OnUpdateOutputFilename(wxCommandEvent &e)
event handler to update preview for project filename
#define MY_CHOICE_VAL(id, val)
#define HUGIN_PROCESSOR_OVERWRITE
void OnCPDetectorMoveUp(wxCommandEvent &e)
#define HUGIN_ASS_LINEFIND
#define HUGIN_FT_ROTATION_START_ANGLE
void OnExifArgfile2Choose(wxCommandEvent &e)
void OnDarktableExe(wxCommandEvent &e)
include file for the hugin project
void EnableRotationCtrls(bool enable)
#define MY_G_CHOICE_VAL(id)
void OnRawTherapeeExe(wxCommandEvent &e)
#define HUGIN_FT_CORR_THRESHOLD
void OnCustomEnfuse(wxCommandEvent &e)
void OnExifArgfileEdit(wxCommandEvent &e)
void OnUserDefinedOutputOptionsCheckBox(wxCommandEvent &e)
#define HUGIN_ENFUSE_ARGS
unsigned int GetDefaultGenerator()
return index of default generator (this one is used for assistent)
#define HUGIN_ASS_PANO_DOWNSIZE_FACTOR
void OnBlenderChanged(wxCommandEvent &e)
event handler if blender was changed
functions for interaction with the hugin configuration file
void OnFileFormatChanged(wxCommandEvent &e)
event handler if default file format was changed
#define HUGIN_ASS_AUTO_CPCLEAN
#define HUGIN_IMGCACHE_MAPPING_FLOAT
#define HUGIN_PROCESSOR_GUI
void OnCPDetectorLoad(wxCommandEvent &e)
event handler for loading cp detector settings
#define HUGIN_PROCESSOR_VERBOSE
void Write(wxConfigBase *config=wxConfigBase::Get())
writes the settings of different cp generators to config
#define HUGIN_ASS_NCONTROLPOINTS
void OnOk(wxCommandEvent &e)
wxListBox * m_CPDetectorList
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 ...
void UpdateSettings(CPDetectorConfig *cpdet_config, int index)
return inputed settings
#define MY_SPIN_VAL(id, val)
#define MY_G_SPIN_VAL(id)
void OnRotationCheckBox(wxCommandEvent &e)
#define HUGIN_ENBLEND_ARGS
#define HUGIN_PHOTOMETRIC_OPTIMIZER_NRPOINTS
#define HUGIN_FT_ROTATION_STOP_ANGLE
#define HUGIN_ENBLEND_EXE
#define HUGIN_DEFAULT_BLENDER
void OnDcrawExe(wxCommandEvent &e)
void SetDefaultGenerator(unsigned int new_default_generator)
sets new default generator, which is used by assistent
wxString getDefaultProjectName(const HuginBase::Panorama &pano, const wxString filenameTemplate)
gets the default project name, as defined in the preferences
declaration of CPDetectorDialog class, which are for storing and changing settings of different autop...
#define HUGIN_FT_ROTATION_SEARCH
void OnCPDetectorAdd(wxCommandEvent &e)
#define HUGIN_CELESTE_AUTO
void OnProcessorChanged(wxCommandEvent &e)
event handler if processor was changed
void OnCPDetectorSave(wxCommandEvent &e)
event handler for saving cp detector settings