X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/blobdiff_plain/70084b679b2a4a3be3f7cc6ef80cef7c7ccf8bed..e994ad95d6fcb7372527146482ce55cea669b6c9:/viewer/view_properties.cpp?ds=sidebyside
diff --git a/viewer/view_properties.cpp b/viewer/view_properties.cpp
index cd48676..4576965 100644
--- a/viewer/view_properties.cpp
+++ b/viewer/view_properties.cpp
@@ -3,36 +3,97 @@
ViewProperties::ViewProperties ():Frame ()
{
- vbox.pack_start (node_num, false, false, 5);
- vbox.pack_start (node_level, false, false, 5);
- vbox.pack_start (node_items, false, false, 5);
- vbox.pack_start (node_freespace, false, false, 5);
-
- vbox.pack_start (data_type, false, false, 5);
- vbox.pack_start (data_key, false, false, 5);
- vbox.pack_start (data_child, false, false, 5);
+ lnode_num.set_use_markup (true);
+ lnode_level.set_use_markup (true);
+ lnode_items.set_use_markup (true);
+ lnode_freespace.set_use_markup (true);
+ ldata_type.set_use_markup (true);
+ ldata_key.set_use_markup (true);
+ ldata_child.set_use_markup (true);
+
+ lnode_num.set_label ("Nodo :");
+ lnode_level.set_label ("Nivel : ");
+ lnode_items.set_label ("Items :");
+ lnode_freespace.set_label ("Libre :");
+ ldata_type.set_label ("Tipo :");
+ ldata_key.set_label ("Clave : ");
+ ldata_child.set_label ("Hijo : ");
+
+ lnode_num.set_alignment(Gtk::JUSTIFY_LEFT);
+ lnode_level.set_alignment(Gtk::JUSTIFY_LEFT);
+ lnode_items.set_alignment(Gtk::JUSTIFY_LEFT);
+ lnode_freespace.set_alignment(Gtk::JUSTIFY_LEFT);
+ ldata_type.set_alignment(Gtk::JUSTIFY_LEFT);
+ ldata_key.set_alignment(Gtk::JUSTIFY_LEFT);
+ ldata_child.set_alignment(Gtk::JUSTIFY_LEFT);
- add (vbox);
+ table.attach (lnode_num, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ table.attach (lnode_level, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ table.attach (lnode_items, 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ table.attach (lnode_freespace, 0, 1, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ table.attach (ldata_type, 0, 1, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ table.attach (ldata_key, 0, 1, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ table.attach (ldata_child, 0, 1, 6, 7, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+
+ table.attach (node_num, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ table.attach (node_level, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ table.attach (node_items, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ table.attach (node_freespace, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+ 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);
set_label ("Propiedades");
set_shadow_type(Gtk::SHADOW_NONE);
+ set_size_request (200, 0);
}
-void ViewProperties::ShowItem (BTreeData *, BTreeNodeHeader &header)
+void ViewProperties::ShowItem (BTreeData *data, BTreeNodeHeader &header)
{
std::string s1, s2, s3;
std::stringstream ss1, ss2, ss3;
+ node_num.set_label ("TODO");
+
ss1 << header.level;
ss1 >> s1;
- node_level.set_label ("Nivel : " + s1);
+ node_level.set_label (s1);
ss2 << header.item_count;
ss2 >> s2;
- node_items.set_label ("Items : " + s2);
+ node_items.set_label (s2);
ss3 << header.free_space;
ss3 >> s3;
- node_freespace.set_label ("Libre : " + s3);
+ node_freespace.set_label (s3);
+
+ 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 >> 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);
+ } else {
+ data_type.set_label ("BTreeData");
+
+ std::string s4;
+ std::stringstream ss4;
+ ss4 << data->getChild ();
+ ss4 >> s4;
+ data_child.set_label (s4);
+
+ std::string s5 = *(data->getClave ());
+ data_key.set_label (s5);
+ }
}