47 #include <wx/stattext.h>
48 #include <wx/textctrl.h>
49 #include <wx/choice.h>
87 wxWindowID
id,
const wxPoint& pos,
const wxSize&
size,
long style )
88 : m_CmdProcessor(cmdproc), m_Seh(seh)
102 SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
103 wxPanel::Create( parent,
id, pos,
size, style );
108 GetSizer()->SetSizeHints(
this);
152 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
153 itemPanel1->SetSizer(itemBoxSizer2);
155 wxFlexGridSizer* itemFlexGridSizer1 =
new wxFlexGridSizer(0, 2, 0, 0);
156 itemBoxSizer2->Add(itemFlexGridSizer1, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
158 wxStaticText* itemStaticText2 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Organism*"), wxDefaultPosition, wxDefaultSize, 0 );
159 itemFlexGridSizer1->Add(itemStaticText2, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
162 m_Taxname =
new wxTextCtrl(itemPanel1,
ID_ORGTAXNAME, wxEmptyString, wxDefaultPosition, wxSize(240, -1), 0);
164 m_Taxname =
new wxTextCtrl(itemPanel1,
ID_ORGTAXNAME, wxEmptyString, wxDefaultPosition, wxSize(270, -1), 0);
166 itemFlexGridSizer1->Add(
m_Taxname, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
168 wxStaticText* itemStaticText3 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"strain**"), wxDefaultPosition, wxDefaultSize, 0 );
169 itemFlexGridSizer1->Add(itemStaticText3, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
171 m_Strain =
new wxTextCtrl( itemPanel1,
ID_ORGSTRAIN, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
172 itemFlexGridSizer1->Add(
m_Strain, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
174 wxStaticText* itemStaticText4 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"isolate**"), wxDefaultPosition, wxDefaultSize, 0 );
175 itemFlexGridSizer1->Add(itemStaticText4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
177 m_Isolate =
new wxTextCtrl( itemPanel1,
ID_ORGISOLATE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
178 itemFlexGridSizer1->Add(
m_Isolate, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
180 wxStaticText* itemStaticText5 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"cultivar**"), wxDefaultPosition, wxDefaultSize, 0 );
181 itemFlexGridSizer1->Add(itemStaticText5, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
184 itemFlexGridSizer1->Add(
m_Cultivar, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
186 wxStaticText* itemStaticText6 =
new wxStaticText(itemPanel1, wxID_STATIC,
_(
"breed**"), wxDefaultPosition, wxDefaultSize, 0);
187 itemFlexGridSizer1->Add(itemStaticText6, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5);
189 m_Breed =
new wxTextCtrl(itemPanel1,
ID_ORGBREED, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
190 itemFlexGridSizer1->Add(
m_Breed, 0, wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
193 itemBoxSizer2->AddStretchSpacer();
195 wxStaticText* itemStaticText7 =
new wxStaticText(itemPanel1, wxID_STATIC,
_(
"**At least one field is required"), wxDefaultPosition, wxDefaultSize, 0);
196 itemBoxSizer2->Add(itemStaticText7, 0, wxALIGN_RIGHT | wxALL, 5);
263 for (
auto& it :
m_Source->GetOrg().GetOrgname().GetMod()) {
264 if (it->IsSetSubtype() && it->IsSetSubname()) {
265 auto subtype = it->GetSubtype();
290 (
COrgName::TMod& orgmod_list, COrgName::TMod::iterator it, wxTextCtrl* ctrl,
bool& changed)
292 if (ctrl->IsEmpty()) {
293 it = orgmod_list.erase(it);
307 bool any_change =
false;
314 if (taxname.empty()) {
323 else if (!taxname.empty()) {
328 bool found_strain =
false;
329 bool found_isolate =
false;
330 bool found_cultivar =
false;
331 bool found_breed =
false;
334 auto mod = orgmodlist.begin();
335 while (
mod != orgmodlist.end()) {
336 if ((*mod)->IsSetSubtype() && (*mod)->IsSetSubname()) {
337 auto subtype = (*mod)->GetSubtype();
344 found_isolate =
true;
348 found_cultivar =
true;
365 if (!found_strain && !
m_Strain->IsEmpty()) {
369 if (!found_isolate && !
m_Isolate->IsEmpty()) {
373 if (!found_cultivar && !
m_Cultivar->IsEmpty()) {
377 if (!found_breed && !
m_Breed->IsEmpty()) {
383 if (any_change && orgmodlist.empty()) {
424 bool any_changes =
false;
426 bool taxname_changed =
false;
436 if (taxname_changed) {
443 cmd->AddCommand(*chg);
455 cmd->AddCommand(*cmdAddDesc);
457 taxname_changed =
true;
465 if (taxname_changed) {
480 text +=
"Organism\n";
483 text +=
"At least one field is required: strain, isolate, cultivar, breed\n";
const string & GetTaxname(void) const
bool IsSetLineage(void) const
bool IsSetTaxname(void) const
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
bool x_ApplyChangesToSource(objects::CBioSource &src)
bool Create(wxWindow *parent, wxWindowID id=ID_CORGGENERALPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
void CreateControls()
Creates the controls and sizers.
virtual void ApplyCommand()
static bool ShowToolTips()
Should we show tooltips?
virtual bool TransferDataToWindow()
void Init()
Initialises member variables.
objects::CSeq_entry_Handle m_Seh
virtual bool TransferDataFromWindow()
virtual void ReportMissingFields(string &text)
ICommandProccessor * m_CmdProcessor
void ApplyBioSource(objects::CBioSource &src)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
~COrgGeneralPanel()
Destructor.
bool x_HasTaxnameChanged(const objects::CBioSource &orig_src, const objects::CBioSource &edited_src)
COrgGeneralPanel()
Constructors.
CRef< objects::CBioSource > m_Source
@OrgMod.hpp User-defined methods of the data storage class.
Undo/Redo interface for editing operations.
virtual void Execute(IEditCommand *command, wxWindow *window=0)=0
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
const string & GetMsg(void) const
Get message string.
void CleanupForTaxnameChange(CObjectInfo oi)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual bool Equals(const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
Check if both objects contain the same values.
TClass GetClass(void) const
CBioseq_set_Handle GetParentBioseq_set(void) const
Return a handle for the parent Bioseq-set, or null handle.
CSeq_entry_Handle GetParentEntry(void) const
Return a handle for the parent seq-entry of the bioseq.
bool IsSetClass(void) const
CSeq_entry_Handle GetSeq_entry_Handle(void) const
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static bool EqualCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive 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.
void SetOrg(TOrg &value)
Assign a value to Org data member.
const TTaxname & GetTaxname(void) const
Get the Taxname member data.
void ResetTaxname(void)
Reset Taxname data member.
void SetTaxname(const TTaxname &value)
Assign a value to Taxname data member.
list< CRef< COrgMod > > TMod
bool IsSetTaxname(void) const
preferred formal name Check if a value has been assigned to Taxname data member.
void SetOrgname(TOrgname &value)
Assign a value to Orgname data member.
@ eClass_nuc_prot
nuc acid and coded proteins
const TSource & GetSource(void) const
Get the variant data.
TSource & SetSource(void)
Select the variant.
@ e_Source
source of materials, includes Org-ref
@ eMol_na
just a nucleic acid
static void text(MDB_val *v)
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
COrgName::TMod::iterator s_UpdateSubtype(COrgName::TMod &orgmod_list, COrgName::TMod::iterator it, wxTextCtrl *ctrl, bool &changed)
CRef< CCmdComposite > TaxonomyLookupCommand(objects::CSeq_entry_Handle seh)
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)