27 #include "hugin_config.h"
30 #include <wx/stdpaths.h>
31 #include <wx/wfstream.h>
38 #include "vigra/imageinfo.hxx"
92 wxFrame(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP)
94 SetExtraStyle(GetExtraStyle() | wxWS_EX_TRANSIENT);
95 wxSizer* topSizer=
new wxBoxSizer(wxVERTICAL);
96 wxStaticBitmap* staticBitmap=
new wxStaticBitmap(
this,wxID_ANY,bitmap);
97 topSizer->Add(staticBitmap,1,wxEXPAND);
98 SetSizerAndFit(topSizer);
99 SetClientSize(bitmap.GetWidth(), bitmap.GetHeight());
103 #if defined(__WXMSW__) || defined(__WXMAC__)
105 #elif defined(__WXGTK20__)
112 DECLARE_EVENT_TABLE()
116 BEGIN_EVENT_TABLE(HuginSplashScreen, wxFrame)
120 bool PanoDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames)
124 if (!mf)
return false;
126 if (!m_imageOnly && filenames.GetCount() == 1) {
127 wxFileName file(filenames[0]);
128 if (file.GetExt().CmpNoCase(wxT(
"pto")) == 0 ||
129 file.GetExt().CmpNoCase(wxT(
"ptp")) == 0 ||
130 file.GetExt().CmpNoCase(wxT(
"pts")) == 0 )
137 ImageCache::getInstance().flush();
144 std::vector<std::string> filesv;
145 std::vector<std::string> rawFilesv;
146 wxArrayString invalidFiles;
147 for (
unsigned int i=0; i< filenames.GetCount(); i++) {
148 wxFileName file(filenames[i]);
156 invalidFiles.Add(file.GetFullPath());
170 invalidFiles.Add(file.GetFullPath());
180 if (!invalidFiles.empty())
189 if(pano.getNrOfCtrlPoints()>0)
195 std::vector<PanoCommand::PanoCommand*> cmds;
202 if (!rawFilesv.empty())
204 if (rawFilesv.size() == 1)
206 wxMessageDialog message(mf, _(
"You selected only one raw file. This is not recommended.\nAll raw files should be converted at once."),
212 wxICON_EXCLAMATION | wxOK | wxCANCEL);
213 message.SetOKLabel(_(
"Convert anyway."));
214 if (message.ShowModal() != wxID_OK)
224 if (dlg.ShowModal() == wxID_OK)
234 #if defined _WIN32 && defined Hugin_shared
235 DEFINE_LOCAL_EVENT_TYPE(EVT_LOADING_FAILED)
237 DEFINE_EVENT_TYPE(EVT_LOADING_FAILED)
242 EVT_MENU(XRCID("action_new_project"),
MainFrame::OnNewProject)
243 EVT_MENU(XRCID("action_load_project"),
MainFrame::OnLoadProject)
244 EVT_MENU(XRCID("action_browse_projects"),
MainFrame::OnBrowseProjects)
245 EVT_MENU(XRCID("action_save_project"),
MainFrame::OnSaveProject)
246 EVT_MENU(XRCID("action_save_as_project"),
MainFrame::OnSaveProjectAs)
247 EVT_MENU(XRCID("action_save_as_ptstitcher"),
MainFrame::OnSavePTStitcherAs)
248 EVT_MENU(XRCID("action_open_batch_processor"),
MainFrame::OnOpenPTBatcher)
249 EVT_MENU(XRCID("action_import_project"),
MainFrame::OnMergeProject)
250 EVT_MENU(XRCID("action_import_papywizard"),
MainFrame::OnReadPapywizard)
251 EVT_MENU(XRCID("action_apply_template"),
MainFrame::OnApplyTemplate)
252 EVT_MENU(XRCID("action_exit_hugin"),
MainFrame::OnUserQuit)
253 EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9,
MainFrame::OnMRUFiles)
254 EVT_MENU(XRCID("action_show_about"),
MainFrame::OnAbout)
255 EVT_MENU(XRCID("action_show_help"),
MainFrame::OnHelp)
256 EVT_MENU(XRCID("action_show_tip"),
MainFrame::OnTipOfDay)
257 EVT_MENU(XRCID("action_show_shortcuts"),
MainFrame::OnKeyboardHelp)
258 EVT_MENU(XRCID("action_show_faq"),
MainFrame::OnFAQ)
259 EVT_MENU(XRCID("action_show_prefs"),
MainFrame::OnShowPrefs)
260 EVT_MENU(XRCID("action_assistant"),
MainFrame::OnRunAssistant)
261 EVT_MENU(XRCID("action_batch_assistant"),
MainFrame::OnSendToAssistantQueue)
262 EVT_MENU(XRCID("action_gui_simple"),
MainFrame::OnSetGuiSimple)
263 EVT_MENU(XRCID("action_gui_advanced"),
MainFrame::OnSetGuiAdvanced)
264 EVT_MENU(XRCID("action_gui_expert"),
MainFrame::OnSetGuiExpert)
266 EVT_MENU(XRCID(
"action_python_script"), MainFrame::OnPythonScript)
269 EVT_MENU(XRCID("ID_EDITREDO"),
MainFrame::OnRedo)
270 EVT_MENU(XRCID("ID_SHOW_FULL_SCREEN"),
MainFrame::OnFullScreen)
271 EVT_MENU(XRCID("ID_SHOW_PREVIEW_FRAME"),
MainFrame::OnTogglePreviewFrame)
272 EVT_MENU(XRCID("ID_SHOW_GL_PREVIEW_FRAME"),
MainFrame::OnToggleGLPreviewFrame)
273 EVT_BUTTON(XRCID("ID_SHOW_PREVIEW_FRAME"),
MainFrame::OnTogglePreviewFrame)
274 EVT_BUTTON(XRCID("ID_SHOW_GL_PREVIEW_FRAME"),
MainFrame::OnToggleGLPreviewFrame)
276 EVT_MENU(XRCID("action_optimize"),
MainFrame::OnOptimize)
277 EVT_MENU(XRCID("action_optimize_only_active"),
MainFrame::OnOnlyActiveImages)
278 EVT_MENU(XRCID("action_optimize_ignore_line_cp"),
MainFrame::OnIgnoreLineCp)
279 EVT_BUTTON(XRCID("action_optimize"),
MainFrame::OnOptimize)
280 EVT_MENU(XRCID("action_finetune_all_cp"),
MainFrame::OnFineTuneAll)
282 EVT_MENU(XRCID("action_remove_cp_in_masks"),
MainFrame::OnRemoveCPinMasks)
284 EVT_MENU(XRCID("ID_CP_TABLE"),
MainFrame::OnShowCPFrame)
285 EVT_BUTTON(XRCID("ID_CP_TABLE"),
MainFrame::OnShowCPFrame)
287 EVT_MENU(XRCID("ID_SHOW_PANEL_IMAGES"),
MainFrame::OnShowPanel)
288 EVT_MENU(XRCID("ID_SHOW_PANEL_MASK"),
MainFrame::OnShowPanel)
289 EVT_MENU(XRCID("ID_SHOW_PANEL_CP_EDITOR"),
MainFrame::OnShowPanel)
290 EVT_MENU(XRCID("ID_SHOW_PANEL_OPTIMIZER"),
MainFrame::OnShowPanel)
291 EVT_MENU(XRCID("ID_SHOW_PANEL_OPTIMIZER_PHOTOMETRIC"),
MainFrame::OnShowPanel)
292 EVT_MENU(XRCID("ID_SHOW_PANEL_PANORAMA"),
MainFrame::OnShowPanel)
293 EVT_MENU(XRCID("action_stitch"),
MainFrame::OnDoStitch)
294 EVT_MENU(XRCID("action_stitch_userdefined"),
MainFrame::OnUserDefinedStitch)
295 EVT_MENU(XRCID("action_add_images"),
MainFrame::OnAddImages)
296 EVT_BUTTON(XRCID("action_add_images"),
MainFrame::OnAddImages)
297 EVT_MENU(XRCID("action_add_time_images"),
MainFrame::OnAddTimeImages)
298 EVT_BUTTON(XRCID("action_add_time_images"),
MainFrame::OnAddTimeImages)
301 EVT_COMMAND(wxID_ANY, EVT_LOADING_FAILED,
MainFrame::OnLoadingFailed)
318 : cp_frame(0), pano(pano)
323 bool disableOpenGL=
false;
324 if(wxGetKeyState(WXK_COMMAND))
327 wxXmlResource::Get()->LoadDialog(&dlg, NULL, wxT(
"disable_opengl_dlg"));
328 long noOpenGL=wxConfigBase::Get()->Read(wxT(
"DisableOpenGL"), 0l);
331 XRCCTRL(dlg,
"disable_dont_ask_checkbox", wxCheckBox)->SetValue(
true);
333 if(dlg.ShowModal()==wxID_OK)
335 if(XRCCTRL(dlg,
"disable_dont_ask_checkbox", wxCheckBox)->IsChecked())
337 wxConfigBase::Get()->Write(wxT(
"DisableOpenGL"), 1l);
341 wxConfigBase::Get()->Write(wxT(
"DisableOpenGL"), 0l);
347 wxConfigBase::Get()->Write(wxT(
"DisableOpenGL"), 0l);
352 long noOpenGL=wxConfigBase::Get()->Read(wxT(
"DisableOpenGL"), 0l);
353 disableOpenGL=(noOpenGL==1);
365 dc.SelectObject(bitmap);
367 wxFont font(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
369 wxFont font(8, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
372 dc.SetTextForeground(*wxBLACK);
373 dc.SetTextBackground(*wxWHITE);
377 dc.GetTextExtent(version, &tw, &th);
379 dc.DrawText(version, bitmap.GetWidth() - tw - 3, bitmap.GetHeight() - th - 3);
380 dc.SelectObject(wxNullBitmap);
382 #if wxCHECK_VERSION(3,1,6)
383 bitmap.SetScaleFactor(GetDPIScaleFactor());
387 wxLogFatalError(_(
"Fatal installation error\nThe file data/splash.png was not found at:") +
huginApp::Get()->
GetXRCPath());
399 wxXmlResource::Get()->LoadFrame(
this, parent, wxT(
"main_frame"));
404 wxApp::s_macAboutMenuItemId = XRCID(
"action_show_about");
405 wxApp::s_macPreferencesMenuItemId = XRCID(
"action_show_prefs");
406 wxApp::s_macExitMenuItemId = XRCID(
"action_exit_hugin");
407 wxApp::s_macHelpMenuTitleName = _(
"&Help");
409 wxMenuBar* mainMenu=wxXmlResource::Get()->LoadMenuBar(
this, wxT(
"main_menubar"));
413 SetMenuBar(mainMenu);
414 m_optOnlyActiveImages = (wxConfigBase::Get()->Read(wxT(
"/OptimizePanel/OnlyActiveImages"), 1l) != 0);
420 wxMenuBar* menubar=GetMenuBar();
422 wxMenu *pluginMenu=
new wxMenu();
428 bool cont = dir.GetFirst(&filename, wxT(
"*.py"), wxDIR_FILES | wxDIR_HIDDEN);
432 wxFileName file(dir.GetName(), filename);
437 items.push_back(item);
439 cont = dir.GetNext(&filename);
444 for (PluginItems::const_iterator it = items.begin(); it != items.end(); ++it)
447 int categoryID = pluginMenu->FindItem(item.
GetCategory());
448 wxMenu* categoryMenu;
449 if (categoryID == wxNOT_FOUND)
451 categoryMenu =
new wxMenu();
452 pluginMenu->AppendSubMenu(categoryMenu, item.
GetCategory());
456 categoryMenu = pluginMenu->FindItem(categoryID)->GetSubMenu();
460 Connect(pluginID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnPlugin));
464 if (pluginMenu->GetMenuItemCount() > 0)
466 menubar->Insert(menubar->GetMenuCount() - 2, pluginMenu, _(
"&Actions"));
470 GetMenuBar()->Enable(XRCID(
"action_python_script"),
false);
474 SetToolBar(wxXmlResource::Get()->LoadToolBar(
this, wxT(
"main_toolbar")));
490 m_notebook = XRCCTRL((*
this),
"controls_notebook", wxNotebook);
523 wxConfigBase * config=wxConfigBase::Get();
543 wxDir::GetAllFiles(
GetDataPath()+
"output", &files, wxT(
"*.executor"), wxDIR_FILES | wxDIR_HIDDEN | wxDIR_NO_FOLLOW);
544 const size_t nrAllUserSequences = files.size();
546 if (!files.IsEmpty())
550 int outputMenuId=mainMenu->FindMenu(_(
"&Output"));
551 if (outputMenuId != wxNOT_FOUND)
553 wxMenu* outputSequencesMenu =
new wxMenu;
555 for (
auto file : files)
557 if (i > 0 && i == nrAllUserSequences && outputSequencesMenu->GetMenuItemCount() > 0)
559 outputSequencesMenu->AppendSeparator();
567 wxFileInputStream inputStream(file);
568 if (inputStream.IsOk())
571 wxFileConfig executorFile(inputStream);
576 help = wxString::Format(_(
"User defined sequence: %s"), file);
581 outputSequencesMenu->Append(outputId, desc, help);
594 if ((outputSequencesMenu->GetMenuItemCount() == 1 && !(outputSequencesMenu->FindItemByPosition(0)->IsSeparator())) ||
595 outputSequencesMenu->GetMenuItemCount() > 1)
597 m_outputUserMenu = mainMenu->GetMenu(outputMenuId)->AppendSubMenu(outputSequencesMenu, _(
"User defined output sequences"));
601 delete outputSequencesMenu;
610 wxDir::GetAllFiles(
GetDataPath() +
"assistant", &files, wxT(
"*.assistant"), wxDIR_FILES | wxDIR_HIDDEN | wxDIR_NO_FOLLOW);
611 const size_t nrAllUserSequences = files.size();
613 if (!files.IsEmpty())
617 const int editMenuId = mainMenu->FindMenu(_(
"&Edit"));
618 if (editMenuId != wxNOT_FOUND)
620 wxMenu* userAssistantMenu =
new wxMenu;
622 for (
auto file : files)
624 if (i > 0 && i == nrAllUserSequences && userAssistantMenu->GetMenuItemCount() > 0)
626 userAssistantMenu->AppendSeparator();
633 wxFileInputStream inputStream(file);
634 if (inputStream.IsOk())
637 wxFileConfig assistantFile(inputStream);
640 help = help.Trim(
true).Trim(
false);
643 help = wxString::Format(_(
"User defined assistant: %s"), file);
648 userAssistantMenu->Append(assistantId, desc, help);
661 if (userAssistantMenu->GetMenuItemCount() > 0)
663 m_assistantUserMenu = mainMenu->GetMenu(editMenuId)->Insert(5, wxID_ANY, _(
"User defined assistant"), userAssistantMenu);
667 delete userAssistantMenu;
676 wxIconBundle myIcons(
GetXRCPath() + wxT(
"data/hugin.ico"), wxBITMAP_TYPE_ICO);
679 wxIcon myIcon(
GetXRCPath() + wxT(
"data/hugin.png"),wxBITMAP_TYPE_PNG);
690 const int fields (2);
691 CreateStatusBar(fields);
692 int widths[fields] = {-1, 85};
693 SetStatusWidths( fields, &widths[0]);
694 SetStatusText(_(
"Started"), 0);
700 #if defined __WXMAC__ || defined __WXMSW__
702 SetSizeHints(900, 675);
705 SetSizeHints(780, 455);
709 ImageCache::getInstance().setProgressDisplay(
this);
710 #if defined __WXMSW__
713 unsigned long mem_high = wxConfigBase::Get()->Read(wxT(
"/ImageCache/UpperBoundHigh"), (
long) 0);
715 mem = ((
unsigned long long) mem_high << 32) + mem_low;
720 ImageCache::getInstance().SetUpperLimit(mem);
722 ImageCache::getInstance().SetUpperLimit(wxConfigBase::Get()->Read(wxT(
"/ImageCache/UpperBound"),
HUGIN_IMGCACHE_UPPERBOUND));
732 SetAutoLayout(
false);
738 this->SetBackgroundColour(
images_panel->GetBackgroundColour());
751 freopen(
"c:\\hugin_stdout.txt",
"w", stdout);
752 freopen(
"c:\\hugin_stderr.txt",
"w", stderr);
758 long guiLevel=config->Read(wxT(
"/GuiLevel"),(
long)0);
759 guiLevel = std::max<long>(0, std::min<long>(2, guiLevel));
785 ImageCache::getInstance().setProgressDisplay(NULL);
786 delete & ImageCache::getInstance();
794 wxConfigBase* config = wxConfigBase::Get();
801 config->Write(wxT(
"/GuiLevel"),(
long)
m_guiLevel);
821 if (!(lastCommand ==
"remove control point" || lastCommand ==
"remove control points"))
830 wxToolBar* theToolBar = GetToolBar();
831 wxMenuBar* theMenuBar = GetMenuBar();
833 theMenuBar->Enable (XRCID(
"ID_EDITUNDO"), can_undo);
834 theToolBar->EnableTool(XRCID(
"ID_EDITUNDO"), can_undo);
836 theMenuBar->Enable (XRCID(
"ID_EDITREDO"), can_redo);
837 theToolBar->EnableTool(XRCID(
"ID_EDITREDO"), can_redo);
882 assert(&
pano == &panorama);
894 wxString messageString;
898 messageString = _(
"Save changes to the project file before opening another project?");
901 messageString = _(
"Save changes to the project file before starting a new project?");
905 messageString = _(
"Save changes to the project file before closing?");
908 wxMessageDialog message(wxGetActiveWindow(), messageString,
914 wxICON_EXCLAMATION | wxYES_NO | (cancelable? (wxCANCEL):0));
918 message.SetExtendedMessage(_(
"If you load another project without saving, your changes since last save will be discarded."));
921 message.SetExtendedMessage(_(
"If you start a new project without saving, your changes since last save will be discarded."));
925 message.SetExtendedMessage(_(
"If you close without saving, your changes since your last save will be discarded."));
928 #if defined __WXMAC__ || defined __WXMSW__
930 message.SetYesNoLabels(wxID_SAVE, _(
"Don't Save"));
933 message.SetYesNoLabels(wxID_SAVE, _(
"Close without saving"));
935 int answer = message.ShowModal();
939 wxCommandEvent dummy;
964 wxLogError(_(
"forced close"));
993 ImageCache::getInstance().flush();
1008 DEBUG_DEBUG(
"stripping " << path <<
" from image filenames");
1012 SetStatusText(wxString::Format(_(
"saved project %s"),
m_filename.c_str()),0);
1017 gl_preview_frame->SetTitle(scriptName.GetName() + wxT(
".") + scriptName.GetExt() + wxT(
" - ") + _(
"Hugin - Panorama Creator"));
1019 SetTitle(scriptName.GetName() + wxT(
".") + scriptName.GetExt() + wxT(
" - ") + _(
"Panorama editor"));
1023 SetTitle(scriptName.GetName() + wxT(
".") + scriptName.GetExt() + wxT(
" - ") + _(
"Hugin - Panorama Creator"));
1028 }
catch (std::exception & e) {
1029 wxString err(e.what(), wxConvLocal);
1030 wxMessageBox(wxString::Format(_(
"Could not save project file \"%s\".\nMaybe the file or the folder is read-only.\n\n(Error code: %s)"),
m_filename.c_str(),err.c_str()),_(
"Error"),wxOK|wxICON_ERROR);
1037 wxFileName scriptName;
1046 scriptName.Normalize(wxPATH_NORM_ABSOLUTE | wxPATH_NORM_DOTS | wxPATH_NORM_TILDE | wxPATH_NORM_SHORTCUT);
1047 wxFileDialog dlg(wxGetActiveWindow(),
1048 _(
"Save project file"),
1049 scriptName.GetPath(), scriptName.GetFullName(),
1050 _(
"Project files (*.pto)|*.pto|All files (*)|*"),
1051 wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition);
1052 if (dlg.ShowModal() == wxID_OK) {
1053 wxConfig::Get()->Write(wxT(
"/actualPath"), dlg.GetDirectory());
1054 wxString fn = dlg.GetPath();
1055 if (fn.Right(4).CmpNoCase(wxT(
".pto"))!=0)
1057 fn.Append(wxT(
".pto"));
1058 if (wxFile::Exists(fn)) {
1059 int d = wxMessageBox(wxString::Format(_(
"File %s exists. Overwrite?"), fn.c_str()),
1060 _(
"Save project"), wxYES_NO | wxICON_QUESTION);
1079 wxFileName scriptNameFN(scriptName);
1080 wxString fn = scriptNameFN.GetName() + wxT(
".txt");
1081 wxFileDialog dlg(wxGetActiveWindow(),
1082 _(
"Save PTmender script file"),
1083 wxConfigBase::Get()->Read(wxT(
"/actualPath"),wxT(
"")), fn,
1084 _(
"PTmender files (*.txt)|*.txt"),
1085 wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition);
1086 if (dlg.ShowModal() == wxID_OK) {
1087 wxString fname = dlg.GetPath();
1089 wxFileName scriptName = fname;
1109 SetStatusText( _(
"Open project: ") + filename);
1111 wxFileName fname(filename);
1112 wxString path = fname.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
1113 if (fname.IsOk() && fname.FileExists())
1123 wxMessageBox(wxString::Format(_(
"Could not load project file \"%s\".\nIt is not a valid pto file."), filename), _(
"Error"), wxOK | wxICON_ERROR);
1139 SetStatusText(_(
"Project opened"));
1140 m_mruFiles.AddFileToHistory(fname.GetFullPath());
1145 gl_preview_frame->SetTitle(fname.GetName() + wxT(
".") + fname.GetExt() + wxT(
" - ") + _(
"Hugin - Panorama Stitcher"));
1147 SetTitle(fname.GetName() + wxT(
".") + fname.GetExt() + wxT(
" - ") + _(
"Panorama editor"));
1151 SetTitle(fname.GetName() + wxT(
".") + fname.GetExt() + wxT(
" - ") + _(
"Hugin - Panorama Stitcher"));
1156 SetStatusText(_(
"Loading canceled"));
1164 SetTitle(_(
"Panorama editor"));
1168 SetTitle(_(
"Hugin - Panorama Stitcher"));
1171 if (! (fname.GetExt() == wxT(
"pto"))) {
1178 wxConfigBase* config = wxConfigBase::Get();
1179 config->Write(wxT(
"/actualPath"), path);
1181 SetStatusText( _(
"Error opening project: ") + filename);
1187 wxCommandEvent dummy;
1197 void MainFrame::MacOnOpenFile(
const wxString & filename)
1201 ImageCache::getInstance().flush();
1213 wxConfigBase* config = wxConfigBase::Get();
1215 wxString defaultdir = config->Read(wxT(
"/actualPath"),wxT(
""));
1216 wxFileDialog dlg(wxGetActiveWindow(),
1217 _(
"Open project file"),
1218 defaultdir, wxT(
""),
1219 _(
"Project files (*.pto)|*.pto|All files (*)|*"),
1220 wxFD_OPEN, wxDefaultPosition);
1221 dlg.SetDirectory(defaultdir);
1222 if (dlg.ShowModal() == wxID_OK)
1224 wxString filename = dlg.GetPath();
1227 if(wxMessageBox(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()),
1233 wxYES_NO | wxICON_QUESTION)==wxYES)
1235 wxArrayString filenameArray;
1236 filenameArray.Add(filename);
1244 ImageCache::getInstance().flush();
1253 SetStatusText( _(
"Open project: cancel"));
1262 ImageCache::getInstance().flush();
1264 wxConfigBase* config = wxConfigBase::Get();
1267 if (dialog.ShowModal() == wxID_OK)
1272 config->Write(
"/actualPath", dialog.GetSelectedPath());
1285 ImageCache::getInstance().flush();
1292 SetTitle(_(
"Panorama editor"));
1296 SetTitle(_(
"Hugin - Panorama Stitcher"));
1299 wxCommandEvent dummy;
1323 wxArrayString invalidFiles;
1324 for(
unsigned int i=0;i<filenameArray.GetCount(); i++)
1328 invalidFiles.Add(filenameArray[i]);
1331 if(!invalidFiles.empty())
1337 std::vector<std::string> filesv;
1338 for (
unsigned int i=0; i< filenameArray.GetCount(); i++) {
1343 if (!filesv.empty()) {
1367 if(e.GetId()==XRCID(
"ID_SHOW_PANEL_MASK"))
1370 if(e.GetId()==XRCID(
"ID_SHOW_PANEL_CP_EDITOR"))
1373 if(e.GetId()==XRCID(
"ID_SHOW_PANEL_OPTIMIZER"))
1376 if(e.GetId()==XRCID(
"ID_SHOW_PANEL_OPTIMIZER_PHOTOMETRIC"))
1388 if(e.GetId()==XRCID(
"ID_SHOW_PANEL_PANORAMA"))
1413 if (wxFileExists(e.GetString()))
1416 wxMessageBox(wxString::Format(_(
"Could not load image \"%s\".\nThis file is not a valid image.\nThis file will be removed from the project."), e.GetString()),
1422 wxOK | wxICON_ERROR);
1427 wxMessageBox(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()),
1433 wxOK | wxICON_ERROR);
1442 imagesToRemove.insert(i);
1445 if (!imagesToRemove.empty())
1497 DisplayHelp(wxT(
"Hugin_Keyboard_shortcuts.html"));
1508 if (section.IsEmpty())
1514 #if defined __wxMSW__ && !(wxCHECK_VERSION(3,1,1))
1528 bool bShowAtStartup;
1533 wxConfigBase * config = wxConfigBase::Get();
1534 nValue = config->Read(wxT(
"/MainFrame/ShowStartTip"),1l);
1538 strFile =
GetXRCPath() + wxT(
"data/tips.txt");
1540 DEBUG_INFO(
"Reading tips from " << strFile.mb_str(wxConvLocal));
1542 bShowAtStartup = wxShowTip(wxGetActiveWindow(), tipProvider, (nValue ?
true :
false));
1545 nValue = (bShowAtStartup ? tipProvider->GetCurrentTip() : 0);
1547 config->Write(wxT(
"/MainFrame/ShowStartTip"), nValue);
1556 pref_dlg.ShowModal();
1558 wxConfigBase* cfg=wxConfigBase::Get();
1559 #if defined __WXMSW__
1562 unsigned long mem_high = cfg->Read(wxT(
"/ImageCache/UpperBoundHigh"), (
long) 0);
1565 mem = ((
unsigned long long) mem_high << 32) + mem_low;
1571 ImageCache::getInstance().SetUpperLimit(mem);
1593 wxCommandEvent dummy;
1603 #if defined __WXMSW__ || defined __WXMAC__
1610 #if defined __WXMSW__
1617 #elif defined __WXGTK__
1646 wxCommandEvent dummy;
1658 wxMenuBar* menubar = GetMenuBar();
1661 menubar->Check(XRCID(
"action_optimize_only_active"), onlyActive);
1676 m_optIgnoreLineCp = GetMenuBar()->IsChecked(XRCID(
"action_optimize_ignore_line_cp"));
1685 wxMenuBar* menubar = GetMenuBar();
1688 menubar->Check(XRCID(
"action_optimize_ignore_line_cp"), ignoreLineCP);
1701 wxCommandEvent dummy;
1708 wxCommandEvent cmdEvt(wxEVT_COMMAND_BUTTON_CLICKED,XRCID(
"pano_button_stitch"));
1709 pano_panel->GetEventHandler()->AddPendingEvent(cmdEvt);
1733 wxConfigBase* config = wxConfigBase::Get();
1735 wxString defaultdir = config->Read(wxT(
"/actualPath"),wxT(
""));
1736 wxFileDialog dlg(wxGetActiveWindow(),
1737 _(
"Open project file"),
1738 defaultdir, wxT(
""),
1739 _(
"Project files (*.pto)|*.pto|All files (*)|*"),
1740 wxFD_OPEN, wxDefaultPosition);
1741 dlg.SetDirectory(defaultdir);
1742 if (dlg.ShowModal() == wxID_OK)
1744 wxString filename = dlg.GetPath();
1745 wxFileName fname(filename);
1746 wxString path = fname.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
1747 if (fname.IsOk() && fname.FileExists())
1760 m_mruFiles.AddFileToHistory(fname.GetFullPath());
1764 wxCommandEvent dummy;
1770 wxMessageBox(wxString::Format(_(
"Could not read project file %s."),fname.GetFullPath().c_str()),_(
"Error"),wxOK|wxICON_ERROR);
1778 wxString currentDir = wxConfigBase::Get()->Read(wxT(
"/actualPath"), wxT(
""));
1779 wxFileDialog dlg(wxGetActiveWindow(), _(
"Open Papywizard xml file"),
1780 currentDir, wxT(
""), _(
"Papywizard xml files (*.xml)|*.xml|All files (*)|*"),
1781 wxFD_OPEN, wxDefaultPosition);
1782 dlg.SetDirectory(currentDir);
1783 if (dlg.ShowModal() == wxID_OK)
1785 wxConfigBase::Get()->Write(wxT(
"/actualPath"), dlg.GetDirectory());
1793 wxConfigBase* config = wxConfigBase::Get();
1795 wxFileDialog dlg(wxGetActiveWindow(),
1796 _(
"Choose template project"),
1797 config->Read(wxT(
"/templatePath"),wxT(
"")), wxT(
""),
1798 _(
"Project files (*.pto)|*.pto|All files (*)|*"),
1799 wxFD_OPEN, wxDefaultPosition);
1800 dlg.SetDirectory(wxConfigBase::Get()->Read(wxT(
"/templatePath"),wxT(
"")));
1801 if (dlg.ShowModal() == wxID_OK) {
1802 wxString filename = dlg.GetPath();
1803 wxConfig::Get()->Write(wxT(
"/templatePath"), dlg.GetDirectory());
1815 #if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
1819 FSRef actuallyLaunched;
1821 FSRef documentArray[1];
1822 LSLaunchFSRefSpec launchSpec;
1825 err = LSFindApplicationForInfo(kLSUnknownCreator,
1826 CFSTR(
"net.sourceforge.hugin.PTBatcherGUI"),
1832 wxMessageBox(wxString::Format(_(
"External program %s not found in the bundle, reverting to system path"), wxT(
"open")), _(
"Error"));
1834 wxExecute(_T(
"open -b net.sourceforge.hugin.PTBatcherGUI"));
1837 wxExecute(_T(
"open -b net.sourceforge.hugin.PTBatcherGUI"));
1840 const wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
1841 wxExecute(exePath.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + _T(
"PTBatcherGUI"));
1853 std::set<unsigned int> unoptimized;
1854 for (
unsigned int i=0; i < cps.size(); i++) {
1856 unoptimized.insert(i);
1859 unsigned int nGood=0;
1860 unsigned int nBad=0;
1862 wxConfigBase *cfg = wxConfigBase::Get();
1872 ProgressReporterDialog progress(unoptimized.size(), _(
"Fine-tuning all points"), _(
"Fine-tuning"), wxGetActiveWindow());
1874 ImageCache & imgCache = ImageCache::getInstance();
1880 std::set<unsigned int>::iterator it=unoptimized.begin();
1882 imgCache.softFlush();
1884 while (it != unoptimized.end()) {
1885 if (cps[*it].image1Nr == imgNr || cps[*it].image2Nr == imgNr) {
1886 if (!progress.updateDisplayValue())
1893 wxImage wxSearchImg;
1895 pano.
getImage(cps[*it].image2Nr).getFilename())->get8BitImage();
1898 pano.
getImage(cps[*it].image1Nr).getFilename())->get8BitImage();
1905 pano.
getImage(cps[*it].image2Nr), *searchImg, roundP2, sWidth);
1913 if (res.
maxi < corrThresh || res.
curv.
x < curvThresh || res.
curv.
y < curvThresh ||
1918 if (res.
maxi >= corrThresh) {
1921 cps[*it].error = res.
maxi;
1930 cps[*it].error = res.
maxi;
1936 cps[*it].error = 1.0;
1938 unsigned int rm = *it;
1940 unoptimized.erase(rm);
1949 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"),
1950 nGood, nBad, corrThresh);
1951 wxMessageBox(result, _(
"Fine-tune result"), wxOK);
1968 wxMessageBox(wxString::Format(_(
"Removed %lu control points"), static_cast<unsigned long>(cps.size())),
1969 _(
"Removing control points in masks"),wxOK|wxICON_INFORMATION);
1974 void MainFrame::OnPythonScript(wxCommandEvent & e)
1977 wxFileDialog dlg(wxGetActiveWindow(),
1978 _(
"Select python script"),
1979 wxConfigBase::Get()->Read(wxT(
"/lensPath"),wxT(
"")), wxT(
""),
1980 _(
"Python script (*.py)|*.py|All files (*.*)|*.*"),
1981 wxFD_OPEN, wxDefaultPosition);
1982 dlg.SetDirectory(wxConfigBase::Get()->Read(wxT(
"/pythonScriptPath"),wxT(
"")));
1984 if (dlg.ShowModal() == wxID_OK)
1986 wxString filename = dlg.GetPath();
1987 wxConfig::Get()->Write(wxT(
"/pythonScriptPath"), dlg.GetDirectory());
1990 new PanoCommand::PythonScriptPanoCmd(
pano,scriptfile)
1995 void MainFrame::OnPlugin(wxCommandEvent & e)
1997 wxFileName file=m_plugins[e.GetId()];
1998 if(file.FileExists())
2002 new PanoCommand::PythonScriptPanoCmd(
pano,scriptfile)
2007 wxMessageBox(wxString::Format(wxT(
"Python-Script %s not found.\nStopping processing."),file.GetFullPath().c_str()),_(
"Warning"),wxOK|wxICON_INFORMATION);
2063 if (switchToCropMode)
2095 msg = wxGetTranslation(wxString(
m_message.c_str(), wxConvLocal));
2098 msg.Append(wxT(
" "));
2102 GetStatusBar()->SetStatusText(msg, 0);
2111 wxToolBar* theToolBar = GetToolBar();
2112 theToolBar->EnableTool(XRCID(
"action_optimize"), option);
2113 theToolBar->EnableTool(XRCID(
"ID_SHOW_PREVIEW_FRAME"), option);
2115 wxMenuBar* theMenuBar = GetMenuBar();
2116 theMenuBar->Enable(XRCID(
"action_optimize"), option);
2117 theMenuBar->Enable(XRCID(
"action_finetune_all_cp"), option);
2118 theMenuBar->Enable(XRCID(
"action_remove_cp_in_masks"), option);
2119 theMenuBar->Enable(XRCID(
"ID_SHOW_PREVIEW_FRAME"), option);
2120 theMenuBar->Enable(XRCID(
"action_stitch"), option);
2121 theMenuBar->Enable(XRCID(
"action_stitch_userdefined"), option);
2130 theMenuBar->Enable(XRCID(
"action_assistant"), option);
2131 theMenuBar->Enable(XRCID(
"action_batch_assistant"), option);
2140 wxSize sz = this->GetSize();
2141 wxSize csz = this->GetClientSize();
2142 wxSize vsz = this->GetVirtualSize();
2144 " client: "<< csz.x <<
"," << csz.y <<
2145 " virtual: "<< vsz.x <<
"," << vsz.y);
2179 return wxGetApp().GetDataPath();
2206 size_t index = e.GetId() - wxID_FILE1;
2207 wxString f(
m_mruFiles.GetHistoryFile(index));
2211 if (fn.FileExists())
2217 ImageCache::getInstance().flush();
2225 wxMessageBox(wxString::Format(_(
"File \"%s\" not found.\nMaybe file was renamed, moved or deleted."),f.c_str()),
2226 _(
"Error!"),wxOK | wxICON_INFORMATION );
2233 ShowFullScreen(!IsFullScreen(), wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION);
2236 GetToolBar()->Show(
true);
2251 if (! wxFile::Exists(wxstrModelFileName) ) {
2252 wxMessageBox(wxString::Format(_(
"Celeste model expected in %s not found, Hugin needs to be properly installed."),wxstrModelFileName.c_str()), _(
"Fatal Error"));
2257 wxMessageBox(wxString::Format(_(
"Could not load Celeste model file %s"),wxstrModelFileName.c_str()),_(
"Error"));
2278 bool needsUpdateOptimizerVar=
false;
2280 for(
size_t i=0; i<optVec.size(); i++)
2282 bool hasTrX=optVec[i].erase(
"TrX")>0;
2283 bool hasTrY=optVec[i].erase(
"TrY")>0;
2284 bool hasTrZ=optVec[i].erase(
"TrZ")>0;
2285 bool hasTpy=optVec[i].erase(
"Tpy")>0;
2286 bool hasTpp=optVec[i].erase(
"Tpp")>0;
2287 bool hasg=optVec[i].erase(
"g")>0;
2288 bool hast=optVec[i].erase(
"t")>0;
2289 needsUpdateOptimizerVar=needsUpdateOptimizerVar || hasTrX || hasTrY || hasTrZ || hasTpy || hasTpp || hasg || hast;
2291 if(needsUpdateOptimizerVar)
2300 bool needsUpdateOptimizerVar=
false;
2302 for(
size_t i=0; i<optVec.size(); i++)
2304 bool hasVx=optVec[i].erase(
"Vx")>0;
2305 bool hasVy=optVec[i].erase(
"Vy")>0;
2306 needsUpdateOptimizerVar=needsUpdateOptimizerVar || hasVx || hasVy;
2308 if(needsUpdateOptimizerVar)
2327 GetMenuBar()->FindItem(XRCID(
"action_gui_simple"))->Check();
2330 GetMenuBar()->FindItem(XRCID(
"action_gui_advanced"))->Check();
2333 GetMenuBar()->FindItem(XRCID(
"action_gui_expert"))->Check();
2340 wxCommandEvent dummy;
2344 GetMenuBar()->Remove(0);
2349 SetTitle(_(
"Panorama editor"));
2354 gl_preview_frame->SetTitle(scriptName.GetName() + wxT(
".") + scriptName.GetExt() + wxT(
" - ") + _(
"Hugin - Panorama Stitcher"));
2355 SetTitle(scriptName.GetName() + wxT(
".") + scriptName.GetExt() + wxT(
" - ") + _(
"Panorama editor"));
2361 wxGetApp().SetTopWindow(
this);
2362 GetMenuBar()->Remove(0);
2366 SetTitle(_(
"Hugin - Panorama Stitcher"));
2371 SetTitle(scriptName.GetName() + wxT(
".") + scriptName.GetExt() + wxT(
" - ") + _(
"Hugin - Panorama Stitcher"));
2391 wxMessageBox(_(
"Can't switch to simple interface. The project is using stacks and/or vignetting center shift.\nThese features are not supported in simple interface."),
2397 wxOK | wxICON_INFORMATION);
2401 wxMessageBox(_(
"Can't switch to simple interface. The project is using translation or shear parameters.\nThese parameters are not supported in simple interface."),
2407 wxOK | wxICON_INFORMATION);
2422 wxMessageBox(_(
"Can't switch to advanced interface. The project is using translation or shear parameters.\nThese parameters are not supported in advanced interface."),
2428 wxOK | wxICON_INFORMATION);
2440 GetMenuBar()->Enable(XRCID(
"ID_SHOW_GL_PREVIEW_FRAME"),
false);
2441 GetMenuBar()->Enable(XRCID(
"action_gui_simple"),
false);
2442 GetToolBar()->EnableTool(XRCID(
"ID_SHOW_GL_PREVIEW_FRAME"),
false);
2448 wxString tempDir= wxConfig::Get()->Read(wxT(
"tempDir"),wxT(
""));
2449 if(!tempDir.IsEmpty())
2451 if(tempDir.Last()!=wxFileName::GetPathSeparator())
2453 tempDir.Append(wxFileName::GetPathSeparator());
2456 wxFileName scriptFileName(wxFileName::CreateTempFileName(tempDir+wxT(
"ha")));
2461 const wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
2462 wxArrayString tempfiles;
2464 if (userdefinedAssistant.IsEmpty())
2470 std::stringstream errors;
2472 if (commands->empty())
2474 wxMessageBox(_(
"The assistant queue is empty. This indicates an error in the user defined assistant file.") +
"\n\n" + wxString(errors.str()),
2475 _(
"Error"), wxOK | wxICON_ERROR, mainWin);
2477 wxRemoveFile(scriptFileName.GetFullPath());
2490 wxRemoveFile(scriptFileName.GetFullPath());
2491 if (!tempfiles.IsEmpty())
2493 for (
auto& f : tempfiles)
2508 if (userdefinedAssistant.IsEmpty())
2512 wxMessageBox(_(
"The assistant could not find vertical lines. Please add vertical lines in the panorama editor and optimize project manually."),
2513 _(
"Warning"), wxOK | wxICON_INFORMATION, mainWin);
2520 if (comps.size() > 1)
2523 unsigned i1 = *(comps[0].rbegin());
2524 unsigned i2 = *(comps[1].begin());
2527 wxMessageBox(wxString::Format(_(
"Warning %d unconnected image groups found:"), static_cast<int>(comps.size())) +
Components2Str(comps) + wxT(
"\n")
2528 + _(
"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);
2531 wxMessageBox(_(
"The assistant did not complete successfully. Please check the resulting project file."),
2532 _(
"Warning"), wxOK | wxICON_INFORMATION, mainWin);
2537 wxMessageBox(_(
"The assistant did not complete successfully. Please check the resulting project file."),
2538 _(
"Warning"), wxOK | wxICON_INFORMATION, mainWin);
2563 wxCommandEvent dummy;
2568 #if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
2572 FSRef actuallyLaunched;
2574 FSRef documentArray[1];
2575 LSLaunchFSRefSpec launchSpec;
2578 err = LSFindApplicationForInfo(kLSUnknownCreator,
2579 CFSTR(
"net.sourceforge.hugin.PTBatcherGUI"),
2586 wxMessageBox(wxString::Format(_(
"External program %s not found in the bundle, reverting to system path"), wxT(
"open")), _(
"Error"));
2592 wxCharBuffer projectFilebuffer=projectFile.ToUTF8();
2594 err = FSPathMakeRef((
unsigned char*) projectFilebuffer.data(), &documentArray[0], &isDir);
2595 if (err != noErr || isDir)
2598 wxMessageBox(wxString::Format(_(
"Project file not found"), wxT(
"open")), _(
"Error"));
2601 launchSpec.appRef = &appRef;
2602 launchSpec.numDocs =
sizeof(documentArray)/
sizeof(documentArray[0]);
2603 launchSpec.itemRefs = documentArray;
2604 launchSpec.passThruParams = NULL;
2605 launchSpec.launchFlags = kLSLaunchDontAddToRecents + kLSLaunchDontSwitch;
2606 launchSpec.asyncRefCon = NULL;
2608 err = LSOpenFromRefSpec(&launchSpec, &actuallyLaunched);
2609 if (err != noErr && err != kLSLaunchInProgressErr)
2613 wxMessageBox(wxString::Format(_(
"Can't launch PTBatcherGui"), wxT(
"open")), _(
"Error"));
2618 if (FSCompareFSRefs(&appRef, &actuallyLaunched) != noErr)
2621 wxMessageBox(wxString::Format(_(
"Launched incorrect programme"), wxT(
"open")), _(
"Error"));
2625 const wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
2626 wxExecute(exePath.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + wxT(
"PTBatcherGUI -a ")+
hugin_utils::wxQuoteFilename(projectFile));
void DisplayHelp(wxString section=wxEmptyString)
call help browser with given file
void OnShowCPFrame(wxCommandEvent &e)
OptimizePanel * opt_panel
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 ...
Base class for all panorama commands.
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
const bool GetOptimizeOnlyActiveImages() const
#define HUGIN_SHOW_PROJECTION_HINTS
void OnUpdate(wxCommandEvent &event)
std::list< PluginItem > PluginItems
void updateProgressDisplay()
receive notification about progress.
std::map< int, wxString > m_userOutput
bool FileExists(const std::string &filename)
checks if file exists
void SetGuiLevel(GuiLevel newLevel)
void OnRemoveCPinMasks(wxCommandEvent &e)
const wxString & GetDataPath()
return the current data path
void OnUserQuit(wxCommandEvent &e)
void OnRunAssistant(wxCommandEvent &e)
void OnApplyTemplate(wxCommandEvent &e)
The OpenGL preview frame.
void setMemento(const PanoramaMemento &memento)
set the internal state
virtual PanoCommand::PanoCommand * GetCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
returns the appropriate PanoCommand::PanoCommand to be inserted into GlobalCmdHistory, checks if operation is enabled
void AddImages(wxArrayString &filenameArray)
adds the given files to the projects, with checking for invalid filenames
void SetGuiLevel(GuiLevel newGuiLevel)
void ShowStitcherTab()
opens the stitcher tab
const bool GetOptimizeIgnoreLineCp() const
void StorePositionAndSize()
store position and size of window in wxConfig
start a new project, reset options to values in preferences
read settings from papywizard xml file
#define HUGIN_FT_LOCAL_SEARCH_WIDTH
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
void OnToggleGLPreviewFrame(wxCommandEvent &e)
void AddUserDefinedAssistant(int id, const wxString &desc, const wxString &help)
adds the given user defined assistant to SplitButton menu
void OnRedo(wxCommandEvent &e)
GLPreviewFrame * gl_preview_frame
ImagesPanel * images_panel
bool m_show_opt_photo_panel
void OnUndo(wxCommandEvent &e)
center panorama horizontically
wxMenuItem * m_assistantUserMenu
struct celeste::svm_model * svmModel
control point editor panel.
OptimizePhotometricPanel * opt_photo_panel
bool removeObserver(PanoramaObserver *observer)
remove a panorama observer.
GuiLevel GetMinimumGuiLevel(HuginBase::PanoramaData &pano)
returns the requiered GuiLevel for the given panorama to work correctly
hugin_utils::FDiff2D corrPos
const wxString GetSelectedCPGenerator()
return the currently selected cp generator description
void RunAssistant(wxWindow *mainWin, const wxString &userdefinedAssistant=wxEmptyString)
#define HUGIN_FT_CURV_THRESHOLD
void registerPTWXDlgFcn()
void OnUserDefinedStitch(wxCommandEvent &e)
void OnSavePTStitcherAs(wxCommandEvent &e)
void OnExit(wxCloseEvent &e)
void RunCPGenerator(CPDetectorSetting &setting, const HuginBase::UIntSet &img)
run the cp generator with the given setting on selected images
const wxString GetDescription() const
return description
Reading python plugins metadata.
void OnTipOfDay(wxCommandEvent &e)
void deregisterPTWXDlgFcn()
void OnMergeProject(wxCommandEvent &e)
This is a cache for all the images we use.
void SetOptimizeOnlyActiveImages(const bool onlyActive)
sets the status of the "optimize only active images" menu item
#define DEBUG_ASSERT(cond)
void OnPhotometricOptimize(wxCommandEvent &e)
HuginBase::ImageCache::ImageCacheRGB8Ptr ImageCacheRGB8Ptr
simple class that forward the drop to the mainframe
include file for the hugin project
A tip file provider that uses gettext to translate the tips.
wxHelpController & GetHelpController()
virtual void clearDirty()
clear dirty flag.
void OnSendToAssistantQueue(wxCommandEvent &e)
void setImage(unsigned int imgNr, bool updateListSelection=false)
sets the image, which is currently edited
void setLeftImage(unsigned int imgNr)
set left image
void InitPreviews()
init previews
const CPVector & getCtrlPoints() const
get all control point of this Panorama
void GeneratePanoOperationVector()
generates the PanoOperationVector for context menu
void OnLoadingFailed(wxCommandEvent &e)
event handler called when loading of image file failed
static MainFrame * m_this
wxMenuItem * m_outputUserMenu
remove several control points
void DoUserDefinedStitch(const wxString &settings=wxString())
stitching with user defined file
void ShowControlPoint(unsigned int cpNr)
show a control point
Definition of PanoOperation class.
std::vector< HuginBase::UIntSet > Components
stores the components of the graph
void SetGuiLevel(GuiLevel newGuiLevel)
static huginApp * Get()
hack.. kind of a pseudo singleton...
void OnUserDefinedStitchSaved(wxCommandEvent &e)
PanoCommand to combine other PanoCommands.
void Init(HuginBase::Panorama *pano)
apply a template to a panorama object
std::set< unsigned int > UIntSet
void OnSetGuiAdvanced(wxCommandEvent &e)
void Init(HuginBase::Panorama *pano)
CommandQueue * GetAssistantCommandQueue(const HuginBase::Panorama &pano, const wxString &ExePath, const wxString &project)
generates the command queue for running the assistant
algorithms for remove control points by statistic method
void ShowCtrlPoint(unsigned int cpNr)
void LoadOpenGLLayout()
loads the layout of the OpenGL windows and restores it
updates the optimize vector, aka all variables which should be optimized
bool loadSVMmodel(struct svm_model *&model, std::string &model_file)
loads the SVM model from file
wxMenu * m_menu_file_simple
void LoadProjectFile(const wxString &filename)
#define HUGIN_IMGCACHE_UPPERBOUND
const wxFileName GetFilename() const
returns filename
std::string getPathPrefix(const std::string &filename)
Get the path to a filename.
HuginBase::Panorama & pano
void OnFineTuneAll(wxCommandEvent &e)
Definition of dialog and functions to import RAW images to project file.
const wxString & GetDataPath()
get the path to data directory
const OptimizeVector & getOptimizeVector() const
return the optimize settings stored inside panorama
bool loadPTScript(std::istream &i, int &ptoVersion, const std::string &prefix="")
load a Hugin file
#define HUGIN_FT_TEMPLATE_SIZE
class, which stores all settings of one cp detector
void OnKeyboardHelp(wxCommandEvent &e)
PanoCommand::PanoCommand * GetPanoCommand()
return PanoCommand for adding converted raw files to Panorama
bool comparePluginItem(PluginItem item1, PluginItem item2)
compares 2 plugin with category and name
std::size_t getNrOfImages() const
number of images.
static MainFrame * Get()
hack.. kind of a pseudo singleton...
void SetIgnoreLineCP(const bool noLineCp)
for external setting of "ignore line cp" checkbox
void OnIgnoreLineCp(wxCommandEvent &e)
const PanoCommand * getLastCommand() const
return the last PanoCommand
void SetOnlyActiveImages(const bool onlyActive)
for external setting of "only active image" checkbox
void OnMRUFiles(wxCommandEvent &e)
event handler for recently used files
void OnFAQ(wxCommandEvent &e)
void SwitchToCropMode()
switches the controls to crop mode
void AddUserDefinedSequence(int id, const wxString &desc, const wxString &help)
adds the given user defined output sequence to SplitButton menu
Dialog for browsing pto files.
void SetGuiLevel(GuiLevel newLevel)
sets the gui level
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Store window size and position in configfile/registry.
void OnCPListFrameClosed()
virtual void panoramaChanged(HuginBase::Panorama &pano)
this is called whenever the panorama has changed.
void DisableOpenGLTools()
disables all OpenGL related menu items and toobar buttons
void OnAddImages(wxCommandEvent &e)
class for generating plugin menu items
virtual bool wasSuccessful() const
void SetOnlyActiveImages(const bool onlyActive)
for external setting of "only active image" checkbox
void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet &imgNr)
notifies about changes to images
wxString GetCurrentOptimizerString()
returns the string which describes the current selected optimizer setting
PanoOperation to add several user selected images to the panorama.
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)
class for showing splash screen the class wxSplashScreen from wxWidgets does not work correctly for o...
Maximum of correlation, position and value.
std::string getLastCommandName() const
returns the name of the last command
Definition of dialog for numeric transforms.
hugin_utils::FDiff2D curv
void OnTogglePreviewFrame(wxCommandEvent &e)
wxwindows specific panorama commands
bool canRedo() const
Return true iff there is a command to redo.
const wxString GetName() const
return name from metadata
void OnOptimizeButton(wxCommandEvent &e)
run the optimizer
update all control points
void clearRedoQueue()
clear all commands in the redo queue
virtual ~MainFrame()
dtor.
distributes all images above the sphere, for the assistant
void SetShowProjectionHints(bool new_value)
set status if projection hints should be shown or not
void SetOptimizeIgnoreLineCp(const bool ignoreLineCP)
sets the status of the "ignore line cp" menu item
static GlobalCmdHist & getInstance()
const wxString & GetXRCPath()
get the path to the xrc directory
void OnOptimizeButton(wxCommandEvent &e)
run the optimizer
void ShowMaskEditor(size_t imgNr, bool switchToCropMode=false)
opens the mask/crop editor with the given image selected
void OnBrowseProjects(wxCommandEvent &e)
void Init(HuginBase::Panorama *pano)
void addCommand(PanoCommand *command, bool execute=true)
Adds a command to the history.
void OnLoadProject(wxCommandEvent &e)
const bool IsAPIValid() const
returns true, if plugin can run on given system and version
void OnOptimize(wxCommandEvent &e)
void clear()
Erases all the undo/redo history.
void ReloadCPDetectorSettings()
Reloads the cp detector settings from config, necessary after edit preferences.
wxMenu * m_menu_file_advanced
void Init(HuginBase::Panorama *pano)
void OnSaveProjectAs(wxCommandEvent &e)
void OnSaveProject(wxCommandEvent &e)
void RunCPGenerator(CPDetectorSetting &setting, const HuginBase::UIntSet &img)
run the cp generator with the given setting on selected images
bool CloseProject(bool cancelable, CloseReason reason)
void SetGuiLevel(GuiLevel newGuiLevel)
void Init(HuginBase::Panorama *pano)
void OnShowPanel(wxCommandEvent &e)
void addObserver(PanoramaObserver *o)
add a panorama observer.
void OnDoStitch(wxCommandEvent &e)
struct celeste::svm_model * GetSVMModel()
void changeFinished(bool keepDirty)
notify observers about changes in this class
PanoOperation to add all image in a defined timeinterval to the panorama.
include file for the hugin project
#define HUGIN_CELESTE_MODEL
const PanoramaOptions & getOptions() const
returns the options for this panorama
void OnHelp(wxCommandEvent &e)
bool canUndo() const
Return true iff there is a command to undo.
const wxString GetSettingStringTranslated(wxConfigBase *setting, const wxString &name, const wxString defaultValue)
read a translated string from settings and remove all whitespaces
void setRightImage(unsigned int imgNr)
set right image
const int getPhotometricOptimizerSwitch() const
return the photometric optimizer master switch
#define HUGIN_FT_CORR_THRESHOLD
GLPreviewFrame * getGLPreview()
Components GetComponents()
find all connected components
void OnRunAssistantUserdefined(wxCommandEvent &e)
Memento class for a Panorama object.
bool isDirty() const
true if there are unsaved changes
void ShowCtrlPointEditor(unsigned int img1, unsigned int img2)
opens the control points tab with the both images selected
const int getOptimizerSwitch() const
returns optimizer master switch
MainFrame(wxWindow *parent, HuginBase::Panorama &pano)
ctor.
std::string GetUserAppDataDir()
returns the directory for user specific Hugin settings, e.g.
void Init(HuginBase::Panorama *pano)
HuginSplashScreen(wxWindow *parent, wxBitmap bitmap)
bool m_optOnlyActiveImages
add image(s) to a panorama
Definition of dialog to browse directory with pto files.
virtual void redo()
Redoes the last undone action.
std::string GetHuginVersion()
return a string with version numbers
void OnOnlyActiveImages(wxCommandEvent &e)
void OnNewProject(wxCommandEvent &e)
hugin_utils::FDiff2D maxpos
void OnSetGuiSimple(wxCommandEvent &e)
CPDetectorSetting & GetDefaultSetting()
returns the default cp detector settings
std::vector< ControlPoint > CPVector
functions for interaction with the hugin configuration file
wxString GetCurrentOptimizerString()
return the currently selected optimizer setting as string from the drop down list box ...
bool WritePTOFile(const std::string &filename, const std::string &prefix="")
write data to given pto file
void OnOpenPTBatcher(wxCommandEvent &e)
std::vector< std::set< std::string > > OptimizeVector
void OnShowPrefs(wxCommandEvent &e)
Define the pano edit panel.
void OnFullScreen(wxCommandEvent &e)
event handler for full screen
MaskEditorPanel * mask_panel
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
void OnShowEvent(wxShowEvent &e)
remove multiple images from a panorama
void CleanPanoOperationVector()
clears the PanoOperationVector
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
virtual void undo()
Undoes the last action.
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
void OnAbout(wxCommandEvent &e)
CPDetectorSetting & GetDefaultSetting()
returns default cp detector setting
virtual void panoramaChanged(HuginBase::Panorama &pano)
Enable or disable undo and redo.
const wxString GetCategory() const
return category name
void OnAddTimeImages(wxCommandEvent &e)
str wxQuoteFilename(const str &arg)
Quote a filename, so that it is surrounded by "".
dump the current project and load a new one.
void OnSize(wxSizeEvent &e)
wxString getProjectName()
const wxString & GetXRCPath()
return the current xrc path
void SetGuiLevel(GuiLevel newGuiLevel)
sets the GuiLevel for all controls on this panel
UIntSet getCPinMasks(HuginBase::Panorama pano)
returns these control points, which are in masks
bool IsShowingCorrelation() const
PreviewFrame * preview_frame
const wxString GetSelectedCPGenerator()
return the currently selected cp generator description
void ResetPreviewZoom()
reset zoom level for preview window
wxString Components2Str(const HuginGraph::ImageGraph::Components &comp)
std::map< int, wxString > m_userAssistant
wxString getDefaultProjectName(const HuginBase::Panorama &pano, const wxString filenameTemplate)
gets the default project name, as defined in the preferences
std::vector< NormalCommand * > CommandQueue
void printStitcherScript(std::ostream &o, const PanoramaOptions &target, const UIntSet &imgs) const
create the stitcher script
void OnSetGuiExpert(wxCommandEvent &e)
bool CheckRawFiles()
return true, if all raw files are from the same camera
create a CommandQueue for running the assistant using CLI tools
void OnReadPapywizard(wxCommandEvent &e)
void enableTools(bool option)
class to work with images graphs created from a HuginBase::Panorama class it creates a graph based on...