void NewClassDlg::OnButtonOK(wxCommandEvent& e) { wxUnusedVar(e); if(!ValidateInput()) { return; } // Save the check boxes ticked size_t flags(0); if(m_checkBoxCopyable->IsChecked()) flags |= NewClassDlgData::NonCopyable; if(m_checkBoxImplPureVirtual->IsChecked()) flags |= NewClassDlgData::ImplAllPureVirtualFuncs; if(m_checkBoxImplVirtual->IsChecked()) flags |= NewClassDlgData::ImplAllVirtualFuncs; if(m_checkBoxInline->IsChecked()) flags |= NewClassDlgData::FileIniline; if(m_checkBoxHpp->IsChecked()) flags |= NewClassDlgData::HppHeader; if(m_checkBoxSingleton->IsChecked()) flags |= NewClassDlgData::Singleton; if(m_checkBoxVirtualDtor->IsChecked()) flags |= NewClassDlgData::VirtualDtor; NewClassDlgData data; data.SetFlags(flags); EditorConfigST::Get()->WriteObject(wxT("NewClassDlgData"), &data); EndModal(wxID_OK); }
NewClassDlg::NewClassDlg(wxWindow* parent, IManager* mgr) : NewClassBaseDlg(parent) , m_selectedItem(wxNOT_FOUND) , m_mgr(mgr) { NewClassDlgData data; EditorConfigST::Get()->ReadObject(wxT("NewClassDlgData"), &data); m_checkBoxCopyable->SetValue(data.GetFlags() & NewClassDlgData::NonCopyable); m_checkBoxImplPureVirtual->SetValue(data.GetFlags() & NewClassDlgData::ImplAllPureVirtualFuncs); m_checkBoxImplVirtual->SetValue(data.GetFlags() & NewClassDlgData::ImplAllVirtualFuncs); m_checkBoxInline->SetValue(data.GetFlags() & NewClassDlgData::FileIniline); m_checkBoxHpp->SetValue(data.GetFlags() & NewClassDlgData::HppHeader); m_checkBoxSingleton->SetValue(data.GetFlags() & NewClassDlgData::Singleton); m_checkBoxVirtualDtor->SetValue(data.GetFlags() & NewClassDlgData::VirtualDtor); m_checkBoxPragmaOnce->SetValue(data.GetFlags() & NewClassDlgData::UsePragma); // set two columns to our list m_listCtrl1->InsertColumn(0, _("Name")); m_listCtrl1->InsertColumn(1, _("Access")); m_listCtrl1->InsertColumn(2, _("File")); wxString vdPath; TreeItemInfo item = mgr->GetSelectedTreeItemInfo(TreeFileView); if(item.m_item.IsOk() && item.m_itemType == ProjectItem::TypeVirtualDirectory) { wxString path = VirtualDirectorySelectorDlg::DoGetPath(m_mgr->GetTree(TreeFileView), item.m_item, false); if(path.IsEmpty() == false) { m_textCtrlVD->ChangeValue(path); } } // set the class path to be the active project path wxString errMsg; if(m_mgr->GetWorkspace()) { wxString start_path; if(item.m_item.IsOk() && item.m_itemType == ProjectItem::TypeVirtualDirectory) { m_basePath = item.m_fileName.GetPath(wxPATH_GET_VOLUME); } else { wxString projname = m_mgr->GetWorkspace()->GetActiveProjectName(); ProjectPtr proj = m_mgr->GetWorkspace()->FindProjectByName(projname, errMsg); if(proj) { m_basePath = proj->GetFileName().GetPath(wxPATH_GET_VOLUME); } } } DoUpdateGeneratedPath(); GetSizer()->Layout(); m_textClassName->SetFocus(); GetSizer()->Fit(this); CentreOnParent(); }
void NewClassDlg::DoSaveOptions() { // Save the check boxes ticked size_t flags(0); if(m_checkBoxCopyable->IsChecked()) flags |= NewClassDlgData::NonCopyable; if(m_checkBoxImplPureVirtual->IsChecked()) flags |= NewClassDlgData::ImplAllPureVirtualFuncs; if(m_checkBoxImplVirtual->IsChecked()) flags |= NewClassDlgData::ImplAllVirtualFuncs; if(m_checkBoxInline->IsChecked()) flags |= NewClassDlgData::FileIniline; if(m_checkBoxHpp->IsChecked()) flags |= NewClassDlgData::HppHeader; if(m_checkBoxSingleton->IsChecked()) flags |= NewClassDlgData::Singleton; if(m_checkBoxVirtualDtor->IsChecked()) flags |= NewClassDlgData::VirtualDtor; if(m_checkBoxPragmaOnce->IsChecked()) flags |= NewClassDlgData::UsePragma; NewClassDlgData data; data.SetFlags(flags); EditorConfigST::Get()->WriteObject(wxT("NewClassDlgData"), &data); }