bool wxExVCS::GetDir(wxWindow* parent) { if (!Use()) { return false; } const wxString message = _("Select VCS Folder"); std::vector<wxExConfigItem> v; // See also vcsentry, same item is used there. v.push_back(wxExConfigItem( _("Base folder"), CONFIG_COMBOBOXDIR, wxEmptyString, true, 1005)); if (wxExConfigFirstOf(_("Base folder")).empty()) { if ( parent != NULL && wxExConfigDialog(parent, v, message).ShowModal() == wxID_CANCEL) { return false; } } else { m_Entry = FindEntry(wxExConfigFirstOf(_("Base folder"))); if (m_Entry.GetName().empty()) { if ( parent != NULL && wxExConfigDialog(parent, v, message).ShowModal() == wxID_CANCEL) { return false; } } } m_Entry = FindEntry(wxExConfigFirstOf(_("Base folder"))); return !m_Entry.GetName().empty(); }
int wxExFrameWithHistory::FindInFilesDialog( int id, bool add_in_files) { if (GetSTC() != NULL) { GetSTC()->GetFindString(); } std::vector<wxExConfigItem> v; v.push_back(wxExConfigItem( wxExFindReplaceData::Get()->GetTextFindWhat(), CONFIG_COMBOBOX, wxEmptyString, true)); if (add_in_files) { v.push_back(wxExConfigItem( m_TextInFiles, CONFIG_COMBOBOX, wxEmptyString, true)); } if (id == ID_TOOL_REPORT_REPLACE) { v.push_back(wxExConfigItem( wxExFindReplaceData::Get()->GetTextReplaceWith(), CONFIG_COMBOBOX)); } v.push_back(wxExConfigItem(wxExFindReplaceData::Get()->GetInfo())); if (wxExConfigDialog(this, v, GetFindInCaption(id)).ShowModal() == wxID_CANCEL) { return wxID_CANCEL; } wxLogStatus( wxExFindReplaceData::Get()->GetFindReplaceInfoText( id == ID_TOOL_REPORT_REPLACE)); return wxID_OK; }
int wxExHeader::ShowDialog(wxWindow* parent, const wxString& title) const { std::vector<wxExConfigItem> v; // Purpose is required. v.push_back( wxExConfigItem( m_TextPurpose, wxEmptyString, wxEmptyString, wxTE_MULTILINE, CONFIG_STRING, true)); // Author is required, but only presented if empty. // Email and License also are only presented if Author empty. if (wxConfigBase::Get()->Read(m_TextAuthor).empty()) { v.push_back(wxExConfigItem( m_TextAuthor, wxEmptyString, wxEmptyString, 0, CONFIG_STRING, true)); if (wxConfigBase::Get()->Read(m_TextEmail).empty()) { v.push_back(wxExConfigItem(m_TextEmail)); } if (wxConfigBase::Get()->Read(m_TextLicense).empty()) { v.push_back(wxExConfigItem(m_TextLicense)); } } return wxExConfigDialog( parent, v, title).ShowModal(); }
int wxExVCS::ConfigDialog( wxWindow* parent, const wxString& title, bool modal) const { if (m_Entries.empty()) { return wxID_CANCEL; } std::map<long, const wxString> choices; choices.insert(std::make_pair((long)VCS_NONE, _("None"))); // Using auto vcs is not useful if we only have one vcs. if (m_Entries.size() != 1) { choices.insert(std::make_pair((long)VCS_AUTO, "Auto")); } long i = VCS_START; for ( #ifdef wxExUSE_CPP0X auto it = m_Entries.begin(); #else std::vector<wxExVCSEntry>::const_iterator it = m_Entries.begin(); #endif it != m_Entries.end(); ++it) { choices.insert(std::make_pair(i, it->GetName())); i++; } // Estimate number of columns used by the radiobox. int cols = 5; switch (choices.size()) { case 6: case 11: cols = 3; break; case 7: case 8: case 12: case 16: cols = 4; break; } std::vector<wxExConfigItem> v; v.push_back(wxExConfigItem( "VCS", choices, true, // use a radiobox wxEmptyString, cols)); for ( #ifdef wxExUSE_CPP0X auto it2 = m_Entries.begin(); #else std::vector<wxExVCSEntry>::const_iterator it2 = m_Entries.begin(); #endif it2 != m_Entries.end(); ++it2) { v.push_back(wxExConfigItem(it2->GetName(), CONFIG_FILEPICKERCTRL)); } if (modal) { return wxExConfigDialog(parent, v, title).ShowModal(); } else { wxExConfigDialog* dlg = new wxExConfigDialog(parent, v, title); return dlg->Show(); } }