TAPs 0.7.7.3
TAPsWXOpenGLCanvas.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsWXOpenGLCanvas.hpp
00003 
00004 WXOpenGLCanvas is a subclass of wxGLCanvas for using wxWidgets Toolkit with OpenGL 
00005 support.
00006 
00007 SUKITTI PUNAK   (05/07/2006)
00008 UPDATE          (05/07/2006)
00009 ******************************************************************************/
00010 #include "TAPsWXOpenGLCanvas.hpp"
00011 // Using Inclusion Model (i.e. definitions are included in declarations)
00012 //                       (this name.cpp is included in name.hpp)
00013 // Each friend is defined directly inside its declaration.
00014 
00015 //=============================================================================
00016 // REMARK:  WXID is a namespace with defining enum for extra ids that that do 
00017 //          not included in wxID.
00018 //          See <TAPs/wxWidgets/TAPsWXEnumList.hpp>
00019 //=============================================================================
00020 
00021 BEGIN_NAMESPACE_TAPs
00022 //=============================================================================
00023 //-----------------------------------------------------------------------------
00024 BEGIN_EVENT_TABLE( WXOpenGLCanvas, wxGLCanvas )
00025     EVT_SIZE                ( WXOpenGLCanvas::OnSize )
00026     EVT_PAINT               ( WXOpenGLCanvas::OnPaint )
00027     EVT_ERASE_BACKGROUND    ( WXOpenGLCanvas::OnEraseBackground )
00028     EVT_CHAR                ( WXOpenGLCanvas::OnChar )
00029     EVT_KEY_DOWN            ( WXOpenGLCanvas::OnKeyDown )
00030     EVT_KEY_UP              ( WXOpenGLCanvas::OnKeyUp )
00031     EVT_ENTER_WINDOW        ( WXOpenGLCanvas::OnEnterWindow )
00032     EVT_MOUSE_EVENTS        ( WXOpenGLCanvas::OnMouse )
00033     EVT_IDLE                ( WXOpenGLCanvas::OnIdle )
00034     /*
00035     //-----------------------------------------------------
00036     // Popup Menu
00037     EVT_MENU    ( WXID::PATCH_SELECTION_MODE,   WXOpenGLCanvas::OnPopupMenu1 )
00038     EVT_MENU    ( WXID::POINT_SELECTION_MODE,   WXOpenGLCanvas::OnPopupMenu1 )
00039     EVT_MENU    ( WXID::USE_FANCY_COLORS,       WXOpenGLCanvas::OnPopupMenu1 )
00040     EVT_MENU    ( WXID::DRAW_STYLE_FILL,        WXOpenGLCanvas::OnPopupMenu1 )
00041     EVT_MENU    ( WXID::DRAW_STYLE_LINE,        WXOpenGLCanvas::OnPopupMenu1 )
00042     EVT_MENU    ( WXID::DRAW_STYLE_POINT,       WXOpenGLCanvas::OnPopupMenu1 )
00043     EVT_MENU    ( WXID::DRAW_TEXTS,             WXOpenGLCanvas::OnPopupMenu1 )
00044     EVT_MENU    ( WXID::DRAW_CTRL_PT,           WXOpenGLCanvas::OnPopupMenu1 )
00045     EVT_MENU    ( WXID::DRAW_CTRL_PT_POLYGON,   WXOpenGLCanvas::OnPopupMenu1 )
00046     EVT_MENU    ( WXID::DRAW_SHADOW,            WXOpenGLCanvas::OnPopupMenu1 )
00047     EVT_MENU    ( WXID::DRAW_PLATFORM,          WXOpenGLCanvas::OnPopupMenu1 )
00048     //*/
00049 END_EVENT_TABLE()
00050 //-----------------------------------------------------------------------------
00051 //=============================================================================
00052 
00053 //=============================================================================
00054 //-----------------------------------------------------------------------------
00055 unsigned long   WXOpenGLCanvas::m_sulSecBase        = 0;
00056 int             WXOpenGLCanvas::m_siTimeInitialized = 0;
00057 unsigned long   WXOpenGLCanvas::m_sulXSynct;
00058 unsigned long   WXOpenGLCanvas::m_sulGSynct;
00059 //-----------------------------------------------------------------------------
00060 //=============================================================================
00061 
00062 //=============================================================================
00063 //-----------------------------------------------------------------------------
00064 WXOpenGLCanvas::WXOpenGLCanvas ( wxWindow * parent,
00065                      wxWindowID id, const wxPoint & pos, const wxSize & size,
00066                      long style, const wxString & name )
00067     : wxGLCanvas( parent, (wxGLCanvas *)NULL, id, pos, size, 
00068                   style | wxFULL_REPAINT_ON_RESIZE, name )
00069 {
00070     m_uiGLList = 0;
00071     m_lRotateLeft  = WXK_LEFT;
00072     m_lRotateRight = WXK_RIGHT;
00073     //---------------------------------------------------------------
00074     CreationAddOn();
00075 }
00076 //-----------------------------------------------------------------------------
00077 WXOpenGLCanvas::WXOpenGLCanvas ( wxWindow * parent, const WXOpenGLCanvas * other, 
00078                      wxWindowID id, const wxPoint & pos, const wxSize & size,
00079                      long style, const wxString & name )
00080     : wxGLCanvas( parent, other->GetContext(), id, pos, size, 
00081                   style | wxFULL_REPAINT_ON_RESIZE, name )
00082 {
00083     m_uiGLList = other->m_uiGLList; // share display list
00084     m_lRotateLeft  = WXK_LEFT;
00085     m_lRotateRight = WXK_RIGHT;
00086     //---------------------------------------------------------------
00087     CreationAddOn();
00088 }
00089 //-----------------------------------------------------------------------------
00090 WXOpenGLCanvas::~WXOpenGLCanvas ()
00091 {
00092 //  if ( m_pTrackballWorld ) {
00093 //      delete m_pTrackballWorld;
00094 //  }
00095 //  if ( m_pTrackballModel ) {
00096 //      delete m_pTrackballModel;
00097 //  }
00098     if ( m_menuPopup1 ) {
00099         delete m_menuPopup1;
00100     }
00101     if ( m_pGLManager ) {
00102         m_pGLManager = NULL;
00103     }
00104 }
00105 //-----------------------------------------------------------------------------
00106 void WXOpenGLCanvas::CreationAddOn ()
00107 {
00108     m_pGLManager = NULL;
00109     //---------------------------------------------------------------
00110     // Drawing Properties
00111     m_eDrawStyle = GL_FILL;
00112     m_bShowCtrlPts      = false;
00113     m_bDrawTexts        = true;
00114     m_bUseFancyColor    = false;
00115     m_bDrawRefObject    = false;
00116     m_bDrawPlatform     = true;
00117     m_bDrawShadow       = true;
00118     m_bDrawLinesConnectedControlPts = false;
00119     //---------------------------------------------------------------
00120     // View
00121     //m_rViewAngle = VIEW_ANGLE;
00122     //---------------------------------------------------------------
00123     // Camera
00124     //m_arCameraPosition[0] = EYE_X;
00125     //m_arCameraPosition[1] = EYE_Y;
00126     //m_arCameraPosition[2] = EYE_Z;
00127     //m_arCameraLookAt[0] = CAMERA_CENTER_X;
00128     //m_arCameraLookAt[1] = CAMERA_CENTER_Y;
00129     //m_arCameraLookAt[2] = CAMERA_CENTER_Z;
00130     //m_arCameraUpVector[0] = CAMERA_UP_X;
00131     //m_arCameraUpVector[1] = CAMERA_UP_Y;
00132     //m_arCameraUpVector[2] = CAMERA_UP_Z;
00133     //---------------------------------------------------------------
00134     // Trackball(s)
00135 //  m_pTrackballWorld = new Trackball_GL( true );   // true for accumulation
00136 //  m_pTrackballModel = new Trackball_GL( true );   // false for no accumulation
00137     //---------------------------------------------------------------
00138     // Menu(s)
00139     m_menuPopup1 = NULL;
00140     CreateMenuPopup1();
00141 }
00142 //-----------------------------------------------------------------------------
00143 void WXOpenGLCanvas::Setup ( OpenGL::BaseOpenGLManager<Real> * pGLManager )
00144 {
00145     m_pGLManager = pGLManager;
00146 }
00147 //-----------------------------------------------------------------------------
00148 void WXOpenGLCanvas::OnEnterWindow ( wxMouseEvent & WXUNUSED(event) )
00149 {
00150     SetFocus();
00151 }
00152 //-----------------------------------------------------------------------------
00153 void WXOpenGLCanvas::OnPaint ( wxPaintEvent & WXUNUSED(event) )
00154 {
00155     wxPaintDC dc(this);
00156 #ifndef __WXMOTIF__
00157     if ( !GetContext() )    return;
00158 #endif
00159     SetCurrent();
00160     //---------------------------------------------------------------
00161     // Render
00162     if ( m_pGLManager ) {
00163         //-------------------------------------------------
00164         // Clear color and depth buffers
00165         glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
00166         //-------------------------------------------------
00167         // Set Camera
00168         glMatrixMode( GL_MODELVIEW );
00169         glLoadIdentity();
00170         m_pGLManager->RetViewManager()->GLSetCamera();
00171         //-------------------------------------------------
00172         m_pGLManager->RetModelManager()->DrawModel(); // gEnumDrawMode );
00173         //-------------------------------------------------
00174     #ifdef TAPs_USE_HAPTIC
00175         m_pGLManager->RetHapticManager()->DrawHapticObjects();
00176         glEnable( GL_LIGHTING );
00177         m_pGLManager->RetHapticManager()->DrawCursor(); // gEnumDrawMode );
00178     #endif
00179     }
00180     //---------------------------------------------------------------
00181     glFlush();
00182     SwapBuffers();
00183 }
00184 //-----------------------------------------------------------------------------
00185 void WXOpenGLCanvas::OnSize ( wxSizeEvent & event )
00186 {
00187     // This is also necessary to update the context on some platforms
00188     wxGLCanvas::OnSize( event );
00189 
00190     // Set GL viewport (not called by wxGLCanvas::OnSize on all platforms
00191     int w, h;
00192     GetClientSize( &w, &h );
00193 
00194 #ifndef __WXMOTIF__
00195     if ( GetContext() )
00196 #endif
00197     {
00198         SetCurrent();
00199         //-------------------------------------------------
00200         m_iWidth  = w;
00201         m_iHeight = h;
00202         //-------------------------------------------------
00203         if ( m_pGLManager ) {
00204             m_pGLManager->RetViewManager()->ReshapeView( w, h );
00205         }
00206         //-------------------------------------------------
00207     }
00208 }
00209 //-----------------------------------------------------------------------------
00210 void WXOpenGLCanvas::OnEraseBackground ( wxEraseEvent & WXUNUSED(event) )
00211 {
00212     // Do nothing, to avoid flashing.
00213 }
00214 //-----------------------------------------------------------------------------
00215 void WXOpenGLCanvas::InitGL ()
00216 {
00217     //---------------------------------------------------------------
00218     // wxWidgets Fn: Sets this canvas as the current recipient of OpenGL calls
00219     SetCurrent();
00220     //---------------------------------------------------------------
00221 //  if ( m_pGLManager ) {
00222 //      m_pGLManager->InitGL();
00223 //  }
00224 }
00225 //-----------------------------------------------------------------------------
00226 GLfloat WXOpenGLCanvas::CalcRotateSpeed ( unsigned long accelTime )
00227 {
00228     GLfloat t, v;
00229     t = ( (GLfloat) accelTime ) / 1000.0f;
00230     if      ( t < 0.5f )    v = t;
00231     else if ( t < 1.0f )    v = t * (2.0f - t);
00232     else                    v = 0.75f;
00233     return v;
00234 }
00235 //-----------------------------------------------------------------------------
00236 GLfloat WXOpenGLCanvas::CalcRotateAngle ( unsigned long lastTime, unsigned long accelTime )
00237 {
00238     GLfloat t, s1, s2;
00239     t  = ( (GLfloat)(accelTime - lastTime) ) / 1000.0f;
00240     s1 = CalcRotateSpeed( lastTime );
00241     s2 = CalcRotateSpeed( accelTime );
00242     return t * (s1+s2) * 135.0f;
00243 }
00244 //-----------------------------------------------------------------------------
00245 void WXOpenGLCanvas::Action ( long code, unsigned long lastTime, unsigned long accelTime )
00246 {
00247     GLfloat angle = CalcRotateAngle( lastTime, accelTime );
00248     if      ( code == m_lRotateLeft )   Rotate( angle );
00249     else if ( code == m_lRotateRight )  Rotate( -angle );
00250 }
00251 //-----------------------------------------------------------------------------
00252 void WXOpenGLCanvas::OnChar ( wxKeyEvent & event )
00253 {
00254     if ( event.AltDown() ) {
00255         event.Skip();
00256         return;
00257     }
00258     int key = event.GetKeyCode();
00259     //---------------------------------------------------------------
00260 //  sprintf( m_cstrDebug, "Key#%i: %c", key, key );
00261     switch ( key ) {
00262         //---------------------------------------
00263         // Reset
00264         case 'r':
00265         case 'R':
00266 //          GFn_Reset( this );
00267             break;
00268         //---------------------------------------
00269         // Toggle showing texts
00270         case 't':
00271         case 'T':
00272             m_bDrawTexts = !m_bDrawTexts;
00273             break;
00274         //---------------------------------------
00275         // Toggle showing platform
00276         case '-':
00277             m_bDrawPlatform = !m_bDrawPlatform;
00278             break;
00279         //---------------------------------------
00280         case '0':
00281             m_bDrawRefObject = !m_bDrawRefObject;
00282             break;
00283         //---------------------------------------
00284         // Zoom Out
00285         case 'Z':       // for zoom out of orthographic view 11 steps
00286 //          m_rOrthoAdjuster += 0.25;
00287 //          m_rViewAngle += 1.0;
00288 //          GFn_ReshapeOpenGLViewport ( this->GetWidth(), this->GetHeight(), this );
00289             break;
00290         //---------------------------------------
00291         // Zoom In
00292         case 'z':       // for zoom in of orthographic view 11 steps
00293 //          m_rOrthoAdjuster -= 0.25;
00294 //          m_rViewAngle -= 1.0;
00295 //          GFn_ReshapeOpenGLViewport ( this->GetWidth(), this->GetHeight(), this );
00296             break;
00297         //---------------------------------------
00298         // Show control points
00299         case 'e':
00300         case 'E':
00301             m_bShowCtrlPts = !m_bShowCtrlPts;
00302             break;
00303         //---------------------------------------
00304         // Draw lines connecting control points
00305         case 'l':
00306         case 'L':
00307             m_bDrawLinesConnectedControlPts = !m_bDrawLinesConnectedControlPts;
00308             break;
00309         //---------------------------------------
00310         // Enable/Disable fancy color
00311         case 'c':
00312         case 'C':
00313             m_bUseFancyColor = !m_bUseFancyColor;
00314             break;
00315         //---------------------------------------
00316         // Change drawing style
00317         case 's':
00318         case 'S':
00319             switch ( this->GetDrawStyle() ) {
00320                 case GL_FILL:
00321                     this->SetDrawStyle( GL_LINE );
00322                     break;
00323                 case GL_LINE:
00324                     this->SetDrawStyle( GL_POINT );
00325                     break;
00326                 case GL_POINT:
00327                     this->SetDrawStyle( GL_FILL );
00328                     break;
00329                 default:
00330                     this->SetDrawStyle( GL_FILL );
00331                     break;
00332             }
00333             break;
00334         //---------------------------------------
00335         /*
00336         case 27:    // ESC for exit the program
00337             //ExitHandler();    // User defined function
00338             exit(0);
00339             //g_wxOpenGLMainWindow->OnFileExit( e );
00340             break;
00341         //*/
00342         //---------------------------------------
00343         default:
00344             //sprintf( const_cast<char*>( g_strDebug ), "Key#%i: %c", key, key );
00345             //sprintf( const_cast<char*>( g_strDebug ), "Invalid Key!" );
00346             //sprintf( const_cast<char*>( g_strDebug ), "" );
00347             break;
00348     }
00349 //  Refresh(false);
00350 
00351     /*
00352     if ( isalpha( event.GetKeyCode() ) ) {
00353         wxBell();
00354     }
00355     else {
00356         wxBell();
00357     }
00358     //*/
00359 }
00360 //-----------------------------------------------------------------------------
00361 void WXOpenGLCanvas::OnKeyDown ( wxKeyEvent & event )
00362 {
00363     //event.Skip();
00364     //*
00365     int key = event.GetKeyCode();
00366     if ( WXK_ALT == key ) {
00367         //event.Skip();
00368         //sprintf( debugStr, "Key#%i: %c == WXK_LEFT", key, key );
00369     }
00370     else if ( 0 < key && key < 256 && isalpha( event.GetKeyCode() ) ) {
00371         event.Skip();
00372     }
00373     else if ( WXK_LEFT == key ) {
00374         //sprintf( debugStr, "Key#%i: %c == WXK_LEFT", key, key );
00375     }
00376     else {
00377         //sprintf( debugStr, "Key#%i: %c", key, key );
00378         //sprintf( debugStr, "Invalid Key!" );
00379         //sprintf( debugStr, "" );
00380     }
00381     Refresh(false);
00382     //*/
00383 
00384 
00385 
00386 
00387     /*
00388     long evtKey = event.GetKeyCode();
00389     if ( evtKey == 0 )  return;
00390     if ( !m_siTimeInitialized ) {
00391         m_siTimeInitialized = 1;
00392         m_sulXSynct = event.GetTimestamp();
00393         m_sulGSynct = StopWatch( &m_sulSecBase );
00394         m_lKey = evtKey;
00395         m_ulStartTime  = 0;
00396         m_ulLastTime   = 0;
00397         m_ulLastRedraw = 0;
00398     }
00399 
00400     unsigned long currTime = event.GetTimestamp() - m_sulXSynct;
00401     if ( evtKey != m_lKey ) {
00402         m_lKey = evtKey;
00403         m_ulLastRedraw = m_ulStartTime = m_ulLastTime = currTime;
00404     }
00405 
00406     if ( currTime >= m_ulLastRedraw ) {     // redraw
00407         Action( m_lKey, m_ulLastTime - m_ulStartTime, currTime - m_ulStartTime );
00408 #if defined (__WXMAC__) && !defined (__DARWIN__)
00409         m_ulLastRedraw = currTime;      // StopWatch() doesn't work on Mac.
00410 #else
00411         m_ulLastRedraw = StopWatch( &m_sulSecBase ) - m_sulGSynct;
00412 #endif
00413         m_ulLastTime = currTime;
00414     }
00415 
00416     event.Skip();
00417     //*/
00418 }
00419 //-----------------------------------------------------------------------------
00420 void WXOpenGLCanvas::OnKeyUp ( wxKeyEvent & event )
00421 {
00422 }
00423 //-----------------------------------------------------------------------------
00424 void WXOpenGLCanvas::Rotate( GLfloat deg )
00425 {
00426     SetCurrent();
00427 
00428     glMatrixMode( GL_MODELVIEW );
00429     glRotatef( (GLfloat)deg, 0.0f, 0.0f, 1.0f );
00430     Refresh( false );
00431 }
00432 //-----------------------------------------------------------------------------
00433 void WXOpenGLCanvas::OnMouse( wxMouseEvent & event )
00434 {
00435     //--------------------------------------------------------------------
00436     //====================================================================
00437     // BUTTON DOWN
00438     //--------------------------------------------------------------------
00439     // LEFT BUTTON DOWN
00440     if ( event.LeftDown() ) {
00441         m_iMouseX = event.m_x;
00442         m_iMouseY = event.m_y;
00443     }
00444     //--------------------------------------------------------------------
00445     // MIDDLE BUTTON DOWN
00446     else if ( event.MiddleDown() ) {
00447         m_iMouseX = event.m_x;
00448         m_iMouseY = event.m_y;
00449     }
00450     //--------------------------------------------------------------------
00451     // RIGHT BUTTON DOWN
00452     else if ( event.RightDown() ) {
00453         m_iMouseX = event.m_x;
00454         m_iMouseY = event.m_y;
00455         //-------------------------------------------------------
00456         OnMouseRightClick( event );
00457     }
00458     //--------------------------------------------------------------------
00459     //====================================================================
00460     // DRAGGING
00461     //--------------------------------------------------------------------
00462     // LEFT BUTTON IS DOWN and Mouse is being dragged
00463     // Trackball Rotation for World/Model
00464     else if ( event.LeftIsDown() ) {
00465         if ( event.Dragging() ) {
00466         }
00467     }
00468     //--------------------------------------------------------------------
00469     // MIDDLE BUTTON IS DOWN and Mouse is being dragged
00470     // Zoom In/Out
00471     else if ( event.MiddleIsDown() ) {
00472         if ( event.Dragging() ) {
00473         }
00474     }
00475     //--------------------------------------------------------------------
00476     // RIGHT BUTTON IS DOWN and Mouse is being dragged
00477     // Panning the camera
00478     else if ( event.RightIsDown() ) {
00479         if ( event.Dragging() ) {
00480         }
00481     }
00482     //--------------------------------------------------------------------
00483     // LEFT BUTTON UP or MIDDLE BUTTON UP or RIGHT BUTTON UP
00484     else if ( event.LeftUp() || event.MiddleUp() || event.RightUp() ) {
00485     }
00486 
00487     // DEBUG
00488     sprintf( m_cstrDebug, "Mouse: (%i,%i)", event.m_x, event.m_y );
00489 
00490     //--------------------------------------------------------------------
00491     Refresh(false);
00492 }
00493 //-----------------------------------------------------------------------------
00494 void WXOpenGLCanvas::OnIdle( wxIdleEvent & event )
00495 {
00496     Refresh( false );
00497 }
00498 //-----------------------------------------------------------------------------
00499 // Create a popup menu from a mouse right click
00500 void WXOpenGLCanvas::OnMouseRightClick( wxMouseEvent & event )
00501 {
00502     //---------------------------------------------------------------
00503     UpdateMenuPopup1();
00504     this->PopupMenu( m_menuPopup1, event.GetPosition() );
00505 }
00506 //---------------------------------------------------------------
00507 // Popup Menu for Setting up Spline Model Property
00508 void WXOpenGLCanvas::OnPopupMenu1 ( wxCommandEvent & event )
00509 {
00510     switch ( event.GetId() ) {
00511         case WXID::PATCH_SELECTION_MODE:
00512             WX::Debug::DisplayDialog( wxString( "Patch Selection Mode" ) );
00513             //this->Disconnect( WXID::PATCH_SELECTION_MODE, 
00514             //      wxEVT_COMMAND_MENU_SELECTED, 
00515             //      wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) );
00516             break;
00517         case WXID::POINT_SELECTION_MODE:
00518             WX::Debug::DisplayDialog( wxString( "Point Selection Mode" ) );
00519             break;
00520         case WXID::USE_FANCY_COLORS:
00521             WX::Debug::DisplayDialog( wxString( "Use Fancy Color" ) );
00522             m_bUseFancyColor = !m_bUseFancyColor;
00523             break;
00524         case WXID::DRAW_STYLE_FILL:
00525             WX::Debug::DisplayDialog( wxString( "Fill Draw Style" ) );
00526             m_eDrawStyle    = GL_FILL;
00527             break;
00528         case WXID::DRAW_STYLE_LINE:
00529             WX::Debug::DisplayDialog( wxString( "Line Draw Style" ) );
00530             m_eDrawStyle    = GL_LINE;
00531             break;
00532         case WXID::DRAW_STYLE_POINT:
00533             WX::Debug::DisplayDialog( wxString( "Point Draw Style" ) );
00534             m_eDrawStyle    = GL_POINT;
00535             break;
00536         case WXID::DRAW_TEXTS:
00537             WX::Debug::DisplayDialog( wxString( "Draw Texts" ) );
00538             m_bDrawTexts = !m_bDrawTexts;
00539             break;
00540         case WXID::DRAW_CTRL_PT:
00541             WX::Debug::DisplayDialog( wxString( "Draw Control Points" ) );
00542             m_bShowCtrlPts = !m_bShowCtrlPts;
00543             break;
00544         case WXID::DRAW_CTRL_PT_POLYGON:
00545             WX::Debug::DisplayDialog( wxString( "Draw Control Polygons" ) );
00546             m_bDrawLinesConnectedControlPts = !m_bDrawLinesConnectedControlPts;
00547             break;
00548         case WXID::DRAW_SHADOW:
00549             WX::Debug::DisplayDialog( wxString( "Display Shadow" ) );
00550             m_bDrawShadow = !m_bDrawShadow;
00551             break;
00552         case WXID::DRAW_PLATFORM:
00553             WX::Debug::DisplayDialog( wxString( "Display Platform" ) );
00554             m_bDrawPlatform = !m_bDrawPlatform;
00555             break;
00556     }
00557 }
00558 //---------------------------------------------------------------
00559 // Create Menu for popup menu #1
00560 void WXOpenGLCanvas::CreateMenuPopup1 ()
00561 {
00562     if ( m_menuPopup1 ) {
00563         delete m_menuPopup1;
00564     }
00565     //---------------------------------------------------------------
00566     m_menuPopup1 = new wxMenu;
00567     m_menuPopup1->AppendCheckItem( WXID::PATCH_SELECTION_MODE, 
00568                             wxT( "Patch Selection Mode" ) );
00569     m_menuPopup1->AppendCheckItem( WXID::POINT_SELECTION_MODE, 
00570                             wxT( "Point Selection Mode" ) );
00571     m_menuPopup1->AppendSeparator();
00572     m_menuPopup1->AppendCheckItem( WXID::USE_FANCY_COLORS, 
00573                             wxT( "Use &Fancy Color" ) );
00574     m_menuPopup1->AppendSeparator();
00575     m_menuPopup1->AppendCheckItem( WXID::DRAW_STYLE_FILL, 
00576                             wxT( "Fill Draw Style" ) );
00577     m_menuPopup1->AppendCheckItem( WXID::DRAW_STYLE_LINE, 
00578                             wxT( "Line Draw Style" ) );
00579     m_menuPopup1->AppendCheckItem( WXID::DRAW_STYLE_POINT, 
00580                             wxT( "Point Draw Style" ) );
00581     m_menuPopup1->AppendSeparator();
00582     m_menuPopup1->AppendCheckItem( WXID::DRAW_TEXTS, 
00583                             wxT( "Show &Texts" ) );
00584     m_menuPopup1->AppendCheckItem( WXID::DRAW_CTRL_PT, 
00585                             wxT( "Show &Ctrl Pts" ) );
00586     m_menuPopup1->AppendCheckItem( WXID::DRAW_CTRL_PT_POLYGON, 
00587                             wxT( "Show &Lines" ) );
00588     m_menuPopup1->AppendSeparator();
00589     m_menuPopup1->AppendCheckItem( WXID::DRAW_SHADOW, 
00590                             wxT( "Show &Shadow" ) );
00591     m_menuPopup1->AppendCheckItem( WXID::DRAW_PLATFORM, 
00592                             wxT( "Show &Platform" ) );
00593     //---------------------------------------------------------------
00594     this->Connect(  WXID::PATCH_SELECTION_MODE, 
00595                     wxEVT_COMMAND_MENU_SELECTED, 
00596                     wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) );
00597     this->Connect(  WXID::POINT_SELECTION_MODE, 
00598                     wxEVT_COMMAND_MENU_SELECTED, 
00599                     wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) );
00600     this->Connect(  WXID::USE_FANCY_COLORS, 
00601                     wxEVT_COMMAND_MENU_SELECTED, 
00602                     wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) );
00603     this->Connect(  WXID::DRAW_STYLE_FILL,  
00604                     wxEVT_COMMAND_MENU_SELECTED, 
00605                     wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) );
00606     this->Connect(  WXID::DRAW_STYLE_LINE,  
00607                     wxEVT_COMMAND_MENU_SELECTED, 
00608                     wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) );
00609     this->Connect(  WXID::DRAW_STYLE_POINT, 
00610                     wxEVT_COMMAND_MENU_SELECTED, 
00611                     wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) );
00612     this->Connect(  WXID::DRAW_TEXTS,   
00613                     wxEVT_COMMAND_MENU_SELECTED, 
00614                     wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) );
00615     this->Connect(  WXID::DRAW_CTRL_PT, 
00616                     wxEVT_COMMAND_MENU_SELECTED, 
00617                     wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) );
00618     this->Connect(  WXID::DRAW_CTRL_PT_POLYGON, 
00619                     wxEVT_COMMAND_MENU_SELECTED, 
00620                     wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) );
00621     this->Connect(  WXID::DRAW_SHADOW,  
00622                     wxEVT_COMMAND_MENU_SELECTED, 
00623                     wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) );
00624     this->Connect(  WXID::DRAW_PLATFORM, 
00625                     wxEVT_COMMAND_MENU_SELECTED, 
00626                     wxCommandEventHandler( WXOpenGLCanvas::OnPopupMenu1 ) );
00627 }
00628 //---------------------------------------------------------------
00629 // Update Menu for Spline Model
00630 void WXOpenGLCanvas::UpdateMenuPopup1 ()
00631 {
00632 //  if ( m_menuPopup1 ) {
00633 //  }
00634 }
00635 //-----------------------------------------------------------------------------
00636 //=============================================================================
00637 END_NAMESPACE_TAPs
00638 //-----------------------------------------------------------------------------
00639 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00640 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines