Example #1
0
void CppCheckPlugin::DoSettingsItem(ProjectPtr project/*= NULL*/)
{
    // Find the default path for the CppCheckSettingsDialog's wxFileDialog
    wxString defaultpath;
    IEditor* ed = m_mgr->GetActiveEditor();
    if (ed && ed->GetFileName().IsOk()) {
        defaultpath = ed->GetFileName().GetPath();
    }

    // If there's an active project, first load any project-specific settings: definitions and undefines
    // (We couldn't do that with the rest of the settings as the workspace hadn't yet been loaded)
    m_settings.LoadProjectSpecificSettings(project); // NB we still do this if !project, as that will clear any stale settings

    CppCheckSettingsDialog dlg(m_mgr->GetTheApp()->GetTopWindow(), &m_settings, m_mgr->GetConfigTool(), defaultpath, project.Get() != NULL);
    if (dlg.ShowModal() == wxID_OK) {
        m_mgr->GetConfigTool()->WriteObject(wxT("CppCheck"), &m_settings);
        if (project) {
            // Also save any project-specific settings: definitions and undefines
            wxString definitions = wxJoin(m_settings.GetDefinitions(), ',');
            wxString undefines   = wxJoin(m_settings.GetUndefines(), ',');
            if (!(definitions.empty() && undefines.empty())) {
                project->SetPluginData("CppCheck", definitions + ';' + undefines);
            } else {
                project->SetPluginData("CppCheck", "");
            }
        }
    }
}
Example #2
0
void ProjectSettings::OnInheritCheck(wxCommandEvent& event) {
	if (event.IsChecked()) {

		const wxString ind = wxJoin(m_parentProject.includeDirs, wxT('\n'), wxT('\0'));
		m_includeDirs->SetValue(ind);

		const wxString inf = wxJoin(m_parentProject.includeFiles, wxT('\n'), wxT('\0'));
		m_includeFiles->SetValue(inf);

		const wxString exd = wxJoin(m_parentProject.excludeDirs, wxT('\n'), wxT('\0'));
		m_excludeDirs->SetValue(exd);

		const wxString exf = wxJoin(m_parentProject.excludeFiles, wxT('\n'), wxT('\0'));
		m_excludeFiles->SetValue(exf);


		m_includeDirs->Disable();
		m_excludeDirs->Disable();
		m_includeFiles->Disable();
		m_excludeFiles->Disable();
	}
	else {
		m_includeDirs->Enable();
		m_excludeDirs->Enable();
		m_includeFiles->Enable();
		m_excludeFiles->Enable();
	}
}
Example #3
0
void CompilerMainPage::OnEditLibraryPaths(wxCommandEvent& event)
{
    wxString curLibPath = m_textCtrlGlobalLibPath->GetValue();
    curLibPath = wxJoin(::wxStringTokenize(curLibPath, ";", wxTOKEN_STRTOK), '\n', '\0');
    wxString newLibPath = ::clGetStringFromUser(curLibPath, EventNotifier::Get()->TopFrame());
    newLibPath.Trim().Trim(false);
    if(!newLibPath.IsEmpty()) {
        m_isDirty = true;
        newLibPath = wxJoin(::wxStringTokenize(newLibPath, "\n\r", wxTOKEN_STRTOK), ';', '\0');
        m_textCtrlGlobalLibPath->ChangeValue(newLibPath);
    }
}
Example #4
0
void ArraysTestCase::wxStringArraySplitJoinTest()
{
    wxChar separators[] = { wxT('a'), wxT(','), wxT('_'), wxT(' '), wxT('\\'),
                            wxT('&'), wxT('{'), wxT('A'), wxT('<'), wxT('>'),
                            wxT('\''), wxT('\n'), wxT('!'), wxT('-') };

    // test with a string: split it and then rejoin it:

    wxString str = wxT("This is a long, long test; if wxSplit and wxJoin do work ")
                   wxT("correctly, then splitting and joining this 'text' _multiple_ ")
                   wxT("times shouldn't cause any loss of content.\n")
                   wxT("This is some latex code: ")
                   wxT("\\func{wxString}{wxJoin}{")
                   wxT("\\param{const wxArray String\\&}{ arr}, ")
                   wxT("\\param{const wxChar}{ sep}, ")
                   wxT("\\param{const wxChar}{ escape = '\\'}}.\n")
                   wxT("This is some HTML code: ")
                   wxT("<html><head><meta http-equiv=\"content-type\">")
                   wxT("<title>Initial page of Mozilla Firefox</title>")
                   wxT("</meta></head></html>");

    size_t i;
    for (i = 0; i < WXSIZEOF(separators); i++)
    {
        wxArrayString arr = wxSplit(str, separators[i]);
        CPPUNIT_ASSERT( str == wxJoin(arr, separators[i]) );
    }


    // test with an array: join it and then resplit it:

    const wxChar *arr[] =
        {
            wxT("first, second!"), wxT("this is the third!!"),
            wxT("\nThat's the fourth token\n\n"), wxT(" - fifth\ndummy\ntoken - "),
            wxT("_sixth__token__with_underscores"), wxT("The! Last! One!")
        };
    wxArrayString theArr(WXSIZEOF(arr), arr);

    for (i = 0; i < WXSIZEOF(separators); i++)
    {
        wxString string = wxJoin(theArr, separators[i]);
        CPPUNIT_ASSERT( theArr == wxSplit(string, separators[i]) );
    }

    wxArrayString emptyArray;
    wxString string = wxJoin(emptyArray, wxT(';'));
    CPPUNIT_ASSERT( string.empty() );

    CPPUNIT_ASSERT( wxSplit(string, wxT(';')).empty() );

    CPPUNIT_ASSERT_EQUAL( 2, wxSplit(wxT(";"), wxT(';')).size() );
}
Example #5
0
void CompilersFoundDlg::MSWUpdateToolchain(CompilerPtr compiler)
{
    wxUnusedVar(compiler);
#ifdef __WXMSW__
    if(compiler->GetCompilerFamily() == COMPILER_FAMILY_MINGW) {
        // Clang and VC lacks 2 tools: make and windres
        // so we copy those from the default MinGW compiler
        wxString make = compiler->GetTool("MAKE");
        wxString resourceCompiler = compiler->GetTool("ResourceCompiler");

        for(size_t i = 0; i < m_allCompilers.size(); ++i) {
            CompilerPtr c = m_allCompilers.at(i);
            if(c->GetCompilerFamily() == COMPILER_FAMILY_CLANG || c->GetCompilerFamily() == COMPILER_FAMILY_VC) {
                c->SetTool("MAKE", make);
                c->SetTool("ResourceCompiler", resourceCompiler);

                if(c->GetCompilerFamily() == COMPILER_FAMILY_CLANG) {
                    // Clang under Windows, needs the include paths from the MinGW compiler
                    IncludePathLocator locator(NULL);
                    wxArrayString includePaths, excludePaths;
                    locator.Locate(includePaths, excludePaths, false, compiler->GetTool("CXX"));

                    // Convert the include paths to semi colon separated list
                    wxString mingwIncludePaths = wxJoin(includePaths, ';');
                    c->SetGlobalIncludePath(mingwIncludePaths);
                }
            }
        }
    }
#endif
}
Example #6
0
void SequenceElements::DeleteTimingFromView(const std::string &name, int view)
{
    std::string viewName = GetViewName(view);
    Element* elem = GetElement(name);
    if( elem != nullptr && elem->GetType() == "timing" )
    {
        std::string views = elem->GetViews();
        wxArrayString all_views = wxSplit(views,',');
        int found = -1;
        for( int j = 0; j < all_views.size(); j++ )
        {
            if( all_views[j] == viewName )
            {
                found = j;
                break;
            }
        }
        if( found != -1 )
        {
            all_views.erase(all_views.begin() + found);
            views = wxJoin(all_views, ',');
            elem->SetViews(views);
        }
    }
}
Example #7
0
void Accelerators::ReadCustomShortcuts() {
	wxString path = eGetSettings().GetSettingsDir() + wxT("accelerators.cfg");
	if (!wxFileExists(path)) return;

	wxFileInputStream fstream(path);
	if (!fstream.IsOk()) {
		wxLogDebug(wxT("Could not open keyboard settings file."));
		return;
	}

	// Parse the JSON contents
	wxJSONReader reader;
	wxJSONValue jsonRoot;
	const int numErrors = reader.Parse(fstream, &jsonRoot);
	if ( numErrors > 0 )  {
		// if there are errors in the JSON document, print the errors
		const wxArrayString& errors = reader.GetErrors();
		wxString msg = _("Invalid JSON in settings:\n\n") + wxJoin(errors, wxT('\n'), '\0');
		wxMessageBox(msg, _("Syntax error"), wxICON_ERROR|wxOK);
		return;
	}

	if(!jsonRoot.HasMember(wxT("bindings"))) return;
	wxJSONValue bindings = jsonRoot[wxT("bindings")];

	m_customBindings.clear();
	wxArrayString keys = bindings.GetMemberNames();
	for(unsigned int c = 0; c < keys.size(); c++) {
		wxString key = keys[c];
		m_customBindings[normalize(key)] = bindings[key].AsString();
	}
}
Example #8
0
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
{
    wxArrayString array;

    array.Add("wxImage demo");
    array.Add("(c) Robert Roebling 1998-2005");
    array.Add("(c) Vadim Zeitlin 2005-2009");

    array.Add(wxEmptyString);
    array.Add("Version of the libraries used:");

#if wxUSE_LIBPNG
    array.Add(wxPNGHandler::GetLibraryVersionInfo().ToString());
#endif
#if wxUSE_LIBJPEG
    array.Add(wxJPEGHandler::GetLibraryVersionInfo().ToString());
#endif
#if wxUSE_LIBTIFF
    array.Add(wxTIFFHandler::GetLibraryVersionInfo().ToString());
#endif
#if wxUSE_ZLIB && wxUSE_STREAMS
    // zlib is used by libpng
    array.Add(wxGetZlibVersionInfo().ToString());
#endif
    (void)wxMessageBox( wxJoin(array, '\n'),
                        "About wxImage Demo",
                        wxICON_INFORMATION | wxOK );
}
Example #9
0
/**
 * @brief Join arguments for project settings.
 *
 * @param settings      Project settings.
 * @param configuration CMakePlugin global configuration.
 *
 * @return Command line arguments.
 */
static wxString CreateArguments(const CMakeProjectSettings& settings,
                                const CMakeConfiguration& configuration)
{
    const wxString& sourceDir = settings.sourceDirectory;
    const wxString& buildDir = settings.buildDirectory;
    wxArrayString args;

    // Get generator
    wxString generator = settings.generator;

    // Use global value
    if (generator.IsEmpty())
        generator = configuration.GetDefaultGenerator();

    // Generator
    if (!generator.IsEmpty())
        args.Add("-G \"" + generator + "\"");

    if (!settings.buildType.IsEmpty())
        args.Add("-DCMAKE_BUILD_TYPE=" + settings.buildType);

    // Copy additional arguments
    for (wxArrayString::const_iterator it = settings.arguments.begin(),
        ite = settings.arguments.end(); it != ite; ++it) {
        args.Add(*it);
    }

    return wxJoin(args, ' ', '\0');
}
Example #10
0
void OptionsConfig::SetBookmarkLabel(const wxString& label, size_t index)
{
    wxArrayString arr = wxSplit(m_bookmarkLabels, ';');
    if(index < arr.GetCount()) {
        arr.Item(index) = label;
        m_bookmarkLabels = wxJoin(arr, ';');
    }
}
Example #11
0
void OptionsConfig::SetBookmarkBgColour(wxColour c, size_t index)
{
    wxArrayString arr = wxSplit(m_bookmarkBgColours, ';');
    if(index < arr.GetCount()) {
        arr.Item(index) = c.GetAsString(wxC2S_HTML_SYNTAX);
        m_bookmarkBgColours = wxJoin(arr, ';');
    }
}
/// Put aPriorityPath in front of all paths in the value of aEnvVar.
const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPath )
{
    wxPathList  paths;

    paths.AddEnvList( aEnvVar );
    paths.Insert( aPriorityPath, 0 );

    return wxJoin( paths, wxPATH_SEP[0] );
}
Example #13
0
void ArraysTestCase::wxStringArrayJoinTest()
{
    // test wxJoin:

    {
        const wxChar *arr[] = { wxT("first"), wxT(""), wxT("second"), wxT("third") };
        wxString expected = wxT("first,,second,third");

        wxArrayString arrstr(WXSIZEOF(arr), arr);
        wxString result = wxJoin(arrstr, wxT(','));
        CPPUNIT_ASSERT( expected == result );
    }

    {
        const wxChar *arr[] = { wxT("first, word"), wxT(",,second"), wxT("third,,") };
        wxString expected = wxT("first\\, word,\\,\\,second,third\\,\\,");
        wxString expected2 = wxT("first, word,,,second,third,,");

        // escaping on:
        wxArrayString arrstr(WXSIZEOF(arr), arr);
        wxString result = wxJoin(arrstr, wxT(','), wxT('\\'));
        CPPUNIT_ASSERT( expected == result );

        // escaping turned off:
        wxString result2 = wxJoin(arrstr, wxT(','), wxT('\0'));
        CPPUNIT_ASSERT( expected2 == result2 );
    }

    {
        // test is escape characters placed in the original array are just ignored as they should:
        const wxChar *arr[] = { wxT("first\\, wo\\rd"), wxT("seco\\nd"), wxT("\\third\\") };
        wxString expected = wxT("first\\\\, wo\\rd,seco\\nd,\\third\\");
        wxString expected2 = wxT("first\\, wo\\rd,seco\\nd,\\third\\");

        // escaping on:
        wxArrayString arrstr(WXSIZEOF(arr), arr);
        wxString result = wxJoin(arrstr, wxT(','), wxT('\\'));
        CPPUNIT_ASSERT( expected == result );

        // escaping turned off:
        wxString result2 = wxJoin(arrstr, wxT(','), wxT('\0'));
        CPPUNIT_ASSERT( expected2 == result2 );
    }
}
Example #14
0
void xlGridCanvasPictures::UpdateRenderedImage()
{
    wxString settings = mEffect->GetSettingsAsString();
    wxArrayString all_settings = wxSplit(settings, ',');
    for( int s = 0; s < all_settings.size(); s++ )
    {
        wxArrayString parts = wxSplit(all_settings[s], '=');
        if( parts[0] == "E_FILEPICKER_Pictures_Filename" ) {
            parts[1] = PictureName;
        }
        all_settings[s] = wxJoin(parts, '=');
    }
    settings = wxJoin(all_settings, ',');
    mEffect->SetSettings(settings.ToStdString(), false);

    wxCommandEvent eventEffectChanged(EVT_EFFECT_CHANGED);
    eventEffectChanged.SetClientData(mEffect);
    wxPostEvent(mMessageParent, eventEffectChanged);
}
Example #15
0
 void Update(CatalogItem *item) override
 {
     auto comment = wxJoin(item->GetAutoComments(), ' ', '\0');
     if (comment.StartsWith("TRANSLATORS:") || comment.StartsWith("translators:"))
     {
         comment.Remove(0, 12);
         if (!comment.empty() && comment[0] == ' ')
             comment.Remove(0, 1);
     }
     m_comment->SetAndWrapLabel(comment);
 }
Example #16
0
void DataModelListCtrl::Copy()
{
    const wxDataModelBase* model = GetModel();
    wxArrayInt rows;
    wxArrayString as;

    GetRowSelections(rows);
    for (wxArrayInt::const_iterator it = rows.begin(); it != rows.end(); it++)
    {
        wxArrayString row_str;
        for (size_t col = 0; col < model->GetColumnCount(); col++)
        {
            wxString str;
            model->GetValueByRow(&str, *it, col);
            row_str.push_back(str);
        }
        as.push_back(wxJoin(row_str, ';', 0));
    }
    wxClipboardHelper::SetText(wxJoin(as, '\n', 0));
}
Example #17
0
 void Update(const CatalogItemPtr& item) override
 {
     auto comment = wxJoin(item->GetExtractedComments(), '\n', '\0');
     if (comment.StartsWith("TRANSLATORS:") || comment.StartsWith("translators:"))
     {
         comment.Remove(0, 12);
         if (!comment.empty() && comment[0] == ' ')
             comment.Remove(0, 1);
     }
     m_comment->SetAndWrapText(comment);
 }
Example #18
0
int wxLoadFileSelector(wxWindow* parent, wxFileName* fileName, const wxArrayString& extensions)
{
    const wxString filter = wxJoin(extensions, wxT('|'), 0);
    wxString defaultPath = GetDefaultPath(*fileName);
    wxString caption = wxGetStockLabelEx(wxID_OPEN, wxSTOCK_PLAINTEXT);
    wxFileDialog fileDialog(parent, caption, defaultPath, fileName->GetFullName(), filter, wxFD_DEFAULT_STYLE_OPEN | wxFD_CHANGE_DIR);

    if (fileDialog.ShowModal() != wxID_OK)
        return wxNOT_FOUND;
    fileName->Assign(fileDialog.GetPath());
    return fileDialog.GetFilterIndex();
}
void PHPProjectSettingsDlg::OnAddIncludePath(wxCommandEvent& event)
{
    wxString path = ::wxDirSelector(_("Select folder"));
    if(!path.IsEmpty()) {
        wxArrayString curIncPaths = wxStringTokenize(m_textCtrlPHPIncludePath->GetValue(), "\n", wxTOKEN_STRTOK);
        if(curIncPaths.Index(path) == wxNOT_FOUND) {
            curIncPaths.Add(path);
        }

        // User SetValue to trigger an event
        m_textCtrlPHPIncludePath->SetValue(wxJoin(curIncPaths, '\n'));
    }
}
Example #20
0
void OptionsDlg::OnOk(wxCommandEvent& WXUNUSED(event))
{
	if ( Validate() && TransferDataFromWindow() )
	{
		prefs.symSearchPath = wxJoin(symPaths->GetStrings(), ';', 0);
		prefs.useSymServer = useSymServer->GetValue();
		prefs.symCacheDir = symCacheDir->GetPath();
		prefs.symServer = symServer->GetValue();
		prefs.useWinePref = mingwWine->GetValue();
		prefs.saveMinidump = saveMinidump->GetValue() ? saveMinidumpTimeValue : -1;
		prefs.throttle = throttle->GetValue();
		EndModal(wxID_OK);
	}
}
Example #21
0
LanguageServerPage::LanguageServerPage(wxWindow* parent, const LanguageServerEntry& data)
    : LanguageServerPageBase(parent)
{
    m_textCtrlName->SetValue(data.GetName());
    m_dirPickerWorkingDir->SetPath(data.GetWorkingDirectory());
    m_filePickerExe->SetPath(data.GetExepath());
    m_textCtrlArgs->SetValue(data.GetArgs());
    m_checkBoxEnabled->SetValue(data.IsEnabled());
    const wxArrayString& langs = data.GetLanguages();
    wxString languages = wxJoin(langs, ';');
    this->m_textCtrlLanguages->SetValue(languages);
    this->m_comboBoxConnection->SetValue(data.GetConnectionString());
    m_checkBoxDiagnostics->SetValue(data.IsDisaplayDiagnostics());
    m_sliderPriority->SetValue(data.GetPriority());
}
Example #22
0
/**
 * Return the value associated with a given field in the group.
 * Some fields require special attention.
 */
wxString BOM_TABLE_GROUP::GetFieldValue( unsigned int aFieldId ) const
{
    wxString value;

    // Account for special cases
    switch( aFieldId )
    {
    // QUANTITY returns the size of the group
    case BOM_COL_ID_QUANTITY:
        value = wxString::Format( "%u", (unsigned int) GroupSize() );
        break;

    // REFERENCE field returns consolidated list of references
    case BOM_COL_ID_REFERENCE:
        value = wxJoin( GetReferences(), ' ' );
        break;

    // Otherwise, return component data
    default:
        if( Components.size() == 0 )
        {
            value = wxEmptyString;
        }
        else
        {
            // If the components in this group contain multiple items,
            // display a special string indicating this
            for( unsigned int i=0; i<Components.size(); i++ )
            {
                auto const& cmp = Components[i];

                if( i == 0 )
                {
                    value = cmp->GetFieldValue( aFieldId );
                }
                // Mismatch found
                else if( value.Cmp( cmp->GetFieldValue( aFieldId ) ) != 0 )
                {
                    value = ROW_MULT_ITEMS;
                    break;
                }
            }
        }
        break;
    }

    return value;
}
Example #23
0
void SequenceElements::DeleteElement(const std::string &name)
{
    for(wxXmlNode* view=mViewsNode->GetChildren(); view!=NULL; view=view->GetNext() )
    {
        wxString view_models = view->GetAttribute("models");
        wxArrayString all_models = wxSplit(view_models, ',');
        wxArrayString new_models;
        for( int model = 0; model < all_models.size(); model++ )
        {
            if( all_models[model] != name )
            {
                new_models.push_back(all_models[model]);
            }
        }
        view_models = wxJoin(new_models, ',');
        view->DeleteAttribute("models");
        view->AddAttribute("models", view_models);
    }

    // delete element pointer from all views
    for(int i=0;i<mAllViews.size();i++)
    {
        for(int j=0;j<mAllViews[i].size();j++)
        {
            if(name == mAllViews[i][j]->GetName())
            {
                mAllViews[i].erase(mAllViews[i].begin()+j);
                IncrementChangeCount(nullptr);
                break;
            }
        }
    }

    // delete contents of pointer
    for(int j=0;j<mAllViews[MASTER_VIEW].size();j++)
    {
        if(name == mAllViews[MASTER_VIEW][j]->GetName())
        {
            Element *e = mAllViews[MASTER_VIEW][j];
            delete e;
            break;
        }
    }
    PopulateRowInformation();
}
CompilerPtr CompilerLocatorCLANG::Locate(const wxString& folder)
{
    m_compilers.clear();
    wxFileName clang(folder, "clang");
#ifdef __WXMSW__
    clang.SetExt("exe");
#endif
    bool found = clang.FileExists();
    if ( ! found ) {
        // try to see if we have a bin folder here
        clang.AppendDir("bin");
        found = clang.FileExists();
    }
    
    if ( found ) {
        CompilerPtr compiler( new Compiler(NULL) );
        compiler->SetCompilerFamily(COMPILER_FAMILY_CLANG);
        // get the compiler version
        compiler->SetName( GetCompilerFullName(clang.GetFullPath() ) );
        compiler->SetGenerateDependeciesFile(true);
        m_compilers.push_back( compiler );
        clang.RemoveLastDir();
        AddTools(compiler, clang.GetPath());
        
        // Update the toolchain (if Windows)
#ifdef __WXMSW__
        CompilerPtr defaultMinGWCmp = BuildSettingsConfigST::Get()->GetDefaultCompiler(COMPILER_FAMILY_MINGW);
        if ( defaultMinGWCmp ) {
            compiler->SetTool("MAKE", defaultMinGWCmp->GetTool("MAKE"));
            compiler->SetTool("ResourceCompiler", defaultMinGWCmp->GetTool("ResourceCompiler"));
            
            // Update the include paths
            IncludePathLocator locator(NULL);
            wxArrayString includePaths, excludePaths;
            locator.Locate(includePaths, excludePaths, false, defaultMinGWCmp->GetTool("CXX"));
            
            // Convert the include paths to semi colon separated list
            wxString mingwIncludePaths = wxJoin(includePaths, ';');
            compiler->SetGlobalIncludePath( mingwIncludePaths );
        }
#endif
        return compiler;
    }
    return NULL;
}
Example #25
0
void xLightsFrame::RenameModelInViews(const std::string& old_name, const std::string& new_name)
{
    // renames view in the rgbeffects xml node
    for(wxXmlNode* view=ViewsNode->GetChildren(); view!=NULL; view=view->GetNext() )
    {
        wxString view_models = view->GetAttribute("models");
        wxArrayString all_models = wxSplit(view_models, ',');
        for( int model = 0; model < all_models.size(); model++ )
        {
            if( all_models[model] == old_name )
            {
                all_models[model] = new_name;
            }
        }
        view_models = wxJoin(all_models, ',');
        view->DeleteAttribute("models");
        view->AddAttribute("models", view_models);
    }
}
void CompilersDetectorManager::MSWFixClangToolChain(CompilerPtr compiler,
                                                    const ICompilerLocator::CompilerVec_t& allCompilers)
{
// Update the toolchain (if Windows)
#ifdef __WXMSW__
    ICompilerLocator::CompilerVec_t compilers;
    if(allCompilers.empty()) {
        BuildSettingsConfigCookie cookie;
        CompilerPtr cmp = BuildSettingsConfigST::Get()->GetFirstCompiler(cookie);
        while(cmp) {
            compilers.push_back(cmp);
            cmp = BuildSettingsConfigST::Get()->GetNextCompiler(cookie);
        }
    } else {
        compilers.insert(compilers.end(), allCompilers.begin(), allCompilers.end());
    }

    if(compiler->GetCompilerFamily() == COMPILER_FAMILY_CLANG) {
        for(size_t i = 0; i < compilers.size(); ++i) {
            CompilerPtr mingwCmp = compilers.at(i);
            if(mingwCmp->GetCompilerFamily() == COMPILER_FAMILY_MINGW) {
                compiler->SetTool("MAKE", mingwCmp->GetTool("MAKE"));
                compiler->SetTool("ResourceCompiler", mingwCmp->GetTool("ResourceCompiler"));

                // Update the include paths
                IncludePathLocator locator(NULL);
                wxArrayString includePaths, excludePaths;
                locator.Locate(includePaths, excludePaths, false, mingwCmp->GetTool("CXX"));

                // Convert the include paths to semi colon separated list
                wxString mingwIncludePaths = wxJoin(includePaths, ';');
                compiler->SetGlobalIncludePath(mingwIncludePaths);

                // Keep the mingw's bin path
                wxFileName mingwGCC(mingwCmp->GetTool("CXX"));
                compiler->SetPathVariable(mingwGCC.GetPath());
                break;
            }
        }
    }
#endif
}
Example #27
0
static wxString wxGetAccelText(int flags, wxKeyCode keyCode)
{
    // wxAcceleratorEntry.ToString() produces silly text
#if (wxVERSION_NUMBER >= 2901)
    const wxChar sep = '+'; // the new wx default
#else
    const wxChar sep = '-'; // the old annoying wx default
#endif
    wxArrayString as;
    if (flags & wxACCEL_CTRL)
        as.push_back(_("Ctrl"));
    if (flags & wxACCEL_ALT)
        as.push_back(_("Alt"));
    if (flags & wxACCEL_SHIFT)
        as.push_back(_("Shift"));
    switch (keyCode)
    {
        case WXK_INSERT         : as.push_back(_("Insert" )); break;
        case WXK_PAGEUP         : as.push_back(_("PgUp"   )); break;
        case WXK_PAGEDOWN       : as.push_back(_("PgDn"   )); break;
        case WXK_HOME           : as.push_back(_("Home"   )); break;
        case WXK_END            : as.push_back(_("End"    )); break;
        case WXK_RETURN         : as.push_back(_("Return" )); break;
        case WXK_DELETE         : as.push_back(_("Del"    )); break;
        case WXK_SPACE          : as.push_back(_("Space"  )); break;
        case WXK_NUMPAD_ADD     : as.push_back(_("Num+"   )); break;
        case WXK_NUMPAD_SUBTRACT: as.push_back(_("Num-"   )); break;
        case WXK_BACK           : as.push_back(_("Back"   )); break;
        default:
            if ( (keyCode >= WXK_F1) && (keyCode <= WXK_F24) )
                as.push_back(wxString::Format(wxT("F%d"), keyCode - WXK_F1 + 1));
            else
            {
                wxASSERT(keyCode >= ' ');
                as.push_back((wxChar)keyCode);
            }
            break;
    }
    return wxJoin(as, sep, 0);
}
Example #28
0
int wxSaveFileSelector(wxWindow* parent, wxFileName* fileName, const wxArrayString& extensions)
{
    const wxString filter = wxJoin(extensions, wxT('|'), 0);
    const wxString ext = wxString(wxT(".")) + fileName->GetExt();
    wxString defaultPath = GetDefaultPath(*fileName);
    wxString caption = wxGetStockLabelEx(wxID_SAVE, wxSTOCK_PLAINTEXT);
    wxFileDialog fileDialog(parent, caption, defaultPath, fileName->GetFullName(), filter, wxFD_DEFAULT_STYLE_SAVE | wxFD_CHANGE_DIR);

    if (!fileName->GetExt().empty())
        for (wxArrayString::const_iterator it = extensions.begin(); it != extensions.end(); it++)
            if (it->EndsWith(ext))
            {
                int index = (int)(it - extensions.begin());
                fileDialog.SetFilterIndex(index);
                break;
            }

    if (fileDialog.ShowModal() != wxID_OK)
        return wxNOT_FOUND;
    fileName->Assign(fileDialog.GetPath());
    return fileDialog.GetFilterIndex();
}
Example #29
0
bool wxDatabaseConfig::FindEntries(const wxString& nameORpath, dbentries& entries)
{
	if (nameORpath.empty()) return false;
	wxString path = nameORpath;
	if (path[0] != wxCONFIG_PATH_SEPARATOR)
	{
		path = m_entry.path + wxCONFIG_PATH_SEPARATOR + path; 
	}
	if (path.Contains("..") || path.Contains("."))
	{
		wxArrayString in(wxSplit(path, wxCONFIG_PATH_SEPARATOR)); 
		wxArrayString out;
		size_t count = in.GetCount();
		for (size_t n = 0; n < count; n++)
		{
			wxString name = in[n];
			if (name.IsSameAs(wxEmptyString)) continue;
			if (name == ".") continue;
			if (name == ".." && !out.empty())
			{
				out.pop_back();
				continue;
			}
			out.Add(name);
		}
		path = wxCONFIG_PATH_SEPARATOR+wxJoin(out, wxCONFIG_PATH_SEPARATOR);
	}
	if (path.IsSameAs(wxCONFIG_PATH_SEPARATOR))
	{
		dbentry root;
		SetRootPath(root);
		entries.push_back(root);
	}
	m_pStatementSqlFindEntries->SetParamString(1, path);
	m_self->ExecuteStatement(m_pStatementSqlFindEntries, &entries);
	return (entries.size() > 0);
}
Example #30
0
void SequenceElements::AddTimingToView(const std::string& timing, const std::string& name)
{
    Element* elem = GetElement(timing);
    if( elem != nullptr && elem->GetType() == "timing" )
    {
        std::string views = elem->GetViews();
        wxArrayString all_views = wxSplit(views,',');
        bool found = false;
        for( int j = 0; j < all_views.size(); j++ )
        {
            if( all_views[j] == name )
            {
                found = true;
                break;
            }
        }
        if( !found )
        {
            all_views.push_back(name);
            views = wxJoin(all_views, ',');
            elem->SetViews(views);
        }
    }
}