42 #include <wx/radiobox.h>
86 : m_AdditionalItems(additional_items), m_DoNotShowSubList(
false), m_is_taxonomy_panel(
false), m_first_run(
true)
100 CFieldNamePanel::Create( parent,
id, pos,
size, style );
105 GetSizer()->SetSizeHints(
this);
149 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
150 itemCFieldNamePanel1->SetSizer(itemBoxSizer2);
152 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
153 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT, 0);
155 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxVERTICAL);
156 itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_TOP|wxLEFT|wxRIGHT, 5);
164 itemBoxSizer4->Add(
m_Taxonomy, 0, wxALIGN_LEFT|wxALL, 5);
168 itemBoxSizer4->Add(
m_Location, 0, wxALIGN_LEFT|wxALL, 5);
172 itemBoxSizer4->Add(
m_Origin, 0, wxALIGN_LEFT|wxALL, 5);
174 wxArrayString m_SourceSubListStrings;
178 wxArrayString m_BioSourceTypes;
179 m_BioSourceTypes.Add(
_(
"&All"));
180 m_BioSourceTypes.Add(
_(
"&Descriptors"));
181 m_BioSourceTypes.Add(
_(
"&Features"));
184 itemBoxSizer2->Add(
m_SourceType, 0, wxGROW | wxLEFT | wxRIGHT, 5);
278 field.append(
" descriptor");
280 field.append(
" feature");
293 string field_name(field);
295 if ( descr_pos !=
NPOS) {
297 field_name = field.substr(0, descr_pos);
298 }
else if (feat_pos !=
NPOS) {
300 field_name = field.substr(0, feat_pos);
312 bool is_textqual =
false;
399 vector<string> choices;
400 choices.push_back(
"mitochondrion");
401 choices.push_back(
"chloroplast");
403 for (
auto& it : loc_values) {
404 if (it.first !=
"mitochondrion" && it.first !=
"chloroplast" && it.first !=
"unknown") {
405 choices.push_back(it.first);
413 vector<string> tf_strings;
414 tf_strings.push_back(
"true");
415 tf_strings.push_back(
"");
421 vector<string> choices;
430 bool is_true_false =
false;
458 wxArrayString choices;
467 }
catch (
const exception&) {
479 choices.push_back(
kHost);
492 }
catch (
const exception&) {
506 choices.insert(choices.begin(),
wxT(
"taxname"));
513 ITERATE (wxArrayString, it, choices) {
529 str =
"\"subtype\", \"" + field +
"\"";
531 str =
"\"org.orgname.mod\", \"" + field +
"\"";
534 str =
"\"org.orgname.mod\", \"nat-host\"";
536 str =
"\"org.db.db\"";
537 if (field ==
"taxname")
538 str =
"\"org.taxname\"";
539 if (field ==
"lineage")
540 str =
"\"org.orgname.lineage\"";
541 if (field ==
"division")
542 str =
"\"org.orgname.div\"";
544 str =
"\"org.orgname.mod\", \"other\"";
546 str =
"\"subtype\", \"other\"";
548 str =
"\"pcr-primers..forward..seq\"";
550 str =
"\"pcr-primers..reverse..seq\"";
552 str =
"\"pcr-primers..forward..name\"";
554 str =
"\"pcr-primers..reverse..name\"";
555 if (field ==
"common name")
556 str =
"\"org.common\"";
558 auto pos = field.find_last_of(
'-');
559 str = macro::CMacroFunction_StructVoucherPart::GetFuncName();
560 str +=
"(\"" + field.substr(0, pos) +
"\", \"" + field.substr(pos + 1) +
"\")";
577 if (target == macro::CMacroBioData::sm_BioSource) {
580 else if (target == macro::CMacroBioData::sm_MolInfo) {
581 str = macro::CMacroFunction_GetSeqdesc::sm_BsrcForMolinfo +
string(
"(") +
str +
")";
583 else if (target == macro::CMacroBioData::sm_StrComm || target == macro::CMacroBioData::sm_Pubdesc) {
584 str = macro::CMacroFunction_GetSeqdesc::sm_BsrcForSeqdesc +
string(
"(") +
str +
")";
586 else if (target == macro::CMacroBioData::sm_Seq || target == macro::CMacroBioData::sm_SeqNa) {
587 str = macro::CMacroFunction_GetSeqdesc::sm_BsrcForSeq +
string(
"(") +
str +
")";
590 str = macro::CMacroFunction_GetSeqdesc::sm_BsrcForFeat +
string(
"(") +
str +
")";
void x_UpdateParent(void)
static bool IsFeature(const string &target)
static bool IsValidSubtypeName(const string &str, EVocabulary vocabulary=eVocabulary_raw)
static string GetSubtypeName(TSubtype stype, EVocabulary vocabulary=eVocabulary_raw)
static TSubtype GetSubtypeValue(const string &str, EVocabulary vocabulary=eVocabulary_raw)
void SetSourceSubpanelSelection(const string &sel)
~CSourceFieldNamePanel()
Destructor.
virtual bool SetFieldName(const string &field)
static vector< string > s_GetSourceLocationOptions()
virtual vector< string > GetChoices(bool &allow_other)
virtual string GetFieldName(const bool subfield=false)
Returns the name of the field as selected in the panel.
void OnLocationBtnSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_LOCATION_BTN
wxRadioButton * m_TextQualifier
void OnTextQualBtnSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_TEXT_QUAL_BTN
@ ID_CSOURCEFIELD_ORIGIN_BTN
@ ID_CSOURCEFIELD_SRC_SUBLIST
@ ID_CSOURCEFIELD_LOCATION_BTN
@ ID_CSOURCEFIELD_TEXT_QUAL_BTN
@ ID_CSOURCEFIELD_TAXONOMY_BTN
@ ID_CSOURCEFIELD_SRCTYPES
void OnOriginBtnSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_ORIGIN_BTN
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
wxRadioButton * m_Location
CSourceFieldNamePanel()
Constructors.
wxRadioButton * m_Taxonomy
virtual string GetMacroFieldName(const string &target, const string &selected_field=kEmptyStr)
static vector< string > s_GetSourceOriginOptions()
void OnTaxonomyBtnSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_TAXONOMY_BTN
virtual void ClearValues(void)
bool Create(wxWindow *parent, wxWindowID id=ID_CSOURCEFIELDNAMEPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
wxListBox * m_SourceSubList
void CreateControls()
Creates the controls and sizers.
void x_ChooseTextQualifier()
void Init()
Initialises member variables.
wxRadioBox * m_SourceType
static bool ShowToolTips()
Should we show tooltips?
void OnSrcSublistSelected(wxCommandEvent &event)
wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_SRC_SUBLIST
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
static TSubtype GetSubtypeValue(const string &str, EVocabulary vocabulary=eVocabulary_raw)
static bool IsValidSubtypeName(const string &str, EVocabulary vocabulary=eVocabulary_raw)
static string GetSubtypeName(CSubSource::TSubtype stype, EVocabulary vocabulary=eVocabulary_raw)
static bool NeedsNoText(const TSubtype &subtype)
static bool IsDiscouraged(const TSubtype subtype)
const char * kFwdPrimerSeq
const char * kFwdPrimerName
const char * kSubSourceNote
const char * kRevPrimerName
const char * kRevPrimerSeq
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
list< pair< string, TEnumValueType > > TValues
bool IsStructVoucherPart(const string &field)
#define ENUM_METHOD_NAME(EnumName)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
NCBI_NS_STD::string::size_type SIZE_TYPE
static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
@ eSubtype_other
ASN5: old-name (254) will be added to next spec.
@ eSubtype_specimen_voucher
@ eSubtype_culture_collection
const struct ncbi::grid::netcache::search::fields::SIZE size
bool QualifierNamesAreEquivalent(string name1, string name2)
vector< string > s_GetTrueFalseList()
static const string kSpecid_suffix("-specid")
static const string kColl_suffix("-coll")
static const string kInst_suffix("-inst")
static const char * str(char *buf, int n)
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)