89 CFieldChoicePanel::CFieldChoicePanel( wxWindow* parent,
const vector<CFieldNamePanel::EFieldType>& field_types,
bool horizontal,
bool is_pair, wxWindowID
id,
const wxPoint& pos,
const wxSize&
size,
long style )
90 : m_IsPair (is_pair), m_IsHorizontal(horizontal), m_Composed(
false), m_FieldTypes(field_types), m_Field1(
NULL), m_Field2(
NULL)
93 Create(parent, field_types, horizontal,
id, pos,
size, style);
101 bool CFieldChoicePanel::Create( wxWindow* parent,
const vector<CFieldNamePanel::EFieldType>& field_types,
bool horizontal, wxWindowID
id,
const wxPoint& pos,
const wxSize&
size,
long style )
104 CFieldNamePanel::Create( parent,
id, pos,
size, style );
109 GetSizer()->SetSizeHints(
this);
152 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
153 itemCFieldNamePanel1->SetSizer(itemBoxSizer2);
158 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxHORIZONTAL);
159 itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_LEFT|wxALL, 5);
165 itemBoxSizer4->Add(
m_FieldPicker, 0, wxALIGN_TOP|wxLEFT|wxRIGHT, 5);
168 wxArrayString field_type_strings;
228 wxCommandEvent fieldTypeEvent(wxEVT_COMMAND_UPDATE_CONSTRAINT_FIELD,
GetId());
229 fieldTypeEvent.SetEventObject(
this);
230 GetEventHandler()->ProcessEvent(fieldTypeEvent);
250 switch (field_type) {
300 if (featfield_panel) {
396 wxCommandEvent fieldTypeEvent(wxEVT_COMMAND_UPDATE_STRUCTCOMMENT_FIELD);
397 fieldTypeEvent.SetEventObject(
this);
398 GetEventHandler()->ProcessEvent(fieldTypeEvent);
476 min_width += borders;
477 min_height += borders;
479 int this_width, this_height;
482 m_Field1->GetSize(&this_width, &this_height);
483 min_width += this_width + borders;
484 this_height += borders;
485 if (this_height > min_height) {
486 min_height = this_height;
490 m_Field2->GetSize(&this_width, &this_height);
491 min_width += this_width + borders;
492 this_height += borders;
493 if (this_height > min_height) {
494 min_height = this_height;
499 m_Field1->GetSize(&this_width, &this_height);
500 min_height += this_height + borders;
501 this_width += borders;
502 if (this_width > min_width) {
503 min_width = this_width;
507 m_Field2->GetSize(&this_width, &this_height);
508 min_width += this_width + borders;
514 }
else if (min_width < 380) {
519 }
else if (min_height < 185) {
523 wxSize min_size(min_width, min_height);
524 this->SetMinClientSize(min_size);
573 vector<CFieldNamePanel::EFieldType> field_types;
578 field_types.push_back(field_type);
593 vector<string> choices;
620 field =
"RNA " + field;
641 if (pos == string::npos) {
651 tmp =
tmp.substr(field_name_str.length());
677 answer =
AutoMatch(field_name, field_type);
684 if (field_names.empty()) {
688 unsigned int unmatched = 0;
689 ITERATE(vector<string>, it, field_names) {
696 return (unmatched <= (2*field_names.size())/3);
704 switch (field_type) {
707 vector<CFieldNamePanel::EFieldType> guess_preference;
713 ITERATE(vector<CFieldNamePanel::EFieldType>, it, guess_preference) {
780 answer =
"specimen-voucher";
812 ITERATE(vector<string>, it, options) {
826 ITERATE(vector<string>, it, options) {
841 if (pos != string::npos) {
842 string feat = field_name.substr(0, pos);
843 string qual = field_name.substr(pos + 1);
847 string answer_feat =
"";
855 string answer_qual =
"";
860 answer_qual = check_qual;
874 answer = answer_feat +
" " + answer_qual;
886 string answer_rna_type =
"";
887 string remainder = field_name;
889 if (pos != string::npos) {
890 string check_rna_type = field_name.substr(0, pos);
891 ITERATE(vector<string>, it, rna_types) {
893 answer_rna_type = *it;
894 remainder = field_name.substr(pos);
900 answer_rna_type = rna_types[0];
904 string ncrna_class =
"";
905 string answer_field =
"";
907 ITERATE(vector<string>, it, rna_fields) {
909 if (remainder.length() > (*it).length()) {
910 ncrna_class = remainder.substr(0, remainder.length() - (*it).length());
917 ITERATE(vector<string>, it, rna_fields) {
925 answer = answer_rna_type;
927 answer +=
" " + ncrna_class;
929 answer +=
" " + answer_field;
941 ITERATE(vector<string>, it, field_names) {
956 ITERATE(vector<string>, it, field_names) {
970 ITERATE(vector<string>, it, field_names) {
static vector< string > GetStrings()
static vector< string > GetFieldNames()
CConfigurableItems - a static list of items that can be configured.
void GetDescriptions(vector< string > &descs, bool hierarchical=false) const
return a list of all the feature descriptions for a menu or other control.
void PopulateFeatureListbox(void)
static string AutoMatchRNA(string field_name)
string GetField2(const bool subfield=false)
static string AutoMatchFeat(string field_name)
virtual string GetFieldName(const bool subfield=false)
Returns the name of the field as selected in the panel.
bool SetFieldType(CFieldNamePanel::EFieldType field_type, bool is_pair=false)
bool IsOneFieldProteinName(void)
static bool LooksLikeHeader(const vector< string > &field_names)
~CFieldChoicePanel()
Destructor.
const vector< CFieldNamePanel::EFieldType > GetFieldTypes()
static string AutoMatch(string field_name)
bool SetOneFieldName(const string &field)
void SetSubpanelSelection(const string &sel)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
static bool ShowToolTips()
Should we show tooltips?
static string AutoMatchSrc(string field_name)
CFieldChoicePanel()
Constructors.
void OnFieldTypeChoiceSelected(wxCommandEvent &event)
static string AutoMatchMolInfo(string field_name)
static string AutoMatchMisc(string field_name)
virtual vector< string > GetChoices(bool &allow_other)
wxBoxSizer * m_FieldPicker
void CreateControls()
Creates the controls and sizers.
wxBoxSizer * m_TopFieldTypeSizer
virtual bool SetFieldName(const string &field)
void Init()
Initialises member variables.
string GetField1(const bool subfield=false)
static string AutoMatchPub(string field_name)
void IncludeComposedItems(bool show)
static string AutoMatchDBLink(string field_name)
wxBoxSizer * m_SideFieldTypeSizer
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
CFieldNamePanel * m_Field1
bool Create(wxWindow *parent, const vector< CFieldNamePanel::EFieldType > &field_types, bool horizontal, wxWindowID id=ID_CFIELDCHOICEPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSIMPLE_BORDER|wxTAB_TRAVERSAL)
Creation.
CFieldNamePanel::EFieldType GetFieldType()
CFieldNamePanel * m_Field2
static string AutoMatchCGP(string field_name)
vector< CFieldNamePanel::EFieldType > m_FieldTypes
virtual string GetFieldName(const bool subfield=false)=0
Returns the name of the field as selected in the panel.
bool x_IsParentAECRDlg(void)
virtual void SetShowLegalOnly(bool show)
virtual vector< string > GetChoices(bool &allow_other)
@ eFieldType_BankITComment
@ eFieldType_StructuredComment
virtual bool SetFieldName(const string &field)=0
static string GetFieldTypeName(EFieldType field_type)
void x_UpdateParent(void)
static EFieldType GetFieldTypeFromName(const string &field_type_name)
static vector< string > GetStrings()
static vector< string > GetFieldNames()
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)
static string NormalizePubFieldName(string orig_label)
static vector< string > GetFieldNames(bool extended=false)
static vector< string > GetRNAFields()
static vector< string > GetRNATypes()
EQualifier
List of available qualifiers for feature keys.
static const CFeatList * GetFeatList()
static CTempString GetQualifierAsString(EQualifier qual)
Convert a qualifier from an enumerated value to a string representation or empty if not found.
void SetSourceSubpanelSelection(const string &sel)
void DoNotShowSubList(bool val)
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 const string kSpecid_suffix("-specid")
wxDEFINE_EVENT(wxEVT_COMMAND_UPDATE_CONSTRAINT_FIELD, wxCommandEvent)
static const string kColl_suffix("-coll")
static const string kInst_suffix("-inst")
const char * kDefinitionLineLabel
const char * kFwdPrimerSeq
const char * kFieldTypeSeqId
const char * kFwdPrimerName
const char * kSubSourceNote
const char * kTaxnameAfterBinomial
const char * kRevPrimerName
const char * kBankITComment
const char * kRevPrimerSeq
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
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 void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
static string & ToLower(string &str)
Convert string to lower case – string& version.
@ eReverseSearch
Search in a backward direction.
@ eNocase
Case insensitive compare.
@ eCase
Case sensitive compare.
const struct ncbi::grid::netcache::search::fields::SIZE size
static const char *const strings[]
bool IsOrgColumnName(string name)
bool QualifierNamesAreEquivalent(string name1, string name2)
bool IsOrgModNoteName(const string &name)
bool IsSubSourceNoteName(const string &name)
static const char *const features[]
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)