void CRCppEmitter::AddComment (wxString str)
{
    wxArrayString COMMENT_BREAK_CHARS;
    COMMENT_BREAK_CHARS.Add (_T(" "));
    COMMENT_BREAK_CHARS.Add (_T(","));
    COMMENT_BREAK_CHARS.Add (_T("."));
    COMMENT_BREAK_CHARS.Add (_T(":"));
    COMMENT_BREAK_CHARS.Add (_T("!"));
    COMMENT_BREAK_CHARS.Add (_T("?"));

    wxString pre = m_tab + _T("// ");
    const unsigned int MIN_CONTENT_LEN = 20;
    str.Prepend (pre);

    unsigned int idx;
    do {

        m_newFile.AddLine (this->BreakString (str, COMMENT_BREAK_CHARS, idx,
                                              pre.Length () + MIN_CONTENT_LEN));
        if (idx != 0) {

            str = str.Mid (idx);
            str.Prepend (pre);
        }

    } while (idx != 0);
    // Again, flush current file status (but not finished yet):
    m_newFile.Write ();
}
void CRCppEmitter::AddCode (wxString str)
{
    wxArrayString CODE_BREAK_CHARS;
    CODE_BREAK_CHARS.Add (_T(" "));
    CODE_BREAK_CHARS.Add (_T(","));
    CODE_BREAK_CHARS.Add (_T("."));
    CODE_BREAK_CHARS.Add (_T("("));
    CODE_BREAK_CHARS.Add (_T("::"));
    CODE_BREAK_CHARS.Add (_T("->"));

    wxString pre = m_tab;
    const unsigned int MIN_CONTENT_LEN = 20;
    str.Prepend (pre);

    bool isInString = false;
    unsigned int idx;
    do {

        wxString line = this->BreakString (str, CODE_BREAK_CHARS, idx,
                                           pre.Length () + MIN_CONTENT_LEN, true);
        // Don't break line within string constants, use line splicing instead:
        isInString = this->HasBrokenInString (line);
        if (isInString) {

            line.Append (_T("\""));
        }

        m_newFile.AddLine (line);
        if (idx != 0) {

            str = str.Mid (idx);

            // Change string literal line splicing from appending "\" to end with
            // "\"" and start next line with "\"":
            if (isInString) {

                str.Prepend (_T("\""));
            }

            for (int i = 0; i < 3; i++) {

                str.Prepend (pre);
            }
        }

    } while (idx != 0);
    // Again, flush current file status (but not finished yet):
    m_newFile.Write ();
}
Example #3
0
// Helper wrapping AssocQueryString() Win32 function: returns the value of the
// given associated string for the specified extension (which may or not have
// the leading period).
//
// Returns empty string if the association is not found.
static
wxString wxAssocQueryString(ASSOCSTR assoc,
                            wxString ext,
                            const wxString& verb = wxString())
{
    typedef HRESULT (WINAPI *AssocQueryString_t)(ASSOCF, ASSOCSTR,
                                                  LPCTSTR, LPCTSTR, LPTSTR,
                                                  DWORD *);
    static AssocQueryString_t s_pfnAssocQueryString = (AssocQueryString_t)-1;
    static wxDynamicLibrary s_dllShlwapi;

    if ( s_pfnAssocQueryString == (AssocQueryString_t)-1 )
    {
        if ( !s_dllShlwapi.Load(wxT("shlwapi.dll"), wxDL_VERBATIM | wxDL_QUIET) )
            s_pfnAssocQueryString = NULL;
        else
            wxDL_INIT_FUNC_AW(s_pfn, AssocQueryString, s_dllShlwapi);
    }

    if ( !s_pfnAssocQueryString )
        return wxString();


    DWORD dwSize = MAX_PATH;
    TCHAR bufOut[MAX_PATH] = { 0 };

    if ( ext.empty() || ext[0] != '.' )
        ext.Prepend('.');

    HRESULT hr = s_pfnAssocQueryString
                 (
                    wxASSOCF_NOTRUNCATE,// Fail if buffer is too small.
                    assoc,              // The association to retrieve.
                    ext.t_str(),        // The extension to retrieve it for.
                    verb.empty() ? NULL
                                 : static_cast<const TCHAR*>(verb.t_str()),
                    bufOut,             // The buffer for output value.
                    &dwSize             // And its size
                 );

    // Do not use SUCCEEDED() here as S_FALSE could, in principle, be returned
    // but would still be an error in this context.
    if ( hr != S_OK )
    {
        // The only really expected error here is that no association is
        // defined, anything else is not expected. The confusing thing is that
        // different errors are returned for this expected error under
        // different Windows versions: XP returns ERROR_FILE_NOT_FOUND while 7
        // returns ERROR_NO_ASSOCIATION. Just check for both to be sure.
        if ( hr != HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) &&
                hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) )
        {
            wxLogApiError("AssocQueryString", hr);
        }

        return wxString();
    }

    return wxString(bufOut);
}
// static
void TopLevelWinWrapper::WrapXRC(wxString& text)
{
    wxString prefix, sifa;
    prefix << wxT("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>")
           << wxT("<resource xmlns=\"http://www.wxwidgets.org/wxxrc\">");
    sifa << wxT("</resource>");
    text.Prepend(prefix).Append(sifa);
}
Example #5
0
void Boat::viewODT( wxString path,wxString layout,bool mode )
{
    if ( parent->logbookPlugIn->opt->filterLayout[LogbookDialog::BOAT] )
        layout.Prepend( parent->logbookPlugIn->opt->layoutPrefix[LogbookDialog::BOAT] );

    toODT( path, layout, mode );
    if ( layout != _T( "" ) )
    {
        wxString fn = data_locn;
        fn.Replace( _T( "txt" ),_T( "odt" ) );
        parent->startApplication( fn,_T( ".odt" ) );
    }
}
Example #6
0
void Boat::viewHTML( wxString path, wxString layout, bool mode )
{
    if ( parent->logbookPlugIn->opt->filterLayout[LogbookDialog::BOAT] )
        layout.Prepend( parent->logbookPlugIn->opt->layoutPrefix[LogbookDialog::BOAT] );

    toHTML( path, layout, mode );
    if ( layout != _T( "" ) )
    {
        wxString fn = data_locn;
        fn.Replace( _T( "txt" ),_T( "html" ) );
        parent->startBrowser( fn );
    }
}
void UsrGlblMgrEditDialog::Sanitise(wxString& s)
{
    s.Trim().Trim(true);

    if (s.IsEmpty())
    {
        s = _T("[?empty?]");
        return;
    }

    for (unsigned int i = 0; i < s.length(); ++i)
#if wxCHECK_VERSION(3, 0, 0)
        s[i] = wxIsalnum(s.GetChar(i)) ? s.GetChar(i) : wxUniChar('_');
#else
        s[i] = wxIsalnum(s.GetChar(i)) ? s.GetChar(i) : _T('_');
#endif

    if (s.GetChar(0) == _T('_'))
        s.Prepend(_T("set"));

    if (s.GetChar(0) >= _T('0') && s.GetChar(0) <= _T('9'))
        s.Prepend(_T("set_"));
}
Example #8
0
void OverView::viewHTML(wxString path,wxString layout,int mode)
{
	wxString fn;

	if(opt->filterLayout)
		layout.Prepend(opt->layoutPrefix[LogbookDialog::OVERVIEW]);

	fn = toHTML(path, layout, mode);

	if(layout != _T(""))
	{
		fn.Replace(_T("txt"),_T("html"));
		parent->startBrowser(fn);
	}
}
Example #9
0
void OverView::viewODT(wxString path,wxString layout,int mode)
{
	wxString fn;

	if(opt->filterLayout)
		layout.Prepend(opt->layoutPrefix[LogbookDialog::OVERVIEW]);

	fn = toODT(path, layout, mode);

	if(layout != _T(""))
	{
		fn.Replace(_T("txt"),_T("odt"));
		parent->startApplication(fn,_T(".odt"));
	}
}
Example #10
0
bool GenerateHelp::OnInit() {
  InitializeHtmlEntities();

  imayle = _T("tizer@c");
  imayle += _T("ozic.net");
  imayle.Prepend(_T("appe"));

  wxArrayString localeCodes;
  localeCodes.Add(_T("en"));
  localeCodes.Add(_T("fr"));  
  localeCodes.Add(_T("de"));  

  for (int i = 0; i < localeCodes.Count(); i++) {
    wxString localeCode = localeCodes[i];
    const wxLanguageInfo* info = wxLocale::FindLanguageInfo(localeCode);
    if (!info) {
      wxLogDebug(_T("CANNOT GET LANGUAGE INFO"));
      continue;
    }

    wxLocale locale;
    locale.Init(info->Language);
    locale.AddCatalogLookupPathPrefix(_T("Data/Help"));
    locale.AddCatalog(_T("appetizer_help"));

    wxString htmlString = GenerateHTMLString();

    wxRegEx imageRegEx(_T("\\[([^\\s]+(\\.png|\\.gif|\\.jpg))\\]"), wxRE_ADVANCED);
    wxRegEx urlRegEx(_T("\\[((ftp|http|https)://[^\\s]+)\\s([^\\]]+)\\]"), wxRE_ADVANCED);    
    wxRegEx strongRegEx(_T("\\[b\\](.*?)\\[\\/b\\]"), wxRE_ADVANCED);
    wxRegEx internalUrlRegEx(_T("\\[(#[^\\s]+)\\s([^\\]]+)\\]"), wxRE_ADVANCED);

    imageRegEx.ReplaceAll(&htmlString, _T("<img src='\\1'/>"));
    urlRegEx.ReplaceAll(&htmlString, _T("<a href='\\1'>\\3</a>"));
    strongRegEx.ReplaceAll(&htmlString, _T("<b>\\1</b>"));
    internalUrlRegEx.ReplaceAll(&htmlString, _T("<a href='\\1'>\\2</a>"));

    htmlString.Replace(imayle, wxString::Format(_T("<a href='mailto:%s'>%s</a>"), imayle, imayle));

    WriteHelp(_T("Data/Help/") + localeCode + _T("/Appetizer.html"), htmlString); 
  }

  return false;
} 
Example #11
0
// Helper wrapping AssocQueryString() Win32 function: returns the value of the
// given associated string for the specified extension (which may or not have
// the leading period).
//
// Returns empty string if the association is not found.
static
wxString wxAssocQueryString(ASSOCSTR assoc,
                            wxString ext,
                            const wxString& verb = wxString())
{
    DWORD dwSize = MAX_PATH;
    TCHAR bufOut[MAX_PATH] = { 0 };

    if ( ext.empty() || ext[0] != '.' )
        ext.Prepend('.');

    HRESULT hr = ::AssocQueryString
                 (
                    wxASSOCF_NOTRUNCATE,// Fail if buffer is too small.
                    assoc,              // The association to retrieve.
                    ext.t_str(),        // The extension to retrieve it for.
                    verb.empty() ? NULL
                                 : static_cast<const TCHAR*>(verb.t_str()),
                    bufOut,             // The buffer for output value.
                    &dwSize             // And its size
                 );

    // Do not use SUCCEEDED() here as S_FALSE could, in principle, be returned
    // but would still be an error in this context.
    if ( hr != S_OK )
    {
        // The only really expected error here is that no association is
        // defined, anything else is not expected. The confusing thing is that
        // different errors are returned for this expected error under
        // different Windows versions: XP returns ERROR_FILE_NOT_FOUND while 7
        // returns ERROR_NO_ASSOCIATION. Just check for both to be sure.
        if ( hr != HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) &&
                hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) )
        {
            wxLogApiError("AssocQueryString", hr);
        }

        return wxString();
    }

    return wxString(bufOut);
}
Example #12
0
wxString CreateFilter(wxString s)
{
    wxString Result;
    size_t i;

    if (s.IsEmpty())
        return wxT("");

    s.Prepend(wxT("*"));

    // Uppercase
    s = s.Upper();

    // Replace whitespace with kleene stars for better matching
    s.Replace(wxT(' '), wxT('*'));

    s += wxT("*");

    return s;
}
Example #13
0
void modeltest::runTest(wxCommandEvent& event)
{
	wxString cmd, cmd2, pa, ssize = "-n";
	int dL, sS, nT;
	wxArrayString output, errors;
	string cmdstr, cmdstr2;

	if(fileSelected == "")
	{
		wxMessageBox("Please select a file before running. \nClick on Select File button");
	}
	else
	{
		BIC = this->checkBIC->GetValue();
		if(BIC == true)
		{
			wxTextEntryDialog* samplesize = new wxTextEntryDialog(this, "Please enter the sample size:", "", "", wxOK, wxDefaultPosition);
			if (samplesize->ShowModal() == wxID_OK)
			{
				ssize += samplesize->GetValue();
			}
		}

#ifdef __WXMSW__
		ofstream batchfile("m.bat");
		cmd = modelP;
		cmd2 = modelP;
		cmd.Append("\""); cmd2.Append("\"");
#else
		ofstream batchfile("m.sh");
		cmd = "modeltest3.7 ";
		cmd2 = "modeltest3.7 ";
#endif
		if(debugL > 0)
		{
			cmd += " -d";
			cmd2 += " -d";
			dL = debugL;
			pa.Printf("%d", dL);
			cmd += pa;
			cmd2 += pa;
		}
		if(alphaL > 0)
		{
			cmd += " -a";
			cmd2 += " -a";
			pa.Printf("%lf", alphaL);
			cmd += pa;
			cmd2 += pa;
		}
		if(sampleSize > 0)
		{
			cmd += " -n";
			cmd2 += " -n";
			sS = sampleSize;
			pa.Printf("%d", sS);
			cmd += pa;
			cmd2 += pa;
		}
		if(numberTaxa > 0)
		{
			cmd += " -t";
			cmd2 += " -t";
			nT = numberTaxa;
			pa.Printf("%d", nT);
			cmd += pa;
			cmd2 += pa;
		}
		if(BIC == true)
		{
			cmd2 += " -b " + ssize;
		}
		cmd += " < ";
		cmd2 += " < ";
		if(filePathSelected == "")
		{
			filePathSelected = fileSelected;
		}
		
#ifdef __WXMSW__
		filePathSelected.Append("\"");
		filePathSelected.Prepend("\"");
		cmd.Prepend("\"");
		cmd2.Prepend("\"");
#endif
		cmd += filePathSelected;
		cmd2 += filePathSelected;
		//cmd += "model.scores";
		//cmd2 += "model.scores";
		//wxMessageBox(cmd2);
		cmdstr = cmd;
		cmdstr2 = cmd2;
		batchfile << cmdstr << "\n";
		if(BIC == true)
		{
			batchfile << cmdstr2;
		}
		batchfile.close();
#ifdef __WXMSW__
		long exec = wxExecute("m.bat", output, errors);
#else
		long exec = wxExecute("bash m.sh", output, errors);
#endif
		this->outputText->WriteText("\n" + cmd + "\n");
		int count = output.GetCount();
		for ( size_t n = 0; n < count; n++ )
		{
	        	this->outputText->WriteText(output[n] + "\n");
				this->inNexus->Enable(true);
				this->saveScores->Enable(true);
		}
		count = errors.GetCount();
		for ( size_t n = 0; n < count; n++ )
		{
	        	this->outputText->WriteText(errors[n] + "\n");
		}
		this->outputText->WriteText("\n\nMTgui designed by Paulo Nuin.\nMore info email me at [email protected]");
	}
	debugL = 0;
	alphaL = 0; 
	sampleSize = 0;
	numberTaxa = 0;
}
Example #14
0
void modeltest::runP2(wxCommandEvent& event)
{
	string toinclude1 = "\nBEGIN PAUP;\nexecute \'";
	string toinclude2 = "\';\nEnd;";
	string toinclude3 = "\nBEGIN PAUP;\nquit warntsave=no;\nEnd;";
	wxArrayString output, errors;
	wxString directory;
	string temp;

	wxFileDialog* openFileDialog = new wxFileDialog ( this, "Select NEXUS file to test in PAUP", "", "", FILETYPES3, wxOPEN, wxDefaultPosition);
	if (openFileDialog->ShowModal() == wxID_OK)
	{
		readBlock();
		ofstream paupfile("paupfile.txt");
		wxString fileP = openFileDialog->GetPath();
		directory = openFileDialog->GetDirectory();
		string to = toinclude1;
		string to2 = "log file=\'";
		to2 += fileP;
		to2 += ".log\' replace;\n";
		to += + fileP;
		to += toinclude2;
		mrbl.insert(7, to);
		mrbl.insert(7+to.length()-4, to2);
		mrbl.insert(mrbl.length()-1, toinclude3);

		paupfile << mrbl;
		paupfile.close();

#ifdef __WXMSW__	
		ofstream pbat("p.bat");
		paupP.Prepend("\"");
		paupP.Append("\"");
		temp = paupP;
		pbat << paupP << " paupfile.txt";
		pbat.close();
#endif
		this->outputText->Clear();
		this->outputText->WriteText("PAUP is running on a separate process, please be patient.\n");
		this->outputText->WriteText("When it finishes this display will be updated.\n");
	//"C:\wxWidgets\projects\modelGUI\modeltest3.7\Modeltest3.7 folder\bin\Modeltest3.7.win.exe" < "C:\wxWidgets\projects\modelGUI\model.scores"
		
#ifdef __WXMSW__
		long exec = wxExecute("p.bat", wxEXEC_SYNC);
#else
		//long exec = wxExecute("ls", wxEXEC_SYNC);
		long exec = wxExecute("paup  paupfile.txt", wxEXEC_SYNC);
#endif
		remove("paupfile.txt");
		mrbl.clear();
		this->outputText->Clear();
		this->outputText->WriteText("PAUP run has finished.\nYou can save the scores file and automatically run MrModelTest.");
		wxMessageDialog dialog( NULL, _T("Your scores file is ready.\nDo you want to run MrModelTest? Click Yes to start the analysis\nor No to perform other actions (do not forget to save your scores file)."),_T("Run MrModelTest??"), wxYES_DEFAULT|wxYES_NO|wxICON_QUESTION);
		if(dialog.ShowModal() == wxID_YES)
		{
			fileSelectedMr =  paupDir + "mrmodel.scores";
			//fileSelected = fileP + "model.scores";
			modeltest::runTestMr(event);
		}
		else
		{
			fileToSave = fileP + ".scores";
		}
		this->saveScoresMr->Enable(true);
	}
}
wxString LogbookHTML::replacePlaceholder(wxString html,wxString htmlHeader,int grid, int row, int col, bool mode)
{
		static wxString route;
		wxString s;
		wxGrid* g = parent->logGrids[grid];

		if(row == 0 && col == 0 && grid == 0)  
			route = _T(""); 

			switch(grid)
			{
			case 0:
					switch(col)
					{
						case ROUTE:	if(route != replaceNewLine(g->GetCellValue(row,col),mode))
									{
										htmlHeader.Replace(wxT("#ROUTE#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Prepend(htmlHeader);
									}
									html.Replace(wxT("#LROUTE#"),g->GetColLabelValue(col));
									route = replaceNewLine(g->GetCellValue(row,col),mode);
								break;
						case RDATE:		html.Replace(wxT("#DATE#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LDATE#"),g->GetColLabelValue(col));
										html.Replace(wxT("#NO.#"),wxString::Format(_T("%i"),row+1));
								break;
						case RTIME:		html.Replace(wxT("#TIME#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LTIME#"),g->GetColLabelValue(col));
								break;
						case SIGN:		html.Replace(wxT("#SIGN#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LSIGN#"),g->GetColLabelValue(col));
								break;
						case WAKE:		html.Replace(wxT("#WAKE#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LWAKE#"),g->GetColLabelValue(col));
								break;
						case DISTANCE:	html.Replace(wxT("#DISTANCE#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LDISTANCE#"),g->GetColLabelValue(col));
								break;
						case DTOTAL:	html.Replace(wxT("#DTOTAL#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LDTOTAL#"),g->GetColLabelValue(col));
								break;
						case POSITION:	html.Replace(wxT("#POSITION#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LPOSITION#"),g->GetColLabelValue(col));
								break;
						case COG:		html.Replace(wxT("#COG#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LCOG#"),g->GetColLabelValue(col));
								break;
						case COW:		html.Replace(wxT("#COW#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LCOW#"),g->GetColLabelValue(col));
								break;
						case SOG:		html.Replace(wxT("#SOG#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LSOG#"),g->GetColLabelValue(col));
								break;
						case SOW:		html.Replace(wxT("#SOW#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LSOW#"),g->GetColLabelValue(col));
								break;
						case DEPTH:		html.Replace(wxT("#DEPTH#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LDEPTH#"),g->GetColLabelValue(col));
								break;
						case REMARKS:	html.Replace(wxT("#REMARKS#"),replaceNewLine(replaceNewLine(g->GetCellValue(row,col),mode),mode));
										html.Replace(wxT("#LREMARKS#"),g->GetColLabelValue(col));
								break;
					}
					break;
			case 1:
					switch(col)
					{
						case BARO:		html.Replace(wxT("#BARO#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LBARO#"),g->GetColLabelValue(col));
								break;
						case WIND:		html.Replace(wxT("#WIND#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LWIND#"),g->GetColLabelValue(col));
								break;
						case WSPD:		html.Replace(wxT("#WSPD#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LWSPD#"),g->GetColLabelValue(col));
								break;
						case CURRENT:	html.Replace(wxT("#CUR#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LCUR#"),g->GetColLabelValue(col));
								break;
						case CSPD:		html.Replace(wxT("#CSPD#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LCSPD#"),g->GetColLabelValue(col));
								break;
						case WAVE:		html.Replace(wxT("#WAVE#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LWAVE#"),g->GetColLabelValue(col));	
								break;
						case SWELL:		html.Replace(wxT("#SWELL#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LSWELL#"),g->GetColLabelValue(col));
								break;
						case WEATHER:	html.Replace(wxT("#WEATHER#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LWEATHER#"),g->GetColLabelValue(col));
								break;
						case CLOUDS:	html.Replace(wxT("#CLOUDS#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LCLOUDS#"),g->GetColLabelValue(col));
								break;
						case VISIBILITY:html.Replace(wxT("#VISIBILITY#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LVISIBILITY#"),g->GetColLabelValue(col));
								break;
					}
					break;
			case 2:
					switch(col)
					{
						case MOTOR:		html.Replace(wxT("#MOTOR#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LMOTOR#"),g->GetColLabelValue(col));
								break;
						case MOTORT:	html.Replace(wxT("#MOTORT#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LMOTORT#"),g->GetColLabelValue(col));
								break;
						case FUEL:		html.Replace(wxT("#FUEL#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LFUEL#"),g->GetColLabelValue(col));
								break;
						case FUELT:		html.Replace(wxT("#FUELT#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LFUELT#"),g->GetColLabelValue(col));
								break;
						case SAILS:		html.Replace(wxT("#SAILS#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LSAILS#"),g->GetColLabelValue(col));
								break;
						case REEF:		html.Replace(wxT("#REEF#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LREEF#"),g->GetColLabelValue(col));
								break;
						case WATER:		html.Replace(wxT("#WATER#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LWATER#"),g->GetColLabelValue(col));
								break;
						case WATERT:	html.Replace(wxT("#WATERT#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LWATERT#"),g->GetColLabelValue(col));
								break;
						case MREMARKS:	html.Replace(wxT("#MREMARKS#"),replaceNewLine(g->GetCellValue(row,col),mode));
										html.Replace(wxT("#LMREMARKS#"),g->GetColLabelValue(col));
								break;
					}
					break;
			}

	if(mode == 0)
		return html;
	else 
	{
		wxString str(html, wxConvUTF8);
		return str;
	}
}
Example #16
0
void modeltest::runTestMr(wxCommandEvent& event)
{
	wxString cmd, pa;
	wxArrayString output, errors;
	string cmdstr;

	if(fileSelectedMr == "")
	{
		wxMessageBox("Please select a file before running. \nClick on Select File button");
	}
	else
	{

#ifdef __WXMSW__
		ofstream batchfile("mr.bat");
		cmd = mrModelP;
		cmd.Append("\"");
#else
		ofstream batchfile("mr.sh");
		cmd = "mrmodeltest2 ";
#endif
		/*if(debugL > 0)
		{
			cmd += " -d";
			dL = debugL;
			pa.Printf("%d", dL);
			cmd += pa;
		}
		if(alphaL > 0)
		{
			cmd += " -a";
			pa.Printf("%lf", alphaL);
			cmd += pa;	
		}
		if(sampleSize > 0)
		{
			cmd += " -c";
			sS = sampleSize;
			pa.Printf("%d", sS);
			cmd += pa;
		}
		if(numberTaxa > 0)
		{
			cmd += " -t";
			nT = numberTaxa;
			pa.Printf("%d", nT);
			cmd += pa;
		}*/
		cmd += " < ";
		if(filePathSelectedMr == "")
		{
			filePathSelectedMr = fileSelectedMr;
		}
		
#ifdef __WXMSW__
		filePathSelectedMr.Append("\"");
		filePathSelectedMr.Prepend("\"");
		cmd.Prepend("\"");
#endif
		cmd += filePathSelectedMr;
		cmdstr = cmd;
		batchfile << cmdstr;
		batchfile.close();
#ifdef __WXMSW__
		long exec = wxExecute("mr.bat", output, errors);
#else
		long exec = wxExecute("bash mr.sh", output, errors);
#endif
		this->outputText->WriteText("\n");
		this->outputText->WriteText(cmd);
		this->outputText->WriteText("\n");
		int count = output.GetCount();
		for ( size_t n = 0; n < count; n++ )
		{
	        	this->outputText->WriteText(output[n]);
			this->outputText->WriteText("\n");
				this->inNexus->Enable(true);
				//this->saveScores->Enable(true);
		}
		count = errors.GetCount();
		for ( size_t n = 0; n < count; n++ )
		{
	        	this->outputText->WriteText(errors[n]);
			this->outputText->WriteText("\n");
		}
		this->outputText->WriteText("\n\nMTgui designed by Paulo Nuin.\nMore info email me at [email protected]");
	}
	debugL = 0;
	alphaL = 0; 
	sampleSize = 0;
	numberTaxa = 0;
}
Example #17
0
void ClangDriver::DoParseCompletionString(CXCompletionString str,
                                          int depth,
                                          wxString& entryName,
                                          wxString& signature,
                                          wxString& completeString,
                                          wxString& returnValue)
{

    bool collectingSignature = false;
    int numOfChunks = clang_getNumCompletionChunks(str);
    for(int j = 0; j < numOfChunks; j++) {

        CXString chunkText = clang_getCompletionChunkText(str, j);
        CXCompletionChunkKind chunkKind = clang_getCompletionChunkKind(str, j);

        switch(chunkKind) {
        case CXCompletionChunk_TypedText:
            entryName = wxString(clang_getCString(chunkText), wxConvUTF8);
            completeString += entryName;
            break;

        case CXCompletionChunk_ResultType:
            completeString += wxString(clang_getCString(chunkText), wxConvUTF8);
            completeString += wxT(" ");
            returnValue = wxString(clang_getCString(chunkText), wxConvUTF8);
            break;

        case CXCompletionChunk_Optional: {
            // Optional argument
            CXCompletionString optStr = clang_getCompletionChunkCompletionString(str, j);
            wxString optionalString;
            wxString dummy;
            // Once we hit the 'Optional Chunk' only the 'completeString' is matter
            DoParseCompletionString(optStr, depth + 1, dummy, dummy, optionalString, dummy);
            if(collectingSignature) {
                signature += optionalString;
            }
            completeString += optionalString;
        } break;
        case CXCompletionChunk_LeftParen:
            collectingSignature = true;
            signature += wxT("(");
            completeString += wxT("(");
            break;

        case CXCompletionChunk_RightParen:
            collectingSignature = true;
            signature += wxT(")");
            completeString += wxT(")");
            break;

        default:
            if(collectingSignature) {
                signature += wxString(clang_getCString(chunkText), wxConvUTF8);
            }
            completeString += wxString(clang_getCString(chunkText), wxConvUTF8);
            break;
        }
        clang_disposeString(chunkText);
    }

    // To make this tag compatible with ctags one, we need to place
    // a /^ and $/ in the pattern string (we add this only to the top level completionString)
    if(depth == 0) {
        completeString.Prepend(wxT("/^ "));
        completeString.Append(wxT(" $/"));
    }
}