long EditorConfig::GetInteger(const wxString& name, long defaultValue) { // Check the cache first std::map<wxString, long>::iterator iter = m_cacheLongValues.find(name); if(iter != m_cacheLongValues.end()) return iter->second; SimpleLongValue data; if(!ReadObject(name, &data)) { return defaultValue; } // update the cache m_cacheLongValues[name] = data.GetValue(); return data.GetValue(); }
bool EditorConfig::GetLongValue(const wxString& name, long& value) { SimpleLongValue data; if(ReadObject(name, &data)) { value = data.GetValue(); return true; } return false; }
OpenResourceDialog::OpenResourceDialog( wxWindow* parent, IManager *manager, const wxString &type, bool allowChangeType ) : OpenResourceDialogBase( parent ) , m_manager(manager) , m_type(type) , m_needRefresh(false) { m_timer = new wxTimer(this, XRCID("OR_TIMER")); m_timer->Start(500); m_listOptions->InsertColumn(0, wxT("")); m_listOptions->InsertColumn(1, wxT("")); m_listOptions->InsertColumn(2, wxT("")); m_listOptions->SetColumnWidth(0, 150); m_listOptions->SetColumnWidth(1, 300); m_listOptions->SetColumnWidth(2, 300); m_textCtrlResourceName->SetFocus(); SetLabel(wxString::Format(wxT("Open %s"), m_type.c_str())); WindowAttrManager::Load(this, wxT("OpenResourceDialog"), m_manager->GetConfigTool()); SimpleLongValue l; l.SetValue(m_checkBoxUsePartialMatching->IsChecked() ? 1 : 0); m_manager->GetConfigTool()->ReadObject(wxT("OpenResourceAllowsPartialMatch"), &l); m_checkBoxUsePartialMatching->SetValue(l.GetValue() == 1); m_choiceResourceType->SetStringSelection(m_type); if (!allowChangeType) m_choiceResourceType->Enable(false); //load all files from the workspace if ( m_manager->IsWorkspaceOpen() ) { wxArrayString projects; m_manager->GetSolution()->GetProjectList( projects ); for ( size_t i=0; i<projects.GetCount(); i++ ) { std::vector<wxFileName> fileNames; wxString errmsg; ProjectPtr p = m_manager->GetSolution()->FindProjectByName(projects.Item(i), errmsg); if ( p ) { p->GetFiles(fileNames, true); //convert std::vector to wxArrayString for ( std::vector<wxFileName>::iterator it = fileNames.begin(); it != fileNames.end(); it ++ ) { m_files.Add ( ( *it ).GetFullPath() ); } } } } m_listOptions->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( OpenResourceDialog::OnItemActivated ), NULL, this ); m_listOptions->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( OpenResourceDialog::OnItemSelected ), NULL, this ); }