Ejemplo n.º 1
0
bool CBasicCommandInvoker::invoke(const wxString& text)
{
    if (text.StartsWith(CBasicCommandInvoker::JOIN)) {
        wxString channle = text;
        wxString argument = channle.Remove(0,
                                           CBasicCommandInvoker::JOIN.size());
        m_service->joinChannel(argument);
        return true;
    } else if (text.StartsWith(CBasicCommandInvoker::TOPIC)) {
        wxString channle = text;
        wxString argument = channle.Remove(0,
                                           CBasicCommandInvoker::TOPIC.size());
        m_service->onChangeTopic(argument);
        return true;
    } else if (text.StartsWith(CBasicCommandInvoker::NICK)) {
        wxString channle = text;
        wxString argument = channle.Remove(0,
                                           CBasicCommandInvoker::NICK.size());
        m_service->onNickChange(argument);
        return true;
    } else if (text.StartsWith(CBasicCommandInvoker::PART)) {
        wxString argument = m_service->getCurrentChannel();
        m_service->partChannel(argument);
        return true;
    }
    return false;
}
Ejemplo n.º 2
0
void CamuleDlg::Add_Skin_Icon(
	const wxString &iconName,
	const wxBitmap &stdIcon,
	bool useSkins)
{
	wxImage new_image;
	if (useSkins) {
		wxFFileInputStream in(m_skinFileName.GetFullPath());
		wxZipInputStream zip(in);

		ZipCatalog::iterator it = cat.find(wxZipEntry::GetInternalName(iconName + wxT(".png")));
		if ( it != cat.end() ) {
			zip.OpenEntry(*it->second);
			if ( !new_image.LoadFile(zip,wxBITMAP_TYPE_PNG) ) {
				AddLogLineN(wxT("Warning: Error loading icon for ") +
						iconName);
				useSkins = false;
			}
		}else {
				AddLogLineN(wxT("Warning: Can't load icon for ") +
						iconName);
				useSkins = false;
		}

	}

	wxBitmap bmp(useSkins ? new_image : stdIcon);
	if (iconName.StartsWith(wxT("Client_"))) {
		m_imagelist.Add(bmp);
	} else if (iconName.StartsWith(wxT("Toolbar_"))) {
		m_tblist.Add(bmp);
	}
}
Ejemplo n.º 3
0
bool SjKaraokeMaster::Init(const wxString& musicFile, const wxString& artist, const wxString& title)
{
	wxFSFile* fsFile;

	// exit old stuff
	Exit();

	if( musicFile.StartsWith(wxT("http:")) // this may be a steam - in this case (or in others) we get into an endless loop
	 || musicFile.StartsWith(wxT("https:"))
	 || musicFile.StartsWith(wxT("ftp:")) )
		return false;

	// try to create CDG (try musicFile.cdg and musicFile.mp3.cdg)
	if( (fsFile=CheckFile(musicFile, wxT("cdg"))) )
	{
		m_reader = new SjCdgReader(fsFile); // SjCdgReader takes ownership of fsFile!
		return true; // success
	}

	// try to create LRC (Simple Lyrics)
	if( (fsFile=CheckFile(musicFile, wxT("lrc"))) )
	{
		m_reader = new SjSyncTxtReader(fsFile, SJ_SYNCTXT_LRC, artist, title); // SjSyncTxtReader takes ownership of fsFile!
		return true; // success
	}

	// no karaoke file available
	return false;
}
Ejemplo n.º 4
0
void HtmlOutputPane::OnBeforeLoad(IHtmlWndBeforeLoadEvent& event) {
    const wxString url = event.GetURL();
	if (url == wxT("about:blank")) return;

	if (url.StartsWith(wxT("txmt://open"))) {
		m_opener.OpenTxmtUrl(url);

		// Don't try to open it in browser
		event.Cancel(true);
		return;
	}
	
	if (url.StartsWith(wxT("tm-file://"))) {
		wxString path = url.substr(10);

#ifdef __WXMSW__
		path = eDocumentPath::CygwinPathToWin(path); // path may be in unix format, so we have to convert it
#endif

		DecodePath(path); // Spaces transformed to %20 in paths confuses ie
		m_browser->LoadUrl(path);

		// Don't try to open it in browser
		event.Cancel(true);
		return;
	}
}
Ejemplo n.º 5
0
bool IRCDDBApp::findRepeater(const wxString& rptrCall)
{

  if (rptrCall.StartsWith(wxT("XRF")) || rptrCall.StartsWith(wxT("REF")))
  {
    findReflector(rptrCall, d);
    return true;
  }

  wxString arearp_cs = rptrCall;
  arearp_cs.Replace(wxT(" "), wxT("_"));

  wxString zonerp_cs;

  wxMutexLocker lock(d->rptrMapMutex);
  
  wxString s = wxT("NONE");

  if (d->rptrMap.count(arearp_cs) == 1)
  {
    IRCDDBAppRptrObject o = d->rptrMap[arearp_cs];
    zonerp_cs = o.zonerp_cs;
    zonerp_cs.Replace(wxT("_"), wxT(" "));
    zonerp_cs.SetChar(7, wxT('G'));
    s = o.zonerp_cs;
  }

  IRCMessage * m2 = new IRCMessage(wxT("IDRT_REPEATER"));
  m2->addParam(rptrCall);
  m2->addParam(zonerp_cs);
  m2->addParam(getIPAddress(s));
  d->replyQ.putMessage(m2);

  return true;
}
Ejemplo n.º 6
0
/*
This function transforms mnemonic pathes to real one
For example %USERPROFILE%\MyBudget will be transformed to C:\Users\James\MyBudget
*/
const wxString mmex::getPathAttachment(const wxString &attachmentsFolder)
{
    if (attachmentsFolder == wxEmptyString)
        return wxEmptyString;

    wxString AttachmentsFolder = attachmentsFolder;
    const wxString sep = wxFileName::GetPathSeparator();
    const wxString LastDBPath = Model_Setting::instance().getLastDbPath();
    const wxString& LastDBFolder = wxFileName::FileName(LastDBPath).GetPath() + sep;
    const wxString& UserFolder = mmex::GetUserDir(false).GetPath() + sep;

    if (attachmentsFolder.StartsWith(ATTACHMENTS_FOLDER_USERPROFILE, &AttachmentsFolder))
        AttachmentsFolder.Prepend(wxGetHomeDir() + sep);
    else if (attachmentsFolder.StartsWith(ATTACHMENTS_FOLDER_DOCUMENTS, &AttachmentsFolder))
        AttachmentsFolder.Prepend(wxStandardPaths::Get().GetDocumentsDir() + sep);
    else if (attachmentsFolder.StartsWith(ATTACHMENTS_FOLDER_DATABASE, &AttachmentsFolder))
        AttachmentsFolder.Prepend(LastDBFolder);
    else if (attachmentsFolder.StartsWith(ATTACHMENTS_FOLDER_APPDATA, &AttachmentsFolder))
        AttachmentsFolder.Prepend(UserFolder);

    if (AttachmentsFolder.Last() != sep)
        AttachmentsFolder.Append(sep);
    if (Model_Infotable::instance().GetBoolInfo("ATTACHMENTSSUBFOLDER", true))
        AttachmentsFolder += wxString::Format("MMEX_%s_Attachments%s", wxFileName::FileName(LastDBPath).GetName(), sep);

    return AttachmentsFolder;
}
Ejemplo n.º 7
0
bool StrToBool(const wxString &value)
{
	if (value.StartsWith(wxT("t")))
	{
		return true;
	}
	else if (value.StartsWith(wxT("T")))
	{
		return true;
	}
	else if (value.StartsWith(wxT("1")))
	{
		return true;
	}
	else if (value.StartsWith(wxT("Y")))
	{
		return true;
	}
	else if (value.StartsWith(wxT("y")))
	{
		return true;
	}
	else if (value == wxT("on"))
		return true;

	return false;
}
Ejemplo n.º 8
0
wxExTextFile::wxExCommentType wxExTextFile::CheckCommentSyntax(
  const wxString& syntax_begin,
  const wxString& syntax_end,
  const wxString& text) const
{
  if (syntax_begin == text)
  {
    return (syntax_end == text) ? COMMENT_BOTH: COMMENT_BEGIN;
  }
  else
  {
    if (syntax_end == text ||
       (syntax_end.empty() && text.empty()))
    {
      return COMMENT_END;
    }
  }

  if ( syntax_begin.StartsWith(text) || 
      (!syntax_end.empty() && syntax_end.StartsWith(text)))
  {
    return COMMENT_INCOMPLETE;
  }

  return COMMENT_NONE;
}
// constructor parses out the url for the get
// and limits size to 750 chars (darn line length limit!)
Request::Request(wxString & get, unsigned int ip) {
	wxString line = _T("");
	wxString url = _T("");
	unsigned int linestartpos = 0, lineendpos = 0;

	//Fill in the url by parsing the get
	// find end of line
	while (get.Len() > lineendpos && get[lineendpos] != '\n')
		lineendpos++;
	//if not multiline or (does not start with "GET " or "POST" or "HEAD")
	if(lineendpos >= get.Len() || lineendpos - linestartpos <= 14 //enough room for "GET / HTTP/1.1"
			|| (!get.StartsWith(_T("GET")) && !get.StartsWith(_T("POST"))
			&& !get.StartsWith(_T("HEAD"))) )
		throw _T("Incomplete Get");

	//get GET
	int start = 4;
	if (get[linestartpos] != 'G') 
		start = 5;
	for (unsigned int i = linestartpos + start; get[i] != ' ' && i < lineendpos; i++) // until we hit a space
		line.append(1,get[i]);

	//next line
	lineendpos++;
	linestartpos = lineendpos;

	// continue to find host. look at each line
	while (true) {
		// find end of line
		while (get.Len() > lineendpos && get[lineendpos] != '\n')
			lineendpos++;
		if (lineendpos >= get.Len() || lineendpos - linestartpos < 3)
			break; // end of get

		// get host
		if (lineendpos - linestartpos > 7 //enough room for "Host: \r"
				&& get[linestartpos] == 'H' && get[linestartpos+1] == 'o'
				&& get[linestartpos+2] == 's' && get[linestartpos+3] == 't'
				&& get[linestartpos+4] == ':' && get[linestartpos+5] == ' ') {
			for (unsigned int i = linestartpos + 6; get[i] != '\r' && i < lineendpos; i++)
				url.append(1,get[i]);
		}
		// move to next line
		lineendpos++;
		linestartpos = lineendpos;
		if (get.length() <= lineendpos || url.Len() > 0) // end of given string or host found
			break;
	}// end each line

	url.append(line);	// append /ig/stuff to host
	if (url.Len() > 748) // truncate long lines
		url.Remove(749);
	url.append(_T("\n"));
	
	// set data members
	this->URL = url;
	this->HTTP = get;
	this->IP = ip;
}
Ejemplo n.º 10
0
/* static */
wxCurlProtocol wxCurlBaseThread::GetProtocolFromURL(const wxString &url)
{
    // I'm sure this check could be done in a better way...
    if (url.StartsWith(wxS("http:")) || url.StartsWith(wxS("https:")))
        return wxCP_HTTP;
    if (url.StartsWith(wxS("ftp:")) || url.StartsWith(wxS("ftps:")))
        return wxCP_FTP;
    return wxCP_INVALID;
}
Ejemplo n.º 11
0
static void StripBuildMarkders(wxString &s)
{
    s.StartsWith(WARNING_MARKER, &s);
    s.StartsWith(ERROR_MARKER,   &s);
    s.StartsWith(SUMMARY_MARKER, &s);
    s.StartsWith(SUMMARY_MARKER_ERROR, &s);
    s.StartsWith(SUMMARY_MARKER_SUCCESS, &s);
    s.StartsWith(SUMMARY_MARKER_WARNING, &s);
}
void progress_dialog::extract_progress_from_stderr( const wxString& stdout_string )
{        
    // If it is a progress string (matches this mask using * and ?)...
    if ( stdout_string.Matches( "*collected, * to do*" ) ) {
    
        wxString    value_string;
        wxString    range_string;        
        long        value_long;
        long        range_long;
        wxString    searchable_string = stdout_string;   
    
        // The string starts like this: "---- 1 collected, 9 to do ----"
        searchable_string.Replace( "---- ", "" );
        // The string now looks like this "1 collected, 9 still to do---\n"
        searchable_string.Replace( " collected, ", "R" );         
        // The string now looks like this: "1R9 still to do---\n"        
        value_string = searchable_string.BeforeFirst( 'R' );
        // The value string is now "1".
        range_string = searchable_string.AfterFirst( 'R' );
        // The range string is now "9 still to ----\n"
        range_string = range_string.BeforeFirst( ' ' );
        // The range string is now "9"        

        // Try to convert these strings to longs (returns false if conversion failed).. 
        if ( value_string.ToLong( &value_long ) ) {
            if ( range_string.ToLong( &range_long ) ) {
                // Note that range_long is current still the number remaining. 
                // Add it to value to get a proper range.
                range_long = range_long + value_long;
                // ...If successfully got two longs, cast to ints, and send to 
                // our channel gaugue function
                set_current_channel_gauge( (int)value_long, (int)range_long );
            }
        }
        
    // If it was a "converting the retrieved files" message...            
    } else if ( stdout_string.StartsWith( "Convert" ) ) {
        // ...Update the static text with a message
        XMLCTRL( *this, "progress_dialog_current_channel_value_statictext", wxStaticText )
            ->SetLabel( _( "Converting retrieved files...." ) );
    // If it was a "writing the files into pdb" message...
    } else if ( stdout_string.StartsWith( "Wrote " ) ) {
        // ...Update the static text with a message
        XMLCTRL( *this, "progress_dialog_current_channel_value_statictext", wxStaticText )
            ->SetLabel( _( "Conversion complete. Writing output file..." ) );      
     // It was a "retrieval of files is complete" message:
    } else if ( stdout_string.StartsWith( "---- all" ) ) {
        // ...Set the progress bar to max (range is always plkrFIXED_PERCENTAGE_GAUGE_RANGE 
        // to stop flicker, see notes in plucker_defines.h
        XMLCTRL( *this, "progress_dialog_current_channel_gauge", wxGauge )
            ->SetValue( plkrFIXED_PERCENTAGE_GAUGE_RANGE ); 
        // ...Update the static text with a message
        XMLCTRL( *this, "progress_dialog_current_channel_value_statictext", wxStaticText )
            ->SetLabel( _( "All pages retrieved and parsed. Starting conversion..." ) );    
    }
}
Ejemplo n.º 13
0
// returns TRUE if the parse is valid, or FALSE if it's a comment.
bool pxParseAssignmentString( const wxString& src, wxString& ldest, wxString& rdest )
{
	if( src.StartsWith(L"--") || src.StartsWith( L"//" ) || src.StartsWith( L";" ) )
		return false;

	ldest = src.BeforeFirst(L'=').Trim(true).Trim(false);
	rdest = src.AfterFirst(L'=').Trim(true).Trim(false);
	
	return true;
}
Ejemplo n.º 14
0
wxEndianness wxPlatformInfo::GetEndianness(const wxString& end)
{
    const wxString endl(end.Lower());
    if ( endl.StartsWith(wxT("little")) )
        return wxENDIAN_LITTLE;

    if ( endl.StartsWith(wxT("big")) )
        return wxENDIAN_BIG;

    return wxENDIAN_INVALID;
}
Ejemplo n.º 15
0
bool wxExEx::Move(
  const wxString& begin_address, 
  const wxString& end_address, 
  const wxString& destination)
{
  if (m_STC->GetReadOnly())
  {
    return false;
  }

  const int dest_line = ToLineNumber(destination);

  if (dest_line == 0)
  {
    return false;
  }

  if (!SetSelection(begin_address, end_address))
  {
    return false;
  }

  if (begin_address.StartsWith("'"))
  {
    if (begin_address.size() > 1)
    {
      MarkerDelete(begin_address.GetChar(1));
    }
  }

  if (end_address.StartsWith("'"))
  {
    if (end_address.size() > 1)
    {
      MarkerDelete(end_address.GetChar(1));
    }
  }

  m_STC->BeginUndoAction();

  m_STC->Cut();
  m_STC->GotoLine(dest_line - 1);
  m_STC->Paste();

  m_STC->EndUndoAction();
  
  const int lines = wxExGetNumberOfLines(m_STC->GetSelectedText());
  if (lines >= 2)
  {
    m_Frame->ShowExMessage(wxString::Format(_("%d lines moved"), lines));
  }

  return true;
}
Ejemplo n.º 16
0
void wxGPProcess::ProcessInput(wxString sInputData)
{
	if(m_nState != enumGISTaskWork)
        return;
    sInputData = sInputData.Trim(true).Trim(false);
//INFO, DONE, ERR, ??
	wxString sRest;
	if( sInputData.StartsWith(wxT("DONE: "), &sRest) )
	{
		int nPercent = wxAtoi(sRest.Trim(true).Trim(false).Truncate(sRest.Len() - 1));
		wxTimeSpan Elapsed = wxDateTime::Now() - m_dtBeg;//time left
        wxString sTxt;
		if(m_pProgressor)
			m_pProgressor->SetValue(nPercent);

        double nPercentR = 100 - nPercent;
		if(nPercentR >= 0)
		{
			//wxTimeSpan Remains = Elapsed * (nPercentR / nPercent);
			long dMSec = double(Elapsed.GetMilliseconds().ToDouble() * nPercentR) / nPercent;
			wxTimeSpan Remains = wxTimeSpan(0,0,0,dMSec);
			m_dtEstEnd = wxDateTime::Now() + Remains;
			sTxt = wxString(_("Remains ")) + Remains.Format(_("%H hour(s) %M min. %S sec."));
		}

		if(m_pTrackCancel && !sTxt.IsEmpty())
			m_pTrackCancel->PutMessage(sTxt, -1, enumGISMessageTitle);
		return;
	}
	if( sInputData.StartsWith(wxT("INFO: "), &sRest) )
	{
		if(m_pTrackCancel)
			m_pTrackCancel->PutMessage(sRest, -1, enumGISMessageNorm);
		return;
	}
	if( sInputData.StartsWith(wxT("ERR: "), &sRest) )
	{
		if(m_pTrackCancel)
			m_pTrackCancel->PutMessage(sRest, -1, enumGISMessageErr);
		return;
	}
	if( sInputData.StartsWith(wxT("WARN: "), &sRest) )
	{
		if(m_pTrackCancel)
			m_pTrackCancel->PutMessage(sRest, -1, enumGISMessageWarning);
		return;
	}
    else
	{
		if(m_pTrackCancel)
			m_pTrackCancel->PutMessage(sInputData, -1, enumGISMessageInfo);
		return;
	}
}
Ejemplo n.º 17
0
void Frame::RunQuery(const wxString& query, bool empty_results)
{
  const wxString query_lower = query.Lower();
  const auto start = std::chrono::system_clock::now();

  std::chrono::milliseconds milli;
  long rpc;

  // Query functions supported by ODBC
  // $SQLTables, $SQLColumns, etc.
  // $SQLTables $1:'%'
  // allow you to get database schema.
  if (query_lower.StartsWith("select") ||
      query_lower.StartsWith("describe") ||
      query_lower.StartsWith("show") ||
      query_lower.StartsWith("explain") ||
      query_lower.StartsWith("$sql"))
  {
    if (m_Results->IsShown())
    {
      rpc = m_otl.Query(query, m_Results, m_Stopped, empty_results);
    }
    else
    {
      rpc = m_otl.Query(query, m_Shell, m_Stopped);
    }

    const auto end = std::chrono::system_clock::now();
    const auto elapsed = end - start;
    milli = std::chrono::duration_cast<std::chrono::milliseconds>(elapsed);
  }
  else
  {
    rpc = m_otl.Query(query);
    const auto end = std::chrono::system_clock::now();
    const auto elapsed = end - start;
    milli = std::chrono::duration_cast<std::chrono::milliseconds>(elapsed);
  }

  m_Shell->AppendText(wxString::Format(_("\n%ld rows processed (%.3f seconds)"),
    rpc,
    (float)milli.count() / (float)1000));

  m_Statistics.Set(_("Rows processed"), rpc);
  m_Statistics.Set(_("Query runtime"), milli.count());

  m_Statistics.Inc(_("Total number of queries run"));
  m_Statistics.Inc(_("Total query runtime"), milli.count());
  m_Statistics.Inc(_("Total rows processed"), rpc);

  m_Shell->DocumentEnd();
}
Ejemplo n.º 18
0
void t4p::ApacheClass::SetVirtualHostMapping(const wxString& fileSystemPath, wxString hostName) {
    if (!hostName.EndsWith(wxT("/"))) {
        hostName += wxT("/");
    }
    if (!hostName.StartsWith(wxT("http://")) && !hostName.StartsWith(wxT("https://"))) {
        hostName = wxT("http://") + hostName;
    }
    wxFileName filename;
    filename.AssignDir(fileSystemPath);

    // when inserting into the map, normalize the host document root
    VirtualHostMappings[filename.GetFullPath()] = hostName;
}
Ejemplo n.º 19
0
bool Token::IsValidAncestor(const wxString& ancestor)
{
    switch (ancestor.Len())
    {
    case 3:
        if (ancestor == _T("int"))
            return false;
        break;

    case 4:
        if (   ancestor == _T("void")
            || ancestor == _T("bool")
            || ancestor == _T("long")
            || ancestor == _T("char") )
        {
            return false;
        }
        break;

    case 5:
        if (   ancestor == _T("short")
            || ancestor == _T("float") )
        {
            return false;
        }
        break;

    case 6:
        if (   ancestor == _T("size_t")
            || ancestor == _T("double") )
        {
            return false;
        }
        break;

    case 10:
        if (ancestor == _T("value_type"))
            return false;
        break;

    default:
        if (   ancestor.StartsWith(_T("unsigned"))
            || ancestor.StartsWith(_T("signed")) )
        {
            return false;
        }
        break;
    }

    return true;
}
Ejemplo n.º 20
0
void Plot2DWiz::SetValue(wxString s)
{
  if (s.StartsWith(wxT("plot2d")))
    Parse(s);
  else if (s.StartsWith(wxT("wxplot2d")))
  {
    Parse(s.SubString(2, s.Length()));
    combo_box_1->SetValue(_("inline"));
  }
  else
    text_ctrl_1->SetValue(s);

  text_ctrl_1->SetSelection(-1, -1);
}
Ejemplo n.º 21
0
void wxSMTP::HeloState::onResponse(wxCmdlineProtocol& context, const wxString& line) const
{
   /* Extract smpt code */
   unsigned long smtpCode = 0;
   line.ToULong(&smtpCode);

   /* Check if command was successful */
   if (smtpCode == 250)
   {
      /* Check if this is the last answer */
      if (line.StartsWith(wxT("250-")))
      {
		  if (line.StartsWith(wxT("250-AUTH"))) {
				((wxSMTP&)context).authentication_line = line;
		  }
         /* We shall wait next acceptance answer... */

      }
      else
      {
         if (((wxSMTP&)context).shall_enter_ssl)
         {
            context.ChangeState(g_startTlsState);
         }
         else
         {
            if (((wxSMTP&)context).authentication_scheme == wxSMTP::NoAuthentication)
            {
               context.ChangeState(g_sendMailFromState);
            }
            else
            {
               context.ChangeState(g_authenticateState);
            }
         }
      }
   }
   else
   {
      if ((smtpCode >= 400) && (smtpCode < 500))
      {
         ((wxSMTP&)context).disconnection_status = Listener::StatusRetry;
      }
      else
      {
         ((wxSMTP&)context).disconnection_status = Listener::StatusError;
      }
      context.ChangeState(g_quitState);
   }
}
//-----------------------------------------------------------------------
void TextureRotatorPropertyWindow::copyAttributeToAffector(wxPGProperty* prop, wxString propertyName)
{
	if (!prop)
		return;

	ParticleUniverse::TextureRotator* affector = static_cast<ParticleUniverse::TextureRotator*>(mOwner->getPUElement());
	if (!affector)
		return;

	if (propertyName == PRNL_USE_OWN_SPEED)
	{
		// Use own rotation speed: bool
		affector->setUseOwnRotationSpeed(prop->DoGetValue().GetBool());
	}
	else if (propertyName.StartsWith(PRNL_ROTATION_SPEED))
	{
		// Rotation Speed: Dynamic Attribute (Must be put before PRNL_ROTATION)
		ParticleUniverse::DynamicAttribute* dynAttr = copyValuesToDynamicAttribute(propertyName, prop, PRNL_ROTATION_SPEED, affector->getRotationSpeed());
		if (dynAttr)
		{
			affector->setRotationSpeed(dynAttr);
		}

		if (affector->_isMarkedForEmission())
		{
			_unprepare(affector, ParticleUniverse::Particle::PT_AFFECTOR, ParticleUniverse::Particle::PT_AFFECTOR);
		}
	}
	else if (propertyName.StartsWith(PRNL_ROTATION))
	{
		// Rotation: Dynamic Attribute
		ParticleUniverse::DynamicAttribute* dynAttr = copyValuesToDynamicAttribute(propertyName, prop, PRNL_ROTATION, affector->getRotation());
		if (dynAttr)
		{
			affector->setRotation(dynAttr);
		}

		if (affector->_isMarkedForEmission())
		{
			_unprepare(affector, ParticleUniverse::Particle::PT_AFFECTOR, ParticleUniverse::Particle::PT_AFFECTOR);
		}
	}
	else
	{
		// Update affector with another attribute
		AffectorPropertyWindow::copyAttributeToAffector(prop, propertyName);
	}
}
Ejemplo n.º 23
0
wxLinuxDistributionInfo wxGetLinuxDistributionInfo()
{
    const wxString id = wxGetCommandOutput(wxT("lsb_release --id"));
    const wxString desc = wxGetCommandOutput(wxT("lsb_release --description"));
    const wxString rel = wxGetCommandOutput(wxT("lsb_release --release"));
    const wxString codename = wxGetCommandOutput(wxT("lsb_release --codename"));

    wxLinuxDistributionInfo ret;

    id.StartsWith("Distributor ID:\t", &ret.Id);
    desc.StartsWith("Description:\t", &ret.Description);
    rel.StartsWith("Release:\t", &ret.Release);
    codename.StartsWith("Codename:\t", &ret.CodeName);

    return ret;
}
Ejemplo n.º 24
0
void SjLogGui::ExplodeMessage(const wxString& all___, unsigned long& severity, unsigned long& time, wxString& msg, wxString& scope)
{
	wxString temp;

	// get and strip severity
	temp = all___.BeforeFirst(wxT('|'));
	temp.ToULong(&severity);
	msg = all___.AfterFirst(wxT('|'));

	// get and strip time
	temp = msg.BeforeFirst(wxT('|'));
	temp.ToULong(&time);
	msg = msg.AfterFirst(wxT('|'));

	// now "msg" is message and optional scope enclosured by "[]"
	scope.Empty();
	int p = msg.Find(wxT('['), true/*from end*/);
	if( p!=-1 )
	{
		scope = msg.Mid(p+1);
		if( scope.Len()>=1 && scope.Last()==wxT(']') )
		{
			scope = scope.Left(scope.Len()-1);
			msg = msg.Left(p).Trim();
		}
	}

	// some finalizing translations (some stuff is logged before the translation system is available)
	if( msg.StartsWith(wxT("Loading "), &temp) )
	{
		msg.Printf(_("Loading %s"), temp.c_str());
	}
}
/**
 * 左クリック時に起こるイベント
 */
void ThreadContentWindow::OnLeftClickHtmlWindow(wxHtmlLinkEvent& event) 
{     
     const wxHtmlLinkInfo linkInfo = event.GetLinkInfo();
     const wxString href = linkInfo.GetHref();
     const wxString target = linkInfo.GetTarget();
     wxString rest = wxEmptyString;
     long res = 0;
     
     // bmp,jpg,jpeg,png,gifなどの拡張子が末尾に付いている場合ダウンロードを行う
     if (regexImage.IsValid()) 
     {
	  // 正規表現のコンパイルにエラーがなければマッチさせる
	  if (regexImage.Matches(href)) 
	  {
	       // 画像ファイルをクリックしたのでダウンロードする
	       const wxString ext = regexImage.GetMatch(href, 3);
	       this->SetJaneCloneImageViewer(href, ext);

	  } 
	  else if (href.StartsWith(wxT("#"), &rest) && rest.ToLong(&res, 10)) 
	  {
	       if ( 0 < res && res <= 1000) 
	       {
		    OnLeftClickResponseNumber(event, href, res);
	       }
	  } 
	  else 
	  {
	       // 通常のリンクかどうか判定して処理
	       OnClickOrdinaryLink(href);
	  }
     }
}
Ejemplo n.º 26
0
//-----------------------------------------------------------------------------
bool ValidateIPDataSet( const wxString& IPAddress, const wxString& SubnetMask, const wxString& Gateway, wxWindow* pParent, IPConfigureFrame* pMainFrame )
//-----------------------------------------------------------------------------
{
    wxString errorCaption( wxT( "Parameter validation check failed" ) );
    if( IPAddress.IsEmpty() )
    {
        wxMessageBox( wxT( "Please specify a valid IP address." ), errorCaption, wxOK | wxICON_EXCLAMATION, pParent );
        return false;
    }

    unsigned long firstIPByte = 0;
    if( ( pMainFrame->IsValidIPv4Address( IPAddress.mb_str() ) != 0 ) ||
        !IPAddress.BeforeFirst( wxT( '.' ) ).ToULong( &firstIPByte ) )
    {
        wxMessageBox( wxString::Format( wxT( "'%s' is not a valid IP address. Can't execute command." ), IPAddress.c_str() ), errorCaption, wxOK | wxICON_EXCLAMATION, pParent );
        return false;
    }

    if( ( firstIPByte < 1 ) || ( firstIPByte > 223 ) )
    {
        wxMessageBox( wxString::Format( wxT( "'%s' is not a valid IP address. The first byte of the IP address must be a value between 1 and 223. Can't execute command." ), IPAddress.c_str() ), errorCaption, wxOK | wxICON_EXCLAMATION, pParent );
        return false;
    }

    if( SubnetMask.IsEmpty() )
    {
        wxMessageBox( wxT( "Please specify a valid subnet mask." ), errorCaption, wxOK | wxICON_EXCLAMATION, pParent );
        return false;
    }

    if( pMainFrame->IsValidIPv4Address( SubnetMask.mb_str() ) != 0 )
    {
        wxMessageBox( wxString::Format( wxT( "'%s' is not a valid netmask. Can't execute command." ), SubnetMask.c_str() ), errorCaption, wxOK | wxICON_EXCLAMATION, pParent );
        return false;
    }

    if( !IPAddress.StartsWith( wxT( "169.254." ) ) )
    {
        if( Gateway.IsEmpty() )
        {
            wxMessageBox( wxT( "Please specify a valid gateway address." ), errorCaption, wxOK | wxICON_EXCLAMATION, pParent );
            return false;
        }

        if( ( pMainFrame->IsValidIPv4Address( Gateway.mb_str() ) != 0 ) ||
            !Gateway.BeforeFirst( wxT( '.' ) ).ToULong( &firstIPByte ) )
        {
            wxMessageBox( wxString::Format( wxT( "'%s' is not a valid gateway. Can't execute command." ), Gateway.c_str() ), errorCaption, wxOK | wxICON_EXCLAMATION, pParent );
            return false;
        }

        if( ( firstIPByte < 1 ) || ( firstIPByte > 223 ) )
        {
            wxMessageBox( wxString::Format( wxT( "'%s' is not a valid gateway. The first byte of the gateway must be a value between 1 and 223. Can't execute command." ), Gateway.c_str() ), errorCaption, wxOK | wxICON_EXCLAMATION, pParent );
            return false;
        }
    }

    return true;
}
Ejemplo n.º 27
0
/**
 * FUNCTION: commandLineCleanOption
 * INPUTS:
 *       option       - input string needs to be reformatted
 *       schemaObject - Is this an object related to schema?
 * PURPOSE:
 *  - Fixup a (double-quoted) string for use on the command line
 */
wxString commandLineCleanOption(const wxString &option, bool schemaObject)
{
	wxString tmp = option;

	if (schemaObject)
	{
		// Replace double-quote with slash & double-quote
		tmp.Replace(wxT("\""), wxT("\\\""));
	}
	else
	{
		// If required, clean the string to know the real object name
		if (option.StartsWith(wxT("\"")) && option.EndsWith(wxT("\"")))
			tmp = option.AfterFirst((wxChar)'"').BeforeLast((wxChar)'"');

		// Replace single splash to double-splash
		tmp.Replace(wxT("\\"), wxT("\\\\"));

		// Replace double-quote with slash & double-quote
		tmp.Replace(wxT("\""), wxT("\\\""));

		// Replace double (slash & double-quote) combination to single (slash & double-quote) combination
		tmp.Replace(wxT("\\\"\\\""), wxT("\\\""));

		// Add the double quotes
		tmp = wxT("\"") + tmp + wxT("\"");
	}

	return tmp;
}
Ejemplo n.º 28
0
bool DbgGdb::FilterMessage( const wxString &msg )
{
    wxString tmpmsg ( msg );
    StripString( tmpmsg );
    tmpmsg.Trim().Trim( false );

    if ( tmpmsg.Contains( wxT( "Variable object not found" ) ) || msg.Contains( wxT( "Variable object not found" ) ) ) {
        return true;
    }

    if ( tmpmsg.Contains( wxT( "mi_cmd_var_create: unable to create variable object" ) )||msg.Contains( wxT( "mi_cmd_var_create: unable to create variable object" ) ) ) {
        return true;
    }

    if ( tmpmsg.Contains( wxT( "Variable object not found" ) )|| msg.Contains( wxT( "Variable object not found" ) ) ) {
        return true;
    }

    if ( tmpmsg.Contains( wxT( "No symbol \"this\" in current context" ) )||msg.Contains( wxT( "No symbol \"this\" in current context" ) ) ) {
        return true;
    }

    if ( tmpmsg.Contains( wxT( "*running,thread-id" ) ) ) {
        return true;
    }

    if ( tmpmsg.StartsWith( wxT( ">" ) )||msg.StartsWith( wxT( ">" ) ) ) {
        // shell line
        return true;
    }
    return false;
}
Ejemplo n.º 29
0
/// Helper function to translate the two color string representations:
/// "255 128 64" (cmap file) and "(255,128,64)" (wxPropertyGrid)
/// If wxColourObj is true, the function will create a string that can be used to create a wxColour object from it.
/// Beware: Strings that are not in one of the formats above are not caught and might result in strange return values.
static wxString TranslateColorString(wxString colorstring, bool wxColourObj=false)
{
    if (colorstring.StartsWith("("))
    {
        // wxPropertyGrid representation.
        if (wxColourObj)
        {
            colorstring="RGB"+colorstring;
        }
        else
        {
            colorstring.Replace("(", "");
            colorstring.Replace(")", "");
            colorstring.Replace(",", " ");
        }
    }
    else
    {
        // cmap file representation.
        colorstring.Replace(" ", ",");
        colorstring="("+colorstring+")";
        if (wxColourObj) colorstring="RGB"+colorstring;
    }

    return colorstring;
}
Ejemplo n.º 30
0
void CMusikLibrary::QuerySongsFrom( const wxString & queryFrom, MusikSongIdArray & aReturn ,bool bSorted)
{
	aReturn.Clear();
	//--- run query ---//
	wxString queryTail(queryFrom);
    bool bDistinct = true;
    bDistinct = !queryFrom.StartsWith(wxT("NODISTINCT "),&queryTail);
	wxString myqueryFrom = wxT(" FROM ") + queryTail;

    wxString query;
	if( bSorted && !m_sSortAllSongsQuery.IsEmpty() )
	{
		query = wxString::Format(  m_sSortAllSongsQuery , myqueryFrom.c_str() );
	}
	else
	{
		query = wxT("select");
        if(bDistinct)
            query += wxT(" distinct");
        query += wxT(" songid ");
		query += myqueryFrom; 
		query += wxT(";");		
	}
	aReturn.Alloc(GetSongCount());
    MusikDb::ResultCB cb(&aReturn,&db_callbackAddToSongIdArray);
    m_pDB->Exec( ConvQueryToMB(query), cb );
	aReturn.Shrink();
	return;
}