Example #1
0
void InstConsoleWindow::AppendMessage(const wxString& msg, MessageType msgT)
{
	// Prevent some red spam
	if (msg.Contains("[STDOUT]") || msg.Contains("[ForgeModLoader]"))
		msgT = MSGT_STDOUT;

	switch (msgT)
	{
	case MSGT_SYSTEM:
		consoleTextCtrl->SetDefaultStyle(
			wxTextAttr(settings->GetConsoleSysMsgColor()));
		break;

	case MSGT_STDOUT:
		consoleTextCtrl->SetDefaultStyle(
			wxTextAttr(settings->GetConsoleStdoutColor()));
		break;

	case MSGT_STDERR:
		consoleTextCtrl->SetDefaultStyle(
			wxTextAttr(settings->GetConsoleStderrColor()));
		break;
	}

	(*consoleTextCtrl) << msg << "\n";

	consoleTextCtrl->SetDefaultStyle(wxTextAttr(
		wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT)));
}
void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
{
    int idx = m_paperSizeComboBox->GetSelection();

    if( idx < 0 )
        idx = 0;

    const wxString paperType = m_pageFmt[idx];

    if( paperType.Contains( PAGE_INFO::Custom ) )
    {
        m_orientationComboBox->Enable( false );
        m_TextUserSizeX->Enable( true );
        m_TextUserSizeY->Enable( true );
        m_customFmt = true;
    }
    else
    {
        m_orientationComboBox->Enable( true );

        if( paperType.Contains( wxT( "A4" ) ) && IsGOST() )
        {
            m_orientationComboBox->SetStringSelection( _( "Portrait" ) );
            m_orientationComboBox->Enable( false );
        }

        m_TextUserSizeX->Enable( false );
        m_TextUserSizeY->Enable( false );
        m_customFmt = false;
    }

    GetPageLayoutInfoFromDialog();
    UpdatePageLayoutExample();
}
Example #3
0
bool TextInString(const wxString& str, const wxString& text, bool wholeWords)
{
    int index = str.Find(text);
    if (index >= 0)
    {
        if (wholeWords)
        {
            size_t textLen = text.Length();

            bool result = true;
            if (index >0)
                result = result && SEPARATORS.Contains(str[index-1]);
            if (index+textLen < str.Length())
                result = result && SEPARATORS.Contains(str[index+textLen]);

            return result;
        }
        else
        {
            return true;
        }
    }
    else
    {
        return false;
    }
}
Example #4
0
wxString modeltest::checkBlock(wxString block)
{
	int lsetPos, semiPos;
	wxString fblock;

	if(block.Contains("Lset") || block.Contains("lset") || block.Contains("LSET"))
	{
		int pB = wxMessageBox("LSET command found on your PAUP block.\nDo you want to comment it?", "Paup Block", wxYES | wxNO);
		if(pB == wxYES)
		{
			lsetPos = block.Find("LSET");
			block.Replace("LSET", "[LSET", false);
			if(lsetPos == -1)
			{
				lsetPos = block.Find("Lset");
				block.Replace("Lset", "[Lset", false);
			}
			if(lsetPos == -1)
			{
				lsetPos = block.Find("lset");
				block.Replace("lset", "[lset", false);
			}
			if(lsetPos == 0)
			{
				semiPos = block.First(";");
				block.Replace(";", ";]", false);
			}
		}
	}
	return block;
}
KeynameConverter::ModifierList KeynameConverter::stringToKeyModifier(const wxString &keyModifier)
{
	ModifierList modifiers;

	// this search must be case-insensitive
	const wxString str = keyModifier.Upper();

	if (str.Contains(wxT("ALT+")))
	{
		modifiers.insert( ALT );
	}

	if (str.Contains(wxT("CTRL+")))
	{
		modifiers.insert( CTRL );
	}

	if (str.Contains(wxT("SHIFT+")))
	{
		modifiers.insert( SHIFT );
	}

	if (str.Contains(wxT("ANY+")))
	{
		modifiers.insert( ANY );
	}

	if (str.Contains(wxT("META+")))
	{
		modifiers.insert( META );
	}

	return modifiers;
}
Example #6
0
bool BaseDialog::existID( wxWindow* dlg, iONode list, iONode props, wxString  id ) {
  if( StrOp.equals( wItem.getid(props), id.mb_str(wxConvUTF8) ) ) {
    return false;
  }

  if( id.Len() == 0 ) {
    wxMessageDialog( dlg, wxGetApp().getMsg("invalidid"), _T("Rocrail"), wxOK | wxICON_ERROR ).ShowModal();
    return true;
  }
  if( id.Contains(wxT(",")) || id.Contains(wxT(";")) || id.Contains(wxT(":")) ) {
    wxMessageDialog( dlg, wxGetApp().getMsg("invalidchars"), _T("Rocrail"), wxOK | wxICON_ERROR ).ShowModal();
    return true;
  }
  if( list != NULL ) {
    int cnt = NodeOp.getChildCnt( list );
    for( int i = 0; i < cnt; i++ ) {
      iONode child = NodeOp.getChild( list, i );
      if( StrOp.equals( wItem.getid(child), id.mb_str(wxConvUTF8) )) {
        wxMessageDialog( dlg,
            wxString::Format(wxGetApp().getMsg("existingid"), wItem.getx(child), wItem.gety(child)) + _T("\n") + wxString(wItem.getdesc(child),wxConvUTF8),
            _T("Rocrail"), wxOK | wxICON_ERROR ).ShowModal();
        return true;
      }
    }
  }
  return false;
}
Example #7
0
TMotion::TMotion(const wxString& type, const wxString& length)
{
    // In case of an error, default to linear growth across one second.
    duration = 1000;
    this->type = Linear;

    if (type == "" || type == "linear")
        this->type = Linear;
    else if (type == "exponential")
        this->type = Exponential;
    else if (type == "logarthmic")
        this->type = Logarithmic;
    else
        wxGetApp().Errorf("Unrecognized motion type '%s'.\n", type.c_str());

    if (length == "") {
        wxGetApp().Errorf("Motion length not specified.\n");
    } else if (length.Contains("ms")) { // milliseconds
        if (!length.SubString(0, length.Length() - 3).ToULong((unsigned long*) &duration))
            wxGetApp().Errorf("Invalid number: '%s'.\n", length.c_str());
    } else if (length.Contains("s")) { // seconds
        if (!length.SubString(0, length.Length() - 2).ToULong((unsigned long*) &duration))
            wxGetApp().Errorf("Invalid number: '%s'.\n", length.c_str());
        else
            duration *= 1000;
    } else if (length.Contains("min")) { // minutes
        if (!length.SubString(0, length.Length() - 4).ToULong((unsigned long*) &duration))
            wxGetApp().Errorf("Invalid number: '%s'.\n", length.c_str());
        else
            duration *= 1000 * 60;
    } else {
        wxGetApp().Errorf("Motion length must be end in one of : {s, ms, min}.\n");
    }
}
Example #8
0
/**
 * Doku see wxFileSystemHandler
 */
wxString wxChmFSHandler::FindFirst(const wxString& spec, int flags)
{
    wxString right = GetRightLocation(spec);
    wxString left = GetLeftLocation(spec);
    wxString nativename = wxFileSystem::URLToFileName(left).GetFullPath();

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

    m_chm = new wxChmTools(wxFileName(nativename));
    m_pattern = right.AfterLast(_T('/'));

    wxString m_found = m_chm->Find(m_pattern);

    // now fake around hhp-files which are not existing in projects...
    if (m_found.empty() &&
        m_pattern.Contains(_T(".hhp")) &&
        !m_pattern.Contains(_T(".hhp.cached")))
    {
        m_found.Printf(_T("%s#chm:%s.hhp"),
                       left.c_str(), m_pattern.BeforeLast(_T('.')).c_str());
    }

    return m_found;

}
Example #9
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;
}
double fromDMM( wxString sdms )
{
    wchar_t buf[64];
    char narrowbuf[64];
    int i, len, top = 0;
    double stk[32], sign = 1;

    //First round of string modifications to accomodate some known strange formats
    wxString replhelper;
    replhelper = wxString::FromUTF8( "´·" ); //UKHO PDFs
    sdms.Replace( replhelper, _T(".") );
    replhelper = wxString::FromUTF8( "\"·" ); //Don't know if used, but to make sure
    sdms.Replace( replhelper, _T(".") );
    replhelper = wxString::FromUTF8( "·" );
    sdms.Replace( replhelper, _T(".") );

    replhelper = wxString::FromUTF8( "s. Å¡." ); //Another example: cs.wikipedia.org (someone was too active translating...)
    sdms.Replace( replhelper, _T("N") );
    replhelper = wxString::FromUTF8( "j. Å¡." );
    sdms.Replace( replhelper, _T("S") );
    sdms.Replace( _T("v. d."), _T("E") );
    sdms.Replace( _T("z. d."), _T("W") );

    //If the string contains hemisphere specified by a letter, then '-' is for sure a separator...
    sdms.UpperCase();
    if( sdms.Contains( _T("N") ) || sdms.Contains( _T("S") ) || sdms.Contains( _T("E") )
            || sdms.Contains( _T("W") ) ) sdms.Replace( _T("-"), _T(" ") );

    wcsncpy( buf, sdms.wc_str( wxConvUTF8 ), 64 );
    len = wcslen( buf );

    for( i = 0; i < len; i++ ) {
        wchar_t c = buf[i];
        if( ( c >= '0' && c <= '9' ) || c == '-' || c == '.' || c == '+' ) {
            narrowbuf[i] = c;
            continue; /* Digit characters are cool as is */
        }
        if( c == ',' ) {
            narrowbuf[i] = '.'; /* convert to decimal dot */
            continue;
        }
        if( ( c | 32 ) == 'w' || ( c | 32 ) == 's' ) sign = -1; /* These mean "negate" (note case insensitivity) */
        narrowbuf[i] = 0; /* Replace everything else with nuls */
    }

    /* Build a stack of doubles */
    stk[0] = stk[1] = stk[2] = 0;
    for( i = 0; i < len; i++ ) {
        while( i < len && narrowbuf[i] == 0 )
            i++;
        if( i != len ) {
            stk[top++] = atof( narrowbuf + i );
            i += strlen( narrowbuf + i );
        }
    }

    return sign * ( stk[0] + ( stk[1] + stk[2] / 60 ) / 60 );
}
Example #11
0
bool wxIsPlatform64Bit()
{
    const wxString machine = wxGetCommandOutput(wxT("uname -m"));

    // the test for "64" is obviously not 100% reliable but seems to work fine
    // in practice
    return machine.Contains(wxT("64")) ||
           machine.Contains(wxT("alpha"));
}
Example #12
0
wxArchitecture wxPlatformInfo::GetArch(const wxString &arch)
{
    if ( arch.Contains(wxT("32")) )
        return wxARCH_32;

    if ( arch.Contains(wxT("64")) )
        return wxARCH_64;

    return wxARCH_INVALID;
}
Example #13
0
int AudioDialog::GetValue(const wxString& type){

	if (type.Contains(ZERO_MARGIN_KEY))
		return  zeroMarginCtl->GetValue();
	if (type.Contains(SILENCE_CUTOFF_KEY))
		return zeroCutOff->GetValue();
	if (type.Contains(SPEECH_LENGTH_KEY))
		return speechMargin->GetValue();

	return debugChk->IsChecked();
}
Example #14
0
void wxSVGLength::SetValueAsString(const wxString& n)
{
  m_valueInSpecifiedUnits = 0;
  m_unitType = wxSVG_LENGTHTYPE_NUMBER;
  wxString value = n.Strip(wxString::both);
  wxString unit;
  if (value.length()>=2)
  {
	const wxString s_numeric = wxT("0123456789");
	const wxString s_numericFirst = wxT("+-.Ee") + s_numeric;
	if (!s_numeric.Contains(value.Right(1)))
	{
	  if (s_numericFirst.Contains(value.Mid(value.Length()-2,1)))
	  {
		unit = value.Right(1);
		value = value.Left(value.Length()-1);
	  }
	  else
	  {
		unit = value.Right(2);
		value = value.Left(value.Length()-2);
	  }
	}
  }
  
  double d;
  if (!value.ToDouble(&d))
	return;
  m_valueInSpecifiedUnits = d;
  
  if (unit.length() == 0);
  else if (unit == wxT("px"))
	m_unitType = wxSVG_LENGTHTYPE_PX;
  else if (unit.Right(1) == wxT("%"))
	m_unitType = wxSVG_LENGTHTYPE_PERCENTAGE;
  else if (unit == wxT("em"))
	m_unitType = wxSVG_LENGTHTYPE_EMS;
  else if (unit == wxT("ex"))
	m_unitType = wxSVG_LENGTHTYPE_EXS;
  else if (unit == wxT("cm"))
	m_unitType = wxSVG_LENGTHTYPE_CM;
  else if (unit == wxT("mm"))
	m_unitType = wxSVG_LENGTHTYPE_MM;
  else if (unit == wxT("in"))
	m_unitType = wxSVG_LENGTHTYPE_IN;
  else if (unit == wxT("pt"))
	m_unitType = wxSVG_LENGTHTYPE_PT;
  else if (unit == wxT("pc"))
	m_unitType = wxSVG_LENGTHTYPE_PC;
  SetValueInSpecifiedUnits(m_valueInSpecifiedUnits);
}
Example #15
0
wxString conv_class(wxString input)//input contains class classname:$/nprivate:$/nvariable ...$/n
{
 	wxString output,classname,temporary;
 	output.Empty();
 	classname = input.BeforeFirst('$');//contains Class classname:
 	classname = classname.AfterFirst(' ');
 	classname = classname.BeforeFirst(':');
 	input = input.AfterFirst('$');//contains \n\tprivate:$\n.....
 	output << "class " <<classname;
 	temporary = input.BeforeFirst('$');//contains \n\tprivate:
	output<<"\n{"<<temporary<<"\n";//has private:\n
	input= input.AfterFirst('$'); //list of data members - either variables or functions and then $\n\tpublic:$\n
	while(input.Contains(wxT("public:")))//input has /nint ....$/n...$/npublic:$/n
	{
		temporary = input.BeforeFirst('$');//contains variable or function or public;
		if(temporary.Contains(wxT("public:"))) break;
		else if(temporary.Contains(wxT("Variable")))
		{
			temporary.Replace("\t ","");
			output<<"\t "<< conv_variable(temporary)<<"\n";
		}
		else if(temporary.Contains(wxT("Function")))
		{
			temporary.Replace("\t ","");
			output<<"\t " << conv_g_func(temporary)<<"\n";
		}
		input = input.AfterFirst('$');
	}//input contains \n\tpublic:$\n ... \nEnd Class$\n
	temporary = input.BeforeFirst('$');//contains \n\tpublic:
	output<<temporary<<"\n";//output has public:\n
	input = input.AfterFirst('$');//input has list of datamembers and then has endclass$\n
	while(input.Contains(wxT("End")))//input has /nint ....$/n...$/npublic:$/n
	{
		temporary = input.BeforeFirst('$');//contains variable or function or public;
		if(temporary.Contains(wxT("End"))) break;
		else if(temporary.Contains(wxT("Variable")))
		{
			temporary.Replace("\t ","");
			output<<"\t "<< conv_variable(temporary)<<"\n";
		}
		else if(temporary.Contains(wxT("Function")))
		{
			temporary.Replace("\t ","");
			output<<"\t " << conv_g_func(temporary)<<"\n";
		}
		input = input.AfterFirst('$');
	}
	output<<"\n};";
	return output;
}
Example #16
0
wxString MakeFileName( const wxString & dir,
		const wxString & shortname, const wxString & ext)
/***************************************************************************/

/* Calcule le nom complet d'un fichier d'apres les chaines
	dir = prefixe (chemin)	  (peut etre "")
	shortname = nom avec ou sans chemin ou extension
	ext = extension	(peut etre "")

	si shortname possede deja un chemin ou une extension, elles
	ne seront pas modifiees

	retourne la chaine calculee
*/
{
wxString fullfilename;
int ii;

	if ( dir != "" )
	{
		if( ! shortname.Contains("/") && ! shortname.Contains("\\")
			&& ! shortname.Contains(":") )
		{ /* aucun chemin n'est donne */
			fullfilename = dir;
		}
	}

	fullfilename += shortname;
	fullfilename.Replace("\\", "/");

	/* Placement de l'extension s'il n'y en a pas deja une */
	if( ext == "") return(fullfilename);

	/* Recherche d'une eventuelle extension */
	ii = fullfilename.Length();	/* Pointe la fin du texte */
	for ( ; ii >= 0 ; ii-- )
	{
		if ( fullfilename.GetChar(ii) == '/' )
		{
		/* Pas d'extension: placement de l'extension standard */
			fullfilename += ext;
			break;
		}
		if ( fullfilename.GetChar(ii) == '.' )	/* extension trouvee */
			break;
	}

	return(fullfilename);
}
void DbgGdb::GetDebugeePID(const wxString& line)
{
    if(m_debuggeePid == wxNOT_FOUND) {
        if(GetIsRemoteDebugging()) {
            m_debuggeePid = m_gdbProcess->GetPid();

        } else {

            static wxRegEx reDebuggerPidWin(wxT("New Thread ([0-9]+)\\.(0[xX][0-9a-fA-F]+)"));
            static wxRegEx reGroupStarted(wxT("id=\"([0-9]+)\""));
            static wxRegEx reSwitchToThread(wxT("Switching to process ([0-9]+)"));

            // test for the debuggee PID
            // in the line with the following pattern:
            // =thread-group-started,id="i1",pid="15599"
            if(m_debuggeePid < 0 && !line.IsEmpty()) {
                wxString debuggeePidStr;

                if(line.Contains(wxT("=thread-group-started")) && reGroupStarted.Matches(line)) {
                    debuggeePidStr = reGroupStarted.GetMatch(line, 1);

                } else if(line.Contains(wxT("=thread-group-created")) && reGroupStarted.Matches(line)) {
                    debuggeePidStr = reGroupStarted.GetMatch(line, 1);

                } else if(reDebuggerPidWin.Matches(line)) {
                    debuggeePidStr = reDebuggerPidWin.GetMatch(line, 1);

                } else if(reSwitchToThread.Matches(line)) {
                    debuggeePidStr = reSwitchToThread.GetMatch(line, 1);
                }

                if(!debuggeePidStr.IsEmpty()) {
                    long iPid(0);
                    if(debuggeePidStr.ToLong(&iPid)) {
                        m_debuggeePid = iPid;
                        wxString msg;
                        msg << wxT(">> Debuggee process ID: ") << m_debuggeePid;
                        m_observer->UpdateAddLine(msg);

                        // Now there's a known pid, the debugger can be interrupted to let any to-be-disabled bps be
                        // disabled. So...
                        m_observer->DebuggerPidValid();
                    }
                }
            }
        }
    }
}
int GetPlatformsFromString(const wxString& platforms)
{
    bool pW = platforms.Contains(_("Windows"));
    bool pU = platforms.Contains(_("Unix"));
    bool pM = platforms.Contains(_("Mac"));
    bool pA = platforms.Contains(_("All"));

    if (pA || (pW && pU && pM))
        return spAll;

    int     p  = 0;
    if (pW) p |= spWindows;
    if (pU) p |= spUnix;
    if (pM) p |= spMac;
    return p;
}
Example #19
0
wxString conv_struct(wxString input)//input contains Structure structname:$\nvariable ...$\n
{
 	wxString output,structname,temporary;
 	output.Empty();
 	structname = input.BeforeFirst('$');//contains Structure structname:
 	structname = structname.AfterFirst(' ');
 	structname = structname.BeforeFirst(':');
 	input = input.AfterFirst('$');//Contains list of data members - either variables or functions and then End Structure
 	output << "struct " <<structname;
	output<<"\n{\n";
	while(input.Contains(wxT("End")))//input has /nint ....$/n...$/npublic:$/n
	{
		temporary = input.BeforeFirst('$');//contains variable or function or public;
		if(temporary.Contains(wxT("End"))) break;
		else if(temporary.Contains(wxT("Variable")))
		{
			temporary.Replace("\t ","");
			output<<"\t "<< conv_variable(temporary)<<"\n";
		}
		else if(temporary.Contains(wxT("Function")))
		{
			temporary.Replace("\t ","");
			output<<"\t " << conv_g_func(temporary)<<"\n";
		}
		input = input.AfterFirst('$');
	}//input contains End Struct $\n
	output<<"\n};";
	return output;
}
Example #20
0
void AudioDialog::SetStrValue(const wxString& type, wxString value){

	if (type.Contains(SERVER_KEY)){
		txtServer->SetValue(value);
		return;
	}
}
Example #21
0
wxString AudioDialog::GetStrValue(const wxString& type){

	if (type.Contains(SERVER_KEY))
		return txtServer->GetValue();

	return _("localhost");
}
Example #22
0
/**
 *	Check if there is "promote" event and notify user if needed
 */
void ChatPanel::CheckForPromotion(const wxString& /*who*/, const wxString& action)
{
	if (!m_reactOnPromoteEvents) { //If this feature disabled in options do nothing
		return;
	}

	//TODO: Make promote templates be user-configurable and uses regexp
	const wxString promoteMessageTemplate = _T(" player(s) needed for battle \"");
	const wxString promoteMessageTemplate2 = _T("). Come play and enjoy !");

	//Detect event and notify user
	//TODO: Rework for using array of regexps, not shit crap
	if (action.Contains(promoteMessageTemplate) || action.Contains(promoteMessageTemplate2)) {
		UiEvents::GetNotificationEventSender().SendEvent(UiEvents::NotficationData(UiEvents::GamePromoted, action));
	}
}
int mxVarWindow::GetVarType (int &line, wxString var_name) {

	if (var_name.Contains("[")) var_name=var_name.BeforeFirst('[');
	var_name.MakeUpper();
	
	wxTreeItemIdValue cookie;
	wxTreeItemId it = tree->GetFirstChild(tree->GetRootItem(),cookie);
	while (it.IsOk()) {
		range *r=(range*)tree->GetItemData(it);
		if (/*r && */line>=r->from && line<=r->to) {
			line = r->from;
			break;
		}
		it = tree->GetNextSibling(it);
	}
	if (!it.IsOk()) return -1;
	it = tree->GetFirstChild(it,cookie);
	while (it.IsOk()) {
		wxString it_text = tree->GetItemText(it);
		if (it_text.Contains("[")) {
			if (it_text.BeforeFirst('[').Upper()==var_name) 
				return GetVarType(it);
		} else {
			if (it_text.Upper()==var_name) 
				return GetVarType(it);
		}
		it = tree->GetNextSibling(it);
	}
	return -1;
	
}
Example #24
0
void NewBuildTab::DoUpdateCurrentCompiler(const wxString& line)
{
    wxString projectName, configuration;
    if ( line.Contains ( wxGetTranslation(BUILD_PROJECT_PREFIX) ) ) {
        // now building the next project

        wxString prj  = line.AfterFirst ( wxT ( '[' ) ).BeforeFirst ( wxT ( ']' ) );
        projectName   = prj.BeforeFirst ( wxT ( '-' ) ).Trim ( false ).Trim();
        configuration = prj.AfterFirst ( wxT ( '-' ) ).Trim ( false ).Trim();

        m_cmp.Reset ( NULL );
        // need to know the compiler in use for this project to extract
        // file/line and error/warning status from the text
        BuildConfigPtr bldConf = WorkspaceST::Get()->GetProjBuildConf(projectName, configuration);
        if ( bldConf ) {
            m_cmp = BuildSettingsConfigST::Get()->GetCompiler ( bldConf->GetCompilerType() );

        } else {
            // probably custom build with project names incorret
            // assign the default compiler for this purpose
            if ( BuildSettingsConfigST::Get()->IsCompilerExist(wxT("gnu g++")) ) {
                m_cmp = BuildSettingsConfigST::Get()->GetCompiler( wxT("gnu g++") );
            }
        }
    }

    if( !m_cmp ) {
        if ( BuildSettingsConfigST::Get()->IsCompilerExist(wxT("gnu g++")) ) {
            m_cmp = BuildSettingsConfigST::Get()->GetCompiler( wxT("gnu g++") );
        }
    }
}
Example #25
0
File: PeerID.cpp Project: ctz/rain
bool PeerID::AddressMatches(const wxString& a)
{
    unsigned long porta = DEFAULT_PORT, portb = DEFAULT_PORT;
    wxIPV4address addra, addrb;

    if (a.Contains(":"))
    {
        addra.Hostname(a.BeforeLast(':'));
        a.AfterLast(':').ToULong(&porta);
        addra.Service(porta);
    } else {
        addra.Hostname(a);
        addra.Service(porta);
    }

    if (this->address.Contains(":"))
    {
        addrb.Hostname(this->address.BeforeLast(':'));
        this->address.AfterLast(':').ToULong(&portb);
        addrb.Service(portb);
    } else {
        addrb.Hostname(this->address);
        addrb.Service(portb);
    }

    return (addra.IPAddress() == addrb.IPAddress() && addra.Service() == addrb.Service());
}
Example #26
0
pgDatatype::pgDatatype(const wxString &nsp, const wxString &typname, bool isDup, long numdims, long typmod)
{
	needSchema = isDup;
	schema = nsp;

	// Above 7.4, format_type also sends the schema name if it's not included
	// in the search_path, so we need to skip it in the typname
	if (typname.Contains(schema + wxT("\".")))
		name = typname.Mid(schema.Len() + 3); // "+2" because of the two double quotes
	else if (typname.Contains(schema + wxT(".")))
		name = typname.Mid(schema.Len() + 1);
	else
		name = typname;

	if (name.StartsWith(wxT("_")))
	{
		if (!numdims)
			numdims = 1;
		name = name.Mid(1);
	}
	if (name.Right(2) == wxT("[]"))
	{
		if (!numdims)
			numdims = 1;
		name = name.Left(name.Len() - 2);
	}

	if (name.StartsWith(wxT("\"")) && name.EndsWith(wxT("\"")))
		name = name.Mid(1, name.Len() - 2);

	if (numdims > 0)
	{
		while (numdims--)
			array += wxT("[]");
	}

	if (typmod != -1)
	{
		length = wxT("(");
		if (name == wxT("numeric"))
		{
			len = (typmod - 4L) >> 16L;
			prec = (typmod - 4) & 0xffff;
			length += NumToStr(len);
			if (prec)
				length += wxT(",") + NumToStr(prec);
		}
Example #27
0
int wxExVCSCommand::From(const wxString& type) const
{
  long command = VCS_COMMAND_IS_BOTH;
  
  if (type.Contains("popup"))
  {
    command = VCS_COMMAND_IS_POPUP;
  }
  else if (type.Contains("main"))
  {
    command = VCS_COMMAND_IS_MAIN;
  }
  
  long flags = (type.Contains("separator") ? VCS_COMMAND_SEPARATOR: 0);
  
  return command | flags;
}
Example #28
0
wxString DotWriter::OptionsShortNameAndParameters(const wxString& name)
{
    if((dwhidenamespaces || dwhideparams) && name.Contains(wxT('(')) && name.Contains(wxT(')'))) {
        wxString out = name;

        if(dwhidenamespaces) {
            wxRegEx re;
            // remove STL
            int start, end;
            while(GetOuterTempleate(out, &start, &end)) {
                out.Replace(out.Mid(start, end - start + 1), wxT("%STL%"));
            }
            out.Replace(wxT("%STL%"), wxT("<...>"));
            // remove namespace
            if(re.Compile(wxT("::[a-zA-Z_~]+[a-zA-Z_0-9<!=\\-\\+\\*/%]*\\(.*\\)[ ]*(const)?[ ]*$"), wxRE_ADVANCED) &&
               re.Matches(name)) {
                out = re.GetMatch(name);
                out.Replace(wxT("::"), wxEmptyString);
            }
        }

        if(dwhideparams) {
            out = out.BeforeFirst(wxT('('));
            out += wxT("()"); // for function return just ()
        }

        return out;

    } else if(name.Contains(wxT('(')) && name.Contains(wxT(')')) && dwstripparams) {
        wxString out = name.BeforeFirst(wxT('('));
        wxString sub = name.AfterFirst(wxT('(')).BeforeFirst(wxT(')'));
        if(sub.IsEmpty()) {
            out += wxT("\\n(\\n)");
            return out;
        } else if(sub.Contains(wxT(","))) {
            sub.Replace(wxT(","), wxT(",\\n"));
            out += wxT("\\n(\\n") + sub + wxT("\\n)");
            return out;
        } else {
            out += wxT("\\n(\\n") + sub + wxT("\\n)");
            return out;
        }
    } else
        return name;
}
 virtual wxDirTraverseResult OnDir( const wxString& directory_name )
 {
     if ( directory_name.Contains( m_filter ) )
     {
         m_subdirectories.Add( directory_name );
     }
     // Using wxDIR_STOP not wxDIR_CONTINUE, since only want one directory.
     return wxDIR_CONTINUE;
 }
Example #30
0
void NewBuildTab::DoSearchForDirectory(const wxString& line)
{
    // Check for makefile directory changes lines
    if(line.Contains(wxT("Entering directory `"))) {
        wxString currentDir = line.AfterFirst(wxT('`'));
        currentDir = currentDir.BeforeLast(wxT('\''));

        // Collect the m_baseDir
        m_directories.Add(currentDir);

    } else if(line.Contains(wxT("Entering directory '"))) {
        wxString currentDir = line.AfterFirst(wxT('\''));
        currentDir = currentDir.BeforeLast(wxT('\''));

        // Collect the m_baseDir
        m_directories.Add(currentDir);
    }
}