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

Go to the SVN repository for this file.

1 /* $Id: cleanup_alignments_params_panel.cpp 39666 2017-10-25 16:01:13Z katargir $
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: Andrey Yazhuk
27  *
28  * File Description:
29  *
30  */
31 
32 // Generated by DialogBlocks (unregistered), 18/07/2008 15:31:02
33 
34 #include <ncbi_pch.hpp>////@begin includes
35 ////@end includes
36 
39 
40 #include <wx/sizer.h>
41 #include <wx/statbox.h>
42 #include <wx/stattext.h>
43 #include <wx/checkbox.h>
44 
46 
47 
49 {
50  Init();
51 }
52 
54 {
58  m_AlnMgr_PreserveRows = false;
59  m_AlnMgr_Transloc = false;
60  m_AlnMgr_Sort = true;
61  m_AlnMgr_FillUnaligned = false;
62 }
63 
64 void SCleanupAlignmentsParams::SetRegistryPath(const string& WXUNUSED(reg_path))
65 {
66 }
67 
69 {
70 
71 }
72 
74 {
75 
76 }
77 
78 
79 /////////////////////////////////////////////////////////////////////////////
80 
81 
82 
84 
86 
87 ////@begin CCleanupAlignmentsParamsPanel event table entries
89 
90 ////@end CCleanupAlignmentsParamsPanel event table entries
91 
93 
95  : m_Params(NULL)
96  , m_InputObjects(NULL)
97  , m_InputListDirty(true)
98 {
99  Init();
100 }
101 
102 CCleanupAlignmentsParamsPanel::CCleanupAlignmentsParamsPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
103 {
104  Init();
105  Create(parent, id, pos, size, style);
106 }
107 
108 bool CCleanupAlignmentsParamsPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
109 {
110 ////@begin CCleanupAlignmentsParamsPanel creation
111  CAlgoToolManagerParamsPanel::Create( parent, id, pos, size, style );
112 
113  CreateControls();
114  if (GetSizer())
115  {
116  GetSizer()->SetSizeHints(this);
117  }
118  Centre();
119 ////@end CCleanupAlignmentsParamsPanel creation
120  return true;
121 }
122 
124 {
125 ////@begin CCleanupAlignmentsParamsPanel destruction
126 ////@end CCleanupAlignmentsParamsPanel destruction
127 }
128 
130 {
131 ////@begin CCleanupAlignmentsParamsPanel member initialisation
132  m_ObjectList = NULL;
141 ////@end CCleanupAlignmentsParamsPanel member initialisation
142 }
143 
145 {
146 ////@begin CCleanupAlignmentsParamsPanel content construction
147  CCleanupAlignmentsParamsPanel* itemCAlgoToolManagerParamsPanel1 = this;
148 
149  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
150  itemCAlgoToolManagerParamsPanel1->SetSizer(itemBoxSizer2);
151 
152  wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemCAlgoToolManagerParamsPanel1, wxID_ANY, _("Choose a set of alignments"));
153  wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL);
154  itemBoxSizer2->Add(itemStaticBoxSizer3, 1, wxGROW|wxALL, 5);
155 
156  m_ObjectList = new CObjectListWidget( itemStaticBoxSizer3->GetStaticBox(), ID_LISTCTRL2, wxDefaultPosition, wxSize(100, 200), wxLC_REPORT );
157  itemStaticBoxSizer3->Add(m_ObjectList, 1, wxGROW|wxALL, 5);
158 
159  wxArrayString m_AlgoSelectorStrings;
160  m_AlgoSelectorStrings.Add(_("Alignment Manager"));
161  m_AlgoSelectorStrings.Add(_("Hit Filter"));
162  m_AlgoSelector = new wxComboBox( itemCAlgoToolManagerParamsPanel1, ID_COMBOBOX, _("Alignment Manager"), wxDefaultPosition, wxDefaultSize, m_AlgoSelectorStrings, wxCB_READONLY|wxCB_SORT );
163  m_AlgoSelector->SetStringSelection(_("Alignment Manager"));
164  itemBoxSizer2->Add(m_AlgoSelector, 0, wxGROW|wxALL, 5);
165 
166  m_ParamsPanel = new wxBoxSizer(wxVERTICAL);
167  itemBoxSizer2->Add(m_ParamsPanel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
168 
169  wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL);
170  m_ParamsPanel->Add(itemBoxSizer7, 0, wxGROW|wxALL, 5);
171 
172  wxFlexGridSizer* itemFlexGridSizer8 = new wxFlexGridSizer(0, 2, 0, 0);
173  itemBoxSizer7->Add(itemFlexGridSizer8, 0, wxALIGN_RIGHT|wxALL, 0);
174 
175  wxStaticText* itemStaticText9 = new wxStaticText( itemCAlgoToolManagerParamsPanel1, wxID_STATIC, _("Minimum alignment identity"), wxDefaultPosition, wxDefaultSize, 0 );
176  itemFlexGridSizer8->Add(itemStaticText9, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
177 
178  m_HitFilter_MinIdentity = new wxTextCtrl( itemCAlgoToolManagerParamsPanel1, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
179  itemFlexGridSizer8->Add(m_HitFilter_MinIdentity, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
180 
181  wxFlexGridSizer* itemFlexGridSizer11 = new wxFlexGridSizer(0, 2, 0, 0);
182  itemBoxSizer7->Add(itemFlexGridSizer11, 0, wxALIGN_RIGHT|wxALL, 0);
183 
184  wxStaticText* itemStaticText12 = new wxStaticText( itemCAlgoToolManagerParamsPanel1, wxID_STATIC, _("Minimum alignment length"), wxDefaultPosition, wxDefaultSize, 0 );
185  itemFlexGridSizer11->Add(itemStaticText12, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
186 
187  m_HitFilter_MinLength = new wxTextCtrl( itemCAlgoToolManagerParamsPanel1, ID_TEXTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
188  itemFlexGridSizer11->Add(m_HitFilter_MinLength, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
189 
190  wxFlexGridSizer* itemFlexGridSizer14 = new wxFlexGridSizer(0, 2, 0, 0);
191  m_ParamsPanel->Add(itemFlexGridSizer14, 1, wxALIGN_LEFT|wxALL, 5);
192 
193  m_AlnMgr_Transloc = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX1, _("Permit Translocations"), wxDefaultPosition, wxDefaultSize, 0 );
194  m_AlnMgr_Transloc->SetValue(false);
195  itemFlexGridSizer14->Add(m_AlnMgr_Transloc, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
196 
197  m_AlnMgr_Sort = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX2, _("Sort Segments By Score"), wxDefaultPosition, wxDefaultSize, 0 );
198  m_AlnMgr_Sort->SetValue(true);
199  itemFlexGridSizer14->Add(m_AlnMgr_Sort, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
200 
201  m_AlnMgr_PreserveRows = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX, _("Preserve Self Alignments"), wxDefaultPosition, wxDefaultSize, 0 );
202  m_AlnMgr_PreserveRows->SetValue(false);
203  itemFlexGridSizer14->Add(m_AlnMgr_PreserveRows, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
204 
205  m_AlnMgr_FillUnaligned = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX5, _("Fill Unaligned Regions With Gaps"), wxDefaultPosition, wxDefaultSize, 0 );
206  m_AlnMgr_FillUnaligned->SetValue(false);
207  itemFlexGridSizer14->Add(m_AlnMgr_FillUnaligned, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
208 
209 ////@end CCleanupAlignmentsParamsPanel content construction
210 
211  m_AlnMgr_Transloc->Enable(false);
212 
213  m_ParamsPanel->Show((size_t)0, false);
214  m_ParamsPanel->Show((size_t)1, true);
215  m_ParamsPanel->Layout();
216 
217 }
218 
220 {
222 
223  // Before editing this code, remove the block markers.
224  event.Skip();
225 }
226 
228 {
229  if (m_AlgoSelector->GetCurrentSelection() == 0) {
230  /// alignment manager panel
231  m_ParamsPanel->Show((size_t)0, false);
232  m_ParamsPanel->Show((size_t)1, true);
233  } else {
234  m_ParamsPanel->Show((size_t)0, true);
235  m_ParamsPanel->Show((size_t)1, false);
236  }
237  m_ParamsPanel->Layout();
238 }
239 
241 {
242  return true;
243 }
244 wxBitmap CCleanupAlignmentsParamsPanel::GetBitmapResource( const wxString& name )
245 {
246  // Bitmap retrieval
247 ////@begin CCleanupAlignmentsParamsPanel bitmap retrieval
248  wxUnusedVar(name);
249  return wxNullBitmap;
250 ////@end CCleanupAlignmentsParamsPanel bitmap retrieval
251 }
253 {
254  // Icon retrieval
255 ////@begin CCleanupAlignmentsParamsPanel icon retrieval
256  wxUnusedVar(name);
257  return wxNullIcon;
258 ////@end CCleanupAlignmentsParamsPanel icon retrieval
259 }
260 
261 
263 {
264  m_RegPath = path; // store for later use
265 }
266 
267 
268 static const char* kTableTag = "Table";
269 
271 {
272  if( ! m_RegPath.empty()) {
274  string reg_path = CGuiRegistryUtil::MakeKey(m_RegPath, kTableTag);
275 
276  CRegistryWriteView table_view = gui_reg.GetWriteView(reg_path);
277  m_ObjectList->SaveTableSettings(table_view);
278  }
279 }
280 
281 
283 {
284  if( ! m_RegPath.empty()) {
286  string reg_path = CGuiRegistryUtil::MakeKey(m_RegPath, kTableTag);
287 
288  CRegistryReadView table_view = gui_reg.GetReadView(reg_path);
289  m_ObjectList->LoadTableSettings(table_view);
290  }
291 }
292 
293 
294 
297 {
298  m_Params = params;
300 }
301 
302 
304 {
305  if (m_InputListDirty) {
308  m_InputListDirty = false;
309  }
310 
312  //m_AlnMgr_Transloc->SetValue(m_Params->m_AlnMgr_Transloc);
315 
316  m_HitFilter_MinIdentity->SetValue
318  m_HitFilter_MinLength->SetValue
320 
321 
322  switch (m_Params->m_Algo) {
324  m_AlgoSelector->SetSelection(1);
325  break;
327  m_AlgoSelector->SetSelection(0);
328  break;
329  }
331 
332  return wxPanel::TransferDataToWindow();
333 }
334 
335 
337 {
338  if(wxPanel::TransferDataFromWindow()) {
340 
343  m_Params->m_AlnMgr_Sort = m_AlnMgr_Sort->GetValue();
345 
346  string v;
347  v = ToStdString(m_HitFilter_MinIdentity->GetValue());
349  v = ToStdString(m_HitFilter_MinLength->GetValue());
351 
352  switch (m_AlgoSelector->GetSelection()) {
353  case 0:
355  break;
356 
357  case 1:
359  break;
360  }
361 
362  return true;
363  }
364  return false;
365 }
366 
368 {
369  if (!m_Params)
370  return;
371  m_Params->Init();
373 }
374 
#define true
Definition: bool.h:35
#define ID_COMBOBOX
CAlgoToolManagerParamsPanel.
static string MakeKey(const string &section, const string &key, const string &delim=CGuiRegistry::kDecimalDot)
create a key from a section and a subkey
Definition: registry.cpp:504
CRegistryWriteView GetWriteView(const string &section)
get a read-write view at a particular level.
Definition: registry.cpp:462
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
CRegistryReadView GetReadView(const string &section) const
get a read-only view at a particular level.
Definition: registry.cpp:428
CObjectListWidget - mediator widget.
void SetObjects(TConstScopedObjects &objects)
void GetSelection(TConstScopedObjects &objects)
ISelection-style API.
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
void LoadTableSettings(const CRegistryReadView &view, bool byName=false)
void SaveTableSettings(CRegistryWriteView &view, bool saveSorting=true) const
static const char * kTableTag
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#define NULL
Definition: ncbistd.hpp:225
void SetParams(SCleanupAlignmentsParams *params, TConstScopedObjects *objects)
virtual void SaveSettings() const
override in derived classes
bool Create(wxWindow *parent, wxWindowID id=ID_CCLEANUPALIGNMENTSPARAMSPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
wxBitmap GetBitmapResource(const wxString &name)
void x_AdjustToAlgoSelector()
Switch params panel according to current algo-selector.
virtual void SetRegistryPath(const string &reg_path)
virtual void SetRegistryPath(const string &path)
CAlgoToolManagerParamsPanel.
void RestoreDefaults()
override in derived classes
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
#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 string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
Definition: ncbistr.hpp:5187
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
Definition: ncbistr.cpp:630
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
Definition: ncbistr.cpp:1387
END_EVENT_TABLE()
const struct ncbi::grid::netcache::search::fields::SIZE size
static static static wxID_ANY
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Sun Mar 03 03:12:45 2024 by modify_doxy.py rev. 669887