void wxSpeedButton::SetAllUp(wxSpeedButton *inButton) { int i,n; wxSpeedButton *b; // no button? if (inButton == NULL) return; // simple button if (inButton->mGroupIndex == 0) { inButton->mButtonDown = false; inButton->Refresh(false); } // toggle button else if (inButton->mGroupIndex == -1) { inButton->mButtonDown = false; inButton->Refresh(false); } // group button, grouped by immediate parent else if (inButton->mGroupIndex == -2) { n = sbgArray.GetCount(); for(i=0; i<n; i++) { b = (wxSpeedButton *) sbgArray.Item(i); if (b->mParent == inButton->mParent) { b->mButtonDown = false; b->Refresh(false); }; }; } // all else is a group toggle button, grouped by index and top-level parent else { n = sbgArray.GetCount(); for(i=0; i<n; i++) { b = (wxSpeedButton *) sbgArray.Item(i); if ((b->mGroupIndex == inButton->mGroupIndex) && (b->mTopParent == inButton->mTopParent)) { b->mButtonDown = false; b->Refresh(false); }; }; }; }
void ODDC::DrawPolygonsTessellated( int n, int npoints[], wxPoint points[], wxCoord xoffset, wxCoord yoffset ) { if( dc ) { int prev = 0; for( int i = 0; i < n; i++ ) { dc->DrawPolygon( npoints[i], &points[i + prev], xoffset, yoffset ); prev += npoints[i]; } } #ifdef ocpnUSE_GL else { GLUtesselator *tobj = gluNewTess(); gluTessCallback( tobj, GLU_TESS_VERTEX, (_GLUfuncptr) &ODDCvertexCallback ); gluTessCallback( tobj, GLU_TESS_BEGIN, (_GLUfuncptr) &ODDCbeginCallback ); gluTessCallback( tobj, GLU_TESS_END, (_GLUfuncptr) &ODDCendCallback ); gluTessCallback( tobj, GLU_TESS_COMBINE, (_GLUfuncptr) &ODDCcombineCallback ); gluTessCallback( tobj, GLU_TESS_ERROR, (_GLUfuncptr) &ODDCerrorCallback ); gluTessNormal( tobj, 0, 0, 1); gluTessProperty(tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); gluTessProperty(tobj, GLU_TESS_BOUNDARY_ONLY, GL_FALSE); if(glIsEnabled(GL_TEXTURE_2D)) g_bTexture2D = true; else g_bTexture2D = false; ConfigurePen(); if( ConfigureBrush() ) { gluTessBeginPolygon(tobj, NULL); int prev = 0; for( int j = 0; j < n; j++ ) { gluTessBeginContour(tobj); for( int i = 0; i < npoints[j]; i++ ) { GLvertex* vertex = new GLvertex(); gTesselatorVertices.Add( vertex ); vertex->info.x = (GLdouble) points[i + prev].x; vertex->info.y = (GLdouble) points[i + prev].y; vertex->info.z = (GLdouble) 0.0; vertex->info.r = (GLdouble) 0.0; vertex->info.g = (GLdouble) 0.0; vertex->info.b = (GLdouble) 0.0; vertex->info.a = (GLdouble) 0.0; gluTessVertex( tobj, (GLdouble*)vertex, (GLdouble*)vertex ); } gluTessEndContour( tobj ); prev += npoints[j]; } gluTessEndPolygon(tobj); } gluDeleteTess(tobj); for (unsigned int i = 0; i<gTesselatorVertices.Count(); i++) delete (GLvertex*)gTesselatorVertices.Item(i); gTesselatorVertices.Clear(); } #endif }
void ocpnDC::DrawPolygonTessellated( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset ) { if( dc ) dc->DrawPolygon( n, points, xoffset, yoffset ); #ifdef ocpnUSE_GL else { # ifndef ocpnUSE_GLES // tessalator in glues is broken if( n < 5 ) # endif { DrawPolygon( n, points, xoffset, yoffset ); return; } glPushAttrib( GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_LINE_BIT | GL_HINT_BIT | GL_POLYGON_BIT ); //Save state SetGLAttrs( false ); static GLUtesselator *tobj = NULL; if( ! tobj ) tobj = gluNewTess(); gluTessCallback( tobj, GLU_TESS_VERTEX, (_GLUfuncptr) &ocpnDCvertexCallback ); gluTessCallback( tobj, GLU_TESS_BEGIN, (_GLUfuncptr) &ocpnDCbeginCallback ); gluTessCallback( tobj, GLU_TESS_END, (_GLUfuncptr) &ocpnDCendCallback ); gluTessCallback( tobj, GLU_TESS_COMBINE, (_GLUfuncptr) &ocpnDCcombineCallback ); gluTessCallback( tobj, GLU_TESS_ERROR, (_GLUfuncptr) &ocpnDCerrorCallback ); gluTessNormal( tobj, 0, 0, 1); gluTessProperty( tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_NONZERO ); if( ConfigureBrush() ) { gluTessBeginPolygon( tobj, NULL ); gluTessBeginContour( tobj ); for( int i = 0; i < n; i++ ) { GLvertex* vertex = new GLvertex(); gTesselatorVertices.Add( vertex ); vertex->info.x = (GLdouble) points[i].x; vertex->info.y = (GLdouble) points[i].y; vertex->info.z = (GLdouble) 0.0; vertex->info.r = (GLdouble) 0.0; vertex->info.g = (GLdouble) 0.0; vertex->info.b = (GLdouble) 0.0; gluTessVertex( tobj, (GLdouble*)vertex, (GLdouble*)vertex ); } gluTessEndContour( tobj ); gluTessEndPolygon( tobj ); } glPopAttrib(); for( unsigned int i=0; i<gTesselatorVertices.Count(); i++ ) delete (GLvertex*)gTesselatorVertices.Item(i); gTesselatorVertices.Clear(); } #endif }