bool wxGCDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const { wxCHECK_MSG( m_graphicContext, false, wxT("wxGCDC(cg)::DoGetPartialTextExtents - invalid DC") ); widths.Clear(); widths.Add(0,text.Length()); if ( text.IsEmpty() ) return true; wxArrayDouble widthsD; m_graphicContext->GetPartialTextExtents( text, widthsD ); for ( size_t i = 0; i < widths.GetCount(); ++i ) widths[i] = (wxCoord)(widthsD[i] + 0.5); return true; }
bool ScriptingManager::RegisterScriptPlugin(const wxString& /*name*/, const wxArrayInt& ids) { // attach this event handler in the main window (one-time run) if (!m_AttachedToMainWindow) { Manager::Get()->GetAppWindow()->PushEventHandler(this); m_AttachedToMainWindow = true; } for (size_t i = 0; i < ids.GetCount(); ++i) { Connect(ids[i], -1, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &ScriptingManager::OnScriptPluginMenu); } return true; }
void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections) { // first clear all currently selected items size_t n, count = m_listbox->GetCount(); for ( n = 0; n < count; ++n ) { m_listbox->Deselect(n); } // now select the ones which should be selected count = selections.GetCount(); for ( n = 0; n < count; n++ ) { m_listbox->Select(selections[n]); } }
bool wxHtmlPageBreakCell::AdjustPagebreak(int* pagebreak, const wxArrayInt& known_pagebreaks, int WXUNUSED(pageHeight)) const { // When we are counting pages, 'known_pagebreaks' is non-NULL. // That's the only time we change 'pagebreak'. Otherwise, pages // were already counted, 'known_pagebreaks' is NULL, and we don't // do anything except return false. // // We also simply return false if the 'pagebreak' argument is // less than (vertically above) or the same as the current // vertical position. Otherwise we'd be setting a pagebreak above // the current cell, which is incorrect, or duplicating a // pagebreak that has already been set. if( known_pagebreaks.GetCount() == 0 || *pagebreak <= m_PosY) { return false; } // m_PosY is only the vertical offset from the parent. The pagebreak // required here is the total page offset, so m_PosY must be added // to the parent's offset and height. int total_height = m_PosY; for ( wxHtmlCell *parent = GetParent(); parent; parent = parent->GetParent() ) { total_height += parent->GetPosY(); } // Search the array of pagebreaks to see whether we've already set // a pagebreak here. int where = known_pagebreaks.Index( total_height); // Add a pagebreak only if there isn't one already set here. if( wxNOT_FOUND != where) { return false; } else { *pagebreak = m_PosY; return true; } }
size_t wxGetMultipleChoices(wxArrayInt& selections, const wxString& message, const wxString& caption, int n, const wxString *choices, wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), int WXUNUSED(width), int WXUNUSED(height)) { wxMultiChoiceDialog dialog(parent, message, caption, n, choices); // call this even if selections array is empty and this then (correctly) // deselects the first item which is selected by default dialog.SetSelections(selections); if ( dialog.ShowModal() == wxID_OK ) selections = dialog.GetSelections(); else selections.Empty(); return selections.GetCount(); }
int wxListBox::GetSelections( wxArrayInt& aSelections ) const { wxCHECK_MSG( m_treeview != NULL, wxNOT_FOUND, wxT("invalid listbox") ); aSelections.Empty(); int i = 0; GtkTreeIter iter; GtkTreeSelection* selection = gtk_tree_view_get_selection(m_treeview); if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(m_liststore), &iter)) { //gtk_tree_selection_get_selected_rows is GTK 2.2+ so iter instead do { if (gtk_tree_selection_iter_is_selected(selection, &iter)) aSelections.Add(i); i++; } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(m_liststore), &iter)); } return aSelections.GetCount(); }
void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections) { #if wxUSE_CHECKLISTBOX wxCheckListBox* checkListBox = wxDynamicCast(m_listbox, wxCheckListBox); if (checkListBox) { // first clear all currently selected items size_t n, count = checkListBox->GetCount(); #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ for ( n = 0; n < count; ++n ) { if (checkListBox->IsChecked(n)) checkListBox->Check(n, false); } // now select the ones which should be selected count = selections.GetCount(); #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ for ( n = 0; n < count; n++ ) { checkListBox->Check(selections[n]); } return; } #endif // first clear all currently selected items size_t n, count = m_listbox->GetCount(); #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ for ( n = 0; n < count; ++n ) { m_listbox->Deselect(n); } // now select the ones which should be selected count = selections.GetCount(); #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ for ( n = 0; n < count; n++ ) { m_listbox->Select(selections[n]); } }
size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayInt &icon_ids) { #ifdef wxHAS_FILESYSTEM_VOLUMES #ifdef __WXWINCE__ // No logical drives; return "\" paths.Add(wxT("\\")); names.Add(wxT("\\")); icon_ids.Add(wxFileIconsTable::computer); #elif defined(__WIN32__) && wxUSE_FSVOLUME // TODO: this code (using wxFSVolumeBase) should be used for all platforms // but unfortunately wxFSVolumeBase is not implemented everywhere const wxArrayString as = wxFSVolumeBase::GetVolumes(); for (size_t i = 0; i < as.GetCount(); i++) { wxString path = as[i]; wxFSVolume vol(path); int imageId; switch (vol.GetKind()) { case wxFS_VOL_FLOPPY: if ( (path == wxT("a:\\")) || (path == wxT("b:\\")) ) imageId = wxFileIconsTable::floppy; else imageId = wxFileIconsTable::removeable; break; case wxFS_VOL_DVDROM: case wxFS_VOL_CDROM: imageId = wxFileIconsTable::cdrom; break; case wxFS_VOL_NETWORK: if (path[0] == wxT('\\')) continue; // skip "\\computer\folder" imageId = wxFileIconsTable::drive; break; case wxFS_VOL_DISK: case wxFS_VOL_OTHER: default: imageId = wxFileIconsTable::drive; break; } paths.Add(path); names.Add(vol.GetDisplayName()); icon_ids.Add(imageId); } #elif defined(__OS2__) APIRET rc; ULONG ulDriveNum = 0; ULONG ulDriveMap = 0; rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap); if ( rc == 0) { size_t i = 0; while (i < 26) { if (ulDriveMap & ( 1 << i )) { const wxString path = wxFileName::GetVolumeString( 'A' + i, wxPATH_GET_SEPARATOR); const wxString name = wxFileName::GetVolumeString( 'A' + i, wxPATH_NO_SEPARATOR); // Note: If _filesys is unsupported by some compilers, // we can always replace it by DosQueryFSAttach char filesysname[20]; #ifdef __WATCOMC__ ULONG cbBuffer = sizeof(filesysname); PFSQBUFFER2 pfsqBuffer = (PFSQBUFFER2)filesysname; APIRET rc = ::DosQueryFSAttach(name.fn_str(),0,FSAIL_QUERYNAME,pfsqBuffer,&cbBuffer); if (rc != NO_ERROR) { filesysname[0] = '\0'; } #else _filesys(name.fn_str(), filesysname, sizeof(filesysname)); #endif /* FAT, LAN, HPFS, CDFS, NFS */ int imageId; if (path == wxT("A:\\") || path == wxT("B:\\")) imageId = wxFileIconsTable::floppy; else if (!strcmp(filesysname, "CDFS")) imageId = wxFileIconsTable::cdrom; else if (!strcmp(filesysname, "LAN") || !strcmp(filesysname, "NFS")) imageId = wxFileIconsTable::drive; else imageId = wxFileIconsTable::drive; paths.Add(path); names.Add(name); icon_ids.Add(imageId); } i ++; } } #else // !__WIN32__, !__OS2__ /* If we can switch to the drive, it exists. */ for ( char drive = 'A'; drive <= 'Z'; drive++ ) { const wxString path = wxFileName::GetVolumeString(drive, wxPATH_GET_SEPARATOR); if (wxIsDriveAvailable(path)) { paths.Add(path); names.Add(wxFileName::GetVolumeString(drive, wxPATH_NO_SEPARATOR)); icon_ids.Add(drive <= 2 ? wxFileIconsTable::floppy : wxFileIconsTable::drive); } } #endif // __WIN32__/!__WIN32__ #elif defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON ItemCount volumeIndex = 1; OSErr err = noErr ; while( noErr == err ) { HFSUniStr255 volumeName ; FSRef fsRef ; FSVolumeInfo volumeInfo ; err = FSGetVolumeInfo(0, volumeIndex, NULL, kFSVolInfoFlags , &volumeInfo , &volumeName, &fsRef); if( noErr == err ) { wxString path = wxMacFSRefToPath( &fsRef ) ; wxString name = wxMacHFSUniStrToString( &volumeName ) ; if ( (volumeInfo.flags & kFSVolFlagSoftwareLockedMask) || (volumeInfo.flags & kFSVolFlagHardwareLockedMask) ) { icon_ids.Add(wxFileIconsTable::cdrom); } else { icon_ids.Add(wxFileIconsTable::drive); } // todo other removable paths.Add(path); names.Add(name); volumeIndex++ ; } } #elif defined(__UNIX__) || defined(__WXPALMOS__) paths.Add(wxT("/")); names.Add(wxT("/")); icon_ids.Add(wxFileIconsTable::computer); #else #error "Unsupported platform in wxGenericDirCtrl!" #endif wxASSERT_MSG( (paths.GetCount() == names.GetCount()), wxT("The number of paths and their human readable names should be equal in number.")); wxASSERT_MSG( (paths.GetCount() == icon_ids.GetCount()), wxT("Wrong number of icons for available drives.")); return paths.GetCount(); }
// Build PolyTessGeo Object from OGR Polygon // Using OpenGL/GLU tesselator int PolyTessGeo::PolyTessGeoGL(OGRPolygon *poly, bool bSENC_SM, double ref_lat, double ref_lon) { #ifdef ocpnUSE_GL int iir, ip; int *cntr; GLdouble *geoPt; wxString sout; wxString sout1; wxString stemp; // Make a quick sanity check of the polygon coherence bool b_ok = true; OGRLineString *tls = poly->getExteriorRing(); if(!tls) { b_ok = false; } else { int tnpta = poly->getExteriorRing()->getNumPoints(); if(tnpta < 3 ) b_ok = false; } for( iir=0 ; iir < poly->getNumInteriorRings() ; iir++) { int tnptr = poly->getInteriorRing(iir)->getNumPoints(); if( tnptr < 3 ) b_ok = false; } if( !b_ok ) return ERROR_BAD_OGRPOLY; #ifdef __WXMSW__ // If using the OpenGL dlls provided with Windows, // load the dll and establish addresses of the entry points needed #ifdef USE_GLU_DLL if(!s_glu_dll_ready) { s_hGLU_DLL = LoadLibrary("glu32.dll"); if (s_hGLU_DLL != NULL) { s_lpfnTessProperty = (LPFNDLLTESSPROPERTY)GetProcAddress(s_hGLU_DLL,"gluTessProperty"); s_lpfnNewTess = (LPFNDLLNEWTESS)GetProcAddress(s_hGLU_DLL, "gluNewTess"); s_lpfnTessBeginContour = (LPFNDLLTESSBEGINCONTOUR)GetProcAddress(s_hGLU_DLL, "gluTessBeginContour"); s_lpfnTessEndContour = (LPFNDLLTESSENDCONTOUR)GetProcAddress(s_hGLU_DLL, "gluTessEndContour"); s_lpfnTessBeginPolygon = (LPFNDLLTESSBEGINPOLYGON)GetProcAddress(s_hGLU_DLL, "gluTessBeginPolygon"); s_lpfnTessEndPolygon = (LPFNDLLTESSENDPOLYGON)GetProcAddress(s_hGLU_DLL, "gluTessEndPolygon"); s_lpfnDeleteTess = (LPFNDLLDELETETESS)GetProcAddress(s_hGLU_DLL, "gluDeleteTess"); s_lpfnTessVertex = (LPFNDLLTESSVERTEX)GetProcAddress(s_hGLU_DLL, "gluTessVertex"); s_lpfnTessCallback = (LPFNDLLTESSCALLBACK)GetProcAddress(s_hGLU_DLL, "gluTessCallback"); s_glu_dll_ready = true; } else { return ERROR_NO_DLL; } } #endif #endif // Allocate a work buffer, which will be grown as needed #define NINIT_BUFFER_LEN 10000 s_pwork_buf = (GLdouble *)malloc(NINIT_BUFFER_LEN * 2 * sizeof(GLdouble)); s_buf_len = NINIT_BUFFER_LEN * 2; s_buf_idx = 0; // Create an array to hold pointers to allocated vertices created by "combine" callback, // so that they may be deleted after tesselation. s_pCombineVertexArray = new wxArrayPtrVoid; // Create tesselator GLUtessobj = gluNewTess(); // Register the callbacks gluTessCallback(GLUtessobj, GLU_TESS_BEGIN, (GLvoid (__CALL_CONVENTION *) ())&beginCallback); gluTessCallback(GLUtessobj, GLU_TESS_BEGIN, (GLvoid (__CALL_CONVENTION *) ())&beginCallback); gluTessCallback(GLUtessobj, GLU_TESS_VERTEX, (GLvoid (__CALL_CONVENTION *) ())&vertexCallback); gluTessCallback(GLUtessobj, GLU_TESS_END, (GLvoid (__CALL_CONVENTION *) ())&endCallback); gluTessCallback(GLUtessobj, GLU_TESS_COMBINE, (GLvoid (__CALL_CONVENTION *) ())&combineCallback); // gluTessCallback(GLUtessobj, GLU_TESS_ERROR, (GLvoid (__CALL_CONVENTION *) ())&errorCallback); // glShadeModel(GL_SMOOTH); gluTessProperty(GLUtessobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE ); // gluTess algorithm internally selects vertically oriented triangle strips and fans. // This orientation is not optimal for conventional memory-mapped raster display shape filling. // We can "fool" the algorithm by interchanging the x and y vertex values passed to gluTessVertex // and then reverting x and y on the resulting vertexCallbacks. // In this implementation, we will explicitely set the preferred orientation. //Set the preferred orientation tess_orient = TESS_HORZ; // prefer horizontal tristrips // PolyGeo BBox as lat/lon OGREnvelope Envelope; poly->getEnvelope(&Envelope); xmin = Envelope.MinX; ymin = Envelope.MinY; xmax = Envelope.MaxX; ymax = Envelope.MaxY; // Get total number of contours m_ncnt = 1; // always exterior ring int nint = poly->getNumInteriorRings(); // interior rings m_ncnt += nint; // Allocate cntr array cntr = (int *)malloc(m_ncnt * sizeof(int)); // Get total number of points(vertices) int npta = poly->getExteriorRing()->getNumPoints(); cntr[0] = npta; npta += 2; // fluff for( iir=0 ; iir < nint ; iir++) { int nptr = poly->getInteriorRing(iir)->getNumPoints(); cntr[iir+1] = nptr; npta += nptr + 2; } // printf("pPoly npta: %d\n", npta); geoPt = (GLdouble *)malloc((npta) * 3 * sizeof(GLdouble)); // vertex array // Grow the work buffer if necessary if((npta * 4) > s_buf_len) { s_pwork_buf = (GLdouble *)realloc(s_pwork_buf, npta * 4 * sizeof(GLdouble)); s_buf_len = npta * 4; } // Define the polygon gluTessBeginPolygon(GLUtessobj, NULL); // Create input structures // Exterior Ring int npte = poly->getExteriorRing()->getNumPoints(); cntr[0] = npte; GLdouble *ppt = geoPt; // Check and account for winding direction of ring bool cw = !(poly->getExteriorRing()->isClockwise() == 0); double x0, y0, x, y; OGRPoint p; if(cw) { poly->getExteriorRing()->getPoint(0, &p); x0 = p.getX(); y0 = p.getY(); } else { poly->getExteriorRing()->getPoint(npte-1, &p); x0 = p.getX(); y0 = p.getY(); } // Transcribe contour to an array of doubles, with duplicates eliminated double *DPbuffer = (double *)malloc(npte * 2 * sizeof(double)); double *DPrun = DPbuffer; int nPoints = npte; for(ip = 0 ; ip < npte ; ip++) { int pidx; if(cw) pidx = npte - ip - 1; else pidx = ip; poly->getExteriorRing()->getPoint(pidx, &p); x = p.getX(); y = p.getY(); if( ((fabs(x-x0) > EQUAL_EPS) || (fabs(y-y0) > EQUAL_EPS))) { GLdouble *ppt_temp = ppt; if(tess_orient == TESS_VERT) { *DPrun++ = x; *DPrun++ = y; } else { *DPrun++ = y; *DPrun++ = x; } x0 = x; y0 = y; } else nPoints--; } if(nPoints > 5 && (m_LOD_meters > .01)){ index_keep.Clear(); index_keep.Add(0); index_keep.Add(nPoints-1); index_keep.Add(1); index_keep.Add(nPoints-2); DouglasPeucker(DPbuffer, 1, nPoints-2, m_LOD_meters/(1852 * 60), &index_keep); // printf("DP Reduction: %d/%d\n", index_keep.GetCount(), nPoints); g_keep += index_keep.GetCount(); g_orig += nPoints; // printf("...................Running: %g\n", (double)g_keep/g_orig); } else { index_keep.Clear(); for(int i = 0 ; i < nPoints ; i++) index_keep.Add(i); } cntr[0] = index_keep.GetCount(); // Mark the keepers by adding a simple constant to X for(unsigned int i=0 ; i < index_keep.GetCount() ; i++){ int k = index_keep.Item(i); DPbuffer[2*k] += 2000.; } // Declare the gluContour and copy the points gluTessBeginContour(GLUtessobj); DPrun = DPbuffer; for(ip = 0 ; ip < nPoints ; ip++) { x = *DPrun++; y = *DPrun++; if(x > 1000.){ GLdouble *ppt_top = ppt; *ppt++ = x-2000; *ppt++ = y; *ppt++ = 0; gluTessVertex( GLUtessobj, ppt_top, ppt_top ) ; } } gluTessEndContour(GLUtessobj); free(DPbuffer); // Now the interior contours for(iir=0 ; iir < nint ; iir++) { gluTessBeginContour(GLUtessobj); int npti = poly->getInteriorRing(iir)->getNumPoints(); // Check and account for winding direction of ring bool cw = !(poly->getInteriorRing(iir)->isClockwise() == 0); if(!cw) { poly->getInteriorRing(iir)->getPoint(0, &p); x0 = p.getX(); y0 = p.getY(); } else { poly->getInteriorRing(iir)->getPoint(npti-1, &p); x0 = p.getX(); y0 = p.getY(); } // Transcribe points to vertex array, in proper order with no duplicates // also, accounting for tess_orient for(int ip = 0 ; ip < npti ; ip++) { OGRPoint p; int pidx; if(!cw) // interior contours must be cw pidx = npti - ip - 1; else pidx = ip; poly->getInteriorRing(iir)->getPoint(pidx, &p); x = p.getX(); y = p.getY(); if((fabs(x-x0) > EQUAL_EPS) || (fabs(y-y0) > EQUAL_EPS)) { GLdouble *ppt_temp = ppt; if(tess_orient == TESS_VERT) { *ppt++ = x; *ppt++ = y; } else { *ppt++ = y; *ppt++ = x; } *ppt++ = 0.0; gluTessVertex( GLUtessobj, ppt_temp, ppt_temp ) ; // printf("tess from Poly, internal vertex %d %g %g\n", ip, x, y); } else cntr[iir+1]--; x0 = x; y0 = y; } gluTessEndContour(GLUtessobj); } // Store some SM conversion data in static store, // for callback access s_ref_lat = ref_lat; s_ref_lon = ref_lon; s_bSENC_SM = bSENC_SM; s_bmerc_transform = false; // Ready to kick off the tesselator s_pTPG_Last = NULL; s_pTPG_Head = NULL; s_nvmax = 0; gluTessEndPolygon(GLUtessobj); // here it goes m_nvertex_max = s_nvmax; // record largest vertex count, updates in callback // Tesselation all done, so... // Create the data structures m_ppg_head = new PolyTriGroup; m_ppg_head->m_bSMSENC = s_bSENC_SM; m_ppg_head->nContours = m_ncnt; m_ppg_head->pn_vertex = cntr; // pointer to array of poly vertex counts m_ppg_head->data_type = DATA_TYPE_DOUBLE; // Transcribe the raw geometry buffer // Converting to float as we go, and // allowing for tess_orient // Also, convert to SM if requested // Recalculate the size of the geometry buffer int nptfinal = cntr[0] + 2; for(int i=0 ; i < nint ; i++) nptfinal += cntr[i+1] + 2; // No longer need the full geometry in the SENC, nptfinal = 1; m_nwkb = (nptfinal + 1) * 2 * sizeof(float); m_ppg_head->pgroup_geom = (float *)calloc(sizeof(float), (nptfinal + 1) * 2); float *vro = m_ppg_head->pgroup_geom; ppt = geoPt; float tx,ty; for(ip = 0 ; ip < nptfinal ; ip++) { if(TESS_HORZ == tess_orient) { ty = *ppt++; tx = *ppt++; } else { tx = *ppt++; ty = *ppt++; } if(bSENC_SM) { // Calculate SM from chart common reference point double easting, northing; toSM(ty, tx, ref_lat, ref_lon, &easting, &northing); *vro++ = easting; // x *vro++ = northing; // y } else { *vro++ = tx; // lon *vro++ = ty; // lat } ppt++; // skip z } m_ppg_head->tri_prim_head = s_pTPG_Head; // head of linked list of TriPrims // Convert the Triangle vertex arrays into a single memory allocation of floats // to reduce SENC size and enable efficient access later // First calculate the total byte size int total_byte_size = 2 * sizeof(float); TriPrim *p_tp = m_ppg_head->tri_prim_head; while( p_tp ) { total_byte_size += p_tp->nVert * 2 * sizeof(float); p_tp = p_tp->p_next; // pick up the next in chain } float *vbuf = (float *)malloc(total_byte_size); p_tp = m_ppg_head->tri_prim_head; float *p_run = vbuf; while( p_tp ) { float *pfbuf = p_run; GLdouble *pdouble_buf = (GLdouble *)p_tp->p_vertex; for( int i=0 ; i < p_tp->nVert * 2 ; ++i){ float x = (float)( *((GLdouble *)pdouble_buf) ); pdouble_buf++; *p_run++ = x; } free(p_tp->p_vertex); p_tp->p_vertex = (double *)pfbuf; p_tp = p_tp->p_next; // pick up the next in chain } m_ppg_head->bsingle_alloc = true; m_ppg_head->single_buffer = (unsigned char *)vbuf; m_ppg_head->single_buffer_size = total_byte_size; m_ppg_head->data_type = DATA_TYPE_FLOAT; gluDeleteTess(GLUtessobj); free( s_pwork_buf ); s_pwork_buf = NULL; free (geoPt); // Free up any "Combine" vertices created for(unsigned int i = 0; i < s_pCombineVertexArray->GetCount() ; i++) free (s_pCombineVertexArray->Item(i)); delete s_pCombineVertexArray; m_bOK = true; #endif // #ifdef ocpnUSE_GL return 0; }
void wxVideoTerminal::DoSelectGraphicRendition(wxArrayInt &attrs) { if (attrs.GetCount() == 0) attrs.Add( 0 ); unsigned int i; for (i=0; i<attrs.GetCount();++i) { int cur_param = attrs[i]; //wxLogDebug("DoSelectGraphicRendition(%d=%d)", i, cur_param); switch (cur_param) { case 0: // reset m_cursor_attr.value = 0; m_cursor_attr.val.fgcolor = 7; break; case 21: m_cursor_attr.val.bold = false; break; case 22: m_cursor_attr.val.dim = false; break; case 24: // underline-off m_cursor_attr.val.underline = false; break; case 25: // blink-off m_cursor_attr.val.blink = false; break; case 27: // reverse-off m_cursor_attr.val.reverse = false; break; case 1: // bold m_cursor_attr.val.bold = true; break; case 2: // dim m_cursor_attr.val.dim = true; break; case 4: // underline m_cursor_attr.val.underline = true; break; case 5: // blink m_cursor_attr.val.blink = true; break; case 7: // reverse m_cursor_attr.val.reverse = true; break; case 39: // default w/ underscore fgcolor m_cursor_attr.val.fgcolor = 7; break; case 38: // default fgcolor m_cursor_attr.val.fgcolor = 7; break; case 30: // black m_cursor_attr.val.fgcolor = 0; break; case 31: // red m_cursor_attr.val.fgcolor = 1; break; case 32: // green m_cursor_attr.val.fgcolor = 2; break; case 33: // brown m_cursor_attr.val.fgcolor = 3; break; case 34: // blue m_cursor_attr.val.fgcolor = 4; break; case 35: // magenta m_cursor_attr.val.fgcolor = 5; break; case 36: // cyan m_cursor_attr.val.fgcolor = 6; break; case 37: // white m_cursor_attr.val.fgcolor = 7; break; case 49: // default bgcolor m_cursor_attr.val.bgcolor = 0; break; case 40: // black m_cursor_attr.val.bgcolor = 0; break; case 41: // red m_cursor_attr.val.bgcolor = 1; break; case 42: // green m_cursor_attr.val.bgcolor = 2; break; case 43: // brown m_cursor_attr.val.bgcolor = 3; break; case 44: // blue m_cursor_attr.val.bgcolor = 4; break; case 45: // magenta m_cursor_attr.val.bgcolor = 5; break; case 46: // cyan m_cursor_attr.val.bgcolor = 6; break; case 47: // white m_cursor_attr.val.bgcolor = 7; break; } } }