main_frame.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) Massimo Cora' 2005 <maxcvs@email.it>
00003  *  Copyright (C) Fabio Zecchini 2005 <zio.zec@gmail.com>
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018  */
00019 
00020 #ifndef __MAIN_FRAME_H__
00021 #define __MAIN_FRAME_H__
00022 
00023 #if defined(__GNUG__) && !defined(__APPLE__)
00024 #pragma interface "main_frame.cpp"
00025 #endif
00026 
00031 
00032 #include "wx/frame.h"
00033 #include "wx/statusbr.h"
00035 
00036 #include "streamer_ctrl.h"
00037 #include "receiver_ctrl.h"
00038 
00039 #include "display_image_frame.h"
00040 
00041 // opencv
00042 #include <cv.h>
00043 #include <cxtypes.h>
00044 
00045 
00046 #include <OmniStuff.hh>
00047 
00048 #include <vector>
00049 
00050 
00055 
00056 class wxStatusBar;
00058 
00059 
00064 
00065 #define ID_MAIN_FRAME 10016
00066 #define SYMBOL_MAINFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxMINIMIZE|wxMINIMIZE_BOX|wxCLOSE_BOX
00067 #define SYMBOL_MAINFRAME_TITLE _("Omimeeting")
00068 #define SYMBOL_MAINFRAME_IDNAME ID_MAIN_FRAME
00069 #define SYMBOL_MAINFRAME_SIZE wxSize(290, 150)
00070 #define SYMBOL_MAINFRAME_POSITION wxDefaultPosition
00071 #define ID_MENUITEM_FILE_EXIT 10017
00072 #define ID_MENUITEM_ACTIONS_STOP_SERVER 10020
00073 #define ID_MENUITEM_ACTIONS_STOP_RECEIVING 10022
00074 #define ID_MENU_PREFERENCES 10001
00075 #define ID_MENU_HELP_AUTHORS 10036
00076 #define ID_MENU_HELP_VERSION 10038
00077 #define ID_STATUSBAR 10023
00079 
00080 enum {
00081         WORKER_EVENT,
00082         IMAGE_RECEIVED_EVENT,
00083         AUDIO_RECEIVED_EVENT
00084 };
00085 
00086 
00087 
00092 #ifndef wxCLOSE_BOX
00093 #define wxCLOSE_BOX 0x1000
00094 #endif
00095 #ifndef wxFIXED_MINSIZE
00096 #define wxFIXED_MINSIZE 0
00097 #endif
00098 
00099 
00104 class MainFrame: public wxFrame
00105 {    
00106     DECLARE_CLASS( MainFrame )
00107     DECLARE_EVENT_TABLE()
00108 
00109 public:
00111     MainFrame( );
00112     MainFrame( wxWindow* parent, wxWindowID id = SYMBOL_MAINFRAME_IDNAME, const wxString& caption = SYMBOL_MAINFRAME_TITLE, const wxPoint& pos = SYMBOL_MAINFRAME_POSITION, const wxSize& size = SYMBOL_MAINFRAME_SIZE, long style = SYMBOL_MAINFRAME_STYLE );
00113 
00114         ~MainFrame( );
00115 
00116     bool Create( wxWindow* parent, wxWindowID id = SYMBOL_MAINFRAME_IDNAME, const wxString& caption = SYMBOL_MAINFRAME_TITLE, const wxPoint& pos = SYMBOL_MAINFRAME_POSITION, const wxSize& size = SYMBOL_MAINFRAME_SIZE, long style = SYMBOL_MAINFRAME_STYLE );
00117 
00119     void CreateControls();
00120 
00122 
00124     void OnCloseWindow( wxCloseEvent& event );
00125 
00127     void OnMenuitemFileExitClick( wxCommandEvent& event );
00128 
00130     void OnMenuitemActionsStopServerClick( wxCommandEvent& event );
00131 
00133     void OnMenuitemActionsStopReceivingClick( wxCommandEvent& event );
00134 
00136     void OnMenuPreferencesClick( wxCommandEvent& event );
00137 
00139     void OnMenuHelpAuthorsClick( wxCommandEvent& event );
00140 
00142     void OnMenuHelpVersionClick( wxCommandEvent& event );
00143 
00145 
00146         void OnWorkerEvent( wxCommandEvent& event );
00147 
00148         // callbacks to receive frames from net when they are ready
00149         void OnImageReceivedFromNet( wxCommandEvent& event );
00150         void OnAudioFrameReceivedFromNet( wxCommandEvent& event );
00151 
00152         
00153         void OnStreamerCtrlThreadEnd();
00154         void OnReceiverCtrlThreadEnd();
00155         void reset_displayed_image_vector();
00156 
00157         void manage_garbage_collector_for_images( IplImage *image, int stream_id );
00158         void clear_garbage_collector_for_images();
00159         void destroy_garbage_collector_for_images();
00160 
00161         void PrintStatusBarMessage( const wxChar* message, int field = 0 );
00162         void SetFacetrackOptions( wxArrayString* cascade_array, int cascade_count, int radius_min, 
00163                 int radius_max, int center_x, int center_y, int freeze_frame_bound, 
00164                 double track_window_hitrate, bool gcard_use, bool flipped_mode, int num_streams = -1, bool algo_simple = true  );
00165 
00166         static void on_display_image_cb ( IplImage* image, int track_id, 
00167                                                            char* window_id, void* callback_data );
00168         static void on_destroy_image_cb ( char* window_id, void* callback_data );
00169         static void on_create_image_cb ( char* window_id, void* callback_data );
00170 
00171 
00173 
00175     wxBitmap GetBitmapResource( const wxString& name );
00176 
00178     wxIcon GetIconResource( const wxString& name );
00180 
00182     static bool ShowToolTips();
00183 
00185     wxStatusBar* m_status_bar;
00187 
00188         int GetMaxRadius();
00189         int GetMinRadius();
00190         int GetCenterX();
00191         int GetCenterY();
00192         wxArrayString* GetCascadeArray ();
00193         int GetCascadeSize ();
00194         int GetFreezeFrameBound();
00195         double GetTrackWindowHitrate();
00196         bool GetAlgoSimpleStatus();
00197         bool GetGCardUseStatus();
00198         bool GetFlippedModeStatus();
00199         bool is_face_detect_options_set ();
00200         
00201 private:                // data
00202 
00203         class StreamerCtrlThread *m_streamer_thread;
00204         class ReceiverCtrlThread *m_receiver_thread;
00205         vector<class DisplayImageFrame *> * _displayed_frames;
00206         vector<list<IplImage *> *> * _gc_images;
00207 
00208         bool face_detect;
00209         bool ctrl_initialized;
00210 
00211         wxMutex *_paint_mutex;
00212         wxArrayString* cascade_array;
00213         int cascade_size;
00214         int radius_min;
00215         int radius_max;
00216         int center_x;
00217         int center_y;
00218         double track_window_hitrate;
00219         int freeze_frame_bound;
00220         bool gcard_use;
00221         bool flipped_mode;
00222         bool is_multi_stream;
00223         int num_streams;
00224         bool algo_simple;
00225 
00226         OmniAlgoSimpleDetection<OmniFastLookupTable, int, IplImage, CvPoint> *ctrl_lookup;
00227         OmniAlgoSimpleDetection<OmniGCardConverter, double, IplImage, CvPoint> *ctrl_gcard;
00228 
00229         OmniAlgoVRFilterDetection<OmniFastLookupTable, int, IplImage, CvPoint> *ctrl_vr_lookup;
00230         OmniAlgoVRFilterDetection<OmniGCardConverter, double, IplImage, CvPoint> *ctrl_vr_gcard;
00231 
00232 
00233 };
00234 
00235 
00236 #endif    // _MAIN_FRAME_H_

Generated on Tue Dec 26 10:32:38 2006 for Omnimeeting by  doxygen 1.4.7