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

Go to the SVN repository for this file.

1 /* $Id: bulk_molinfo_edit_dlg.cpp 34945 2016-03-03 20:31:51Z 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 
39 
40 #include <wx/button.h>
41 
42 ////@begin XPM images
43 ////@end XPM images
44 
46 
48 
49 /*!
50  * CBulkMolinfoEditDlg type definition
51  */
52 
53 IMPLEMENT_DYNAMIC_CLASS( CBulkMolinfoEditDlg, CBulkCmdDlg )
54 
55 
56 /*!
57  * CBulkMolinfoEditDlg event table definition
58  */
59 
60 BEGIN_EVENT_TABLE( CBulkMolinfoEditDlg, CBulkCmdDlg )
61 
62 ////@begin CBulkMolinfoEditDlg event table entries
63 ////@end CBulkMolinfoEditDlg event table entries
64 
66 
67 
68 /*!
69  * CBulkMolinfoEditDlg constructors
70  */
71 
73 {
74  Init();
75 }
76 
77 CBulkMolinfoEditDlg::CBulkMolinfoEditDlg( wxWindow* parent, CSeq_entry_Handle seh, CSourceRequirements::EWizardType wizard_type, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
78 : m_TopSeqEntry(seh), m_WizardType(wizard_type)
79 {
80  Init();
81  Create(parent, id, caption, pos, size, style);
82 }
83 
84 
85 /*!
86  * CBulkMolinfoEditDlg creator
87  */
88 
89 bool CBulkMolinfoEditDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
90 {
91 ////@begin CBulkMolinfoEditDlg creation
92  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
93  CBulkCmdDlg::Create( parent, id, caption, pos, size, style );
94 
96  if (GetSizer())
97  {
98  GetSizer()->SetSizeHints(this);
99  }
100  Centre();
101 ////@end CBulkMolinfoEditDlg creation
102  return true;
103 }
104 
105 
106 /*!
107  * CBulkMolinfoEditDlg destructor
108  */
109 
111 {
112 ////@begin CBulkMolinfoEditDlg destruction
113 ////@end CBulkMolinfoEditDlg destruction
114 }
115 
116 
117 /*!
118  * Member initialisation
119  */
120 
122 {
123 ////@begin CBulkMolinfoEditDlg member initialisation
124 ////@end CBulkMolinfoEditDlg member initialisation
125 }
126 
127 
128 /*!
129  * Control creation for CBulkMolinfoEditDlg
130  */
131 
133 {
134 ////@begin CBulkMolinfoEditDlg content construction
135  // Generated by DialogBlocks, 10/06/2013 17:54:31 (unregistered)
136 
137  CBulkMolinfoEditDlg* itemCBulkCmdDlg1 = this;
138 
139  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
140  itemCBulkCmdDlg1->SetSizer(itemBoxSizer2);
141 
142  wxGrid* itemGrid3 = new wxGrid( itemCBulkCmdDlg1, ID_GRID, wxDefaultPosition, wxSize(600, 300), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
143  itemGrid3->SetDefaultColSize(50);
144  itemGrid3->SetDefaultRowSize(25);
145  itemGrid3->SetColLabelSize(25);
146  itemGrid3->SetRowLabelSize(100);
147  itemGrid3->CreateGrid(5, 5, wxGrid::wxGridSelectCells);
148  itemBoxSizer2->Add(itemGrid3, 0, wxGROW|wxALL, 5);
149 
150  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
151  itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
152 
153  wxButton* itemButton5 = new wxButton( itemCBulkCmdDlg1, wxID_OK, _("Accept"), wxDefaultPosition, wxDefaultSize, 0 );
154  itemBoxSizer4->Add(itemButton5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
155 
156  wxButton* itemButton6 = new wxButton( itemCBulkCmdDlg1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
157  itemBoxSizer4->Add(itemButton6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
158 
159 ////@end CBulkMolinfoEditDlg content construction
160  m_Grid = itemGrid3;
161 
162  if (m_TopSeqEntry) {
163  /* this is where we need to construct a CSeqTable object from the BioSources in the record */
165 
166  CSeqTableGrid *gridAdapter = new CSeqTableGrid(seqTable);
167  m_Grid->SetTable(gridAdapter, true);
168 
169  // TODO: Find column by label instead of making assumption
170  // TODO: Add existing values as choices
171  vector<string> mol_strings = GetMoleculeTypeOptions (m_WizardType);
172  wxArrayString moltype_choices;
173  for (size_t i = 0; i < mol_strings.size(); i++) {
174  moltype_choices.push_back(ToWxString(mol_strings[i]));
175  }
176 
177  wxArrayString topology_choices;
178  topology_choices.push_back(wxT("linear"));
179  topology_choices.push_back(wxT("circular"));
180 
181  for (int row = 0; row < seqTable->GetNum_rows(); row++) {
182  m_Grid->SetCellEditor(row, 0, new wxGridCellChoiceEditor (moltype_choices, false));
183  m_Grid->SetCellEditor(row, 1, new wxGridCellChoiceEditor (topology_choices, false));
184  }
185 
186  m_Grid->AutoSizeColumns();
187  }
188 }
189 
190 
191 /*!
192  * Should we show tooltips?
193  */
194 
196 {
197  return true;
198 }
199 
200 /*!
201  * Get bitmap resources
202  */
203 
204 wxBitmap CBulkMolinfoEditDlg::GetBitmapResource( const wxString& name )
205 {
206  // Bitmap retrieval
207 ////@begin CBulkMolinfoEditDlg bitmap retrieval
208  wxUnusedVar(name);
209  return wxNullBitmap;
210 ////@end CBulkMolinfoEditDlg bitmap retrieval
211 }
212 
213 /*!
214  * Get icon resources
215  */
216 
217 wxIcon CBulkMolinfoEditDlg::GetIconResource( const wxString& name )
218 {
219  // Icon retrieval
220 ////@begin CBulkMolinfoEditDlg icon retrieval
221  wxUnusedVar(name);
222  return wxNullIcon;
223 ////@end CBulkMolinfoEditDlg icon retrieval
224 }
225 
226 
228 {
230 
231  CSeqTableGrid *gridAdapter = dynamic_cast<CSeqTableGrid*>(m_Grid->GetTable());
232  if( gridAdapter ) {
233  CRef<objects::CSeq_table> values_table = gridAdapter->GetValuesTable();
235  }
236  return cmd;
237 }
238 
239 
241 {
242  return "Unknown error";
243 }
244 
245 
246 
USING_SCOPE(ncbi::objects)
#define ID_GRID
bool Create(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE, const wxString &name=wxFrameNameStr)
virtual string GetErrorMessage()
CBulkMolinfoEditDlg()
Constructors.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
static bool ShowToolTips()
Should we show tooltips?
bool Create(wxWindow *parent, wxWindowID id=10077, const wxString &caption=_("Molecule Information"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void Init()
Initialises member variables.
void CreateControls()
Creates the controls and sizers.
objects::CSeq_entry_Handle m_TopSeqEntry
CSourceRequirements::EWizardType m_WizardType
virtual CRef< CCmdComposite > GetCommand()
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
CRef< objects::CSeq_table > GetValuesTable(void)
CSeq_entry_Handle –.
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
END_EVENT_TABLE()
int i
vector< string > GetMoleculeTypeOptions(CSourceRequirements::EWizardType wizard_type)
CRef< objects::CSeq_table > BuildMolInfoValuesTableFromSeqEntry(objects::CSeq_entry_Handle seh, CSourceRequirements::EWizardType wizard_type)
CRef< CCmdComposite > ApplyMolInfoValuesTableToSeqEntry(CRef< objects::CSeq_table >values_table, objects::CSeq_entry_Handle seh, bool add_confirmed=true)
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
Modified on Sun Mar 03 03:16:49 2024 by modify_doxy.py rev. 669887