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_SELECTED_CHOICE_VAL(id, val) { SelectListValue( XRCCTRL(*this, id, wxChoice), val); }
54#define MY_STATIC_VAL(id, val) { XRCCTRL(*this, id, wxStaticText)->SetLabel(val); };
55
56#define MY_G_STR_VAL(id) XRCCTRL(*this, id, wxTextCtrl)->GetValue()
57#define MY_G_SPIN_VAL(id) XRCCTRL(*this, id, wxSpinCtrl)->GetValue()
58#define MY_G_BOOL_VAL(id) XRCCTRL(*this, id, wxCheckBox)->GetValue()
59#define MY_G_CHOICE_VAL(id) XRCCTRL(*this, id, wxChoice)->GetSelection()
60#define MY_G_SELECTED_CHOICE_VAL(id) (long)GetSelectedValue(XRCCTRL(*this, id, wxChoice))
61
63//: wxDialog(parent, -1, _("Preferences - hugin"))
64{
65 DEBUG_TRACE("");
66 // load our children. some children might need special
67 // initialization. this will be done later.
68 wxXmlResource::Get()->LoadDialog(this, parent, "pref_dialog");
69
70 // Custom setup ( stuff that can not be done in XRC )
71 XRCCTRL(*this, "prefs_ft_RotationStartAngle", wxSpinCtrl)->SetRange(-180,0);
72 XRCCTRL(*this, "prefs_ft_RotationStopAngle", wxSpinCtrl)->SetRange(0,180);
73 XRCCTRL(*this, "prefs_ass_nControlPoints", wxSpinCtrl)->SetRange(3,3000);
74
75 wxChoice* lang_choice = XRCCTRL(*this, "prefs_gui_language", wxChoice);
76 // add languages to choice
77 long* lp = new long;
79 lang_choice->Append(_("System default"), lp);
80 lp = new long;
82 lang_choice->Append(_("Basque"), lp);
88 lp = new long;
90 lang_choice->Append(_("Catalan"), lp);
91 lp = new long;
93 lang_choice->Append(_("Chinese (Simplified)"), lp);
94 lp = new long;
96 lang_choice->Append(_("Chinese (Traditional)"), lp);
97 lp = new long;
99 lang_choice->Append(_("Czech"), lp);
100 lp = new long;
102 lang_choice->Append(_("Danish"), lp);
103 lp = new long;
105 lang_choice->Append(_("Dutch"), lp);
106 lp = new long;
108 lang_choice->Append(_("English"), lp);
109 lp = new long;
111 lang_choice->Append(_("French"), lp);
112 lp = new long;
114 lang_choice->Append(_("German"), lp);
115 lp = new long;
117 lang_choice->Append(_("Hungarian"), lp);
118 lp = new long;
120 lang_choice->Append(_("Italian"), lp);
121 lp = new long;
123 lang_choice->Append(_("Japanese"), lp);
129 lp = new long;
131 lang_choice->Append(_("Polish"), lp);
132 lp = new long;
134 lang_choice->Append(_("Portuguese (Brazilian)"), lp);
135 lp = new long;
137 lang_choice->Append(_("Russian"), lp);
138 lp = new long;
140 lang_choice->Append(_("Slovak"), lp);
146 lp = new long;
148 lang_choice->Append(_("Spanish"), lp);
149 lp = new long;
151 lang_choice->Append(_("Swedish"), lp);
157 lp = new long;
159 lang_choice->Append(_("Finnish"), lp);
160 lp = new long;
162 lang_choice->Append(_("Valencian (Southern Catalan)"), lp);
163 lang_choice->SetSelection(0);
164
165 // enable auto completion on raw converter executables
166 XRCCTRL(*this, "pref_raw_dcraw_exe", wxTextCtrl)->AutoCompleteFileNames();
167 XRCCTRL(*this, "pref_raw_rt_exe", wxTextCtrl)->AutoCompleteFileNames();
168 XRCCTRL(*this, "pref_raw_darktable_exe", wxTextCtrl)->AutoCompleteFileNames();
169
170 // default blender settings
171 FillBlenderList(XRCCTRL(*this, "pref_default_blender", wxChoice));
172
173 wxStaticText* preview=XRCCTRL(*this, "prefs_project_filename_preview", wxStaticText);
174 preview->SetWindowStyle(preview->GetWindowStyle() | wxST_ELLIPSIZE_START);
175 preview=XRCCTRL(*this, "prefs_output_filename_preview", wxStaticText);
176 preview->SetWindowStyle(preview->GetWindowStyle() | wxST_ELLIPSIZE_START);
177 // enable auto-completion
178 XRCCTRL(*this, "prefs_misc_tempdir", wxTextCtrl)->AutoCompleteDirectories();
179 XRCCTRL(*this, "pref_exiftool_argfile", wxTextCtrl)->AutoCompleteFileNames();
180 XRCCTRL(*this, "pref_exiftool_argfile2", wxTextCtrl)->AutoCompleteFileNames();
181 XRCCTRL(*this, "prefs_enblend_EnblendExe", wxTextCtrl)->AutoCompleteFileNames();
182 XRCCTRL(*this, "prefs_enblend_EnfuseExe", wxTextCtrl)->AutoCompleteFileNames();
183 // load autopano settings
184 wxConfigBase* cfg = wxConfigBase::Get();
185 m_CPDetectorList = XRCCTRL(*this, "pref_cpdetector_list", wxListBox);
187 wxCommandEvent evt; this->OnCPDetectorEdit(evt); });
189
190 // add interpolators
191 FillInterpolatorList(XRCCTRL(*this, "prefs_nona_interpolator", wxChoice));
192 // Load configuration values from wxConfig
194
195 Update();
196 GetSizer()->SetSizeHints(this);
197 // bind all event handler for buttons and boxes
198 Bind(wxEVT_BUTTON, &PreferencesDialog::OnEnblendExe, this, XRCID("prefs_enblend_select"));
199 Bind(wxEVT_BUTTON, &PreferencesDialog::OnEnfuseExe, this, XRCID("prefs_enblend_enfuse_select"));
200 Bind(wxEVT_BUTTON, &PreferencesDialog::OnDcrawExe, this, XRCID("pref_raw_dcraw_exe_select"));
201 Bind(wxEVT_BUTTON, &PreferencesDialog::OnRawTherapeeExe, this, XRCID("pref_raw_rt_exe_select"));
202 Bind(wxEVT_BUTTON, &PreferencesDialog::OnDarktableExe, this, XRCID("pref_raw_darktable_exe_select"));
203 Bind(wxEVT_BUTTON, &PreferencesDialog::OnExifArgfileChoose, this, XRCID("pref_exiftool_argfile_choose"));
204 Bind(wxEVT_BUTTON, &PreferencesDialog::OnExifArgfileEdit, this, XRCID("pref_exiftool_argfile_edit"));
205 Bind(wxEVT_BUTTON, &PreferencesDialog::OnExifArgfile2Choose, this, XRCID("pref_exiftool_argfile2_choose"));
206 Bind(wxEVT_BUTTON, &PreferencesDialog::OnExifArgfile2Edit, this, XRCID("pref_exiftool_argfile2_edit"));
207 Bind(wxEVT_CHECKBOX, &PreferencesDialog::OnExifTool, this, XRCID("pref_exiftool_metadata"));
208 Bind(wxEVT_CHECKBOX, &PreferencesDialog::OnRotationCheckBox, this, XRCID("prefs_ft_RotationSearch"));
209 Bind(wxEVT_CHECKBOX, &PreferencesDialog::OnCustomEnblend, this, XRCID("prefs_enblend_Custom"));
210 Bind(wxEVT_CHECKBOX, &PreferencesDialog::OnCustomEnfuse, this, XRCID("prefs_enblend_enfuseCustom"));
212 Bind(wxEVT_BUTTON, &PreferencesDialog::OnChangeUserDefinedOutputOptions, this, XRCID("pref_ass_change_output"));
213 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorAdd, this, XRCID("pref_cpdetector_new"));
214 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorEdit, this, XRCID("pref_cpdetector_edit"));
215 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorDelete, this, XRCID("pref_cpdetector_del"));
216 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorMoveUp, this, XRCID("pref_cpdetector_moveup"));
217 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorMoveDown, this, XRCID("pref_cpdetector_movedown"));
218 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorDefault, this, XRCID("pref_cpdetector_default"));
219 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorLoad, this, XRCID("pref_cpdetector_load"));
220 Bind(wxEVT_BUTTON, &PreferencesDialog::OnCPDetectorSave, this, XRCID("pref_cpdetector_save"));
221 Bind(wxEVT_CHOICE, &PreferencesDialog::OnFileFormatChanged, this, XRCID("pref_ldr_output_file_format"));
222 Bind(wxEVT_CHOICE, &PreferencesDialog::OnProcessorChanged, this, XRCID("pref_processor_gui"));
223 Bind(wxEVT_CHOICE, &PreferencesDialog::OnBlenderChanged, this, XRCID("pref_default_blender"));
224 Bind(wxEVT_TEXT, &PreferencesDialog::OnUpdateProjectFilename, this, XRCID("prefs_project_filename"));
225 Bind(wxEVT_TEXT, &PreferencesDialog::OnUpdateOutputFilename, this, XRCID("prefs_output_filename"));
226
227 // only enable bundled if the build is actually bundled.
228#if defined __WXMSW__ || defined MAC_SELF_CONTAINED_BUNDLE
229
230#else
231 MY_BOOL_VAL("prefs_enblend_Custom", HUGIN_ENBLEND_EXE_CUSTOM);
232 XRCCTRL(*this, "prefs_enblend_Custom", wxCheckBox)->Hide();
233 cfg->Write("/Enblend/Custom", HUGIN_ENBLEND_EXE_CUSTOM);
234
235 MY_BOOL_VAL("prefs_enblend_enfuseCustom", HUGIN_ENFUSE_EXE_CUSTOM);
236 XRCCTRL(*this, "prefs_enblend_enfuseCustom", wxCheckBox)->Hide();
237 cfg->Write("/Enfuse/Custom", HUGIN_ENFUSE_EXE_CUSTOM);
238#endif
239
240 hugin_utils::RestoreFramePosition(this, "PreferencesDialog");
241 // event handler for default buttons
244 Bind(wxEVT_BUTTON, &PreferencesDialog::OnRestoreDefaults, this, XRCID("prefs_defaults"));
245}
246
247
249{
250 DEBUG_TRACE("begin dtor");
251
252 hugin_utils::StoreFramePosition(this, "PreferencesDialog");
253
254 // delete custom list data
255 wxChoice* lang_choice = XRCCTRL(*this, "prefs_gui_language", wxChoice);
256 for (int i = 0; i < (int) lang_choice->GetCount(); i++)
257 {
258 delete static_cast<long*>(lang_choice->GetClientData(i));
259 }
260
261 DEBUG_TRACE("end dtor");
262}
263
264void PreferencesDialog::OnOk(wxCommandEvent& e)
265{
267 this->EndModal(wxOK);
268}
269
270void PreferencesDialog::OnHelp(wxCommandEvent& e)
271{
272 MainFrame::Get()->DisplayHelp("Hugin_Preferences.html");
273};
274
276{
277 EnableRotationCtrls(e.IsChecked());
278}
279
280void PreferencesDialog::OnEnblendExe(wxCommandEvent& e)
281{
282 wxFileDialog dlg(this,_("Select Enblend"),
285 _("Executables (*.exe)|*.exe"),
286#else
287 "*",
288#endif
290 if (dlg.ShowModal() == wxID_OK)
291 {
292 XRCCTRL(*this, "prefs_enblend_EnblendExe", wxTextCtrl)->SetValue(
293 dlg.GetPath());
294 }
295}
296
297void PreferencesDialog::OnEnfuseExe(wxCommandEvent& e)
298{
299 wxFileDialog dlg(this,_("Select Enfuse"),
302 _("Executables (*.exe)|*.exe"),
303#else
304 "*",
305#endif
307 if (dlg.ShowModal() == wxID_OK)
308 {
309 XRCCTRL(*this, "prefs_enblend_EnfuseExe", wxTextCtrl)->SetValue(
310 dlg.GetPath());
311 }
312}
313
314void PreferencesDialog::OnDcrawExe(wxCommandEvent & e)
315{
316 wxTextCtrl* ctrl = XRCCTRL(*this, "pref_raw_dcraw_exe", wxTextCtrl);
317 wxFileDialog dlg(this, _("Select dcraw"), "", ctrl->GetValue(),
319 _("Executables (*.exe)|*.exe"),
320#else
321 "*",
322#endif
324 if (dlg.ShowModal() == wxID_OK)
325 {
326 ctrl->SetValue(dlg.GetPath());
327 };
328};
329
331{
332 wxTextCtrl* ctrl = XRCCTRL(*this, "pref_raw_rt_exe", wxTextCtrl);
333 wxFileDialog dlg(this, _("Select RawTherapee-cli"), "", ctrl->GetValue(),
335 _("Executables (*.exe)|*.exe"),
336#else
337 "*",
338#endif
340 if (dlg.ShowModal() == wxID_OK)
341 {
342 ctrl->SetValue(dlg.GetPath());
343 };
344};
345
346void PreferencesDialog::OnDarktableExe(wxCommandEvent & e)
347{
348 wxTextCtrl* ctrl = XRCCTRL(*this, "pref_raw_darktable_exe", wxTextCtrl);
349 wxFileDialog dlg(this, _("Select Darktable-cli"), "", ctrl->GetValue(),
351 _("Executables (*.exe)|*.exe"),
352#else
353 "*",
354#endif
356 if (dlg.ShowModal() == wxID_OK)
357 {
358 ctrl->SetValue(dlg.GetPath());
359 };
360};
361
362
364{
365 XRCCTRL(*this, "prefs_enblend_EnblendExe", wxTextCtrl)->Enable(e.IsChecked());
366 XRCCTRL(*this, "prefs_enblend_select", wxButton)->Enable(e.IsChecked());
367}
368
370{
371 XRCCTRL(*this, "prefs_enblend_EnfuseExe", wxTextCtrl)->Enable(e.IsChecked());
372 XRCCTRL(*this, "prefs_enblend_enfuse_select", wxButton)->Enable(e.IsChecked());
373}
374
376{
377 wxFileDialog dlg(this,_("Select ExifTool argfile"),
378 wxEmptyString, XRCCTRL(*this, "pref_exiftool_argfile", wxTextCtrl)->GetValue(),
379 _("ExifTool Argfiles (*.arg)|*.arg|All Files(*)|*"),
381 if (dlg.ShowModal() == wxID_OK)
382 {
383 XRCCTRL(*this, "pref_exiftool_argfile", wxTextCtrl)->SetValue(
384 dlg.GetPath());
385 }
386}
387
389{
391 defaultFile.Open();
393 newFile.Create();
394 if (defaultFile.IsOpened())
395 {
396 for (size_t i = 0; i < defaultFile.GetLineCount(); ++i)
397 {
398 newFile.AddLine(defaultFile[i]);
399 };
400 };
401 newFile.Write();
402 defaultFile.Close();
403 newFile.Close();
404};
405
407{
408 wxString filename=XRCCTRL(*this, "pref_exiftool_argfile", wxTextCtrl)->GetValue();
409 if(!filename.empty())
410 {
411 wxFileName file(filename);
413 if(!file.Exists())
414 {
415 if (hugin_utils::HuginMessageBox(wxString::Format(_("Argfile %s does not exist.\nShould the argfile be created with default tags?"), filename),
416 _("Hugin"), wxYES_NO | wxICON_EXCLAMATION, this) != wxYES)
417 {
418 return;
419 };
420 filename = file.GetFullPath();
421 CreateNewArgFile(filename, MainFrame::Get()->GetDataPath() + "hugin_exiftool_copy.arg");
422 }
423 else
424 {
425 filename = file.GetFullPath();
426 };
427 }
428 else
429 {
430 if (hugin_utils::HuginMessageBox(_("No file selected.\nShould an argfile be created with default tags?"),
431 _("Hugin"), wxYES_NO | wxICON_EXCLAMATION, this) != wxYES)
432 {
433 return;
434 };
435 wxFileDialog dlg(this,_("Select new ExifTool argfile"),
436 wxStandardPaths::Get().GetUserConfigDir(), wxEmptyString,
437 _("ExifTool Argfiles (*.arg)|*.arg|All Files(*)|*"),
439 if (dlg.ShowModal() != wxID_OK)
440 {
441 return;
442 };
443 filename=dlg.GetPath();
444 CreateNewArgFile(filename, MainFrame::Get()->GetDataPath() + "hugin_exiftool_copy.arg");
445 };
446 XRCCTRL(*this, "pref_exiftool_argfile", wxTextCtrl)->SetValue(filename);
447 wxDialog edit_dlg;
448 wxXmlResource::Get()->LoadDialog(&edit_dlg, this, "pref_edit_argfile");
450 wxTextCtrl* argfileControl=XRCCTRL(edit_dlg, "pref_edit_textcontrol", wxTextCtrl);
451 argfileControl->LoadFile(filename);
452 if(edit_dlg.ShowModal() == wxID_OK)
453 {
454 if(!argfileControl->SaveFile(filename))
455 {
456 hugin_utils::HuginMessageBox(wxString::Format(_("Could not save file \"%s\"."), filename),
457 _("Hugin"), wxOK | wxICON_ERROR, this);
458 };
460 };
461};
462
464{
465 wxFileDialog dlg(this, _("Select ExifTool argfile"),
466 wxEmptyString, XRCCTRL(*this, "pref_exiftool_argfile2", wxTextCtrl)->GetValue(),
467 _("ExifTool Argfiles (*.arg)|*.arg|All Files(*)|*"),
469 if (dlg.ShowModal() == wxID_OK)
470 {
471 XRCCTRL(*this, "pref_exiftool_argfile2", wxTextCtrl)->SetValue(
472 dlg.GetPath());
473 }
474}
475
477{
478 wxString filename = XRCCTRL(*this, "pref_exiftool_argfile2", wxTextCtrl)->GetValue();
479 if (!filename.empty())
480 {
481 wxFileName file(filename);
483 if (!file.Exists())
484 {
485 if (hugin_utils::HuginMessageBox(wxString::Format(_("File %s does not exist.\nShould an example argfile be created?"), filename),
486 _("Hugin"), wxYES_NO | wxICON_EXCLAMATION, this) != wxYES)
487 {
488 return;
489 };
490 filename = file.GetFullPath();
491 CreateNewArgFile(filename, MainFrame::Get()->GetDataPath() + "hugin_exiftool_final_example.arg");
492 }
493 else
494 {
495 filename = file.GetFullPath();
496 };
497 }
498 else
499 {
500 if (hugin_utils::HuginMessageBox(_("No file selected.\nShould an example argfile be created?"),
501 _("Hugin"), wxYES_NO | wxICON_EXCLAMATION, this) != wxYES)
502 {
503 return;
504 };
505 wxFileDialog dlg(this, _("Select new ExifTool argfile"),
506 wxStandardPaths::Get().GetUserConfigDir(), wxEmptyString,
507 _("ExifTool Argfiles (*.arg)|*.arg|All Files(*)|*"),
509 if (dlg.ShowModal() != wxID_OK)
510 {
511 return;
512 };
513 filename = dlg.GetPath();
514 CreateNewArgFile(filename, MainFrame::Get()->GetDataPath() + "hugin_exiftool_final_example.arg");
515 };
516 XRCCTRL(*this, "pref_exiftool_argfile2", wxTextCtrl)->SetValue(filename);
517 wxDialog edit_dlg;
518 wxXmlResource::Get()->LoadDialog(&edit_dlg, this, "pref_edit_argfile_placeholders");
519 hugin_utils::RestoreFramePosition(&edit_dlg, "EditArgfilePlaceholders");
520 wxTextCtrl* argfileControl = XRCCTRL(edit_dlg, "pref_edit_textcontrol", wxTextCtrl);
521 argfileControl->LoadFile(filename);
522 if (edit_dlg.ShowModal() == wxID_OK)
523 {
524 if (!argfileControl->SaveFile(filename))
525 {
526 hugin_utils::HuginMessageBox(wxString::Format(_("Could not save file \"%s\"."), filename),
527 _("Hugin"), wxOK | wxICON_ERROR, this);
528 };
529 hugin_utils::StoreFramePosition(&edit_dlg, "EditArgfilePlaceholders");
530 };
531};
532
533void PreferencesDialog::OnExifTool(wxCommandEvent & e)
534{
535 bool copyMetadata=XRCCTRL(*this, "pref_exiftool_metadata", wxCheckBox)->GetValue();
536 XRCCTRL(*this, "pref_exiftool_argfile_general_label", wxStaticText)->Enable(copyMetadata);
537 XRCCTRL(*this, "pref_exiftool_argfile_intermediate_label", wxStaticText)->Enable(copyMetadata);
538 XRCCTRL(*this, "pref_exiftool_argfile_label", wxStaticText)->Enable(copyMetadata);
539 XRCCTRL(*this, "pref_exiftool_argfile", wxTextCtrl)->Enable(copyMetadata);
540 XRCCTRL(*this, "pref_exiftool_argfile_choose", wxButton)->Enable(copyMetadata);
541 XRCCTRL(*this, "pref_exiftool_argfile_edit", wxButton)->Enable(copyMetadata);
542 XRCCTRL(*this, "pref_exiftool_argfile_final_label", wxStaticText)->Enable(copyMetadata);
543 XRCCTRL(*this, "pref_exiftool_argfile2_label", wxStaticText)->Enable(copyMetadata);
544 XRCCTRL(*this, "pref_exiftool_argfile2", wxTextCtrl)->Enable(copyMetadata);
545 XRCCTRL(*this, "pref_exiftool_argfile2_choose", wxButton)->Enable(copyMetadata);
546 XRCCTRL(*this, "pref_exiftool_argfile2_edit", wxButton)->Enable(copyMetadata);
547 XRCCTRL(*this, "pref_exiftool_gpano", wxCheckBox)->Enable(copyMetadata);
548};
549
551{
552 XRCCTRL(*this, "prefs_ft_rot_panel", wxPanel)->Enable(enable);
553}
554
556{
557 DEBUG_DEBUG("Updating display data");
558
559 double d;
560 bool t;
562 wxConfigBase* cfg = wxConfigBase::Get();
563
564 if (panel==0 || panel == 1)
565 {
566 // memory setting
567 unsigned long long mem = cfg->Read("/ImageCache/UpperBound", HUGIN_IMGCACHE_UPPERBOUND);
568#ifdef __WXMSW__
569 unsigned long mem_low = cfg->Read("/ImageCache/UpperBound", HUGIN_IMGCACHE_UPPERBOUND);
570 unsigned long mem_high = cfg->Read("/ImageCache/UpperBoundHigh", (long) 0);
571 if (mem_high > 0)
572 {
573 mem = ((unsigned long long) mem_high << 32) + mem_low;
574 }
575 else
576 {
577 mem = mem_low;
578 }
579#endif
580 MY_SPIN_VAL("prefs_cache_UpperBound", mem >> 20);
581
582 // language
583 // check if current language is in list and activate it then.
584 wxChoice* lang_choice = XRCCTRL(*this, "prefs_gui_language", wxChoice);
585 int curlang = cfg->Read("language", HUGIN_LANGUAGE);
586 bool found = false;
587 int idx = 0;
588 int idxDefault = 0;
589 for (int i = 0; i < (int)lang_choice->GetCount(); i++)
590 {
591 long lang = * static_cast<long*>(lang_choice->GetClientData(i));
592 if (curlang == lang)
593 {
594 found = true;
595 idx = i;
596 }
598 {
600 }
601 }
602 if (found)
603 {
604 DEBUG_DEBUG("wxChoice language updated:" << curlang);
605 // update language
606 lang_choice->SetSelection(idx);
607 }
608 else
609 {
610 // unknown language selected..
611 DEBUG_WARN("Unknown language configured");
612 // select default language
613 lang_choice->SetSelection(idxDefault);
614 }
615
616 // smart undo
617 t = cfg->Read("smartUndo", HUGIN_SMART_UNDO) == 1;
618 MY_BOOL_VAL("prefs_smart_undo", t);
619
620 // copy log to clipboard
621 t = cfg->Read("CopyLogToClipboard", 0l) == 1;
622 MY_BOOL_VAL("prefs_copy_log", t);
623
624 t = cfg->Read("/GLPreviewFrame/ShowProjectionHints", HUGIN_SHOW_PROJECTION_HINTS) == 1;
625 MY_BOOL_VAL("pref_show_projection_hints", t);
626 // auto-rotate
627 t = cfg->Read("/CPEditorPanel/AutoRot", 1l) == 1;
628 MY_BOOL_VAL("pref_autorotate", t);
629
630 // raw converter programs paths
631 MY_STR_VAL("pref_raw_dcraw_exe", cfg->Read("/RawImportDialog/dcrawExe", ""));
632 MY_STR_VAL("pref_raw_rt_exe", cfg->Read("/RawImportDialog/RTExe", ""));
633 MY_STR_VAL("pref_raw_darktable_exe", cfg->Read("/RawImportDialog/DarktableExe", ""));
634 };
635
636 // filename panel
637 if(panel==0 || panel==2)
638 {
639 // tempdir
640 MY_STR_VAL("prefs_misc_tempdir", cfg->Read("tempDir",wxEmptyString));
641 // default filenames
642 wxString filename=cfg->Read("ProjectFilename", HUGIN_DEFAULT_PROJECT_NAME);
643#ifdef __WXMSW__
644 filename.Replace("/","\\",true);
645#endif
646 MY_STR_VAL("prefs_project_filename", filename);
647 filename=cfg->Read("OutputFilename", HUGIN_DEFAULT_OUTPUT_NAME);
648#ifdef __WXMSW__
649 filename.Replace("/","\\",true);
650#endif
651 MY_STR_VAL("prefs_output_filename", filename);
652 }
653
654 if (panel==0 || panel == 3)
655 {
656 // Assistant settings
657 t = cfg->Read("/Assistant/autoAlign", HUGIN_ASS_AUTO_ALIGN) == 1;
658 MY_BOOL_VAL("prefs_ass_autoAlign", t);
659 t = cfg->Read("/General/IgnoreFovRectilinearOnAdd", 1l) == 1l;
660 MY_BOOL_VAL("prefs_ass_loadFovRectilinear", !t);
661 MY_SPIN_VAL("prefs_ass_nControlPoints",
662 cfg->Read("/Assistant/nControlPoints", HUGIN_ASS_NCONTROLPOINTS));
663 double factor = HUGIN_ASS_PANO_DOWNSIZE_FACTOR;
664 cfg->Read("/Assistant/panoDownsizeFactor", &factor);
665 MY_SPIN_VAL("prefs_ass_panoDownsizeFactor",(int)(factor*100.0));
666 t = cfg->Read("/Assistant/Linefind", HUGIN_ASS_LINEFIND) == 1;
667 MY_BOOL_VAL("prefs_ass_linefind", t);
668 t = cfg->Read("/Celeste/Auto", HUGIN_CELESTE_AUTO) == 1;
669 MY_BOOL_VAL("prefs_celeste_auto", t);
670 t = cfg->Read("/Assistant/AutoCPClean", HUGIN_ASS_AUTO_CPCLEAN) == 1;
671 MY_BOOL_VAL("prefs_auto_cpclean", t);
672 t = cfg->Read("/Assistant/UserDefinedOutputOption", 0l) == 1;
673 MY_BOOL_VAL("pref_ass_output", t);
674 wxCommandEvent dummy;
676 }
677 // Fine tune settings
678
679 if (panel==0 || panel == 4)
680 {
681 // hdr display settings
682 MY_CHOICE_VAL("prefs_misc_hdr_mapping", cfg->Read("/ImageCache/Mapping", HUGIN_IMGCACHE_MAPPING_FLOAT));
683 //MY_CHOICE_VAL("prefs_misc_hdr_range", cfg->Read("/ImageCache/Range", HUGIN_IMGCACHE_RANGE));
684
685 int val = wxConfigBase::Get()->Read("/CPEditorPanel/MagnifierWidth", 61l);
686 val = hugin_utils::floori((val - 61) / 20);
687 val = std::min(val, 3);
688 XRCCTRL(*this, "prefs_misc_magnifier_width", wxChoice)->SetSelection(val);
689
690
691 MY_SPIN_VAL("prefs_ft_TemplateSize",
692 cfg->Read("/Finetune/TemplateSize",HUGIN_FT_TEMPLATE_SIZE));
693 MY_SPIN_VAL("prefs_ft_SearchAreaPercent",cfg->Read("/Finetune/SearchAreaPercent",
695 MY_SPIN_VAL("prefs_ft_LocalSearchWidth", cfg->Read("/Finetune/LocalSearchWidth",
697
699 cfg->Read("/Finetune/CorrThreshold", &d, HUGIN_FT_CORR_THRESHOLD);
701 MY_STR_VAL("prefs_ft_CorrThreshold", tstr);
702
703 cfg->Read("/Finetune/CurvThreshold", &d, HUGIN_FT_CURV_THRESHOLD);
705 MY_STR_VAL("prefs_ft_CurvThreshold", tstr);
706
707 t = cfg->Read("/Finetune/RotationSearch", HUGIN_FT_ROTATION_SEARCH) == 1;
708 MY_BOOL_VAL("prefs_ft_RotationSearch", t);
710
712 cfg->Read("/Finetune/RotationStartAngle",&d,HUGIN_FT_ROTATION_START_ANGLE);
713 MY_SPIN_VAL("prefs_ft_RotationStartAngle", hugin_utils::roundi(d))
714
716 cfg->Read("/Finetune/RotationStopAngle", &d, HUGIN_FT_ROTATION_STOP_ANGLE);
717 MY_SPIN_VAL("prefs_ft_RotationStopAngle", hugin_utils::roundi(d));
718
719 MY_SPIN_VAL("prefs_ft_RotationSteps", cfg->Read("/Finetune/RotationSteps",
721 }
722
725
728
729 if (panel==0 || panel == 5)
730 {
732 }
733
734 if (panel == 0 || panel == 6)
735 {
738 MY_CHOICE_VAL("pref_ldr_output_file_format", cfg->Read("/output/ldr_format", HUGIN_LDR_OUTPUT_FORMAT));
740 // MY_CHOICE_VAL("pref_hdr_output_file_format", cfg->Read("/output/hdr_format", HUGIN_HDR_OUTPUT_FORMAT));
741 MY_CHOICE_VAL("pref_tiff_compression", cfg->Read("/output/tiff_compression", HUGIN_TIFF_COMPRESSION));
742 MY_SPIN_VAL("pref_jpeg_quality", cfg->Read("/output/jpeg_quality", HUGIN_JPEG_QUALITY));
744
745 // default blender
746 SelectListValue(XRCCTRL(*this, "pref_default_blender", wxChoice), cfg->Read("/default_blender", HUGIN_DEFAULT_BLENDER));
747 // default verdandi parameters
748 const wxString defaultVerdandiArgs = cfg->Read("/VerdandiDefaultArgs", wxEmptyString);
749 if (defaultVerdandiArgs.Find("--seam=blend") != wxNOT_FOUND)
750 {
751 XRCCTRL(*this, "pref_internal_blender_seam", wxChoice)->SetSelection(1);
752 }
753 else
754 {
755 XRCCTRL(*this, "pref_internal_blender_seam", wxChoice)->SetSelection(0);
756 };
758
761 MY_CHOICE_VAL("pref_processor_gui", cfg->Read("/Processor/gui", HUGIN_PROCESSOR_GUI));
762 t = cfg->Read("/Processor/start", HUGIN_PROCESSOR_START) == 1;
763 MY_BOOL_VAL("pref_processor_start", t);
764 t = cfg->Read("/Processor/overwrite", HUGIN_PROCESSOR_OVERWRITE) == 1;
765 MY_BOOL_VAL("pref_processor_overwrite", t);
766 t = cfg->Read("/Processor/verbose", HUGIN_PROCESSOR_VERBOSE) == 1;
767 MY_BOOL_VAL("pref_processor_verbose", t);
769 }
770
771 if (panel == 0 || panel == 7)
772 {
773 // stitching (2) panel
774 t = cfg->Read("/output/useExiftool", HUGIN_USE_EXIFTOOL) == 1;
775 MY_BOOL_VAL("pref_exiftool_metadata", t);
776 MY_STR_VAL("pref_exiftool_argfile", cfg->Read("/output/CopyArgfile", wxEmptyString));
777 MY_STR_VAL("pref_exiftool_argfile2", cfg->Read("/output/FinalArgfile", wxEmptyString));
778 t = cfg->Read("/output/writeGPano", HUGIN_EXIFTOOL_CREATE_GPANO) == 1;
779 MY_BOOL_VAL("pref_exiftool_gpano", t);
780 wxCommandEvent dummy;
782 // number of threads
783 int nThreads = cfg->Read("/output/NumberOfThreads", 0l);
784 MY_SPIN_VAL("prefs_output_NumberOfThreads", nThreads);
785 }
786
787 if (panel==0 || panel == 8)
788 {
789
792 MY_SELECTED_CHOICE_VAL("prefs_nona_interpolator", cfg->Read("/Nona/Interpolator", HUGIN_NONA_INTERPOLATOR));
793 t = cfg->Read("/Nona/CroppedImages", HUGIN_NONA_CROPPEDIMAGES) == 1;
794 MY_BOOL_VAL("prefs_nona_createCroppedImages", t);
795 t = cfg->Read("/Nona/UseGPU", HUGIN_NONA_USEGPU) == 1;
796 MY_BOOL_VAL("prefs_nona_useGpu", t);
797
800 MY_STR_VAL("prefs_enblend_EnblendExe", cfg->Read("/Enblend/Exe",
803 cfg->Read("/Enblend/Custom", &customEnblendExe);
804 MY_BOOL_VAL("prefs_enblend_Custom", customEnblendExe);
805 XRCCTRL(*this, "prefs_enblend_EnblendExe", wxTextCtrl)->Enable(customEnblendExe);
806 XRCCTRL(*this, "prefs_enblend_select", wxButton)->Enable(customEnblendExe);
807 MY_STR_VAL("prefs_enblend_EnblendArgs", cfg->Read("/Enblend/Args",
811 MY_STR_VAL("prefs_enblend_EnfuseExe", cfg->Read("/Enfuse/Exe",
814 cfg->Read("/Enfuse/Custom", &customEnfuseExe);
815 MY_BOOL_VAL("prefs_enblend_enfuseCustom", customEnfuseExe);
816 XRCCTRL(*this, "prefs_enblend_EnfuseExe", wxTextCtrl)->Enable(customEnfuseExe);
817 XRCCTRL(*this, "prefs_enblend_enfuse_select", wxButton)->Enable(customEnfuseExe);
818 MY_STR_VAL("prefs_enblend_EnfuseArgs", cfg->Read("/Enfuse/Args",
820 }
821
822 if (panel==0 || panel == 9)
823 {
824 // Celeste settings
826 cfg->Read("/Celeste/Threshold", &d, HUGIN_CELESTE_THRESHOLD);
828 MY_STR_VAL("prefs_celeste_threshold", tstr);
829 MY_CHOICE_VAL("prefs_celeste_filter", cfg->Read("/Celeste/Filter", HUGIN_CELESTE_FILTER));
830 // photometric optimizer settings
831 MY_SPIN_VAL("prefs_photo_optimizer_nr_points", cfg->Read("/OptimizePhotometric/nRandomPointsPerImage", HUGIN_PHOTOMETRIC_OPTIMIZER_NRPOINTS));
832 // warnings
833 t = cfg->Read("/ShowSaveMessage", 1l) == 1;
834 MY_BOOL_VAL("prefs_warning_save", t);
835 t = cfg->Read("/ShowExposureWarning", 1l) == 1;
836 MY_BOOL_VAL("prefs_warning_exposure", t);
837 t = cfg->Read("/ShowFisheyeCropHint", 1l) == 1;
838 MY_BOOL_VAL("prefs_warning_fisheye_crop", t);
839 MY_CHOICE_VAL("pref_editcp_action", cfg->Read("/EditCPAfterAction", 0l));
840 }
841}
842
844{
845 DEBUG_TRACE("");
846 wxConfigBase* cfg = wxConfigBase::Get();
847 // check which tab is enabled
848 wxNotebook* noteb = XRCCTRL(*this, "prefs_tab", wxNotebook);
849 if (hugin_utils::HuginMessageBox(_("Really reset displayed preferences to default values?"), _("Hugin"), wxYES_NO | wxICON_QUESTION, this) == wxYES)
850 {
851 if (noteb->GetSelection() == 0)
852 {
853 // MISC
854 // cache
855 /*
856 * special treatment for windows not necessary here since we know the value of
857 * HUGIN_IMGCACHE_UPPERBOUND must fit into 32bit to be compatible with 32bit systems.
858 * However, just as a reminder:
859 #ifdef __WXMSW__
860 cfg->Write("/ImageCache/UpperBoundHigh", HUGIN_IMGCACHE_UPPERBOUND >> 32);
861 #endif
862 */
863 cfg->Write("/ImageCache/UpperBound", HUGIN_IMGCACHE_UPPERBOUND);
864 // locale
865 cfg->Write("language", int(HUGIN_LANGUAGE));
866 // smart undo
867 cfg->Write("smartUndo", HUGIN_SMART_UNDO);
868 cfg->Write("CopyLogToClipboard", 0l);
869 // projection hints
870 cfg->Write("/GLPreviewFrame/ShowProjectionHints", HUGIN_SHOW_PROJECTION_HINTS);
871 cfg->Write("/CPEditorPanel/AutoRot", 1l);
872 // raw converter
873 cfg->Write("/RawImportDialog/dcrawExe", "");
874 cfg->Write("/RawImportDialog/RTExe", "");
875 cfg->Write("/RawImportDialog/DarktableExe", "");
876 }
877 if(noteb->GetSelection() == 1)
878 {
879 cfg->Write("tempDir", wxEmptyString);
880 cfg->Write("ProjectFilename", HUGIN_DEFAULT_PROJECT_NAME);
881 cfg->Write("OutputFilename", HUGIN_DEFAULT_OUTPUT_NAME);
882 };
883 if (noteb->GetSelection() == 2)
884 {
885 cfg->Write("/Assistant/autoAlign", HUGIN_ASS_AUTO_ALIGN);
886 cfg->Write("/General/IgnoreFovRectilinearOnAdd", 1l);
887 cfg->Write("/Assistant/nControlPoints", HUGIN_ASS_NCONTROLPOINTS);
888 cfg->Write("/Assistant/panoDownsizeFactor",HUGIN_ASS_PANO_DOWNSIZE_FACTOR);
889 cfg->Write("/Assistant/Linefind", HUGIN_ASS_LINEFIND);
890 cfg->Write("/Celeste/Auto", HUGIN_CELESTE_AUTO);
891 cfg->Write("/Assistant/AutoCPClean", HUGIN_ASS_AUTO_CPCLEAN);
892 cfg->Write("/Assistant/UserDefinedOutputOption", 0l);
893 }
894 if (noteb->GetSelection() == 3)
895 {
896 // hdr
897 cfg->Write("/ImageCache/Mapping", HUGIN_IMGCACHE_MAPPING_FLOAT);
898 //cfg->Write("/ImageCache/Range", HUGIN_IMGCACHE_RANGE);
899 cfg->Write("/CPEditorPanel/MagnifierWidth", 61l);
900 // Fine tune settings
901 cfg->Write("/Finetune/SearchAreaPercent", HUGIN_FT_SEARCH_AREA_PERCENT);
902 cfg->Write("/Finetune/TemplateSize", HUGIN_FT_TEMPLATE_SIZE);
903 cfg->Write("/Finetune/LocalSearchWidth", HUGIN_FT_LOCAL_SEARCH_WIDTH);
904
905 cfg->Write("/Finetune/CorrThreshold", HUGIN_FT_CORR_THRESHOLD);
906 cfg->Write("/Finetune/CurvThreshold", HUGIN_FT_CURV_THRESHOLD);
907
908 cfg->Write("/Finetune/RotationSearch", HUGIN_FT_ROTATION_SEARCH);
909 cfg->Write("/Finetune/RotationStartAngle", HUGIN_FT_ROTATION_START_ANGLE);
910 cfg->Write("/Finetune/RotationStopAngle", HUGIN_FT_ROTATION_STOP_ANGLE);
911 cfg->Write("/Finetune/RotationSteps", HUGIN_FT_ROTATION_STEPS);
912 }
913 if (noteb->GetSelection() == 4)
914 {
919 }
920 if (noteb->GetSelection() == 5)
921 {
923 cfg->Write("/output/ldr_format", HUGIN_LDR_OUTPUT_FORMAT);
925 // cfg->Write("/output/hdr_format", HUGIN_HDR_OUTPUT_FORMAT);
926 cfg->Write("/output/tiff_compression", HUGIN_TIFF_COMPRESSION);
927 cfg->Write("/output/jpeg_quality", HUGIN_JPEG_QUALITY);
928 // default blender
929 cfg->Write("/default_blender", static_cast<long>(HUGIN_DEFAULT_BLENDER));
930 cfg->Write("/VerdandiDefaultArgs", wxEmptyString);
931 // stitching engine
932 cfg->Write("/Processor/gui", HUGIN_PROCESSOR_GUI);
933 cfg->Write("/Processor/start", HUGIN_PROCESSOR_START);
934 cfg->Write("/Processor/overwrite", HUGIN_PROCESSOR_OVERWRITE);
935 cfg->Write("/Processor/verbose", HUGIN_PROCESSOR_VERBOSE);
936 }
937 if (noteb->GetSelection() == 6)
938 {
939 cfg->Write("/output/useExiftool", HUGIN_USE_EXIFTOOL);
940 cfg->Write("/output/CopyArgfile", wxEmptyString);
941 cfg->Write("/output/FinalArgfile", wxEmptyString);
942 cfg->Write("/output/writeGPano", HUGIN_EXIFTOOL_CREATE_GPANO);
943 cfg->Write("/output/NumberOfThreads", 0l);
944 }
945 if (noteb->GetSelection() == 7)
946 {
948 cfg->Write("/Enblend/Exe", HUGIN_ENBLEND_EXE);
949 cfg->Write("/Enblend/Custom", HUGIN_ENBLEND_EXE_CUSTOM);
950 cfg->Write("/Enblend/Args", HUGIN_ENBLEND_ARGS);
951
952 cfg->Write("/Enfuse/Exe", HUGIN_ENFUSE_EXE);
953 cfg->Write("/Enfuse/Custom", HUGIN_ENFUSE_EXE_CUSTOM);
954 cfg->Write("/Enfuse/Args", HUGIN_ENFUSE_ARGS);
955 }
956
957 if (noteb->GetSelection() == 8)
958 {
960 cfg->Write("/Celeste/Threshold", HUGIN_CELESTE_THRESHOLD);
961 cfg->Write("/Celeste/Filter", HUGIN_CELESTE_FILTER);
962 cfg->Write("/OptimizePhotometric/nRandomPointsPerImage", HUGIN_PHOTOMETRIC_OPTIMIZER_NRPOINTS);
963 cfg->Write("/ShowSaveMessage", 1l);
964 cfg->Write("/ShowExposureWarning", 1l);
965 cfg->Write("/ShowFisheyeCropHint", 1l);
966 cfg->Write("/EditCPAfterAction", 0l);
967 }
968
969 /*
970 if (noteb->GetSelection() == 5) {
971 cfg->Write("/PTmender/Exe", HUGIN_PT_MENDER_EXE );
972 cfg->Write("/PTmender/Custom",HUGIN_PT_MENDER_EXE_CUSTOM);
973 cfg->Write("/PanoTools/ScriptFile", "PT_script.txt");
974 }
975 */
976 UpdateDisplayData(noteb->GetSelection() + 1);
977 }
978}
979
981{
982 DEBUG_TRACE("");
983 wxConfigBase* cfg = wxConfigBase::Get();
984 // Assistant
985 cfg->Write("/Assistant/autoAlign",MY_G_BOOL_VAL("prefs_ass_autoAlign"));
986 cfg->Write("/General/IgnoreFovRectilinearOnAdd", !MY_G_BOOL_VAL("prefs_ass_loadFovRectilinear"));
987 cfg->Write("/Assistant/nControlPoints", MY_G_SPIN_VAL("prefs_ass_nControlPoints"));
988 cfg->Write("/Assistant/panoDownsizeFactor", MY_G_SPIN_VAL("prefs_ass_panoDownsizeFactor") / 100.0);
989 cfg->Write("/Assistant/Linefind", MY_G_BOOL_VAL("prefs_ass_linefind"));
990 cfg->Write("/Celeste/Auto", MY_G_BOOL_VAL("prefs_celeste_auto"));
991 cfg->Write("/Assistant/AutoCPClean", MY_G_BOOL_VAL("prefs_auto_cpclean"));
992 cfg->Write("/Assistant/UserDefinedOutputOption", MY_G_BOOL_VAL("pref_ass_output"));
993
994 // hdr display
995 cfg->Write("/ImageCache/Mapping",MY_G_CHOICE_VAL("prefs_misc_hdr_mapping"));
996 //cfg->Write("/ImageCache/Range",MY_G_CHOICE_VAL("prefs_misc_hdr_range"));
997 cfg->Write("/CPEditorPanel/MagnifierWidth", MY_G_CHOICE_VAL("prefs_misc_magnifier_width") * 20 + 61l);
998
999 // Fine tune settings
1000 cfg->Write("/Finetune/SearchAreaPercent", MY_G_SPIN_VAL("prefs_ft_SearchAreaPercent"));
1001 cfg->Write("/Finetune/TemplateSize", MY_G_SPIN_VAL("prefs_ft_TemplateSize"));
1002 cfg->Write("/Finetune/LocalSearchWidth", MY_G_SPIN_VAL("prefs_ft_LocalSearchWidth"));
1003 wxString t = MY_G_STR_VAL("prefs_ft_CorrThreshold");
1005 hugin_utils::stringToDouble(std::string(t.mb_str(wxConvLocal)), td);
1006 cfg->Write("/Finetune/CorrThreshold", td);
1007
1008 t = MY_G_STR_VAL("prefs_ft_CurvThreshold");
1010 hugin_utils::stringToDouble(std::string(t.mb_str(wxConvLocal)), td);
1011 cfg->Write("/Finetune/CurvThreshold", td);
1012
1013 cfg->Write("/Finetune/RotationSearch", MY_G_BOOL_VAL("prefs_ft_RotationSearch"));
1014 cfg->Write("/Finetune/RotationStartAngle", (double) MY_G_SPIN_VAL("prefs_ft_RotationStartAngle"));
1015 cfg->Write("/Finetune/RotationStopAngle", (double) MY_G_SPIN_VAL("prefs_ft_RotationStopAngle"));
1016 cfg->Write("/Finetune/RotationSteps", MY_G_SPIN_VAL("prefs_ft_RotationSteps"));
1017
1020 // cache
1021#ifdef __WXMSW__
1022 // shifting only 12 bits rights: 32-20=12 and the prefs_cache_UpperBound is in GB
1023 cfg->Write("/ImageCache/UpperBoundHigh", (long) MY_G_SPIN_VAL("prefs_cache_UpperBound") >> 12);
1024#endif
1025 cfg->Write("/ImageCache/UpperBound", (long) MY_G_SPIN_VAL("prefs_cache_UpperBound") << 20);
1026 // locale
1027 // language
1028 wxChoice* lang = XRCCTRL(*this, "prefs_gui_language", wxChoice);
1029 // DEBUG_TRACE("Language Selection Name: " << huginApp::Get()->GetLocale().GetLanguageName((int) lang->GetClientData(lang->GetSelection())).mb_str(wxConvLocal));
1030 //DEBUG_INFO("Language Selection locale: " << ((huginApp::Get()->GetLocale().GetLanguageInfo((int) lang->GetClientData(lang->GetSelection())))->CanonicalName).mb_str(wxConvLocal));
1031 //DEBUG_INFO("Current System Language ID: " << huginApp::Get()->GetLocale().GetSystemLanguage());
1032
1033 void* tmplp = lang->GetClientData(lang->GetSelection());
1034 long templ = * static_cast<long*>(tmplp);
1035 cfg->Write("language", templ);
1036 DEBUG_INFO("Language Selection ID: " << templ);
1037 // smart undo
1038 cfg->Write("smartUndo", MY_G_BOOL_VAL("prefs_smart_undo"));
1039 cfg->Write("CopyLogToClipboard", MY_G_BOOL_VAL("prefs_copy_log"));
1040 // show projections hints
1041 cfg->Write("/GLPreviewFrame/ShowProjectionHints", MY_G_BOOL_VAL("pref_show_projection_hints"));
1042 //auto-rotate
1043 cfg->Write("/CPEditorPanel/AutoRot", MY_G_BOOL_VAL("pref_autorotate"));
1044 // raw converter
1045 cfg->Write("/RawImportDialog/dcrawExe", MY_G_STR_VAL("pref_raw_dcraw_exe"));
1046 cfg->Write("/RawImportDialog/RTExe", MY_G_STR_VAL("pref_raw_rt_exe"));
1047 cfg->Write("/RawImportDialog/DarktableExe", MY_G_STR_VAL("pref_raw_darktable_exe"));;
1048 // tempdir
1049 cfg->Write("tempDir",MY_G_STR_VAL("prefs_misc_tempdir"));
1050 // filename templates
1051 wxString filename=XRCCTRL(*this, "prefs_project_filename", wxTextCtrl)->GetValue();
1052#ifdef __WXMSW__
1053 filename.Replace("\\", "/", true);
1054#endif
1055 cfg->Write("ProjectFilename", filename);
1056 filename=XRCCTRL(*this, "prefs_output_filename", wxTextCtrl)->GetValue();
1057#ifdef __WXMSW__
1058 filename.Replace("\\", "/", true);
1059#endif
1060 cfg->Write("OutputFilename", filename);
1064
1067 cfg->Write("/output/ldr_format", MY_G_CHOICE_VAL("pref_ldr_output_file_format"));
1069 // cfg->Write("/output/hdr_format", MY_G_CHOICE_VAL("pref_hdr_output_file_format"));
1070 cfg->Write("/output/tiff_compression", MY_G_CHOICE_VAL("pref_tiff_compression"));
1071 cfg->Write("/output/jpeg_quality", MY_G_SPIN_VAL("pref_jpeg_quality"));
1072
1073 cfg->Write("/default_blender", static_cast<long>(GetSelectedValue(XRCCTRL(*this, "pref_default_blender", wxChoice))));
1074 if (XRCCTRL(*this, "pref_internal_blender_seam", wxChoice)->GetSelection() == 1)
1075 {
1076 cfg->Write("/VerdandiDefaultArgs", "--seam=blend");
1077 }
1078 else
1079 {
1080 cfg->Write("/VerdandiDefaultArgs", wxEmptyString);
1081 };
1082
1085 cfg->Write("/Processor/gui", MY_G_CHOICE_VAL("pref_processor_gui"));
1086 cfg->Write("/Processor/start", MY_G_BOOL_VAL("pref_processor_start"));
1087 cfg->Write("/Processor/overwrite", MY_G_BOOL_VAL("pref_processor_overwrite"));
1088 cfg->Write("/Processor/verbose", MY_G_BOOL_VAL("pref_processor_verbose"));
1089
1090 cfg->Write("/output/useExiftool", MY_G_BOOL_VAL("pref_exiftool_metadata"));
1091 cfg->Write("/output/CopyArgfile", MY_G_STR_VAL("pref_exiftool_argfile"));
1092 cfg->Write("/output/FinalArgfile", MY_G_STR_VAL("pref_exiftool_argfile2"));
1093 cfg->Write("/output/writeGPano", MY_G_BOOL_VAL("pref_exiftool_gpano"));
1094 cfg->Write("/output/NumberOfThreads", MY_G_SPIN_VAL("prefs_output_NumberOfThreads"));
1097 cfg->Write("/Nona/Interpolator", MY_G_SELECTED_CHOICE_VAL("prefs_nona_interpolator"));
1098 cfg->Write("/Nona/CroppedImages", MY_G_BOOL_VAL("prefs_nona_createCroppedImages"));
1099 cfg->Write("/Nona/UseGPU", MY_G_BOOL_VAL("prefs_nona_useGpu"));
1100
1103 cfg->Write("/Enblend/Custom", MY_G_BOOL_VAL("prefs_enblend_Custom"));
1104 cfg->Write("/Enblend/Exe", MY_G_STR_VAL("prefs_enblend_EnblendExe"));
1105 cfg->Write("/Enblend/Args", MY_G_STR_VAL("prefs_enblend_EnblendArgs"));
1106
1107 cfg->Write("/Enfuse/Custom", MY_G_BOOL_VAL("prefs_enblend_enfuseCustom"));
1108 cfg->Write("/Enfuse/Exe", MY_G_STR_VAL("prefs_enblend_EnfuseExe"));
1109 cfg->Write("/Enfuse/Args", MY_G_STR_VAL("prefs_enblend_EnfuseArgs"));
1110
1111 // Celeste
1112 t = MY_G_STR_VAL("prefs_celeste_threshold");
1114 hugin_utils::stringToDouble(std::string(t.mb_str(wxConvLocal)), td);
1115 cfg->Write("/Celeste/Threshold", td);
1116 cfg->Write("/Celeste/Filter", MY_G_CHOICE_VAL("prefs_celeste_filter"));
1117 //photometric optimizer
1118 cfg->Write("/OptimizePhotometric/nRandomPointsPerImage", MY_G_SPIN_VAL("prefs_photo_optimizer_nr_points"));
1119 cfg->Write("/ShowSaveMessage", MY_G_BOOL_VAL("prefs_warning_save"));
1120 cfg->Write("/ShowExposureWarning", MY_G_BOOL_VAL("prefs_warning_exposure"));
1121 cfg->Write("/ShowFisheyeCropHint", MY_G_BOOL_VAL("prefs_warning_fisheye_crop"));
1122 cfg->Write("/EditCPAfterAction", MY_G_CHOICE_VAL("pref_editcp_action"));
1123
1124 cfg->Flush();
1126}
1127
1139
1141{
1143 int selection=m_CPDetectorList->GetSelection();
1144 if (selection == wxNOT_FOUND)
1145 {
1146 hugin_utils::HuginMessageBox(_("Please select an entry first"), _("Hugin"), wxOK | wxICON_EXCLAMATION, this);
1147 }
1148 else
1149 {
1150 autopano_dlg.UpdateFields(&cpdetector_config_edit, selection);
1151 if(autopano_dlg.ShowModal()==wxOK)
1152 {
1153 autopano_dlg.UpdateSettings(&cpdetector_config_edit, selection);
1155 m_CPDetectorList->SetSelection(selection);
1156 };
1157 }
1158};
1159
1161{
1162 unsigned int selection=m_CPDetectorList->GetSelection();
1163 if(m_CPDetectorList->GetCount()==1)
1164 {
1165 hugin_utils::HuginMessageBox(_("You can't delete the last setting.\nAt least one setting is required."), _("Hugin"), wxOK | wxICON_EXCLAMATION, this);
1166 }
1167 else
1168 {
1169 if (hugin_utils::HuginMessageBox(wxString::Format(_("Do you really want to remove control point detector setting \"%s\"?"), cpdetector_config_edit.settings[selection].GetCPDetectorDesc()),
1170 _("Hugin"), wxYES_NO | wxICON_QUESTION, this) == wxYES)
1171 {
1173 {
1175 }
1176 cpdetector_config_edit.settings.RemoveAt(selection);
1178 if(selection>=m_CPDetectorList->GetCount())
1179 {
1180 selection=m_CPDetectorList->GetCount()-1;
1181 }
1182 m_CPDetectorList->SetSelection(selection);
1183 };
1184 };
1185};
1186
1188{
1189 unsigned int selection=m_CPDetectorList->GetSelection();
1190 if(selection>0)
1191 {
1192 cpdetector_config_edit.Swap(selection-1);
1194 m_CPDetectorList->SetSelection(selection-1);
1195 };
1196};
1197
1199{
1200 unsigned int selection=m_CPDetectorList->GetSelection();
1201 if(selection<m_CPDetectorList->GetCount()-1)
1202 {
1203 cpdetector_config_edit.Swap(selection);
1205 m_CPDetectorList->SetSelection(selection+1);
1206 };
1207};
1208
1210{
1211 unsigned int selection=m_CPDetectorList->GetSelection();
1213 {
1216 m_CPDetectorList->SetSelection(selection);
1217 };
1218};
1219
1221{
1222 wxFileDialog dlg(this,_("Load control point detector settings"),
1223 wxConfigBase::Get()->Read("/actualPath",wxEmptyString), wxEmptyString,
1224 _("Control point detector settings (*.setting)|*.setting"),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
1225 if (dlg.ShowModal() == wxID_OK)
1226 {
1227 wxConfig::Get()->Write("/actualPath", dlg.GetDirectory()); // remember for later
1228 wxString fn = dlg.GetPath();
1232 };
1233};
1234
1236{
1237 wxFileDialog dlg(this,_("Save control point detector settings"),
1238 wxConfigBase::Get()->Read("/actualPath",wxEmptyString), wxEmptyString,
1239 _("Control point detector settings (*.setting)|*.setting"),wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
1240 if (dlg.ShowModal() == wxID_OK)
1241 {
1242 wxConfig::Get()->Write("/actualPath", dlg.GetDirectory()); // remember for later
1243 wxString fn = dlg.GetPath();
1244#ifndef __WXMSW__
1245 //append extension if not given
1246 //not necessary on Windows, the wxFileDialog appends it automatic
1247 if(fn.Right(8)!=".setting")
1248 {
1249 fn.Append(".setting");
1250 };
1251#endif
1253 };
1254};
1255
1257{
1259};
1260
1262{
1263 int i=MY_G_CHOICE_VAL("pref_ldr_output_file_format");
1264 XRCCTRL(*this,"pref_tiff_compression_label",wxStaticText)->Show(i==0);
1265 XRCCTRL(*this,"pref_tiff_compression",wxChoice)->Show(i==0);
1266 XRCCTRL(*this,"pref_jpeg_quality_label",wxStaticText)->Show(i==1);
1267 XRCCTRL(*this,"pref_jpeg_quality",wxSpinCtrl)->Show(i==1);
1268 XRCCTRL(*this,"pref_tiff_compression",wxChoice)->GetParent()->Layout();
1269};
1270
1272{
1274};
1275
1277{
1278 int i=MY_G_CHOICE_VAL("pref_processor_gui");
1279 XRCCTRL(*this,"pref_processor_start",wxCheckBox)->Enable(i==0);
1280 XRCCTRL(*this,"pref_processor_verbose",wxCheckBox)->Enable(i==0);
1281 switch(i)
1282 {
1283 case 0:
1284 //PTBatcherGUI
1285 {
1286 wxConfigBase* config=wxConfigBase::Get();
1287 XRCCTRL(*this,"pref_processor_start",wxCheckBox)->SetValue(config->Read("/Processor/start", HUGIN_PROCESSOR_START) == 1);
1288 XRCCTRL(*this,"pref_processor_verbose",wxCheckBox)->SetValue(config->Read("/Processor/verbose", HUGIN_PROCESSOR_VERBOSE) == 1);
1289 }
1290 break;
1291 case 1:
1292 //Hugin_stitch_project
1293 XRCCTRL(*this,"pref_processor_start",wxCheckBox)->SetValue(true);
1294 XRCCTRL(*this,"pref_processor_verbose",wxCheckBox)->SetValue(true);
1295 break;
1296 };
1297};
1298
1300{
1302};
1303
1305{
1306 const int blender = MY_G_CHOICE_VAL("pref_default_blender");
1307 XRCCTRL(*this, "pref_internal_blender_seam_label", wxStaticText)->Show(blender == 1);
1308 wxChoice* seamChoice = XRCCTRL(*this, "pref_internal_blender_seam", wxChoice);
1309 seamChoice->Show(blender == 1);
1310 seamChoice->Enable(blender == 1);
1311};
1312
1314{
1315 XRCCTRL(*this, "prefs_project_filename_preview", wxStaticText)->SetLabel(
1316 getDefaultProjectName(MainFrame::Get()->getPanorama(), XRCCTRL(*this, "prefs_project_filename", wxTextCtrl)->GetValue())
1317 );
1318};
1319
1321{
1322 XRCCTRL(*this, "prefs_output_filename_preview", wxStaticText)->SetLabel(
1323 getDefaultOutputName(MainFrame::Get()->getProjectName(), MainFrame::Get()->getPanorama(), XRCCTRL(*this, "prefs_output_filename", wxTextCtrl)->GetValue())
1324 );
1325};
1326
1328{
1329 //enable/disable button related to user defined output options of assistant
1330 XRCCTRL(*this, "pref_ass_change_output", wxButton)->Enable(XRCCTRL(*this, "pref_ass_output", wxCheckBox)->IsChecked());
1331}
1332
1334{
1335 // show dialog to change user defined output options of assistant
1337 dlg.ShowModal();
1338}
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:83
size_t GetSelectedValue(wxControlWithItems *list)
Returns the client value of the selected item from list.
void FillInterpolatorList(wxControlWithItems *list)
Fill a wxControlWithItem with all possible interpolators.
Definition LensTools.cpp:91
void SelectListValue(wxControlWithItems *list, size_t newValue)
Selects the given value (stored in the client data) in the given list item.
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_SELECTED_CHOICE_VAL(id)
#define MY_G_BOOL_VAL(id)
#define MY_SELECTED_CHOICE_VAL(id, val)
#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:639
#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.