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

Go to the SVN repository for this file.

1 /* $Id: muscle_tool_panel.cpp 43792 2019-08-30 18:31:36Z 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: Roman Katargin
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
36 
37 #include "muscle_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 
51 #include "wx/bitmap.h"
52 #include "wx/icon.h"
53 
54 ////@begin includes
55 ////@end includes
56 
59 
60 IMPLEMENT_DYNAMIC_CLASS( CMuscleToolPanel, CAlgoToolManagerParamsPanel )
61 
63 
64 ////@begin CMuscleToolPanel event table entries
65  EVT_BUTTON( ID_BITMAPBUTTON1, CMuscleToolPanel::OnMusclePathClick )
66 ////@end CMuscleToolPanel event table entries
67 
69 
71 {
72  Init();
73 }
74 
75 CMuscleToolPanel::CMuscleToolPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, bool visible )
76 {
77  Init();
78  Create(parent, id, pos, size, style, visible);
79 }
80 
81 bool CMuscleToolPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, bool visible )
82 {
83  SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
84 
85  CAlgoToolManagerParamsPanel::Create( parent, id, pos, size, style );
86 
87  if (!visible) {
88  Hide();
89  }
90 
92  if (GetSizer())
93  {
94  GetSizer()->SetSizeHints(this);
95  }
96  Centre();
97  return true;
98 }
99 
101 {
102 ////@begin CMuscleToolPanel destruction
103 ////@end CMuscleToolPanel destruction
104 }
105 
107 {
108 ////@begin CMuscleToolPanel member initialisation
110 ////@end CMuscleToolPanel member initialisation
111 }
112 
114 {
115 ////@begin CMuscleToolPanel content construction
116  // Generated by DialogBlocks, 30/08/2019 14:25:53 (unregistered)
117 
118  CMuscleToolPanel* itemCAlgoToolManagerParamsPanel1 = this;
119 
120  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
121  itemCAlgoToolManagerParamsPanel1->SetSizer(itemBoxSizer2);
122 
123  m_LocationSel = new CObjectListWidgetSel( itemCAlgoToolManagerParamsPanel1, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
124  itemBoxSizer2->Add(m_LocationSel, 1, wxGROW|wxALL, 0);
125 
126  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
127  itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_RIGHT|wxALL, 0);
128 
129  wxStaticText* itemStaticText5 = new wxStaticText( itemCAlgoToolManagerParamsPanel1, wxID_STATIC, _("Scoring method"), wxDefaultPosition, wxDefaultSize, 0 );
130  itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
131 
132  wxArrayString itemChoice6Strings;
133  itemChoice6Strings.Add(_("log-expectation score (default)"));
134  itemChoice6Strings.Add(_("PAM200"));
135  itemChoice6Strings.Add(_("VTML240"));
136  wxChoice* itemChoice6 = new wxChoice( itemCAlgoToolManagerParamsPanel1, ID_CHOICE2, wxDefaultPosition, wxDefaultSize, itemChoice6Strings, 0 );
137  itemChoice6->SetStringSelection(_("log-expectation score (default)"));
138  itemBoxSizer4->Add(itemChoice6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
139 
140  wxCheckBox* itemCheckBox7 = new wxCheckBox( itemCAlgoToolManagerParamsPanel1, ID_CHECKBOX12, _("Generate reconstructed tree from alignment"), wxDefaultPosition, wxDefaultSize, 0 );
141  itemCheckBox7->SetValue(false);
142  itemBoxSizer2->Add(itemCheckBox7, 0, wxALIGN_LEFT|wxALL, 5);
143 
144  wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
145  itemBoxSizer2->Add(itemBoxSizer8, 0, wxGROW|wxALL, 0);
146 
147  wxStaticText* itemStaticText9 = new wxStaticText( itemCAlgoToolManagerParamsPanel1, wxID_STATIC, _("Command line options"), wxDefaultPosition, wxDefaultSize, 0 );
148  itemBoxSizer8->Add(itemStaticText9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
149 
150  wxTextCtrl* itemTextCtrl10 = new wxTextCtrl( itemCAlgoToolManagerParamsPanel1, ID_TEXTCTRL11, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
151  itemBoxSizer8->Add(itemTextCtrl10, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
152 
153  wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxHORIZONTAL);
154  itemBoxSizer2->Add(itemBoxSizer11, 0, wxGROW|wxALL, 0);
155 
156  wxStaticText* itemStaticText12 = new wxStaticText( itemCAlgoToolManagerParamsPanel1, wxID_STATIC, _("Path to executable"), wxDefaultPosition, wxDefaultSize, 0 );
157  itemBoxSizer11->Add(itemStaticText12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
158 
159  wxTextCtrl* itemTextCtrl13 = new wxTextCtrl( itemCAlgoToolManagerParamsPanel1, ID_TEXTCTRL12, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
160  itemBoxSizer11->Add(itemTextCtrl13, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
161 
162  wxBitmapButton* itemBitmapButton14 = new wxBitmapButton( itemCAlgoToolManagerParamsPanel1, ID_BITMAPBUTTON1, itemCAlgoToolManagerParamsPanel1->GetBitmapResource(wxT("menu::open")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
163  itemBitmapButton14->SetHelpText(_("Select MUSCLE executable"));
165  itemBitmapButton14->SetToolTip(_("Select MUSCLE executable"));
166  itemBoxSizer11->Add(itemBitmapButton14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
167 
168  // Set validators
169  itemChoice6->SetValidator( wxGenericValidator(& GetData().m_ScoringMethod) );
170  itemCheckBox7->SetValidator( wxGenericValidator(& GetData().m_GenerateTree) );
171  itemTextCtrl10->SetValidator( wxTextValidator(wxFILTER_NONE, & GetData().m_CommandLine) );
172  itemTextCtrl13->SetValidator( CExeFileValidator(& GetData().m_MusclePath, wxT("MUSCLE")) );
173 ////@end CMuscleToolPanel content construction
174 
175  m_LocationSel->SetTitle(wxT("Select Locations"));
178  m_LocationSel->EnableGroups(false);
179  m_LocationSel->SetDefaultSelection("Genomic Location (total range)");
180 }
181 
183 {
185 }
186 
188 {
189  return true;
190 }
191 
192 
193 wxBitmap CMuscleToolPanel::GetBitmapResource( const wxString& name )
194 {
195  return wxArtProvider::GetBitmap(name);
196 }
197 
198 wxIcon CMuscleToolPanel::GetIconResource( const wxString& name )
199 {
200  // Icon retrieval
201 ////@begin CMuscleToolPanel icon retrieval
202  wxUnusedVar(name);
203  return wxNullIcon;
204 ////@end CMuscleToolPanel icon retrieval
205 }
206 
208 {
209  if (!CAlgoToolManagerParamsPanel::TransferDataFromWindow())
210  return false;
211 
213 
214  return true;
215 }
216 
217 static const char* kLocationSel = ".LocationSel";
218 
219 void CMuscleToolPanel::SetRegistryPath(const string& path)
220 {
221  m_RegPath = path;
223 }
224 
226 {
228 }
229 
231 {
233 }
234 
235 void CMuscleToolPanel::OnMusclePathClick( wxCommandEvent& WXUNUSED(event) )
236 {
237  wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>(FindWindow(ID_TEXTCTRL12));
238  _ASSERT(nullptr != textCtrl);
239 
240  wxString path = textCtrl->GetValue();
241 
242  wxFileDialog dlg(this, wxT("Select a file"), wxT(""), wxT(""), wxT("*"),
243  wxFD_OPEN|wxFD_FILE_MUST_EXIST);
244 
245  dlg.SetPath(path);
246 
247  if (dlg.ShowModal() != wxID_OK)
248  return;
249 
250  path = dlg.GetPath();
251  textCtrl->SetValue(path);
252 }
253 
255 {
256  GetData().Init();
257  TransferDataToWindow();
258 }
259 
CAlgoToolManagerParamsPanel.
string m_RegPath
registry path to the settings
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
virtual bool TransferDataFromWindow()
wxIcon GetIconResource(const wxString &name)
virtual void LoadSettings()
void RestoreDefaults()
override in derived classes
void OnMusclePathClick(wxCommandEvent &event)
CMuscleToolParams & GetData()
bool Create(wxWindow *parent, wxWindowID id=ID_CMUSCLEPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL, bool visible=true)
virtual void SaveSettings() const
override in derived classes
CObjectListWidgetSel * m_LocationSel
void SetObjects(map< string, TConstScopedObjects > *objects)
wxBitmap GetBitmapResource(const wxString &name)
static bool ShowToolTips()
TConstScopedObjects & SetObjects()
virtual void SetRegistryPath(const string &path)
CAlgoToolManagerParamsPanel.
#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()
#define wxT(x)
Definition: muParser.cpp:41
USING_SCOPE(ncbi::objects)
static const char * kLocationSel
const struct ncbi::grid::netcache::search::fields::SIZE size
#define _ASSERT
Modified on Wed Sep 04 15:04:09 2024 by modify_doxy.py rev. 669887