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

Go to the SVN repository for this file.

1 /* $Id: submitblockpanel.cpp 42280 2019-01-24 20:12:34Z 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>
33 #include <objects/seq/Pubdesc.hpp>
34 #include <objects/pub/Pub.hpp>
36 
40 #include <wx/sizer.h>
41 #include <wx/choice.h>
42 
45 
46 /*
47  * CSubmitBlockPanel type definition
48  */
49 
50 IMPLEMENT_DYNAMIC_CLASS( CSubmitBlockPanel, wxPanel )
51 
52 
53 /*
54  * CSubmitBlockPanel event table definition
55  */
56 
57 BEGIN_EVENT_TABLE( CSubmitBlockPanel, wxPanel )
58 
59 ////@begin CSubmitBlockPanel event table entries
62 ////@end CSubmitBlockPanel event table entries
63 
65 
66 
67 /*
68  * CSubmitBlockPanel constructors
69  */
70 
72 {
73  Init();
74 }
75 
76 CSubmitBlockPanel::CSubmitBlockPanel( wxWindow* parent, CRef<CSubmit_block> submit_block, bool create_submit_block, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
77  : m_SubBlock(submit_block), m_CreateMode(create_submit_block)
78 {
79  Init();
80  Create(parent, id, pos, size, style);
81 }
82 
83 
84 /*
85  * CSubmitBlockPanel creator
86  */
87 
88 bool CSubmitBlockPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
89 {
90 ////@begin CSubmitBlockPanel creation
91  wxPanel::Create( parent, id, pos, size, style );
92 
94  if (GetSizer())
95  {
96  GetSizer()->SetSizeHints(this);
97  }
98  Centre();
99 ////@end CSubmitBlockPanel creation
100  return true;
101 }
102 
103 
104 /*
105  * CSubmitBlockPanel destructor
106  */
107 
109 {
110 ////@begin CSubmitBlockPanel destruction
111 ////@end CSubmitBlockPanel destruction
112 }
113 
114 
115 /*
116  * Member initialisation
117  */
118 
120 {
121 ////@begin CSubmitBlockPanel member initialisation
123  m_HUP = NULL;
124  m_Title = NULL;
125  m_Reldate = NULL;
126  m_Submitdate = NULL;
127 ////@end CSubmitBlockPanel member initialisation
128 }
129 
130 
131 /*
132  * Control creation for CSubmitBlockPanel
133  */
134 
136 {
137 ////@begin CSubmitBlockPanel content construction
138  CSubmitBlockPanel* itemPanel1 = this;
139 
140  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
141  itemPanel1->SetSizer(itemBoxSizer2);
142 
143  if (m_CreateMode) {
144  itemBoxSizer2->AddSpacer(10);
145  }
146 
147  wxStaticText* itemStaticText3 = new wxStaticText( itemPanel1, wxID_STATIC, _("When should this submission be released to the public?"), wxDefaultPosition, wxDefaultSize, 0 );
148  itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
149 
150  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
151  itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
152 
153  m_ImmediateRelease = new wxRadioButton( itemPanel1, ID_RBTN_SUBPNL1, _("Immediately after processing"), wxDefaultPosition, wxDefaultSize, 0 );
154  m_ImmediateRelease->SetValue(true);
155  itemBoxSizer4->Add(m_ImmediateRelease, 0, wxALIGN_LEFT|wxALL, 5);
156 
157  m_HUP = new wxRadioButton( itemPanel1, ID_RBTN_SUBPNL2, _("Release on specified date:"), wxDefaultPosition, wxDefaultSize, 0 );
158  m_HUP->SetValue(false);
159  itemBoxSizer4->Add(m_HUP, 0, wxALIGN_LEFT|wxALL, 5);
160 
161  CRef<CDate> r_date(&(m_SubBlock->SetReldate()));
162  m_Reldate = new CFlexibleDatePanel(itemPanel1, r_date);
163  itemBoxSizer2->Add(m_Reldate, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
164 
165  wxStaticText* itemStaticText8 = new wxStaticText( itemPanel1, wxID_STATIC, _("NOTE: Please inform GenBank when the accession number or any portion of the sequence is published, "
166  "as published data must be released."), wxDefaultPosition, wxDefaultSize, 0 );
167  itemStaticText8->Wrap(350);
168  itemBoxSizer2->Add(itemStaticText8, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
169 
170  wxStaticText* itemStaticText9 = new wxStaticText( itemPanel1, wxID_STATIC, _("Submission title (Recommended)"), wxDefaultPosition, wxDefaultSize, 0 );
171  itemBoxSizer2->Add(itemStaticText9, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
172 
173  m_Title = new wxTextCtrl( itemPanel1, ID_TEXTCTRL10, wxEmptyString, wxDefaultPosition, wxSize(360, -1), wxTE_MULTILINE );
174  itemBoxSizer2->Add(m_Title, 0, wxALIGN_CENTER_HORIZONTAL |wxALL, 5);
175 
176  if (!m_CreateMode) {
177  wxStaticText* itemStaticText10 = new wxStaticText(itemPanel1, wxID_STATIC, _("Submission Date"), wxDefaultPosition, wxDefaultSize, 0);
178  itemBoxSizer2->Add(itemStaticText10, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, 5);
179 
180  CCit_sub& citsub = m_SubBlock->SetCit();
181  CRef<CDate> subdate(&(citsub.SetDate()));
182  m_Submitdate = new CFlexibleDatePanel(itemPanel1, subdate);
183  itemBoxSizer2->Add(m_Submitdate, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 0);
184  }
185 
186 ////@end CSubmitBlockPanel content construction
187 }
188 
189 
191 {
192  if (!wxPanel::TransferDataToWindow()) {
193  return false;
194  }
195 
196  if (m_SubBlock->IsSetHup() && m_SubBlock->GetHup()) {
197  m_ImmediateRelease->SetValue (false);
198  m_HUP->SetValue (true);
199  m_Reldate->Enable(true);
200  } else {
201  m_ImmediateRelease->SetValue (true);
202  m_HUP->SetValue (false);
203  m_Reldate->Enable(false);
204  }
205 
206  if (m_SubBlock->IsSetCit() && m_SubBlock->GetCit().IsSetDescr()) {
207  m_Title->SetValue(m_SubBlock->GetCit().GetDescr());
208  } else {
209  m_Title->SetValue(wxEmptyString);
210  }
211  if (m_Submitdate) {
213  }
214  return true;
215 }
216 
217 
219 {
220  if (!wxPanel::TransferDataFromWindow()) {
221  return false;
222  }
223  if (m_HUP->GetValue()) {
224  m_SubBlock->SetHup(true);
225  } else {
226  m_SubBlock->SetHup(false);
227  m_SubBlock->ResetReldate();
228  }
229 
230  if (!m_Title->IsEmpty()) {
231  m_SubBlock->SetCit().SetDescr(ToAsciiStdString(m_Title->GetValue()));
232  }
233  if (m_Submitdate) {
235  }
236  return true;
237 }
238 
239 void CSubmitBlockPanel::SetData(const CSubmit_block& submit_block)
240 {
241  m_SubBlock->Assign(submit_block);
243 }
244 
245 /*
246  * Should we show tooltips?
247  */
248 
250 {
251  return true;
252 }
253 
254 /*
255  * Get bitmap resources
256  */
257 
258 wxBitmap CSubmitBlockPanel::GetBitmapResource( const wxString& name )
259 {
260  // Bitmap retrieval
261 ////@begin CSubmitBlockPanel bitmap retrieval
262  wxUnusedVar(name);
263  return wxNullBitmap;
264 ////@end CSubmitBlockPanel bitmap retrieval
265 }
266 
267 /*
268  * Get icon resources
269  */
270 
271 wxIcon CSubmitBlockPanel::GetIconResource( const wxString& name )
272 {
273  // Icon retrieval
274 ////@begin CSubmitBlockPanel icon retrieval
275  wxUnusedVar(name);
276  return wxNullIcon;
277 ////@end CSubmitBlockPanel icon retrieval
278 }
279 
280 
281 /*
282  * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RADIOBUTTON
283  */
284 
286 {
287  m_Reldate->Enable(false);
288 }
289 
290 
291 /*
292  * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RADIOBUTTON1
293  */
294 
295 void CSubmitBlockPanel::OnHUPSelected( wxCommandEvent& event )
296 {
297  m_Reldate->Enable(true);
298 }
299 
User-defined methods of the data storage class.
#define ID_TEXTCTRL10
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
virtual bool TransferDataFromWindow()
CSubmitBlockPanel()
Constructors.
void Init()
Initialises member variables.
wxRadioButton * m_HUP
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
wxRadioButton * m_ImmediateRelease
~CSubmitBlockPanel()
Destructor.
static bool ShowToolTips()
Should we show tooltips?
bool Create(wxWindow *parent, wxWindowID id=10077, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 400), long style=wxTAB_TRAVERSAL)
Creation.
void OnImmediateReleaseSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RBTN_SUBPNL1
CFlexibleDatePanel * m_Submitdate
void CreateControls()
Creates the controls and sizers.
CRef< objects::CSubmit_block > m_SubBlock
void SetData(const objects::CSubmit_block &submit_block)
CFlexibleDatePanel * m_Reldate
virtual bool TransferDataToWindow()
void OnHUPSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RBTN_SUBPNL2
CSubmit_block –.
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#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
void SetDate(TDate &value)
Assign a value to Date data member.
Definition: Cit_sub_.cpp:101
END_EVENT_TABLE()
const struct ncbi::grid::netcache::search::fields::SIZE size
USING_SCOPE(objects)
#define ID_RBTN_SUBPNL2
#define ID_RBTN_SUBPNL1
string ToAsciiStdString(const wxString &input)
Definition: wx_utils.hpp:166
Modified on Sun Mar 03 03:10:28 2024 by modify_doxy.py rev. 669887