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

Go to the SVN repository for this file.

1 /* $Id: mafft_tool_panel.cpp 43794 2019-08-30 19:15:21Z 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: Vladislav Evgeniev
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
36 
37 #include "mafft_tool_panel.hpp"
38 
39 #include <wx/sizer.h>
40 #include <wx/stattext.h>
41 #include <wx/choice.h>
42 #include <wx/bmpbuttn.h>
43 #include <wx/checkbox.h>
44 #include <wx/valgen.h>
45 #include <wx/valtext.h>
46 #include <wx/msgdlg.h>
47 #include <wx/filedlg.h>
48 #include <wx/filename.h>
49 #include <wx/artprov.h>
50 #include <wx/bitmap.h>
51 #include <wx/icon.h>
52 
53 ////@begin includes
54 ////@end includes
55 
58 
59 IMPLEMENT_DYNAMIC_CLASS( CMafftToolPanel, CAlgoToolManagerParamsPanel )
60 
61 BEGIN_EVENT_TABLE( CMafftToolPanel, CAlgoToolManagerParamsPanel )
62 
63 ////@begin CMafftToolPanel event table entries
64  EVT_BUTTON( ID_BITMAPBUTTON1, CMafftToolPanel::OnMafftPathClick )
65 ////@end CMafftToolPanel event table entries
66 
68 
70 {
71  Init();
72 }
73 
74 CMafftToolPanel::CMafftToolPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, bool visible )
75 {
76  Init();
77  Create(parent, id, pos, size, style);
78 }
79 
80 bool CMafftToolPanel::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, bool visible)
81 {
82 ////@begin CMafftToolPanel creation
83  SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
84  CAlgoToolManagerParamsPanel::Create( parent, id, pos, size, style );
85 
87  if (GetSizer())
88  {
89  GetSizer()->SetSizeHints(this);
90  }
91  Centre();
92 ////@end CMafftToolPanel creation
93  if (!visible) {
94  Hide();
95  }
96  return true;
97 }
98 
100 {
101 ////@begin CMafftToolPanel destruction
102 ////@end CMafftToolPanel destruction
103 }
104 
106 {
107 ////@begin CMafftToolPanel member initialisation
109 ////@end CMafftToolPanel member initialisation
110 }
111 
113 {
114 ////@begin CMafftToolPanel content construction
115  // Generated by DialogBlocks, 30/08/2019 14:53:34 (unregistered)
116 
117  CMafftToolPanel* itemCAlgoToolManagerParamsPanel1 = this;
118 
119  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
120  itemCAlgoToolManagerParamsPanel1->SetSizer(itemBoxSizer2);
121 
122  m_LocationSel = new CObjectListWidgetSel( itemCAlgoToolManagerParamsPanel1, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
123  itemBoxSizer2->Add(m_LocationSel, 1, wxGROW|wxALL, 0);
124 
125  wxCheckBox* itemCheckBox4 = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX1, _("Automatically select an appropriate strategy from L-INS-i, FFT-NS-i and FFT-NS-2 (default is FFT-NS-2). "), wxDefaultPosition, wxDefaultSize, 0 );
126  itemCheckBox4->SetValue(false);
127  itemBoxSizer2->Add(itemCheckBox4, 0, wxGROW|wxALL, 5);
128 
129  wxCheckBox* itemCheckBox5 = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX, _("Quiet mode (prints nothing to the console)"), wxDefaultPosition, wxDefaultSize, 0 );
130  itemCheckBox5->SetValue(true);
131  itemBoxSizer2->Add(itemCheckBox5, 0, wxGROW|wxALL, 5);
132 
133  wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
134  itemBoxSizer2->Add(itemBoxSizer6, 0, wxGROW|wxALL, 0);
135 
136  wxStaticText* itemStaticText7 = new wxStaticText( itemCAlgoToolManagerParamsPanel1, wxID_STATIC, _("Command line options"), wxDefaultPosition, wxDefaultSize, 0 );
137  itemBoxSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
138 
139  wxTextCtrl* itemTextCtrl8 = new wxTextCtrl( itemCAlgoToolManagerParamsPanel1, ID_TEXTCTRL11, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
140  itemBoxSizer6->Add(itemTextCtrl8, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
141 
142  wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
143  itemBoxSizer2->Add(itemBoxSizer9, 0, wxGROW|wxALL, 0);
144 
145  wxStaticText* itemStaticText10 = new wxStaticText( itemCAlgoToolManagerParamsPanel1, wxID_STATIC, _("Path to executable"), wxDefaultPosition, wxDefaultSize, 0 );
146  itemBoxSizer9->Add(itemStaticText10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
147 
148  wxTextCtrl* itemTextCtrl11 = new wxTextCtrl( itemCAlgoToolManagerParamsPanel1, ID_TEXTCTRL12, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
149  itemBoxSizer9->Add(itemTextCtrl11, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
150 
151  wxBitmapButton* itemBitmapButton12 = new wxBitmapButton( itemCAlgoToolManagerParamsPanel1, ID_BITMAPBUTTON1, itemCAlgoToolManagerParamsPanel1->GetBitmapResource(wxT("menu::open")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
152  itemBitmapButton12->SetHelpText(_("Select MAFFT executable"));
154  itemBitmapButton12->SetToolTip(_("Select MAFFT executable"));
155  itemBoxSizer9->Add(itemBitmapButton12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
156 
157  // Set validators
158  itemCheckBox5->SetValidator( wxGenericValidator(& GetData().m_QuietFlag) );
159  itemTextCtrl8->SetValidator( wxTextValidator(wxFILTER_NONE, & GetData().m_CommandLine) );
160  itemTextCtrl11->SetValidator( CExeFileValidator(& GetData().m_MafftPath, wxT("MAFFT")) );
161 ////@end CMafftToolPanel content construction
162 
163  m_LocationSel->SetTitle(wxT("Select Locations"));
166  m_LocationSel->EnableGroups(false);
167  m_LocationSel->SetDefaultSelection("Genomic Location (total range)");
168 }
169 
171 {
172  return true;
173 }
174 wxBitmap CMafftToolPanel::GetBitmapResource( const wxString& name )
175 {
176  return wxArtProvider::GetBitmap(name);
177 }
178 wxIcon CMafftToolPanel::GetIconResource( const wxString& name )
179 {
180  // Icon retrieval
181 ////@begin CMafftToolPanel icon retrieval
182  wxUnusedVar(name);
183  return wxNullIcon;
184 ////@end CMafftToolPanel icon retrieval
185 }
186 
188 {
189  if (!CAlgoToolManagerParamsPanel::TransferDataFromWindow())
190  return false;
191 
193 
194  return true;
195 }
196 
197 static const char* kLocationSel = ".LocationSel";
198 
199 void CMafftToolPanel::SetRegistryPath(const string& path)
200 {
201  m_RegPath = path;
203 }
204 
206 {
208 }
209 
211 {
213 }
214 
215 void CMafftToolPanel::OnMafftPathClick(wxCommandEvent& WXUNUSED(event))
216 {
217  wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>(FindWindow(ID_TEXTCTRL12));
218  _ASSERT(nullptr != textCtrl);
219 
220  wxString path = textCtrl->GetValue();
221 
222  wxFileDialog dlg(this, wxT("Select a file"), wxT(""), wxT(""), wxT("*"),
223  wxFD_OPEN|wxFD_FILE_MUST_EXIST);
224 
225  dlg.SetPath(path);
226 
227  if (dlg.ShowModal() != wxID_OK)
228  return;
229 
230  path = dlg.GetPath();
231  textCtrl->SetValue(path);
232 }
233 
235 {
236  GetData().Init();
237  TransferDataToWindow();
238 }
239 
241 {
243 }
244 
CAlgoToolManagerParamsPanel.
string m_RegPath
registry path to the settings
virtual bool TransferDataFromWindow()
static bool ShowToolTips()
wxBitmap GetBitmapResource(const wxString &name)
void SetObjects(map< string, TConstScopedObjects > *objects)
CMafftToolParams & GetData()
bool Create(wxWindow *parent, wxWindowID id=ID_CMAFFTPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL, bool visible=true)
void OnMafftPathClick(wxCommandEvent &event)
void RestoreDefaults()
override in derived classes
wxIcon GetIconResource(const wxString &name)
virtual void LoadSettings()
CObjectListWidgetSel * m_LocationSel
virtual void SaveSettings() const
override in derived classes
virtual void SetRegistryPath(const string &path)
CAlgoToolManagerParamsPanel.
virtual void SetRegistryPath(const string &path)
IRegSettings.
void EnableGroups(bool enable=true)
TConstScopedObjects GetSelection() const
void SetObjects(const TObjectListMap &value)
void SetTitle(const wxString &value)
void SetDefaultSelection(const wxString &selection)
virtual void SaveSettings() const
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#define NULL
Definition: ncbistd.hpp:225
TConstScopedObjects & SetObjects()
#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()
USING_SCOPE(ncbi::objects)
static const char * kLocationSel
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
#define _ASSERT
Modified on Sun Mar 03 03:14:57 2024 by modify_doxy.py rev. 669887