Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

process_progress_dialog.h

Go to the documentation of this file.
      00001 //----------------------------------------------------------------------------------------
      00011 // RCS-ID:      $Id: process_progress_dialog.h,v 1.5 2003/02/06 21:47:30 robertoconnor Exp $
      00012 //----------------------------------------------------------------------------------------
      00013 
      00014 //----------------------------------------------------------------------------------------
      00015 // Begin single inclusion of this .h file condition
      00016 //----------------------------------------------------------------------------------------
      00017 
      00018 #ifndef _PROCESS_PROGRESS_DIALOG_H_
      00019 #define _PROCESS_PROGRESS_DIALOG_H_
      00020 
      00021 //----------------------------------------------------------------------------------------
      00022 // GCC interface
      00023 //----------------------------------------------------------------------------------------
      00024 
      00025 #if defined(__GNUG__) && ! defined(__APPLE__)
      00026     #pragma interface "process_progress_dialog.h"
      00027 #endif
      00028 
      00029 //----------------------------------------------------------------------------------------
      00030 // Shared defines
      00031 //----------------------------------------------------------------------------------------
      00032 
      00033 #include "plucker_defines.h"
      00034 
      00035 //----------------------------------------------------------------------------------------
      00036 // Begin feature removal condition
      00037 //----------------------------------------------------------------------------------------
      00038 
      00039 #if ( setupUSE_ENHANCED_PROGRESS_DIALOG )
      00040 
      00041 //----------------------------------------------------------------------------------------
      00042 // Headers
      00043 //----------------------------------------------------------------------------------------
      00044 
      00045 #include "details_progress_dialog.h"
      00046 
      00047 // Forward declaration.
      00048 class piped_process;
      00049 #include "piped_process.h"
      00050 
      00051 //----------------------------------------------------------------------------------------
      00052 // Class option flags
      00053 //----------------------------------------------------------------------------------------
      00054 
      00055 enum {
      00056     optionPROCESS_PROGRESS_DIALOG_NONE_STREAM_KIND                      = 0,
      00057     optionPROCESS_PROGRESS_DIALOG_STDOUT_STREAM_KIND                    = 1,
      00058     optionPROCESS_PROGRESS_DIALOG_STDERR_STREAM_KIND                    = 2
      00059 };
      00060 
      00061 //----------------------------------------------------------------------------------------
      00062 // Array definitions
      00063 //----------------------------------------------------------------------------------------
      00064 
      00065 // Define an array of pointers to piped_process objects.
      00066 WX_DEFINE_ARRAY( piped_process*, piped_process_array );
      00067 
      00068 //----------------------------------------------------------------------------------------
      00069 // Class definition: process_progress_dialog
      00070 //----------------------------------------------------------------------------------------
      00071 
      00073 
      00096 class process_progress_dialog : public details_progress_dialog
00097 {
00098 
00099     DECLARE_DYNAMIC_CLASS( process_progress_dialog )
00100 
00101 public: 
00102  
00104 
00129     process_progress_dialog( wxWindow* parent,
00130                      const wxArrayString& commandline_array, 
00131                      long stream_kind = optionPROCESS_PROGRESS_DIALOG_STDOUT_STREAM_KIND    |
00132                                         optionPROCESS_PROGRESS_DIALOG_STDERR_STREAM_KIND,
00133                      wxSignal kill_signal = wxSIGKILL,  
00134                      bool automatically_close_when_done = TRUE,
00135                      const wxString& show_hide_listbox_configuration_key = wxEmptyString, 
00136                      const wxString& log_filename = wxEmptyString,
00137                      const wxString& log_path = wxEmptyString,
00138                      long scroll_history = optionDETAILS_PROGRESS_LISTBOX_RECOMMENDED_SCROLL_HISTORY
00139                    );
00140     
00141     // Dummy construtor for RTTI macros
00142     process_progress_dialog() {}
00143                      
00145     virtual ~process_progress_dialog();     
00146 
00147     //---Optional tasks to do before and after executions of commandlines-----------------------
00148         
00150 
00153     virtual bool on_before_execute_commandline_array() { return TRUE; }
00154     
00156 
00160     virtual bool on_before_execute_commandline_array_item( size_t commandline_array_index ) { return TRUE; }
00161     
00163 
00167     virtual bool on_after_commandline_array_item_execution_finished( size_t commandline_array_index ) { return TRUE; }
00168 
00170 
00173     virtual bool on_after_commandline_array_executions_finished() { return TRUE; }
00174 
00175     //---Handling a line of processs output and manipulating the abort signal----------
00176 
00178 
00195     virtual void on_process_generated_an_output_line( long stream_kind, 
00196                                                       const wxString& line_text,
00197                                                       size_t commandline_array_index
00198                                                     );
00199     
00200     // From details_progress_dialog()
00201     virtual void action_to_do_when_dialog_is_ready();
00202     
00203     // From details_progress_dialog()
00204     virtual void action_to_do_before_dialog_finishes_closing();
00205 
00206     // From details_progress_dialog()
00207     virtual void action_to_do_after_dialog_finishes_closing();
00208 
00210     void set_stream_kind( long stream_kind );
00211     
00213     long get_stream_kind();
00214 
00216     size_t get_current_commandline_array_index();   
00217    
00219 
00222     virtual void custom_kill( long pid, 
00223                               wxSignal sig,
00224                               wxKillError *krc 
00225                             );
00226    
00227 private:
00228 
00230     void on_process_terminated( wxProcessEvent& event );
00231 
00233     void detach_and_kill_all_running_processes();       
00234     
00235     //-----Process functions-----------------------------------------------------------
00236     
00238     void execute_commandline_array_item( size_t commandline_array_index );
00239 
00241     void on_idle( wxIdleEvent& event );
00242 
00243 #if ( setupUSE_PROCESS_PROGRESS_DIALOG_IDLE_TIMER )
00244 
00245     void on_timer( wxTimerEvent& event );
00246 #endif
00247 
00249     wxArrayString   m_commandline_array;
00250 
00252 
00256     size_t          m_current_commandline_array_index;    
00257    
00259     long            m_stream_kind;           
00260                 
00262     wxSignal        m_kill_signal;           
00263                 
00265     bool            m_kill_process_children;
00266                 
00268     piped_process_array m_running_process_array;
00269 
00270 #if ( setupUSE_PROCESS_PROGRESS_DIALOG_IDLE_TIMER )
00271     // Timer to generate idle events.
00272     wxTimer         m_idle_timer;
00273 #endif
00274 
00275     DECLARE_EVENT_TABLE()
00276 
00277 };
00278 
00279 //----------------------------------------------------------------------------------------
00280 // End feature removal condition
00281 //----------------------------------------------------------------------------------------
00282 
00283 #endif  // setupUSE_ENHANCED_PROGRESS_DIALOG
00284 
00285 //----------------------------------------------------------------------------------------
00286 // End single inclusion of this .h file condition
00287 //----------------------------------------------------------------------------------------
00288 
00289 #endif  // _PROCESS_PROGRESS_DIALOG_H_