void EnvVarsTableDlg::OnButtonOk( wxCommandEvent& event ) { EvnVarList vars; std::map<wxString, wxString> envSets; wxString content = m_textCtrlDefault->GetText(); wxString name = wxT("Default"); content.Trim().Trim(false); envSets[name] = content; for (size_t i=1; i<m_notebook1->GetPageCount(); i++) { if (i == (size_t)m_notebook1->GetSelection()) { vars.SetActiveSet(m_notebook1->GetPageText(i)); } EnvVarSetPage *page = (EnvVarSetPage*) m_notebook1->GetPage(i); wxString content = page->m_textCtrl->GetText(); wxString name = m_notebook1->GetPageText(i); content.Trim().Trim(false); envSets[name] = content; } vars.SetEnvVarSets(envSets); EnvironmentConfig::Instance()->WriteObject(wxT("Variables"), &vars); event.Skip(); }
void EnvVarsTableDlg::OnButtonOk(wxCommandEvent& event) { EvnVarList vars; std::map<wxString, wxString> envSets; wxString content = m_textCtrlDefault->GetText(); wxString name = wxT("Default"); content.Trim().Trim(false); envSets[name] = content; for(size_t i = 1; i < m_notebook1->GetPageCount(); i++) { if(i == (size_t)m_notebook1->GetSelection()) { vars.SetActiveSet(m_notebook1->GetPageText(i)); } EnvVarSetPage* page = (EnvVarSetPage*)m_notebook1->GetPage(i); wxString content = page->m_textCtrl->GetText(); wxString name = m_notebook1->GetPageText(i); content.Trim().Trim(false); envSets[name] = content; } vars.SetEnvVarSets(envSets); EnvironmentConfig::Instance()->WriteObject(wxT("Variables"), &vars); // Notify that the environment variables were modified clCommandEvent eventSave(wxEVT_ENVIRONMENT_VARIABLES_MODIFIED); EventNotifier::Get()->AddPendingEvent(eventSave); event.Skip(); }
WorkspaceSettingsDlg::WorkspaceSettingsDlg(wxWindow* parent, LocalWorkspace* localWorkspace) : WorkspaceSettingsBase(parent) , m_localWorkspace(localWorkspace) { m_ccPage = new CodeCompletionPage(m_notebook1, CodeCompletionPage::TypeWorkspace); m_notebook1->AddPage(m_ccPage, wxT("Code Completion"), false); EvnVarList vars; EnvironmentConfig::Instance()->ReadObject(wxT("Variables"), &vars); std::map<wxString, wxString> envSets = vars.GetEnvVarSets(); wxString activePage = vars.GetActiveSet(); m_choiceEnvSets->Clear(); std::map<wxString, wxString>::iterator iter = envSets.begin(); int useActiveSetIndex = m_choiceEnvSets->Append(wxGetTranslation(USE_GLOBAL_SETTINGS)); for(; iter != envSets.end(); iter++) { m_choiceEnvSets->Append(iter->first); } // select the current workspace active set name wxString activeEnvSet; wxString tmpSet = localWorkspace->GetActiveEnvironmentSet(); if(tmpSet == _("<Use Active Set>")) { tmpSet = wxGetTranslation(USE_GLOBAL_SETTINGS); } int where = m_choiceEnvSets->FindString(tmpSet); if(where == wxNOT_FOUND) { activeEnvSet = activePage; m_choiceEnvSets->SetSelection(useActiveSetIndex); } else { activeEnvSet = tmpSet; m_choiceEnvSets->SetSelection(where); } if(activeEnvSet.IsEmpty() == false) { vars.SetActiveSet(activeEnvSet); EnvironmentConfig::Instance()->SetSettings(vars); } wxString envvars = WorkspaceST::Get()->GetEnvironmentVariabels(); envvars.Trim().Trim(false); m_textCtrlWspEnvVars->SetValue(envvars); SetName("WorkspaceSettingsDlg"); WindowAttrManager::Load(this); }