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

Go to the SVN repository for this file.

1 /* $Id: src_desc_editor_panel.cpp 47116 2022-08-16 19:42:04Z 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 #include <ncbi_pch.hpp>
30 ////@begin includes
31 #include "wx/imaglist.h"
32 ////@end includes
33 #include <wx/sizer.h>
34 #include <wx/msgdlg.h>
39 
42 #include "loc_gcode_panel.hpp"
43 #include "biosourcepanel.hpp"
44 #include "src_other_pnl.hpp"
45 
46 
47 ////@begin XPM images
48 ////@end XPM images
49 
52 
53 /*!
54  * CSrcDescEditorPanel type definition
55  */
56 
57 IMPLEMENT_DYNAMIC_CLASS( CSrcDescEditorPanel, wxPanel )
58 
59 
60 /*!
61  * CSrcDescEditorPanel event table definition
62  */
63 
64 BEGIN_EVENT_TABLE( CSrcDescEditorPanel, wxPanel )
65 
66 ////@begin CSrcDescEditorPanel event table entries
67 ////@end CSrcDescEditorPanel event table entries
68 
70 
71 
72 /*!
73  * CSrcDescEditorPanel constructors
74  */
75 
77 {
78  Init();
79 }
80 
81 CSrcDescEditorPanel::CSrcDescEditorPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
82 {
83  Init();
84  Create(parent, id, pos, size, style);
85 }
86 
87 
88 /*!
89  * CSrcDescEditorPanel creator
90  */
91 
92 bool CSrcDescEditorPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
93 {
94 ////@begin CSrcDescEditorPanel creation
95  wxPanel::Create( parent, id, pos, size, style );
96 
98  if (GetSizer())
99  {
100  GetSizer()->SetSizeHints(this);
101  }
102  Centre();
103 ////@end CSrcDescEditorPanel creation
104  return true;
105 }
106 
107 
108 /*!
109  * CSrcDescEditorPanel destructor
110  */
111 
113 {
114 ////@begin CSrcDescEditorPanel destruction
115 ////@end CSrcDescEditorPanel destruction
116 }
117 
118 
119 /*!
120  * Member initialisation
121  */
122 
124 {
125 ////@begin CSrcDescEditorPanel member initialisation
127 ////@end CSrcDescEditorPanel member initialisation
128 }
129 
130 
131 /*!
132  * Control creation for CSrcDescEditorPanel
133  */
134 
136 {
137 ////@begin CSrcDescEditorPanel content construction
138  CSrcDescEditorPanel* itemPanel1 = this;
139 
140  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
141  itemPanel1->SetSizer(itemBoxSizer2);
142 
143  m_SourceTreebook = new wxTreebook( itemPanel1, ID_TREEBOOK1, wxDefaultPosition, wxSize(-1, 500), wxBK_DEFAULT );
144  itemBoxSizer2->Add(m_SourceTreebook, 1, wxGROW|wxALL, 5);
145 
146 ////@end CSrcDescEditorPanel content construction
147 
148  wxWindow* panel = new wxPanel(m_SourceTreebook, wxID_ANY, wxDefaultPosition, wxSize(550, 460), wxBK_DEFAULT );
149  m_SourceTreebook->AddPage(panel, wxT("Source Modifiers and Extra"));
150  panel = new wxPanel(m_SourceTreebook, wxID_ANY, wxDefaultPosition, wxSize(550, 460), wxBK_DEFAULT );
151  m_SourceTreebook->AddPage(panel, wxT("other"));
152 
153 }
154 
155 
156 /*!
157  * Should we show tooltips?
158  */
159 
161 {
162  return true;
163 }
164 
165 /*!
166  * Get bitmap resources
167  */
168 
169 wxBitmap CSrcDescEditorPanel::GetBitmapResource( const wxString& name )
170 {
171  // Bitmap retrieval
172 ////@begin CSrcDescEditorPanel bitmap retrieval
173  wxUnusedVar(name);
174  return wxNullBitmap;
175 ////@end CSrcDescEditorPanel bitmap retrieval
176 }
177 
178 /*!
179  * Get icon resources
180  */
181 
182 wxIcon CSrcDescEditorPanel::GetIconResource( const wxString& name )
183 {
184  // Icon retrieval
185 ////@begin CSrcDescEditorPanel icon retrieval
186  wxUnusedVar(name);
187  return wxNullIcon;
188 ////@end CSrcDescEditorPanel icon retrieval
189 }
190 
191 
193 {
194  return wxPanel::TransferDataToWindow();
195 }
196 
197 
199 {
200  if (!wxPanel::TransferDataFromWindow())
201  return false;
202 
206  return true;
207 }
208 
209 
211 {
213  m_BioSource->Assign(desc.GetSource());
214 
215  m_SourceTreebook->DeleteAllPages();
216 
218  m_SourceTreebook->AddPage(m_SrcPanel, wxT("Source Modifiers"));
219 
221  m_SourceTreebook->AddPage(m_LocAndGCodePanel, wxT("Genetic Code"));
222 
225  m_SourceTreebook->AddPage(m_SrcOtherPanel, wxT("Other"));
226 
228  m_SourceTreebook->Refresh();
229  Refresh();
230 }
231 
232 
234 {
238 
239  COrg_ref& org = desc.SetSource().SetOrg();
240  if (RunningInsideNCBI())
241  {
243  }
244  else if ( org.IsSetTaxname() && !NStr::IsBlank (org.GetTaxname()) && org.GetTaxId() == ZERO_TAX_ID && org.TableLookup(org.GetTaxname()) &&
245  wxMessageBox("Would you like to load default lineage and genetic code values for this organism?", "Please confirm", wxICON_QUESTION | wxYES_NO) == wxYES )
246  {
248  }
250  cleanup.BasicCleanup(desc);
251 
252 }
253 
255 {
258 }
259 
260 
static bool AutoFill(objects::COrg_ref &org)
void PopulateBioSource(objects::CBioSource &source)
void OnChangedTaxname(void)
void PopulateLocAndGC(objects::CBioSource &source)
TTaxId GetTaxId() const
Definition: Org_ref.cpp:72
static CConstRef< COrg_ref > TableLookup(const string &taxname)
Definition: Org_ref.cpp:448
void OnChangedTaxname(void)
void TransferToOrgRef(objects::COrg_ref &org)
void TransferFromOrgRef(const objects::COrg_ref &org)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
virtual bool TransferDataToWindow()
virtual bool TransferDataFromWindow()
CBioSourcePanel * m_SrcPanel
static bool ShowToolTips()
Should we show tooltips?
CLocAndGCodePanel * m_LocAndGCodePanel
void CreateControls()
Creates the controls and sizers.
bool Create(wxWindow *parent, wxWindowID id=ID_CSRCDESCEDITORPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
CSrcDescEditorPanel()
Constructors.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
CSourceOtherPanel * m_SrcOtherPanel
virtual void UpdateSeqdesc(objects::CSeqdesc &desc)
void Init()
Initialises member variables.
virtual void ChangeSeqdesc(const objects::CSeqdesc &desc)
CRef< objects::CBioSource > m_BioSource
static void cleanup(void)
Definition: ct_dynamic.c:30
static void Init(void)
Definition: cursor6.c:76
#define ZERO_TAX_ID
Definition: ncbimisc.hpp:1115
#define NULL
Definition: ncbistd.hpp:225
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#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 IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
void SetOrg(TOrg &value)
Assign a value to Org data member.
Definition: BioSource_.cpp:108
const TTaxname & GetTaxname(void) const
Get the Taxname member data.
Definition: Org_ref_.hpp:372
bool IsSetTaxname(void) const
preferred formal name Check if a value has been assigned to Taxname data member.
Definition: Org_ref_.hpp:360
const TSource & GetSource(void) const
Get the variant data.
Definition: Seqdesc_.cpp:566
TSource & SetSource(void)
Select the variant.
Definition: Seqdesc_.cpp:572
END_EVENT_TABLE()
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
static static static wxID_ANY
USING_SCOPE(objects)
bool RunningInsideNCBI()
Definition: wx_utils.cpp:1335
Modified on Mon May 06 04:52:22 2024 by modify_doxy.py rev. 669887