void DIALOG_LIB_EDIT_PIN::SetStyleList( const wxArrayString& list, const BITMAP_DEF* aBitmaps )
{
    for ( unsigned ii = 0; ii < list.GetCount(); ii++ )
    {
        if( aBitmaps == NULL )
            m_choiceStyle->Append( list[ii] );
        else
            m_choiceStyle->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii );
    }
}
Example #2
0
void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos)
{
    wxListBox::DoInsertItems(items, pos);

    size_t count = items.GetCount();
    for ( size_t n = 0; n < count; n++ )
    {
        m_checks.Insert(FALSE, pos + n);
    }
}
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 Execution::RunScan(const wxArrayString& FilesToProcess,
                       const wxArrayString& Groups)
{
  // Running the scan
  m_Execute = true;
  int HeadersAdded = 0;
  m_Progress->SetRange((int)FilesToProcess.GetCount());
  for ( size_t i=0; i<FilesToProcess.GetCount(); i++ )
  {
    m_Progress->SetValue((int)i);
    if ( !m_Execute )
      return HeadersAdded;
    HeadersAdded += ProcessFile(FilesToProcess[i],Groups);
  }
  m_Progress->SetValue((int)FilesToProcess.GetCount());
  m_Execute = false;

  return HeadersAdded;
}// RunScan
Example #5
0
void AutoCompData::BuildString( wxArrayString& strings, wxString* output, wxArrayInt* index )
{
   wxASSERT( output );
   wxASSERT( index );

   strings.Sort( CmpStringNoCase );
   output->Alloc( strings.GetCount() * 10 ); // Take a guess at the size.
   index->Alloc( strings.GetCount() );

   for ( int i=0; i < strings.GetCount(); i++ )
   {
      index->Add( (int)output->Length() );
      output->Append( strings[i] );
      output->Append( ' ' );
   }

   output->RemoveLast();
   output->Shrink();
}
Example #6
0
bool CTextFile::WriteLines(const wxArrayString& lines, const wxMBConv& conv)
{
	bool result = true;

	for (size_t i = 0; i < lines.GetCount(); ++i) {
		result &= WriteLine(lines[i], conv);
	}

	return result;
}
Example #7
0
wxMenuBar::wxMenuBar(size_t n, wxMenu *menus[], const wxArrayString& titles, long WXUNUSED(style))
{
    wxASSERT( n == titles.GetCount() );

    Init();

    m_titles = titles;
    for ( size_t i = 0; i < n; i++ )
        m_menus.Append(menus[i]);
}
Example #8
0
void WinFrame::SetOutput(const wxArrayString& out, bool largeView)
{
    wxString str;

    for (std::size_t i = 0; i < out.GetCount(); ++i)
        str += out[i] + "\n";

    outCtrl_->SetValue(str);
    outCtrl_->SetFont(largeView ? *stdFont_ : *smallFont_);
}
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));
    }
}
void MusikScanNewThread::GetMusicDirs( const wxArrayString & aDirs, wxArrayString & aFiles )
{
	aFiles.Clear();
	if ( aDirs.GetCount() > 0 )
	{

		wxString sCurrPath;
		wxCommandEvent evtSetTotalFiles	( wxEVT_COMMAND_MENU_SELECTED, MUSIK_LIBRARY_THREAD_PROG );
		evtSetTotalFiles.SetInt(SET_TOTAL);
		wxCommandEvent ScanNewProgEvt	( wxEVT_COMMAND_MENU_SELECTED, MUSIK_LIBRARY_THREAD_PROG );	
		ScanNewProgEvt.SetInt(SET_CURRENT);
		wxCommandEvent evtSetNewFiles	( wxEVT_COMMAND_MENU_SELECTED, MUSIK_LIBRARY_THREAD_PROG );
		evtSetNewFiles.SetInt(SET_NEW);


		for ( size_t i = 0; i < aDirs.GetCount(); i++ )
		{
			if ( TestDestroy() )
				break;
			else 
			{
					//--- get directory ---//
				int nLastCount = aFiles.GetCount();
				GetMusicDir(  aDirs[i], aFiles );

				//--- do math ---//
				int nTotal		= aFiles.GetCount() - nLastCount;
				evtSetTotalFiles.SetExtraLong( nTotal );
				wxPostEvent( Parent(), evtSetTotalFiles );

				int nCompare	= wxGetApp().Library.GetSongDirCount( sCurrPath );
				int nResult		= nTotal - nCompare;

				//--- post update progress event ---//
				evtSetNewFiles.SetExtraLong( nResult );
				wxPostEvent( Parent(), evtSetNewFiles );
				ScanNewProgEvt.SetExtraLong(i);
				wxPostEvent( Parent(), ScanNewProgEvt );
			}
		}
	}
}
Example #11
0
bool wxWebUpdateActionExtract::SetProperties(const wxArrayString &propnames,
										const wxArrayString &propvalues)
{
	wxString flags;

	for (int i=0; i < (int)propnames.GetCount(); i++) {
		wxLogAdvMsg(wxT("wxWebUpdateActionExtract::SetProperties - name: [")
				+ propnames[i] + wxT("], value: [") + propvalues[i] + wxT("]"));

		if (propnames[i] == wxT("where"))
			m_strWhere = propvalues[i];
		else if (propnames[i] == wxT("file"))
			m_strFile = propvalues[i];
		else if (propnames[i] == wxT("type"))
			m_strType = propvalues[i];
		else if (propnames[i] == wxT("namemap"))
			m_strNameMap = propvalues[i];
		else
			wxLogAdvMsg(wxT("wxWebUpdateActionExtract::SetProperties - unknown property: ") 
						+ propnames[i]);
	}

	// do substitutions on the paths
	m_strWhere = wxWebUpdateInstaller::Get()->DoSubstitution(m_strWhere);
	
	// by default, WebUpdater executables must be extracted with the '_'
	// character prepended
	wxString str = wxWebUpdateInstaller::Get()->GetKeywordValue(wxT("updatername")) +
					wxWebUpdateInstaller::Get()->GetKeywordValue(wxT("exe"));
	m_strNameMap = str + wxT("=_") + str + wxT(",") + m_strNameMap;

	// set defaults
	if (m_strFile.IsEmpty())		// the FILE default value is $(thisfile)
		m_strFile = wxWebUpdateInstaller::Get()->GetKeywordValue(wxT("thisfile"));
	if (m_strWhere.IsEmpty())		// the WHERE default value is $(programdir)
		m_strWhere = wxWebUpdateInstaller::Get()->GetKeywordValue(wxT("programdir"));
	if (m_strType.IsEmpty())		// the TYPE default value is "zip"
		m_strType = wxT("zip");

	// validate the properties
	wxFileName f(m_strWhere), f2(m_strFile);

	// we won't do the wxFileName::FileExists check because the file we need to run
	// could be a file which does not exist yet (e.g. its in the update package)
	//
	// NOTE: wxFileName::IsDir() only checks if the given string ends with a path
	//       separator character (there are no real ways to do a ::IsDir check
	//       without trying to access that path!) and thus we won't use it
	if (m_strWhere.IsEmpty() || m_strFile.IsEmpty() || 
		!f.IsOk() || !f2.IsOk()) 
		return FALSE;

	return TRUE;
}
Example #12
0
bool SetStringListLongListInCombo(wxComboBox *cbx, const wxArrayString &strData,
  const wxArrayLong &lgData)
{
	wxUnusedVar(lgData);
	cbx->Clear();
	for (size_t i = 0; i < strData.GetCount(); ++i)
	{
		cbx->AppendString(strData.Item(i));
	}
	return true;
}
Example #13
0
void SpringUnitSync::SetCacheFile( const wxString& path, const wxArrayString& data )
{
  wxTextFile file( path );
  unsigned int arraycount = data.GetCount();
  for ( unsigned int count = 0; count < arraycount; count++ )
  {
    file.AddLine( data[count] );
  }
  file.Write();
  file.Close();
}
void ShowOutput(const wxArrayString& output)
{
    size_t count = output.GetCount();
    if ( !count )
        return;

    for ( size_t n = 0; n < count; n++ )
    {
        std::cout << output[n] << std::endl;
    }
}
Example #15
0
void wxEditableListBox::SetStrings(const wxArrayString& strings)
{
    m_listCtrl->DeleteAllItems();
    size_t i;

#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 (i = 0; i < strings.GetCount(); i++)
        m_listCtrl->InsertItem(i, strings[i]);

    m_listCtrl->InsertItem(strings.GetCount(), wxEmptyString);
    m_listCtrl->SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
void ReopenEditorListView::DoOpen(wxArrayString fnames)
{
    EditorManager* em = Manager::Get()->GetEditorManager();
    for(size_t i = 0; i < fnames.GetCount(); ++i)
    {
        if(!fnames[i].IsEmpty() && !em->IsOpen(fnames[i]))
        {
            em->Open(fnames[i]);
        }
    }
}
Example #17
0
void ItemContainerWidgetsPage::EndTest(const wxArrayString& items)
{
    const unsigned count = m_container->GetCount();

    bool ok = count == items.GetCount();
    if ( !ok )
    {
        wxFAIL_MSG(wxT("Item count does not match."));
    }
    else
    {
        for ( unsigned i = 0; i < count; ++i )
        {
            wxString str = m_container->GetString(i);
            if ( str != items[i] )
            {
                wxFAIL_MSG(wxString::Format(
                            wxT("Wrong string \"%s\" at position %d (expected \"%s\")"),
                           str.c_str(), i, items[i].c_str()));
                ok = false;
                break;
            }

            if ( m_container->HasClientUntypedData() )
            {
                void *data = m_container->GetClientData(i);
                if ( data && !VerifyClientData((wxUIntPtr)data, str) )
                {
                    ok = false;
                    break;
                }
            }
            else if ( m_container->HasClientObjectData() )
            {
                TrackedClientData* obj = (TrackedClientData*)m_container->GetClientObject(i);
                if ( obj && !VerifyClientData(obj->GetValue(), str) )
                {
                    ok = false;
                    break;
                }
            }
        }

        if ( !ok )
        {
            wxLogMessage(DumpContainerData(items));
        }
    }

    m_container->Clear();
    ok &= VerifyAllClientDataDestroyed();

    wxLogMessage(wxT("...%s"), ok ? wxT("passed") : wxT("failed"));
}
Example #18
0
///////////////////////////////////////////////////////////////////////
// Drag-and-drop functionality
//
bool DnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames)
{
	size_t nFiles = filenames.GetCount();
	EnviroFrame *frame = GetFrame();
	for ( size_t n = 0; n < nFiles; n++ )
	{
		wxString str = filenames[n];
		frame->OnDrop(str);
	}
	return TRUE;
}
void RestoreTreeState(wxTreeCtrl* tree, const wxTreeItemId& parent, wxArrayString& nodePaths, wxArrayString& selectedItemPaths)
{
    if (!parent.IsOk() || !tree)
        return;

    if (nodePaths.GetCount() == 0)
    {
        tree->Collapse(parent);
        return;
    }

    for (unsigned int i = 0; i < nodePaths.GetCount(); ++i)
        DoExpandRememberedNode(tree, parent, nodePaths[i]);

    nodePaths.Clear();
    for (unsigned int i = 0; i < selectedItemPaths.GetCount(); ++i)
        DoSelectRememberedNode(tree, tree->GetRootItem(), selectedItemPaths[i]);

    selectedItemPaths.Clear();
}
Example #20
0
void wxCheckListBox::DoSetItems(const wxArrayString& items, void **clientData)
{
    // call it first as it does DoClear()
    wxListBox::DoSetItems(items, clientData);

    size_t count = items.GetCount();
    for ( size_t n = 0; n < count; n++ )
    {
        m_checks.Add(false);
    }
}
Example #21
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 CMusikLibrary::GetFilelistSongs( const wxArrayString & aFiles, MusikSongIdArray & aReturn )
{
	aReturn.Clear();
	if(aFiles.GetCount() == 0)
        return;
	wxString sQuery = wxT("select songs.songid,songs.filename from songs where ");

	sQuery.Alloc(sQuery.Len() + aFiles.GetCount() * 30); // optimization ( the 30 is a wild guess)
    _Add_IN_ClauseForColumn(sQuery,g_PlaylistColumn[PlaylistColumn::FILENAME],aFiles);
    sQuery << wxT(";");

	myStringToMusikSongIdPtrMap theMap;
	//---------------------------------------------------------------------//
	//--- we fill the map and afterwards a array from the map because	---//
	//--- we can have multiple filenames in the same list				---//
	//---------------------------------------------------------------------//
    MusikDb::ResultCB cb(&theMap, &db_callbackAddToSongIdMap);
    m_pDB->Exec( ConvQueryToMB( sQuery ),cb);

	aReturn.Alloc( aFiles.GetCount() );
	for ( size_t i = 0; i < aFiles.GetCount(); i++ )
	{
		MusikSongId * pSongid = theMap[ aFiles.Item( i ) ];
	//	wxASSERT_MSG( pSong, wxString(aFiles.Item( i ) + wxT( " is not on the map!" ) ) );

		//---------------------------------------------------------------------//
		//--- add the object(of the map) by value, to create duplicate		---// 
		//--- entries if needed.											---//
		//---------------------------------------------------------------------//
		if( pSongid )
			aReturn.Add( *pSongid ); 
	}

	//-------------------------------------------------------------------------//
	//--- delete all map objects( this is done explicitly, because the map	---//
	//--- contains pointers to objects)										---//
	//-------------------------------------------------------------------------//
	WX_CLEAR_HASH_MAP(myStringToMusikSongIdPtrMap, theMap); 

	return;
}
Example #23
0
void ParseThread::ParseAndStoreFiles(ParseRequest* req, const wxArrayString& arrFiles, int initalCount, ITagsStoragePtr db)
{
	// Loop over the files and parse them
	int totalSymbols (0);
	DEBUG_MESSAGE(wxString::Format(wxT("Parsing and saving files to database....")));
	for (size_t i=0; i<arrFiles.GetCount(); i++) {

		// give a shutdown request a chance
		TEST_DESTROY();

		wxString tags;  // output
		TagsManagerST::Get()->SourceToTags(arrFiles.Item(i), tags);

		if ( tags.IsEmpty() == false ) {
			DoStoreTags(tags, arrFiles.Item(i), totalSymbols, db);
		}
	}

	DEBUG_MESSAGE(wxString(wxT("Done")));

	// Update the retagging timestamp
	TagsManagerST::Get()->UpdateFilesRetagTimestamp(arrFiles, db);

	if ( req->_evtHandler ) {
		wxCommandEvent e(wxEVT_PARSE_THREAD_MESSAGE);
		wxString message;
		if(initalCount != -1)
			message << wxT("INFO: Found ") << initalCount << wxT(" system include files. ");
		message << arrFiles.GetCount() << wxT(" needed to be parsed. Stored ") << totalSymbols << wxT(" new tags to the database");

		e.SetClientData(new wxString(message.c_str()));
		req->_evtHandler->AddPendingEvent( e );

		// if we added new symbols to the database, send an even to the main thread
		// to clear the tags cache
		if(totalSymbols) {
			wxCommandEvent clearCacheEvent(wxEVT_PARSE_THREAD_CLEAR_TAGS_CACHE);
			req->_evtHandler->AddPendingEvent(clearCacheEvent);
		}
	}
}
Example #24
0
int ConvertWXArrayToC(const wxArrayString& aChoices, wxString **choices)
{
    int n = aChoices.GetCount();
    *choices = new wxString[n];

    for ( int i = 0; i < n; i++ )
    {
        (*choices)[i] = aChoices[i];
    }

    return n;
}
Example #25
0
// Joins a list of strings into one larger string, using the given string concatenation
// character as a separator.  If you want to be able to split the string later then the
// concatenation string needs to be a single character.
//
// Note: wxWidgets 2.9 / 3.0 has a wxJoin function, but we're using 2.8 so I had to make
// my own.
wxString JoinString( const wxArrayString& src, const wxString& separator )
{
	wxString dest;
	for( int i=0, len=src.GetCount(); i<len; ++i )
	{
		if( src[i].IsEmpty() ) continue;
		if( !dest.IsEmpty() )
			dest += separator;
		dest += src[i];
	}
	return dest;
}
Example #26
0
void wxSTEInitComboBoxStrings(const wxArrayString& values, wxComboBox* combo)
{
    wxCHECK_RET(combo, wxT("Invalid combobox in wxSTEditorFindReplaceDialog::InitComboBoxStrings"));

    combo->Clear();

    for (size_t n = 0; n < values.GetCount(); n++)
        combo->Append(values[n]);

    if (combo->GetCount() > 0)
        combo->SetSelection(0);
}
Example #27
0
void LocalWorkspace::SetParserPaths(const wxArrayString& inclduePaths, const wxArrayString& excludePaths)
{
    if(!SanityCheck()) return;

    wxXmlNode* workspaceInclPaths = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), wxT("WorkspaceParserPaths"));
    if(workspaceInclPaths) {
        m_doc.GetRoot()->RemoveChild(workspaceInclPaths);
        delete workspaceInclPaths;
    }
    workspaceInclPaths = new wxXmlNode(m_doc.GetRoot(), wxXML_ELEMENT_NODE, wxT("WorkspaceParserPaths"));
    for(size_t i = 0; i < inclduePaths.GetCount(); i++) {
        wxXmlNode* child = new wxXmlNode(workspaceInclPaths, wxXML_ELEMENT_NODE, wxT("Include"));
        child->AddProperty(wxT("Path"), inclduePaths.Item(i));
    }

    for(size_t i = 0; i < excludePaths.GetCount(); i++) {
        wxXmlNode* child = new wxXmlNode(workspaceInclPaths, wxXML_ELEMENT_NODE, wxT("Exclude"));
        child->AddProperty(wxT("Path"), excludePaths.Item(i));
    }
    SaveXmlFile();
}
Example #28
0
static bool projectinfo_match(const wxString& path, const wxArrayString& includes, const wxArrayString& excludes) {
	if (!includes.IsEmpty()) {
		bool doInclude = false;
		for (unsigned int i = 0; i < includes.GetCount(); ++i) {
			if (wxMatchWild(includes[i], path, false)) {
				doInclude = true;
				break;
			}
		}

		if (!doInclude) return false;
	}

	for (unsigned int i = 0; i < excludes.GetCount(); ++i) {
		if (wxMatchWild(excludes[i], path, false)) {
			return false;
		}
	}

	return true;
}
void CMusikLibrary::GetSongs( const wxArrayString & aList, const PlaylistColumn & Column, MusikSongIdArray & aReturn )
{
	aReturn.Clear();
	wxString sInfo;
	aReturn.Alloc(GetSongCount()); // optimize item adding performance,
  	wxString sQuery;
  
	sQuery.Alloc(sQuery.Len() + 30 + aList.GetCount() * 30); // optimization ( the 30 is a wild guess)
    _Add_IN_ClauseForColumn(sQuery,Column,aList);
	QuerySongsWhere( sQuery, aReturn,true); // query sorted
	return;
}
Example #30
0
void SlideShow::LoadImages(wxArrayString images, bool deleteRead)
{
  m_size = images.GetCount();

  for (int i = 0; i < m_size; i++)
  {
    Image *image = new Image(m_configuration, images[i], deleteRead, m_fileSystem);
    m_images.push_back(image);
  }
  m_fileSystem = NULL;
  m_displayed = 0;
}