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

Go to the SVN repository for this file.

1 /* $Id: wx_track_settings_dlg.cpp 23952 2011-06-23 19:12:28Z wuliangs $
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>////@begin includes
32 ////@end includes
33 #include <wx/bitmap.h>
34 #include <wx/icon.h>
35 #include <wx/textctrl.h>
36 #include <wx/stattext.h>
37 #include <wx/button.h>
38 #include <wx/sizer.h>
39 #include <wx/choice.h>
40 #include <wx/combobox.h>
41 
42 
48 
50 
52 
53 ////@begin XPM images
54 ////@end XPM images
55 
56 IMPLEMENT_DYNAMIC_CLASS( CwxTrackSettingsDlg, wxDialog )
57 
58 BEGIN_EVENT_TABLE( CwxTrackSettingsDlg, wxDialog )
59 
60 ////@begin CwxTrackSettingsDlg event table entries
62 
63  EVT_BUTTON( wxID_OK, CwxTrackSettingsDlg::OnOkClick )
64 
65 ////@end CwxTrackSettingsDlg event table entries
66 
68 
70 {
71  Init();
72 }
73 
74 CwxTrackSettingsDlg::CwxTrackSettingsDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
75 {
76  Init();
77  CreateX(parent, id, caption, pos, size, style);
78 }
79 
80 bool CwxTrackSettingsDlg::CreateX( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
81 {
82 ////@begin CwxTrackSettingsDlg creation
83  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
84  wxDialog::Create( parent, id, caption, pos, size, style );
85 
87  if (GetSizer())
88  {
89  GetSizer()->SetSizeHints(this);
90  }
91  Centre();
92 ////@end CwxTrackSettingsDlg creation
93  return true;
94 }
95 
97 {
98 ////@begin CwxTrackSettingsDlg destruction
99 ////@end CwxTrackSettingsDlg destruction
100 }
101 
103 {
104 ////@begin CwxTrackSettingsDlg member initialisation
105  m_TrackType = NULL;
107  m_Subtype = NULL;
108  m_TrackName = NULL;
110  m_Annots = NULL;
111 ////@end CwxTrackSettingsDlg member initialisation
112 }
113 
115 {
116 ////@begin CwxTrackSettingsDlg content construction
117  // Generated by DialogBlocks, 10/05/2011 16:10:49 (unregistered)
118 
119  CwxTrackSettingsDlg* itemDialog1 = this;
120 
121  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
122  itemDialog1->SetSizer(itemBoxSizer2);
123 
124  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
125  itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5);
126 
127  wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Track type:"), wxDefaultPosition, wxDefaultSize, 0 );
128  itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
129 
130  wxArrayString m_TrackTypeStrings;
131  m_TrackType = new wxChoice( itemDialog1, ID_CHOICE, wxDefaultPosition, wxSize(150, -1), m_TrackTypeStrings, 0 );
132  itemBoxSizer3->Add(m_TrackType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
133 
134  m_SubtypeGroup = new wxBoxSizer(wxHORIZONTAL);
135  itemBoxSizer2->Add(m_SubtypeGroup, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5);
136 
137  wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _("Feature subtype:"), wxDefaultPosition, wxDefaultSize, 0 );
139  itemStaticText7->SetToolTip(_("Feature subtype storage key, such as STS and gene"));
140  m_SubtypeGroup->Add(itemStaticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
141 
142  wxArrayString m_SubtypeStrings;
143  m_Subtype = new wxChoice( itemDialog1, ID_CHOICE1, wxDefaultPosition, wxSize(150, -1), m_SubtypeStrings, 0 );
145  m_Subtype->SetToolTip(_("Feature subtype storage key, such as STS and gene"));
146  m_SubtypeGroup->Add(m_Subtype, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
147 
148  wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
149  itemBoxSizer2->Add(itemBoxSizer9, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5);
150 
151  wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Track title:"), wxDefaultPosition, wxDefaultSize, 0 );
153  itemStaticText10->SetToolTip(_("Track title/name shown on the track title bar. It doesn't need to be unique, but a unique name may help differentiate it from others."));
154  itemBoxSizer9->Add(itemStaticText10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
155 
156  m_TrackName = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0 );
158  m_TrackName->SetToolTip(_("Track title/name shown on the track title bar. It doesn't need to be unique, but a unique name may help differentiate it from others."));
159  itemBoxSizer9->Add(m_TrackName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
160 
161  wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
162  itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5);
163 
164  wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _("Filter:"), wxDefaultPosition, wxDefaultSize, 0 );
166  itemStaticText13->SetToolTip(_("Track-specific filter, not all tracks support filters. It is optional."));
167  itemBoxSizer12->Add(itemStaticText13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
168 
169  m_TrackFilter = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0 );
171  m_TrackFilter->SetToolTip(_("Track-specific filter, not all tracks support filters. It is optional."));
172  itemBoxSizer12->Add(m_TrackFilter, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
173 
174  wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxHORIZONTAL);
175  itemBoxSizer2->Add(itemBoxSizer15, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5);
176 
177  wxStaticText* itemStaticText16 = new wxStaticText( itemDialog1, wxID_STATIC, _("Annotation names:"), wxDefaultPosition, wxDefaultSize, 0 );
179  itemStaticText16->SetToolTip(_("Type in specific annotation names or select one of preset categories. More than one annotations separated using any of \",;|\" are acceptable, e.g. NA000000015.1,NA000000026.1"));
180  itemBoxSizer15->Add(itemStaticText16, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
181 
182  wxArrayString m_AnnotsStrings;
183  m_Annots = new wxComboBox( itemDialog1, ID_COMBOBOX, wxEmptyString, wxDefaultPosition, wxSize(150, -1), m_AnnotsStrings, wxCB_DROPDOWN );
185  m_Annots->SetToolTip(_("Type in specific annotation names or select one of preset categories. More than one annotations separated using any of \",;|\" are acceptable, e.g. NA000000015.1,NA000000026.1."));
186  itemBoxSizer15->Add(m_Annots, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
187 
188  itemBoxSizer2->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
189 
190  wxStdDialogButtonSizer* itemStdDialogButtonSizer19 = new wxStdDialogButtonSizer;
191 
192  itemBoxSizer2->Add(itemStdDialogButtonSizer19, 0, wxALIGN_RIGHT|wxALL, 0);
193  wxButton* itemButton20 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxSize(70, 24), 0 );
194  itemButton20->SetDefault();
195  itemStdDialogButtonSizer19->AddButton(itemButton20);
196 
197  wxButton* itemButton21 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize(70, 24), 0 );
198  itemStdDialogButtonSizer19->AddButton(itemButton21);
199 
200  itemStdDialogButtonSizer19->Realize();
201 
202 ////@end CwxTrackSettingsDlg content construction
203 }
204 
206 {
207  return true;
208 }
209 wxBitmap CwxTrackSettingsDlg::GetBitmapResource( const wxString& name )
210 {
211  // Bitmap retrieval
212 ////@begin CwxTrackSettingsDlg bitmap retrieval
213  wxUnusedVar(name);
214  return wxNullBitmap;
215 ////@end CwxTrackSettingsDlg bitmap retrieval
216 }
217 wxIcon CwxTrackSettingsDlg::GetIconResource( const wxString& name )
218 {
219  // Icon retrieval
220 ////@begin CwxTrackSettingsDlg icon retrieval
221  wxUnusedVar(name);
222  return wxNullIcon;
223 ////@end CwxTrackSettingsDlg icon retrieval
224 }
225 
226 void CwxTrackSettingsDlg::OnOkClick( wxCommandEvent& event )
227 {
228 ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in CwxTrackSettingsDlg.
229  // Before editing this code, remove the block markers.
230  event.Skip();
231 ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in CwxTrackSettingsDlg.
232 }
233 
234 void CwxTrackSettingsDlg::OnTrackTypeChanged( wxCommandEvent& event )
235 {
236  if (m_TrackType->GetStringSelection() ==
238  m_SubtypeGroup->Show(true);
239  } else {
240  m_SubtypeGroup->Show(false);
241  }
242  // Before editing this code, remove the block markers.
243  event.Skip();
244  Layout();
245 }
246 
247 void CwxTrackSettingsDlg::SetTrackName(const wxString& name)
248 {
249  m_TrackName->SetValue(name);
250 }
251 
253  const CTrackConfigManager::TFactoryMap& factories)
254 {
255  m_Subtype->Freeze();
256  m_TrackType->Freeze();
257  m_Annots->Freeze();
258 
259  m_Subtype->Clear();
260  m_TrackType->Clear();
261  m_Annots->Clear();
262 
263  m_Annots->Append(_("All"));
264  m_Annots->Append(_("Named"));
265  m_Annots->Append(_("Unnamed"));
266 
267  const CFeatList& feats(*CSeqFeatData::GetFeatList());
268  ITERATE(CFeatList, iter, feats) {
269  if (iter->GetSubtype() != CSeqFeatData::eSubtype_any) {
270  m_Subtype->Append(ToWxString(iter->GetStoragekey()));
271  }
272  }
273  m_Subtype->Select(0);
274 
275  ITERATE (CTrackConfigManager::TFactoryMap, iter, factories) {
276  if (iter->first !=
278  m_TrackType->Append(ToWxString(iter->first));
279  }
280  }
281  m_TrackType->Select(0);
282 
283  m_Subtype->Thaw();
284  m_TrackType->Thaw();
285  m_Annots->Thaw();
286 
287  m_SubtypeGroup->Show(false);
288  Layout();
289 }
290 
292 {
293  return m_TrackName->GetValue();
294 }
295 
297 {
298  return m_TrackFilter->GetValue();
299 }
300 
302 {
303  return m_TrackType->GetStringSelection();
304 }
305 
307 {
308  return m_Subtype->GetStringSelection();
309 }
310 
312 {
313  return m_Annots->GetValue();
314 }
315 
#define ID_COMBOBOX
#define ID_CHOICE1
static const CTrackTypeInfo & GetTypeInfo()
CConfigurableItems - a static list of items that can be configured.
static const CTrackTypeInfo & GetTypeInfo()
static const CFeatList * GetFeatList()
const string & GetId() const
void InitTrackTypes(const CTrackConfigManager::TFactoryMap &factories)
wxBitmap GetBitmapResource(const wxString &name)
wxString GetTrackFilter() const
void OnOkClick(wxCommandEvent &event)
void SetTrackName(const wxString &name)
user-defined member functions.
void OnTrackTypeChanged(wxCommandEvent &event)
wxIcon GetIconResource(const wxString &name)
bool CreateX(wxWindow *parent, wxWindowID id=10035, const wxString &caption=_("Graphical view new track settings"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 100), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NULL
Definition: ncbistd.hpp:225
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define ID_CHOICE
END_EVENT_TABLE()
const struct ncbi::grid::netcache::search::fields::SIZE size
#define ID_TEXTCTRL1
#define ID_TEXTCTRL
USING_SCOPE(objects)
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
Modified on Sat Apr 13 11:47:22 2024 by modify_doxy.py rev. 669887