Hugin trunk 0.1
Loading...
Searching...
No Matches
MainFrame.cpp
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
2
27#include "hugin_config.h"
28
29#include <wx/dir.h>
30#include <wx/stdpaths.h>
31#include <wx/wfstream.h>
32#include "panoinc_WX.h"
33#include "panoinc.h"
34
35#include "base_wx/platform.h"
36#include "base_wx/wxPlatform.h"
37#include "base_wx/wxutils.h"
38
39#include "vigra/imageinfo.hxx"
41
44#include "hugin/MainFrame.h"
47#include "hugin/PanoPanel.h"
48#include "hugin/ImagesPanel.h"
50#include "hugin/OptimizePanel.h"
52#include "hugin/PreviewFrame.h"
54#include "hugin/huginApp.h"
55#include "hugin/CPEditorPanel.h"
56#include "hugin/CPListFrame.h"
59#include "hugin/PanoOperation.h"
61
65#include "base_wx/PTWXDlg.h"
69
70#include "base_wx/huginConfig.h"
71#include "hugin/AboutDialog.h"
72#include "hugin/RawImport.h"
73#include "hugin/BrowseDialog.h"
74
75#if HUGIN_HSI
76#include "PluginItems.h"
77#endif
78
79#ifdef __MINGW32__
80// fixes for mingw compilation...
81#undef FindWindow
82#endif
83
88class HuginSplashScreen : public wxFrame
89{
90public:
92 HuginSplashScreen(wxWindow* parent, wxBitmap bitmap) :
94 {
97 bitmap.SetScaleFactor(GetDPIScaleFactor());
101 SetClientSize(bitmap.GetWidth(), bitmap.GetHeight());
103 Show(true);
104 SetFocus();
105#if defined(__WXMSW__) || defined(__WXMAC__)
106 Update();
107#elif defined(__WXGTK20__)
108 //do nothing
109#else
111#endif
112 };
114};
115
117
118
120{
121 DEBUG_TRACE("OnDropFiles");
123 if (!mf) return false;
124
125 if (!m_imageOnly && filenames.GetCount() == 1) {
126 wxFileName file(filenames[0]);
127 if (file.GetExt().CmpNoCase("pto") == 0 ||
128 file.GetExt().CmpNoCase("ptp") == 0 ||
129 file.GetExt().CmpNoCase("pts") == 0 )
130 {
131 // load project
132 if (mf->CloseProject(true, MainFrame::LOAD_NEW_PROJECT))
133 {
134 mf->LoadProjectFile(file.GetFullPath());
135 // remove old images from cache
137 }
138 return true;
139 }
140 }
141
142 // try to add as images
143 std::vector<std::string> filesv;
144 std::vector<std::string> rawFilesv;
146 for (unsigned int i=0; i< filenames.GetCount(); i++) {
147 wxFileName file(filenames[i]);
148 // first check if raw file
149 // vigra::isImage reports also some raw files as image because
150 // technical some of them are tiff files
151 if (IsRawExtension(file.GetExt()))
152 {
154 {
155 invalidFiles.Add(file.GetFullPath());
156 }
157 else
158 {
159 rawFilesv.push_back((const char *)file.GetFullPath().mb_str(HUGIN_CONV_FILENAME));
160 };
161 }
162 else
163 {
164 // now check if drop file is a image
165 if (vigra::isImage(file.GetFullPath().mb_str(HUGIN_CONV_FILENAME)))
166 {
168 {
169 invalidFiles.Add(file.GetFullPath());
170 }
171 else
172 {
173 filesv.push_back((const char *)filenames[i].mb_str(HUGIN_CONV_FILENAME));
174 };
175 };
176 };
177 }
178 // show warning about invalid file names
179 if (!invalidFiles.empty())
180 {
182 }
183 // we got some images to add.
184 if (!filesv.empty())
185 {
186 // use a Command to ensure proper undo and updating of GUI parts
187 wxBusyCursor();
188 if(pano.getNrOfCtrlPoints()>0)
189 {
191 }
192 else
193 {
194 std::vector<PanoCommand::PanoCommand*> cmds;
195 cmds.push_back(new PanoCommand::wxAddImagesCmd(pano, filesv));
196 cmds.push_back(new PanoCommand::DistributeImagesCmd(pano));
197 cmds.push_back(new PanoCommand::CenterPanoCmd(pano));
199 };
200 };
201 if (!rawFilesv.empty())
202 {
203 if (rawFilesv.size() == 1)
204 {
205 hugin_utils::MessageDialog message = hugin_utils::GetMessageDialog(_("You selected only one raw file. This is not recommended.\nAll raw files should be converted at once."),
206 _("Hugin"), wxICON_EXCLAMATION | wxOK | wxCANCEL, mf);
207 message->SetOKLabel(_("Convert anyway."));
208 if (message->ShowModal() != wxID_OK)
209 {
210 return true;
211 };
212 };
214 // check that raw files are from same camera and that all can be read
215 if (dlg.CheckRawFiles())
216 {
217 // now show dialog
218 if (dlg.ShowModal() == wxID_OK)
219 {
221 };
222 };
223 };
224 return true;
225}
226
228
229enum
230{
235
237 : cp_frame(0), pano(pano)
238{
239 preview_frame = 0;
241
242 bool disableOpenGL=false;
244 {
245 wxDialog dlg;
246 wxXmlResource::Get()->LoadDialog(&dlg, NULL, "disable_opengl_dlg");
247 long noOpenGL=wxConfigBase::Get()->Read("DisableOpenGL", 0l);
248 if(noOpenGL==1)
249 {
250 XRCCTRL(dlg, "disable_dont_ask_checkbox", wxCheckBox)->SetValue(true);
251 };
252 if(dlg.ShowModal()==wxID_OK)
253 {
254 if(XRCCTRL(dlg, "disable_dont_ask_checkbox", wxCheckBox)->IsChecked())
255 {
256 wxConfigBase::Get()->Write("DisableOpenGL", 1l);
257 }
258 else
259 {
260 wxConfigBase::Get()->Write("DisableOpenGL", 0l);
261 };
262 disableOpenGL=true;
263 }
264 else
265 {
266 wxConfigBase::Get()->Write("DisableOpenGL", 0l);
267 };
268 }
269 else
270 {
271 long noOpenGL=wxConfigBase::Get()->Read("DisableOpenGL", 0l);
273 };
274
275 wxBitmap bitmap;
277 wxYield();
278
279 if (bitmap.LoadFile(huginApp::Get()->GetXRCPath() + "data/splash.png", wxBITMAP_TYPE_PNG))
280 {
281 // embed package version into string.
282 {
284 dc.SelectObject(bitmap);
285#ifdef __WXMAC__
287#else
289#endif
290 dc.SetFont(font);
291 dc.SetTextForeground(*wxBLACK);
292 dc.SetTextBackground(*wxWHITE);
293 int tw, th;
296 dc.GetTextExtent(version, &tw, &th);
297 // place text on bitmap.
298 dc.DrawText(version, bitmap.GetWidth() - tw - 3, bitmap.GetHeight() - th - 3);
299 dc.SelectObject(wxNullBitmap);
300 }
301 splash = new HuginSplashScreen(NULL, bitmap);
302 } else {
303 wxLogFatalError(_("Fatal installation error\nThe file data/splash.png was not found at:") + huginApp::Get()->GetXRCPath());
304 abort();
305 }
306 //splash->Refresh();
307 wxYield();
308
309 // save our pointer
310 m_this = this;
311
312 DEBUG_TRACE("");
313 // load our children. some children might need special
314 // initialization. this will be done later.
315 wxXmlResource::Get()->LoadFrame(this, parent, "main_frame");
316 DEBUG_TRACE("");
317
318 // load our menu bar
319#ifdef __WXMAC__
320 wxApp::s_macAboutMenuItemId = XRCID("action_show_about");
321 wxApp::s_macPreferencesMenuItemId = XRCID("action_show_prefs");
322 wxApp::s_macExitMenuItemId = XRCID("action_exit_hugin");
323 wxApp::s_macHelpMenuTitleName = _("&Help");
324#endif
325 wxMenuBar* mainMenu=wxXmlResource::Get()->LoadMenuBar(this, "main_menubar");
326 m_menu_file_simple=wxXmlResource::Get()->LoadMenu("file_menu_simple");
327 m_menu_file_advanced=wxXmlResource::Get()->LoadMenu("file_menu_advanced");
328 mainMenu->Insert(0, m_menu_file_simple, _("&File"));
330 m_optOnlyActiveImages = (wxConfigBase::Get()->Read("/OptimizePanel/OnlyActiveImages", 1l) != 0);
331 m_optIgnoreLineCp = false;
332 // observe the panorama, this should be the first observer
333 pano.addObserver(this);
334
335#ifdef HUGIN_HSI
337 // the plugin menu will be generated dynamically
338 wxMenu *pluginMenu=new wxMenu();
339 // search for all .py files in plugins directory
340 wxDir dir(GetDataPath()+"plugins");
341 if (dir.IsOpened())
342 {
343 wxString filename;
344 bool cont = dir.GetFirst(&filename, "*.py", wxDIR_FILES | wxDIR_HIDDEN);
346 while (cont)
347 {
348 wxFileName file(dir.GetName(), filename);
349 file.MakeAbsolute();
350 PluginItem item(file);
351 if (item.IsAPIValid())
352 {
353 items.push_back(item);
354 };
355 cont = dir.GetNext(&filename);
356 };
358
360 for (PluginItems::const_iterator it = items.begin(); it != items.end(); ++it)
361 {
362 PluginItem item = *it;
363 int categoryID = pluginMenu->FindItem(item.GetCategory());
365 if (categoryID == wxNOT_FOUND)
366 {
367 categoryMenu = new wxMenu();
368 pluginMenu->AppendSubMenu(categoryMenu, item.GetCategory());
369 }
370 else
371 {
372 categoryMenu = pluginMenu->FindItem(categoryID)->GetSubMenu();
373 };
374 categoryMenu->Append(pluginID, item.GetName(), item.GetDescription());
375 m_plugins[pluginID] = item.GetFilename();
376 Bind(wxEVT_MENU, &MainFrame::OnPlugin, this, pluginID);
377 pluginID++;
378 };
379 // show the new menu
380 if (pluginMenu->GetMenuItemCount() > 0)
381 {
382 menubar->Insert(menubar->GetMenuCount() - 2, pluginMenu, _("&Actions"));
383 };
384 };
385#else
386 GetMenuBar()->Enable(XRCID("action_python_script"), false);
387#endif
388
389 // create tool bar
390 SetToolBar(wxXmlResource::Get()->LoadToolBar(this, "main_toolbar"));
391
392 // Disable tools by default
393 enableTools(false);
394
395 // put an "unknown" object in an xrc file and
396 // take as wxObject (second argument) the return value of wxXmlResource::Get
397 // finish the images_panel
398 DEBUG_TRACE("");
399
400 // image_panel
401 images_panel = XRCCTRL(*this, "images_panel_unknown", ImagesPanel);
404 DEBUG_TRACE("");
405
406 m_notebook = XRCCTRL((*this), "controls_notebook", wxNotebook);
407// m_notebook = ((wxNotebook*) ((*this).FindWindow(XRCID("controls_notebook"))));
408// m_notebook = ((wxNotebook*) (FindWindow(XRCID("controls_notebook"))));
410
411 // the mask panel
412 mask_panel = XRCCTRL(*this, "mask_panel_unknown", MaskEditorPanel);
415
416 // the pano_panel
417 DEBUG_TRACE("");
418 pano_panel = XRCCTRL(*this, "panorama_panel_unknown", PanoPanel);
421 pano_panel->panoramaChanged (pano); // initialize from pano
422
423 cpe = XRCCTRL(*this, "cp_editor_panel_unknown", CPEditorPanel);
424 assert(cpe);
425 cpe->Init(&pano);
426
427 opt_panel = XRCCTRL(*this, "optimizer_panel_unknown", OptimizePanel);
430 m_show_opt_panel=true;
431
432 opt_photo_panel = XRCCTRL(*this, "optimizer_photometric_panel_unknown", OptimizePhotometricPanel);
436
437 // generate list of most recently uses files and add it to menu
438 // needs to be initialized before the fast preview, there we call AddFilesToMenu()
439 wxConfigBase * config=wxConfigBase::Get();
440 m_mruFiles.Load(*config);
441 m_mruFiles.UseMenu(m_menu_file_advanced->FindItem(XRCID("menu_mru"))->GetSubMenu());
442
443 preview_frame = new PreviewFrame(this, pano);
444 if(disableOpenGL)
445 {
448 m_mruFiles.AddFilesToMenu();
449 }
450 else
451 {
453 };
454
455 // add saved user defined output sequences
456 {
457 wxArrayString files;
458 // search all .executor files, do not follow links
459 wxDir::GetAllFiles(GetDataPath()+"output", &files, "*.executor", wxDIR_FILES | wxDIR_HIDDEN | wxDIR_NO_FOLLOW);
460 const size_t nrAllUserSequences = files.size();
461 wxDir::GetAllFiles(hugin_utils::GetUserAppDataDir(), &files, "*.executor", wxDIR_FILES | wxDIR_HIDDEN | wxDIR_NO_FOLLOW);
462 if (!files.IsEmpty())
463 {
464 // we found some files
466 int outputMenuId=mainMenu->FindMenu(_("&Output"));
468 {
470 size_t i = 0;
471 for (auto file : files)
472 {
473 if (i > 0 && i == nrAllUserSequences && outputSequencesMenu->GetMenuItemCount() > 0)
474 {
475 outputSequencesMenu->AppendSeparator();
477 {
478 // add assistant to context menu on align button
480 };
481
482 };
484 if (inputStream.IsOk())
485 {
486 // read descriptions from file
490 if (help.IsEmpty())
491 {
492 help = wxString::Format(_("User defined sequence: %s"), file);
493 };
494 // add menu
495 if (!desc.IsEmpty())
496 {
497 outputSequencesMenu->Append(outputId, desc, help);
499 m_userOutput[outputId] = file;
501 {
502 // add output sequence to context menu on create button
504 };
505 ++outputId;
506 };
507 };
508 i++;
509 };
510 if ((outputSequencesMenu->GetMenuItemCount() == 1 && !(outputSequencesMenu->FindItemByPosition(0)->IsSeparator())) ||
511 outputSequencesMenu->GetMenuItemCount() > 1)
512 {
513 m_outputUserMenu = mainMenu->GetMenu(outputMenuId)->AppendSubMenu(outputSequencesMenu, _("User defined output sequences"));
514 }
515 else
516 {
517 delete outputSequencesMenu;
518 };
519 };
520 };
521 };
522 // add saved user defined assistants
523 {
524 wxArrayString files;
525 // search all .assistant files, do not follow links
526 wxDir::GetAllFiles(GetDataPath() + "assistant", &files, "*.assistant", wxDIR_FILES | wxDIR_HIDDEN | wxDIR_NO_FOLLOW);
527 const size_t nrAllUserSequences = files.size();
528 wxDir::GetAllFiles(hugin_utils::GetUserAppDataDir(), &files, "*.assistant", wxDIR_FILES | wxDIR_HIDDEN | wxDIR_NO_FOLLOW);
529 if (!files.IsEmpty())
530 {
531 // we found some files
533 const int editMenuId = mainMenu->FindMenu(_("&Edit"));
534 if (editMenuId != wxNOT_FOUND)
535 {
537 size_t i = 0;
538 for (auto file : files)
539 {
540 if (i > 0 && i == nrAllUserSequences && userAssistantMenu->GetMenuItemCount() > 0)
541 {
542 userAssistantMenu->AppendSeparator();
544 {
545 // add assistant to context menu on align button
547 };
548 };
550 if (inputStream.IsOk())
551 {
552 // read descriptions from file
556 help = help.Trim(true).Trim(false);
557 if (help.IsEmpty())
558 {
559 help = wxString::Format(_("User defined assistant: %s"), file);
560 };
561 // add menu
562 if (!desc.IsEmpty())
563 {
564 userAssistantMenu->Append(assistantId, desc, help);
568 {
569 // add assistant to context menu on align button
571 };
572 ++assistantId;
573 };
574 };
575 i++;
576 };
577 if (userAssistantMenu->GetMenuItemCount() > 0)
578 {
579 m_assistantUserMenu = mainMenu->GetMenu(editMenuId)->Insert(5, wxID_ANY, _("User defined assistant"), userAssistantMenu);
580 }
581 else
582 {
583 delete userAssistantMenu;
584 };
585 };
586 };
587 };
588
589
590 // set the minimize icon
591#ifdef __WXMSW__
592 wxIconBundle myIcons(GetXRCPath() + "data/hugin.ico", wxBITMAP_TYPE_ICO);
594#else
595 wxIcon myIcon(GetXRCPath() + "data/hugin.png",wxBITMAP_TYPE_PNG);
597#endif
598
599 // create a new drop handler. wxwindows deletes the automaticall
601 DEBUG_TRACE("");
602
604
605 // create a status bar
606 const int fields (2);
608 int widths[fields] = {-1, 85};
610 SetStatusText(_("Started"), 0);
611 wxYield();
612 DEBUG_TRACE("");
613
614 // Set sizing characteristics
615 //set minumum size
616#if defined __WXMAC__ || defined __WXMSW__
617 // a minimum nice looking size; smaller than this would clutter the layout.
618 SetSizeHints(900, 675);
619#else
620 // For ASUS eeePc
621 SetSizeHints(780, 455); //set minumum size
622#endif
623
624 // set progress display for image cache.
625 ImageCache::getInstance().setProgressDisplay(this);
626#if defined __WXMSW__
627 unsigned long long mem = HUGIN_IMGCACHE_UPPERBOUND;
628 unsigned long mem_low = wxConfigBase::Get()->Read("/ImageCache/UpperBound", HUGIN_IMGCACHE_UPPERBOUND);
629 unsigned long mem_high = wxConfigBase::Get()->Read("/ImageCache/UpperBoundHigh", (long) 0);
630 if (mem_high > 0) {
631 mem = ((unsigned long long) mem_high << 32) + mem_low;
632 }
633 else {
634 mem = mem_low;
635 }
636 ImageCache::getInstance().SetUpperLimit(mem);
637#else
638 ImageCache::getInstance().SetUpperLimit(wxConfigBase::Get()->Read("/ImageCache/UpperBound", HUGIN_IMGCACHE_UPPERBOUND));
639#endif
640
641 if(splash) {
642 splash->Close();
643 delete splash;
644 }
645 wxYield();
646
647 // disable automatic Layout() calls, to it by hand
648 SetAutoLayout(false);
650
651// By using /SUBSYSTEM:CONSOLE /ENTRY:"WinMainCRTStartup" in the linker
652// options for the debug build, a console window will be used for stdout
653// and stderr. No need to redirect to a file. Better security since we can't
654// guarantee that c: exists and writing a file to the root directory is
655// never a good idea. release build still uses /SUBSYSTEM:WINDOWS
656
657#if 0
658#ifdef DEBUG
659#ifdef __WXMSW__
660
661 freopen("c:\\hugin_stdout.txt", "w", stdout); // redirect stdout to file
662 freopen("c:\\hugin_stderr.txt", "w", stderr); // redirect stderr to file
663#endif
664#endif
665#endif
666 //reload gui level
668 long guiLevel=config->Read("/GuiLevel",(long)0);
669 guiLevel = std::max<long>(0, std::min<long>(2, guiLevel));
671 {
673 };
674 SetGuiLevel(static_cast<GuiLevel>(guiLevel));
675
676#ifndef __WXMSW__
677 // check settings of help window and fix when needed
679#endif
680 // bind handler for menu items
681 Bind(wxEVT_MENU, &MainFrame::OnNewProject, this, XRCID("action_new_project"));
682 Bind(wxEVT_MENU, &MainFrame::OnLoadProject, this, XRCID("action_load_project"));
683 Bind(wxEVT_MENU, &MainFrame::OnBrowseProjects, this, XRCID("action_browse_projects"));
684 Bind(wxEVT_MENU, &MainFrame::OnSaveProject, this, XRCID("action_save_project"));
685 Bind(wxEVT_MENU, &MainFrame::OnSaveProjectAs, this, XRCID("action_save_as_project"));
686 Bind(wxEVT_MENU, &MainFrame::OnSavePTStitcherAs, this, XRCID("action_save_as_ptstitcher"));
687 Bind(wxEVT_MENU, &MainFrame::OnOpenPTBatcher, this, XRCID("action_open_batch_processor"));
688 Bind(wxEVT_MENU, &MainFrame::OnMergeProject, this, XRCID("action_import_project"));
689 Bind(wxEVT_MENU, &MainFrame::OnReadPapywizard, this, XRCID("action_import_papywizard"));
690 Bind(wxEVT_MENU, &MainFrame::OnApplyTemplate, this, XRCID("action_apply_template"));
691 Bind(wxEVT_MENU, &MainFrame::OnUserQuit, this, XRCID("action_exit_hugin"));
692 for (int i = 0; i < 9; ++i)
693 {
695 }
696 Bind(wxEVT_MENU, &MainFrame::OnAbout, this, XRCID("action_show_about"));
697 Bind(wxEVT_MENU, &MainFrame::OnHelp, this, XRCID("action_show_help"));
698 Bind(wxEVT_MENU, &MainFrame::OnTipOfDay, this, XRCID("action_show_tip"));
699 Bind(wxEVT_MENU, &MainFrame::OnKeyboardHelp, this, XRCID("action_show_shortcuts"));
700 Bind(wxEVT_MENU, &MainFrame::OnFAQ, this, XRCID("action_show_faq"));
701 Bind(wxEVT_MENU, &MainFrame::OnShowPrefs, this, XRCID("action_show_prefs"));
702 Bind(wxEVT_MENU, &MainFrame::OnRunAssistant, this, XRCID("action_assistant"));
703 Bind(wxEVT_MENU, &MainFrame::OnSendToAssistantQueue, this, XRCID("action_batch_assistant"));
704 Bind(wxEVT_MENU, &MainFrame::OnSetGuiSimple, this, XRCID("action_gui_simple"));
705 Bind(wxEVT_MENU, &MainFrame::OnSetGuiAdvanced, this, XRCID("action_gui_advanced"));
706 Bind(wxEVT_MENU, &MainFrame::OnSetGuiExpert, this, XRCID("action_gui_expert"));
707#ifdef HUGIN_HSI
708 Bind(wxEVT_MENU, &MainFrame::OnPythonScript, this, XRCID("action_python_script"));
709#endif
710 Bind(wxEVT_MENU, &MainFrame::OnUndo, this, XRCID("ID_EDITUNDO"));
711 Bind(wxEVT_MENU, &MainFrame::OnRedo, this, XRCID("ID_EDITREDO"));
712 Bind(wxEVT_MENU, &MainFrame::OnFullScreen, this, XRCID("ID_SHOW_FULL_SCREEN"));
713 Bind(wxEVT_MENU, &MainFrame::OnTogglePreviewFrame, this, XRCID("ID_SHOW_PREVIEW_FRAME"));
714 Bind(wxEVT_MENU, &MainFrame::OnToggleGLPreviewFrame, this, XRCID("ID_SHOW_GL_PREVIEW_FRAME"));
715 Bind(wxEVT_BUTTON, &MainFrame::OnTogglePreviewFrame, this, XRCID("ID_SHOW_PREVIEW_FRAME"));
716 Bind(wxEVT_BUTTON, &MainFrame::OnToggleGLPreviewFrame, this, XRCID("ID_SHOW_GL_PREVIEW_FRAME"));
717
718 Bind(wxEVT_MENU, &MainFrame::OnOptimize, this, XRCID("action_optimize"));
719 Bind(wxEVT_MENU, &MainFrame::OnOnlyActiveImages, this, XRCID("action_optimize_only_active"));
720 Bind(wxEVT_MENU, &MainFrame::OnIgnoreLineCp, this, XRCID("action_optimize_ignore_line_cp"));
721 Bind(wxEVT_BUTTON, &MainFrame::OnOptimize, this, XRCID("action_optimize"));
722 Bind(wxEVT_MENU, &MainFrame::OnFineTuneAll, this, XRCID("action_finetune_all_cp"));
723 Bind(wxEVT_MENU, &MainFrame::OnRemoveCPinMasks, this, XRCID("action_remove_cp_in_masks"));
724
725 Bind(wxEVT_MENU, &MainFrame::OnShowCPFrame, this, XRCID("ID_CP_TABLE"));
726 Bind(wxEVT_BUTTON, &MainFrame::OnShowCPFrame, this, XRCID("ID_CP_TABLE"));
727
728 Bind(wxEVT_MENU, &MainFrame::OnShowPanel, this, XRCID("ID_SHOW_PANEL_IMAGES"));
729 Bind(wxEVT_MENU, &MainFrame::OnShowPanel, this, XRCID("ID_SHOW_PANEL_MASK"));
730 Bind(wxEVT_MENU, &MainFrame::OnShowPanel, this, XRCID("ID_SHOW_PANEL_CP_EDITOR"));
731 Bind(wxEVT_MENU, &MainFrame::OnShowPanel, this, XRCID("ID_SHOW_PANEL_OPTIMIZER"));
732 Bind(wxEVT_MENU, &MainFrame::OnShowPanel, this, XRCID("ID_SHOW_PANEL_OPTIMIZER_PHOTOMETRIC"));
733 Bind(wxEVT_MENU, &MainFrame::OnShowPanel, this, XRCID("ID_SHOW_PANEL_PANORAMA"));
734 Bind(wxEVT_MENU, &MainFrame::OnDoStitch, this, XRCID("action_stitch"));
735 Bind(wxEVT_MENU, &MainFrame::OnUserDefinedStitch, this, XRCID("action_stitch_userdefined"));
736 Bind(wxEVT_MENU, &MainFrame::OnAddImages, this, XRCID("action_add_images"));
737 Bind(wxEVT_BUTTON, &MainFrame::OnAddImages, this, XRCID("action_add_images"));
738 Bind(wxEVT_MENU, &MainFrame::OnAddTimeImages, this, XRCID("action_add_time_images"));
739 Bind(wxEVT_BUTTON, &MainFrame::OnAddTimeImages, this, XRCID("action_add_time_images"));
741 Bind(wxEVT_SIZE, &MainFrame::OnSize, this);
743
744 DEBUG_TRACE("");
745}
746
748{
749 DEBUG_TRACE("dtor");
751 {
753 }
754 else
755 {
756 delete m_menu_file_simple;
757 };
758 ImageCache::getInstance().setProgressDisplay(NULL);
759 delete & ImageCache::getInstance();
761// delete cpe;
762// delete images_panel;
763 DEBUG_DEBUG("removing observer");
764 pano.removeObserver(this);
765
766 // get the global config object
767 wxConfigBase* config = wxConfigBase::Get();
768
769 hugin_utils::StoreFramePosition(this, "MainFrame");
770
771 //store most recently used files
772 m_mruFiles.Save(*config);
773 //store gui level
774 config->Write("/GuiLevel",(long)m_guiLevel);
775 // store optimize only active images
776 config->Write("/OptimizePanel/OnlyActiveImages", m_optOnlyActiveImages ? 1l : 0l);
777
778 config->Flush();
779 if(svmModel!=NULL)
780 {
782 };
784
785 DEBUG_TRACE("dtor end");
786}
787
789{
790 // set flag to indicate list should show correlation instead of error
791 if (m_showCorrelation == 2)
792 {
794 if (!(lastCommand == "remove control point" || lastCommand == "remove control points"))
795 {
797 };
798 };
799 if (m_showCorrelation == 1)
800 {
802 };
806 theMenuBar->Enable (XRCID("ID_EDITUNDO"), can_undo);
807 theToolBar->EnableTool(XRCID("ID_EDITUNDO"), can_undo);
809 theMenuBar->Enable (XRCID("ID_EDITREDO"), can_redo);
810 theToolBar->EnableTool(XRCID("ID_EDITREDO"), can_redo);
811
812 //show or hide optimizer and exposure optimizer tab depending on optimizer master switches
814 {
815 m_notebook->InsertPage(3, opt_panel, _("Optimizer"));
816 m_show_opt_panel=true;
817 };
819 {
820 m_notebook->RemovePage(3);
821 m_show_opt_panel=false;
822 };
824 {
826 {
827 m_notebook->InsertPage(4, opt_photo_panel, _("Exposure"));
828 }
829 else
830 {
831 m_notebook->InsertPage(3, opt_photo_panel, _("Exposure"));
832 }
834 };
836 {
838 {
839 m_notebook->RemovePage(4);
840 }
841 else
842 {
843 m_notebook->RemovePage(3);
844 };
846 };
847 theMenuBar->Enable(XRCID("ID_SHOW_PANEL_OPTIMIZER"), m_show_opt_panel);
848 theMenuBar->Enable(XRCID("ID_SHOW_PANEL_OPTIMIZER_PHOTOMETRIC"), m_show_opt_photo_panel);
849}
850
851//void MainFrame::panoramaChanged(HuginBase::Panorama &panorama)
858
859void MainFrame::OnUserQuit(wxCommandEvent & e)
860{
861 Close();
862}
863
865{
866 if (pano.isDirty()) {
868 switch (reason)
869 {
870 case LOAD_NEW_PROJECT:
871 messageString = _("Save changes to the project file before opening another project?");
872 break;
873 case NEW_PROJECT:
874 messageString = _("Save changes to the project file before starting a new project?");
875 break;
876 case CLOSE_PROGRAM:
877 default:
878 messageString = _("Save changes to the project file before closing?");
879 break;
880 };
882 switch(reason)
883 {
884 case LOAD_NEW_PROJECT:
885 message->SetExtendedMessage(_("If you load another project without saving, your changes since last save will be discarded."));
886 break;
887 case NEW_PROJECT:
888 message->SetExtendedMessage(_("If you start a new project without saving, your changes since last save will be discarded."));
889 break;
890 case CLOSE_PROGRAM:
891 default:
892 message->SetExtendedMessage(_("If you close without saving, your changes since your last save will be discarded."));
893 break;
894 };
895 #if defined __WXMAC__ || defined __WXMSW__
896 // Apple human interface guidelines and Windows user experience interaction guidelines
897 message->SetYesNoLabels(wxID_SAVE, _("Do&n't Save"));
898 #else
899 // Gnome human interface guidelines:
900 message->SetYesNoLabels(wxID_SAVE, _("&Close without saving"));
901 #endif
902 const int answer = message->ShowModal();
903 switch (answer)
904 {
905 case wxID_YES:
906 {
907 wxCommandEvent dummy;
909 return !pano.isDirty();
910 }
911 case wxID_CANCEL:
912 return false;
913 default: //no save
914 return true;
915 }
916 }
917 else return true;
918}
919
921{
922 DEBUG_TRACE("");
924 {
925 if(!CloseProject(e.CanVeto(), CLOSE_PROGRAM))
926 {
927 if (e.CanVeto())
928 {
929 e.Veto();
930 return;
931 }
932 wxLogError(_("forced close"));
933 }
934 }
935 else
936 {
937 if(e.CanVeto())
938 {
939 Hide();
940 e.Veto();
941 return;
942 };
943 };
944
945 if(preview_frame)
946 {
947 preview_frame->Close(true);
948 }
950 {
952 {
954 }
955 else
956 {
957 gl_preview_frame->Close(true);
958 };
959 }
960
961 ImageCache::getInstance().flush();
962 Destroy();
963 DEBUG_TRACE("");
964}
965
966void MainFrame::OnSaveProject(wxCommandEvent & e)
967{
968 DEBUG_TRACE("");
969 try {
971 if (m_filename == wxEmptyString) {
974 } else {
975 // the project file is just a PTOptimizer script...
976 DEBUG_DEBUG("stripping " << path << " from image filenames");
977 const std::string script(scriptName.GetFullPath().mb_str(HUGIN_CONV_FILENAME));
979
980 SetStatusText(wxString::Format(_("saved project %s"), m_filename.c_str()),0);
982 {
984 {
985 gl_preview_frame->SetTitle(scriptName.GetName() + "." + scriptName.GetExt() + " - " + _("Hugin - Panorama Creator"));
986 };
987 SetTitle(scriptName.GetName() + "." + scriptName.GetExt() + " - " + _("Panorama editor"));
988 }
989 else
990 {
991 SetTitle(scriptName.GetName() + "." + scriptName.GetExt() + " - " + _("Hugin - Panorama Creator"));
992 };
993
995 }
996 } catch (std::exception & e) {
997 wxString err(e.what(), wxConvLocal);
998 hugin_utils::HuginMessageBox(wxString::Format(_("Could not save project file \"%s\".\nMaybe the file or the folder is read-only.\n\n(Error code: %s)"),m_filename,err),
999 _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
1000 }
1001}
1002
1003void MainFrame::OnSaveProjectAs(wxCommandEvent & e)
1004{
1005 DEBUG_TRACE("");
1007 if (m_filename.IsEmpty())
1008 {
1009 scriptName.Assign(getDefaultProjectName(pano) + ".pto");
1010 }
1011 else
1012 {
1014 };
1017 _("Save project file"),
1018 scriptName.GetPath(), scriptName.GetFullName(),
1019 _("Project files (*.pto)|*.pto|All files (*)|*"),
1021 if (dlg.ShowModal() == wxID_OK) {
1022 wxConfig::Get()->Write("/actualPath", dlg.GetDirectory()); // remember for later
1023 wxString fn = dlg.GetPath();
1024 if (fn.Right(4).CmpNoCase(".pto")!=0)
1025 {
1026 fn.Append(".pto");
1027 if (wxFile::Exists(fn)) {
1029 {
1030 return;
1031 }
1032 }
1033 }
1034 m_filename = fn;
1035 m_mruFiles.AddFileToHistory(m_filename);
1036 OnSaveProject(e);
1037 }
1038}
1039
1040void MainFrame::OnSavePTStitcherAs(wxCommandEvent & e)
1041{
1042 DEBUG_TRACE("");
1044 if (m_filename == wxEmptyString) {
1046 }
1048 wxString fn = scriptNameFN.GetName() + ".txt";
1050 _("Save PTmender script file"),
1051 wxConfigBase::Get()->Read("/actualPath",wxEmptyString), fn,
1052 _("PTmender files (*.txt)|*.txt"),
1054 if (dlg.ShowModal() == wxID_OK) {
1055 wxString fname = dlg.GetPath();
1056 // the project file is just a PTStitcher script...
1059 if (pano.getNrOfImages() > 0) {
1060 fill_set(all, 0, pano.getNrOfImages()-1);
1061 }
1062 std::ofstream script(scriptName.GetFullPath().mb_str(HUGIN_CONV_FILENAME));
1064 script.close();
1065 }
1066
1067}
1068
1070{
1071 DEBUG_TRACE("");
1072
1073 // remove old images from cache
1074 // hmm probably not a good idea, if the project is reloaded..
1075 // ImageCache::getInstance().flush();
1076
1077 SetStatusText( _("Open project: ") + filename);
1078
1079 wxFileName fname(filename);
1081 if (fname.IsOk() && fname.FileExists())
1082 {
1083 m_filename = filename;
1087 new PanoCommand::wxLoadPTProjectCmd(pano, (const char *)filename.mb_str(HUGIN_CONV_FILENAME), (const char *)path.mb_str(HUGIN_CONV_FILENAME), true)
1088 );
1089 if (!PanoCommand::GlobalCmdHist::getInstance().getLastCommand()->wasSuccessful())
1090 {
1091 hugin_utils::HuginMessageBox(wxString::Format(_("Could not load project file \"%s\".\nIt is not a valid pto file."), filename), _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
1095 return;
1096 };
1099 DEBUG_DEBUG("project contains " << pano.getNrOfImages() << " after load");
1102 {
1104 };
1105 if (pano.getNrOfImages() > 0)
1106 {
1107 SetStatusText(_("Project opened"));
1108 m_mruFiles.AddFileToHistory(fname.GetFullPath());
1109 if (m_guiLevel == GUI_SIMPLE)
1110 {
1111 if (gl_preview_frame)
1112 {
1113 gl_preview_frame->SetTitle(fname.GetName() + "." + fname.GetExt() + " - " + _("Hugin - Panorama Stitcher"));
1114 };
1115 SetTitle(fname.GetName() + "." + fname.GetExt() + " - " + _("Panorama editor"));
1116 }
1117 else
1118 {
1119 SetTitle(fname.GetName() + "." + fname.GetExt() + " - " + _("Hugin - Panorama Stitcher"));
1120 };
1121 }
1122 else
1123 {
1124 SetStatusText(_("Loading canceled"));
1125 m_filename = "";
1126 if (m_guiLevel == GUI_SIMPLE)
1127 {
1128 if (gl_preview_frame)
1129 {
1130 gl_preview_frame->SetTitle(_("Hugin - Panorama Stitcher"));
1131 };
1132 SetTitle(_("Panorama editor"));
1133 }
1134 else
1135 {
1136 SetTitle(_("Hugin - Panorama Stitcher"));
1137 };
1138 };
1139 if (! (fname.GetExt() == "pto")) {
1140 // do not remember filename if its not a hugin project
1141 // to avoid overwriting the original project with an
1142 // incompatible one
1144 }
1145 // get the global config object
1146 wxConfigBase* config = wxConfigBase::Get();
1147 config->Write("/actualPath", path); // remember for later
1148 } else {
1149 SetStatusText( _("Error opening project: ") + filename);
1150 DEBUG_ERROR("Could not open file " << filename);
1151 }
1152
1153 // force update of preview window
1154 if ( !(preview_frame->IsIconized() ||(! preview_frame->IsShown()) ) ) {
1155 wxCommandEvent dummy;
1157 };
1158 if (gl_preview_frame)
1159 {
1161 };
1162}
1163
1164#ifdef __WXMAC__
1165void MainFrame::MacOnOpenFile(const wxString & filename)
1166{
1167 if(!CloseProject(true, LOAD_NEW_PROJECT)) return; //if closing old project is canceled do nothing.
1168
1169 ImageCache::getInstance().flush();
1170 LoadProjectFile(filename);
1171}
1172#endif
1173
1174void MainFrame::OnLoadProject(wxCommandEvent & e)
1175{
1176 DEBUG_TRACE("");
1177
1178 if(CloseProject(true, LOAD_NEW_PROJECT)) //if closing old project is canceled do nothing.
1179 {
1180 // get the global config object
1181 wxConfigBase* config = wxConfigBase::Get();
1182
1183 wxString defaultdir = config->Read("/actualPath",wxEmptyString);
1185 _("Open project file"),
1187 _("Project files (*.pto)|*.pto|All files (*)|*"),
1189 dlg.SetDirectory(defaultdir);
1190 if (dlg.ShowModal() == wxID_OK)
1191 {
1192 wxString filename = dlg.GetPath();
1193 if(vigra::isImage(filename.mb_str(HUGIN_CONV_FILENAME)))
1194 {
1195 if (hugin_utils::HuginMessageBox(wxString::Format(_("File %s is an image file and not a project file.\nThis file can't be open with File, Open.\nDo you want to add this image file to the current project?"), filename.c_str()),
1197 {
1199 filenameArray.Add(filename);
1201 };
1202 return;
1203 }
1204 else
1205 {
1206 // remove old images from cache
1207 ImageCache::getInstance().flush();
1208
1209 LoadProjectFile(filename);
1210 return;
1211 };
1212 }
1213 }
1214 // do not close old project
1215 // nothing to open
1216 SetStatusText( _("Open project: cancel"));
1217}
1218
1219void MainFrame::OnBrowseProjects(wxCommandEvent& e)
1220{
1221 // first check if there are unsaved changes
1222 if (CloseProject(true, LOAD_NEW_PROJECT))
1223 {
1224 // remove old images from cache
1225 ImageCache::getInstance().flush();
1226 // get the global config object
1227 wxConfigBase* config = wxConfigBase::Get();
1228 // show dialog
1229 BrowsePTOFilesDialog dialog(this, config->Read("/actualPath", ""));
1230 if (dialog.ShowModal() == wxID_OK)
1231 {
1232 // open newly selected file
1233 LoadProjectFile(dialog.GetSelectedProject());
1234 // remember path for later
1235 config->Write("/actualPath", dialog.GetSelectedPath());
1236 };
1237 };
1238}
1239
1240void MainFrame::OnNewProject(wxCommandEvent & e)
1241{
1242 if(!CloseProject(true, NEW_PROJECT)) return; //if closing current project is canceled
1243
1247 // remove old images from cache
1248 ImageCache::getInstance().flush();
1250 {
1252 {
1253 gl_preview_frame->SetTitle(_("Hugin - Panorama Stitcher"));
1254 };
1255 SetTitle(_("Panorama editor"));
1256 }
1257 else
1258 {
1259 SetTitle(_("Hugin - Panorama Stitcher"));
1260 };
1261
1262 wxCommandEvent dummy;
1264 if (gl_preview_frame)
1265 {
1267 };
1268}
1269
1270void MainFrame::OnAddImages( wxCommandEvent& event )
1271{
1272 DEBUG_TRACE("");
1274 HuginBase::UIntSet images;
1276 if(cmd!=NULL)
1277 {
1279 };
1280
1281 DEBUG_TRACE("");
1282}
1283
1285{
1287 for(unsigned int i=0;i<filenameArray.GetCount(); i++)
1288 {
1290 {
1292 };
1293 };
1294 if(!invalidFiles.empty())
1295 {
1297 }
1298 else
1299 {
1300 std::vector<std::string> filesv;
1301 for (unsigned int i=0; i< filenameArray.GetCount(); i++) {
1302 filesv.push_back((const char *)filenameArray[i].mb_str(HUGIN_CONV_FILENAME));
1303 }
1304
1305 // we got some images to add.
1306 if (!filesv.empty()) {
1307 // use a Command to ensure proper undo and updating of GUI
1308 // parts
1309 wxBusyCursor();
1312 );
1313 };
1314 };
1315};
1316
1327
1328void MainFrame::OnShowPanel(wxCommandEvent & e)
1329{
1330 if(e.GetId()==XRCID("ID_SHOW_PANEL_MASK"))
1331 m_notebook->SetSelection(1);
1332 else
1333 if(e.GetId()==XRCID("ID_SHOW_PANEL_CP_EDITOR"))
1334 m_notebook->SetSelection(2);
1335 else
1336 if(e.GetId()==XRCID("ID_SHOW_PANEL_OPTIMIZER"))
1337 m_notebook->SetSelection(3);
1338 else
1339 if(e.GetId()==XRCID("ID_SHOW_PANEL_OPTIMIZER_PHOTOMETRIC"))
1340 {
1342 {
1343 m_notebook->SetSelection(4);
1344 }
1345 else
1346 {
1347 m_notebook->SetSelection(3);
1348 };
1349 }
1350 else
1351 if(e.GetId()==XRCID("ID_SHOW_PANEL_PANORAMA"))
1352 {
1354 {
1355 m_notebook->SetSelection(5);
1356 }
1357 else
1358 {
1360 {
1361 m_notebook->SetSelection(4);
1362 }
1363 else
1364 {
1365 m_notebook->SetSelection(3);
1366 };
1367 };
1368 }
1369 else
1370 m_notebook->SetSelection(0);
1371}
1372
1373void MainFrame::OnLoadingFailed(wxCommandEvent & e)
1374{
1375 // check if file exists
1376 if (wxFileExists(e.GetString()))
1377 {
1378 // file exists, but could not loaded
1379 hugin_utils::HuginMessageBox(wxString::Format(_("Could not load image \"%s\".\nThis file is not a valid image.\nThis file will be removed from the project."), e.GetString()),
1380 _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
1381 }
1382 else
1383 {
1384 // file does not exists
1385 hugin_utils::HuginMessageBox(wxString::Format(_("Could not load image \"%s\".\nThis file was renamed, deleted or is on a non-accessible drive.\nThis file will be removed from the project."), e.GetString()),
1386 _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
1387 };
1388 // now remove the file from the pano
1389 const std::string filename(e.GetString().mb_str(HUGIN_CONV_FILENAME));
1391 for (size_t i = 0; i < pano.getNrOfImages(); ++i)
1392 {
1393 if (pano.getImage(i).getFilename() == filename)
1394 {
1395 imagesToRemove.insert(i);
1396 };
1397 };
1398 if (!imagesToRemove.empty())
1399 {
1401 };
1402}
1403
1404
1405void MainFrame::OnAbout(wxCommandEvent & e)
1406{
1408 dlg.ShowModal();
1409}
1410
1411/*
1412void MainFrame::OnAbout(wxCommandEvent & e)
1413{
1414 DEBUG_TRACE("");
1415 wxDialog dlg;
1416 wxString strFile;
1417 wxString langCode;
1418
1419 wxXmlResource::Get()->LoadDialog(&dlg, this, "about_dlg");
1420
1421#if __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
1422 //rely on the system's locale choice
1423 strFile = MacGetPathToBundledResourceFile(CFSTR("about.htm"));
1424 if(strFile!=wxEmptyString) XRCCTRL(dlg,"about_html",wxHtmlWindow)->LoadPage(strFile);
1425#else
1426 //if the language is not default, load custom About file (if exists)
1427 langCode = huginApp::Get()->GetLocale().GetName().Left(2).Lower();
1428 DEBUG_INFO("Lang Code: " << langCode.mb_str(wxConvLocal));
1429 if(langCode != wxString("en"))
1430 {
1431 strFile = GetXRCPath() + "data/about_" + langCode + ".htm";
1432 if(wxFile::Exists(strFile))
1433 {
1434 DEBUG_TRACE("Using About: " << strFile.mb_str(wxConvLocal));
1435 XRCCTRL(dlg,"about_html",wxHtmlWindow)->LoadPage(strFile);
1436 }
1437 }
1438#endif
1439 dlg.ShowModal();
1440}
1441*/
1442
1443void MainFrame::OnHelp(wxCommandEvent & e)
1444{
1445 DisplayHelp();
1446}
1447
1448void MainFrame::OnKeyboardHelp(wxCommandEvent & e)
1449{
1450 DisplayHelp("Hugin_Keyboard_shortcuts.html");
1451}
1452
1453void MainFrame::OnFAQ(wxCommandEvent & e)
1454{
1455 DisplayHelp("Hugin_FAQ.html");
1456}
1457
1458
1460{
1461 if (section.IsEmpty())
1462 {
1463 GetHelpController().DisplayContents();
1464 }
1465 else
1466 {
1467 GetHelpController().DisplaySection(section);
1468 };
1469}
1470
1471void MainFrame::OnTipOfDay(wxCommandEvent& WXUNUSED(e))
1472{
1474 bool bShowAtStartup;
1475// DGSW FIXME - Unreferenced
1476// bool bTipsExist = false;
1477 int nValue;
1478
1479 wxConfigBase * config = wxConfigBase::Get();
1480 nValue = config->Read("/MainFrame/ShowStartTip",1l);
1481
1482 //TODO: tips not localisable
1483 DEBUG_INFO("Tip index: " << nValue);
1484 strFile = GetXRCPath() + "data/tips.txt"; //load default file
1485
1486 DEBUG_INFO("Reading tips from " << strFile.mb_str(wxConvLocal));
1487 wxTipProvider *tipProvider = new LocalizedFileTipProvider(strFile, nValue);
1489
1490 //store startup preferences
1491 nValue = (bShowAtStartup ? tipProvider->GetCurrentTip() : 0);
1492 DEBUG_INFO("Writing tip index: " << nValue);
1493 config->Write("/MainFrame/ShowStartTip", nValue);
1494 delete tipProvider;
1495}
1496
1497
1498void MainFrame::OnShowPrefs(wxCommandEvent & e)
1499{
1500 DEBUG_TRACE("");
1502 pref_dlg.ShowModal();
1503 //update image cache size
1504 wxConfigBase* cfg=wxConfigBase::Get();
1505#if defined __WXMSW__
1506 unsigned long long mem = HUGIN_IMGCACHE_UPPERBOUND;
1507 unsigned long mem_low = cfg->Read("/ImageCache/UpperBound", HUGIN_IMGCACHE_UPPERBOUND);
1508 unsigned long mem_high = cfg->Read("/ImageCache/UpperBoundHigh", (long) 0);
1509 if (mem_high > 0)
1510 {
1511 mem = ((unsigned long long) mem_high << 32) + mem_low;
1512 }
1513 else
1514 {
1515 mem = mem_low;
1516 }
1517 ImageCache::getInstance().SetUpperLimit(mem);
1518#else
1519 ImageCache::getInstance().SetUpperLimit(cfg->Read("/ImageCache/UpperBound", HUGIN_IMGCACHE_UPPERBOUND));
1520#endif
1523 {
1524 gl_preview_frame->SetShowProjectionHints(cfg->Read("/GLPreviewFrame/ShowProjectionHints",HUGIN_SHOW_PROJECTION_HINTS)!=0);
1525 };
1526}
1527
1528void MainFrame::OnTogglePreviewFrame(wxCommandEvent & e)
1529{
1530 DEBUG_TRACE("");
1531 if (preview_frame->IsIconized()) {
1532 preview_frame->Iconize(false);
1533 }
1534 preview_frame->Show();
1535 preview_frame->Raise();
1536
1537 // we need to force an update since autoupdate fires
1538 // before the preview frame is shown
1539 wxCommandEvent dummy;
1541}
1542
1544{
1546 {
1547 return;
1548 };
1549#if defined __WXMSW__ || defined __WXMAC__
1551#endif
1552 if (gl_preview_frame->IsIconized()) {
1553 gl_preview_frame->Iconize(false);
1554 }
1555 gl_preview_frame->Show();
1556#if defined __WXMSW__
1557 // on wxMSW Show() does not send OnShowEvent needed to update the
1558 // visibility state of the fast preview windows
1559 // so explicit calling this event handler
1561 se.SetShow(true);
1563#elif defined __WXGTK__
1565#endif
1566 gl_preview_frame->Raise();
1567}
1568
1569void MainFrame::OnShowCPFrame(wxCommandEvent & e)
1570{
1571 DEBUG_TRACE("");
1572 if (cp_frame) {
1573 if (cp_frame->IsIconized()) {
1574 cp_frame->Iconize(false);
1575 }
1576 cp_frame->Show();
1577 cp_frame->Raise();
1578 } else {
1579 cp_frame = new CPListFrame(this, pano);
1580 cp_frame->Show();
1581 }
1582}
1583
1585{
1586 cp_frame = 0;
1587}
1588
1589void MainFrame::OnOptimize(wxCommandEvent & e)
1590{
1591 DEBUG_TRACE("");
1592 wxCommandEvent dummy;
1594}
1595
1596void MainFrame::OnOnlyActiveImages(wxCommandEvent &e)
1597{
1598 SetOptimizeOnlyActiveImages(GetMenuBar()->IsChecked(XRCID("action_optimize_only_active")));
1599};
1600
1602{
1605 if (menubar)
1606 {
1607 menubar->Check(XRCID("action_optimize_only_active"), onlyActive);
1608 };
1611 // notify all observer so they can update their display
1613};
1614
1616{
1617 return m_optOnlyActiveImages;
1618};
1619
1620void MainFrame::OnIgnoreLineCp(wxCommandEvent &e)
1621{
1622 m_optIgnoreLineCp = GetMenuBar()->IsChecked(XRCID("action_optimize_ignore_line_cp"));
1624 // notify all observer so they can update their display
1626};
1627
1629{
1632 if (menubar)
1633 {
1634 menubar->Check(XRCID("action_optimize_ignore_line_cp"), ignoreLineCP);
1635 // notify all observer so they can update their display
1637 };
1638};
1639
1641{
1642 return m_optIgnoreLineCp;
1643};
1644
1645void MainFrame::OnPhotometricOptimize(wxCommandEvent & e)
1646{
1647 wxCommandEvent dummy;
1649};
1650
1651void MainFrame::OnDoStitch(wxCommandEvent & e)
1652{
1653 DEBUG_TRACE("");
1655 wxCommandEvent cmdEvt(wxEVT_BUTTON, stitchButton->GetId());
1656 stitchButton->GetEventHandler()->AddPendingEvent(cmdEvt);
1657}
1658
1659void MainFrame::OnUserDefinedStitch(wxCommandEvent & e)
1660{
1662}
1663
1665{
1666 auto filename = m_userOutput.find(e.GetId());
1667 if (filename != m_userOutput.end())
1668 {
1669 pano_panel->DoUserDefinedStitch(filename->second);
1670 }
1671 else
1672 {
1673 wxBell();
1674 };
1675}
1676
1677void MainFrame::OnMergeProject(wxCommandEvent & e)
1678{
1679 // get the global config object
1680 wxConfigBase* config = wxConfigBase::Get();
1681
1682 wxString defaultdir = config->Read("/actualPath",wxEmptyString);
1684 _("Open project file"),
1686 _("Project files (*.pto)|*.pto|All files (*)|*"),
1688 dlg.SetDirectory(defaultdir);
1689 if (dlg.ShowModal() == wxID_OK)
1690 {
1691 wxString filename = dlg.GetPath();
1692 wxFileName fname(filename);
1694 if (fname.IsOk() && fname.FileExists())
1695 {
1698 std::ifstream in((const char *)fname.GetFullPath().mb_str(HUGIN_CONV_FILENAME));
1699 int ptoversion=0;
1700 if (newPano.loadPTScript(in, ptoversion, (const char *)path.mb_str(HUGIN_CONV_FILENAME)))
1701 {
1703 new_pano.setMemento(newPano);
1706 );
1707 m_mruFiles.AddFileToHistory(fname.GetFullPath());
1708 // force update of preview window
1709 if ( !(preview_frame->IsIconized() ||(! preview_frame->IsShown()) ) )
1710 {
1711 wxCommandEvent dummy;
1713 };
1714 }
1715 else
1716 {
1717 hugin_utils::HuginMessageBox(wxString::Format(_("Could not read project file %s."), fname.GetFullPath()), _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
1718 };
1719 };
1720 }
1721}
1722
1723void MainFrame::OnReadPapywizard(wxCommandEvent & e)
1724{
1725 wxString currentDir = wxConfigBase::Get()->Read("/actualPath", wxEmptyString);
1726 wxFileDialog dlg(wxGetActiveWindow(), _("Open Papywizard xml file"),
1727 currentDir, wxEmptyString, _("Papywizard xml files (*.xml)|*.xml|All files (*)|*"),
1729 dlg.SetDirectory(currentDir);
1730 if (dlg.ShowModal() == wxID_OK)
1731 {
1732 wxConfigBase::Get()->Write("/actualPath", dlg.GetDirectory());
1734 };
1735};
1736
1737void MainFrame::OnApplyTemplate(wxCommandEvent & e)
1738{
1739 // get the global config object
1740 wxConfigBase* config = wxConfigBase::Get();
1741
1743 _("Choose template project"),
1744 config->Read("/templatePath",wxEmptyString), wxEmptyString,
1745 _("Project files (*.pto)|*.pto|All files (*)|*"),
1747 dlg.SetDirectory(wxConfigBase::Get()->Read("/templatePath",wxEmptyString));
1748 if (dlg.ShowModal() == wxID_OK) {
1749 wxString filename = dlg.GetPath();
1750 wxConfig::Get()->Write("/templatePath", dlg.GetDirectory()); // remember for later
1751
1752 std::ifstream file((const char *)filename.mb_str(HUGIN_CONV_FILENAME));
1753
1756
1757 }
1758}
1759
1760void MainFrame::OnOpenPTBatcher(wxCommandEvent & e)
1761{
1762#if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
1763 // Original patch for OSX by Charlie Reiman dd. 18 June 2011
1764 // Slightly modified by HvdW. Errors in here are mine, not Charlie's.
1765 FSRef appRef;
1767 OSStatus err;
1768 FSRef documentArray[1]; // Don't really need an array if we only have 1 item
1770 Boolean isDir;
1771
1773 CFSTR("net.sourceforge.hugin.PTBatcherGUI"),
1774 NULL,
1775 &appRef,
1776 NULL);
1777 if (err != noErr) {
1778 // error, can't find PTBatcherGUI
1779 hugin_utils::HuginMessageBox(wxString::Format(_("External program %s not found in the bundle, reverting to system path"), "open"), _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
1780 // Possibly a silly attempt otherwise the previous would have worked as well, but just try it.
1781 wxExecute(_T("open -b net.sourceforge.hugin.PTBatcherGUI"));
1782 }
1783 else {
1784 wxExecute(_T("open -b net.sourceforge.hugin.PTBatcherGUI"));
1785 }
1786#else
1787 const wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
1788 wxExecute(exePath.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + _T("PTBatcherGUI"));
1789#endif
1790}
1791
1792void MainFrame::OnFineTuneAll(wxCommandEvent & e)
1793{
1794 DEBUG_TRACE("");
1795 // fine-tune all points
1796
1798
1799 // create a map of all control points.
1800 std::set<unsigned int> unoptimized;
1801 for (unsigned int i=0; i < cps.size(); i++) {
1802 // create all control points.
1803 unoptimized.insert(i);
1804 }
1805
1806 unsigned int nGood=0;
1807 unsigned int nBad=0;
1808
1809 wxConfigBase *cfg = wxConfigBase::Get();
1810 double corrThresh=HUGIN_FT_CORR_THRESHOLD;
1811 cfg->Read("/Finetune/CorrThreshold", &corrThresh, HUGIN_FT_CORR_THRESHOLD);
1813 cfg->Read("/Finetune/CurvThreshold",&curvThresh, HUGIN_FT_CURV_THRESHOLD);
1814 // load parameters
1815 const long templWidth = cfg->Read("/Finetune/TemplateSize", HUGIN_FT_TEMPLATE_SIZE);
1816 const long sWidth = templWidth + cfg->Read("/Finetune/LocalSearchWidth", HUGIN_FT_LOCAL_SEARCH_WIDTH);
1817
1818 {
1819 ProgressReporterDialog progress(unoptimized.size(), _("Fine-tuning all points"), _("Fine-tuning"), wxGetActiveWindow());
1820
1821 ImageCache & imgCache = ImageCache::getInstance();
1822
1823 // do not process the control points in random order,
1824 // but walk from image to image, to reduce image reloading
1825 // in low mem situations.
1826 for (unsigned int imgNr = 0 ; imgNr < pano.getNrOfImages(); imgNr++) {
1827 std::set<unsigned int>::iterator it=unoptimized.begin();
1828
1829 imgCache.softFlush();
1830
1831 while (it != unoptimized.end()) {
1832 if (cps[*it].image1Nr == imgNr || cps[*it].image2Nr == imgNr) {
1833 if (!progress.updateDisplayValue())
1834 {
1835 return;
1836 };
1837 if (cps[*it].mode == HuginBase::ControlPoint::X_Y) {
1838 // finetune only normal points
1839 DEBUG_DEBUG("fine tuning point: " << *it);
1841 ImageCache::ImageCacheRGB8Ptr searchImg = imgCache.getImage(
1842 pano.getImage(cps[*it].image2Nr).getFilename())->get8BitImage();
1843
1844 ImageCache::ImageCacheRGB8Ptr templImg = imgCache.getImage(
1845 pano.getImage(cps[*it].image1Nr).getFilename())->get8BitImage();
1846
1848 vigra::Diff2D roundP1(hugin_utils::roundi(cps[*it].x1), hugin_utils::roundi(cps[*it].y1));
1849 vigra::Diff2D roundP2(hugin_utils::roundi(cps[*it].x2), hugin_utils::roundi(cps[*it].y2));
1850
1852 pano.getImage(cps[*it].image2Nr), *searchImg, roundP2, sWidth);
1853
1854 // invert curvature. we always assume its a maxima, the curvature there is negative
1855 // however, we allow the user to specify a positive threshold, so we need to
1856 // invert it
1857 res.curv.x = - res.curv.x;
1858 res.curv.y = - res.curv.y;
1859
1860 if (res.maxi < corrThresh || res.curv.x < curvThresh || res.curv.y < curvThresh ||
1861 res.maxpos.x < 0 || res.maxpos.y < 0 || res.corrPos.x < 0 || res.corrPos.y < 0)
1862 {
1863 // Bad correlation result.
1864 nBad++;
1865 if (res.maxi >= corrThresh) {
1866 cps[*it].error = 0;
1867 }
1868 cps[*it].error = res.maxi;
1869 DEBUG_DEBUG("low correlation: " << res.maxi << " curv: " << res.curv);
1870 } else {
1871 nGood++;
1872 // only update if a good correlation was found
1873 cps[*it].x1 = res.corrPos.x;
1874 cps[*it].y1 = res.corrPos.y;
1875 cps[*it].x2 = res.maxpos.x;
1876 cps[*it].y2 = res.maxpos.y;
1877 cps[*it].error = res.maxi;
1878 }
1879 }
1880 else
1881 {
1882 // for line control points set error = correlation to 1
1883 cps[*it].error = 1.0;
1884 };
1885 unsigned int rm = *it;
1886 ++it;
1887 unoptimized.erase(rm);
1888 } else {
1889 ++it;
1890 }
1891 }
1892 }
1893 }
1895 wxString result;
1896 result.Printf(_("%d points fine-tuned, %d points not updated due to low correlation\n\nHint: The errors of the fine-tuned points have been set to the correlation coefficient\nProblematic points can be spotted (just after fine-tune, before optimizing)\nby an error <= %.3f.\nThe error of points without a well defined peak (typically in regions with uniform color)\nwill be set to 0\n\nUse the Control Point list (F3) to see all points of the current project\n"),
1897 nGood, nBad, corrThresh);
1898 hugin_utils::HuginMessageBox(result, _("Hugin"), wxOK, this);
1899 // set newly optimized points
1901 new PanoCommand::UpdateCPsCmd(pano, cps, false)
1902 );
1903}
1904
1905void MainFrame::OnRemoveCPinMasks(wxCommandEvent & e)
1906{
1907 if(pano.getCtrlPoints().size()<2)
1908 return;
1909 HuginBase::UIntSet cps=getCPinMasks(pano);
1910 if(!cps.empty())
1911 {
1914 );
1915 hugin_utils::HuginMessageBox(wxString::Format(_("Removed %lu control points"), static_cast<unsigned long>(cps.size())),
1916 _("Hugin"), wxOK | wxICON_INFORMATION, this);
1917 };
1918}
1919
1920#ifdef HUGIN_HSI
1921void MainFrame::OnPythonScript(wxCommandEvent & e)
1922{
1925 _("Select python script"),
1926 wxConfigBase::Get()->Read("/lensPath",wxEmptyString), wxEmptyString,
1927 _("Python script (*.py)|*.py|All files (*.*)|*.*"),
1929 dlg.SetDirectory(wxConfigBase::Get()->Read("/pythonScriptPath",wxEmptyString));
1930
1931 if (dlg.ShowModal() == wxID_OK)
1932 {
1933 wxString filename = dlg.GetPath();
1934 wxConfig::Get()->Write("/pythonScriptPath", dlg.GetDirectory());
1935 std::string scriptfile((const char *)filename.mb_str(HUGIN_CONV_FILENAME));
1937 new PanoCommand::PythonScriptPanoCmd(pano,scriptfile)
1938 );
1939 }
1940}
1941
1942void MainFrame::OnPlugin(wxCommandEvent & e)
1943{
1944 wxFileName file=m_plugins[e.GetId()];
1945 if(file.FileExists())
1946 {
1947 std::string scriptfile((const char *)file.GetFullPath().mb_str(HUGIN_CONV_FILENAME));
1949 new PanoCommand::PythonScriptPanoCmd(pano,scriptfile)
1950 );
1951 }
1952 else
1953 {
1954 hugin_utils::HuginMessageBox(wxString::Format("Python-Script %s not found.\nStopping processing.", file.GetFullPath()), _("Hugin"), wxOK | wxICON_INFORMATION, wxGetActiveWindow());
1955 };
1956}
1957
1958#endif
1959
1960void MainFrame::OnUndo(wxCommandEvent & e)
1961{
1962 DEBUG_TRACE("OnUndo");
1964 {
1966 }
1967 else
1968 {
1969 wxBell();
1970 };
1971}
1972
1973void MainFrame::OnRedo(wxCommandEvent & e)
1974{
1975 DEBUG_TRACE("OnRedo");
1977 {
1979 };
1980}
1981
1983{
1984 DEBUG_DEBUG("Showing control point " << cpNr);
1985 m_notebook->SetSelection(2);
1987}
1988
1989void MainFrame::ShowCtrlPointEditor(unsigned int img1, unsigned int img2)
1990{
1991 if(!IsShown())
1992 {
1993 Show();
1994 Raise();
1995 };
1996 m_notebook->SetSelection(2);
1997 cpe->setLeftImage(img1);
1998 cpe->setRightImage(img2);
1999}
2000
2002{
2003 if(!IsShown())
2004 {
2005 Show();
2006 Raise();
2007 };
2008 m_notebook->SetSelection(1);
2009 mask_panel->setImage(imgNr, true);
2010 if (switchToCropMode)
2011 {
2013 };
2014};
2015
2017{
2020 {
2021 m_notebook->SetSelection(5);
2022 }
2023 else
2024 {
2026 {
2027 m_notebook->SetSelection(4);
2028 }
2029 else
2030 {
2031 m_notebook->SetSelection(3);
2032 };
2033 };
2034}
2035
2038{
2039 wxString msg;
2040 if (!m_message.empty())
2041 {
2043 if (!m_filename.empty())
2044 {
2045 msg.Append(" ");
2046 msg.Append(wxString(ProgressDisplay::m_filename.c_str(), HUGIN_CONV_FILENAME));
2047 };
2048 };
2049 GetStatusBar()->SetStatusText(msg, 0);
2050
2051#ifdef __WXMSW__
2053#endif
2054}
2055
2056void MainFrame::enableTools(bool option)
2057{
2059 theToolBar->EnableTool(XRCID("action_optimize"), option);
2060 theToolBar->EnableTool(XRCID("ID_SHOW_PREVIEW_FRAME"), option);
2061 //theToolBar->EnableTool(XRCID("ID_SHOW_GL_PREVIEW_FRAME"), option);
2063 theMenuBar->Enable(XRCID("action_optimize"), option);
2064 theMenuBar->Enable(XRCID("action_finetune_all_cp"), option);
2065 theMenuBar->Enable(XRCID("action_remove_cp_in_masks"), option);
2066 theMenuBar->Enable(XRCID("ID_SHOW_PREVIEW_FRAME"), option);
2067 theMenuBar->Enable(XRCID("action_stitch"), option);
2068 theMenuBar->Enable(XRCID("action_stitch_userdefined"), option);
2069 if (m_outputUserMenu != nullptr)
2070 {
2071 m_outputUserMenu->Enable(option);
2072 };
2073 if (m_assistantUserMenu != nullptr)
2074 {
2075 m_assistantUserMenu->Enable(option);
2076 };
2077 theMenuBar->Enable(XRCID("action_assistant"), option);
2078 theMenuBar->Enable(XRCID("action_batch_assistant"), option);
2079 m_menu_file_advanced->Enable(XRCID("action_import_papywizard"), option);
2080 //theMenuBar->Enable(XRCID("ID_SHOW_GL_PREVIEW_FRAME"), option);
2081}
2082
2083
2085{
2086#ifdef DEBUG
2087 wxSize sz = this->GetSize();
2088 wxSize csz = this->GetClientSize();
2089 wxSize vsz = this->GetVirtualSize();
2090 DEBUG_TRACE(" size:" << sz.x << "," << sz.y <<
2091 " client: "<< csz.x << "," << csz.y <<
2092 " virtual: "<< vsz.x << "," << vsz.y);
2093#endif
2094
2095 Layout();
2096 e.Skip();
2097}
2098
2103
2108
2113
2118
2120{
2121 return huginApp::Get()->GetXRCPath();
2122};
2123
2125{
2126 return wxGetApp().GetDataPath();
2127};
2128
2131{
2132 if (m_this) {
2133 return m_this;
2134 } else {
2135 DEBUG_FATAL("MainFrame not yet created");
2137 return 0;
2138 }
2139}
2140
2145
2147{
2148 return m_showCorrelation > 0;
2149}
2150
2151void MainFrame::OnMRUFiles(wxCommandEvent &e)
2152{
2153 size_t index = e.GetId() - wxID_FILE1;
2154 wxString f(m_mruFiles.GetHistoryFile(index));
2155 if (!f.empty())
2156 {
2157 wxFileName fn(f);
2158 if (fn.FileExists())
2159 {
2160 // if closing old project was canceled do nothing
2161 if (CloseProject(true, LOAD_NEW_PROJECT))
2162 {
2163 // remove old images from cache
2164 ImageCache::getInstance().flush();
2165 // finally load project
2166 LoadProjectFile(f);
2167 };
2168 }
2169 else
2170 {
2171 m_mruFiles.RemoveFileFromHistory(index);
2172 hugin_utils::HuginMessageBox(wxString::Format(_("File \"%s\" not found.\nMaybe file was renamed, moved or deleted."),f.c_str()),
2174 };
2175 };
2176}
2177
2178void MainFrame::OnFullScreen(wxCommandEvent & e)
2179{
2181#ifdef __WXGTK__
2182 //workaround a wxGTK bug that also the toolbar is hidden, but not requested to hide
2183 GetToolBar()->Show(true);
2184#endif
2185};
2186
2188{
2189 if(svmModel==NULL)
2190 {
2191 // determine file name of SVM model file
2192 // get XRC path from application
2194 // convert wxString to string
2196
2197 // SVM model file
2198 if (! wxFile::Exists(wxstrModelFileName) ) {
2199 hugin_utils::HuginMessageBox(wxString::Format(_("Celeste model expected in %s not found, Hugin needs to be properly installed."), wxstrModelFileName), _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
2200 return NULL;
2201 }
2203 {
2204 hugin_utils::HuginMessageBox(wxString::Format(_("Could not load Celeste model file %s"), wxstrModelFileName), _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
2205 svmModel=NULL;
2206 };
2207 }
2208 return svmModel;
2209};
2210
2215
2217{
2219 {
2221 return;
2222 };
2224 {
2225 bool needsUpdateOptimizerVar=false;
2227 for(size_t i=0; i<optVec.size(); i++)
2228 {
2229 bool hasTrX=optVec[i].erase("TrX")>0;
2230 bool hasTrY=optVec[i].erase("TrY")>0;
2231 bool hasTrZ=optVec[i].erase("TrZ")>0;
2232 bool hasTpy=optVec[i].erase("Tpy")>0;
2233 bool hasTpp=optVec[i].erase("Tpp")>0;
2234 bool hasg=optVec[i].erase("g")>0;
2235 bool hast=optVec[i].erase("t")>0;
2237 };
2239 {
2242 );
2243 };
2244 };
2246 {
2247 bool needsUpdateOptimizerVar=false;
2249 for(size_t i=0; i<optVec.size(); i++)
2250 {
2251 bool hasVx=optVec[i].erase("Vx")>0;
2252 bool hasVy=optVec[i].erase("Vy")>0;
2254 };
2256 {
2259 );
2260 };
2261 };
2268 {
2270 };
2271 switch(m_guiLevel)
2272 {
2273 case GUI_SIMPLE:
2274 GetMenuBar()->FindItem(XRCID("action_gui_simple"))->Check();
2275 break;
2276 case GUI_ADVANCED:
2277 GetMenuBar()->FindItem(XRCID("action_gui_advanced"))->Check();
2278 break;
2279 case GUI_EXPERT:
2280 GetMenuBar()->FindItem(XRCID("action_gui_expert"))->Check();
2281 break;
2282 };
2284 {
2285 if(!gl_preview_frame->IsShown())
2286 {
2287 wxCommandEvent dummy;
2289 };
2290 wxGetApp().SetTopWindow(gl_preview_frame);
2291 GetMenuBar()->Remove(0);
2292 GetMenuBar()->Insert(0, m_menu_file_simple, _("&File"));
2293 if(m_filename.IsEmpty())
2294 {
2295 gl_preview_frame->SetTitle(_("Hugin - Panorama Stitcher"));
2296 SetTitle(_("Panorama editor"));
2297 }
2298 else
2299 {
2301 gl_preview_frame->SetTitle(scriptName.GetName() + "." + scriptName.GetExt() + " - " + _("Hugin - Panorama Stitcher"));
2302 SetTitle(scriptName.GetName() + "." + scriptName.GetExt() + " - " + _("Panorama editor"));
2303 };
2304 Hide();
2305 }
2306 else
2307 {
2308 wxGetApp().SetTopWindow(this);
2309 GetMenuBar()->Remove(0);
2310 GetMenuBar()->Insert(0, m_menu_file_advanced, _("&File"));
2311 if(m_filename.IsEmpty())
2312 {
2313 SetTitle(_("Hugin - Panorama Stitcher"));
2314 }
2315 else
2316 {
2318 SetTitle(scriptName.GetName() + "." + scriptName.GetExt() + " - " + _("Hugin - Panorama Stitcher"));
2319 };
2320 if(!IsShown())
2321 {
2322 Show();
2323 };
2324 };
2325};
2326
2327void MainFrame::OnSetGuiSimple(wxCommandEvent & e)
2328{
2331 {
2333 }
2334 else
2335 {
2337 {
2338 hugin_utils::HuginMessageBox(_("Can't switch to simple interface. The project is using stacks and/or vignetting center shift.\nThese features are not supported in simple interface."),
2340 }
2341 else
2342 {
2343 hugin_utils::HuginMessageBox(_("Can't switch to simple interface. The project is using translation or shear parameters.\nThese parameters are not supported in simple interface."),
2345 }
2347 };
2348};
2349
2350void MainFrame::OnSetGuiAdvanced(wxCommandEvent & e)
2351{
2354 {
2356 }
2357 else
2358 {
2359 hugin_utils::HuginMessageBox(_("Can't switch to advanced interface. The project is using translation or shear parameters.\nThese parameters are not supported in advanced interface."),
2362 };
2363};
2364
2365void MainFrame::OnSetGuiExpert(wxCommandEvent & e)
2366{
2368};
2369
2371{
2372 GetMenuBar()->Enable(XRCID("ID_SHOW_GL_PREVIEW_FRAME"), false);
2373 GetMenuBar()->Enable(XRCID("action_gui_simple"), false);
2374 GetToolBar()->EnableTool(XRCID("ID_SHOW_GL_PREVIEW_FRAME"), false);
2375};
2376
2378{
2379 //save project into temp directory
2380 wxString tempDir= wxConfig::Get()->Read("tempDir",wxEmptyString);
2381 if(!tempDir.IsEmpty())
2382 {
2383 if(tempDir.Last()!=wxFileName::GetPathSeparator())
2384 {
2385 tempDir.Append(wxFileName::GetPathSeparator());
2386 }
2387 };
2388 wxFileName scriptFileName(wxFileName::CreateTempFileName(tempDir+"ha"));
2389 const std::string script(scriptFileName.GetFullPath().mb_str(HUGIN_CONV_FILENAME));
2391
2392 // get assistant queue
2393 const wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
2395 HuginQueue::CommandQueue* commands;
2396 if (userdefinedAssistant.IsEmpty())
2397 {
2399 }
2400 else
2401 {
2402 std::stringstream errors;
2404 if (commands->empty())
2405 {
2406 hugin_utils::HuginMessageBox(_("The assistant queue is empty. This indicates an error in the user defined assistant file.") + "\n\n" + wxString(errors.str()),
2407 _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
2408 //delete temporary files
2409 wxRemoveFile(scriptFileName.GetFullPath());
2410 return;
2411 };
2412 };
2413 //execute queue
2414 int ret = MyExecuteCommandQueue(commands, mainWin, _("Running assistant"));
2415
2416 //read back panofile
2418 (const char *)scriptFileName.GetFullPath().mb_str(HUGIN_CONV_FILENAME), "",
2419 ret==0, false));
2420
2421 //delete temporary files
2422 wxRemoveFile(scriptFileName.GetFullPath());
2423 if (!tempfiles.IsEmpty())
2424 {
2425 for (auto& f : tempfiles)
2426 {
2427 wxRemoveFile(f);
2428 };
2429 };
2430 // check that GUI level is still approbiate
2432 if (reqGuiLevel > m_guiLevel)
2433 {
2434 // output of assistant requires higher GUI level
2436 };
2437 //if return value is non-zero, an error occurred in the assistant
2438 if(ret!=0)
2439 {
2440 if (userdefinedAssistant.IsEmpty())
2441 {
2442 if (pano.getNrOfImages() == 1)
2443 {
2444 hugin_utils::HuginMessageBox(_("The assistant could not find vertical lines. Please add vertical lines in the panorama editor and optimize project manually."),
2446 }
2447 else
2448 {
2449 //check for unconnected images
2451 const HuginGraph::ImageGraph::Components comps = graph.GetComponents();
2452 if (comps.size() > 1)
2453 {
2454 // switch to images panel.
2455 unsigned i1 = *(comps[0].rbegin());
2456 unsigned i2 = *(comps[1].begin());
2457 ShowCtrlPointEditor(i1, i2);
2458 // display message box with
2459 hugin_utils::HuginMessageBox(wxString::Format(_("Warning %d unconnected image groups found:"), static_cast<int>(comps.size())) + Components2Str(comps) + "\n"
2460 + _("Please create control points between unconnected images using the Control Points tab in the panorama editor.\n\nAfter adding the points, press the \"Align\" button again"), _("Error"), wxOK, mainWin);
2461 return;
2462 };
2463 hugin_utils::HuginMessageBox(_("The assistant did not complete successfully. Please check the resulting project file."),
2465 };
2466 }
2467 else
2468 {
2469 hugin_utils::HuginMessageBox(_("The assistant did not complete successfully. Please check the resulting project file."),
2471 };
2472 };
2473};
2474
2475void MainFrame::OnRunAssistant(wxCommandEvent & e)
2476{
2477 RunAssistant(this);
2478};
2479
2481{
2482 const auto filename = m_userAssistant.find(e.GetId());
2483 if (filename != m_userAssistant.end())
2484 {
2485 RunAssistant(this, filename->second);
2486 }
2487 else
2488 {
2489 wxBell();
2490 };
2491};
2492
2494{
2495 wxCommandEvent dummy;
2498 if(wxFileName::FileExists(projectFile))
2499 {
2500#if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
2501 // Original patch for OSX by Charlie Reiman dd. 18 June 2011
2502 // Slightly modified by HvdW. Errors in here are mine, not Charlie's.
2503 FSRef appRef;
2505 OSStatus err;
2506 FSRef documentArray[1]; // Don't really need an array if we only have 1 item
2508 Boolean isDir;
2509
2511 CFSTR("net.sourceforge.hugin.PTBatcherGUI"),
2512 NULL,
2513 &appRef,
2514 NULL);
2515 if (err != noErr)
2516 {
2517 // error, can't find PTBatcherGUI
2518 hugin_utils::HuginMessageBox(wxString::Format(_("External program %s not found in the bundle, reverting to system path"), "open"), _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
2519 // Possibly a silly attempt otherwise the previous would have worked as well, but just try it.
2520 wxExecute(_T("open -b net.sourceforge.hugin.PTBatcherGUI ")+hugin_utils::wxQuoteFilename(projectFile));
2521 return;
2522 }
2523
2525 // Point to document
2526 err = FSPathMakeRef((unsigned char*) projectFilebuffer.data(), &documentArray[0], &isDir);
2527 if (err != noErr || isDir)
2528 {
2529 // Something went wrong.
2530 hugin_utils::HuginMessageBox(wxString::Format(_("Project file not found"), "open"), _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
2531 return;
2532 }
2533 launchSpec.appRef = &appRef;
2534 launchSpec.numDocs = sizeof(documentArray)/sizeof(documentArray[0]);
2535 launchSpec.itemRefs = documentArray;
2536 launchSpec.passThruParams = NULL;
2538 launchSpec.asyncRefCon = NULL;
2539
2541 if (err != noErr && err != kLSLaunchInProgressErr)
2542 {
2543 // Should be ok if it's in progress... I think.
2544 // Launch failed.
2545 hugin_utils::HuginMessageBox(wxString::Format(_("Can't launch PTBatcherGui"), "open"), _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
2546 return;
2547 }
2548
2549 // Should verify that actuallyLaunched and appRef are the same.
2551 {
2552 // error, lauched the wrong thing.
2553 hugin_utils::HuginMessageBox(wxString::Format(_("Launched incorrect programme"), "open"), _("Hugin"), wxOK | wxICON_ERROR, wxGetActiveWindow());
2554 return;
2555 }
2556#else
2557 const wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
2559#endif
2560 }
2561};
2562
2567
Definition of dialog for numeric transforms.
create a CommandQueue for running the assistant using CLI tools
Definition of dialog to browse directory with pto files.
vigra_ext::CorrelationResult PointFineTuneProjectionAware(const HuginBase::SrcPanoImage &templ, const vigra::UInt8RGBImage &templImg, vigra::Diff2D templPos, int templSize, const HuginBase::SrcPanoImage &search, const vigra::UInt8RGBImage &searchImg, vigra::Diff2D searchPos, int sWidth)
function for fine-tune with remapping to stereographic projection
image1Nr
image2Nr
algorithms for remove control points by statistic method
GuiLevel GetMinimumGuiLevel(HuginBase::PanoramaData &pano)
returns the requiered GuiLevel for the given panorama to work correctly
Definition GuiLevel.cpp:29
GuiLevel
Definition GuiLevel.h:32
@ GUI_EXPERT
Definition GuiLevel.h:35
@ GUI_ADVANCED
Definition GuiLevel.h:34
@ GUI_SIMPLE
Definition GuiLevel.h:33
wxDEFINE_EVENT(EVT_LOADING_FAILED, wxCommandEvent)
@ wxIDUSERASSISTANT
@ wxIDPYTHONSCRIPTS
@ wxIDUSEROUTPUTSEQUENCE
int MyExecuteCommandQueue(HuginQueue::CommandQueue *queue, wxWindow *parent, const wxString &title, const wxString &comment)
execute all commands in queue with redirection of output to frame and allow canceling the queue will ...
void registerPTWXDlgFcn()
Definition PTWXDlg.cpp:178
void deregisterPTWXDlgFcn()
Definition PTWXDlg.cpp:185
Definition of PanoOperation class.
read settings from papywizard xml file
bool comparePluginItem(PluginItem item1, PluginItem item2)
compares 2 plugin with category and name
Reading python plugins metadata.
std::list< PluginItem > PluginItems
Definition PluginItems.h:61
Definition of dialog and functions to import RAW images to project file.
Dialog for about window.
Definition AboutDialog.h:41
Dialog for browsing pto files.
class, which stores all settings of one cp detector
control point editor panel.
void setRightImage(unsigned int imgNr)
set right image
void Init(HuginBase::Panorama *pano)
void setLeftImage(unsigned int imgNr)
set left image
void ShowControlPoint(unsigned int cpNr)
show a control point
The OpenGL preview frame.
void InitPreviews()
init previews
void OnShowEvent(wxShowEvent &e)
void SetGuiLevel(GuiLevel newLevel)
sets the gui level
void LoadOpenGLLayout()
loads the layout of the OpenGL windows and restores it
void StorePositionAndSize()
store position and size of window in wxConfig
void AddUserDefinedSequence(int id, const wxString &desc, const wxString &help)
adds the given user defined output sequence to SplitButton menu
void AddUserDefinedAssistant(int id, const wxString &desc, const wxString &help)
adds the given user defined assistant to SplitButton menu
void ResetPreviewZoom()
reset zoom level for preview window
void SetShowProjectionHints(bool new_value)
set status if projection hints should be shown or not
This is a cache for all the images we use.
Definition ImageCache.h:53
static ImageCache & getInstance()
get the global ImageCache object
void flush()
release all images in the cache.
Memento class for a Panorama object.
Definition Panorama.h:50
bool loadPTScript(std::istream &i, int &ptoVersion, const std::string &prefix="")
load a Hugin file
Model for a panorama.
Definition Panorama.h:153
void changeFinished(bool keepDirty)
notify observers about changes in this class
Definition Panorama.cpp:831
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
Definition Panorama.h:211
const PanoramaOptions & getOptions() const
returns the options for this panorama
Definition Panorama.h:481
virtual void clearDirty()
clear dirty flag.
Definition Panorama.h:645
bool isDirty() const
true if there are unsaved changes
Definition Panorama.h:636
void setMemento(const PanoramaMemento &memento)
set the internal state
void addObserver(PanoramaObserver *o)
add a panorama observer.
const int getPhotometricOptimizerSwitch() const
return the photometric optimizer master switch
Definition Panorama.h:467
const CPVector & getCtrlPoints() const
get all control point of this Panorama
Definition Panorama.h:319
bool removeObserver(PanoramaObserver *observer)
remove a panorama observer.
const OptimizeVector & getOptimizeVector() const
return the optimize settings stored inside panorama
Definition Panorama.h:454
bool WritePTOFile(const std::string &filename, const std::string &prefix="")
write data to given pto file
void printStitcherScript(std::ostream &o, const PanoramaOptions &target, const UIntSet &imgs) const
create the stitcher script
Definition Panorama.cpp:778
const int getOptimizerSwitch() const
returns optimizer master switch
Definition Panorama.h:461
std::size_t getNrOfImages() const
number of images.
Definition Panorama.h:205
class to work with images graphs created from a HuginBase::Panorama class it creates a graph based on...
Definition ImageGraph.h:45
std::vector< HuginBase::UIntSet > Components
stores the components of the graph
Definition ImageGraph.h:50
class for showing splash screen the class wxSplashScreen from wxWidgets does not work correctly for o...
Definition MainFrame.cpp:89
HuginSplashScreen(wxWindow *parent, wxBitmap bitmap)
Definition MainFrame.cpp:92
Hugin's first panel.
Definition ImagesPanel.h:41
wxString GetCurrentOptimizerString()
return the currently selected optimizer setting as string from the drop down list box
void RunCPGenerator(CPDetectorSetting &setting, const HuginBase::UIntSet &img)
run the cp generator with the given setting on selected images
void SetGuiLevel(GuiLevel newGuiLevel)
sets the GuiLevel for all controls on this panel
void ReloadCPDetectorSettings()
Reloads the cp detector settings from config, necessary after edit preferences.
const wxString GetSelectedCPGenerator()
return the currently selected cp generator description
void Init(HuginBase::Panorama *pano)
CPDetectorSetting & GetDefaultSetting()
returns the default cp detector settings
Definition ImagesPanel.h:74
A tip file provider that uses gettext to translate the tips.
The main window frame.
Definition MainFrame.h:84
void OnTogglePreviewFrame(wxCommandEvent &e)
PanoPanel * pano_panel
Definition MainFrame.h:258
bool m_show_opt_panel
Definition MainFrame.h:255
void ShowCtrlPoint(unsigned int cpNr)
void OnFAQ(wxCommandEvent &e)
void OnLoadingFailed(wxCommandEvent &e)
event handler called when loading of image file failed
bool m_optIgnoreLineCp
Definition MainFrame.h:290
void OnMRUFiles(wxCommandEvent &e)
event handler for recently used files
static MainFrame * Get()
hack.. kind of a pseudo singleton...
void OnSaveProject(wxCommandEvent &e)
virtual ~MainFrame()
dtor.
void AddImages(wxArrayString &filenameArray)
adds the given files to the projects, with checking for invalid filenames
void SetGuiLevel(GuiLevel newLevel)
bool m_optOnlyActiveImages
Definition MainFrame.h:289
bool m_show_opt_photo_panel
Definition MainFrame.h:257
void updateProgressDisplay()
receive notification about progress.
void OnShowPrefs(wxCommandEvent &e)
void LoadProjectFile(const wxString &filename)
void OnTipOfDay(wxCommandEvent &e)
void OnDoStitch(wxCommandEvent &e)
void OnRunAssistantUserdefined(wxCommandEvent &e)
void OnShowCPFrame(wxCommandEvent &e)
std::map< int, wxString > m_userOutput
Definition MainFrame.h:299
void DisableOpenGLTools()
disables all OpenGL related menu items and toobar buttons
void ShowCtrlPointEditor(unsigned int img1, unsigned int img2)
opens the control points tab with the both images selected
void OnKeyboardHelp(wxCommandEvent &e)
GLPreviewFrame * gl_preview_frame
Definition MainFrame.h:263
const wxString & GetXRCPath()
get the path to the xrc directory
HuginBase::Panorama & pano
Definition MainFrame.h:274
void OnPhotometricOptimize(wxCommandEvent &e)
void OnOpenPTBatcher(wxCommandEvent &e)
void OnSendToAssistantQueue(wxCommandEvent &e)
PreviewFrame * preview_frame
Definition MainFrame.h:262
void OnAbout(wxCommandEvent &e)
void OnAddImages(wxCommandEvent &e)
struct celeste::svm_model * svmModel
Definition MainFrame.h:259
GuiLevel m_guiLevel
Definition MainFrame.h:265
void OnToggleGLPreviewFrame(wxCommandEvent &e)
wxMenu * m_menu_file_simple
Definition MainFrame.h:284
void OnRemoveCPinMasks(wxCommandEvent &e)
std::map< int, wxString > m_userAssistant
Definition MainFrame.h:300
void OnHelp(wxCommandEvent &e)
wxHelpController & GetHelpController()
Definition MainFrame.h:183
wxString m_filename
Definition MainFrame.h:277
void OnUserQuit(wxCommandEvent &e)
void RunCPGenerator(CPDetectorSetting &setting, const HuginBase::UIntSet &img)
run the cp generator with the given setting on selected images
void OnOnlyActiveImages(wxCommandEvent &e)
void OnSetGuiSimple(wxCommandEvent &e)
void RunAssistant(wxWindow *mainWin, const wxString &userdefinedAssistant=wxEmptyString)
void ShowMaskEditor(size_t imgNr, bool switchToCropMode=false)
opens the mask/crop editor with the given image selected
void OnSetGuiAdvanced(wxCommandEvent &e)
wxString getProjectName()
void OnNewProject(wxCommandEvent &e)
static MainFrame * m_this
Definition MainFrame.h:282
void OnMergeProject(wxCommandEvent &e)
void OnReadPapywizard(wxCommandEvent &e)
void OnOptimize(wxCommandEvent &e)
const bool GetOptimizeIgnoreLineCp() const
wxMenuItem * m_assistantUserMenu
Definition MainFrame.h:287
CPListFrame * cp_frame
Definition MainFrame.h:264
OptimizePanel * opt_panel
Definition MainFrame.h:254
wxMenuItem * m_outputUserMenu
Definition MainFrame.h:286
bool IsShowingCorrelation() const
void OnFullScreen(wxCommandEvent &e)
event handler for full screen
MaskEditorPanel * mask_panel
Definition MainFrame.h:252
void OnLoadProject(wxCommandEvent &e)
virtual void panoramaChanged(HuginBase::Panorama &pano)
Enable or disable undo and redo.
wxString GetCurrentOptimizerString()
returns the string which describes the current selected optimizer setting
void DisplayHelp(wxString section=wxEmptyString)
call help browser with given file
void OnRunAssistant(wxCommandEvent &e)
void OnCPListFrameClosed()
void OnUndo(wxCommandEvent &e)
bool CloseProject(bool cancelable, CloseReason reason)
void enableTools(bool option)
wxFileHistory m_mruFiles
Definition MainFrame.h:248
const wxString GetSelectedCPGenerator()
return the currently selected cp generator description
void OnFineTuneAll(wxCommandEvent &e)
void OnUserDefinedStitch(wxCommandEvent &e)
wxNotebook * m_notebook
Definition MainFrame.h:249
void SetOptimizeIgnoreLineCp(const bool ignoreLineCP)
sets the status of the "ignore line cp" menu item
void OnRedo(wxCommandEvent &e)
const wxString & GetDataPath()
get the path to data directory
void OnIgnoreLineCp(wxCommandEvent &e)
struct celeste::svm_model * GetSVMModel()
MainFrame(wxWindow *parent, HuginBase::Panorama &pano)
ctor.
void OnSavePTStitcherAs(wxCommandEvent &e)
void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet &imgNr)
notifies about changes to images
GLPreviewFrame * getGLPreview()
void OnSetGuiExpert(wxCommandEvent &e)
void OnAddTimeImages(wxCommandEvent &e)
ImagesPanel * images_panel
Definition MainFrame.h:251
const bool GetOptimizeOnlyActiveImages() const
void OnSize(wxSizeEvent &e)
OptimizePhotometricPanel * opt_photo_panel
Definition MainFrame.h:256
void OnBrowseProjects(wxCommandEvent &e)
CPEditorPanel * cpe
Definition MainFrame.h:253
void OnShowPanel(wxCommandEvent &e)
CPDetectorSetting & GetDefaultSetting()
returns default cp detector setting
void ShowStitcherTab()
opens the stitcher tab
void OnUserDefinedStitchSaved(wxCommandEvent &e)
@ CLOSE_PROGRAM
Definition MainFrame.h:134
@ LOAD_NEW_PROJECT
Definition MainFrame.h:135
int m_showCorrelation
Definition MainFrame.h:279
void OnApplyTemplate(wxCommandEvent &e)
void SetOptimizeOnlyActiveImages(const bool onlyActive)
sets the status of the "optimize only active images" menu item
void OnExit(wxCloseEvent &e)
wxMenu * m_menu_file_advanced
Definition MainFrame.h:285
void OnSaveProjectAs(wxCommandEvent &e)
mask editor panel.
void Init(HuginBase::Panorama *pano)
void SwitchToCropMode()
switches the controls to crop mode
void setImage(unsigned int imgNr, bool updateListSelection=false)
sets the image, which is currently edited
run the optimizer.
void SetGuiLevel(GuiLevel newGuiLevel)
void SetOnlyActiveImages(const bool onlyActive)
for external setting of "only active image" checkbox
void OnOptimizeButton(wxCommandEvent &e)
run the optimizer
void Init(HuginBase::Panorama *pano)
void SetIgnoreLineCP(const bool noLineCp)
for external setting of "ignore line cp" checkbox
void Init(HuginBase::Panorama *pano)
void SetGuiLevel(GuiLevel newGuiLevel)
void SetOnlyActiveImages(const bool onlyActive)
for external setting of "only active image" checkbox
void OnOptimizeButton(wxCommandEvent &e)
run the optimizer
center panorama horizontically
PanoCommand to combine other PanoCommands.
Definition PanoCommand.h:40
bool canRedo() const
Return true iff there is a command to redo.
std::string getLastCommandName() const
returns the name of the last command
void clearRedoQueue()
clear all commands in the redo queue
virtual void redo()
Redoes the last undone action.
void addCommand(PanoCommand *command, bool execute=true)
Adds a command to the history.
virtual void undo()
Undoes the last action.
void clear()
Erases all the undo/redo history.
bool canUndo() const
Return true iff there is a command to undo.
distributes all images above the sphere, for the assistant
static GlobalCmdHist & getInstance()
merge two project files
Base class for all panorama commands.
Definition Command.h:39
remove several control points
remove multiple images from a panorama
Definition PanoCommand.h:95
update all control points
updates the optimize vector, aka all variables which should be optimized
add image(s) to a panorama
apply a template to a panorama object
dump the current project and load a new one.
start a new project, reset options to values in preferences
simple class that forward the drop to the mainframe
Definition MainFrame.h:62
PanoOperation to add several user selected images to the panorama.
PanoOperation to add all image in a defined timeinterval to the panorama.
virtual PanoCommand::PanoCommand * GetCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
returns the appropriate PanoCommand::PanoCommand to be inserted into GlobalCmdHistory,...
Define the pano edit panel.
Definition PanoPanel.h:44
virtual void panoramaChanged(HuginBase::Panorama &pano)
this is called whenever the panorama has changed.
wxButton * GetStitchButton() const
Definition PanoPanel.h:85
void Init(HuginBase::Panorama *pano)
void SetGuiLevel(GuiLevel newGuiLevel)
void DoUserDefinedStitch(const wxString &settings=wxString())
stitching with user defined file
class for generating plugin menu items
Definition PluginItems.h:36
hugin preferences dialog
The image preview frame.
void OnUpdate(wxCommandEvent &event)
Dialog for raw import.
Definition RawImport.h:35
const wxString & GetDataPath()
return the current data path
Definition huginApp.h:104
const wxString & GetXRCPath()
return the current xrc path
Definition huginApp.h:98
static huginApp * Get()
hack.. kind of a pseudo singleton...
Definition huginApp.cpp:651
#define HUGIN_FT_TEMPLATE_SIZE
#define HUGIN_CELESTE_MODEL
#define HUGIN_IMGCACHE_UPPERBOUND
#define HUGIN_FT_CURV_THRESHOLD
#define HUGIN_FT_LOCAL_SEARCH_WIDTH
#define HUGIN_SHOW_PROJECTION_HINTS
#define HUGIN_FT_CORR_THRESHOLD
implementation of huginApp Class
#define HUGIN_CONV_FILENAME
Definition platform.h:40
wxString Components2Str(const HuginGraph::ImageGraph::Components &comp)
Definition huginApp.cpp:84
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_ERROR(msg)
Definition utils.h:76
#define DEBUG_ASSERT(cond)
Definition utils.h:80
#define DEBUG_DEBUG(msg)
Definition utils.h:68
#define DEBUG_FATAL(msg)
Definition utils.h:78
#define DEBUG_TRACE(msg)
Definition utils.h:67
#define DEBUG_INFO(msg)
Definition utils.h:69
std::vector< ControlPoint > CPVector
std::vector< std::set< std::string > > OptimizeVector
std::set< unsigned int > UIntSet
CommandQueue * GetAssistantCommandQueueUserDefined(const HuginBase::Panorama &pano, const wxString &ExePath, const wxString &project, const wxString &assistantSetting, wxArrayString &tempFilesDelete, std::ostream &errStream)
generates the command queue for running the assistant
std::vector< NormalCommand * > CommandQueue
Definition Executor.h:61
const wxString GetSettingStringTranslated(wxConfigBase *setting, const wxString &name, const wxString defaultValue)
read a translated string from settings and remove all whitespaces
Definition Executor.cpp:288
CommandQueue * GetAssistantCommandQueue(const HuginBase::Panorama &pano, const wxString &ExePath, const wxString &project)
generates the command queue for running the assistant
void GeneratePanoOperationVector()
generates the PanoOperationVector for context menu
void CleanPanoOperationVector()
clears the PanoOperationVector
bool ImportPapywizardFile(const wxString &filename, HuginBase::Panorama &pano)
import the settings from given filename into pano
void destroySVMmodel(struct svm_model *&model)
frees the resource of model
Definition Celeste.cpp:60
bool loadSVMmodel(struct svm_model *&model, std::string &model_file)
loads the SVM model from file
Definition Celeste.cpp:45
str wxQuoteFilename(const str &arg)
Quote a filename, so that it is surrounded by "".
Definition wxPlatform.h:82
bool AskUserOverwrite(const wxString &filename, const wxString &caption, wxWindow *parent)
ask user if the given file should be overwritten, return true if the user confirmed the overwritting
Definition wxutils.cpp:233
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
Definition wxutils.cpp:176
std::unique_ptr< wxMessageDialogBase > MessageDialog
Definition wxutils.h:90
std::string GetUserAppDataDir()
returns the directory for user specific Hugin settings, e.g.
Definition utils.cpp:497
int roundi(T x)
Definition hugin_math.h:73
std::string GetHuginVersion()
return a string with version numbers
Definition utils.cpp:907
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
Definition wxutils.cpp:106
std::string getPathPrefix(const std::string &filename)
Get the path to a filename.
Definition utils.cpp:184
MessageDialog GetMessageDialog(const wxString &message, const wxString &caption, int style, wxWindow *parent)
Definition wxutils.cpp:212
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)
include file for the hugin project
include file for the hugin project
bool IsRawExtension(const wxString &testExt)
return true, if given extension is in list of known raw extension (comparision is case insensitive
Definition platform.cpp:112
bool containsInvalidCharacters(const wxString stringToTest)
returns true, if the given strings contains invalid characters
Definition platform.cpp:511
void ShowFilenameWarning(wxWindow *parent, const wxArrayString filelist)
shows a dialog about filename with invalid characters, all names in filelist will be show in list
Definition platform.cpp:524
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
Definition stl_utils.h:81
Maximum of correlation, position and value.
Definition Correlation.h:57
hugin_utils::FDiff2D corrPos
Definition Correlation.h:66
hugin_utils::FDiff2D curv
Definition Correlation.h:68
hugin_utils::FDiff2D maxpos
Definition Correlation.h:64
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
wxwindows specific panorama commands
WXIMPEX void FixHelpSettings()
helper function to check window position settings of help window
platform/compiler specific stuff.