51 #include <wx/stattext.h>
52 #include <wx/statline.h>
53 #include <wx/statbox.h>
54 #include <wx/combobox.h>
56 #include <wx/clrpicker.h>
57 #include <wx/checklst.h>
58 #include <wx/valgen.h>
59 #include <wx/bitmap.h>
61 #include <wx/listbook.h>
62 #include <wx/listctrl.h>
63 #include <wx/msgdlg.h>
95 , m_UpdatedFeature(
NULL)
103 , m_UpdatedFeature(
NULL)
106 Create(parent,
id, caption, pos,
size, style);
112 SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY|wxWS_EX_BLOCK_EVENTS);
113 wxDialog::Create( parent,
id, caption, pos,
size, style );
118 GetSizer()->SetSizeHints(
this);
146 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
147 itemDialog1->SetSizer(itemBoxSizer2);
149 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
150 itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5);
152 m_List =
new wxListCtrl( itemDialog1,
ID_LISTCTRL1, wxDefaultPosition, wxSize(300, 120), wxLC_REPORT );
153 itemBoxSizer3->Add(
m_List, 0, wxALIGN_TOP|wxALL, 5);
155 wxBoxSizer* itemBoxSizer5 =
new wxBoxSizer(wxVERTICAL);
156 itemBoxSizer3->Add(itemBoxSizer5, 0, wxALIGN_TOP|wxALL, 5);
158 wxButton* itemButton6 =
new wxButton( itemDialog1,
ID_BUTTON4,
_(
"Add"), wxDefaultPosition, wxDefaultSize, 0 );
159 itemBoxSizer5->Add(itemButton6, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
161 wxButton* itemButton7 =
new wxButton( itemDialog1,
ID_BUTTON5,
_(
"Remove"), wxDefaultPosition, wxDefaultSize, 0 );
162 itemBoxSizer5->Add(itemButton7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
164 wxButton* itemButton8 =
new wxButton( itemDialog1,
ID_BUTTON,
_(
"Update"), wxDefaultPosition, wxDefaultSize, 0 );
165 itemBoxSizer5->Add(itemButton8, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
167 wxStaticBox* itemStaticBoxSizer9Static =
new wxStaticBox(itemDialog1,
wxID_ANY, wxEmptyString);
168 wxStaticBoxSizer* itemStaticBoxSizer9 =
new wxStaticBoxSizer(itemStaticBoxSizer9Static, wxVERTICAL);
169 itemBoxSizer2->Add(itemStaticBoxSizer9, 1, wxGROW|wxALL, 5);
171 wxBoxSizer* itemBoxSizer10 =
new wxBoxSizer(wxHORIZONTAL);
172 itemStaticBoxSizer9->Add(itemBoxSizer10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT, 5);
174 wxStaticText* itemStaticText11 =
new wxStaticText( itemDialog1, wxID_STATIC,
_(
"Name"), wxDefaultPosition, wxDefaultSize, 0 );
175 itemBoxSizer10->Add(itemStaticText11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
177 m_Name =
new wxTextCtrl( itemDialog1,
ID_TEXTCTRL14, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0 );
178 itemBoxSizer10->Add(
m_Name, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
180 wxBoxSizer* itemBoxSizer13 =
new wxBoxSizer(wxHORIZONTAL);
181 itemStaticBoxSizer9->Add(itemBoxSizer13, 1, wxGROW|wxLEFT|wxRIGHT, 5);
183 wxBoxSizer* itemBoxSizer14 =
new wxBoxSizer(wxHORIZONTAL);
184 itemBoxSizer13->Add(itemBoxSizer14, 1, wxALIGN_TOP|wxRIGHT|wxTOP|wxBOTTOM, 5);
186 wxStaticText* itemStaticText15 =
new wxStaticText( itemDialog1, wxID_STATIC,
_(
"Value"), wxDefaultPosition, wxDefaultSize, 0 );
187 itemBoxSizer14->Add(itemStaticText15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
189 m_Value =
new wxTextCtrl( itemDialog1,
ID_TEXTCTRL15, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
190 itemBoxSizer14->Add(
m_Value, 1, wxGROW|wxALL, 5);
192 wxStaticText* itemStaticText17 =
new wxStaticText( itemDialog1, wxID_STATIC,
_(
"Color"), wxDefaultPosition, wxDefaultSize, 0 );
193 itemBoxSizer14->Add(itemStaticText17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
195 m_ColorPicker =
new wxColourPickerCtrl( itemDialog1,
ID_COLOURCTRL, wxColour(0, 255, 0), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
196 itemBoxSizer13->Add(
m_ColorPicker, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
198 wxStaticLine* itemStaticLine19 =
new wxStaticLine( itemDialog1,
ID_STATICLINE1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
199 itemBoxSizer2->Add(itemStaticLine19, 0, wxGROW|wxALL, 5);
201 wxStdDialogButtonSizer* itemStdDialogButtonSizer20 =
new wxStdDialogButtonSizer;
203 itemBoxSizer2->Add(itemStdDialogButtonSizer20, 0, wxALIGN_RIGHT|wxALL, 5);
204 wxButton* itemButton21 =
new wxButton( itemDialog1, wxID_OK,
_(
"&OK"), wxDefaultPosition, wxDefaultSize, 0 );
205 itemStdDialogButtonSizer20->AddButton(itemButton21);
207 wxButton* itemButton22 =
new wxButton( itemDialog1, wxID_CANCEL,
_(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
208 itemStdDialogButtonSizer20->AddButton(itemButton22);
210 itemStdDialogButtonSizer20->Realize();
218 wxString
n =
m_Name->GetValue();
230 item_num =
m_List->GetNextItem(item_num,
232 wxLIST_STATE_DONTCARE);
233 if ( item_num == -1 )
237 info.m_itemId = item_num;
238 info.m_mask = wxLIST_MASK_TEXT;
243 wxString msg =
wxT(
"Item '");
245 msg +=
wxT(
"' is already a property.\n");
246 msg +=
wxT(
"Select the property from the list to update it.");
248 wxMessageBox(msg,
wxT(
"Duplicate Property Name"),
249 wxOK | wxICON_WARNING);
256 wxListItem * item =
new wxListItem();
257 auto itemId =
m_List->InsertItem(*item);
266 if (
m_List->GetSelectedItemCount() == 0)
270 auto index =
m_List->GetNextItem(-1,
272 wxLIST_STATE_SELECTED);
274 m_List->DeleteItem(index);
291 item =
m_List->GetNextItem(item,
293 wxLIST_STATE_DONTCARE);
298 info.m_itemId = item;
299 info.m_mask = wxLIST_MASK_TEXT;
311 for (
id=0;
id < 255;
id++){
320 "CPhyloTreeNode::SetFeature - maximum number of features exceeded");
358 int w =
m_List->GetSize().GetWidth();
361 m_List->InsertColumn(0,
wxT(
"Name"), wxLIST_FORMAT_LEFT, w/3 );
362 m_List->InsertColumn(1,
wxT(
"Value"), wxLIST_FORMAT_LEFT, (w*2)/3 );
370 string sValue = it->value;
372 wxListItem * item =
new wxListItem();
373 auto itemId =
m_List->InsertItem(*item);
384 if (
m_List->GetSelectedItemCount() == 0)
388 auto index =
m_List->GetNextItem(-1,
390 wxLIST_STATE_SELECTED);
393 info.m_itemId = index;
394 info.m_mask = wxLIST_MASK_TEXT;
405 string::size_type idx1 = current_value.find_first_of(
'[');
406 if (idx1 != string::npos) {
407 string::size_type idx2 = current_value.find_first_of(
']');
408 if (idx2 != string::npos && idx2 > idx1) {
411 string color_str = current_value.substr(idx1, idx2-idx1 + 1);
439 if (
m_List->GetSelectedItemCount() == 0)
443 auto index =
m_List->GetNextItem(-1,
445 wxLIST_STATE_SELECTED);
448 wxString
n =
m_Name->GetValue();
468 string::size_type idx1 = current_value.find_first_of(
'[');
469 if (idx1 != string::npos) {
470 string::size_type idx2 = current_value.find_first_of(
']');
471 if (idx2 != string::npos && idx2 > idx1) {
473 string old_color_str = current_value.substr(idx1, idx2-idx1 + 1);
483 current_value.replace(idx1, idx2-idx1 + 1, new_color_str);
494 new_color.
SetAlpha((
unsigned char)64);
Things for representing and manipulating bio trees.
Features storage for the bio tree node.
Tree subclass also has functions and data needed for rendering and selection.
CBioTreeFeatureDictionary & GetFeatureDict()
Return feature dictionary.
class CRgbaColor provides a simple abstraction for managing colors.
void OnButton4Click(wxCommandEvent &event)
void x_UpdateSelectedRow()
void SetParams(CPhyloTree *tree, CPhyloTree::TTreeIdx node_idx, CFeatureEdit *updated_feature)
void OnButtonClick(wxCommandEvent &event)
static bool ShowToolTips()
wxIcon GetIconResource(const wxString &name)
void OnColourctrlColourPickerChanged(wxColourPickerEvent &event)
void OnButton5Click(wxCommandEvent &event)
void OnListctrl1Selected(wxListEvent &event)
bool Create(wxWindow *parent, wxWindowID id=10000, const wxString &caption=_("Node Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
wxBitmap GetBitmapResource(const wxString &name)
wxColourPickerCtrl * m_ColorPicker
CFeatureEdit * m_UpdatedFeature
CPhyloTree::TTreeIdx m_NodeIdx
void OnOkClick(wxCommandEvent &event)
void OnListctrl1Deselected(wxListEvent &event)
const_iterator find(const key_type &key) const
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
string ToString(bool printAlpha=true, bool uchars=true) const
Return a string representation of the current color.
float GetAlpha(void) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string & ToLower(string &str)
Convert string to lower case – string& version.
unsigned int TBioTreeFeatureId
Feature Id.
TBioTreeFeatureId GetId(const string &feature_name) const
If feature is already registered returns its id by name.
const TFeatureList & GetFeatureList() const
Return reference on the internal container.
TBioTreeFeatureId Register(const string &feature_name)
Register new feature, return its id.
bool HasFeature(const string &feature_name) const
Check if feature is listed in the dictionary.
const TFeatureDict & GetFeatureDict() const
Get reference on the internal map.
vector< CBioTreeFeaturePair > TFeatureList
const struct ncbi::grid::netcache::search::fields::SIZE size
Edits for one or more nodes.
vector< CUpdatedFeature > & GetUpdated()
CBioTreeFeatureDictionary & GetDictionary()
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)