Exemplo n.º 1
0
void EditConfigurationDialog::RenameConfiguration(const wxString &oldName, const wxString &newName)
{
	ProjectSettingsPtr settings = ManagerST::Get()->GetProjectSettings(m_projectName);
	if(settings){
		BuildConfigPtr bldConf = settings->GetBuildConfiguration(oldName);
		if(bldConf){
			settings->RemoveConfiguration(oldName);
			bldConf->SetName(newName);
			settings->SetBuildConfiguration(bldConf);
			//save changes
			ManagerST::Get()->SetProjectSettings(m_projectName, settings);

			//update the control
			m_configurationsList->Clear();
			ProjectSettingsCookie cookie;
			BuildConfigPtr bldConf = settings->GetFirstBuildConfiguration(cookie);
			while(bldConf){
				m_configurationsList->Append(bldConf->GetName());
				bldConf = settings->GetNextBuildConfiguration(cookie);
			}
			if(m_configurationsList->GetCount()>0)
				m_configurationsList->SetSelection(0);
		}
	}
}
Exemplo n.º 2
0
void EditConfigurationDialog::OnButtonDelete(wxCommandEvent &event)
{
	wxUnusedVar(event);
	wxString selection = m_configurationsList->GetStringSelection() ;
	if(selection.IsEmpty()){
		return;
	}
	wxString msg(wxT("Remove configuration '"));
	msg << selection << wxT("' ?");
	if(wxMessageBox(msg, wxT("Confirm"), wxYES_NO | wxCANCEL | wxICON_QUESTION) == wxYES){
		ProjectSettingsPtr settings = ManagerST::Get()->GetProjectSettings(m_projectName);
		if(settings){
			settings->RemoveConfiguration(selection);
			m_configurationsList->Delete(m_configurationsList->GetSelection());
			if(m_configurationsList->GetCount()>0)
				m_configurationsList->SetSelection(0);
			
			//save changes
			ManagerST::Get()->SetProjectSettings(m_projectName, settings);
		}
	}
}