BatchFrame.h

Go to the documentation of this file.
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 #include "ProgressStatusBar.h"
00040 
00042 class BatchDropTarget : public wxFileDropTarget
00043 {
00044 public:
00051     bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
00052 };
00053 
00054 class BatchFrame : public wxFrame, public wxThreadHelper
00055 {
00056 public:
00057     //Main constructor
00058     BatchFrame(wxLocale* locale, wxString xrc);
00059     //Main thread for all file polling - checking for new projects and updating modified ones.
00060     void* Entry();
00061     // create statusbar with progress control
00062     wxStatusBar* OnCreateStatusBar(int number, long style, wxWindowID id, const wxString& name);
00063 
00064     void OnUserExit(wxCommandEvent& event);
00065     void OnButtonAddCommand(wxCommandEvent& event);
00066     void OnButtonAddDir(wxCommandEvent& event);
00067     void OnButtonSearchPano(wxCommandEvent& e);
00069     void OnButtonAddToStitchingQueue(wxCommandEvent& event);
00071     void OnButtonAddToAssistantQueue(wxCommandEvent& event);
00072     void OnButtonCancel(wxCommandEvent& event);
00073     void OnButtonChangePrefix(wxCommandEvent& event);
00074     void OnButtonClear(wxCommandEvent& event);
00075     void OnButtonHelp(wxCommandEvent& event);
00076     void OnButtonMoveDown(wxCommandEvent& event);
00077     void OnButtonMoveUp(wxCommandEvent& event);
00078     void OnButtonOpenBatch(wxCommandEvent& event);
00079     void OnButtonOpenWithHugin(wxCommandEvent& event);
00080     void OnButtonPause(wxCommandEvent& event);
00081     void OnButtonRemoveComplete(wxCommandEvent& event);
00082     void OnButtonRemoveFromList(wxCommandEvent& event);
00083     void OnButtonReset(wxCommandEvent& event);
00084     void OnButtonResetAll(wxCommandEvent& event);
00085     void OnButtonRunBatch(wxCommandEvent& event);
00086     void OnButtonSaveBatch(wxCommandEvent& event);
00087     void OnButtonSkip(wxCommandEvent& event);
00088 
00089     void OnCheckOverwrite(wxCommandEvent& event);
00090     void OnChoiceEnd(wxCommandEvent& event);
00091     void OnCheckVerbose(wxCommandEvent& event);
00093     void OnCheckAutoRemove(wxCommandEvent& event);
00095     void OnCheckAutoStitch(wxCommandEvent& event);
00097     void OnCheckSaveLog(wxCommandEvent& event);
00099     void OnProgress(wxCommandEvent& event);
00100 
00101     //Called on window close to take care of the child thread
00102     void OnClose(wxCloseEvent& event);
00104     void OnMinimize(wxIconizeEvent& e);
00105     //Resets all checkboxes based on m_batch object properties
00106     void PropagateDefaults();
00107     //Sets all checkboxes corresponding the setting in config
00108     void SetCheckboxes();
00109     //Starts batch execution
00110     void RunBatch();
00111     //Sets locale and XRC prefix pointers from main app
00112     void SetLocaleAndXRC(wxLocale* locale, wxString xrc);
00113     //Swaps the project entry at index in the list with the next (at index+1).
00114     void SwapProject(int index);
00115     //PanoramaOptions readOptions(wxString projectFile);
00117     Batch::EndTask GetEndTask();
00119     bool GetCheckOverwrite();
00121     bool GetCheckVerbose();
00123     bool GetCheckAutoRemove();
00125     bool GetCheckAutoStitch();
00127     bool GetCheckSaveLog();
00128     void RestoreSize();
00129     void AddToList(wxString aFile, Project::Target target=Project::STITCHING);
00130     void AddDirToList(wxString aDir);
00131     void ChangePrefix(int index,wxString newPrefix);
00133     bool IsRunning();
00135     bool IsPaused();
00139     void SetStatusInformation(wxString status,bool showBalloon);
00141     void UpdateBatchVerboseStatus();
00143     bool IsStartedMinimized()
00144     {
00145         return m_startedMinimized;
00146     };
00148     void SetInternalVerbose(bool newVerbose);
00150     void UpdateTaskBarProgressBar();
00151 
00152 #ifdef __WXMSW__
00153 
00154     wxCHMHelpController& GetHelpController()
00155     {
00156         return m_msHtmlHelp;
00157     }
00158 #endif
00159 
00160     //wxMutex* projListMutex;
00161     ProjectListBox* projListBox;
00162 
00163 private:
00164     wxLocale* m_locale;
00165     wxString m_xrcPrefix;
00166     Batch* m_batch;
00167     bool m_cancelled;
00168     bool m_paused;
00169     bool m_closeThread; //included to signal the thread to finish execution
00170     wxChoice* m_endChoice;
00171     //TO-DO: include a batch or project progress gauge? Test initialization commented out in constructor
00172     //wxGauge* m_gauge;
00173 #ifdef __WXMSW__
00174     wxCHMHelpController m_msHtmlHelp;
00175 #else
00176     wxHtmlHelpController* m_help;
00177 #endif
00178     BatchTaskBarIcon* m_tray;
00179     ProgressStatusBar* m_progStatusBar;
00180     bool m_startedMinimized;
00181 
00182     void OnProcessTerminate(wxProcessEvent& event);
00185     void OnReloadBatch(wxCommandEvent& event);
00187     void OnUpdateListBox(wxCommandEvent& event);
00189     void OnBatchFailed(wxCommandEvent& event);
00191     void OnBatchInformation(wxCommandEvent& e);
00193     void OnRefillListBox(wxCommandEvent& e);
00194 
00195     DECLARE_EVENT_TABLE()
00196 };
00197 
00198 #endif //BATCHFRAME_H

Generated on 4 Sep 2015 for Hugintrunk by  doxygen 1.4.7