NCBI C++ ToolKit
field_name_panel.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: field_name_panel.cpp 45195 2020-06-16 14:58:49Z asztalos $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Colleen Bollin
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
32 ////@begin includes
33 ////@end includes
34 
38 
39 ////@begin XPM images
40 ////@end XPM images
41 
44 
45 vector<string> CFieldNamePanel::GetChoices(bool& allow_other)
46 {
47  vector<string> choices;
48  return choices;
49 }
50 
52 {
53  vector<string> values;
54  return values;
55 }
56 
58 {
59  wxWindow* w = this->GetParent();
60  while (w != NULL) {
61  CFieldNamePanelParent* parent = dynamic_cast<CFieldNamePanelParent*>(w);
62  if (parent) {
63  parent->UpdateEditor();
64  }
65  w = w->GetParent();
66  }
67 }
68 
69 
71 {
72  return false;
73 }
74 
76 {
77 }
78 
80 {
81 // wxWindow* w = this->GetParent();
82 // while (w) {
83 // CEditPubDlg* epubdlg = dynamic_cast<CEditPubDlg*>(w);
84 // if (epubdlg) {
85 // return true;
86 // }
87 // w = w->GetParent();
88 // }
89  return false;
90 }
91 
93 {
94  string val = "";
95  switch (field_type) {
96  case eFieldType_Unknown:
97  // leave blank;
98  break;
99  case eFieldType_Source:
100  val = "Source Qualifier";
101  break;
102  case eFieldType_Taxname:
103  val = "Taxname";
104  break;
105  case eFieldType_Feature:
106  val = "Feature Qualifier";
107  break;
109  val = "CDS-Gene-Prot Qualifier";
110  break;
111  case eFieldType_RNA:
112  val = "RNA Qualifier";
113  break;
114  case eFieldType_Gene:
115  val = "Gene Field";
116  break;
117  case eFieldType_Protein:
118  val = "Protein Field";
119  break;
120  case eFieldType_MolInfo:
121  val = "MolInfo Qualifier";
122  break;
123  case eFieldType_Pub:
124  val = "Pub Qualifier";
125  break;
127  val = "Structured Comment";
128  break;
129  case eFieldType_DBLink:
130  val = "DBLink Field";
131  break;
132  case eFieldType_Dbxref:
133  val = "Dbxref";
134  break;
135  case eFieldType_Misc:
136  val = "Misc Qualifiers";
137  break;
140  break;
141  case eFieldType_Comment:
142  val = kComment;
143  break;
144  case eFieldType_DefLine:
146  break;
149  break;
150  case eFieldType_FlatFile:
151  val = kFlatFile;
152  break;
153  case eFieldType_FileId:
154  val = kFileSeqId;
155  break;
157  val = kGeneralId;
158  break;
159  case eFieldType_LocalId:
160  val = kLocalId;
161  break;
162  case eFieldType_SeqId:
164  break;
165  }
166  return val;
167 }
168 
169 
171 {
173  if (NStr::StartsWith(field_type_name, "Source", NStr::eNocase)) {
175  } else if (NStr::StartsWith(field_type_name, kTaxnameAfterBinomial, NStr::eNocase)) {
177  } else if (NStr::StartsWith(field_type_name, "Taxname", NStr::eNocase)) {
179  } else if (NStr::StartsWith(field_type_name, "Feature", NStr::eNocase)) {
181  } else if (NStr::StartsWith(field_type_name, "CDS", NStr::eNocase)) {
183  } else if (NStr::StartsWith(field_type_name, "RNA", NStr::eNocase)) {
185  } else if (NStr::EqualNocase(field_type_name, "Gene field")) {
187  } else if (NStr::EqualNocase(field_type_name, "Protein field")) {
189  }
190  else if (NStr::StartsWith(field_type_name, "Mol", NStr::eNocase)) {
192  } else if (NStr::StartsWith(field_type_name, "Pub", NStr::eNocase)) {
194  } else if (NStr::StartsWith(field_type_name, "author ", NStr::eNocase) || NStr::EqualNocase(field_type_name, "journal") ||
195  NStr::EqualNocase(field_type_name, "volume") || NStr::EqualNocase(field_type_name, "issue") ||
196  NStr::EqualNocase(field_type_name, "pages") || NStr::EqualNocase(field_type_name, "title") ||
197  NStr::EqualNocase(field_type_name, "pmid") || NStr::EqualNocase(field_type_name, "status")) {
199  } else if (NStr::StartsWith(field_type_name, "Structured", NStr::eNocase)) {
201  } else if (NStr::StartsWith(field_type_name, "DBLink", NStr::eNocase)) {
203  } else if (NStr::StartsWith(field_type_name, "Dbxref", NStr::eNocase)) {
205  } else if (NStr::StartsWith(field_type_name, "Misc", NStr::eNocase)) {
207  } else if (NStr::StartsWith(field_type_name, kDefinitionLineLabel, NStr::eNocase)) {
209  } else if (NStr::EqualNocase(field_type_name, kBankITComment)) {
211  } else if (NStr::EqualNocase(field_type_name, kComment)) {
213  } else if (NStr::EqualNocase(field_type_name, kFlatFile)) {
215  } else if (NStr::EqualNocase(field_type_name, kFileSeqId)) {
217  } else if (NStr::EqualNocase(field_type_name, kGeneralId)) {
219  } else if (NStr::EqualNocase(field_type_name, kLocalId)) {
221  } else if (NStr::StartsWith(field_type_name, kFieldTypeSeqId, NStr::eNocase)
222  || NStr::EqualNocase(field_type_name, "accession")) {
224  }
225  return val;
226 }
227 
228 bool CFieldNamePanel::IsFeature(const string& target)
229 {
230  return target == macro::CMacroBioData::sm_CdRegion ||
231  target == macro::CMacroBioData::sm_Gene ||
232  target == macro::CMacroBioData::sm_ImpFeat ||
233  target == macro::CMacroBioData::sm_Miscfeat ||
234  target == macro::CMacroBioData::sm_miscRNA ||
235  target == macro::CMacroBioData::sm_mRNA ||
236  target == macro::CMacroBioData::sm_rRNA ||
237  target == macro::CMacroBioData::sm_RNA ||
238  target == macro::CMacroBioData::sm_Protein ||
239  target == macro::CMacroBioData::sm_SeqFeat;
240 }
241 
242 bool CFieldNamePanel::IsDescriptor(const string& target)
243 {
244  return target == macro::CMacroBioData::sm_Seqdesc ||
245  target == macro::CMacroBioData::sm_BioSource ||
246  target == macro::CMacroBioData::sm_MolInfo ||
247  target == macro::CMacroBioData::sm_UserObject ||
248  target == macro::CMacroBioData::sm_DBLink ||
249  target == macro::CMacroBioData::sm_StrComm ||
250  target == macro::CMacroBioData::sm_Pubdesc;
251 }
252 
254 
255 
virtual void UpdateEditor()=0
static bool IsDescriptor(const string &target)
bool x_IsParentAECRDlg(void)
virtual vector< string > GetChoices(bool &allow_other)
bool x_ShouldDecreaseStrConstrPanel(void)
static string GetFieldTypeName(EFieldType field_type)
void x_UpdateParent(void)
static EFieldType GetFieldTypeFromName(const string &field_type_name)
static bool IsFeature(const string &target)
void x_UpdateAECRDlgLayout(void)
virtual vector< string > GetMacroValues()
USING_SCOPE(objects)
const char * kDefinitionLineLabel
const char * kFileSeqId
const char * kFieldTypeSeqId
const char * kComment
const char * kLocalId
const char * kTaxnameAfterBinomial
const char * kFlatFile
const char * kGeneralId
const char * kBankITComment
#define NULL
Definition: ncbistd.hpp:225
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5406
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5347
@ eNocase
Case insensitive compare.
Definition: ncbistr.hpp:1206
Modified on Fri Sep 20 14:58:28 2024 by modify_doxy.py rev. 669887