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

Go to the SVN repository for this file.

1 /* $Id: wx_build_options_dlg.cpp 44757 2020-03-05 18:58:50Z evgeniev $
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:
27  *
28  * File Description:
29  *
30  */
31 #include <ncbi_pch.hpp>
32 
33 ////@begin includes
34 ////@end includes
35 
37 
39 
40 #include <gui/objutils/label.hpp>
41 #include <objmgr/util/sequence.hpp>
42 
43 #include <wx/panel.h>
44 #include <wx/stattext.h>
45 #include <wx/statbox.h>
46 #include <wx/button.h>
47 #include <wx/combobox.h>
48 #include <wx/sizer.h>
49 #include <wx/radiobut.h>
50 #include <wx/checkbox.h>
51 #include <wx/listbox.h>
52 #include <wx/bitmap.h>
53 #include <wx/icon.h>
54 #include <wx/valgen.h>
55 #include <wx/textctrl.h>
56 
57 
59 
61 typedef vector<CBioseq_Handle> THandles;
62 
63 
64 IMPLEMENT_DYNAMIC_CLASS( CBuildOptionsDlg, CDialog )
65 
66 BEGIN_EVENT_TABLE( CBuildOptionsDlg, CDialog )
67 ////@begin CBuildOptionsDlg event table entries
68  EVT_RADIOBUTTON( ID_MULTIPLE_RADIO, CBuildOptionsDlg::OnMultipleRadioSelected )
69 
70  EVT_RADIOBUTTON( ID_QUERY_RADIO, CBuildOptionsDlg::OnQueryRadioSelected )
71 
72  EVT_RADIOBUTTON( ID_ORIGINAL_RADIO, CBuildOptionsDlg::OnOriginalRadioSelected )
73 
74  EVT_RADIOBUTTON( ID_CLIP_RADIO, CBuildOptionsDlg::OnClipRadioSelected )
75 
76  EVT_RADIOBUTTON( ID_EXTEND_RADIO, CBuildOptionsDlg::OnExtendRadioSelected )
77 
78  EVT_RADIOBUTTON( ID_SHOW_FLANK_RADIO, CBuildOptionsDlg::OnShowFlankRadioSelected )
79 
80  EVT_RADIOBUTTON( ID_SHOW_UA_RADIO, CBuildOptionsDlg::OnShowUaRadioSelected )
81 
82 ////@end CBuildOptionsDlg event table entries
84 
85 
87 {
88  Init();
89 }
90 
91 
92 CBuildOptionsDlg::CBuildOptionsDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
93 {
94  Init();
95  Create(parent, id, caption, pos, size, style);
96 }
97 
98 
99 bool CBuildOptionsDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
100 {
101 ////@begin CBuildOptionsDlg creation
102  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
103  CDialog::Create( parent, id, caption, pos, size, style );
104 
105  CreateControls();
106  if (GetSizer())
107  {
108  GetSizer()->SetSizeHints(this);
109  }
110  Centre();
111 ////@end CBuildOptionsDlg creation
112  return true;
113 }
114 
116 {
117 ////@begin CBuildOptionsDlg destruction
118 ////@end CBuildOptionsDlg destruction
119 }
120 
122 {
123 ////@begin CBuildOptionsDlg member initialisation
125  m_StartText = NULL;
126  m_EndText = NULL;
127  m_ExtentText = NULL;
128  m_FlankText = NULL;
129 ////@end CBuildOptionsDlg member initialisation
130 }
131 
133 {
134 ////@begin CBuildOptionsDlg content construction
135  CBuildOptionsDlg* itemCDialog1 = this;
136 
137  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
138  itemCDialog1->SetSizer(itemBoxSizer2);
139 
140  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
141  itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 0);
142 
143  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
144  itemBoxSizer3->Add(itemBoxSizer4, 1, wxGROW|wxALL, 0);
145 
146  wxStaticBox* itemStaticBoxSizer5Static = new wxStaticBox(itemCDialog1, wxID_ANY, wxT("Display Alignment as:"));
147  wxStaticBoxSizer* itemStaticBoxSizer5 = new wxStaticBoxSizer(itemStaticBoxSizer5Static, wxVERTICAL);
148  itemBoxSizer4->Add(itemStaticBoxSizer5, 1, wxGROW|wxALL, 5);
149 
150  wxRadioButton* itemRadioButton6 = new wxRadioButton( itemCDialog1, ID_MULTIPLE_RADIO, wxT("Multiple"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
151  itemRadioButton6->SetValue(false);
152  itemStaticBoxSizer5->Add(itemRadioButton6, 0, wxALIGN_LEFT|wxALL, 5);
153 
154  wxRadioButton* itemRadioButton7 = new wxRadioButton( itemCDialog1, ID_QUERY_RADIO, wxT("Query-anchored"), wxDefaultPosition, wxDefaultSize, 0 );
155  itemRadioButton7->SetValue(false);
156  itemStaticBoxSizer5->Add(itemRadioButton7, 0, wxALIGN_LEFT|wxALL, 5);
157 
158  wxArrayString m_AnchorIDListStrings;
159  m_AnchorIDList = new wxListBox( itemCDialog1, ID_ANCHOR_LIST, wxDefaultPosition, wxSize(300, 190), m_AnchorIDListStrings, wxLB_SINGLE|wxLB_NEEDED_SB|wxLB_HSCROLL );
160  itemStaticBoxSizer5->Add(m_AnchorIDList, 1, wxGROW|wxALL, 5);
161 
162  wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
163  itemBoxSizer4->Add(itemBoxSizer9, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT, 5);
164 
165  wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
166  itemBoxSizer3->Add(itemBoxSizer10, 0, wxGROW|wxALL, 0);
167 
168  wxStaticBox* itemStaticBoxSizer11Static = new wxStaticBox(itemCDialog1, wxID_ANY, wxT("Clip \\ Extend Alignment"));
169  wxStaticBoxSizer* itemStaticBoxSizer11 = new wxStaticBoxSizer(itemStaticBoxSizer11Static, wxVERTICAL);
170  itemBoxSizer10->Add(itemStaticBoxSizer11, 0, wxGROW|wxALL, 5);
171 
172  wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxVERTICAL);
173  itemStaticBoxSizer11->Add(itemBoxSizer12, 0, wxGROW, 5);
174 
175  wxRadioButton* itemRadioButton13 = new wxRadioButton( itemCDialog1, ID_ORIGINAL_RADIO, wxT("Do not modify"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
176  itemRadioButton13->SetValue(false);
177  itemBoxSizer12->Add(itemRadioButton13, 0, wxALIGN_LEFT|wxALL, 5);
178 
179  wxRadioButton* itemRadioButton14 = new wxRadioButton( itemCDialog1, ID_CLIP_RADIO, wxT("Clip Alignment on sequence"), wxDefaultPosition, wxDefaultSize, 0 );
180  itemRadioButton14->SetValue(false);
181  itemBoxSizer12->Add(itemRadioButton14, 0, wxALIGN_LEFT|wxALL, 5);
182 
183  wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxHORIZONTAL);
184  itemBoxSizer12->Add(itemBoxSizer15, 0, wxALIGN_RIGHT, 5);
185 
186  itemBoxSizer15->Add(20, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
187 
188  wxStaticText* itemStaticText17 = new wxStaticText( itemCDialog1, wxID_STATIC, wxT("Start:"), wxDefaultPosition, wxDefaultSize, 0 );
189  itemBoxSizer15->Add(itemStaticText17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
190 
191  m_StartText = new wxTextCtrl( itemCDialog1, ID_START_TEXT, wxT(""), wxDefaultPosition, wxDefaultSize, 0 );
192  itemBoxSizer15->Add(m_StartText, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5);
193 
194  wxStaticText* itemStaticText19 = new wxStaticText( itemCDialog1, wxID_STATIC, wxT("End:"), wxDefaultPosition, wxDefaultSize, 0 );
195  itemBoxSizer15->Add(itemStaticText19, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
196 
197  m_EndText = new wxTextCtrl( itemCDialog1, ID_END_TEXT, wxT(""), wxDefaultPosition, wxDefaultSize, 0 );
198  itemBoxSizer15->Add(m_EndText, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5);
199 
200  wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxHORIZONTAL);
201  itemBoxSizer12->Add(itemBoxSizer21, 0, wxALIGN_CENTER_HORIZONTAL, 5);
202 
203  wxRadioButton* itemRadioButton22 = new wxRadioButton( itemCDialog1, ID_EXTEND_RADIO, wxT("Extend Alignment on every side by:"), wxDefaultPosition, wxDefaultSize, 0 );
204  itemRadioButton22->SetValue(false);
205  itemBoxSizer21->Add(itemRadioButton22, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
206 
207  itemBoxSizer21->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
208 
209  m_ExtentText = new wxTextCtrl( itemCDialog1, ID_TEXTCTRL, wxT(""), wxDefaultPosition, wxDefaultSize, 0 );
210  itemBoxSizer21->Add(m_ExtentText, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5);
211 
212  wxStaticBox* itemStaticBoxSizer25Static = new wxStaticBox(itemCDialog1, wxID_ANY, wxT("Unaligned Regions:"));
213  wxStaticBoxSizer* itemStaticBoxSizer25 = new wxStaticBoxSizer(itemStaticBoxSizer25Static, wxVERTICAL);
214  itemBoxSizer10->Add(itemStaticBoxSizer25, 0, wxGROW|wxALL, 5);
215 
216  wxRadioButton* itemRadioButton26 = new wxRadioButton( itemCDialog1, ID_HIDE_UA_RADIO, wxT("Hide Unaligned"), wxDefaultPosition, wxDefaultSize, 0 );
217  itemRadioButton26->SetValue(false);
218  itemStaticBoxSizer25->Add(itemRadioButton26, 0, wxALIGN_LEFT|wxALL, 5);
219 
220  wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxHORIZONTAL);
221  itemStaticBoxSizer25->Add(itemBoxSizer27, 0, wxALIGN_LEFT, 5);
222 
223  wxRadioButton* itemRadioButton28 = new wxRadioButton( itemCDialog1, ID_SHOW_FLANK_RADIO, wxT("Show flanking Unaligned"), wxDefaultPosition, wxDefaultSize, 0 );
224  itemRadioButton28->SetValue(false);
225  itemBoxSizer27->Add(itemRadioButton28, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
226 
227  m_FlankText = new wxTextCtrl( itemCDialog1, ID_EXTENT_TEXT, wxT(""), wxDefaultPosition, wxDefaultSize, 0 );
228  itemBoxSizer27->Add(m_FlankText, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5);
229 
230  wxStaticText* itemStaticText30 = new wxStaticText( itemCDialog1, wxID_STATIC, wxT("residues"), wxDefaultPosition, wxDefaultSize, 0 );
231  itemBoxSizer27->Add(itemStaticText30, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
232 
233  wxRadioButton* itemRadioButton31 = new wxRadioButton( itemCDialog1, ID_SHOW_UA_RADIO, wxT("Show Unaligned"), wxDefaultPosition, wxDefaultSize, 0 );
234  itemRadioButton31->SetValue(false);
235  itemStaticBoxSizer25->Add(itemRadioButton31, 0, wxALIGN_LEFT|wxALL, 5);
236 
237  wxBoxSizer* itemBoxSizer32 = new wxBoxSizer(wxVERTICAL);
238  itemBoxSizer10->Add(itemBoxSizer32, 0, wxALIGN_LEFT|wxLEFT, 10);
239 
240  wxCheckBox* itemCheckBox33 = new wxCheckBox( itemCDialog1, ID_COMBINE_CHECK, wxT("Combine rows with the same IDs"), wxDefaultPosition, wxDefaultSize, 0 );
241  itemCheckBox33->SetValue(false);
242  itemBoxSizer32->Add(itemCheckBox33, 0, wxALIGN_LEFT|wxALL, 5);
243 
244  wxCheckBox* itemCheckBox34 = new wxCheckBox( itemCDialog1, ID_SEPARATE_STRANDS, wxT("Separate Strands"), wxDefaultPosition, wxDefaultSize, 0 );
245  itemCheckBox34->SetValue(false);
246  itemBoxSizer32->Add(itemCheckBox34, 0, wxALIGN_LEFT|wxALL, 5);
247 
248  wxStdDialogButtonSizer* itemStdDialogButtonSizer35 = new wxStdDialogButtonSizer;
249 
250  itemBoxSizer2->Add(itemStdDialogButtonSizer35, 0, wxALIGN_RIGHT|wxALL, 5);
251  wxButton* itemButton36 = new wxButton( itemCDialog1, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
252  itemStdDialogButtonSizer35->AddButton(itemButton36);
253 
254  wxButton* itemButton37 = new wxButton( itemCDialog1, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
255  itemStdDialogButtonSizer35->AddButton(itemButton37);
256 
257  itemStdDialogButtonSizer35->Realize();
258 
259  // Set validators
260  itemRadioButton6->SetValidator( wxGenericValidator(& m_Multiple) );
261  m_AnchorIDList->SetValidator( wxGenericValidator(& m_IDIndexes) );
262  itemRadioButton13->SetValidator( wxGenericValidator(& m_Original) );
263  itemRadioButton14->SetValidator( wxGenericValidator(& m_Clip) );
264  itemRadioButton22->SetValidator( wxGenericValidator(& m_Extend) );
265  itemCheckBox33->SetValidator( wxGenericValidator(& m_CombineRows) );
266  itemCheckBox34->SetValidator( wxGenericValidator(& m_SeparateStrands) );
267 ////@end CBuildOptionsDlg content construction
268 }
269 
270 
272 {
273  return true;
274 }
275 
276 
277 wxBitmap CBuildOptionsDlg::GetBitmapResource( const wxString& name )
278 {
279  // Bitmap retrieval
280  wxUnusedVar(name);
281  return wxNullBitmap;
282 }
283 
284 
285 wxIcon CBuildOptionsDlg::GetIconResource( const wxString& name )
286 {
287  wxUnusedVar(name);
288  return wxNullIcon;
289 }
290 
291 void CBuildOptionsDlg::OnMultipleRadioSelected( wxCommandEvent& event )
292 {
295 }
296 
297 void CBuildOptionsDlg::OnQueryRadioSelected( wxCommandEvent& event )
298 {
301 }
302 
303 void CBuildOptionsDlg::OnOriginalRadioSelected( wxCommandEvent& event )
304 {
305 }
306 
307 void CBuildOptionsDlg::OnClipRadioSelected( wxCommandEvent& event )
308 {
309 }
310 
311 void CBuildOptionsDlg::OnExtendRadioSelected( wxCommandEvent& event )
312 {
313 }
314 
315 void CBuildOptionsDlg::OnShowFlankRadioSelected( wxCommandEvent& event )
316 {
317 }
318 
319 void CBuildOptionsDlg::OnShowUaRadioSelected( wxCommandEvent& event )
320 {
321 }
322 
323 
324 void CBuildOptionsDlg::SetParams(const CAlnMultiDSBuilder::TOptions& options, const vector<CBioseq_Handle>& handles, objects::CScope& scope)
325 {
326  m_Options = options;
327  m_Handles = handles;
328  m_Scope.Reset(&scope);
329 
330  // fill ID List
331  vector<string> ids;
332  for( size_t i = 0; i< m_Handles.size(); i++ ) {
333  ids.push_back(sequence::CDeflineGenerator().GenerateDefline(m_Handles[i]));
334  }
336 
337  m_CombineRows = (m_Options.m_MergeAlgo == TOptions::eMergeAllSeqs);
338  m_SeparateStrands = (m_Options.m_MergeFlags & TOptions::fAllowMixedStrand) == 0;
339 
343 
344  //m_ShowFlanking = m_Options.m_UnalignedOption == TOptions::eShowFlankingN;
345 }
346 
347 
349 {
350  m_AnchorIDList->Enable( ! m_Multiple);
351 
352  m_StartText->Enable(m_Clip);
353  m_EndText->Enable(m_Clip);
354 
355  m_ExtentText->Enable(m_Extend);
356 
357  //m_FlankText->Enable
358  return wxDialog::TransferDataToWindow();
359 }
360 
362 {
363  return wxDialog::TransferDataFromWindow();
364 }
365 
366 
367 
369 {
370 }
371 
372 
Options for different alignment manager operations.
EMergeAlgo m_MergeAlgo
TMergeFlags m_MergeFlags
CwxBuildOptionsDlg.
void OnClipRadioSelected(wxCommandEvent &event)
void SetParams(const CAlnMultiDSBuilder::TOptions &options, const vector< CBioseq_Handle > &handles, objects::CScope &scope)
void OnShowUaRadioSelected(wxCommandEvent &event)
void GetOptions(CAlnMultiDSBuilder::TOptions &options)
virtual bool TransferDataFromWindow()
void OnMultipleRadioSelected(wxCommandEvent &event)
virtual bool TransferDataToWindow()
vector< CBioseq_Handle > m_Handles
void OnOriginalRadioSelected(wxCommandEvent &event)
wxIcon GetIconResource(const wxString &name)
CAlnMultiDSBuilder::TOptions m_Options
wxBitmap GetBitmapResource(const wxString &name)
void OnShowFlankRadioSelected(wxCommandEvent &event)
void OnQueryRadioSelected(wxCommandEvent &event)
void OnExtendRadioSelected(wxCommandEvent &event)
bool Create(wxWindow *parent, wxWindowID id=ID_CWXBUILDOPTIONSDLG, const wxString &caption=wxT("Build Alignment"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
CDialog.
Definition: dialog.hpp:47
static void Init(void)
Definition: cursor6.c:76
void Init_wxControl(wxControlWithItems &combo, const vector< string > &values)
FillComboBox() initializes wxWidgets controls with a list of text strings; works for wxListBox,...
#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
END_EVENT_TABLE()
int i
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
static static static wxID_ANY
CAlnMultiDSBuilder::TOptions TOptions
vector< CBioseq_Handle > THandles
Modified on Fri Mar 01 10:05:46 2024 by modify_doxy.py rev. 669887