28#include <wx/stdpaths.h>
37#pragma comment(lib, "PowrProf.lib")
39#include <wx/taskbarbutton.h>
60 if (file.GetExt().CmpNoCase(
"pto") == 0 ||
61 file.GetExt().CmpNoCase(
"ptp") == 0 ||
62 file.GetExt().CmpNoCase(
"pts") == 0 )
92 wxXmlResource::Get()->LoadFrame(
this, (wxWindow* )
NULL,
"batch_frame");
95 wxApp::s_macExitMenuItemId =
XRCID(
"menu_exit");
96 wxApp::s_macHelpMenuTitleName =
_(
"&Help");
103 int widths[2] = { -1, 150 };
131 text.Append(
_(
"Should the loading of the batch queue be skipped?"));
153#if !defined __WXMAC__ && !defined __WXOSX_COCOA__
178 if (wxTaskBarIcon::IsAvailable())
185 wxConfigBase::Get()->Read(
"/BatchFrame/minimizeTray", &
minTray,
false);
342 wxTextEntryDialog dlg(
this,
_(
"Please enter the command-line application to execute:"),
_(
"Enter application"));
343 wxTheApp->SetEvtHandlerEnabled(
false);
352 wxTheApp->SetEvtHandlerEnabled(
true);
359 _(
"Specify a directory to search for projects in"),
361 dlg.SetPath(wxConfigBase::Get()->Read(
"/BatchFrame/actualPath",
wxEmptyString));
364 wxConfig::Get()->Write(
"/BatchFrame/actualPath",
dlg.GetPath());
379 _(
"Specify project source file(s)"),
381 _(
"Project files (*.pto)|*.pto|All files (*)|*"),
387 wxConfig::Get()->Write(
"/BatchFrame/actualPath",
wxPathOnly(
dlg.GetPath()));
407 _(
"Specify project source file(s)"),
409 _(
"Project files (*.pto)|*.pto|All files (*)|*"),
419 wxConfig::Get()->Write(
"/BatchFrame/actualPath",
wxPathOnly(
paths[0]));
421 wxConfig::Get()->Write(
"/BatchFrame/actualPath",
dlg.GetDirectory());
423 for(
unsigned int i=0;
i<
paths.GetCount();
i++)
435 _(
"Specify project source file(s)"),
437 _(
"Project files (*.pto)|*.pto|All files (*)|*"),
447 wxConfig::Get()->Write(
"/BatchFrame/actualPath",
wxPathOnly(
paths[0]));
449 wxConfig::Get()->Write(
"/BatchFrame/actualPath",
dlg.GetDirectory());
452 for(
unsigned int i=0;
i<
paths.GetCount();
i++)
488 s=wxString::Format(
_(
"Add project %s to stitching queue."),
aFile.c_str());
491 s=wxString::Format(
_(
"Add project %s to assistant queue."),
aFile.c_str());
545 list.Add(
dlg.GetPath());
553 while (!prefix.IsDirWritable())
555 hugin_utils::HuginMessageBox(wxString::Format(
_(
"You have no permissions to write in folder \"%s\".\nPlease select another folder for the final output."), prefix.GetPath()),
561 prefix =
dlg.GetPath();
572 SetStatusText(
_(
"The prefix of an assistant target cannot be changed."));
637 SetStatusText(
_(
"Changing user defined sequence is not possible for application entries."));
643 SetStatusText(
_(
"You can change the user defined sequence only for the same type of operation (either stitching or assistant)."));
717 _(
"Specify batch file to open"),
719 _(
"Batch file (*.ptq)|*.ptq;|All files (*)|*"),
723 wxConfig::Get()->Write(
"/BatchFrame/batchPath",
dlg.GetDirectory());
928 _(
"Specify batch file to save"),
930 _(
"Batch file (*.ptq)|*.ptq;|All files (*)|*"),
934 wxConfig::Get()->Write(
"/BatchFrame/batchPath",
dlg.GetDirectory());
987 for (
unsigned int i = 0;
i<list->GetCount();
i++)
991 list->SetSelection(
i);
995 list->SetSelection(0);
1003#if defined __WXMAC__ || defined __WXOSX_COCOA__
1006 i=
config->Read(
"/BatchFrame/ShutdownCheck", 0l);
1013 config->DeleteEntry(
"/BatchFrame/ShutdownCheck");
1015 i =
config->Read(
"/BatchFrame/AtEnd", 0l);
1016#if defined __WXMAC__ || defined __WXOSX_COCOA__
1025 i=
config->Read(
"/BatchFrame/OverwriteCheck", 0l);
1028 i=
config->Read(
"/BatchFrame/VerboseCheck", 0l);
1031 i=
config->Read(
"/BatchFrame/AutoRemoveCheck", 1l);
1034 i=
config->Read(
"/BatchFrame/AutoStitchCheck", 0l);
1037 i=
config->Read(
"/BatchFrame/SaveLog", 0l);
1075 if(
event.IsChecked())
1078 config->Write(
"/BatchFrame/OverwriteCheck", 1l);
1083 config->Write(
"/BatchFrame/OverwriteCheck", 0l);
1099 if(
event.IsChecked())
1102 config->Write(
"/BatchFrame/VerboseCheck", 1l);
1107 config->Write(
"/BatchFrame/VerboseCheck", 0l);
1124 config->Write(
"/BatchFrame/AutoRemoveCheck", 1l);
1128 config->Write(
"/BatchFrame/AutoRemoveCheck", 0l);
1139 config->Write(
"/BatchFrame/AutoStitchCheck", 1l);
1143 config->Write(
"/BatchFrame/AutoStitchCheck", 0l);
1154 config->Write(
"/BatchFrame/SaveLog", 1l);
1158 config->Write(
"/BatchFrame/SaveLog", 0l);
1170 message->SetYesNoLabels(
_(
"Clear batch queue now"),
_(
"Keep batch queue"));
1181 config->Write(
"/BatchFrame/Max", 1l);
1182 config->Write(
"/BatchFrame/Minimized", 0l);
1186 config->Write(
"/BatchFrame/Max", 0l);
1189 config->Write(
"/BatchFrame/Minimized", 1l);
1193 config->Write(
"/BatchFrame/Minimized", 0l);
1194 config->Write(
"/BatchFrame/Width", GetSize().GetWidth());
1195 config->Write(
"/BatchFrame/Height", GetSize().GetHeight());
1238 if(index>=0 && index<(
projListBox->GetItemCount()-1))
1273 int width =
config->Read(
"/BatchFrame/Width", -1l);
1274 int height =
config->Read(
"/BatchFrame/Height", -1l);
1275 int max =
config->Read(
"/BatchFrame/Max", -1l);
1276 int min =
config->Read(
"/BatchFrame/Minimized", -1l);
1277 if((width != -1) && (height != -1))
1279 SetSize(width,height);
1309 if (
m_tray && e.GetInt() == 1)
1324#if defined __WXMSW__ && wxUSE_TASKBARBUTTON
1351 Show(!e.IsIconized());
1366 if (!e.IsIconized())
1405 config->Write(
"/BatchFrame/minimizeTray",
event.IsChecked());
@ EVT_TIMER_UPDATE_LISTBOX
void SelectEndTask(wxControlWithItems *list, const Batch::EndTask endTask)
Batch processor for Hugin with GUI.
Definition of failed projects dialog.
Definition of dialog to change user defined sequence.
Definition of GenerateSequenceDialog class.
Batch processor for Hugin with GUI.
Simple class that forward the drop to the mainframe.
bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
File/directory drag and drop handler method.
ProgressStatusBar * m_progStatusBar
void ChangeUserDefined(int index, wxString newUserDefined)
void OnButtonResetAll(wxCommandEvent &event)
void OnMinimizeTrayMenu(wxCommandEvent &e)
void UpdateTrayIcon(const bool createTrayIcon)
create or destroy the tray icon
void OnButtonRunBatch(wxCommandEvent &event)
void OnButtonPause(wxCommandEvent &event)
void OnCheckVerbose(wxCommandEvent &event)
void OnCheckOverwrite(wxCommandEvent &event)
ProjectListBox * projListBox
void OnRefillListBox(wxCommandEvent &e)
called if the project box needs to be updated, because projects were added or deleted
bool IsPaused()
returns true, if batch is paused
void SetInternalVerbose(bool newVerbose)
sets the current verbose status, does not update the checkbox
void AddArrayToList(const wxArrayString &fileList, Project::Target target)
void OnButtonAddToAssistantQueue(wxCommandEvent &event)
let the user select a project file which should be added to the stitching queue
void OnButtonMoveUp(wxCommandEvent &event)
void SwapProject(int index, bool down)
wxHelpController & GetHelpController()
return help controller for open help
void UpdateBatchVerboseStatus()
update visibility of verbose output window depending on status of verbose checkbox
void OnProgress(wxCommandEvent &event)
event handler for update progress controls
void OnButtonRemoveFromList(wxCommandEvent &event)
wxTimer * m_updateProjectsTimer
void OnCheckAutoStitch(wxCommandEvent &event)
event handler called when auto stitch checkbox was changed
void OnButtonSkip(wxCommandEvent &event)
void OnButtonAddDir(wxCommandEvent &event)
void OnUpdateListBox(wxTimerEvent &event)
called by thread to update listbox
bool GetCheckAutoRemove()
return if auto remove checkbox is checked
Batch::EndTask GetEndTask()
return which task should be executed at end
void OnButtonChangePrefix(wxCommandEvent &event)
void OnButtonAddToStitchingQueue(wxCommandEvent &event)
let the user select a project file which should be added to the stitching queue
void OnProcessTerminate(wxProcessEvent &event)
BatchTaskBarIcon * m_tray
void OnButtonOpenBatch(wxCommandEvent &event)
void OnButtonChangeUserDefinedSequence(wxCommandEvent &event)
void OnButtonGenerateSequence(wxCommandEvent &e)
generate a sequence of panoramas
void OnButtonMoveDown(wxCommandEvent &event)
void OnButtonReset(wxCommandEvent &event)
bool GetCheckSaveLog()
return if always save log is checked
void OnButtonHelp(wxCommandEvent &event)
void OnClose(wxCloseEvent &event)
void OnButtonSearchPano(wxCommandEvent &e)
void OnButtonCancel(wxCommandEvent &event)
wxStatusBar * OnCreateStatusBar(int number, long style, wxWindowID id, const wxString &name)
bool GetCheckVerbose()
return if verbose checkbox is checked
void OnCheckSaveLog(wxCommandEvent &event)
event handler called when always save log checkbox was changed
bool GetCheckAutoStitch()
return if auto stitch checkbox is checked
void SetLocaleAndXRC(wxLocale *locale, wxString xrc)
void OnBatchInformation(wxCommandEvent &e)
called when batch wants to show some progress message
void OnCheckAutoRemove(wxCommandEvent &event)
event handler called when auto remove checkbox was changed
void OnBatchFailed(wxCommandEvent &event)
called when batch was finished and there are failed projects
bool GetCheckOverwrite()
return if overwrite checkbox is checked
void OnButtonOpenWithHugin(wxCommandEvent &event)
void OnButtonSaveBatch(wxCommandEvent &event)
void OnMinimize(wxIconizeEvent &e)
handle when minimize or restore image
void OnButtonAddCommand(wxCommandEvent &event)
bool IsRunning()
returns true, if batch is running
void OnChoiceEnd(wxCommandEvent &event)
void AddDirToList(wxString aDir)
BatchFrame(wxLocale *locale, wxString xrc)
void OnUserExit(wxCommandEvent &event)
void OnButtonClear(wxCommandEvent &event)
void OnButtonRemoveComplete(wxCommandEvent &event)
void ChangePrefix(int index, wxString newPrefix)
void UpdateTaskBarProgressBar()
update the progress bar in the task bar
void AddToList(wxString aFile, Project::Target target=Project::STITCHING, wxString userDefined=wxEmptyString)
class for showing a taskbar/tray icon
int ClearBatch()
Clears batch list and returns 0 if succesful.
void RunBatch()
Starts batch execution.
void ChangeUserDefined(int index, wxString newUserDefined)
Changes user defined sequence for project at index.
int GetRunningCount()
Returns number of projects currently in progress.
void SaveBatchFile(wxString file)
Saves batch list to file.
void RemoveProjectAtIndex(int selIndex)
Removes project at index from batch list.
bool CompareProjectsInLists(int stitchListIndex, int batchListIndex)
Compares two project at indexes in both lists and returns true if they have identical project ids.
void AddProjectToBatch(wxString projectFile, wxString outputFile=wxEmptyString, wxString userDefinedSequence=wxEmptyString, Project::Target target=Project::STITCHING)
Adds a project entry in the batch list.
bool IsPaused()
Returns true if batch execution is currently paused.
void PauseBatch()
Pauses and continues batch execution.
void AddAppToBatch(wxString app)
Adds an application entry in the batch list.
Project * GetProject(int index)
Returns project at index.
bool IsRunning()
return true, if batch is running
Project::Status GetStatus(int index)
Returns current status of project at index.
void ChangePrefix(int index, wxString newPrefix)
Changes output prefix for project at index.
void CancelProject(int index)
Cancels project at index in batch, failing it.
void SwapProject(int index)
Swaps position in batch of project at index with project at index+1.
void SetStatus(int index, Project::Status status)
Used internally to set status of selected project.
bool NoErrors()
Returns true if there are no failed projects in batch.
int LoadBatchFile(wxString file)
Clears current batch list and loads projects from batch file.
void SaveTemp()
Saves batch list to temporary file.
int LoadTemp()
Loads temporary batch file.
int GetProjectCount()
Returns number of projects in batch list.
void ShowOutput(bool isVisible=true)
Set visibility of all running projects.
void CancelBatch()
Stops batch run, failing projects in progress.
size_t GetFailedProjectsCount()
returns number of failed projects
Dialog for changing the user defined sequence.
Dialog for finding panorama in given directory.
Dialog for finding panorama in given directory.
Dialog for generate panoramas from a sequence of images.
class for showing a status bar with progress, the progress bar is always in the last field of the sta...
int GetProgress()
return current progress value, should be in range 0 - 100, or -1 if the progress gauge is hidden
void SetProgress(int progress)
update progress bar
void SwapProject(int index)
void AppendProject(Project *project)
wxString GetText(int row, int column)
void ChangePrefix(int index, wxString newPrefix)
HuginBase::UIntSet GetSelectedProjects()
bool UpdateStatus(int index, Project *project)
void ReloadProject(int index, Project *project)
void ChangeUserDefined(int index, wxString newUserDefined)
void SetMissing(int index)
wxString userDefindSequence
std::set< unsigned int > UIntSet
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
std::unique_ptr< wxMessageDialogBase > MessageDialog
MessageDialog GetMessageDialog(const wxString &message, const wxString &caption, int style, wxWindow *parent)
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.