Esempio n. 1
0
void PHPWorkspaceView::DoAddFilesToFolder(const wxArrayString& paths, PHPProject::Ptr_t pProject, bool notify)
{
    if(paths.IsEmpty()) return;

    CHECK_PTR_RET(pProject);

    wxString folder_path = PHPFolder::GetFolderPathFromFileFullPath(paths.Item(0), pProject->GetFilename().GetPath());
    wxTreeItemId folderItem =
        EnsureFolderExists(DoGetProjectItem(pProject->GetName()), folder_path, pProject->GetName());
    PHPFolder::Ptr_t pFolder = pProject->AddFolder(folder_path);
    CHECK_PTR_RET(pFolder);

    wxArrayString newPaths;
    for(size_t i = 0; i < paths.GetCount(); i++) {
        if(pFolder->AddFile(paths.Item(i))) {
            newPaths.Add(paths.Item(i));
        }
    }
    if(newPaths.IsEmpty()) return;

    if(notify) {
        DoAddFilesToTreeView(folderItem, pProject, pFolder, newPaths);
        // Notify the plugins
        clCommandEvent evtFilesAdded(wxEVT_PROJ_FILE_ADDED);
        evtFilesAdded.SetStrings(newPaths);
        EventNotifier::Get()->AddPendingEvent(evtFilesAdded);
    }
}
Esempio n. 2
0
wtfRenamer::wtfRenamer(const wxArrayString& files, const wxArrayString& names)
	: wxObject(),
	m_files(),
	m_names(),
	m_opts(NULL),
	m_process(),
	m_error(0),
	m_undo()
{
	wxString str;
	size_t i, cnt;

	cnt = files.GetCount();
	for (i = 0; i < cnt; i++)
	{
		str = files.Item(i);
		m_files.Add(str);
	}

	cnt = names.GetCount();
	for (i = 0; i < cnt; i++)
	{
		str = names.Item(i);
		m_names.Add(str);
	}

	m_opts = new wsdgRenamerOptions();
}
Esempio n. 3
0
void SubversionView::DoAddNode(const wxString& title, int imgId, SvnTreeData::SvnNodeType nodeType, const wxArrayString& files)
{
	wxTreeItemId root = m_treeCtrl->GetRootItem();
	wxString basePath = m_textCtrlRootDir->GetValue();

	// Add the basic four root items
	if (files.IsEmpty() == false) {

		wxTreeItemId parent = m_treeCtrl->AppendItem(root, title, imgId, imgId, new SvnTreeData(nodeType, wxT("")));

		// Set the parent node with bold font
		wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
		font.SetWeight(wxBOLD);
		m_treeCtrl->SetItemFont(parent, font);

		// Add all children items
		for (size_t i=0; i<files.GetCount(); i++) {
			wxString filename(files.Item(i));
			m_treeCtrl->AppendItem(parent, files.Item(i), DoGetIconIndex(filename), DoGetIconIndex(filename), new SvnTreeData(SvnTreeData::SvnNodeTypeFile, files.Item(i)));
		}

		if ( nodeType != SvnTreeData::SvnNodeTypeUnversionedRoot) {
			m_treeCtrl->Expand(parent);
		}
	}
}
void _Add_IN_ClauseForColumn(wxString & query,const PlaylistColumn & Column,const wxArrayString & aList)
{
    bool bQuote = (Column.Type == PlaylistColumn::Textual);

    query << wxString::Format(Column.ColQueryMask,Column.DBName.c_str())
        << wxT(" in (");
    for ( int i = 0; i < (int)aList.GetCount(); i++ )
    {
        if ( i > 0 )
            query << wxT(',');
        if(bQuote)
        {
            query << wxT('\'');
            wxString s (aList.Item( i ));
            s.Replace( wxT("'"), wxT("''") );
            query << s;
        }
        else
            query << aList.Item( i );
        if(bQuote)
            query << wxT('\'');

    }
    query << wxT(')');
}
bool ProjectOptionsManipulator::HasOption(const wxArrayString& opt_array, const wxString& opt, wxString& full_opt)
{
  switch ( m_Dlg->GetSearchOption() )
  {
    case (ProjectOptionsManipulatorDlg::eContains):
    {
      for (size_t i=0; i<opt_array.Count(); ++i)
      {
        if ( opt_array.Item(i).Contains(opt) )
        {
          full_opt = opt_array.Item(i);
          return true;
        }
      }
    }
    break;

    case (ProjectOptionsManipulatorDlg::eEquals): // fall through
    default:
    {
      int idx = opt_array.Index(opt);
      if (idx!=wxNOT_FOUND)
      {
        full_opt = opt_array.Item(idx);
        return true;
      }
    }
    break;
  }

  return false;
}
void DbExplorerSettings::SetRecentFiles(const wxArrayString& recentFiles)
{
    m_recentFiles.Clear();
    for(size_t i=0; i<recentFiles.Count(); i++) {
        if(m_recentFiles.Index(recentFiles.Item(i)) == wxNOT_FOUND) {
            m_recentFiles.Add(recentFiles.Item(i));
        }
    }
}
Esempio n. 7
0
void PHPWorkspaceView::DoAddFilesToTreeView(const wxTreeItemId& folderId, PHPProject::Ptr_t pProject, PHPFolder::Ptr_t pFolder, const wxArrayString& files)
{
    for(size_t i=0; i<files.GetCount(); ++i) {
        ItemData *itemData = new ItemData(ItemData::Kind_File);
        itemData->SetFile( files.Item(i) );
        itemData->SetProjectName( pProject->GetName() );
        itemData->SetFolderPath( pFolder->GetPathRelativeToProject() );
        
        int imgId = DoGetItemImgIdx(files.Item(i));
        m_treeCtrlView->AppendItem(folderId, wxFileName(files.Item(i)).GetFullName(), imgId, imgId, itemData);
    }
    m_treeCtrlView->SortChildren( folderId );
}
Esempio n. 8
0
void ParseThread::SetSearchPaths(const wxArrayString& paths, const wxArrayString &exlucdePaths)
{
	wxCriticalSectionLocker locker( m_cs );
	m_searchPaths.Clear();
	m_excludePaths.Clear();
	for (size_t i=0; i<paths.GetCount(); i++) {
		m_searchPaths.Add( paths.Item(i).c_str() );
	}

	for (size_t i=0; i<exlucdePaths.GetCount(); i++) {
		m_excludePaths.Add( exlucdePaths.Item(i).c_str() );
	}
}
/// Set the list of most recently used computers.
///
/// \param[in] mru_list An array containing the names of all computers
///                     that were used recently.
void CDlgSelectComputer::SetMRUList(const wxArrayString& mru_list)
{
    m_ComputerNameCtrl->Clear();
    for (size_t i = 0; i < mru_list.Count(); ++i) {
        m_ComputerNameCtrl->Append(mru_list.Item(i));
    }
}
Esempio n. 10
0
void Project::SetDependencies(wxArrayString& deps, const wxString& configuration)
{
    // first try to locate the old node
    wxXmlNode *node = m_doc.GetRoot()->GetChildren();
    while (node) {
        if ( node->GetName() == wxT("Dependencies") && node->GetPropVal(wxT("Name"), wxEmptyString) == configuration) {
            // we have our match
            node->GetParent()->RemoveChild(node);
            delete node;
            break;
        }
        node = node->GetNext();
    }

    // create new dependencies node
    node = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("Dependencies"));
    node->AddProperty(wxT("Name"), configuration);
    m_doc.GetRoot()->AddChild(node);

    //create a node for each dependency in the array
    for (size_t i=0; i<deps.GetCount(); i++) {
        wxXmlNode *child = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("Project"));
        child->AddProperty(wxT("Name"), deps.Item(i));
        node->AddChild(child);
    }

    //save changes
    SaveXmlFile();
    SetModified(true);
}
Esempio n. 11
0
int frmHint::ShowHint(wxWindow *fr, const wxArrayString &hints, const wxString &info, bool force)
{
	wxArrayInt hintnos;
	size_t i;

	if(!hints.GetCount())
		return wxID_OK;
	for (i = 0 ; i < hints.GetCount() ; i++)
	{
		int hintNo = GetHintNo(hints.Item(i));
		if (hintNo >= 0 && (force || WantHint(hintNo)))
			hintnos.Add(hintNo);
	}

	if (!hintnos.GetCount())
		return wxID_OK;

	frmHint *frm = new frmHint(fr, force);
	frm->SetHint(hintnos, info);

	frm->CenterOnParent();
	int rc = frm->ShowModal();
	delete frm;

	if ((rc == wxID_CANCEL || rc == -1))
		rc = wxID_OK;

	return rc;
}
Esempio n. 12
0
//void wxVListBoxComboPopup::Populate( int n, const wxString choices[] )
void wxVListBoxComboPopup::Populate( const wxArrayString& choices )
{
    int i;

    int n = choices.GetCount();

    for ( i=0; i<n; i++ )
    {
        const wxString& item = choices.Item(i);
        m_strings.Add(item);
    }

    m_widths.SetCount(n,-1);
    m_widthsDirty = true;

    if ( IsCreated() )
        wxVListBox::SetItemCount(n);

    // Sort the initial choices
    if ( m_combo->GetWindowStyle() & wxCB_SORT )
        m_strings.Sort();

    // Find initial selection
    wxString strValue = m_combo->GetValue();
    if ( !strValue.empty() )
        m_value = m_strings.Index(strValue);
}
Esempio n. 13
0
bool GitCommitListDlg::IsMatchFilter(const wxArrayString& filters, const wxArrayString& columns)
{
    if(filters.IsEmpty()) return true;

    bool match = true;
    for(size_t i = 0; i < filters.GetCount() && match; ++i) {
        wxString filter = filters.Item(i).Lower();
        wxString col1, col2, col3, col4;
        col1 = columns.Item(0).Lower();
        col2 = columns.Item(1).Lower();
        col3 = columns.Item(2).Lower();
        col4 = columns.Item(3).Lower();
        match = (col1.Contains(filter) || col2.Contains(filter) || col3.Contains(filter) || col4.Contains(filter));
    }
    return match;
}
Esempio n. 14
0
/**
 * Find()
 *
 * Finds the next file descibed by a pattern in the archive, starting
 * the file given by second parameter
 *
 * @param pattern   The file-pattern to search for. May contain '*' and/or '?'
 * @param startfrom The filename which the search should start after
 * @returns         The full pathname of the found file
 */
const wxString wxChmTools::Find(const wxString& pattern,
                                const wxString& startfrom)
{
    int count;
    wxString tmp;
    wxString pattern_tmp(pattern);
    wxString startfrom_tmp(startfrom);
    pattern_tmp.MakeLower();
    startfrom_tmp.MakeLower();

    if ( m_fileNames && (count = m_fileNames->GetCount()) > 0 )
    {
        for (int i = 0; i < count; i++)
        {
            tmp = m_fileNames->Item(i).MakeLower();
            // if we find the string where the search should began
            if ( tmp.Matches(startfrom_tmp) ||
                 tmp.Mid(1).Matches(startfrom_tmp) )
                continue;
            if ( tmp.Matches(pattern_tmp) ||
                 tmp.Mid(1).Matches(pattern_tmp) )
            {
                return tmp;
            }
        }
    }

    return wxEmptyString;
}
Esempio n. 15
0
void EditorConfig::SetRecentItems(const wxArrayString& files, const wxString& nodeName)
{
    if(nodeName.IsEmpty()) { return; }

    // find the root node
    wxXmlNode* node = XmlUtils::FindFirstByTagName(m_doc->GetRoot(), nodeName);
    if(node) {
        wxXmlNode* root = m_doc->GetRoot();
        root->RemoveChild(node);
        delete node;
    }
    // create new entry in the configuration file
    node = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, nodeName);
    m_doc->GetRoot()->AddChild(node);
    for(size_t i = 0; i < files.GetCount(); i++) {
        wxXmlNode* child = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("File"));
        child->AddProperty(wxT("Name"), files.Item(i));
        node->AddChild(child);
    }

    // Update the cache
    if(m_cacheRecentItems.count(nodeName)) { m_cacheRecentItems.erase(nodeName); }
    m_cacheRecentItems.insert(std::make_pair(nodeName, files));

    // save the data to disk
    DoSave();
    wxCommandEvent evt(wxEVT_EDITOR_CONFIG_CHANGED);
    evt.SetString(nodeName);
    EventNotifier::Get()->AddPendingEvent(evt);
}
Esempio n. 16
0
void main_listctrl::paste_fullnames_as_new_separate_channels( const wxArrayString& fullnames )
{
#if ( setupUSE_DRAG_AND_DROP ) 
    plucker_controller::get()->set_is_new_update_execution_allowed( FALSE );
    
    size_t      number_of_fullnames           = fullnames.GetCount();
    size_t      current_fullname_array_index;
    wxString    current_fullname;
    
    if ( number_of_fullnames == 0 ) 
    {
        return;
    } 
    
    for ( current_fullname_array_index = 0; 
          (int)current_fullname_array_index < (int)number_of_fullnames;
          current_fullname_array_index++ ) 
    {  
          // Clear the string from the previous loop iteration
          current_fullname.Empty();
          // Append file:// to the front of the file
          current_fullname << "file://" << fullnames.Item( current_fullname_array_index );                  
          // Ship it.if it was a single pasted url
          paste_text_url_as_new_channel( current_fullname );
    }
    
    plucker_controller::get()->set_is_new_update_execution_allowed( TRUE );
#endif  // setupUSE_DRAG_AND_DROP 
}
Esempio n. 17
0
void OptionsDialog::FillCombo(wxChoice *combo, wxArrayString& items, int selectedIndex)
{
	combo->Clear();
	for (unsigned int j = 0; j < items.GetCount (); j++) {
		combo->Append (items.Item (j));
		}
	combo->SetSelection (selectedIndex);
}
Esempio n. 18
0
int
WelcomePage::DoGetPopupMenuSelection(wxCommandLinkButton* btn, const wxArrayString& strings, const wxString& menuTitle)
{
    BitmapLoader bl;
    BitmapLoader::BitmapMap_t bmps = bl.MakeStandardMimeMap();

    m_idToName.clear();
    wxUnusedVar(menuTitle);
    wxMenu menu;

    for(size_t i = 0; i < strings.GetCount(); i++) {

        wxBitmap bmp = bmps[FileExtManager::TypeText];
        wxString filename = strings.Item(i);
        if(filename.Find("@") != wxNOT_FOUND) {
            filename = filename.AfterFirst('@');
        }
        filename.Trim().Trim(false);
        FileExtManager::FileType type = FileExtManager::GetType(filename);
        if(bmps.count(type)) {
            bmp = bmps[type];
        }

        wxMenuItem* item = new wxMenuItem(&menu, wxID_ANY, strings.Item(i));
        item->SetBitmap(bmp);
        m_idToName.insert(std::make_pair(item->GetId(), strings.Item(i)));
        menu.Append(item);
    }

    // get the best position to show the menu
    wxPoint pos = btn->GetPosition();
    pos = m_scrollWin247->CalcScrolledPosition(pos);

    pos.y += btn->GetSize().y;
#ifdef __WXGTK__
    pos.y += 5;
    pos.x += 5;
#elif defined(__WXMAC__)
    pos.y += 10;
    pos.x += 10;
#else // MSW
    pos.y += 5;
    pos.x += 5;
#endif
    return GetPopupMenuSelectionFromUser(menu, pos);
}
Esempio n. 19
0
void SjCInterface::LoadModulesFastHack(SjModuleList& list, const wxArrayString& possibleDlls)
{
	size_t                  i, iCount = possibleDlls.GetCount();
	wxDynamicLibrary*       dynlib;
	dllMainEntryFuncType    entryPoint;
	SjInterface*            cinterf;
	for( i = 0; i < iCount; i++ )
	{
		// load a DLL
		{
			wxLogNull null;

			dynlib = new wxDynamicLibrary(possibleDlls[i]);
			if( dynlib == NULL )
				continue; // nothing to log - this is no SjDll

			if( !dynlib->IsLoaded() )
			{
				delete dynlib;
				continue; // nothing to log - this is no SjDll
			}

			entryPoint = (dllMainEntryFuncType)dynlib->GetSymbol(wxT("SjGetInterface"));
			if( entryPoint == NULL )
			{
				delete dynlib;
				continue; // nothing to log - this is no SjDll
			}
		}

		wxLogInfo(wxT("Loading %s"), possibleDlls.Item(i).c_str());

		cinterf = entryPoint();
		if( cinterf == NULL || cinterf->CallPlugin == NULL )
		{
			wxLogError(wxT("SjGetInterface returns 0 or CallPlugin set to 0."));
			wxLogError(_("Cannot open \"%s\"."), possibleDlls.Item(i).c_str());
			delete dynlib;
			continue; // error
		}

		// success so far - create the plugin and add it to the list
		list.Append(new SjCPlugin(this, possibleDlls[i], dynlib, cinterf));
	}
}
Esempio n. 20
0
void CppCheckSettings::SetSuppressedWarnings(wxCheckListBox* clb, const wxArrayString& keys)
{
	wxCHECK_RET(clb->GetCount() == keys.GetCount(), wxT("Mismatched counts"));
	
	m_SuppressedWarnings0.clear(); m_SuppressedWarnings1.clear();
	for (size_t n = 0; n < clb->GetCount(); ++n) {
		AddSuppressedWarning(keys.Item(n), clb->GetString(n), clb->IsChecked(n));
	}
}
Esempio n. 21
0
void PPToken::expandOnce(const wxArrayString& initList)
{
	if(initList.size() != args.size())
		return;

	for(size_t i=0; i<args.size(); i++) {
		wxString placeHolder;
		placeHolder << wxT("%") << i;
		
		wxString replaceWith = initList.Item(i);
		replaceWith.Trim().Trim(false);
		
		if(replaceWith.Contains(placeHolder))
			continue;
		
		replacement.Replace(placeHolder, initList.Item(i));
	}
}
Esempio n. 22
0
void TIniFile::WriteStringList(const wxString & Section, const wxString & Ident,
  wxArrayString Value)
{
	EraseSection(Section);
	for (int i = 0; i < Value.GetCount(); i++)
	{
		this->WriteString(Section, wxString::Format("%s%d", Ident, i),Value.Item(i));
	}
}
Esempio n. 23
0
void PHPFolder::RemoveFiles(const wxArrayString& files,
                            const wxString& projectPath,
                            wxArrayString& filesRemoved,
                            bool removeFromFileSystem)
{
    for(size_t i = 0; i < files.GetCount(); ++i) {
        if(RemoveFile(files.Item(i))) {
            wxFileName fn(projectPath, files.Item(i));
            filesRemoved.Add(fn.GetFullPath());
            
            // delete it from the file system?
            if(removeFromFileSystem) {
                wxLogNull noLog;
                ::wxRemoveFile(fn.GetFullPath());
            }
        }
    }
}
Esempio n. 24
0
bool FileDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
{
    wxUnusedVar(x);
    wxUnusedVar(y);
    for(size_t i=0; i<filenames.GetCount(); i++) {
        Frame::Get()->GetMainBook()->OpenFile(filenames.Item(i));
    }
    return true;
}
Esempio n. 25
0
void sysProcess::SetEnvironment(const wxArrayString &environment)
{
	size_t i;
	for (i = 0 ; i < environment.GetCount() ; i++)
	{
		wxString str = environment.Item(i);
		wxSetEnv(str.BeforeFirst('='), str.AfterFirst('='));
	}
}
Esempio n. 26
0
wxString TagsOptionsData::DoJoinArray(const wxArrayString& arr) const
{
    wxString s;
    for(size_t i = 0; i < arr.GetCount(); ++i) s << arr.Item(i) << "\n";

    if(s.IsEmpty() == false) s.RemoveLast();

    return s;
}
void CheckListDialog::SetChecked(wxArrayString items)
{
    size_t item = 0;
    while(item < items.GetCount())
    {
        m_checkList->Check(m_checkList->FindString(items.Item(item), true));
        item++;
    }
}
void ConnectionDialog::setPorts2( wxArrayString portlist)
{
	for (unsigned int i=0; i<portlist.GetCount();i++)
	{
		portlist2->AppendItem(portlist2->GetRootItem(),portlist.Item(i),-1,-1,NULL);
	}

	portlist2->Expand(portlist2->GetRootItem());
	portlist2->Refresh();
}
int wxArrayString_2_vector_string(  wxArrayString &in, vector<string> &out  )
{
	int count= in.GetCount();
	for(int i=0; i<count; i++)
	{
		string str(in.Item(i).mb_str());
		out.push_back(str);
	}
	return 1;
}
bool CRemoteProtocolHandler::sendCallsigns(const wxArrayString& repeaters, const wxArrayString& starNets)
{
	unsigned char* p = m_outBuffer;

	::memcpy(p, "CAL", 3U);
	p += 3U;

	for (unsigned int n = 0U; n < repeaters.GetCount(); n++) {
		*p++ = 'R';

		::memset(p, ' ' , LONG_CALLSIGN_LENGTH);
		for (unsigned int i = 0U; i < repeaters.Item(n).Len(); i++)
			p[i] = repeaters.Item(n).GetChar(i);
		p += LONG_CALLSIGN_LENGTH;
	}

	for (unsigned int n = 0U; n < starNets.GetCount(); n++) {
		*p++ = 'S';

		::memset(p, ' ' , LONG_CALLSIGN_LENGTH);
		for (unsigned int i = 0U; i < starNets.Item(n).Len(); i++)
			p[i] = starNets.Item(n).GetChar(i);
		p += LONG_CALLSIGN_LENGTH;
	}

	// CUtils::dump(wxT("Outgoing"), m_outBuffer, p - m_outBuffer);

	return m_socket.write(m_outBuffer, p - m_outBuffer, m_address, m_port);
}