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 #include "wx/help.h"
00035 #if !wxUSE_HELP
00036 #error wxWidgets needs to be compiled with help support (wxUSE_HELP not set)
00037 #endif
00038 #if defined __WXMSW__ && !(wxCHECK_VERSION(3,1,1))
00039 #include "base_wx/wxPlatform.h"
00040 #define wxHelpController HuginCHMHelpController
00041 #endif
00042 #include "BatchTrayIcon.h"
00043 //#include <wx/app.h>
00044 #include "ProgressStatusBar.h"
00045 
00047 class BatchDropTarget : public wxFileDropTarget
00048 {
00049 public:
00056     bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
00057 };
00058 
00059 class BatchFrame : public wxFrame, public wxThreadHelper
00060 {
00061 public:
00062     //Main constructor
00063     BatchFrame(wxLocale* locale, wxString xrc);
00064     //Main thread for all file polling - checking for new projects and updating modified ones.
00065     void* Entry();
00066     // create statusbar with progress control
00067     wxStatusBar* OnCreateStatusBar(int number, long style, wxWindowID id, const wxString& name);
00068 
00069     void OnUserExit(wxCommandEvent& event);
00070     void OnButtonAddCommand(wxCommandEvent& event);
00071     void OnButtonAddDir(wxCommandEvent& event);
00072     void OnButtonSearchPano(wxCommandEvent& e);
00074     void OnButtonAddToStitchingQueue(wxCommandEvent& event);
00076     void OnButtonAddToAssistantQueue(wxCommandEvent& event);
00077     void OnButtonCancel(wxCommandEvent& event);
00078     void OnButtonChangePrefix(wxCommandEvent& event);
00079     void OnButtonClear(wxCommandEvent& event);
00080     void OnMinimizeTrayMenu(wxCommandEvent& e);
00081     void OnButtonHelp(wxCommandEvent& event);
00082     void OnButtonMoveDown(wxCommandEvent& event);
00083     void OnButtonMoveUp(wxCommandEvent& event);
00084     void OnButtonOpenBatch(wxCommandEvent& event);
00085     void OnButtonOpenWithHugin(wxCommandEvent& event);
00086     void OnButtonPause(wxCommandEvent& event);
00087     void OnButtonRemoveComplete(wxCommandEvent& event);
00088     void OnButtonRemoveFromList(wxCommandEvent& event);
00089     void OnButtonReset(wxCommandEvent& event);
00090     void OnButtonResetAll(wxCommandEvent& event);
00091     void OnButtonRunBatch(wxCommandEvent& event);
00092     void OnButtonSaveBatch(wxCommandEvent& event);
00093     void OnButtonSkip(wxCommandEvent& event);
00094 
00095     void OnCheckOverwrite(wxCommandEvent& event);
00096     void OnChoiceEnd(wxCommandEvent& event);
00097     void OnCheckVerbose(wxCommandEvent& event);
00099     void OnCheckAutoRemove(wxCommandEvent& event);
00101     void OnCheckAutoStitch(wxCommandEvent& event);
00103     void OnCheckSaveLog(wxCommandEvent& event);
00105     void OnProgress(wxCommandEvent& event);
00106 
00107     //Called on window close to take care of the child thread
00108     void OnClose(wxCloseEvent& event);
00110     void OnMinimize(wxIconizeEvent& e);
00111     //Resets all checkboxes based on m_batch object properties
00112     void PropagateDefaults();
00113     //Sets all checkboxes corresponding the setting in config
00114     void SetCheckboxes();
00115     //Starts batch execution
00116     void RunBatch();
00117     //Sets locale and XRC prefix pointers from main app
00118     void SetLocaleAndXRC(wxLocale* locale, wxString xrc);
00119     //Swaps the project entry at index in the list with the next (at index+1).
00120     void SwapProject(int index);
00121     //PanoramaOptions readOptions(wxString projectFile);
00123     Batch::EndTask GetEndTask();
00125     bool GetCheckOverwrite();
00127     bool GetCheckVerbose();
00129     bool GetCheckAutoRemove();
00131     bool GetCheckAutoStitch();
00133     bool GetCheckSaveLog();
00134     void RestoreSize();
00135     void AddToList(wxString aFile, Project::Target target=Project::STITCHING);
00136     void AddDirToList(wxString aDir);
00137     void ChangePrefix(int index,wxString newPrefix);
00139     bool IsRunning();
00141     bool IsPaused();
00145     void SetStatusInformation(wxString status);
00147     void UpdateBatchVerboseStatus();
00149     bool IsStartedMinimized()
00150     {
00151         return m_startedMinimized;
00152     };
00154     void SetInternalVerbose(bool newVerbose);
00156     void UpdateTaskBarProgressBar();
00157 
00159     wxHelpController& GetHelpController() { return m_HelpController; }
00160 
00161     //wxMutex* projListMutex;
00162     ProjectListBox* projListBox;
00163 
00164 private:
00165     wxLocale* m_locale;
00166     wxString m_xrcPrefix;
00167     Batch* m_batch;
00168     bool m_cancelled;
00169     bool m_paused;
00170     bool m_closeThread; //included to signal the thread to finish execution
00171     wxChoice* m_endChoice;
00172     //TO-DO: include a batch or project progress gauge? Test initialization commented out in constructor
00173     //wxGauge* m_gauge;
00174     // help controller
00175     wxHelpController m_HelpController;
00176     BatchTaskBarIcon* m_tray;
00177     ProgressStatusBar* m_progStatusBar;
00178     wxIcon m_iconNormal;
00179     wxIcon m_iconRunning;
00180     wxIcon m_iconPaused;
00181     bool m_startedMinimized;
00182 
00183     void OnProcessTerminate(wxProcessEvent& event);
00186     void OnReloadBatch(wxCommandEvent& event);
00188     void OnUpdateListBox(wxCommandEvent& event);
00190     void OnBatchFailed(wxCommandEvent& event);
00192     void OnBatchInformation(wxCommandEvent& e);
00194     void OnRefillListBox(wxCommandEvent& e);
00196     void UpdateTrayIcon(const bool createTrayIcon);
00197 
00198     DECLARE_EVENT_TABLE()
00199 };
00200 
00201 #endif //BATCHFRAME_H

Generated on 3 Dec 2016 for Hugintrunk by  doxygen 1.4.7