本文整理汇总了C++中wxLogMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ wxLogMessage函数的具体用法?C++ wxLogMessage怎么用?C++ wxLogMessage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxLogMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxFrame
// Define my frame constructor
MyFrame::MyFrame(wxFrame *frame, const wxString& title)
: wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize(400, 300))
{
#if wxUSE_STATUSBAR
CreateStatusBar();
#endif // wxUSE_STATUSBAR
// Give it an icon
SetIcon(wxICON(sample));
// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(wxID_EXIT, _T("&Quit\tCtrl-Q"));
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _T("&File"));
// Associate the menu bar with the frame
SetMenuBar(menu_bar);
// set a dialog background
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
// add the controls to the frame
wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
wxFlexGridSizer *item2 = new wxFlexGridSizer( 2, 0, 0 );
item2->AddGrowableCol( 1 );
wxButton *item3 = new wxButton( this, ID_START, wxT("Start Server"), wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxString strs4[] =
{
IPC_SERVICE, _T("...")
};
wxChoice *item4 = new wxChoice( this, ID_SERVERNAME, wxDefaultPosition, wxSize(100,-1), 2, strs4, 0 );
item2->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxButton *item5 = new wxButton( this, ID_DISCONNECT, wxT("Disconnect Client"), wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
wxButton *item6 = new wxButton( this, ID_ADVISE, wxT("Advise"), wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item6, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
item1->Add( item2, 1, wxALIGN_CENTER|wxALL, 5 );
item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxStaticBox *item8 = new wxStaticBox( this, -1, wxT("Server log") );
wxStaticBoxSizer *item7 = new wxStaticBoxSizer( item8, wxVERTICAL );
wxTextCtrl *item9 = new wxTextCtrl( this, ID_LOG, wxT(""), wxDefaultPosition, wxSize(500,140), wxTE_MULTILINE );
item7->Add( item9, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item0->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
SetSizer( item0 );
item0->SetSizeHints( this );
// status
m_server = NULL;
GetServername()->SetSelection(0);
wxLogTextCtrl *logWindow = new wxLogTextCtrl(GetLog());
delete wxLog::SetActiveTarget(logWindow);
wxLogMessage(_T("Click on Start to start the server"));
Enable();
}
示例2: AddLocaleCatalog
int grib_pi::Init(void)
{
AddLocaleCatalog( _T("opencpn-grib_pi") );
// Set some default private member parameters
m_CtrlBarxy = wxPoint( 0 ,0 );
m_CursorDataxy = wxPoint( 0, 0 );
m_pGribCtrlBar = NULL;
m_pGRIBOverlayFactory = NULL;
::wxDisplaySize(&m_display_width, &m_display_height);
m_DialogStyleChanged = false;
// Get a pointer to the opencpn configuration object
m_pconfig = GetOCPNConfigObject();
// And load the configuration items
LoadConfig();
// Get a pointer to the opencpn display canvas, to use as a parent for the GRIB dialog
m_parent_window = GetOCPNCanvasWindow();
// int m_height = GetChartbarHeight();
// This PlugIn needs a CtrlBar icon, so request its insertion if enabled locally
if (m_bGRIBShowIcon) {
wxString shareLocn = *GetpSharedDataLocation() +
_T("plugins") + wxFileName::GetPathSeparator() +
_T("grib_pi") + wxFileName::GetPathSeparator()
+ _T("data") + wxFileName::GetPathSeparator();
wxString normalIcon = shareLocn + _T("grib.svg");
wxString toggledIcon = shareLocn + _T("grib_toggled.svg");
wxString rolloverIcon = shareLocn + _T("grib_rollover.svg");
// For journeyman styles, we prefer the built-in raster icons which match the rest of the toolbar.
if (GetActiveStyleName().Lower() != _T("traditional")){
normalIcon = _T("");
toggledIcon = _T("");
rolloverIcon = _T("");
}
wxLogMessage(normalIcon);
m_leftclick_tool_id = InsertPlugInToolSVG(_T(""), normalIcon, rolloverIcon, toggledIcon, wxITEM_CHECK,
_("Grib"), _T(""), NULL, GRIB_TOOL_POSITION, 0, this);
}
if( !QualifyCtrlBarPosition( m_CtrlBarxy, m_CtrlBar_Sizexy ) ) {
m_CtrlBarxy = wxPoint( 20, 60 ); //reset to the default position
m_CursorDataxy = wxPoint( 20, 170 );
}
return (WANTS_OVERLAY_CALLBACK |
WANTS_OPENGL_OVERLAY_CALLBACK |
WANTS_CURSOR_LATLON |
WANTS_TOOLBAR_CALLBACK |
INSTALLS_TOOLBAR_TOOL |
WANTS_CONFIG |
WANTS_PREFERENCES |
WANTS_PLUGIN_MESSAGING |
WANTS_ONPAINT_VIEWPORT |
WANTS_MOUSE_EVENTS
);
}
示例3: if
void CDVAPNodeTRXThread::receiveNetwork()
{
if (m_protocolHandler == NULL)
return;
NETWORK_TYPE type;
for (;;) {
type = m_protocolHandler->read();
// Get the data from the network
if (type == NETWORK_NONE) { // Nothing received
break;
} else if (type == NETWORK_HEADER) { // A header
CHeaderData* header = m_protocolHandler->readHeader();
if (header != NULL) {
::memcpy(m_lastData, NULL_FRAME_DATA_BYTES, DV_FRAME_LENGTH_BYTES);
processNetworkHeader(header);
m_headerTime.Start();
m_packetTime.Start();
m_packetCount = 0U;
m_packetSilence = 0U;
}
} else if (type == NETWORK_DATA) { // AMBE data and slow data
unsigned char data[2U * DV_FRAME_MAX_LENGTH_BYTES];
::memset(data, 0x00U, 2U * DV_FRAME_MAX_LENGTH_BYTES);
unsigned char seqNo;
unsigned int length = m_protocolHandler->readData(data, DV_FRAME_MAX_LENGTH_BYTES, seqNo);
if (length != 0U) {
::memcpy(m_lastData, data, length);
m_packetCount += processNetworkFrame(data, length, seqNo);
m_watchdogTimer.reset();
}
} else if (type == NETWORK_TEXT) { // Slow data text for the Ack
m_protocolHandler->readText(m_ackText, m_linkStatus, m_reflector);
m_linkEncoder.setTextData(m_ackText);
wxLogMessage(wxT("Slow data set to \"%s\""), m_ackText.c_str());
} else if (type == NETWORK_STATUS1) { // Slow data text for status 1, unused
m_protocolHandler->readStatus1();
} else if (type == NETWORK_STATUS2) { // Slow data text for status 2, unused
m_protocolHandler->readStatus2();
} else if (type == NETWORK_STATUS3) { // Slow data text for status 3, unused
m_protocolHandler->readStatus3();
} else if (type == NETWORK_STATUS4) { // Slow data text for status 4, unused
m_protocolHandler->readStatus4();
} else if (type == NETWORK_STATUS5) { // Slow data text for status 5, unused
m_protocolHandler->readStatus5();
}
}
// Have we missed any data frames?
if (m_state == DSRS_NETWORK && m_packetTime.Time() > 200L) {
unsigned int packetsNeeded = m_headerTime.Time() / DSTAR_FRAME_TIME_MS;
// wxLogMessage(wxT("Time: %u ms, need %u packets and received %u packets"), ms - m_headerMS, packetsNeeded, m_packetCount);
if (packetsNeeded > m_packetCount) {
unsigned int count = packetsNeeded - m_packetCount;
if (count > 5U) {
count -= 2U;
// wxLogMessage(wxT("Inserting %u silence packets into the network data stream"), count);
// Create silence frames
for (unsigned int i = 0U; i < count; i++) {
unsigned char data[DV_FRAME_LENGTH_BYTES];
::memcpy(data, NULL_FRAME_DATA_BYTES, DV_FRAME_LENGTH_BYTES);
m_packetCount += processNetworkFrame(data, DV_FRAME_LENGTH_BYTES, m_networkSeqNo);
m_packetSilence++;
}
}
}
m_packetTime.Start();
}
}
示例4: glyphList
/// Make wxPdfDocument font metrics file based on UFM file
bool
MakeFont::MakeFontUFM(const wxString& fontFileName,
const wxString& ufmFileName,
const wxString& type,
const wxString& volt)
{
bool hasVolt = !volt.IsEmpty();
int paBase = 0xe000;
bool cff = false;
GlyphList glyphList(CompareGlyphListEntries);
static size_t CC2GNSIZE = 131072; // 2*64kB
wxFileName fileName(ufmFileName);
bool embeddingAllowed = false;
bool subsettingAllowed = false;
int cffOffset = -1;
int cffLength = 0;
if (fontFileName.Length() > 0)
{
CheckTTF(fontFileName, embeddingAllowed, subsettingAllowed, cffOffset, cffLength);
cff = cffOffset > 0;
}
else
{
cff = (type == wxT("OpenType"));
}
wxPdfFontData* ufmFont;
if (cff)
{
ufmFont = new wxPdfFontDataOpenTypeUnicode();
}
else
{
ufmFont = new wxPdfFontDataTrueTypeUnicode();
}
// Initialize font description
wxPdfFontDescription fd;
fd.SetAscent(1000);
fd.SetDescent(-200);
fd.SetItalicAngle(0);
fd.SetStemV(70);
fd.SetMissingWidth(600);
bool hasCapHeight = false;
bool hasXCapHeight = false;
bool hasXHeight = false;
bool hasFontBBox = false;
bool hasStemV = false;
bool hasMissingWidth = false;
int flags = 0;
wxFileInputStream ufmFile(ufmFileName);
if (!ufmFile.Ok())
{
wxLogMessage(wxT("Error: Unable to read UFM file '") + ufmFileName + wxT("'."));
return false;
}
wxTextInputStream text(ufmFile);
// Prepare empty CIDToGIDMap
unsigned char* cc2gn = new unsigned char[131072];
size_t j;
for (j = 0; j < CC2GNSIZE; j++)
{
cc2gn[j] = '\0';
}
// Read the UFM font metric file
wxPdfGlyphWidthMap* widths = new wxPdfGlyphWidthMap();
wxPdfChar2GlyphMap* glyphs = new wxPdfChar2GlyphMap();
wxString line;
wxString charcode, glyphname;
wxString code, param, dummy, glyph;
wxString token, tokenBoxHeight;
long nParam, width, glyphNumber, boxHeight;
wxString weight;
while (!ufmFile.Eof())
{
line = text.ReadLine();
line.Trim();
wxStringTokenizer tkz(line, wxT(" "));
int count = (int) tkz.CountTokens();
if (count < 2) continue;
code = tkz.GetNextToken(); // 0
param = tkz.GetNextToken(); // 1
if (code == wxT("U"))
{
long cc;
param.ToLong(&cc); // Character code
width = -1;
glyphNumber = 0;
boxHeight = 0;
tokenBoxHeight = wxEmptyString;
dummy = tkz.GetNextToken(); // Semicolon
while (tkz.HasMoreTokens())
{
token = tkz.GetNextToken();
//.........这里部分代码省略.........
示例5: fileName
/// Make wxPdfDocument font metrics file based on AFM file
bool
MakeFont::MakeFontAFM(const wxString& fontFileName, const wxString& afmFileName,
const wxString& encoding, const wxString& type, const wxString& patch)
{
bool valid = false;
wxString fontType = type;
wxFileName fileName(fontFileName);
// Find font type
if (fontFileName.Length() > 0)
{
wxString ext = fileName.GetExt();
if (ext == wxT("ttf"))
{
fontType = wxT("TrueType");
}
else if (ext == wxT("pfb"))
{
fontType = wxT("Type1");
}
else
{
wxLogMessage(wxT("Warning: Unrecognized font file extension (") + ext + wxT("), ") + fontType + wxT(" font assumed."));
}
}
bool embeddingAllowed = true;
bool subsettingAllowed = true;
if (fontFileName.Length() > 0)
{
int cffOffset, cffLength;
if (fontType == wxT("TrueType"))
{
CheckTTF(fontFileName, embeddingAllowed, subsettingAllowed, cffOffset, cffLength);
}
}
wxPdfFontData* afmFont;
if (fontType == wxT("TrueType"))
{
afmFont = new wxPdfFontDataTrueType();
}
else
{
afmFont = new wxPdfFontDataType1();
}
// Initialize font description
wxPdfFontDescription fd;
fd.SetAscent(1000);
fd.SetDescent(-200);
fd.SetItalicAngle(0);
fd.SetStemV(70);
fd.SetMissingWidth(600);
fd.SetUnderlinePosition(-100);
fd.SetUnderlineThickness(50);
bool hasCapHeight = false;
bool hasXCapHeight = false;
bool hasXHeight = false;
bool hasFontBBox = false;
bool hasStemV = false;
bool hasMissingWidth = false;
int flags = 0;
CTGMap cc2gn;
CTGMap cc2gnPatch;
if (encoding.Length() > 0)
{
afmFont->SetEncoding(encoding);
valid = ReadMap(encoding, cc2gn);
if (!valid)
{
delete afmFont;
return false;
}
if (patch.Length() > 0)
{
valid = ReadMap(patch, cc2gnPatch);
if (valid)
{
CTGMap::iterator patchIter;
for (patchIter = cc2gnPatch.begin(); patchIter != cc2gnPatch.end(); patchIter++)
{
cc2gn[patchIter->first] = patchIter->second;
}
}
else
{
wxLogMessage(wxT("Warning: Unable to read patch file '") + patch + wxT("'."));
}
}
}
// Read a font metric file
wxFileInputStream afmFile(afmFileName);
if (!afmFile.Ok())
{
wxLogMessage(wxT("Error: Unable to read AFM file '") + afmFileName + wxT("'."));
delete afmFont;
return false;
//.........这里部分代码省略.........
示例6: wxASSERT
int IfaceCheckApp::CompareClasses(const wxClass* iface, const wxClass* api)
{
const wxMethod *real;
int count = 0;
wxASSERT(iface && api);
// shorten the name of the header so the log file is more readable
wxString header = wxFileName(iface->GetHeader()).GetFullName();
#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 (unsigned int i=0; i<iface->GetMethodCount(); i++)
{
const wxMethod& m = iface->GetMethod(i);
// only compare the methods which are available for the port
// for which the gcc XML was produced
if (m.GetAvailability() != wxPORT_UNKNOWN &&
(m.GetAvailability() & m_gccInterface.GetInterfacePort()) == 0) {
if (g_verbose)
{
wxLogMessage("skipping method '%s' since it's not available for the %s port.",
m.GetAsString(), m_gccInterface.GetInterfacePortName());
}
continue; // skip this method
}
// search in the methods of the api classes provided
real = api->RecursiveUpwardFindMethod(m, &m_gccInterface);
// avoid some false positives:
if (!real && m.ActsAsDefaultCtor())
{
// build an artificial default ctor for this class:
wxMethod temp(m);
temp.GetArgumentTypes().Clear();
// repeat search:
real = api->RecursiveUpwardFindMethod(temp, &m_gccInterface);
}
// no matches?
if (!real)
{
bool proceed = true;
wxMethodPtrArray overloads =
api->RecursiveUpwardFindMethodsNamed(m.GetName(), &m_gccInterface);
// avoid false positives:
#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 (unsigned int k=0; k<overloads.GetCount(); k++)
if (overloads[k]->MatchesExceptForAttributes(m) &&
m.IsDeprecated() && !overloads[k]->IsDeprecated())
{
// maybe the iface method is marked as deprecated but the
// real method is not?
wxMethod tmp(*overloads[k]);
tmp.SetDeprecated(true);
if (tmp == m)
{
// in this case, we can disregard this warning... the real
// method probably is included in WXWIN_COMPAT sections!
proceed = false; // skip this method
}
}
#define HACK_TO_AUTO_CORRECT_ONLY_METHOD_ATTRIBUTES 0
#if HACK_TO_AUTO_CORRECT_ONLY_METHOD_ATTRIBUTES
#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 (unsigned int k=0; k<overloads.GetCount(); k++)
if (overloads[k]->MatchesExceptForAttributes(m))
{
// fix default values of results[k]:
//.........这里部分代码省略.........
示例7: wxLogError
bool wxvbamApp::OnCmdLineParsed(wxCmdLineParser &cl)
{
if (!wxApp::OnCmdLineParsed(cl))
return false;
wxString s;
if (cl.Found(wxT("save-xrc"), &s))
{
// This was most likely done on a command line, so use
// stderr instead of gui for messages
wxLog::SetActiveTarget(new wxLogStderr);
wxFileSystem fs;
wxFSFile* f = fs.OpenFile(wxT("memory:wxvbam.xrs#zip:wxvbam.xrs$wxvbam.xrc"));
if (!f)
{
wxLogError(_("Configuration/build error: can't find built-in xrc"));
return false;
}
wxFileOutputStream os(s);
os.Write(*f->GetStream());
delete f;
wxString lm;
lm.Printf(_("Wrote built-in configuration to %s.\n"
"To override, remove all but changed root node(s). "
"First found root node of correct name in any .xrc or "
".xrs files in following search path overrides built-in:"),
s.c_str());
tack_full_path(lm);
wxLogMessage(lm);
return false;
}
if (cl.Found(wxT("print-cfg-path")))
{
// This was most likely done on a command line, so use
// stderr instead of gui for messages
wxLog::SetActiveTarget(new wxLogStderr);
wxString lm(_("Configuration is read from, in order:"));
tack_full_path(lm);
wxLogMessage(lm);
return false;
}
if (cl.Found(wxT("save-over"), &s))
{
// This was most likely done on a command line, so use
// stderr instead of gui for messages
wxLog::SetActiveTarget(new wxLogStderr);
wxFileOutputStream os(s);
os.Write(builtin_over, sizeof(builtin_over));
wxString lm;
lm.Printf(_("Wrote built-in override file to %s\n"
"To override, delete all but changed section. First found section is used from search path:"), s.c_str());
wxString oi = wxFileName::GetPathSeparator();
oi += wxT("vba-over.ini");
tack_full_path(lm, oi);
lm.append(_("\n\tbuilt-in"));
wxLogMessage(lm);
return false;
}
if (cl.Found(wxT("f")))
{
pending_fullscreen = true;
}
if (cl.Found(wxT("o")))
{
wxPrintf(_("Options set from the command line are saved if any"
" configuration changes are made in the user interface.\n\n"
"For flag options, true and false are specified as 1 and 0, respectively.\n\n"));
for (int i = 0; i < num_opts; i++)
{
wxPrintf(wxT("%s (%s"), opts[i].opt,
opts[i].boolopt ? (const wxChar*)wxT("flag") :
opts[i].stropt ? (const wxChar*)wxT("string") :
opts[i].enumvals ? opts[i].enumvals :
opts[i].intopt ? (const wxChar*)wxT("int") :
(const wxChar*)wxT("string"));
if (opts[i].enumvals)
{
const wxChar* evx = wxGetTranslation(opts[i].enumvals);
if (wxStrcmp(evx, opts[i].enumvals))
wxPrintf(wxT(" = %s"), evx);
}
wxPrintf(wxT(")\n\t%s\n\n"), opts[i].desc);
if (opts[i].enumvals)
opts[i].enumvals = wxGetTranslation(opts[i].enumvals);
}
wxPrintf(_("The commands available for the Keyboard/* option are:\n\n"));
//.........这里部分代码省略.........
示例8: while
//.........这里部分代码省略.........
// DECORATE //$ handling
if (!decorate)
skipLineComment();
else if (current + 2 < end && current[2] != '$')
skipLineComment();
else
ready = true;
}
// Check if we have a multiline comment
if (current + 1 != end && current[0] == '/' && current[1] == '*')
{
skipMultilineComment(); // Skip it
ready = false;
}
}
// Skip '##' comments
if (comments & HCOMMENTS)
{
if (current + 1 != end && current[0] == '#' && current[1] == '#')
{
skipLineComment(); // Skip it
ready = false;
}
}
// Skip ';' comments
if (comments & SCOMMENTS)
{
if (current[0] == ';')
{
skipLineComment(); // Skip it
ready = false;
}
}
// Check for end of text
if (position == size)
return;
}
// Init token delimiters
t_start = position;
t_end = position;
// If we're at a special character, it's our token
if (isSpecialCharacter(current[0]))
{
token_current += current[0];
t_end = position + 1;
incrementCurrent();
return;
}
// Now read the token
if (current[0] == '\"') // If we have a literal string (enclosed with "")
{
qstring = true;
// Skip opening "
incrementCurrent();
// Read literal string (include whitespace)
while (current[0] != '\"')
{
token_current += current[0];
if (!incrementCurrent())
return;
}
// Skip closing "
incrementCurrent();
}
else
{
// Read token (don't include whitespace)
while (!isWhitespace(current[0]))
{
// Return if special character found
if (isSpecialCharacter(current[0]))
return;
// Add current character to the token
token_current += current[0];
// Return if end of text found
if (!incrementCurrent())
return;
}
}
// Write token to log if debug mode enabled
if (debug)
wxLogMessage(token_current);
// Return the token
return;
}
示例9: wxLogMessage
void CStarNetHandler::linkUp(DSTAR_PROTOCOL protocol, const wxString& callsign)
{
wxLogMessage(wxT("DCS link to %s established"), callsign.c_str());
m_linkStatus = LS_LINKED_DCS;
}
示例10: wxLogMessage
bool Spring::RunReplay ( const wxString& filename )
{
wxLogMessage( _T("launching spring with replay: ") + filename );
return LaunchSpring( _T("\"") + filename + _T("\"") );
}
示例11: while
void* CDSPControl::Entry()
{
// Open for business
m_running = true;
m_rxWriter->enable();
while (!TestDestroy()) {
wxSemaError ret = m_waiting.WaitTimeout(500UL);
if (ret == wxSEMA_NO_ERROR) {
if (m_transmit == TXSTATE_INT || m_transmit == TXSTATE_EXT) {
unsigned int nSamples = m_txRingBuffer.getData(m_txBuffer, m_blockSize);
if (nSamples != m_blockSize) {
// Copy the last buffer of good data to the output
::memcpy(m_txBuffer, m_txLastBuffer, m_blockSize * sizeof(float) * 2U);
m_txFills++;
} else {
// Save the last full buffer in case it's needed
::memcpy(m_txLastBuffer, m_txBuffer, m_blockSize * sizeof(float) * 2U);
}
if (nSamples > 0U)
m_txWriter->write(m_txBuffer, nSamples);
}
unsigned int nSamples = m_rxRingBuffer.getData(m_rxBuffer, m_blockSize);
// Create silence on transmit if no sidetone is being transmitted
if (nSamples == 0U && (m_transmit == TXSTATE_INT || m_transmit == TXSTATE_EXT)) {
::memset(m_rxBuffer, 0x00U, m_blockSize * 2U * sizeof(float));
nSamples = m_blockSize;
}
// Only send audio to the external protocol handler when not transmitting
if (m_extHandler != NULL && m_transmit != TXSTATE_EXT)
m_extHandler->writeAudio(m_rxBuffer, nSamples);
if (nSamples != m_blockSize) {
// Copy the last buffer of good data to the output
::memcpy(m_rxBuffer, m_rxLastBuffer, m_blockSize * sizeof(float) * 2U);
m_rxFills++;
} else {
// Save the last full buffer in case it's needed
::memcpy(m_rxLastBuffer, m_rxBuffer, m_blockSize * sizeof(float) * 2U);
}
// Don't record when transmitting
if (m_record != NULL && (m_recordType == RECORD_MONO_AUDIO || m_recordType == RECORD_STEREO_AUDIO) && m_transmit == TXSTATE_RX)
m_record->write(m_rxBuffer, nSamples);
// Scale the audio by the AF Gain setting
for (unsigned int i = 0U; i < (nSamples * 2U); i++)
m_rxBuffer[i] *= m_afGain;
m_rxWriter->write(m_rxBuffer, nSamples);
}
}
m_running = false;
m_rxWriter->disable();
m_txWriter->disable();
wxLogMessage(wxT("DSPControl: RX Overruns=%u, RX Fills=%u"), m_rxOverruns, m_rxFills);
wxLogMessage(wxT("DSPControl: TX Overruns=%u, TX Fills=%u"), m_txOverruns, m_txFills);
closeIO();
return (void*)0;
}
示例12: wxSetEnv
//! @brief Initializes the application.
//!
//! It will open the main window and connect default to server or open the connect window.
bool SpringLobbyApp::OnInit()
{
wxSetEnv(_T("UBUNTU_MENUPROXY"), _T("0"));
//this triggers the Cli Parser amongst other stuff
if (!wxApp::OnInit())
return false;
SetAppName(m_appname);
#if wxUSE_ON_FATAL_EXCEPTION
wxHandleFatalExceptions(!m_crash_handle_disable);
#else
try {
#endif
const wxString m_log_file_path = SlPaths::GetLobbyWriteDir() + "springlobby.log";
//initialize all loggers, we'll use the returned pointer to set correct parent window later
wxLogWindow* loggerwin = Logger::InitializeLoggingTargets(0, m_log_console, m_log_file_path, m_log_window_show, m_log_verbosity);
wxLogMessage(_T("%s started"), TowxString(GetSpringlobbyAgent()).c_str());
//this needs to called _before_ mainwindow instance is created
wxInitAllImageHandlers();
wxFileSystem::AddHandler(new wxZipFSHandler);
wxSocketBase::Initialize();
m_translationhelper = new wxTranslationHelper(GetAppName().Lower(), getLocalePath());
const std::string configdir = SlPaths::GetConfigfileDir();
wxLogMessage("Config dir: %s", configdir.c_str());
SlPaths::mkDir(configdir);
if (cfg().ReadBool(_T("/ResetLayout"))) {
wxLogMessage("Resetting Layout...");
//we do this early on and reset the config var a little later so we can save a def. perps once mw is created
sett().RemoveLayouts();
cfg().Write(_T( "/ResetLayout" ), false);
ui().mw().SavePerspectives(_T("SpringLobby-default"));
}
if (SlPaths::IsPortableMode()) {
// change write path for downloader if in portable mode
fileSystem->setWritePath(SlPaths::GetExecutableFolder());
} else {
// only search if not in portable mode
SlPaths::SetSpringBinary(SlPaths::GetCurrentUsedSpringIndex(), SlPaths::GetSpringBinary());
SlPaths::SetUnitSync(SlPaths::GetCurrentUsedSpringIndex(), SlPaths::GetUnitSync());
}
wxLogMessage("Configuring Unitsync...");
// configure unitsync paths before trying to load
SlPaths::ReconfigureUnitsync();
sett().Setup(m_translationhelper);
notificationManager(); //needs to be initialized too
wxLogMessage("Showing Main Window");
ui().ShowMainWindow();
SetTopWindow(&ui().mw());
ui().mw().SetLogWin(loggerwin);
//unitsync first load, FIXME move to a thread!
wxLogMessage("Refreshing Spring Version List...");
SlPaths::RefreshSpringVersionList();
if (LSL::usync().ReloadUnitSyncLib()) {
GlobalEventManager::Instance()->Send(GlobalEventManager::OnUnitsyncReloaded);
} else {
wxLogWarning("Couldn't load unitsync");
}
wxLogWarning("%s", TowxString(GetSpringlobbyInfo()).c_str());
ui().OnInit();
#if !wxUSE_ON_FATAL_EXCEPTION
}
catch (std::exception& ex)
{
wxLogError(_T("Error had happened: " + wxString(ex.what())));
}
#endif
return true;
}
示例13: wxBeginBusyCursor
//----------------------------------------------------------------------------------------
int DBGrid::OnTableView(wxString Table)
{
wxStopWatch sw;
//---------------------------------------------------------------------------------------
int x,y,z;
wxString Temp0;
wxBeginBusyCursor();
SetDefaultCellFont(* pDoc->ft_Doc);
//---------------------------------------------------------------------------------------
ct_BrowserDB = (db_Br+i_Which)->ct_BrowserDB; // Get the DSN Pointer
//---------------------------------------------------------------------------------------
if (ct_BrowserDB) // Valid pointer (!= NULL) ?
{ // Pointer is Valid, use the wxDatabase Information
for (x=0;x<ct_BrowserDB->numTables;x++) // go through the Tables
{
if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableName,Table)) // is this our Table ?
{ // Yes, the Data of this Table shall be put into the Grid
int ValidTable = x; // Save the Tablenumber
(db_Br+i_Which)->OnSelect(Table,false); // Select * from "table"
// Set the local Pointer to the Column Information we are going to use
(db_Br+i_Which)->cl_BrowserDB = (ct_BrowserDB->pTableInf+x)->pColInf;
if ((ct_BrowserDB->pTableInf+x)->pColInf) // Valid pointer (!= NULL) ?
{ // Pointer is Valid, Column Informationen sind Vorhanden
int i = (db_Br+i_Which)->i_Records; // How many Records are there
(db_Br+i_Which)->i_Which = ValidTable; // Still used ???? mj10777
if (i == 0) // If the Table is empty, then show one empty row
i++;
// wxLogMessage(_("\n-I-> DBGrid::OnTableView() : Vor CreateGrid"));
CreateGrid(i,(ct_BrowserDB->pTableInf+x)->numCols); // Records , Columns
for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++) // Loop through the Fields
{ // The Field / Column name is used here as Row Titel
SetColLabelValue(y,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName);
SetColSize(y,95);
} // for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++)
SetColSize(((ct_BrowserDB->pTableInf+x)->numCols-1),120); // Make the last Column Wider
// The Grid has been created, now fill it
for (z=0;z<(db_Br+i_Which)->i_Records;z++) // Loop through the Records
{
Temp0.Printf(_T("%06d"),z+1); SetRowLabelValue(z,Temp0); // Set Row Lable Value
(db_Br+i_Which)->OnGetNext((ct_BrowserDB->pTableInf+ValidTable)->numCols,false);
for (y=0;y<(ct_BrowserDB->pTableInf+ValidTable)->numCols;y++) // Loop through the Fields
{ // BrowserDB::OnGetNext Formats the field Value into tablename
SetCellValue(z, y,((db_Br+i_Which)->cl_BrowserDB+y)->tableName);
}
#if wxUSE_STATUSBAR
if (z % 50 == 0)
{
Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - Record %6d (from %d) has been read."),Table.c_str(),z,(db_Br+i_Which)->i_Records);
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
}
#endif // wxUSE_STATUSBAR
} // for (z=0;z<(db_Br+i_Which)->i_Records;z++)
Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - %6d Records have been read. - Time needed : %ld ms"),Table.c_str(),z,sw.Time());
wxLogMessage(Temp0);
#if wxUSE_STATUSBAR
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
#endif // wxUSE_STATUSBAR
// The Grid has been filled, now leave
goto Weiter;
} // if ((ct_BrowserDB->pTableInf+x)->pColInf)
else
wxLogMessage(_("\n-E-> DBGrid::OnTableView() : Invalid Column Pointer : Failed"));
} // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE")
} // for (x=0;x<ct_BrowserDB->numTables;x++)
} // if (ct_BrowserDB)
else
wxLogMessage(_("\n-E-> DBGrid::OnTableView() : Invalid DSN Pointer : Failed"));
//---------------------------------------------------------------------------------------
Weiter:
EnableEditing(b_EditModus); // Deactivate in-place Editing
wxEndBusyCursor();
//---------------------------------------------------------------------------------------
wxLogMessage(_("-I-> DBGrid::OnTableView() - End"));
return 0;
}
示例14: wxGetLocalTime
int IfaceCheckApp::OnRun()
{
long startTime = wxGetLocalTime(); // for timing purpose
wxCmdLineParser parser(g_cmdLineDesc, argc, argv);
parser.SetLogo(
wxString::Format("wxWidgets Interface checker utility (built %s against %s)",
__DATE__, wxVERSION_STRING));
// make the output more readable:
wxLog::SetActiveTarget(new IfaceCheckLog);
wxLog::DisableTimestamp();
// parse the command line...
bool ok = true;
wxString preprocFile;
switch (parser.Parse())
{
case 0:
if (parser.Found(VERBOSE_SWITCH))
g_verbose = true;
// IMPORTANT: parsing #define values must be done _before_ actually
// parsing the GCC/doxygen XML files
if (parser.Found(USE_PREPROCESSOR_OPTION, &preprocFile))
{
if (!ParsePreprocessorOutput(preprocFile))
return 1;
}
// in any case set basic std preprocessor #defines:
m_doxyInterface.AddPreprocessorValue("NULL", "0");
// parse the two XML files which contain the real and the doxygen interfaces
// for wxWidgets API:
if (!m_gccInterface.Parse(parser.GetParam(0)) ||
!m_doxyInterface.Parse(parser.GetParam(1)))
return 1;
if (parser.Found(DUMP_SWITCH))
{
wxLogMessage("Dumping real API to '%s'...", API_DUMP_FILE);
m_gccInterface.Dump(API_DUMP_FILE);
wxLogMessage("Dumping interface API to '%s'...", INTERFACE_DUMP_FILE);
m_doxyInterface.Dump(INTERFACE_DUMP_FILE);
}
else
{
if (parser.Found(MODIFY_SWITCH))
m_modify = true;
if (parser.Found(PROCESS_ONLY_OPTION, &m_strToMatch))
{
size_t len = m_strToMatch.Len();
if (m_strToMatch.StartsWith("\"") &&
m_strToMatch.EndsWith("\"") &&
len > 2)
m_strToMatch = m_strToMatch.Mid(1, len-2);
}
ok = Compare();
}
PrintStatistics(wxGetLocalTime() - startTime);
return ok ? 0 : 1;
default:
wxPrintf("\nThis utility checks that the interface XML files created by Doxygen are in\n");
wxPrintf("synch with the real headers (whose contents are extracted by the gcc XML file).\n\n");
wxPrintf("The 'gccXML' parameter should be the wxapi.xml file created by the 'rungccxml.sh'\n");
wxPrintf("script which resides in 'utils/ifacecheck'.\n");
wxPrintf("The 'doxygenXML' parameter should be the index.xml file created by Doxygen\n");
wxPrintf("for the wxWidgets 'interface' folder.\n\n");
wxPrintf("Since the gcc XML file does not contain info about #defines, if you use\n");
wxPrintf("the -%s option, you'll get a smaller number of false warnings.\n",
USE_PREPROCESSOR_OPTION);
// HELP_SWITCH was passed or a syntax error occurred
return 0;
}
}
示例15: wxLogMessage
bool IfaceCheckApp::Compare()
{
const wxClassArray& interfaces = m_doxyInterface.GetClasses();
const wxClass* c;
int mcount = 0, ccount = 0;
wxLogMessage("Comparing the interface API to the real API (%d classes to compare)...",
interfaces.GetCount());
if (!m_strToMatch.IsEmpty())
{
wxLogMessage("Processing only header files matching '%s' expression.", m_strToMatch);
}
#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 (unsigned int i=0; i<interfaces.GetCount(); i++)
{
// only compare the methods which are available for the port
// for which the gcc XML was produced
if (interfaces[i].GetAvailability() != wxPORT_UNKNOWN &&
(interfaces[i].GetAvailability() & m_gccInterface.GetInterfacePort()) == 0) {
if (g_verbose)
{
wxLogMessage("skipping class '%s' since it's not available for the %s port.",
interfaces[i].GetName(), m_gccInterface.GetInterfacePortName());
}
continue; // skip this method
}
// shorten the name of the header so the log file is more readable
// and also for calling IsToProcess() against it
wxString header = wxFileName(interfaces[i].GetHeader()).GetFullName();
if (!IsToProcess(header))
continue; // skip this one
wxString cname = interfaces[i].GetName();
// search in the real headers for i-th interface class; we search for
// both class cname and cnameBase since in wxWidgets world tipically
// class cname is platform-specific while the real public interface of
// that class is part of the cnameBase class.
/*c = m_gccInterface.FindClass(cname + "Base");
if (c) api.Add(c);*/
c = m_gccInterface.FindClass(cname);
if (!c)
{
// sometimes the platform-specific class is named "wxGeneric" + cname
// or similar:
c = m_gccInterface.FindClass("wxGeneric" + cname.Mid(2));
if (!c)
{
c = m_gccInterface.FindClass("wxGtk" + cname.Mid(2));
}
}
if (c) {
// there is a class with the same (logic) name!
mcount += CompareClasses(&interfaces[i], c);
} else {
wxLogMessage("%s: couldn't find the real interface for the '%s' class",
header, cname);
ccount++;
}
}
wxLogMessage("%d on a total of %d methods (%.1f%%) of the interface headers do not exist in the real headers",
mcount, m_doxyInterface.GetMethodCount(), (float)(100.0 * mcount/m_doxyInterface.GetMethodCount()));
wxLogMessage("%d on a total of %d classes (%.1f%%) of the interface headers do not exist in the real headers",
ccount, m_doxyInterface.GetClassesCount(), (float)(100.0 * ccount/m_doxyInterface.GetClassesCount()));
return true;
}