X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/blobdiff_plain/d76cfcfa2ef1363786c12ede4780e99d1bf02803..ea5776d090486ba7895940545e8dff58d558a7d3:/viewer/view_properties.cpp?ds=sidebyside diff --git a/viewer/view_properties.cpp b/viewer/view_properties.cpp index 4576965..11498ba 100644 --- a/viewer/view_properties.cpp +++ b/viewer/view_properties.cpp @@ -42,8 +42,18 @@ ViewProperties::ViewProperties ():Frame () table.attach (data_type, 1, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); table.attach (data_key, 1, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); table.attach (data_child, 1, 2, 6, 7, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); - add (table); + + table.property_column_spacing () = 8; + table.property_row_spacing () = 8; + + hbox.pack_start (table, false, true, 8); + hbox.pack_start (raw_view, true, true, 8); + + table.set_size_request (250, 0); + + add (hbox); + property_label_xalign () = 0; set_label ("Propiedades"); set_shadow_type(Gtk::SHADOW_NONE); set_size_request (200, 0); @@ -68,32 +78,62 @@ void ViewProperties::ShowItem (BTreeData *data, BTreeNodeHeader &header) ss3 >> s3; node_freespace.set_label (s3); + raw_view.get_buffer ()->assign (ToRaw (data)); + if (dynamic_cast(data)) { data_type.set_label ("BTreeChildData"); data_key.set_label ("N/C"); std::string s4; std::stringstream ss4; - ss4 << data->getChild (); + ss4 << data->GetChild (); ss4 >> s4; data_child.set_label (s4); } else if (dynamic_cast(data)) { data_type.set_label ("BTreeLeafData"); data_child.set_label ("N/C"); - std::string s4 = *(data->getClave ()); - data_child.set_label (s4); + std::string s4 = *(data->GetKey ()); + std::cout << "----> " << s4 << std::endl; + data_key.set_label (s4); } else { data_type.set_label ("BTreeData"); std::string s4; std::stringstream ss4; - ss4 << data->getChild (); + ss4 << data->GetChild (); ss4 >> s4; data_child.set_label (s4); - std::string s5 = *(data->getClave ()); + std::string s5 = *(data->GetKey ()); data_key.set_label (s5); } } +std::string ViewProperties::ToRaw (BTreeData *p) +{ + std::stringstream ss; + uint size = 0, i; + uchar *arr = NULL; + if (p->GetKey ()) { + arr = p->GetKey ()->ToRaw (size); + } + + for (i=0; i < size; i++) { + if (isalnum (arr[i])) + ss << arr[i]; + else + ss << "."; + } + + if (p->GetChild () != 0) { + ss << "("; + ss << p->GetChild (); + ss << ")"; + } + + if (arr) + delete [] arr; + return ss.str (); +} +