Ejemplo n.º 1
0
bool CGMSKModemWinUSB::open()
{
	wxASSERT(m_handle == INVALID_HANDLE_VALUE);

	bool res = openModem();
	if (!res) {
		wxLogError(wxT("Cannot find the GMSK Modem with address: 0x%04X"), m_address);
		return false;
	}

	wxLogInfo(wxT("Found the GMSK Modem with address: 0x%04X"), m_address);

	wxString version;

	int ret;
	do {
		unsigned char buffer[GMSK_MODEM_DATA_LENGTH];
		ret = io(GET_VERSION, 0xC0U, 0U, buffer, GMSK_MODEM_DATA_LENGTH);
		if (ret > 0) {
			wxString text((char*)buffer, wxConvLocal, ret);
			version.Append(text);
		} else if (ret < 0) {
			wxLogError(wxT("GET_VERSION returned %d"), -ret);
			close();
			return false;
		}
	} while (ret == int(GMSK_MODEM_DATA_LENGTH));

	wxLogInfo(wxT("Firmware version: %s"), version.c_str());

	// Trap firmware version 0.1.00 of DUTCH*Star and complain loudly
	if (version.Find(wxT("DUTCH*Star")) != wxNOT_FOUND && version.Find(wxT("0.1.00")) != wxNOT_FOUND) {
		wxLogWarning(wxT("This modem firmware is not supported by the repeater"));
		wxLogWarning(wxT("Please upgrade to a newer version"));
		close();
		return false;
	}

	// DUTCH*Star firmware has a broken concept of free space
	if (version.Find(wxT("DUTCH*Star")) != wxNOT_FOUND)
		m_brokenSpace = true;

	return true;
}
Ejemplo n.º 2
0
void processManager::LogOutput(bool &hasOutput, const wxString &label,float *outputProgression)
{
    hasOutput = false;

    if ( IsInputAvailable() )
    {
        wxTextInputStream tis(*GetInputStream());

        // this assumes that the output is always line buffered
        wxString msg;
        wxString output= tis.ReadLine();
        if(!this->outlogs.empty())
        {
            for(std::vector<smart_ptr<InterfLogger> >::iterator itlogs=this->outlogs.begin(); itlogs!=this->outlogs.end(); itlogs++)
            {
                (*(*itlogs)).LogMessage(output);
            }
        }
        if(outputProgression==NULL || output.Left(1)!="#")
        {
            msg << label << output;
            msg.Replace("%","%%"); //si il y a un seul % alors un bug apparait wxString attend un format du type %s ou %i par exemple
            if(output.Left(1)=="!")
            {
                wxLogWarning(msg);
            } else {
                wxLogMessage(msg);
            }
        } else {
            wxString prog=output.Right(output.Len()-1).Strip();
            *outputProgression=Convertor::ToFloat(prog);
        }

        hasOutput = true;
    }

    while ( IsErrorAvailable() )
    {
        wxTextInputStream tis(*GetErrorStream());
        const wxString& errMsg(tis.ReadLine());
        if(!this->outlogs.empty())
        {
            for(std::vector<smart_ptr<InterfLogger> >::iterator itlogs=this->outlogs.begin(); itlogs!=this->outlogs.end(); itlogs++)
            {
                (*(*itlogs)).LogError(errMsg);
            }
        }
        // this assumes that the output is always line buffered
        wxString msg;
        msg << _("Erreur exécutable :") << errMsg;
        msg.Replace("%","%%"); //si il y a un seul % alors un bug apparait wxString attend un format du type %s ou %i par exemple
        wxLogError(msg);

        hasOutput = true;
    }
}
Ejemplo n.º 3
0
bool IBattle::LoadOptionsPreset( const std::string& name )
{
	const std::string preset = FixPresetName(name);
	if (preset.empty()) return false; //preset not found
	m_preset = preset;

	for ( unsigned int i = 0; i < LSL::OptionsWrapper::LastOption; i++) {
		std::map<wxString,wxString> options = sett().GetHostingPreset( TowxString(m_preset), i );
		if ( (LSL::OptionsWrapper::GameOption)i != LSL::OptionsWrapper::PrivateOptions ) {
			for ( std::map<wxString,wxString>::const_iterator itor = options.begin(); itor != options.end(); ++itor ) {
				wxLogWarning( itor->first + _T(" ::: ") + itor->second );
				CustomBattleOptions().setSingleOption( STD_STRING(itor->first),
								       STD_STRING(itor->second),
								       (LSL::OptionsWrapper::GameOption)i );
			}
		} else {
			if ( !options[_T("mapname")].IsEmpty() ) {
				if (LSL::usync().MapExists(STD_STRING(options[_T("mapname")]))) {
					SetLocalMap( STD_STRING(options[_T("mapname")]) );
					SendHostInfo( HI_Map );
				} else if ( !ui().OnPresetRequiringMap( options[_T("mapname")] ) ) {
					//user didn't want to download the missing map, so set to empty to not have it tried to be loaded again
					options[_T("mapname")] = wxEmptyString;
					sett().SetHostingPreset( TowxString(m_preset), i, options );
				}
			}

			for( unsigned int j = 0; j <= GetLastRectIdx(); ++j ) {
				if ( GetStartRect( j ).IsOk() )
					RemoveStartRect(j); // remove all rects that might come from map presets
			}
			SendHostInfo( IBattle::HI_StartRects );

			unsigned int rectcount = s2l( options[_T("numrects")] );
			for ( unsigned int loadrect = 0; loadrect < rectcount; loadrect++) {
				int ally = s2l(options[_T("rect_") + TowxString(loadrect) + _T("_ally")]);
				if ( ally == 0 ) continue;
				AddStartRect( ally - 1, s2l(options[_T("rect_") + TowxString(loadrect) + _T("_left")]), s2l(options[_T("rect_") + TowxString(loadrect) + _T("_top")]), s2l(options[_T("rect_") + TowxString(loadrect) + _T("_right")]), s2l(options[_T("rect_") + TowxString(loadrect) + _T("_bottom")]) );
			}
			SendHostInfo( HI_StartRects );

			wxStringTokenizer tkr( options[_T("restrictions")], _T('\t') );
			m_restricted_units.clear();
			while( tkr.HasMoreTokens() ) {
				wxString unitinfo = tkr.GetNextToken();
				RestrictUnit( STD_STRING(unitinfo.BeforeLast(_T('='))), s2l( unitinfo.AfterLast(_T('=')) ) );
			}
			SendHostInfo( HI_Restrictions );
			Update( wxFormat( _T("%d_restrictions") ) % LSL::OptionsWrapper::PrivateOptions );

		}
	}
	SendHostInfo( HI_Send_All_opts );
	ui().ReloadPresetList();
	return true;
}
Ejemplo n.º 4
0
bool CMMDVMController::writeHeader(const CHeaderData& header)
{
	bool ret = m_txData.hasSpace(46U);
	if (!ret) {
		wxLogWarning(wxT("No space to write the header"));
		return false;
	}

	unsigned char buffer[50U];

	buffer[0U] = MMDVM_FRAME_START;
	buffer[1U] = RADIO_HEADER_LENGTH_BYTES + 3U;
	buffer[2U] = MMDVM_DSTAR_HEADER;

	::memset(buffer + 3U, ' ', RADIO_HEADER_LENGTH_BYTES);

	buffer[3U] = header.getFlag1();
	buffer[4U] = header.getFlag2();
	buffer[5U] = header.getFlag3();

	wxString rpt2 = header.getRptCall2();
	for (unsigned int i = 0U; i < rpt2.Len() && i < LONG_CALLSIGN_LENGTH; i++)
		buffer[i + 6U]  = rpt2.GetChar(i);

	wxString rpt1 = header.getRptCall1();
	for (unsigned int i = 0U; i < rpt1.Len() && i < LONG_CALLSIGN_LENGTH; i++)
		buffer[i + 14U] = rpt1.GetChar(i);

	wxString your = header.getYourCall();
	for (unsigned int i = 0U; i < your.Len() && i < LONG_CALLSIGN_LENGTH; i++)
		buffer[i + 22U] = your.GetChar(i);

	wxString my1 = header.getMyCall1();
	for (unsigned int i = 0U; i < my1.Len() && i < LONG_CALLSIGN_LENGTH; i++)
		buffer[i + 30U] = my1.GetChar(i);

	wxString my2 = header.getMyCall2();
	for (unsigned int i = 0U; i < my2.Len() && i < SHORT_CALLSIGN_LENGTH; i++)
		buffer[i + 38U] = my2.GetChar(i);

	CCCITTChecksumReverse cksum1;
	cksum1.update(buffer + 3U, RADIO_HEADER_LENGTH_BYTES - 2U);
	cksum1.result(buffer + 42U);

	wxMutexLocker locker(m_mutex);

	unsigned char type = DSMTT_HEADER;
	m_txData.addData(&type, 1U);

	unsigned char len = RADIO_HEADER_LENGTH_BYTES + 3U;
	m_txData.addData(&len, 1U);

	m_txData.addData(buffer, RADIO_HEADER_LENGTH_BYTES + 3U);

	return true;
}
Ejemplo n.º 5
0
void ConfigEntry::SetLine(LineList *pLine)
{
  if ( m_pLine != NULL ) {
    wxLogWarning(_("entry '%s' appears more than once in group '%s'"),
                 Name().c_str(), m_pParent->GetFullName().c_str());
  }

  m_pLine = pLine;
  Group()->SetLastEntry(this);
}
Ejemplo n.º 6
0
void MyFrame::OnAuiDemoToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
{
#if wxUSE_AUI
    wxDialog dlg;
    wxXmlResource::Get()->LoadDialog(&dlg, this, wxS("aui_dialog"));
    dlg.ShowModal();
#else
    wxLogWarning("wxUSE_AUI must be set to 1 in 'setup.h' to view the AUI demo.");
#endif
}
Ejemplo n.º 7
0
wxBitmap& IconsCollection::GetFractionBmp(const std::string& gameName, size_t fractionId)
{

	if (gameName.empty() || !LSL::usync().GameExists(gameName)) {
		wxLogWarning("SideIcon %zu for game %s not found!", fractionId, gameName.c_str());
		// game doesn't exist, dl needed?!
		return BMP_EMPTY;
	}

	const auto sides = LSL::usync().GetSides(gameName);

	//This can happen whenever in time, so must be caught in release build too
	if (sides.empty()) {
		wxLogWarning("IconsCollection::GetFractionBmp(): sides.empty()");
		return BMP_EMPTY;
	}

	if (fractionId >= sides.size()) {
		wxLogWarning("Invalid side requested: %s:%d", gameName.c_str(), fractionId);
		return BMP_EMPTY;
	}

	std::string sideName;

	sideName = sides[fractionId];

	const std::string cacheString = gameName + "_" + sideName;

	//Check if image already in cache
	if (m_cachedFractionBmps.find(cacheString) != m_cachedFractionBmps.end()) {
		return m_cachedFractionBmps[cacheString];
		//Create one and add to cache
	} else {
		try {
			const LSL::UnitsyncImage img = LSL::usync().GetSidePicture(gameName, sideName);
			m_cachedFractionBmps[cacheString] = img.wxbitmap();
		} catch (...) {
			//unitsync can fail!
			ASSERT_LOGIC(false, "LSL::usync().GetSidePicture() failed!");
		}
		return m_cachedFractionBmps[cacheString];
	}
}
Ejemplo n.º 8
0
bool ChatLog::CreateCurrentLogFolder()
{
	const wxString path = wxFileName(GetCurrentLogfilePath()).GetPath();
	if (!wxFileName::Mkdir(path, 0755, wxPATH_MKDIR_FULL)) {
		wxLogWarning(_T( "can't create logging folder: %s" ), path.c_str());
		m_active = false;
		return false;
	}
	return true;
}
Ejemplo n.º 9
0
void NickListCtrl::RemoveUser(const User& user)
{
	const auto it = m_real_users_list.find(user.GetNick());
	if (it == m_real_users_list.end()) {
		wxLogWarning(_T( "Didn't find the user to remove." ));
		return;
	}
	m_real_users_list.erase(it);
	RemoveItem(&user);
}
Ejemplo n.º 10
0
void BattleRoomTab::OnHostNew(wxCommandEvent& /*event*/)
{
	if (!ui().IsConnected()) {
		wxLogWarning(_T( "Trying to host while offline" ));
		customMessageBoxNoModal(SL_MAIN_ICON, _("You cannot host a game while being offline. Please connect to a lobby server."), _("Not Online."), wxOK);
		ui().ShowConnectWindow();
		return;
	}
	SL::RunHostBattleDialog(this);
}
Ejemplo n.º 11
0
void Sequence::HandleXMLEndTag(const wxChar *tag)
{
   if (wxStrcmp(tag, wxT("sequence")) != 0)
      return;

   // Make sure that the sequence is valid
   // First, replace missing blockfiles with SilentBlockFiles
   unsigned int b;
   for (b = 0; b < mBlock->Count(); b++) {
      if (!mBlock->Item(b)->f) {
         sampleCount len;

         if (b < mBlock->Count()-1)
            len = mBlock->Item(b+1)->start - mBlock->Item(b)->start;
         else
            len = mNumSamples - mBlock->Item(b)->start;

         if (len > mMaxSamples) 
         	// This could be why the blockfile failed, so limit 
         	// the silent replacement to mMaxSamples.
            len = mMaxSamples;
         mBlock->Item(b)->f = new SilentBlockFile(len);
         wxLogWarning(_("Gap detected in project file\n"));
         mErrorOpening = true;
      }
   }

   // Next, make sure that start times and lengths are consistent
   sampleCount numSamples = 0;
   for (b = 0; b < mBlock->Count(); b++) {
      if (mBlock->Item(b)->start != numSamples) {
         mBlock->Item(b)->start = numSamples;
         wxLogWarning(_("Gap detected in project file\n"));
         mErrorOpening = true;         
      }
      numSamples += mBlock->Item(b)->f->GetLength();
   }
   if (mNumSamples != numSamples) {
      mNumSamples = numSamples;
      wxLogWarning(_("Gap detected in project file\n"));
      mErrorOpening = true;
   }
}
Ejemplo n.º 12
0
void NickListCtrl::UserUpdated(const User& user)
{
	const auto it = m_real_users_list.find(user.GetNick());
	if (it == m_real_users_list.end()) {
		wxLogWarning(_T( "NickListCtrl::UserUpdated error, index == -1 ." ));
		return;
	}
	it->second = &user;
	DoUsersFilter();
}
Ejemplo n.º 13
0
void CONTEXT_MENU::Add( const wxString& aLabel, int aId )
{
#ifdef DEBUG

    if( m_menu.FindItem( aId ) != NULL )
        wxLogWarning( wxT( "Adding more than one menu entry with the same ID may result in"
                "undefined behaviour" ) );
#endif
    m_menu.Append( new wxMenuItem( &m_menu, aId, aLabel, wxEmptyString, wxITEM_NORMAL ) );
}
Ejemplo n.º 14
0
void ServerEvents::OnBattleInfoUpdated(int battleid)
{
	slLogDebugFunc("");
	try {
		IBattle& battle = m_serv.GetBattle(battleid);
		ui().OnBattleInfoUpdated(battle, wxEmptyString);
	} catch (assert_exception) {
		wxLogWarning("Exception in OnBattleInfoUpdated(%d)", battleid);
	}
}
Ejemplo n.º 15
0
void BattleroomListCtrl::AddUser( User& user )
{
	//first time setting is necessary to have color in replay/savegame used controls
	if ( !user.BattleStatus().spectator )
		icons().SetColourIcon( user.BattleStatus().colour );
    if ( AddItem( &user ) )
        return;

    wxLogWarning( _T("user already in battleroom list.") );
}
Ejemplo n.º 16
0
bool MyFrame::CheckNonVirtual() const
{
    if ( !m_listCtrl->HasFlag(wxLC_VIRTUAL) )
        return true;

    // "this" == whatever
    wxLogWarning(_T("Can't do this in virtual view, sorry."));

    return false;
}
Ejemplo n.º 17
0
void NickListCtrl::AddUser(const User& user)
{
	const auto it = m_real_users_list.find(user.GetNick());
	if (it != m_real_users_list.end()) {
		wxLogWarning(_T( "User already in list." ));
		return;
	}
	m_real_users_list[user.GetNick()] = &user;
	DoUsersFilter();
}
Ejemplo n.º 18
0
off_t wxUtfFile::Read(wxString &str, off_t nCount)
{
	if (nCount == (off_t) - 1)
		nCount = Length() - Tell();
	if (!nCount)
		return 0;

	char *buffer = new char[nCount + 4];
	// on some systems, len returned from wxFile::read might not reflect the number of bytes written
	// to the buffer, but the bytes read from file. In case of CR/LF translation, this is not the same.
	memset(buffer, 0, nCount + 4);
	off_t len = wxFile::Read(buffer, nCount);

	if (len >= 0)
	{
		memset(buffer + len, 0, 4);

		if (m_conversion)
		{
			int decr;
			size_t nLen = 0;


			// We are trying 4 times to convert, in case the last utf char
			// was truncated.
			for (decr = 0 ; len > 0 && decr < 4 ; decr++)
			{
				nLen = m_conversion->MB2WC(NULL, buffer, 0);
				if ( nLen != (size_t) - 1 )
					break;
				len--;
				buffer[len] = 0;
			}

			if (nLen == (size_t) - 1)
			{
				if (!m_strFileName.IsEmpty())
				{
					wxLogWarning(_("The file \"%s\" could not be opened because it contains characters that could not be interpreted."), m_strFileName.c_str());
				}
				Seek(decr - nLen, wxFromCurrent);
				return (size_t) - 1;
			}
			if (decr)
				Seek(-decr, wxFromCurrent);

			m_conversion->MB2WC((wchar_t *)(wxChar *)wxStringBuffer(str, nLen + 1), (const char *)buffer, (size_t)(nLen + 1));
		}
		else
			str = (wxChar *)buffer;
	}

	delete[] buffer;
	return len;
}
Ejemplo n.º 19
0
wxFSFile* wxChmFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs),
                                   const wxString& location)
{
    wxString right = GetRightLocation(location);
    wxString left = GetLeftLocation(location);

    wxInputStream *s;

    int index;

    if ( GetProtocol(left) != wxT("file") )
    {
        wxLogError(_("CHM handler currently supports only local files!"));
        return NULL;
    }

    // Work around javascript
    wxString tmp = wxString(right);
    if ( tmp.MakeLower().Contains(wxT("javascipt")) && tmp.Contains(wxT("\'")) )
    {
        right = right.AfterFirst(wxT('\'')).BeforeLast(wxT('\''));
    }

    // now work on the right location
    if (right.Contains(wxT("..")))
    {
        wxFileName abs(right);
        abs.MakeAbsolute(wxT("/"));
        right = abs.GetFullPath();
    }

    // a workaround for absolute links to root
    if ( (index=right.Index(wxT("//"))) != wxNOT_FOUND )
    {
        right=wxString(right.Mid(index+1));
        wxLogWarning(_("Link contained '//', converted to absolute link."));
    }

    wxFileName leftFilename = wxFileSystem::URLToFileName(left);

    // Open a stream to read the content of the chm-file
    s = new wxChmInputStream(leftFilename.GetFullPath(), right, true);

    if ( s )
    {
        return new wxFSFile(s,
                            left + wxT("#chm:") + right,
                            wxEmptyString,
                            GetAnchor(location),
                            wxDateTime(wxFileModificationTime(left)));
    }

    delete s;
    return NULL;
}
Ejemplo n.º 20
0
void LoadModule(wxString fname)
{
   wxLogDebug(wxT("About to load module %s"), fname.c_str());
   tModuleInit mainFn = NULL;
#if defined(__WXMAC__)
   wxLogNull logNo;
#endif

   // As a courtesy to some modules that might be bridges to
   // open other modules, we set the current working
   // directory to be the module's directory.

   wxString saveOldCWD = ::wxGetCwd();
   wxString prefix = ::wxPathOnly(fname);
   ::wxSetWorkingDirectory(prefix);

   wxDynamicLibrary* pDLL = new wxDynamicLibrary();
   if (pDLL && pDLL->Load(fname, wxDL_LAZY)) 
   {
      int result = 1;
      mainFn   = (tModuleInit)(pDLL->GetSymbol(wxT(initFnName)));

      if (mainFn) 
         result = mainFn( 0 );

      // If the module provides a version string, check that it matches the
      // Audacity version string. (For now, they must match exactly)
      // For compatibility reasons, if no version string is provided we try to
      // load the module anyway.
      tVersionFn versionFn = (tVersionFn)(pDLL->GetSymbol(wxT(versionFnName)));
      if (versionFn)
      {
         wxString moduleVersion = versionFn();
         if (!moduleVersion.IsSameAs(AUDACITY_VERSION_STRING))
         {
            wxLogError(wxT("The module %s is designed to work with Audacity version %s; it will not be loaded."), fname.c_str(), moduleVersion.c_str());
            delete pDLL;
            return;
         }
      }
      else
      {
         wxLogWarning(wxT("The module %s does not provide a version string. Attempting to load it anyway."), fname.c_str());
      }

      if(( scriptFn == NULL ) &&(result>=0 ))
         scriptFn = (tpRegScriptServerFunc)(pDLL->GetSymbol(wxT(scriptFnName)));

      if((pPanelHijack==NULL ) && (result>=0))
         pPanelHijack = (tPanelFn)(pDLL->GetSymbol(wxT(mainPanelFnName)));
   }

   ::wxSetWorkingDirectory(saveOldCWD);
}
Ejemplo n.º 21
0
void MyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
    wxString url = link.GetHref();
    if ( url.StartsWith(wxT("http:")) || url.StartsWith(wxT("mailto:")) ) 
    {
        // pass http/mailto URL to user's preferred browser/emailer
#ifdef __WXMAC__
        // wxLaunchDefaultBrowser doesn't work on Mac with IE
        // but it's easier just to use the Mac OS X open command
        if ( wxExecute(wxT("open ") + url, wxEXEC_ASYNC) == -1 )
            wxLogWarning(wxT("Could not open URL!"));
#else
        if ( !wxLaunchDefaultBrowser(url) )
            wxLogWarning(wxT("Could not launch browser!"));
#endif
    } 
    else 
    {
        LoadPage(url);
    }
}
Ejemplo n.º 22
0
std::vector<wxString> tokenize(const wxString &text) {
	std::vector<wxString> paramList;
	paramList.reserve(6);

	if (text.empty()) {
		return paramList;
	}
	if (text[0] != '(') {
		// There's just one parameter (because there's no parentheses)
		// This means text is all our parameters
		wxString param(text);
		paramList.push_back(param.Trim(true).Trim(false));
		return paramList;
	}

	// Ok, so there are parentheses used here, so there may be more than one parameter
	// Enter fullscale parsing!
	size_t i = 0, textlen = text.size();
	size_t start = 0;
	int parDepth = 1;
	while (i < textlen && parDepth > 0) {
		// Just skip until next ',' or ')', whichever comes first
		// (Next ')' is achieved when parDepth == 0)
		start = ++i;
		while (i < textlen && parDepth > 0) {
			wxChar c = text[i];
			// parDepth 1 is where we start, and the tag-level we're interested in parsing on
			if (c == ',' && parDepth == 1) break;
			if (c == '(') parDepth++;
			else if (c == ')') {
				parDepth--;
				if (parDepth < 0) {
					wxLogWarning("Unmatched parenthesis near '%s'!\nTag-parsing incomplete.", text.SubString(i, 10));
					return paramList;
				}
				else if (parDepth == 0) {
					// We just ate the parenthesis ending this parameter block
					// Make sure it doesn't get included in the parameter text
					break;
				}
			}
			i++;
		}
		// i now points to the first character not member of this parameter
		paramList.push_back(text.SubString(start, i-1).Trim(true).Trim(false));
	}

	if (i+1 < textlen) {
		// There's some additional garbage after the parentheses
		// Just add it in for completeness
		paramList.push_back(text.Mid(i+1));
	}
	return paramList;
}
Ejemplo n.º 23
0
// Madcat - Sets Fast ED2K Links Handler on/off.
void CamuleDlg::ShowED2KLinksHandler( bool show )
{
	// Errorchecking in case the pointer becomes invalid ...
	if (s_fed2klh == NULL) {
		wxLogWarning(wxT("Unable to find Fast ED2K Links handler sizer! Hiding FED2KLH aborted."));
		return;
	}

	s_dlgcnt->Show( s_fed2klh, show );
	s_dlgcnt->Layout();
}
Ejemplo n.º 24
0
void Task::OnStatusChanged(const wxString& status)
{
	if (endCalled)
	{
		wxLogWarning(_("OnStatusChanged should not be called after the task ends!"));
		return;
	}
	
	TaskStatusEvent event(this, status);
	m_evtHandler->AddPendingEvent(event);
}
Ejemplo n.º 25
0
void ServerEvents::OnBattleClosed(int battleid)
{
	slLogDebugFunc("");
	if (!m_serv.BattleExists(battleid)) {
		wxLogWarning("Tried to close non-existing battle %d", battleid);
		return;
	}
	IBattle& battle = m_serv.GetBattle(battleid);
	ui().OnBattleClosed(battle);
	m_serv._RemoveBattle(battleid);
}
Ejemplo n.º 26
0
void Task::OnProgressChanged(const int& progress)
{
	if (endCalled)
	{
		wxLogWarning(_("OnProgressChanged should not be called after the task ends!"));
		return;
	}
	
	TaskProgressEvent event(this, progress);
	m_evtHandler->AddPendingEvent(event);
}
Ejemplo n.º 27
0
void szAppImpl::InitializeLocale(wxArrayString &catalogs, wxLocale &locale) {

	wxString lang = wxConfig::Get()->Read(_T("LANGUAGE"), AUTO_LANGUAGE);
	if (lang == AUTO_LANGUAGE)
		lang = DEFAULT_LANGUAGE;

	const wxLanguageInfo *info = wxLocale::FindLanguageInfo(lang);

	int l;

	if (info)
	{
		l = info->Language;
	} else
		l = wxLANGUAGE_ENGLISH;

	locale.Init(l);

	if (!locale.IsOk()) {
		if(locale.IsAvailable(locale.GetSystemLanguage())) {
			l = locale.GetSystemLanguage();
			locale.Init(l);
			if(!locale.IsOk()) {
				wxMessageBox(_("Default locale cannot be loaded. Exiting"), _("Information."), wxICON_ERROR);
				exit(1);
			}
			wxString Ls = L"Locale " + lang + L" not available.\nDefault system locale loaded.";
			wxMessageBox(_(s), _("Information."), wxICON_INFORMATION);
		}
		else {
			wxLogWarning(_("No locale for this system`s language."));
		}
	}

	locale.AddCatalogLookupPathPrefix(GetSzarpDir() + _T("resources/locales"));

	for(size_t i = 0; i < catalogs.Count(); i++)
		locale.AddCatalog(catalogs[i]);

#ifdef __WXGTK__
	if (!locale.IsOk()) {
		wxLogInfo(_("Setting locale to \"C\""));
		setenv("LC_ALL", "C", 1);
	} else if( locale.GetSystemEncodingName() == _("") ) { // this probably doesn't happen on unix machines 
		wxLogInfo(_("wx: Setting locale to \"") + locale.GetCanonicalName() + _("\""));
		setenv("LC_ALL", SC::S2A(locale.GetCanonicalName()).c_str(), 1);
	} else {
		wxString localename = locale.GetCanonicalName() + _(".") + locale.GetSystemEncodingName();
		wxLogInfo(_("wx: Setting locale to \"") + localename + _("\""));
		setenv("LC_ALL", SC::S2A(localename).c_str(), 1);
	}
#endif

}
Ejemplo n.º 28
0
bool SystemCmdSound::Load(const char* path, int deviceIndex)
{
    m_path = path;
#ifdef _DEBUG
    if (deviceIndex != -1) {
        wxLogWarning("Selecting device is not supported by SystemCmdSound");
    }
#endif /* _DEBUG */
    m_OK = wxFileExists(m_path);
    return m_OK;
}
Ejemplo n.º 29
0
void MyPipeFrame::OnProcessTerm(wxProcessEvent& WXUNUSED(event))
{
	DoGet();

	wxDELETE(m_process);

	wxLogWarning(wxT("The other process has terminated, closing"));

	DisableInput();
	DisableOutput();
}
Ejemplo n.º 30
0
void MyFrame::OnUnloadResourceMenuCommand(wxCommandEvent& WXUNUSED(event))
{
    if ( wxXmlResource::Get()->Unload(wxT("rc/basicdlg.xrc")) )
    {
        wxLogMessage(wxT("Basic dialog resource has now been unloaded, you ")
                     wxT("won't be able to use it before loading it again"));
    }
    else
    {
        wxLogWarning(wxT("Failed to unload basic dialog resource"));
    }
}