void DirectoryParamsPanel::SetSearchHistory(const wxArrayString& searchDirs, const wxArrayString& searchMasks)
{
    for (wxArrayString::const_iterator it = searchDirs.begin(); it != searchDirs.end(); ++it)
    {
        if (!it->empty())
            m_pSearchDirPath->Append(*it);
    }
    for (wxArrayString::const_iterator it = searchMasks.begin(); it != searchMasks.end(); ++it)
    {
        if (!it->empty())
            m_pMask->Append(*it);
    }
}
Пример #2
0
bool Config::setValue(const wxString& key, const wxArrayString& value)
{
    wxString s;
    for (wxArrayString::const_iterator it = value.begin(); it != value.end();
        it++)
    {
        if (it != value.begin())
            s += ",";
        // this is just a parachute, if this should ever be triggered we
        // will need to quote and unquote this wxString or all in value
        wxASSERT((*it).find(',') == wxString::npos);
        s += *it;
    }
    return setValue(key, s);
}
Пример #3
0
void Project::SetExcludeConfigForFile(const wxString& filename, const wxString& virtualDirPath, const wxArrayString& configs)
{
    wxXmlNode *vdNode = GetVirtualDir(virtualDirPath);
    if ( !vdNode ) {
        return ;
    }
    
    // locate our file
    wxFileName tmp(filename);
    tmp.MakeRelativeTo(m_fileName.GetPath());
    wxString filepath = tmp.GetFullPath(wxPATH_UNIX);
    wxXmlNode *fileNode = XmlUtils::FindNodeByName(vdNode, "File", filepath);
    if ( !fileNode ) {
        return ;
    }
    
    // Make sure the list is unique
    wxStringSet_t unique_set;
    unique_set.insert(configs.begin(), configs.end());
    wxArrayString uniqueArr;
    wxStringSet_t::iterator iter = unique_set.begin();
    for( ; iter != unique_set.end(); ++iter ) {
        uniqueArr.Add( *iter );
    }
    
    wxString excludeConfigs = ::wxJoin(uniqueArr, ';');
    XmlUtils::UpdateProperty(fileNode, EXCLUDE_FROM_BUILD_FOR_CONFIG, excludeConfigs );
    SaveXmlFile();
}
Пример #4
0
bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)
{
    GtkEntry* const entry = (GtkEntry*)GetEditable();
    wxCHECK_MSG(GTK_IS_ENTRY(entry), false, "auto completion doesn't work with this control");

    GtkListStore * const store = gtk_list_store_new(1, G_TYPE_STRING);
    GtkTreeIter iter;

    for ( wxArrayString::const_iterator i = choices.begin();
          i != choices.end();
          ++i )
    {
        gtk_list_store_append(store, &iter);
        gtk_list_store_set(store, &iter,
                           0, (const gchar *)i->utf8_str(),
                           -1);
    }

    GtkEntryCompletion * const completion = gtk_entry_completion_new();
    gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(store));
    gtk_entry_completion_set_text_column(completion, 0);
    gtk_entry_set_completion(entry, completion);
    g_object_unref(completion);
    return true;
}
Пример #5
0
bool ModEditWindow::JarModsDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
{
	int flags = wxLIST_HITTEST_ONITEM;
	
	long index = 0;
	
	if (m_owner->GetItemCount() > 0)
	{
		index = m_owner->HitTest(wxPoint(x, y), flags);
	}
	
	m_owner->SetInsertMark(-1);
	
	for (wxArrayString::const_iterator iter = filenames.begin(); iter != filenames.end(); iter++)
	{
		// just skip the dirs here...
		if(wxFileName::DirExists(*iter))
			continue;
		wxFileName modFileName(*iter);
		m_inst->GetModList()->InsertMod(index, modFileName.GetFullPath());
		m_owner->UpdateItems();
	}

	return true;
}
Пример #6
0
wxArrayString ArrayVariableProperty::get_valid(const wxArrayString& val) {
	std::set<wxString> set = get_set(dataset_vars_);
	wxArrayString ret;
	for (wxArrayString::const_iterator it = val.begin(); it != val.end(); it++)
		if (set.find(*it) != set.end()) ret.Add(*it);
	return ret;
}
Пример #7
0
wxArrayString
wxGridCellAutoWrapStringRenderer::GetTextLines(wxGrid& grid,
                                               wxDC& dc,
                                               const wxGridCellAttr& attr,
                                               const wxRect& rect,
                                               int row, int col)
{
    dc.SetFont(attr.GetFont());
    const wxCoord maxWidth = rect.GetWidth();

    // Transform logical lines into physical ones, wrapping the longer ones.
    const wxArrayString
        logicalLines = wxSplit(grid.GetCellValue(row, col), '\n', '\0');

    wxArrayString physicalLines;
    for ( wxArrayString::const_iterator it = logicalLines.begin();
          it != logicalLines.end();
          ++it )
    {
        const wxString& line = *it;

        if ( dc.GetTextExtent(line).x > maxWidth )
        {
            // Line does not fit, break it up.
            BreakLine(dc, line, maxWidth, physicalLines);
        }
        else // The entire line fits as is
        {
            physicalLines.push_back(line);
        }
    }

    return physicalLines;
}
Пример #8
0
GameDatabaseListView& GameDatabaseListView::SortBy( GameDataColumnId column )
{
    const bool isDescending = false;

    wxArrayString::iterator begin	= m_GamesInView.begin();
    wxArrayString::iterator end		= m_GamesInView.end();

    // Note: std::sort does not pass predicate instances by reference, which means we can't use
    // object polymorphism to simplify the code below. --air

    switch( column )
    {
    case GdbCol_Serial:
        std::sort(begin, end, GLSort_bySerial(isDescending));
        break;
    case GdbCol_Title:
        std::sort(begin, end, GLSort_byTitle(isDescending));
        break;
    case GdbCol_Region:
        std::sort(begin, end, GLSort_byRegion(isDescending));
        break;
    case GdbCol_Compat:
        std::sort(begin, end, GLSort_byCompat(isDescending));
        break;
    case GdbCol_Patches:
        std::sort(begin, end, GLSort_byPatches(isDescending));
        break;

    default:
        break; // for GdbCol_Count
    }
    //m_GamesInView.(  );

    return *this;
}
Пример #9
0
void SearchThread::GetFiles(const SearchData* data, wxArrayString& files)
{
    std::set<wxString> scannedFiles;

    const wxArrayString& rootDirs = data->GetRootDirs();
    files = data->GetFiles();

    // Remove files that do not match our search criteria
    FilterFiles(files, data);

    // Populate "scannedFiles" with list of files to scan
    scannedFiles.insert(files.begin(), files.end());

    for(size_t i = 0; i < rootDirs.size(); ++i) {
        // make sure it's really a dir (not a fifo, etc.)
        DirTraverser traverser(data->GetExtensions());
        wxDir dir(rootDirs.Item(i));
        dir.Traverse(traverser);
        wxArrayString& someFiles = traverser.GetFiles();

        for(size_t j = 0; j < someFiles.Count(); ++j) {
            if(scannedFiles.count(someFiles.Item(j)) == 0) {
                files.Add(someFiles.Item(j));
                scannedFiles.insert(someFiles.Item(j));
            }
        }
    }

    files.clear();
    std::for_each(scannedFiles.begin(), scannedFiles.end(), [&](const wxString& file) { files.Add(file); });
}
Пример #10
0
void ParamsDialog::display_invalid_params(const wxArrayString& params) {
	if (params.empty()) return;
	wxString msg = "The following parameters are invalid.\n";
	wxArrayString::const_iterator it;
	for (it = params.begin(); it != params.end(); it++) msg += '\n' + *it;
	wxMessageBox(msg, "Error", wxICON_ERROR);
}
Пример #11
0
const std::set<wxString> ArrayVariableProperty::get_set(
		const wxArrayString& val) const {
	std::set<wxString> ret;
	for (wxArrayString::const_iterator it = val.begin(); it != val.end(); it++)
		ret.emplace(*it);
	return ret;
}
Пример #12
0
bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)
{
    GtkEntry* const entry = (GtkEntry*)GetEditable();
    wxCHECK_MSG(GTK_IS_ENTRY(entry), false, "auto completion doesn't work with this control");

    GtkListStore * const store = gtk_list_store_new(1, G_TYPE_STRING);
    GtkTreeIter iter;

#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    for ( wxArrayString::const_iterator i = choices.begin();
          i != choices.end();
          ++i )
    {
        gtk_list_store_append(store, &iter);
        gtk_list_store_set(store, &iter,
                           0, (const gchar *)i->utf8_str(),
                           -1);
    }

    GtkEntryCompletion * const completion = gtk_entry_completion_new();
    gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(store));
    gtk_entry_completion_set_text_column(completion, 0);
    gtk_entry_set_completion(entry, completion);
    g_object_unref(completion);
    return true;
}
Пример #13
0
wxCoord
ClueListBox::OnMeasureItem(size_t n) const
{
    XPuzzle::Clue clue = GetItem(n);

    // Cache the wrapped clue's text if it isn't already
    if (m_cachedClues.at(n).empty())
    {
        int maxWidth;
        GetClientSize(&maxWidth, NULL);
        m_cachedClues.at(n) = Wrap(this, clue.Text(),
                                   maxWidth - m_numWidth - GetMargins().x);
    }

    int height = 0;
    const wxArrayString lines = wxStringTokenize(m_cachedClues.at(n), _T("\n"));
    for (wxArrayString::const_iterator it = lines.begin();
         it != lines.end();
         ++it)
    {
        int lineHeight;
        GetTextExtent(*it, NULL, &lineHeight);
        height += lineHeight;
    }

    return height;
}
Пример #14
0
void SearchThread::GetFiles(const SearchData* data, wxArrayString& files)
{
    wxStringSet_t scannedFiles;

    const wxArrayString& rootDirs = data->GetRootDirs();
    files = data->GetFiles();

    // Populate "scannedFiles" with list of files to scan
    scannedFiles.insert(files.begin(), files.end());

    for(size_t i = 0; i < rootDirs.size(); ++i) {
        // make sure it's really a dir (not a fifo, etc.)
        clFilesScanner scanner;
        std::vector<wxString> filesV;
        if(scanner.Scan(rootDirs.Item(i), filesV, data->GetExtensions())) {
            std::for_each(filesV.begin(), filesV.end(), [&](const wxString& file) { scannedFiles.insert(file); });
        }
    }

    files.clear();
    files.Alloc(scannedFiles.size());
    std::for_each(scannedFiles.begin(), scannedFiles.end(), [&](const wxString& file) { files.Add(file); });

    // Filter all non matching files
    FilterFiles(files, data);
}
Пример #15
0
void FindReplaceData::SetSearchPaths(const wxArrayString& searchPaths)
{
    // filter duplicate items
    wxStringSet_t paths;
    paths.insert(searchPaths.begin(), searchPaths.end());
    m_searchPaths.clear();
    std::for_each(paths.begin(), paths.end(), [&](const wxString& path) { m_searchPaths.Add(path); });
}
Пример #16
0
/**
 * @brief Joins array of strings into single string.
 *
 * @param array Input array.
 *
 * @return Result string.
 */
static wxString CreateHtml(const wxArrayString& array)
{
    wxString result;

    for (wxArrayString::const_iterator it = array.begin(), ite = array.end(); it != ite; ++it) {
        if (it != array.begin()) {
            result += "<br />";
        }
        wxString esc = *it;
        // Escape
        esc.Replace("<", "&lt;");
        esc.Replace(">", "&gt;");
        result += esc;
    }

    return result;
}
Пример #17
0
bool SaveMgrWindow::SaveListDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
{
	for (wxArrayString::const_iterator iter = filenames.begin(); iter != filenames.end(); iter++)
	{
		m_owner->AddSaveFromPath(*iter);
	}
	return true;
}
Пример #18
0
void ArrayVariableProperty::write_cache(const wxArrayString& val) const {
	const wxString name = GetLabel();
	const wxString dir = boost::filesystem::current_path().string();
	const wxString pathname = dir + '/' + name + ".csv";;
	std::fstream fs(pathname.c_str(), std::fstream::out);
	for (wxArrayString::const_iterator it = val.begin(); it != val.end(); it++)
		fs << enquote(*it) << std::endl;
	fs.close();
}
Пример #19
0
	bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
	{
		ReplayProvider* provider = static_cast<ReplayDataModel*>(m_dataViewCtrl->GetModel())->GetProvider();
		bool filesAccepted = false;

		for (auto filename = filenames.begin(); filename != filenames.end(); ++filename)
		{
			if (provider->Import(*filename))
				filesAccepted = true;
		}

		return filesAccepted;
	}
Пример #20
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();
}
Пример #21
0
void SearchThread::FilterFiles(wxArrayString& files, const SearchData* data)
{
    wxArrayString tmpFiles;
    std::set<wxString> uniqueFiles;
    const wxString& mask = data->GetExtensions();
    std::for_each(files.begin(), files.end(), [&](wxString& filename) {
        if(uniqueFiles.count(filename)) return;
        uniqueFiles.insert(filename);
        if(FileUtils::WildMatch(mask, filename)) {
            tmpFiles.Add(filename);
        }
    });
    files.swap(tmpFiles);
}
Пример #22
0
bool ModEditWindow::MLModsDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
{
	for (wxArrayString::const_iterator iter = filenames.begin(); iter != filenames.end(); ++iter)
	{
		wxFileName dest(Path::Combine(m_inst->GetMLModsDir().GetFullPath(), *iter));
		wxCopyFile(*iter, dest.GetFullPath());
	}
	
	auto mllist = m_inst->GetMLModList();
	mllist->UpdateModList();
	m_owner->UpdateItems();

	return true;
}
Пример #23
0
void CodeCompletionManager::OnFindUsingNamespaceDone(const wxArrayString& usingNamespace, const wxString& filename)
{
    CL_DEBUG("OnFindUsingNamespaceDone called");

    CL_DEBUG("Found the following 'using namespace' statements for file %s", filename);
    CL_DEBUG_ARR(usingNamespace);

    // We got a list of macros from the parser thead
    // prepare a space delimited list out of it
    std::vector<wxString> additionalScopes;
    additionalScopes.insert(additionalScopes.end(), usingNamespace.begin(), usingNamespace.end());

    LanguageST::Get()->UpdateAdditionalScopesCache(filename, additionalScopes);
}
Пример #24
0
void wxExOpenFiles(
    wxExFrame* frame,
    const wxArrayString& files,
    long file_flags,
    int dir_flags)
{
    // std::vector gives compile error.
    for (
#ifdef wxExUSE_CPP0X
        auto it = files.begin();
#else
        wxArrayString::const_iterator it = files.begin();
#endif
        it != files.end();
        it++)
    {
        wxString file = *it; // cannot be const because of file = later on

        if (file.Contains("*") || file.Contains("?"))
        {
            wxExDirOpenFile dir(frame, wxGetCwd(), file, file_flags, dir_flags);
            dir.FindFiles();
        }
        else
        {
            int line = 0;

            if (!wxFileName(file).FileExists() && file.Contains(":"))
            {
                line = atoi(file.AfterFirst(':').c_str());
                file = file.BeforeFirst(':');
            }

            frame->OpenFile(file, line, wxEmptyString, file_flags);
        }
    }
}
Пример #25
0
void FileDriveManagerState::insertElements(const wxArrayString& filenames, long position)
{
    wxTextFile file(m_data.getPath());
    if (!file.Exists() || !file.Open())
        return;

    if (-1 == position)
        position = file.GetLineCount();

    const long startPosition = 1;

    for (wxArrayString::const_iterator iter = filenames.begin(); iter != filenames.end(); ++iter, ++position)
        file.InsertLine(*iter, position + startPosition);

    file.Write();
    file.Close();
    fillExplorerList();
}
Пример #26
0
// assertion - adds some information about the test that failed
//
void RegExTestCase::fail(const wxString& msg) const
{
    wxString str;
    wxArrayString::const_iterator it;

    str << (wxChar)m_mode << _T(" ") << m_id << _T(" ") << m_flags << _T(" ")
        << quote(m_pattern) << _T(" ") << quote(m_data);

    for (it = m_expected.begin(); it != m_expected.end(); ++it)
        str << _T(" ") << quote(*it);

    if (str.length() > 77)
        str = str.substr(0, 74) + _T("...");

    str << _T("\n ") << msg;

    // no lossy convs so using utf8
    CPPUNIT_FAIL(string(str.mb_str(wxConvUTF8)));
}
Пример #27
0
void DirTransitiveDataTarget::doCopyProcessing(const wxArrayString& data, const long position)
{
    if (NULL == m_dirFileManager)
        return;
    wxString destinationPath = m_directory;
    if (position >= 0 && position < m_source.GetItemCount())
    {
        wxFileName filename(m_directory, m_source.GetItemText(position));
        if (filename.Exists())
            destinationPath = filename.GetFullPath();
    }

    for (wxArrayString::const_iterator iter = data.begin(); iter != data.end(); ++iter)
    {
        const wxString& source = *iter;
        wxString destination = destinationPath + wxFileName::GetPathSeparator() + wxFileName::FileName(source).GetFullName();
        m_dirFileManager->createCopyOperation(source, destination);
    }
}
bool vvCommitCommand::ParseArguments(
	const wxArrayString& cArguments
	)
{
	// make sure we got at least one path
	if (cArguments.Count() < 1u)
	{
		wxLogError("No path(s) specified to commit from.");
		return false;
	}

	// store the given paths
	for (wxArrayString::const_iterator it = cArguments.begin(); it != cArguments.end(); ++it)
	{
		this->mcAbsolutePaths.Add(*it);
	}

	// success
	return true;
}
Пример #29
0
void ModEditWindow::CopyFiles(wxWindow *window, wxArrayString files, wxString destDir)
{
	for (wxArrayString::const_iterator iter = files.begin(); iter != files.end(); ++iter)
	{
		wxFileName source (*iter);
		wxString fileName = source.GetFullName();
		wxFileName dest(Path::Combine(destDir, fileName));
		if (wxFileName::DirExists(*iter))
		{
			// TODO make the file copy task copy the file list all in one go.
			FileCopyTask *task = new FileCopyTask(*iter, dest.GetFullPath());
			TaskProgressDialog dlg(window);
			dlg.ShowModal(task);
			delete task;
		}
		else
		{
			wxCopyFile(*iter, dest.GetFullPath());
		}
	}
}
Пример #30
0
void ClangUtils::MakePCHIfNeeded(const wxArrayString& tokens, const CXIndex& index)
{
    // Copy the tokens
    wxArrayString mytokens;
    wxString      pchfile;
    mytokens.insert(mytokens.end(), tokens.begin(), tokens.end());
    
    int where = mytokens.Index(wxT("-include-pch"));
    if(where != wxNOT_FOUND) {
        
        int pchfileIndex = where + 1;
        if(mytokens.GetCount() > pchfileIndex) {
            
            pchfile = mytokens.Item(pchfileIndex);
            mytokens.RemoveAt(where, 2);
            
        } else {
            // Invalid tokens
            // Found -include-pch but not the actual pch file...
            return;
        }
        
        // At this point, pchfile contains the file that we should create for faster code-completion
        // Now we simply test to see if this file exists
        wxFileName filename(pchfile);
        wxFileName filename_h(pchfile);
        
        filename.SetExt(wxT("clang-pch"));
        
        if(filename.FileExists()) {
            return;
        }
        
        // We needed to create it...
        
    }
}