这篇教程C++ wxLogError函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wxLogError函数的典型用法代码示例。如果您正苦于以下问题:C++ wxLogError函数的具体用法?C++ wxLogError怎么用?C++ wxLogError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wxLogError函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: wxASSERTint OggImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTracks, Tags *tags){ outTracks.clear(); wxASSERT(mFile->IsOpened()); CreateProgress(); //Number of streams used may be less than mVorbisFile->links, //but this way bitstream matches array index. mChannels.resize(mVorbisFile->links); int i = -1; for (auto &link: mChannels) { ++i; //Stream is not used if (mStreamUsage[i] == 0) { //This is just a padding to keep bitstream number and //array indices matched. continue; } vorbis_info *vi = ov_info(mVorbisFile, i); link.resize(vi->channels); int c = - 1; for (auto &channel : link) { ++c; channel = trackFactory->NewWaveTrack(mFormat, vi->rate); if (vi->channels == 2) { switch (c) { case 0: channel->SetChannel(Track::LeftChannel); channel->SetLinked(true); break; case 1: channel->SetChannel(Track::RightChannel); break; } } else { channel->SetChannel(Track::MonoChannel); } } }/* The number of bytes to get from the codec in each run */#define CODEC_TRANSFER_SIZE 4096/* The number of samples to read between calls to the callback. * Balance between responsiveness of the GUI and throughput of import. */#define SAMPLES_PER_CALLBACK 100000 short *mainBuffer = new short[CODEC_TRANSFER_SIZE]; /* determine endianness (clever trick courtesy of Nicholas Devillard, * (http://www.eso.org/~ndevilla/endian/) */ int testvar = 1, endian; if(*(char *)&testvar) endian = 0; // little endian else endian = 1; // big endian /* number of samples currently in each channel's buffer */ int updateResult = eProgressSuccess; long bytesRead = 0; long samplesRead = 0; int bitstream = 0; int samplesSinceLastCallback = 0; // You would think that the stream would already be seeked to 0, and // indeed it is if the file is legit. But I had several ogg files on // my hard drive that have malformed headers, and this added call // causes them to be read correctly. Otherwise they have lots of // zeros inserted at the beginning ov_pcm_seek(mVorbisFile, 0); do { /* get data from the decoder */ bytesRead = ov_read(mVorbisFile, (char *) mainBuffer, CODEC_TRANSFER_SIZE, endian, 2, // word length (2 for 16 bit samples) 1, // signed &bitstream); if (bytesRead == OV_HOLE) { wxFileName ff(mFilename); wxLogError(wxT("Ogg Vorbis importer: file %s is malformed, ov_read() reported a hole"), ff.GetFullName().c_str()); /* http://lists.xiph.org/pipermail/vorbis-dev/2001-February/003223.html * is the justification for doing this - best effort for malformed file, * hence the message.//.........这里部分代码省略.........
开发者ID:Avi2011class,项目名称:audacity,代码行数:101,
示例2: switchvoidEventWorker::OnSocketEvent(wxSocketEvent& pEvent) { switch(pEvent.GetSocketEvent()) { case wxSOCKET_INPUT: //wxLogDebug(wxT("EventWorker: INPUT")); do { if (m_readed == m_insize) return; //event already posted m_clientSocket->Read(m_inbuf + m_readed, m_insize - m_readed); if (m_clientSocket->Error()) { if (m_clientSocket->LastError() != wxSOCKET_WOULDBLOCK) { wxLogError(wxT("%s: read error"),CreateIdent(m_localaddr).c_str()); SendEvent(true); } } m_readed += m_clientSocket->LastCount(); //wxLogDebug(wxT("EventWorker: readed %d bytes, %d bytes to do"),m_clientSocket->LastCount(), m_insize - m_readed); if (m_readed == m_insize) { if (!memcmp(m_inbuf,m_outbuf,m_insize)) { wxLogError(wxT("%s: data mismatch"),CreateIdent(m_localaddr).c_str()); SendEvent(true); } m_currentType = WorkerEvent::DISCONNECTING; wxLogDebug(wxT("%s: DISCONNECTING"),CreateIdent(m_localaddr).c_str()); SendEvent(false); //wxLogDebug(wxT("EventWorker %p closing"),this); m_clientSocket->Close(); m_currentType = WorkerEvent::DONE; wxLogDebug(wxT("%s: DONE"),CreateIdent(m_localaddr).c_str()); SendEvent(false); } } while (!m_clientSocket->Error()); break; case wxSOCKET_OUTPUT: //wxLogDebug(wxT("EventWorker: OUTPUT")); do { if (m_written == m_outsize) return; if (m_written == 0) { m_currentType = WorkerEvent::SENDING; wxLogDebug(wxT("%s: SENDING"),CreateIdent(m_localaddr).c_str()); } m_clientSocket->Write(m_outbuf + m_written, m_outsize - m_written); if (m_clientSocket->Error()) { if (m_clientSocket->LastError() != wxSOCKET_WOULDBLOCK) { wxLogError(wxT("%s: Write error"),CreateIdent(m_localaddr).c_str()); SendEvent(true); } } m_written += m_clientSocket->LastCount(); if (m_written != m_outsize) { //wxLogDebug(wxT("EventWorker: written %d bytes, %d bytes to do"),m_clientSocket->LastCount(),m_outsize - m_written); } else { //wxLogDebug(wxT("EventWorker %p SENDING->RECEIVING"),this); m_currentType = WorkerEvent::RECEIVING; wxLogDebug(wxT("%s: RECEIVING"),CreateIdent(m_localaddr).c_str()); SendEvent(false); } } while(!m_clientSocket->Error()); break; case wxSOCKET_CONNECTION: { //wxLogMessage(wxT("EventWorker: got connection")); wxLogMessage(wxT("%s: starting writing message (2 bytes for signature and %d bytes of data to write)"),CreateIdent(m_localaddr).c_str(),m_outsize-2); if (!m_clientSocket->GetLocal(m_localaddr)) { wxLogError(_("Cannot get peer data for socket %p"),m_clientSocket); } m_currentType = WorkerEvent::SENDING; wxLogDebug(wxT("%s: CONNECTING"),CreateIdent(m_localaddr).c_str()); SendEvent(false); } break; case wxSOCKET_LOST: { wxLogError(_("%s: connection lost"),CreateIdent(m_localaddr).c_str()); SendEvent(true); } break; }}
开发者ID:ExperimentationBox,项目名称:Edenite,代码行数:92,
示例3: wxLogErrorvoid dlgSelectConnection::OnChangeServer(wxCommandEvent& ev){ int item; wxString olddatabase, oldusername; if (!GetServer()) return; // Keep old value for these comboboxes so that we can restore them if needed olddatabase = cbDatabase->GetValue(); oldusername = cbUsername->GetValue(); // Clear the comboboxes cbDatabase->Clear(); cbUsername->Clear(); cbRolename->Clear(); int sel=cbServer->GetCurrentSelection(); if (sel >= 0) { remoteServer = (pgServer*)cbServer->GetClientData(sel); if (!remoteServer->GetConnected()) { remoteServer->Connect(mainForm, remoteServer->GetStorePwd()); if (!remoteServer->GetConnected()) { wxLogError(wxT("%s"), remoteServer->GetLastError().c_str()); return; } } if (remoteServer->GetConnected()) { pgSetIterator set1(remoteServer->GetConnection(), wxT("SELECT DISTINCT datname/n") wxT(" FROM pg_database db/n") wxT(" WHERE datallowconn ORDER BY datname")); item = 0; while(set1.RowsLeft()) { cbDatabase->Append(set1.GetVal(wxT("datname"))); if (set1.GetVal(wxT("datname")) == olddatabase) item = cbDatabase->GetCount() - 1; } if (cbDatabase->GetCount()) cbDatabase->SetSelection(item); pgSetIterator set2(remoteServer->GetConnection(), wxT("SELECT DISTINCT usename/n") wxT("FROM pg_user db/n") wxT("ORDER BY usename")); item = 0; while(set2.RowsLeft()) { cbUsername->Append(set2.GetVal(wxT("usename"))); if (set2.GetVal(wxT("usename")) == oldusername) item = cbDatabase->GetCount() - 1; } if (cbUsername->GetCount()) cbUsername->SetSelection(item); if (remoteServer->GetConnection()->BackendMinimumVersion(8, 1)) { pgSetIterator set3(remoteServer->GetConnection(), wxT("SELECT DISTINCT rolname/n") wxT("FROM pg_roles db/n") wxT("ORDER BY rolname")); cbRolename->Append(wxEmptyString); while(set3.RowsLeft()) cbRolename->Append(set3.GetVal(wxT("rolname"))); cbRolename->Enable(true); } else cbRolename->Disable(); cbRolename->SetValue(wxEmptyString); } } OnChangeDatabase(ev);}
开发者ID:lhcezar,项目名称:pgadmin3,代码行数:88,
示例4: switchvoid *wxGetClipboardData(wxDataFormat dataFormat, long *len){ void *retval = NULL; switch ( dataFormat ) {#ifndef __WXWINCE__ case wxDF_BITMAP: { BITMAP bm; HBITMAP hBitmap = (HBITMAP) GetClipboardData(CF_BITMAP); if (!hBitmap) break; HDC hdcMem = CreateCompatibleDC((HDC) NULL); HDC hdcSrc = CreateCompatibleDC((HDC) NULL); HBITMAP old = (HBITMAP) ::SelectObject(hdcSrc, hBitmap); GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm); HBITMAP hNewBitmap = CreateBitmapIndirect(&bm); if (!hNewBitmap) { SelectObject(hdcSrc, old); DeleteDC(hdcMem); DeleteDC(hdcSrc); break; } HBITMAP old1 = (HBITMAP) SelectObject(hdcMem, hNewBitmap); BitBlt(hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, hdcSrc, 0, 0, SRCCOPY); // Select new bitmap out of memory DC SelectObject(hdcMem, old1); // Clean up SelectObject(hdcSrc, old); DeleteDC(hdcSrc); DeleteDC(hdcMem); // Create and return a new wxBitmap wxBitmap *wxBM = new wxBitmap; wxBM->SetHBITMAP((WXHBITMAP) hNewBitmap); wxBM->SetWidth(bm.bmWidth); wxBM->SetHeight(bm.bmHeight); wxBM->SetDepth(bm.bmPlanes); retval = wxBM; break; }#endif case wxDF_METAFILE: case CF_SYLK: case CF_DIF: case CF_TIFF: case CF_PALETTE: case wxDF_DIB: wxLogError(_("Unsupported clipboard format.")); return NULL; case wxDF_OEMTEXT: dataFormat = wxDF_TEXT; // fall through case wxDF_TEXT: { HANDLE hGlobalMemory = ::GetClipboardData(dataFormat); if (!hGlobalMemory) break; DWORD hsize = ::GlobalSize(hGlobalMemory); if (len) *len = hsize; char *s = new char[hsize]; if (!s) break; LPSTR lpGlobalMemory = (LPSTR) GlobalLock(hGlobalMemory); memcpy(s, lpGlobalMemory, hsize); GlobalUnlock(hGlobalMemory); retval = s; break; } default: { HANDLE hGlobalMemory = ::GetClipboardData(dataFormat); if ( !hGlobalMemory ) break; DWORD size = ::GlobalSize(hGlobalMemory); if ( len ) *len = size; void *buf = malloc(size);//.........这里部分代码省略.........
开发者ID:chromylei,项目名称:third_party,代码行数:101,
示例5: memset// load the mxf file formatbool wxMXFHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index){ opj_dparameters_t parameters; /* decompression parameters */ opj_event_mgr_t event_mgr; /* event manager */ opj_image_t *opjimage = NULL; unsigned char *src = NULL; unsigned char *ptr; int file_length, j2k_point, j2k_len; opj_codestream_info_t cstr_info; /* Codestream information structure */ // destroy the image image->Destroy(); /* handle to a decompressor */ opj_dinfo_t* dinfo = NULL; opj_cio_t *cio = NULL; /* configure the event callbacks (not required) */ memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); event_mgr.error_handler = mxf_error_callback; event_mgr.warning_handler = mxf_warning_callback; event_mgr.info_handler = mxf_info_callback; /* set decoding parameters to default values */ opj_set_default_decoder_parameters(¶meters); /* prepare parameters */ strncpy(parameters.infile, "", sizeof(parameters.infile)-1); strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1); parameters.decod_format = J2K_CFMT; parameters.cod_format = BMP_DFMT; if (m_reducefactor) parameters.cp_reduce = m_reducefactor; if (m_qualitylayers) parameters.cp_layer = m_qualitylayers; /*if (n_components) parameters. = n_components;*/ /* JPWL only */#ifdef USE_JPWL parameters.jpwl_exp_comps = m_expcomps; parameters.jpwl_max_tiles = m_maxtiles; parameters.jpwl_correct = m_enablejpwl;#endif /* USE_JPWL */ /* get a decoder handle */ dinfo = opj_create_decompress(CODEC_J2K); /* find length of the stream */ stream.SeekI(0, wxFromEnd); file_length = (int) stream.TellI(); /* search for the m_framenum codestream position and length */ //jp2c_point = searchjp2c(stream, file_length, m_framenum); //jp2c_len = searchjp2c(stream, file_length, m_framenum); j2k_point = 0; j2k_len = 10; // malloc memory source src = (unsigned char *) malloc(j2k_len); // copy the jp2c stream.SeekI(j2k_point, wxFromStart); stream.Read(src, j2k_len); /* catch events using our callbacks and give a local context */ opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr); /* setup the decoder decoding parameters using user parameters */ opj_setup_decoder(dinfo, ¶meters); /* open a byte stream */ cio = opj_cio_open((opj_common_ptr)dinfo, src, j2k_len); /* decode the stream and fill the image structure */ opjimage = opj_decode_with_info(dinfo, cio, &cstr_info); if (!opjimage) { wxMutexGuiEnter(); wxLogError(wxT("MXF: failed to decode image!")); wxMutexGuiLeave(); opj_destroy_decompress(dinfo); opj_cio_close(cio); free(src); return false; } /* close the byte stream */ opj_cio_close(cio); /* common rendering method */#include "imagjpeg2000.cpp" wxMutexGuiEnter(); wxLogMessage(wxT("MXF: image loaded.")); wxMutexGuiLeave(); /* close openjpeg structs */ opj_destroy_decompress(dinfo); opj_image_destroy(opjimage);//.........这里部分代码省略.........
开发者ID:OpenInkpot-archive,项目名称:iplinux-openjpeg,代码行数:101,
示例6: wxCHECK_MSG// same as AddPage() but does it at given positionbool wxNotebook::InsertPage(size_t nPage, wxNotebookPage *pPage, const wxString& strText, bool bSelect, int imageId){ wxCHECK_MSG( pPage != NULL, false, wxT("NULL page in wxNotebook::InsertPage") ); wxCHECK_MSG( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), false, wxT("invalid index in wxNotebook::InsertPage") ); wxASSERT_MSG( pPage->GetParent() == this, wxT("notebook pages must have notebook as parent") ); // add a new tab to the control // ---------------------------- // init all fields to 0 TC_ITEM tcItem; wxZeroMemory(tcItem); // set the image, if any if ( imageId != -1 ) { tcItem.mask |= TCIF_IMAGE; tcItem.iImage = imageId; } // and the text if ( !strText.empty() ) { tcItem.mask |= TCIF_TEXT; tcItem.pszText = (wxChar *)strText.wx_str(); // const_cast } // hide the page: unless it is selected, it shouldn't be shown (and if it // is selected it will be shown later) HWND hwnd = GetWinHwnd(pPage); SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_VISIBLE); // this updates internal flag too -- otherwise it would get out of sync // with the real state pPage->Show(false); // fit the notebook page to the tab control's display area: this should be // done before adding it to the notebook or TabCtrl_InsertItem() will // change the notebooks size itself! AdjustPageSize(pPage); // finally do insert it if ( TabCtrl_InsertItem(GetHwnd(), nPage, &tcItem) == -1 ) { wxLogError(wxT("Can't create the notebook page '%s'."), strText.c_str()); return false; } // need to update the bg brush when the first page is added // so the first panel gets the correct themed background if ( m_pages.empty() ) {#if wxUSE_UXTHEME UpdateBgBrush();#endif // wxUSE_UXTHEME } // succeeded: save the pointer to the page m_pages.Insert(pPage, nPage); // also ensure that the notebook background is used for its pages by making // them transparent: this ensures that MSWGetBgBrush() queries the notebook // for the background brush to be used for erasing them if ( wxPanel *panel = wxDynamicCast(pPage, wxPanel) ) { panel->MSWSetTransparentBackground(); } // we may need to adjust the size again if the notebook size changed: // normally this only happens for the first page we add (the tabs which // hadn't been there before are now shown) but for a multiline notebook it // can happen for any page at all as a new row could have been started if ( m_pages.GetCount() == 1 || HasFlag(wxNB_MULTILINE) ) { AdjustPageSize(pPage); } // now deal with the selection // --------------------------- // if the inserted page is before the selected one, we must update the // index of the selected page if ( int(nPage) <= m_nSelection ) { // one extra page added m_nSelection++; } // some page should be selected: either this one or the first one if there // is still no selection//.........这里部分代码省略.........
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:101,
示例7: wxLogDebugFSOExecutable FSOExecutable::GetBinaryVersion(wxString binaryname) { wxLogDebug(_T("Making version struct for the executable '%s'"), binaryname.c_str()); FSOExecutable ver; wxStringTokenizer tok(binaryname, _T("_.- ()[]/")); ver.executablename = binaryname; if ( !tok.HasMoreTokens() ) { wxLogError( _T("Did not find initial 'fs2' or 'fred2' token in executable '%s'"), binaryname.c_str()); return ver; } wxString first(tok.GetNextToken()); if ( tok.HasMoreTokens() && (!first.CmpNoCase(_T("fred2")) || !first.CmpNoCase(_T("fs2"))) ) { wxString second(tok.GetNextToken()); if ( !second.CmpNoCase(_T("open")) ) { if ( !first.CmpNoCase(_T("fs2")) ) { ver.binaryname = _T("FS2 Open"); } else { ver.binaryname = _T("FRED2 Open"); } } else { wxLogWarning(_T("was expecting 'open'; got %s in executable %s"), second.c_str(), binaryname.c_str()); return ver; } } else { wxLogWarning(_T("executable name '%s' too short"), binaryname.c_str()); return ver; } while ( tok.HasMoreTokens() ) { wxString token = tok.GetNextToken(); wxString temp; long tempVersion; if (token.IsEmpty()) { // can happen in OS X nightly debug builds // do nothing } else if ( !token.CmpNoCase(_T("exe")) ) { ; // do nothing#if IS_APPLE } else if ( !token.CmpNoCase(_T("app")) ) { break; // we've reached the end of the app name#endif } else if ( token.ToLong(&tempVersion) && token.size() == 8 ) { // must be a date from a nightly build; add it to the string if (!ver.string.IsEmpty()) { ver.string += _T(" "); } // add it in YYYY-MM-DD format ver.string += token.Mid(0, 4); ver.string += _T("-"); ver.string += token.Mid(4, 2); ver.string += _T("-"); ver.string += token.Mid(6, 2); } else if ( token.ToLong(&tempVersion) && ver.antipodes && ver.antNumber == 0) { // must be antipodes number if ( tempVersion > 0 ) { ver.antNumber = (int)tempVersion; } else { wxLogWarning( _T("antipodes number out of range (%ld) in executable %s"), tempVersion, binaryname.c_str()); } } else if ( token.ToLong(&tempVersion) && ver.major == 0 ) { // must be major version number if ( tempVersion < 1000 && tempVersion > 0 ) { ver.major = (int)tempVersion; } else { wxLogWarning( _T("major version number out of range (%ld) in executable %s"), tempVersion, binaryname.c_str()); } } else if ( token.ToLong(&tempVersion) && ver.minor == 0 ) { // must be minor version number if ( tempVersion < 1000 && tempVersion >= 0 ) { ver.minor = (int)tempVersion; } else { wxLogWarning( _T("minor version number out of range (%ld) in executable %s"), tempVersion, binaryname.c_str()); } } else if ( token.ToLong(&tempVersion) && ver.revision == 0) { // must be revision version number if ( tempVersion < 1000 && tempVersion >= 0 ) { ver.revision = (int)tempVersion; } else { wxLogWarning( _T("Revision version number out of range (%ld) in executable %s"), tempVersion, binaryname.c_str()); } } else if ( !token.CmpNoCase(_T("d")) || !token.CmpNoCase(_T("debug")) ) { ver.debug = true; } else if ( token.Lower().EndsWith(_T("d"), &temp) ) { if ( temp.ToLong(&tempVersion) ) { // is the revision version number if ( tempVersion < 1000 && tempVersion >= 0 ) { ver.revision = (int)tempVersion; ver.debug = true; } else {//.........这里部分代码省略.........
开发者ID:asarium,项目名称:wxlauncher,代码行数:101,
示例8: socketbool CDPlusAuthenticator::authenticate(const wxString& callsign, const wxString& hostname, unsigned int port, unsigned char id, bool writeToCache){ CTCPReaderWriterClient socket(hostname, port, m_address); bool ret = socket.open(); if (!ret) return false; unsigned char* buffer = new unsigned char[600U]; ::memset(buffer, ' ', 56U); buffer[0U] = 0x38U; buffer[1U] = 0xC0U; buffer[2U] = 0x01U; buffer[3U] = 0x00U; for (unsigned int i = 0U; i < callsign.Len(); i++) buffer[i + 4U] = callsign.GetChar(i); buffer[12U] = 'D'; buffer[13U] = 'V'; buffer[14U] = '0'; buffer[15U] = '1'; buffer[16U] = '9'; buffer[17U] = '9'; buffer[18U] = '9'; buffer[19U] = '9'; buffer[28U] = 'W'; buffer[29U] = '7'; buffer[30U] = 'I'; buffer[31U] = 'B'; buffer[32U] = id; buffer[40U] = 'D'; buffer[41U] = 'H'; buffer[42U] = 'S'; buffer[43U] = '0'; buffer[44U] = '2'; buffer[45U] = '5'; buffer[46U] = '7'; ret = socket.write(buffer, 56U); if (!ret) { socket.close(); delete[] buffer; return false; } ret = read(socket, buffer + 0U, 2U); while (ret) { unsigned int len = (buffer[1U] & 0x0FU) * 256U + buffer[0U]; // Ensure that we get exactly len - 2U bytes from the TCP stream ret = read(socket, buffer + 2U, len - 2U); if (!ret) { wxLogError(wxT("Short read from %s:%u"), hostname.c_str(), port); break; } if ((buffer[1U] & 0xC0U) != 0xC0U || buffer[2U] != 0x01U) { wxLogError(wxT("Invalid packet received from %s:%u"), hostname.c_str(), port); CUtils::dump(wxT("Details:"), buffer, len); ret = read(socket, buffer + 0U, 2U); continue; } for (unsigned int i = 8U; i < len; i += 26U) { wxString address = wxString((char*)(buffer + i + 0U), wxConvLocal); wxString name = wxString((char*)(buffer + i + 16U), wxConvLocal); address.Trim(); name.Trim(); // Get the active flag bool active = (buffer[i + 25U] & 0x80U) == 0x80U; // An empty name or IP address or an inactive gateway/reflector is not written out if (address.Len() > 0U && name.Len() > 0U && !name.Left(3U).IsSameAs(wxT("XRF")) && active && writeToCache){ if (name.Left(3U).IsSameAs(wxT("REF"))) wxLogMessage(wxT("D-Plus: %s/t%s"), name.c_str(), address.c_str()); name.Append(wxT(" ")); name.Truncate(LONG_CALLSIGN_LENGTH - 1U); name.Append(wxT("G")); m_cache->updateGateway(name, address, DP_DPLUS, false, true); } } ret = read(socket, buffer + 0U, 2U); } wxLogMessage(wxT("Registered with %s using callsign %s"), hostname.c_str(), callsign.c_str()); socket.close(); delete[] buffer; return true;//.........这里部分代码省略.........
开发者ID:OZ1BV,项目名称:DMRRepeater,代码行数:101,
示例9: GetParamNodewxObject *wxNotebookXmlHandler::DoCreateResource(){ if (m_class == wxT("notebookpage")) { wxXmlNode *n = GetParamNode(wxT("object")); if ( !n ) n = GetParamNode(wxT("object_ref")); if (n) { bool old_ins = m_isInside; m_isInside = false; wxObject *item = CreateResFromNode(n, m_notebook, NULL); m_isInside = old_ins; wxWindow *wnd = wxDynamicCast(item, wxWindow); if (wnd) { m_notebook->AddPage(wnd, GetText(wxT("label")), GetBool(wxT("selected"))); if ( HasParam(wxT("bitmap")) ) { wxBitmap bmp = GetBitmap(wxT("bitmap"), wxART_OTHER); wxImageList *imgList = m_notebook->GetImageList(); if ( imgList == NULL ) { imgList = new wxImageList( bmp.GetWidth(), bmp.GetHeight() ); m_notebook->AssignImageList( imgList ); } int imgIndex = imgList->Add(bmp); m_notebook->SetPageImage(m_notebook->GetPageCount()-1, imgIndex ); } } else wxLogError(wxT("Error in resource.")); return wnd; } else { wxLogError(wxT("Error in resource: no control within notebook's <page> tag.")); return NULL; } } else { XRC_MAKE_INSTANCE(nb, wxNotebook) nb->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(wxT("style")), GetName()); SetupWindow(nb); wxNotebook *old_par = m_notebook; m_notebook = nb; bool old_ins = m_isInside; m_isInside = true; CreateChildren(m_notebook, true/*only this handler*/); m_isInside = old_ins; m_notebook = old_par; return nb; }}
开发者ID:gitrider,项目名称:wxsj2,代码行数:68,
示例10: strwxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd){ wxString str(wxGetWindowClass(hWnd)); str.UpperCase(); long id = wxGetWindowId(hWnd); long style = GetWindowLong((HWND) hWnd, GWL_STYLE); wxWindow* win = NULL; if (str == wxT("BUTTON")) { int style1 = (style & 0xFF);#if wxUSE_CHECKBOX if ((style1 == BS_3STATE) || (style1 == BS_AUTO3STATE) || (style1 == BS_AUTOCHECKBOX) || (style1 == BS_CHECKBOX)) { win = new wxCheckBox; } else#endif#if wxUSE_RADIOBTN if ((style1 == BS_AUTORADIOBUTTON) || (style1 == BS_RADIOBUTTON)) { win = new wxRadioButton; } else#endif#if wxUSE_BMPBUTTON#if defined(__WIN32__) && defined(BS_BITMAP) if (style & BS_BITMAP) { // TODO: how to find the bitmap? win = new wxBitmapButton; wxLogError(wxT("Have not yet implemented bitmap button as BS_BITMAP button.")); } else#endif if (style1 == BS_OWNERDRAW) { // TODO: how to find the bitmap? // TODO: can't distinguish between bitmap button and bitmap static. // Change implementation of wxStaticBitmap to SS_BITMAP. // PROBLEM: this assumes that we're using resource-based bitmaps. // So maybe need 2 implementations of bitmap buttons/static controls, // with a switch in the drawing code. Call default proc if BS_BITMAP. win = new wxBitmapButton; } else#endif#if wxUSE_BUTTON if ((style1 == BS_PUSHBUTTON) || (style1 == BS_DEFPUSHBUTTON)) { win = new wxButton; } else#endif#if wxUSE_STATBOX if (style1 == BS_GROUPBOX) { win = new wxStaticBox; } else#endif { wxLogError(wxT("Don't know what kind of button this is: id = %ld"), id); } }#if wxUSE_COMBOBOX else if (str == wxT("COMBOBOX")) { win = new wxComboBox; }#endif#if wxUSE_TEXTCTRL // TODO: Problem if the user creates a multiline - but not rich text - text control, // since wxWin assumes RichEdit control for this. Should have m_isRichText in // wxTextCtrl. Also, convert as much of the window style as is necessary // for correct functioning. // Could have wxWindow::AdoptAttributesFromHWND(WXHWND) // to be overridden by each control class. else if (str == wxT("EDIT")) { win = new wxTextCtrl; }#endif#if wxUSE_LISTBOX else if (str == wxT("LISTBOX")) { win = new wxListBox; }#endif#if wxUSE_SCROLLBAR else if (str == wxT("SCROLLBAR")) { win = new wxScrollBar; }#endif#if wxUSE_SPINBTN//.........这里部分代码省略.........
开发者ID:252525fb,项目名称:rpcs3,代码行数:101,
示例11: wxCHECK_MSGint wxRegExImpl::Replace(wxString *text, const wxString& replacement, size_t maxMatches) const{ wxCHECK_MSG( text, wxNOT_FOUND, wxT("NULL text in wxRegEx::Replace") ); wxCHECK_MSG( IsValid(), wxNOT_FOUND, wxT("must successfully Compile() first") ); // the input string#ifndef WXREGEX_CONVERT_TO_MB const wxChar *textstr = text->c_str(); size_t textlen = text->length();#else const wxWX2MBbuf textstr = WXREGEX_CHAR(*text); if (!textstr) { wxLogError(_("Failed to find match for regular expression: %s"), GetErrorMsg(0, true).c_str()); return 0; } size_t textlen = strlen(textstr); text->clear();#endif // the replacement text wxString textNew; // the result, allow 25% extra wxString result; result.reserve(5 * textlen / 4); // attempt at optimization: don't iterate over the string if it doesn't // contain back references at all bool mayHaveBackrefs = replacement.find_first_of(wxT("//&")) != wxString::npos; if ( !mayHaveBackrefs ) { textNew = replacement; } // the position where we start looking for the match size_t matchStart = 0; // number of replacement made: we won't make more than maxMatches of them // (unless maxMatches is 0 which doesn't limit the number of replacements) size_t countRepl = 0; // note that "^" shouldn't match after the first call to Matches() so we // use wxRE_NOTBOL to prevent it from happening while ( (!maxMatches || countRepl < maxMatches) && Matches(#ifndef WXREGEX_CONVERT_TO_MB textstr + matchStart,#else textstr.data() + matchStart,#endif countRepl ? wxRE_NOTBOL : 0 WXREGEX_IF_NEED_LEN(textlen - matchStart)) ) { // the string possibly contains back references: we need to calculate // the replacement text anew after each match if ( mayHaveBackrefs ) { mayHaveBackrefs = false; textNew.clear(); textNew.reserve(replacement.length()); for ( const wxChar *p = replacement.c_str(); *p; p++ ) { size_t index = (size_t)-1; if ( *p == wxT('//') ) { if ( wxIsdigit(*++p) ) { // back reference wxChar *end; index = (size_t)wxStrtoul(p, &end, 10); p = end - 1; // -1 to compensate for p++ in the loop } //else: backslash used as escape character } else if ( *p == wxT('&') ) { // treat this as "/0" for compatbility with ed and such index = 0; } // do we have a back reference? if ( index != (size_t)-1 ) { // yes, get its text size_t start, len; if ( !GetMatch(&start, &len, index) ) { wxFAIL_MSG( wxT("invalid back reference") ); // just eat it... } else//.........这里部分代码省略.........
开发者ID:BauerBox,项目名称:wxWidgets,代码行数:101,
示例12: Reinitbool wxRegExImpl::Compile(const wxString& expr, int flags){ Reinit();#ifdef WX_NO_REGEX_ADVANCED# define FLAVORS wxRE_BASIC#else# define FLAVORS (wxRE_ADVANCED | wxRE_BASIC) wxASSERT_MSG( (flags & FLAVORS) != FLAVORS, wxT("incompatible flags in wxRegEx::Compile") );#endif wxASSERT_MSG( !(flags & ~(FLAVORS | wxRE_ICASE | wxRE_NOSUB | wxRE_NEWLINE)), wxT("unrecognized flags in wxRegEx::Compile") ); // translate our flags to regcomp() ones int flagsRE = 0; if ( !(flags & wxRE_BASIC) ) {#ifndef WX_NO_REGEX_ADVANCED if (flags & wxRE_ADVANCED) flagsRE |= REG_ADVANCED; else#endif flagsRE |= REG_EXTENDED; } if ( flags & wxRE_ICASE ) flagsRE |= REG_ICASE; if ( flags & wxRE_NOSUB ) flagsRE |= REG_NOSUB; if ( flags & wxRE_NEWLINE ) flagsRE |= REG_NEWLINE; // compile it#ifdef WXREGEX_USING_BUILTIN bool conv = true; // FIXME-UTF8: use wc_str() after removing ANSI build int errorcode = wx_re_comp(&m_RegEx, expr.c_str(), expr.length(), flagsRE);#else // FIXME-UTF8: this is potentially broken, we shouldn't even try it // and should always use builtin regex library (or PCRE?) const wxWX2MBbuf conv = expr.mbc_str(); int errorcode = conv ? regcomp(&m_RegEx, conv, flagsRE) : REG_BADPAT;#endif if ( errorcode ) { wxLogError(_("Invalid regular expression '%s': %s"), expr.c_str(), GetErrorMsg(errorcode, !conv).c_str()); m_isCompiled = false; } else // ok { // don't allocate the matches array now, but do it later if necessary if ( flags & wxRE_NOSUB ) { // we don't need it at all m_nMatches = 0; } else { // we will alloc the array later (only if really needed) but count // the number of sub-expressions in the regex right now // there is always one for the whole expression m_nMatches = 1; // and some more for bracketed subexperessions for ( const wxChar *cptr = expr.c_str(); *cptr; cptr++ ) { if ( *cptr == wxT('//') ) { // in basic RE syntax groups are inside /(.../) if ( *++cptr == wxT('(') && (flags & wxRE_BASIC) ) { m_nMatches++; } } else if ( *cptr == wxT('(') && !(flags & wxRE_BASIC) ) { // we know that the previous character is not an unquoted // backslash because it would have been eaten above, so we // have a bare '(' and this indicates a group start for the // extended syntax. '(?' is used for extensions by perl- // like REs (e.g. advanced), and is not valid for POSIX // extended, so ignore them always. if ( cptr[1] != wxT('?') ) m_nMatches++; } } } m_isCompiled = true; } return IsValid();}
开发者ID:BauerBox,项目名称:wxWidgets,代码行数:97,
示例13: LogEventvoid MyListCtrl::OnListKeyDown(wxListEvent& event){ long item; if ( !wxGetKeyState(WXK_SHIFT) ) { LogEvent(event, wxT("OnListKeyDown")); event.Skip(); return; } switch ( event.GetKeyCode() ) { case 'C': // colorize { wxListItem info; info.m_itemId = event.GetIndex(); if ( info.m_itemId == -1 ) { // no item break; } GetItem(info); wxListItemAttr *attr = info.GetAttributes(); if ( !attr || !attr->HasTextColour() ) { info.SetTextColour(*wxCYAN); SetItem(info); RefreshItem(info.m_itemId); } } break; case 'N': // next item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED); if ( item++ == GetItemCount() - 1 ) { item = 0; } wxLogMessage(wxT("Focusing item %ld"), item); SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); EnsureVisible(item); break; case 'R': // show bounding rectangle { item = event.GetIndex(); wxRect r; if ( !GetItemRect(item, r) ) { wxLogError(wxT("Failed to retrieve rect of item %ld"), item); break; } wxLogMessage(wxT("Bounding rect of item %ld is (%d, %d)-(%d, %d)"), item, r.x, r.y, r.x + r.width, r.y + r.height); } break; case '1': // show sub item bounding rectangle for the given column case '2': // (and icon/label rectangle if Shift/Ctrl is pressed) case '3': case '4': // this column is invalid but we want to test it too if ( InReportView() ) { int subItem = event.GetKeyCode() - '1'; item = event.GetIndex(); wxRect r; int code = wxLIST_RECT_BOUNDS; if ( wxGetKeyState(WXK_SHIFT) ) code = wxLIST_RECT_ICON; else if ( wxGetKeyState(WXK_CONTROL) ) code = wxLIST_RECT_LABEL; if ( !GetSubItemRect(item, subItem, r, code) ) { wxLogError(wxT("Failed to retrieve rect of item %ld column %d"), item, subItem + 1); break; } wxLogMessage(wxT("Bounding rect of item %ld column %d is (%d, %d)-(%d, %d)"), item, subItem + 1, r.x, r.y, r.x + r.width, r.y + r.height); } break; case 'U': // update if ( !IsVirtual() ) break; if ( m_updated != -1 ) RefreshItem(m_updated);//.........这里部分代码省略.........
开发者ID:HanruZhou,项目名称:wxWidgets,代码行数:101,
示例14: ttfFile/// Check TrueType font file whether font license allows embeddingvoidMakeFont::CheckTTF(const wxString& fileName, bool& embeddingAllowed, bool& subsettingAllowed, int& cffOffset, int& cffLength){ embeddingAllowed = false; subsettingAllowed = false; cffOffset = -1; cffLength = 0; if (fileName.Length() == 0) { return; } wxFileInputStream ttfFile(fileName); if (!ttfFile.Ok()) { // Can't open file wxLogMessage(wxT("Error: Unable to read font file '") + fileName + wxT("'.")); return; } // Extract number of tables ttfFile.SeekI(0, wxFromCurrent); int id = ReadInt(&ttfFile); if (id != 0x00010000 && id != 0x4f54544f) { wxLogError(wxT("Error: File '") + fileName + wxT("' is not a valid font file.")); return; } short nb = ReadShort(&ttfFile); ttfFile.SeekI(6, wxFromCurrent); // Seek OS/2 table bool found = false; int offset = 0; int i; for (i = 0; i < nb; i++) { char buffer[4]; ttfFile.Read(buffer,4); if (strncmp(buffer,"OS/2",4) == 0) { found = true; ttfFile.SeekI(4, wxFromCurrent); offset = ReadInt(&ttfFile); ttfFile.SeekI(4, wxFromCurrent); } else if (strncmp(buffer,"CFF ",4) == 0) { ttfFile.SeekI(4, wxFromCurrent); cffOffset = ReadInt(&ttfFile); cffLength = ReadInt(&ttfFile); } else { ttfFile.SeekI(12, wxFromCurrent); } } if (!found) { return; } ttfFile.SeekI(offset, wxFromStart); // Extract fsType flags ttfFile.SeekI(8, wxFromCurrent); short fsType = ReadShort(&ttfFile); bool rl = (fsType & 0x02) != 0; bool pp = (fsType & 0x04) != 0; bool e = (fsType & 0x08) != 0; bool ns = (fsType & 0x0100) != 0; bool eb = (fsType & 0x0200) != 0; embeddingAllowed = !(rl && !pp && !e) && !eb; subsettingAllowed = !ns;}
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:71,
示例15: configbool CDVAPNodeD::createThread(){ CDVAPNodeConfig config(m_confDir, m_name); wxString callsign, gateway; DSTAR_MODE mode; ACK_TYPE ack; bool restriction, rpt1Validation; config.getCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation); switch (mode) { case MODE_RXONLY: m_thread = new CDVAPNodeRXThread; break; case MODE_TXONLY: m_thread = new CDVAPNodeTXThread; break; default: m_thread = new CDVAPNodeTRXThread; break; } m_thread->setCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation); wxLogInfo(wxT("Callsign set to /"%s/", gateway set to /"%s/", mode: %d, ack: %d, restriction: %d, RPT1 validation: %d"), callsign.c_str(), gateway.c_str(), int(mode), int(ack), restriction, rpt1Validation); wxString gatewayAddress, localAddress; unsigned int gatewayPort, localPort; config.getNetwork(gatewayAddress, gatewayPort, localAddress, localPort); wxLogInfo(wxT("Gateway set to %s:%u, local set to %s:%u"), gatewayAddress.c_str(), gatewayPort, localAddress.c_str(), localPort); if (!gatewayAddress.IsEmpty()) { CRepeaterProtocolHandler* handler = new CRepeaterProtocolHandler(gatewayAddress, gatewayPort, localAddress, localPort); bool res = handler->open(); if (!res) { wxLogError(wxT("Cannot open the protocol handler")); return false; } m_thread->setProtocolHandler(handler); } unsigned int timeout, ackTime; config.getTimes(timeout, ackTime); m_thread->setTimes(timeout, ackTime); wxLogInfo(wxT("Timeout set to %u secs, ack time set to %u ms"), timeout, ackTime); unsigned int beaconTime; wxString beaconText; bool beaconVoice; TEXT_LANG language; config.getBeacon(beaconTime, beaconText, beaconVoice, language); m_thread->setBeacon(beaconTime, beaconText, beaconVoice, language); wxLogInfo(wxT("Beacon set to %u mins, text set to /"%s/", voice set to %d, language set to %d"), beaconTime / 60U, beaconText.c_str(), int(beaconVoice), int(language)); wxString dvapPort; unsigned int dvapFrequency; int dvapPower, dvapSquelch, dvapOffset; config.getDVAP(dvapPort, dvapFrequency, dvapPower, dvapSquelch, dvapOffset); wxLogInfo(wxT("DVAP: port: %s, frequency: %u Hz, power: %d dBm, squelch: %d dBm, offset: %d Hz"), dvapPort.c_str(), dvapFrequency, dvapPower, dvapSquelch, dvapOffset); if (!dvapPort.IsEmpty()) { CDVAPController* dvap = new CDVAPController(dvapPort, dvapFrequency, dvapPower, dvapSquelch, dvapOffset); bool res = dvap->open(); if (!res) { wxLogError(wxT("Unable to open the DVAP")); return false; } m_thread->setDVAP(dvap); } bool logging; config.getLogging(logging); m_thread->setLogging(logging, m_audioDir); wxLogInfo(wxT("Frame logging set to %d, in %s"), int(logging), m_audioDir.c_str()); wxFileName wlFilename(wxFileName::GetHomeDir(), WHITELIST_FILE_NAME); bool exists = wlFilename.FileExists(); if (exists) { CCallsignList* list = new CCallsignList(wlFilename.GetFullPath()); bool res = list->load(); if (!res) { wxLogError(wxT("Unable to open white list file - %s"), wlFilename.GetFullPath().c_str()); delete list; } else { wxLogInfo(wxT("%u callsigns loaded into the white list"), list->getCount()); m_thread->setWhiteList(list); } } wxFileName blFilename(wxFileName::GetHomeDir(), BLACKLIST_FILE_NAME); exists = blFilename.FileExists(); if (exists) { CCallsignList* list = new CCallsignList(blFilename.GetFullPath()); bool res = list->load(); if (!res) { wxLogError(wxT("Unable to open black list file - %s"), blFilename.GetFullPath().c_str()); delete list; } else {//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:101,
示例16: SeeLogErrorObjstatic void SeeLogErrorObj(SEE_interpreter* interpr_, SEE_value* errorValue){ // is the value an object? if( errorValue==NULL || SEE_VALUE_GET_TYPE(errorValue) != SEE_OBJECT ) return; // is the object an array? SEE_object* errorObj = errorValue->u.object; if( errorObj == NULL ) return; // get what to get ... wxString errorName, errorMsg, tempStr; long lineno = -1; // ... get the error name SEE_value tempVal; SEE_OBJECT_GET(interpr_, errorObj, str_name, &tempVal); if( SEE_VALUE_GET_TYPE(&tempVal) == SEE_STRING ) errorName = SeeValueToWxString(interpr_, &tempVal); errorName.Trim(true); errorName.Trim(false); if( errorName.IsEmpty() ) errorName = wxT("Error"); // ... get the error message, this is formatted as "<string>:<lineno>:msg" SEE_OBJECT_GET(interpr_, errorObj, str_message, &tempVal); if( SEE_VALUE_GET_TYPE(&tempVal) == SEE_STRING ) { errorMsg = SeeValueToWxString(interpr_, &tempVal); if( errorMsg.Find(wxT(":")) >= 0 ) { tempStr = errorMsg.BeforeFirst(wxT(':')); errorMsg = errorMsg.AfterFirst(wxT(':')); } if( errorMsg.Find(wxT(":")) >= 0 ) { tempStr = errorMsg.BeforeFirst(wxT(':')); if( !tempStr.ToLong(&lineno, 10) ) lineno = -1; errorMsg = errorMsg.AfterFirst(wxT(':')); } errorMsg.Trim(true); errorMsg.Trim(false); } if( errorMsg.IsEmpty() ) errorMsg = wxT("Unknown error"); // ... get the line number if( lineno >= 1 ) tempStr.Printf(wxT("%i"), (int)lineno); else tempStr = wxT("?"); // ... format the line wxLogError(wxT("Line %s: %s: %s [%s]"), tempStr.c_str(), errorName.c_str(), errorMsg.c_str(), HOST_DATA->m_executionScope.c_str() ); // old stuff #if 0 { SEE_value errorObjAsStr; SEE_ToString(interpr_, errorValue, &errorObjAsStr); wxString error = ::SeeValueToWxString(interpr_, &errorObjAsStr); if( error.IsEmpty() ) error = wxT("Unknown error."); wxLogError(wxT("%s [%s]"), error.c_str(), HOST_DATA->m_executionScope.c_str()); } #endif}
开发者ID:conradstorz,项目名称:silverjuke,代码行数:79,
示例17: wxFilterInputStreamwxGzipInputStream::wxGzipInputStream(wxInputStream& stream, wxMBConv& conv /*=wxConvFile*/) : wxFilterInputStream(stream){ m_decomp = NULL; m_crc = crc32(0, Z_NULL, 0); // Try to read the Gzip magic numbers 0x1f, 0x8b. If not found then the // underlying stream isn't gzipped after all, so unread the bytes taken // so that the underlying stream can be read directly instead. wxUint8 magic[2]; size_t n = m_parent_i_stream->Read(magic, sizeof(magic)).LastRead(); if (n < sizeof(magic) || ((magic[1] << 8) | magic[0]) != GZ_MAGIC) { if (n) m_parent_i_stream->Ungetch(magic, n); // Set EOF rather than error to indicate no gzip data m_lasterror = wxSTREAM_EOF; return; } wxDataInputStream ds(*m_parent_i_stream); // read method, flags, timestamp, extra flags and OS-code int method = ds.Read8(); int flags = ds.Read8();#if wxUSE_DATETIME wxUint32 datetime = ds.Read32(); if (datetime) // zero means not set (not -1 as usual for time_t) m_datetime = wxLongLong(0, datetime) * 1000L;#else ds.Read32();#endif ds.Read8(); ds.Read8(); if (flags & GZ_HEAD_CRC) ds.Read16(); if (flags & GZ_EXTRA_FIELD) for (int i = ds.Read16(); i > 0 && m_parent_i_stream->IsOk(); i--) m_parent_i_stream->GetC(); // RFC-1952 specifies ISO-8859-1 for these fields if (flags & GZ_ORIG_NAME) {#if wxUSE_UNICODE wxTextInputStream tis(*m_parent_i_stream, wxT(" /t"), conv);#else wxTextInputStream tis(*m_parent_i_stream); (void)conv;#endif wxChar c; while ((c = tis.GetChar()) != 0 && m_parent_i_stream->IsOk()) m_name += c; } if (flags & GZ_COMMENT) while (m_parent_i_stream->GetC() != 0 && m_parent_i_stream->IsOk()) ; // empty loop m_lasterror = wxSTREAM_READ_ERROR; if (!*m_parent_i_stream) { wxLogDebug(wxT("Error reading Gzip header")); return; } if (flags & GZ_RESERVED) wxLogWarning(_("Unsupported flag in Gzip header")); switch (method) { case Z_DEFLATED: m_decomp = new wxZlibInputStream(*m_parent_i_stream, wxZLIB_NO_HEADER); break; default: wxLogError(_("unsupported compression method in Gzip stream")); return; } if (m_decomp) m_lasterror = m_decomp->GetLastError();}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:82,
示例18: wxLogError// save the mxf file formatbool wxMXFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose ){ wxLogError(wxT("MXF: Couldn't save movie -> not implemented.")); return false;}
开发者ID:OpenInkpot-archive,项目名称:iplinux-openjpeg,代码行数:6,
示例19: ExportMultipleDatasetsSelect//.........这里部分代码省略......... { wxGxObjectContainer* pGxCont = wxDynamicCast(pGxParentObj, wxGxObjectContainer); if (NULL != pGxCont && pGxCont->CanCreate(enumGISFeatureDataset, eDefaulSubType)) { break; } else { pGxParentObj = pGxParentObj->GetParent(); } } if (pGxParentObj) { sStartLoc = pGxParentObj->GetFullName(); } } wxGISAppConfig oConfig = GetConfig(); if (oConfig.IsOk()) { if (eType == enumGISFeatureDataset) { sStartLoc = oConfig.Read(enumGISHKCU, dlg.GetAppName() + wxT("/lastpath/expm_vector_ds/path"), sStartLoc); } else if (eType == enumGISRasterDataset) { sStartLoc = oConfig.Read(enumGISHKCU, dlg.GetAppName() + wxT("/lastpath/expm_raster_ds/path"), sStartLoc); } else if (eType == enumGISTableDataset) { sStartLoc = oConfig.Read(enumGISHKCU, dlg.GetAppName() + wxT("/lastpath/expm_table_ds/path"), sStartLoc); } } if (!sStartLoc.IsEmpty()) dlg.SetStartingLocation(sStartLoc); if (dlg.ShowModal() == wxID_OK) { wxGxObjectFilter* pFilter = dlg.GetCurrentFilter(); if (NULL == pFilter) { wxMessageBox(_("Unexpected error"), _("Error"), wxCENTRE | wxOK | wxICON_ERROR, pWnd); wxLogError(_("Null wxGxObjectFilter returned")); return; } CPLString sPath = dlg.GetPath(); wxString sCatalogPath = dlg.GetLocation()->GetFullName(); if (oConfig.IsOk()) { if (eType == enumGISFeatureDataset) { oConfig.Write(enumGISHKCU, dlg.GetAppName() + wxT("/lastpath/expm_vector_ds/path"), sCatalogPath); } else if (eType == enumGISRasterDataset) { oConfig.Write(enumGISHKCU, dlg.GetAppName() + wxT("/lastpath/expm_raster_ds/path"), sCatalogPath); } else if (eType == enumGISTableDataset) { oConfig.Write(enumGISHKCU, dlg.GetAppName() + wxT("/lastpath/expm_table_ds/path"), sCatalogPath); } } //TODO: Now we create the copies (new names) instead of overwrite, but should show table with exist names and new names. If user set the same name - overwrite // |----------------|------------------| // | dataset1 | dataset1 (1) | // | dataset2 | dataset2 (1) | // | dataset3 | dataset3 (2) | // |----------------|------------------| wxVector<EXPORTED_DATASET> paExportDatasets; for (size_t i = 0; i < paDatasets.size(); ++i) { wxGxObject* pGxSrcDatasetObj = dynamic_cast<wxGxObject*>(paDatasets[i]); if (NULL == pGxSrcDatasetObj) { continue; } wxString sNewName = CheckUniqName(sPath, pGxSrcDatasetObj->GetBaseName(), pFilter->GetExt()); EXPORTED_DATASET ds = { sNewName, paDatasets[i] }; paExportDatasets.push_back(ds); } if (eType == enumGISFeatureDataset) { ExportMultipleVectorDatasets(pWnd, sPath, pFilter, paExportDatasets); } else if (eType == enumGISRasterDataset) { ExportMultipleRasterDatasets(pWnd, sPath, pFilter, paExportDatasets); } else if (eType == enumGISTableDataset) { ExportMultipleTableDatasets(pWnd, sPath, pFilter, paExportDatasets); } }}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:101,
示例20: configbool CIRCDDBGatewayAppD::createThread(){ CIRCDDBGatewayConfig config(m_confDir, CONFIG_FILE_NAME, m_name); m_thread = new CIRCDDBGatewayThread(m_logDir, m_name); GATEWAY_TYPE gatewayType; wxString gatewayCallsign, gatewayAddress, icomAddress, hbAddress, description1, description2, url; unsigned int icomPort, hbPort; double latitude, longitude; config.getGateway(gatewayType, gatewayCallsign, gatewayAddress, icomAddress, icomPort, hbAddress, hbPort, latitude, longitude, description1, description2, url); gatewayCallsign.MakeUpper(); gatewayCallsign.Append(wxT(" ")); gatewayCallsign.Truncate(LONG_CALLSIGN_LENGTH - 1U); wxString callsign = gatewayCallsign; callsign.Append(wxT(" ")); gatewayCallsign.Append(wxT("G")); wxLogInfo(wxT("Gateway type: %d, callsign: /"%s/", address: %s, Icom address: %s:%u, homebrew address: %s:%u, latitude: %lf, longitude: %lf, description: /"%s %s/", URL: /"%s/""), int(gatewayType), gatewayCallsign.c_str(), gatewayAddress.c_str(), icomAddress.c_str(), icomPort, hbAddress.c_str(), hbPort, latitude, longitude, description1.c_str(), description2.c_str(), url.c_str()); m_thread->setGateway(gatewayType, gatewayCallsign, gatewayAddress); wxString aprsHostname; unsigned int aprsPort; bool aprsEnabled; config.getDPRS(aprsEnabled, aprsHostname, aprsPort); wxLogInfo(wxT("APRS enabled: %d, host: %s:%u"), int(aprsEnabled), aprsHostname.c_str(), aprsPort); CAPRSWriter* aprs = NULL; if (aprsEnabled && !gatewayCallsign.IsEmpty() && !aprsHostname.IsEmpty() && aprsPort != 0U) { aprs = new CAPRSWriter(aprsHostname, aprsPort, gatewayCallsign, gatewayAddress); bool res = aprs->open(); if (!res) wxLogError(wxT("Cannot initialise the APRS data writer")); else m_thread->setAPRSWriter(aprs); } TEXT_LANG language; bool infoEnabled, echoEnabled, logEnabled, dratsEnabled, dtmfEnabled; config.getMiscellaneous(language, infoEnabled, echoEnabled, logEnabled, dratsEnabled, dtmfEnabled); wxLogInfo(wxT("Language: %d, info enabled: %d, echo enabled: %d, log enabled : %d, D-RATS enabled: %d, DTMF control enabled: %d"), int(language), int(infoEnabled), int(echoEnabled), int(logEnabled), int(dratsEnabled), int(dtmfEnabled)); CIcomRepeaterProtocolHandler* icomRepeaterHandler = NULL; CHBRepeaterProtocolHandler* hbRepeaterHandler = NULL; CDummyRepeaterProtocolHandler* dummyRepeaterHandler = NULL; unsigned int icomCount = 0U; wxString repeaterCall1, repeaterBand1, repeaterAddress1, reflector1, description11, description12, url1; double frequency1, offset1, range1, latitude1, longitude1, agl1; unsigned char band11, band12, band13; unsigned int repeaterPort1; HW_TYPE repeaterType1; bool atStartup1; RECONNECT reconnect1; config.getRepeater1(repeaterCall1, repeaterBand1, repeaterType1, repeaterAddress1, repeaterPort1, band11, band12, band13, reflector1, atStartup1, reconnect1, frequency1, offset1, range1, latitude1, longitude1, agl1, description11, description12, url1); CUtils::clean(description11, wxT("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 .,&*()[email C++ wxLogInfo函数代码示例 C++ wxLogDebugFunc函数代码示例
|