00001 // -*- c-basic-offset: 4 -*- 00002 00027 #ifndef BATCHFRAME_H 00028 #define BATCHFRAME_H 00029 00030 #include "RunStitchFrame.h" 00031 #include "Batch.h" 00032 #include "ProjectListBox.h" 00033 #include "DirTraverser.h" 00034 #ifdef __WXMSW__ 00035 #include "wx/msw/helpchm.h" 00036 #endif 00037 #include "BatchTrayIcon.h" 00038 //#include <wx/app.h> 00039 00041 class BatchDropTarget : public wxFileDropTarget 00042 { 00043 public: 00050 bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames); 00051 }; 00052 00053 class BatchFrame : public wxFrame, wxThreadHelper 00054 { 00055 public: 00056 //Main constructor 00057 BatchFrame(wxLocale* locale, wxString xrc); 00058 //Main thread for all file polling - checking for new projects and updating modified ones. 00059 void* Entry(); 00060 00061 void OnUserExit(wxCommandEvent& event); 00062 void OnButtonAddCommand(wxCommandEvent& event); 00063 void OnButtonAddDir(wxCommandEvent& event); 00064 void OnButtonSearchPano(wxCommandEvent& e); 00066 void OnButtonAddToStitchingQueue(wxCommandEvent& event); 00068 void OnButtonAddToAssistantQueue(wxCommandEvent& event); 00069 void OnButtonCancel(wxCommandEvent& event); 00070 void OnButtonChangePrefix(wxCommandEvent& event); 00071 void OnButtonClear(wxCommandEvent& event); 00072 void OnButtonHelp(wxCommandEvent& event); 00073 void OnButtonMoveDown(wxCommandEvent& event); 00074 void OnButtonMoveUp(wxCommandEvent& event); 00075 void OnButtonOpenBatch(wxCommandEvent& event); 00076 void OnButtonOpenWithHugin(wxCommandEvent& event); 00077 void OnButtonPause(wxCommandEvent& event); 00078 void OnButtonRemoveComplete(wxCommandEvent& event); 00079 void OnButtonRemoveFromList(wxCommandEvent& event); 00080 void OnButtonReset(wxCommandEvent& event); 00081 void OnButtonResetAll(wxCommandEvent& event); 00082 void OnButtonRunBatch(wxCommandEvent& event); 00083 void OnButtonSaveBatch(wxCommandEvent& event); 00084 void OnButtonSkip(wxCommandEvent& event); 00085 00086 void OnCheckOverwrite(wxCommandEvent& event); 00087 void OnCheckParallel(wxCommandEvent& event); 00088 void OnCheckShutdown(wxCommandEvent& event); 00089 void OnCheckVerbose(wxCommandEvent& event); 00091 void OnCheckAutoRemove(wxCommandEvent& event); 00093 void OnCheckAutoStitch(wxCommandEvent& event); 00095 void OnCheckSaveLog(wxCommandEvent& event); 00096 00097 00098 //Called on window close to take care of the child thread 00099 void OnClose(wxCloseEvent& event); 00101 void OnMinimize(wxIconizeEvent& e); 00102 //Resets all checkboxes based on m_batch object properties 00103 void PropagateDefaults(); 00104 //Sets all checkboxes corresponding the setting in config 00105 void SetCheckboxes(); 00106 //Starts batch execution 00107 void RunBatch(); 00108 //Sets locale and XRC prefix pointers from main app 00109 void SetLocaleAndXRC(wxLocale* locale, wxString xrc); 00110 //Swaps the project entry at index in the list with the next (at index+1). 00111 void SwapProject(int index); 00112 //PanoramaOptions readOptions(wxString projectFile); 00114 bool GetCheckParallel(); 00116 bool GetCheckShutdown(); 00118 bool GetCheckOverwrite(); 00120 bool GetCheckVerbose(); 00122 bool GetCheckAutoRemove(); 00124 bool GetCheckAutoStitch(); 00126 bool GetCheckSaveLog(); 00127 void RestoreSize(); 00128 void AddToList(wxString aFile, Project::Target target=Project::STITCHING); 00129 void AddDirToList(wxString aDir); 00130 void ChangePrefix(int index,wxString newPrefix); 00132 bool IsRunning(); 00134 bool IsPaused(); 00138 void SetStatusInformation(wxString status,bool showBalloon); 00140 void UpdateBatchVerboseStatus(); 00142 bool IsStartedMinimized() 00143 { 00144 return m_startedMinimized; 00145 }; 00147 void SetInternalVerbose(bool newVerbose); 00148 00149 #ifdef __WXMSW__ 00150 00151 wxCHMHelpController& GetHelpController() 00152 { 00153 return m_msHtmlHelp; 00154 } 00155 #endif 00156 00157 //wxMutex* projListMutex; 00158 ProjectListBox* projListBox; 00159 00160 private: 00161 wxLocale* m_locale; 00162 wxString m_xrcPrefix; 00163 Batch* m_batch; 00164 bool m_cancelled; 00165 bool m_paused; 00166 bool m_closeThread; //included to signal the thread to finish execution 00167 //TO-DO: include a batch or project progress gauge? Test initialization commented out in constructor 00168 //wxGauge* m_gauge; 00169 #ifdef __WXMSW__ 00170 wxCHMHelpController m_msHtmlHelp; 00171 #else 00172 wxHtmlHelpController* m_help; 00173 #endif 00174 BatchTaskBarIcon* m_tray; 00175 bool m_startedMinimized; 00176 00177 void OnProcessTerminate(wxProcessEvent& event); 00180 void OnReloadBatch(wxCommandEvent& event); 00182 void OnUpdateListBox(wxCommandEvent& event); 00184 void OnBatchFailed(wxCommandEvent& event); 00186 void OnBatchInformation(wxCommandEvent& e); 00188 void OnRefillListBox(wxCommandEvent& e); 00189 00190 DECLARE_EVENT_TABLE() 00191 }; 00192 00193 #endif //BATCHFRAME_H
1.3.9.1