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

Go to the SVN repository for this file.

1 /* $Id: wx_phylo_settings_dlg.cpp 47479 2023-05-02 13:24:02Z ucko $
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: Vladimir Tereshkov
27  *
28  * File Description:
29  *
30  */
31 #include <ncbi_pch.hpp>
32 
33 #include <corelib/ncbitime.hpp>
34 #include <corelib/ncbistr.hpp>
35 
36 
39 
42 
44 
45 #include <util/random_gen.hpp>
46 
47 #include <wx/editlbox.h>
48 
49 
50 
51 #include <wx/panel.h>
52 #include <wx/stattext.h>
53 #include <wx/statline.h>
54 #include <wx/statbox.h>
55 #include <wx/combobox.h>
56 #include <wx/sizer.h>
57 #include <wx/clrpicker.h>
58 #include <wx/checklst.h>
59 #include <wx/valgen.h>
60 #include <wx/bitmap.h>
61 #include <wx/icon.h>
62 #include <wx/listbook.h>
63 #include <wx/radiobut.h>
64 #include <wx/slider.h>
65 #include <wx/stattext.h>
66 #include <wx/hyperlink.h>
67 
68 ////@begin XPM images
69 ////@end XPM images
70 
72 
73 IMPLEMENT_DYNAMIC_CLASS( CwxPhyloSettingsDlg, wxDialog )
74 
75 BEGIN_EVENT_TABLE( CwxPhyloSettingsDlg, wxDialog )
76 
77 ////@begin CwxPhyloSettingsDlg event table entries
78  EVT_NOTEBOOK_PAGE_CHANGED( ID_LISTBOOK1, CwxPhyloSettingsDlg::OnListbook1PageChanged )
79 
81 
83 
85 
87 
89 
91 
93 
95 
97 
99 
101 
102  EVT_BUTTON( wxID_OK, CwxPhyloSettingsDlg::OnOkClick )
103 
104 ////@end CwxPhyloSettingsDlg event table entries
105 
107 
109 {
110  Init();
111 }
112 
113 CwxPhyloSettingsDlg::CwxPhyloSettingsDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
114 : m_SampleNode(CPhyloTree::Null())
115 {
116  Init();
117  Create(parent, id, caption, pos, size, style);
118 }
119 
120 bool CwxPhyloSettingsDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
121 {
122 ////@begin CwxPhyloSettingsDlg creation
123  SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY|wxWS_EX_BLOCK_EVENTS);
124  wxDialog::Create( parent, id, caption, pos, size, style );
125 
126  CreateControls();
127  if (GetSizer())
128  {
129  GetSizer()->SetSizeHints(this);
130  }
131  Centre();
132 ////@end CwxPhyloSettingsDlg creation
133  return true;
134 }
135 
137 {
138 ////@begin CwxPhyloSettingsDlg destruction
139 ////@end CwxPhyloSettingsDlg destruction
140 }
141 
143 {
144 ////@begin CwxPhyloSettingsDlg member initialisation
145  m_ResizableCollapsed = false;
146  m_ColorPanel = NULL;
147  m_Coloration = NULL;
162  m_rbSimple = NULL;
163  m_Feature1 = NULL;
164  m_rbBuilder = NULL;
165  m_Feature2 = NULL;
166  m_btnInsert = NULL;
171  m_FontFace = NULL;
172  m_FontSize = NULL;
174 ////@end CwxPhyloSettingsDlg member initialisation
175 }
176 
178 {
179 ////@begin CwxPhyloSettingsDlg content construction
180  CwxPhyloSettingsDlg* itemDialog1 = this;
181 
182  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
183  itemDialog1->SetSizer(itemBoxSizer2);
184 
185  wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(2, 1, 0, 0);
186  itemBoxSizer2->Add(itemFlexGridSizer3, 1, wxGROW|wxALL, 5);
187 
188  wxNotebook* itemNotebook4 = new wxNotebook( itemDialog1, ID_LISTBOOK1, wxDefaultPosition, wxDefaultSize, wxBK_DEFAULT );
189 
190  m_ColorPanel = new wxPanel( itemNotebook4, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
191  m_ColorPanel->SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
192  wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
193  m_ColorPanel->SetSizer(itemBoxSizer6);
194 
195  wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxHORIZONTAL);
196  itemBoxSizer6->Add(itemBoxSizer7, 0, wxGROW|wxLEFT|wxRIGHT, 5);
197  wxArrayString m_ColorationStrings;
198  m_ColorationStrings.Add(_("&Use Color palette"));
199  m_ColorationStrings.Add(_("&Perform coloration of tree clusters"));
200  m_ColorationStrings.Add(_("&Use monochrome palette"));
201  m_Coloration = new wxRadioBox( m_ColorPanel, ID_COLORATION_RADIOBOX, _("Coloration Options"), wxDefaultPosition, wxDefaultSize, m_ColorationStrings, 1, wxRA_SPECIFY_COLS );
202  m_Coloration->SetSelection(0);
203  itemBoxSizer7->Add(m_Coloration, 1, wxALIGN_TOP|wxLEFT|wxRIGHT, 5);
204 
205  wxStaticBox* itemStaticBoxSizer9Static = new wxStaticBox(m_ColorPanel, wxID_ANY, _("Color Matrix"));
206  wxStaticBoxSizer* itemStaticBoxSizer9 = new wxStaticBoxSizer(itemStaticBoxSizer9Static, wxVERTICAL);
207  itemBoxSizer6->Add(itemStaticBoxSizer9, 0, wxGROW, 5);
208  wxFlexGridSizer* itemFlexGridSizer10 = new wxFlexGridSizer(5, 4, 2, 2);
209  itemStaticBoxSizer9->Add(itemFlexGridSizer10, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, 5);
210  wxStaticText* itemStaticText11 = new wxStaticText( itemStaticBoxSizer9->GetStaticBox(), wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
211  itemFlexGridSizer10->Add(itemStaticText11, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
212 
213  wxStaticText* itemStaticText12 = new wxStaticText( itemStaticBoxSizer9->GetStaticBox(), wxID_STATIC, _("Node Color"), wxDefaultPosition, wxDefaultSize, 0 );
214  itemFlexGridSizer10->Add(itemStaticText12, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
215 
216  wxStaticText* itemStaticText13 = new wxStaticText( itemStaticBoxSizer9->GetStaticBox(), wxID_STATIC, _("Edge Color"), wxDefaultPosition, wxDefaultSize, 0 );
217  itemFlexGridSizer10->Add(itemStaticText13, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
218 
219  wxStaticText* itemStaticText14 = new wxStaticText( itemStaticBoxSizer9->GetStaticBox(), wxID_STATIC, _("Label Color"), wxDefaultPosition, wxDefaultSize, 0 );
220  itemFlexGridSizer10->Add(itemStaticText14, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
221 
222  wxStaticText* itemStaticText15 = new wxStaticText( itemStaticBoxSizer9->GetStaticBox(), wxID_STATIC, _("Default"), wxDefaultPosition, wxDefaultSize, 0 );
223  itemFlexGridSizer10->Add(itemStaticText15, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
224 
225  m_NodeColorDefault = new wxColourPickerCtrl( itemStaticBoxSizer9->GetStaticBox(), ID_TEXTCTRL2, wxColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
226  itemFlexGridSizer10->Add(m_NodeColorDefault, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
227 
228  m_EdgeColorDefault = new wxColourPickerCtrl( itemStaticBoxSizer9->GetStaticBox(), ID_TEXTCTRL3, wxColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
229  itemFlexGridSizer10->Add(m_EdgeColorDefault, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
230 
231  m_LabelColorDefault = new wxColourPickerCtrl( itemStaticBoxSizer9->GetStaticBox(), ID_TEXTCTRL4, wxColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
232  itemFlexGridSizer10->Add(m_LabelColorDefault, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
233 
234  wxStaticText* itemStaticText19 = new wxStaticText( itemStaticBoxSizer9->GetStaticBox(), ID_TEXTCTRL5, _("Selection"), wxDefaultPosition, wxDefaultSize, 0 );
235  itemFlexGridSizer10->Add(itemStaticText19, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
236 
237  m_NodeColorSelection = new wxColourPickerCtrl( itemStaticBoxSizer9->GetStaticBox(), ID_TEXTCTRL6, wxColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
238  itemFlexGridSizer10->Add(m_NodeColorSelection, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
239 
240  m_EdgeColorSelection = new wxColourPickerCtrl( itemStaticBoxSizer9->GetStaticBox(), ID_TEXTCTRL7, wxColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
241  itemFlexGridSizer10->Add(m_EdgeColorSelection, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
242 
243  m_LabelColorSelection = new wxColourPickerCtrl( itemStaticBoxSizer9->GetStaticBox(), ID_TEXTCTRL8, wxColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
244  itemFlexGridSizer10->Add(m_LabelColorSelection, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
245 
246  wxStaticText* itemStaticText23 = new wxStaticText( itemStaticBoxSizer9->GetStaticBox(), ID_TEXTCTRL9, _("Trace to Root"), wxDefaultPosition, wxDefaultSize, 0 );
247  itemFlexGridSizer10->Add(itemStaticText23, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
248 
249  m_NodeColorTrace = new wxColourPickerCtrl( itemStaticBoxSizer9->GetStaticBox(), ID_TEXTCTRL10, wxColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
250  itemFlexGridSizer10->Add(m_NodeColorTrace, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
251 
252  m_EdgeColorTrace = new wxColourPickerCtrl( itemStaticBoxSizer9->GetStaticBox(), ID_TEXTCTRL11, wxColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
253  itemFlexGridSizer10->Add(m_EdgeColorTrace, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
254 
255  m_LabelColorTrace = new wxColourPickerCtrl( itemStaticBoxSizer9->GetStaticBox(), ID_TEXTCTRL12, wxColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
256  itemFlexGridSizer10->Add(m_LabelColorTrace, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
257 
258  wxStaticText* itemStaticText27 = new wxStaticText( itemStaticBoxSizer9->GetStaticBox(), wxID_STATIC, _("Common Path"), wxDefaultPosition, wxDefaultSize, 0 );
259  itemFlexGridSizer10->Add(itemStaticText27, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
260 
261  m_NodeColorCommon = new wxColourPickerCtrl( itemStaticBoxSizer9->GetStaticBox(), ID_COLOURPICKERCTRL, wxColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
262  itemFlexGridSizer10->Add(m_NodeColorCommon, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
263 
264  m_EdgeColorCommon = new wxColourPickerCtrl( itemStaticBoxSizer9->GetStaticBox(), ID_COLOURPICKERCTRL1, wxColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
265  itemFlexGridSizer10->Add(m_EdgeColorCommon, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
266 
267  m_LabelColorCommon = new wxColourPickerCtrl( itemStaticBoxSizer9->GetStaticBox(), ID_COLOURPICKERCTRL2, wxColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
268  itemFlexGridSizer10->Add(m_LabelColorCommon, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
269 
270  wxStaticBox* itemStaticBoxSizer31Static = new wxStaticBox(m_ColorPanel, wxID_ANY, _("Selection Options"));
271  wxStaticBoxSizer* itemStaticBoxSizer31 = new wxStaticBoxSizer(itemStaticBoxSizer31Static, wxVERTICAL);
272  itemBoxSizer6->Add(itemStaticBoxSizer31, 1, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5);
273  wxPanel* itemPanel32 = new wxPanel( itemStaticBoxSizer31->GetStaticBox(), ID_PANEL, wxDefaultPosition, wxSize(-1, 60), wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
274  itemStaticBoxSizer31->Add(itemPanel32, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
275  wxBoxSizer* itemBoxSizer33 = new wxBoxSizer(wxHORIZONTAL);
276  itemPanel32->SetSizer(itemBoxSizer33);
277 
278  wxStaticText* itemStaticText34 = new wxStaticText( itemPanel32, wxID_STATIC, _("Transparency factor when not selected"), wxDefaultPosition, wxDefaultSize, 0 );
279  itemBoxSizer33->Add(itemStaticText34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
280 
281  m_SelectionAlpha = new wxSlider( itemPanel32, ID_SELECTION_ALPHA_SLIDER, 10, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
283  m_SelectionAlpha->SetToolTip(_("Transparency value used when choosing to hide non-selected elements"));
284  itemBoxSizer33->Add(m_SelectionAlpha, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
285 
286  m_SelectionAlphaText = new wxStaticText( itemPanel32, wxID_STATIC, _("0.1"), wxDefaultPosition, wxDefaultSize, 0 );
288  m_SelectionAlphaText->SetToolTip(_("Transparency value used when choosing to hide non-selected elements"));
289  itemBoxSizer33->Add(m_SelectionAlphaText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 10);
290 
291  itemBoxSizer33->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5);
292 
293  itemNotebook4->AddPage(m_ColorPanel, _("Colors"));
294 
295  wxPanel* itemPanel38 = new wxPanel( itemNotebook4, ID_PANEL2, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
296  wxBoxSizer* itemBoxSizer39 = new wxBoxSizer(wxVERTICAL);
297  itemPanel38->SetSizer(itemBoxSizer39);
298 
299  wxStaticBox* itemStaticBoxSizer40Static = new wxStaticBox(itemPanel38, wxID_ANY, _("Label Selection"));
300  wxStaticBoxSizer* itemStaticBoxSizer40 = new wxStaticBoxSizer(itemStaticBoxSizer40Static, wxVERTICAL);
301  itemBoxSizer39->Add(itemStaticBoxSizer40, 0, wxGROW|wxALL, 5);
302  wxBoxSizer* itemBoxSizer41 = new wxBoxSizer(wxHORIZONTAL);
303  itemStaticBoxSizer40->Add(itemBoxSizer41, 0, wxALIGN_LEFT|wxALL, 5);
304  m_rbSimple = new wxRadioButton( itemStaticBoxSizer40->GetStaticBox(), ID_RADIOBUTTON1, _("Simple Labels Using Property:"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
305  m_rbSimple->SetValue(true);
306  itemBoxSizer41->Add(m_rbSimple, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
307 
308  wxArrayString m_Feature1Strings;
309  m_Feature1 = new wxChoice( itemStaticBoxSizer40->GetStaticBox(), ID_CHOICE1, wxDefaultPosition, wxDefaultSize, m_Feature1Strings, 0 );
310  itemBoxSizer41->Add(m_Feature1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
311 
312  wxBoxSizer* itemBoxSizer44 = new wxBoxSizer(wxHORIZONTAL);
313  itemStaticBoxSizer40->Add(itemBoxSizer44, 0, wxALIGN_LEFT|wxALL, 5);
314  m_rbBuilder = new wxRadioButton( itemStaticBoxSizer40->GetStaticBox(), ID_RADIOBUTTON2, _("Custom Labels Using Properties:"), wxDefaultPosition, wxDefaultSize, 0 );
315  m_rbBuilder->SetValue(false);
316  itemBoxSizer44->Add(m_rbBuilder, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
317 
318  wxArrayString m_Feature2Strings;
319  m_Feature2 = new wxChoice( itemStaticBoxSizer40->GetStaticBox(), ID_CHOICE2, wxDefaultPosition, wxDefaultSize, m_Feature2Strings, 0 );
320  itemBoxSizer44->Add(m_Feature2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
321 
322  m_btnInsert = new wxButton( itemStaticBoxSizer40->GetStaticBox(), ID_BUTTON1, _("Insert"), wxDefaultPosition, wxSize(60, -1), 0 );
323  itemBoxSizer44->Add(m_btnInsert, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
324 
325  wxStaticText* itemStaticText48 = new wxStaticText( itemStaticBoxSizer40->GetStaticBox(), wxID_STATIC, _("Format String"), wxDefaultPosition, wxDefaultSize, 0 );
326  itemStaticBoxSizer40->Add(itemStaticText48, 0, wxALIGN_LEFT|wxALL, 5);
327 
328  m_FormatString = new wxTextCtrl( itemStaticBoxSizer40->GetStaticBox(), ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
329  itemStaticBoxSizer40->Add(m_FormatString, 0, wxGROW|wxALL, 5);
330 
331  wxBoxSizer* itemBoxSizer50 = new wxBoxSizer(wxHORIZONTAL);
332  itemStaticBoxSizer40->Add(itemBoxSizer50, 0, wxALIGN_LEFT|wxALL, 5);
333  m_SetMaxLabelLenCheck = new wxCheckBox( itemStaticBoxSizer40->GetStaticBox(), ID_MAX_LABEL_LEN_CHECK, _("Set Maximum Label Length"), wxDefaultPosition, wxDefaultSize, 0 );
334  m_SetMaxLabelLenCheck->SetValue(false);
335  itemBoxSizer50->Add(m_SetMaxLabelLenCheck, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
336 
337  m_MaxLabelLenValue = new wxTextCtrl( itemStaticBoxSizer40->GetStaticBox(), ID_MAX_LABEL_LEN_VALUE, _("-1"), wxDefaultPosition, wxDefaultSize, wxTE_RIGHT );
338  itemBoxSizer50->Add(m_MaxLabelLenValue, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
339 
340  wxStaticBox* itemStaticBoxSizer53Static = new wxStaticBox(itemPanel38, wxID_ANY, _("Testing Area"));
341  wxStaticBoxSizer* itemStaticBoxSizer53 = new wxStaticBoxSizer(itemStaticBoxSizer53Static, wxVERTICAL);
342  itemBoxSizer39->Add(itemStaticBoxSizer53, 0, wxGROW|wxALL, 5);
343  wxStaticText* itemStaticText54 = new wxStaticText( itemStaticBoxSizer53->GetStaticBox(), wxID_STATIC, _("Sample Label (random tree node)"), wxDefaultPosition, wxDefaultSize, 0 );
344  itemStaticBoxSizer53->Add(itemStaticText54, 0, wxALIGN_LEFT|wxALL, 5);
345 
346  m_SampleLabel = new wxTextCtrl( itemStaticBoxSizer53->GetStaticBox(), ID_TEXTCTRL13, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
347  itemStaticBoxSizer53->Add(m_SampleLabel, 0, wxGROW|wxALL, 5);
348 
349  wxBoxSizer* itemBoxSizer56 = new wxBoxSizer(wxHORIZONTAL);
350  itemStaticBoxSizer53->Add(itemBoxSizer56, 0, wxALIGN_LEFT|wxALL, 5);
351  wxButton* itemButton57 = new wxButton( itemStaticBoxSizer53->GetStaticBox(), ID_BUTTON2, _("Randomize Node"), wxDefaultPosition, wxDefaultSize, 0 );
352  itemBoxSizer56->Add(itemButton57, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
353 
354  itemNotebook4->AddPage(itemPanel38, _("Labels"));
355 
356  wxPanel* itemPanel58 = new wxPanel( itemNotebook4, ID_PANEL3, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
357  wxBoxSizer* itemBoxSizer59 = new wxBoxSizer(wxVERTICAL);
358  itemPanel58->SetSizer(itemBoxSizer59);
359 
360  wxStaticBox* itemStaticBoxSizer60Static = new wxStaticBox(itemPanel58, wxID_ANY, _("Margins"));
361  wxStaticBoxSizer* itemStaticBoxSizer60 = new wxStaticBoxSizer(itemStaticBoxSizer60Static, wxVERTICAL);
362  itemBoxSizer59->Add(itemStaticBoxSizer60, 0, wxGROW|wxALL, 5);
363  wxGridSizer* itemGridSizer61 = new wxGridSizer(2, 2, 0, 0);
364  itemStaticBoxSizer60->Add(itemGridSizer61, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
365  wxBoxSizer* itemBoxSizer62 = new wxBoxSizer(wxHORIZONTAL);
366  itemGridSizer61->Add(itemBoxSizer62, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 0);
367  wxStaticText* itemStaticText63 = new wxStaticText( itemStaticBoxSizer60->GetStaticBox(), wxID_STATIC, _("Left"), wxDefaultPosition, wxDefaultSize, 0 );
368  itemBoxSizer62->Add(itemStaticText63, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
369 
370  wxTextCtrl* itemTextCtrl64 = new wxTextCtrl( itemStaticBoxSizer60->GetStaticBox(), ID_TEXTCTRL19, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
371  itemBoxSizer62->Add(itemTextCtrl64, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
372 
373  wxBoxSizer* itemBoxSizer65 = new wxBoxSizer(wxHORIZONTAL);
374  itemGridSizer61->Add(itemBoxSizer65, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 0);
375  wxStaticText* itemStaticText66 = new wxStaticText( itemStaticBoxSizer60->GetStaticBox(), wxID_STATIC, _("Top"), wxDefaultPosition, wxDefaultSize, 0 );
376  itemBoxSizer65->Add(itemStaticText66, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
377 
378  wxTextCtrl* itemTextCtrl67 = new wxTextCtrl( itemStaticBoxSizer60->GetStaticBox(), ID_TEXTCTRL20, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
379  itemBoxSizer65->Add(itemTextCtrl67, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
380 
381  wxBoxSizer* itemBoxSizer68 = new wxBoxSizer(wxHORIZONTAL);
382  itemGridSizer61->Add(itemBoxSizer68, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 0);
383  wxStaticText* itemStaticText69 = new wxStaticText( itemStaticBoxSizer60->GetStaticBox(), wxID_STATIC, _("Bottom"), wxDefaultPosition, wxDefaultSize, 0 );
384  itemBoxSizer68->Add(itemStaticText69, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
385 
386  wxTextCtrl* itemTextCtrl70 = new wxTextCtrl( itemStaticBoxSizer60->GetStaticBox(), ID_TEXTCTRL21, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
387  itemBoxSizer68->Add(itemTextCtrl70, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
388 
389  wxBoxSizer* itemBoxSizer71 = new wxBoxSizer(wxHORIZONTAL);
390  itemGridSizer61->Add(itemBoxSizer71, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 0);
391  wxStaticText* itemStaticText72 = new wxStaticText( itemStaticBoxSizer60->GetStaticBox(), wxID_STATIC, _("Right"), wxDefaultPosition, wxDefaultSize, 0 );
392  itemBoxSizer71->Add(itemStaticText72, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
393 
394  wxTextCtrl* itemTextCtrl73 = new wxTextCtrl( itemStaticBoxSizer60->GetStaticBox(), ID_TEXTCTRL22, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
395  itemBoxSizer71->Add(itemTextCtrl73, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
396 
397  wxStaticBox* itemStaticBoxSizer74Static = new wxStaticBox(itemPanel58, wxID_ANY, _("Sizes"));
398  wxStaticBoxSizer* itemStaticBoxSizer74 = new wxStaticBoxSizer(itemStaticBoxSizer74Static, wxVERTICAL);
399  itemBoxSizer59->Add(itemStaticBoxSizer74, 0, wxGROW|wxALL, 5);
400  wxGridSizer* itemGridSizer75 = new wxGridSizer(2, 2, 0, 0);
401  itemStaticBoxSizer74->Add(itemGridSizer75, 0, wxGROW|wxALL, 5);
402  wxBoxSizer* itemBoxSizer76 = new wxBoxSizer(wxHORIZONTAL);
403  itemGridSizer75->Add(itemBoxSizer76, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 0);
404  wxStaticText* itemStaticText77 = new wxStaticText( itemStaticBoxSizer74->GetStaticBox(), wxID_STATIC, _("Node Size"), wxDefaultPosition, wxDefaultSize, 0 );
405  itemBoxSizer76->Add(itemStaticText77, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
406 
407  wxTextCtrl* itemTextCtrl78 = new wxTextCtrl( itemStaticBoxSizer74->GetStaticBox(), ID_TEXTCTRL17, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
408  itemBoxSizer76->Add(itemTextCtrl78, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
409 
410  wxBoxSizer* itemBoxSizer79 = new wxBoxSizer(wxHORIZONTAL);
411  itemGridSizer75->Add(itemBoxSizer79, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 0);
412  wxStaticText* itemStaticText80 = new wxStaticText( itemStaticBoxSizer74->GetStaticBox(), wxID_STATIC, _("Leaf Size"), wxDefaultPosition, wxDefaultSize, 0 );
413  itemBoxSizer79->Add(itemStaticText80, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
414 
415  wxTextCtrl* itemTextCtrl81 = new wxTextCtrl( itemStaticBoxSizer74->GetStaticBox(), ID_TEXTCTRL23, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
416  itemBoxSizer79->Add(itemTextCtrl81, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
417 
418  wxBoxSizer* itemBoxSizer82 = new wxBoxSizer(wxHORIZONTAL);
419  itemGridSizer75->Add(itemBoxSizer82, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 0);
420  wxStaticText* itemStaticText83 = new wxStaticText( itemStaticBoxSizer74->GetStaticBox(), wxID_STATIC, _("Max Node Size"), wxDefaultPosition, wxDefaultSize, 0 );
421  itemBoxSizer82->Add(itemStaticText83, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
422 
423  wxTextCtrl* itemTextCtrl84 = new wxTextCtrl( itemStaticBoxSizer74->GetStaticBox(), m_TEXTCTRL24, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
424  itemBoxSizer82->Add(itemTextCtrl84, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
425 
426  wxBoxSizer* itemBoxSizer85 = new wxBoxSizer(wxHORIZONTAL);
427  itemGridSizer75->Add(itemBoxSizer85, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 0);
428  wxStaticText* itemStaticText86 = new wxStaticText( itemStaticBoxSizer74->GetStaticBox(), wxID_STATIC, _("Line Width"), wxDefaultPosition, wxDefaultSize, 0 );
429  itemBoxSizer85->Add(itemStaticText86, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
430 
431  wxTextCtrl* itemTextCtrl87 = new wxTextCtrl( itemStaticBoxSizer74->GetStaticBox(), ID_TEXTCTRL18, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
432  itemBoxSizer85->Add(itemTextCtrl87, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
433 
434  wxCheckBox* itemCheckBox88 = new wxCheckBox( itemStaticBoxSizer74->GetStaticBox(), ID_CHECKBOX, _("Resizable Collapsed Nodes"), wxDefaultPosition, wxDefaultSize, 0 );
435  itemCheckBox88->SetValue(false);
436  itemStaticBoxSizer74->Add(itemCheckBox88, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
437 
438  wxStaticBox* itemStaticBoxSizer89Static = new wxStaticBox(itemPanel58, wxID_ANY, _("Font"));
439  wxStaticBoxSizer* itemStaticBoxSizer89 = new wxStaticBoxSizer(itemStaticBoxSizer89Static, wxVERTICAL);
440  itemBoxSizer59->Add(itemStaticBoxSizer89, 0, wxGROW|wxALL, 5);
441  wxFlexGridSizer* itemFlexGridSizer90 = new wxFlexGridSizer(0, 2, 0, 0);
442  itemStaticBoxSizer89->Add(itemFlexGridSizer90, 0, wxGROW|wxALL, 5);
443  wxStaticText* itemStaticText91 = new wxStaticText( itemStaticBoxSizer89->GetStaticBox(), wxID_STATIC, _("Font Face"), wxDefaultPosition, wxDefaultSize, 0 );
444  itemFlexGridSizer90->Add(itemStaticText91, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
445 
446  wxArrayString m_FontFaceStrings;
447  m_FontFace = new wxChoice( itemStaticBoxSizer89->GetStaticBox(), ID_CHOICE, wxDefaultPosition, wxDefaultSize, m_FontFaceStrings, 0 );
448  itemFlexGridSizer90->Add(m_FontFace, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
449 
450  wxStaticText* itemStaticText93 = new wxStaticText( itemStaticBoxSizer89->GetStaticBox(), wxID_STATIC, _("Font Size"), wxDefaultPosition, wxDefaultSize, 0 );
451  itemFlexGridSizer90->Add(itemStaticText93, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
452 
453  wxArrayString m_FontSizeStrings;
454  m_FontSizeStrings.Add(_("10"));
455  m_FontSize = new wxChoice( itemStaticBoxSizer89->GetStaticBox(), m_CHOICE, wxDefaultPosition, wxDefaultSize, m_FontSizeStrings, 0 );
456  m_FontSize->SetStringSelection(_("10"));
457  itemFlexGridSizer90->Add(m_FontSize, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
458 
459  itemNotebook4->AddPage(itemPanel58, _("Sizes"));
460 
461  itemFlexGridSizer3->Add(itemNotebook4, 1, wxGROW|wxGROW|wxALL, 5);
462 
463  itemFlexGridSizer3->AddGrowableRow(0);
464  itemFlexGridSizer3->AddGrowableCol(0);
465 
466  wxBoxSizer* itemBoxSizer95 = new wxBoxSizer(wxHORIZONTAL);
467  itemBoxSizer2->Add(itemBoxSizer95, 0, wxGROW|wxALL, 5);
468 
469  m_HelpHyperLink = new wxHyperlinkCtrl( itemDialog1, ID_HYPERLINKCTRL, _("Help"), _T("http://www.ncbi.nlm.nih.gov/tools/gbench/tutorial3A/#Ch1Step6"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
470  m_HelpHyperLink->Enable(false);
471  itemBoxSizer95->Add(m_HelpHyperLink, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
472 
473  wxStdDialogButtonSizer* itemStdDialogButtonSizer97 = new wxStdDialogButtonSizer;
474 
475  itemBoxSizer95->Add(itemStdDialogButtonSizer97, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
476  wxButton* itemButton98 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
477  itemStdDialogButtonSizer97->AddButton(itemButton98);
478 
479  wxButton* itemButton99 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
480  itemStdDialogButtonSizer97->AddButton(itemButton99);
481 
482  itemStdDialogButtonSizer97->Realize();
483 
484  // Set validators
497  itemTextCtrl64->SetValidator( wxGenericValidator(& m_MarginLeft) );
498  itemTextCtrl67->SetValidator( wxGenericValidator(& m_MarginTop) );
499  itemTextCtrl70->SetValidator( wxGenericValidator(& m_MarginBottom) );
500  itemTextCtrl73->SetValidator( wxGenericValidator(& m_MarginRight) );
501  itemTextCtrl78->SetValidator( wxGenericValidator(& m_NodeSize) );
502  itemTextCtrl81->SetValidator( wxGenericValidator(& m_LeafNodeSize) );
503  itemTextCtrl84->SetValidator( wxGenericValidator(& m_MaxNodeSize) );
504  itemTextCtrl87->SetValidator( wxGenericValidator(& m_LineWidth) );
505  itemCheckBox88->SetValidator( wxGenericValidator(& m_ResizableCollapsed) );
506 ////@end CwxPhyloSettingsDlg content construction
507 
508  m_HelpHyperLink->Hide();
509 }
510 
511 void CwxPhyloSettingsDlg::OnOkClick( wxCommandEvent& event )
512 {
513  m_pSL->SetLabelFormat() =
514  ( (m_rbSimple->GetValue())?
515  ("$(" + ToStdString(m_Feature1->GetStringSelection())+")")
516  : ToStdString(m_FormatString->GetValue()));
517 
518  if(TransferDataFromWindow()) {
519 
521  = m_DefNode;
522 
524  = m_SelNode;
525 
527  = m_TraceNode;
528 
530  = m_CommonNode;
531 
533  = m_DefEdge;
534 
536  = m_SelEdge;
537 
539  = m_TraceEdge;
540 
542  = m_CommonEdge;
543 
545  = m_DefLabel;
546 
548  = m_SelLabel;
549 
551  = m_TraceLabel;
552 
554  = m_CommonLabel;
555 
556  m_pSL->SetNonSelectedAlpha( ((float)m_SelectionAlpha->GetValue())/100.0f );
557 
558  if (m_SetMaxLabelLenCheck->GetValue()) {
560  }
561  else {
563  }
564 
573 
574 
575  if (m_Coloration->GetSelection() == 0) {
577  }
578  else if (m_Coloration->GetSelection() == 1) {
580  }
581  else if (m_Coloration->GetSelection() == 2) {
583  }
584 
586  NStr::StringToNonNegativeInt((ToStdString(m_FontSize->GetStringSelection()))));
587 
588  m_pSL->SetFont(font);
589 
591 
593  }
594 
595  event.Skip();
596 }
597 
599 {
600  return true;
601 }
602 wxBitmap CwxPhyloSettingsDlg::GetBitmapResource( const wxString& name )
603 {
604  // Bitmap retrieval
605 ////@begin CwxPhyloSettingsDlg bitmap retrieval
606  wxUnusedVar(name);
607  return wxNullBitmap;
608 ////@end CwxPhyloSettingsDlg bitmap retrieval
609 }
610 wxIcon CwxPhyloSettingsDlg::GetIconResource( const wxString& name )
611 {
612  // Icon retrieval
613 ////@begin CwxPhyloSettingsDlg icon retrieval
614  wxUnusedVar(name);
615  return wxNullIcon;
616 ////@end CwxPhyloSettingsDlg icon retrieval
617 }
618 
620 {
621  m_pDS = ds;
622  m_pSL = sl;
623 
624 
625  // Create map of disallowed font face/size combinations. These combinations
626  // look bad enough (dropped characters etc) that user would generally not
627  // want to see them.
628  vector<string> sizes1, sizes2, sizes3;
629  sizes1.push_back("6");
630  sizes2.push_back("7");
631  sizes3.push_back("6");
632  sizes3.push_back("7");
633 
634  m_InvalidFaceSizes["Helvetica Bold"] = sizes1;
635  m_InvalidFaceSizes["Helvetica Oblique"] = sizes1;
636  m_InvalidFaceSizes["Helvetica Bold Oblique"] = sizes1;
637 
638  m_InvalidFaceSizes["Lucida Bold"] = sizes1;
639  m_InvalidFaceSizes["Lucida Italic"] = sizes1;
640  m_InvalidFaceSizes["Lucida Bold Italic"] = sizes1;
641 
642  m_InvalidFaceSizes["Courier"] = sizes2;
643  m_InvalidFaceSizes["Courier Oblique"] = sizes2;
644 
645  m_InvalidFaceSizes["Fixed"] = sizes2;
646  m_InvalidFaceSizes["Fixed Bold"] = sizes2;
647  m_InvalidFaceSizes["Fixed Oblique"] = sizes2;
648  m_InvalidFaceSizes["Fixed Bold Oblique"] = sizes2;
649 
650  m_InvalidFaceSizes["Times-Roman"] = sizes1;
651  m_InvalidFaceSizes["Times-Roman Bold"] = sizes1;
652  m_InvalidFaceSizes["Times-Roman Italic"] = sizes1;
653  m_InvalidFaceSizes["Times-Roman Bold Italic"] = sizes1;
654 
655  m_InvalidFaceSizes["BPMono"] = sizes2;
656  m_InvalidFaceSizes["BPMono Bold"] = sizes2;
657  m_InvalidFaceSizes["BPMono Bold Stencil"] = sizes2;
658 
659  m_InvalidFaceSizes["BPMono Italic"] = sizes3;
660 
661 
663  m_Coloration->SetSelection(2);
664  }
665  else if (sl->GetColoration()==CPhyloTreeScheme::eClusters) {
666  m_Coloration->SetSelection(1);
667  }
668  else {
669  m_Coloration->SetSelection(0);
670  }
671 
675 
679 
683 
687 
688  float alpha = sl->GetNonSelectedAlpha();
689  m_SelectionAlpha->SetValue( (int)(alpha*100.0f) );
690  wxCommandEvent dummy_evt;
691  dummy_evt.SetInt(m_SelectionAlpha->GetValue());
692  OnSelectionAlphaSliderUpdated(dummy_evt);
693 
694  GLdouble left, top, right, bottom;
695  sl->GetMargins(left, top, right, bottom);
696 
697  m_MarginLeft = left;
698  m_MarginTop = top;
699  m_MarginRight = right;
700  m_MarginBottom = bottom;
701 
707 
708  const CGlTextureFont & font = sl->GetFont();
709 
710  /// Fill font face and size choices
711  wxArrayString font_faces;
712  wxArrayString font_sizes;
713 
714  std::vector<string> faces;
715  std::vector<string> sizes;
716 
719 
720  size_t idx;
721  for (idx = 0; idx<faces.size(); ++idx)
722  font_faces.Add(ToWxString(faces[idx]));
723  for (idx = 0; idx<sizes.size(); ++idx)
724  font_sizes.Add(ToWxString(sizes[idx]));
725 
726  m_FontFace->Clear();
727  m_FontFace->Append(font_faces);
728  m_FontSize->Clear();
729  m_FontSize->Append(font_sizes);
730 
731  m_FontFace->SetStringSelection(ToWxString(CGlTextureFont::FaceToString(font.GetFontFace())));
732  m_FontSize->SetStringSelection(ToWxString(NStr::NumericToString(font.GetFontSize())));
733 
734  // Make sure it is a valid face/size combination
735  wxCommandEvent non_event;
736  OnFontFaceChoiceSelected(non_event);
737 
738  // labels
740 
741  int max_label_len = sl->GetMaxLabelLength();
742  m_MaxLabelLenValue->SetValue(ToWxString(NStr::IntToString(max_label_len)));
743  if (max_label_len > 0) {
744  m_MaxLabelLenValue->Enable();
745  m_SetMaxLabelLenCheck->SetValue(true);
746  }
747  else {
748  m_MaxLabelLenValue->SetValue("-1");
749  m_MaxLabelLenValue->Disable();
750  m_SetMaxLabelLenCheck->SetValue(false);
751  }
752 
753  // determining format type
754  string & lblFormat = sl->SetLabelFormat();
755  string smplLabel = "";
756  m_FormatString->Clear();
757 
758  if (lblFormat.find_first_of("$") == lblFormat.find_last_of("$")) {
759  m_rbSimple->SetValue(true);
760 
761  string::size_type pos1 = lblFormat.find_first_not_of("$(");
762  string::size_type pos2 = lblFormat.find_last_not_of(")");
763  if ( pos1!=string::npos && pos2!=string::npos && pos2>pos1){
764  smplLabel = lblFormat.substr(pos1, pos2-pos1+1);
765  }
766  }
767  else {
768  m_rbBuilder->SetValue(true);
769  }
770  m_FormatString->WriteText(ToWxString(lblFormat));
771 
772  int item = 0;
774  wxString s = ToWxString(it->second);
775  m_Feature1->Append(s);
776  m_Feature2->Append(s);
777 
778  if (smplLabel == it->second) {
779  m_Feature1->SetSelection(item);
780  }
781  item++;
782  }
783  m_Feature2->SetSelection(0);
784  SwitchMode(m_rbSimple->GetValue());
785  UpdateSample();
786 }
787 
788 
790 {
791  m_Feature1->Enable(bmode);
792  m_Feature2->Enable(!bmode);
793  m_btnInsert->Enable(!bmode);
794  m_FormatString->Enable(!bmode);
795 }
796 
798 {
799  CPhyloTree& tree = *m_pDS->GetTree();
800  m_SampleNode = tree.GetRootIdx();
801 
802  CTime t;
803  t.SetCurrent();
804  CRandom r(static_cast<CRandom::TValue>(t.MilliSecond()));
805 
806  while (!tree[m_SampleNode].IsLeaf()) {
807  int child_count = 0;
808 
809  CPhyloTree::TNodeList_I it = tree[m_SampleNode].SubNodeBegin();
810  for(;it != tree[m_SampleNode].SubNodeEnd(); child_count++, it++ ) {}
811 
812  int sub_node_idx = r.GetRand(0,child_count-1);
813  int idx = 0;
814 
815  for(it=tree[m_SampleNode].SubNodeBegin(); idx!=sub_node_idx; idx++, it++ ) {}
816 
817  m_SampleNode = *it;
818  }
819 }
820 
822 {
823  if (!this->IsVisible())
824  return;
825 
826  CPhyloTreeLabel lbl;
827  const string fmt( (m_rbSimple->GetValue())?
828  ("$(" + ToStdString(m_Feature1->GetStringSelection())+")") :
829  ToStdString(m_FormatString->GetValue()));
830 
832  GetRandomNode();
833 
834  m_SampleLabel->Clear();
835  string full_label = lbl.GetLabelForNode(*m_pDS->GetTree(),
836  (m_pDS->GetTree()->GetNode(m_SampleNode)), fmt);
837 
838  if (m_SetMaxLabelLenCheck->GetValue()) {
839  int max_label_len = NStr::StringToInt(ToStdString(m_MaxLabelLenValue->GetValue()), NStr::fConvErr_NoThrow);
840 
841  if (max_label_len > 0 && int(full_label.length()) > max_label_len) {
842  full_label = full_label.substr(0, max_label_len) + "...";
843  }
844  }
845 
846  m_SampleLabel->ChangeValue(ToWxString(full_label));
847 }
848 
849 
850 void CwxPhyloSettingsDlg::OnRadiobutton1Selected( wxCommandEvent& event )
851 {
852  SwitchMode(true);
853  UpdateSample();
854  event.Skip();
855 }
856 
857 void CwxPhyloSettingsDlg::OnRadiobutton2Selected( wxCommandEvent& event )
858 {
859  SwitchMode(false);
860  UpdateSample();
861  event.Skip();
862 }
863 
864 void CwxPhyloSettingsDlg::OnChoice1Selected( wxCommandEvent& event )
865 {
866  UpdateSample();
867  event.Skip();
868 }
869 
870 void CwxPhyloSettingsDlg::OnTextctrl1Updated( wxCommandEvent& event )
871 {
872  UpdateSample();
873  event.Skip();
874 }
875 
876 void CwxPhyloSettingsDlg::OnButton1Click( wxCommandEvent& event )
877 {
878  wxString value = wxT("$(") + m_Feature2->GetStringSelection() + wxT(")");
879  m_FormatString->WriteText(value);
880  event.Skip();
881 }
882 
884 {
885  // Switch the color set we are editing (monochrome vs color)
886  if (m_Coloration->GetSelection() == 0 || m_Coloration->GetSelection() == 1 ) {
887  // colors for clustering are automatic, so include that with colored even though
888  // the values won't be used.
893 
897 
901 
905  }
906  else {
911 
915 
919 
923  }
924 
925  m_ColorPanel->TransferDataToWindow();
926 
927  Refresh();
928 
929  event.Skip();
930 }
931 
932 
933 void CwxPhyloSettingsDlg::OnRandomizeButtonClick( wxCommandEvent& /* event */ )
934 {
935  GetRandomNode();
936  UpdateSample();
937  Refresh();
938 }
939 
941 {
942  //wxGetApp().ShowHelp(_(""), this);
943  double val = (double)(event.GetInt());
944  val /= 100.0;
945 
946  string s = NStr::DoubleToString(val, 2);
947  wxString wstr(s.c_str(), wxConvUTF8);
948 
949  m_SelectionAlphaText->SetLabel(wstr);
950 }
951 
952 void CwxPhyloSettingsDlg::OnMaxLabelLenCheckClick( wxCommandEvent& event )
953 {
954  if (event.IsChecked()) {
955  m_MaxLabelLenValue->Enable();
956  }
957  else {
958  m_MaxLabelLenValue->Disable();
959  }
960 }
961 
962 void CwxPhyloSettingsDlg::OnListbook1PageChanged( wxNotebookEvent& event )
963 {
964  // Enable help only for those pages tha currently have it (and we should set the
965  // help to a top-level help for all settings or update the url in this function when
966  // more than one page gets help)
967  if (m_HelpHyperLink == NULL)
968  return;
969 
970  if (event.GetSelection() != 3) {
971  m_HelpHyperLink->Disable();
972  m_HelpHyperLink->Hide();
973  }
974  else {
975  m_HelpHyperLink->Show(true);
976  m_HelpHyperLink->Enable();
977  this->Layout();
978  }
979 
980 }
981 
983 {
984  /// Fill font size choices
985  wxArrayString font_sizes;
986 
987  std::vector<string> sizes;
989 
990  size_t idx;
991  string current_face = ToStdString(m_FontFace->GetStringSelection());
992  string current_size = ToStdString(m_FontSize->GetStringSelection());
993 
994  if (m_InvalidFaceSizes.find(current_face) != m_InvalidFaceSizes.end())
995  {
996  vector<string> invalid_sizes = m_InvalidFaceSizes[current_face];
997  bool increment_current_size = false;
998 
999  for (idx = 0; idx < sizes.size(); ++idx) {
1000  if (find(invalid_sizes.begin(), invalid_sizes.end(), sizes[idx]) == invalid_sizes.end()) {
1001  font_sizes.Add(ToWxString(sizes[idx]));
1002  if (increment_current_size) {
1003  current_size = sizes[idx];
1004  increment_current_size = false;
1005  }
1006  }
1007  else if (current_size == sizes[idx]) {
1008  increment_current_size = true;
1009  }
1010  }
1011  }
1012  else {
1013  for (idx = 0; idx < sizes.size(); ++idx)
1014  font_sizes.Add(ToWxString(sizes[idx]));
1015  }
1016 
1017  m_FontSize->Clear();
1018  m_FontSize->Append(font_sizes);
1019 
1020  m_FontSize->SetStringSelection(ToWxString(current_size));
1021 }
1022 
1024 {
1025  event.Skip();
1026 }
1027 
1029 
1030 
EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1
#define ID_TEXTCTRL11
#define ID_TEXTCTRL12
#define ID_TEXTCTRL10
#define ID_CHOICE1
Feature dictionary.
Definition: bio_tree.hpp:176
CPhyloTree * GetTree()
const CBioTreeFeatureDictionary & GetDictionary() const
string GetLabelForNode(const CPhyloTree &tree, const CPhyloTreeNode &node, const string &format)
void SetBoaNodes(bool x_bnodes)
GLdouble & SetSize(TPhyloTreeSizes obj)
void SetFont(const CGlTextureFont &font)
void SetColoration(const TColoration &col)
string & SetLabelFormat(void)
void GetMargins(GLdouble &left, GLdouble &top, GLdouble &right, GLdouble &bottom) const
float GetNonSelectedAlpha() const
void SetMaxLabelLength(int len)
CRgbaColor & SetColor(TPhyloTreeObject obj, TPhyloTreeColors col)
int GetMaxLabelLength() const
const TColoration & GetColoration(void) const
const CGlTextureFont & GetFont(void) const
bool GetBoaNodes() const
virtual bool SaveCurrentSettings() const
void SetNonSelectedAlpha(float a)
Tree subclass also has functions and data needed for rendering and selection.
Definition: phylo_tree.hpp:52
CRandom::
Definition: random_gen.hpp:66
CTime –.
Definition: ncbitime.hpp:296
TNodeType::TNodeList_I TNodeList_I
Definition: tree_model.hpp:189
static TTreeIdx Null()
Return the index value that represents a NULL node.
Definition: tree_model.hpp:678
TNodeType & GetNode(TTreeIdx idx)
Return a reference to the node at the given index.
Definition: tree_model.hpp:207
void SetParams(CPhyloTreeDataSource *ds, CPhyloTreeScheme *sl)
void OnMaxLabelLenCheckClick(wxCommandEvent &event)
void OnFontFaceChoiceSelected(wxCommandEvent &event)
void OnRandomizeButtonClick(wxCommandEvent &event)
wxColourPickerCtrl * m_EdgeColorTrace
wxColourPickerCtrl * m_EdgeColorSelection
bool Create(wxWindow *parent, wxWindowID id=10000, const wxString &caption=_("Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
wxBitmap GetBitmapResource(const wxString &name)
void OnOkClick(wxCommandEvent &event)
wxColourPickerCtrl * m_NodeColorSelection
wxColourPickerCtrl * m_LabelColorDefault
wxStaticText * m_SelectionAlphaText
wxColourPickerCtrl * m_LabelColorTrace
wxColourPickerCtrl * m_NodeColorDefault
wxColourPickerCtrl * m_EdgeColorCommon
wxColourPickerCtrl * m_LabelColorCommon
std::map< string, vector< string > > m_InvalidFaceSizes
wxIcon GetIconResource(const wxString &name)
void OnRadiobutton2Selected(wxCommandEvent &event)
void OnListbook1PageChanged(wxNotebookEvent &event)
CPhyloTree::TTreeIdx m_SampleNode
void OnButton1Click(wxCommandEvent &event)
wxColourPickerCtrl * m_NodeColorTrace
wxColourPickerCtrl * m_EdgeColorDefault
CPhyloTreeDataSource * m_pDS
wxColourPickerCtrl * m_LabelColorSelection
wxHyperlinkCtrl * m_HelpHyperLink
void OnChoice1Selected(wxCommandEvent &event)
wxColourPickerCtrl * m_NodeColorCommon
void OnColorationRadioboxSelected(wxCommandEvent &event)
void OnSelectionAlphaSliderUpdated(wxCommandEvent &event)
void OnRadiobutton1Selected(wxCommandEvent &event)
void OnTextctrl1Updated(wxCommandEvent &event)
void OnFontSizeChoiceSelected(wxCommandEvent &event)
The NCBI C++ standard methods for dealing with std::string.
#define _(proto)
Definition: ct_nlmzip_i.h:78
#define ID_BUTTON1
#define ID_BUTTON2
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
static void GetAllFaces(vector< string > &faces)
GetAllFaces() and GetAllSizes() fills containers with strings repesenting all available enumerated (p...
static string FaceToString(EFontFace face)
funtions below provide conversion of font parameters to strings and back.
EFontFace GetFontFace() const
static void GetAllSizes(vector< string > &sizes)
static EFontFace FaceFromString(const string &str)
Selects a font face given a string or eFontFace_LastFont on failure.
unsigned int GetFontSize() const
Uint4 TValue
Type of the generated integer value and/or the seed value.
Definition: random_gen.hpp:69
#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 StringToNonNegativeInt(const CTempString str, TStringToNumFlags flags=0)
Convert string to non-negative integer value.
Definition: ncbistr.cpp:457
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
Definition: ncbistr.cpp:630
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition: ncbistr.hpp:673
@ fConvErr_NoThrow
Do not throw an exception on error.
Definition: ncbistr.hpp:285
const TFeatureDict & GetFeatureDict() const
Get reference on the internal map.
Definition: bio_tree.hpp:219
#define ID_TEXTCTRL4
#define ID_CHOICE
#define ID_RADIOBUTTON1
#define ID_TEXTCTRL3
END_EVENT_TABLE()
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
EIPRangeType t
Definition: ncbi_localip.c:101
Defines: CTimeFormat - storage class for time format.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
#define ID_CHECKBOX
#define ID_TEXTCTRL13
static static static wxID_ANY
#define ID_TEXTCTRL5
#define ID_TEXTCTRL1
#define ID_TEXTCTRL2
#define ID_COLOURPICKERCTRL1
#define ID_TEXTCTRL8
#define ID_PANEL3
#define ID_TEXTCTRL19
#define ID_COLOURPICKERCTRL2
#define ID_TEXTCTRL17
#define ID_PANEL2
#define ID_PANEL1
#define ID_TEXTCTRL9
#define ID_LISTBOOK1
#define ID_MAX_LABEL_LEN_VALUE
#define ID_TEXTCTRL6
#define ID_TEXTCTRL18
#define ID_TEXTCTRL21
#define ID_HYPERLINKCTRL
#define m_TEXTCTRL24
#define ID_TEXTCTRL7
#define ID_RADIOBUTTON2
#define ID_COLORATION_RADIOBOX
#define ID_COLOURPICKERCTRL
#define ID_TEXTCTRL22
#define m_CHOICE
#define ID_MAX_LABEL_LEN_CHECK
#define ID_TEXTCTRL20
#define ID_TEXTCTRL23
#define ID_PANEL
#define ID_SELECTION_ALPHA_SLIDER
#define ID_CHOICE2
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Fri Apr 12 17:16:19 2024 by modify_doxy.py rev. 669887