From 8d91dae9933285ea0ba05eb19ac6263129b39599 Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Sat, 29 Oct 2005 18:30:45 +0000 Subject: [PATCH] Agrego vista RAW y algunos detalles. --- viewer/main.cpp | 3 ++- viewer/view_btree.cpp | 2 +- viewer/view_properties.cpp | 27 ++++++++++++++++++++++++++- viewer/view_properties.h | 4 ++++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/viewer/main.cpp b/viewer/main.cpp index 1cee643..3b89a38 100644 --- a/viewer/main.cpp +++ b/viewer/main.cpp @@ -68,7 +68,8 @@ int main(int argc, char *argv[]) area.add (canvas); hbox.pack_start (area); - hbox.pack_end (frame, true, true, 10); + hbox.pack_start (frame, false, false, 10); + frame.set_size_request (200, 200); Glib::RefPtr actiongroup = Gtk::ActionGroup::create(); diff --git a/viewer/view_btree.cpp b/viewer/view_btree.cpp index fc1881e..4349187 100644 --- a/viewer/view_btree.cpp +++ b/viewer/view_btree.cpp @@ -8,7 +8,7 @@ double ViewBTree::node_width = 0; double ViewBTree::node_height = 0; ViewBTree::ViewBTree (Canvas::Group *parent, std::string filename, uint block_size, int type):Canvas::Group (*parent, 0, 0), - BTree (filename, block_size, type) + BTree (filename, block_size, BTree::TYPE_UNIQUE, type) { /* Cada bytes lo hago de 5 units de ancho */ node_width = 5 * block_size; diff --git a/viewer/view_properties.cpp b/viewer/view_properties.cpp index 65f782f..8f92d5f 100644 --- a/viewer/view_properties.cpp +++ b/viewer/view_properties.cpp @@ -45,7 +45,13 @@ ViewProperties::ViewProperties ():Frame () table.property_column_spacing () = 8; table.property_row_spacing () = 8; - add (table); + + 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"); @@ -72,6 +78,8 @@ 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"); @@ -102,3 +110,20 @@ void ViewProperties::ShowItem (BTreeData *data, BTreeNodeHeader &header) } } +std::string ViewProperties::ToRaw (BTreeData *p) +{ + std::stringstream ss; + uint size = p->Size (), i; + uchar *arr = p->ToArray (); + + for (i=0; i < size; i++) { + if (isalnum (arr[i])) + ss << arr[i]; + else + ss << "."; + } + + delete [] arr; + return ss.str (); +} + diff --git a/viewer/view_properties.h b/viewer/view_properties.h index 1ec555f..2036513 100644 --- a/viewer/view_properties.h +++ b/viewer/view_properties.h @@ -12,7 +12,11 @@ class ViewProperties:public Gtk::Frame { void ShowItem (BTreeData *, BTreeNodeHeader &header); private: + std::string ToRaw (BTreeData *); + Gtk::Table table; + Gtk::HBox hbox; + Gtk::TextView raw_view; /* Node Info */ Gtk::Label node_num; -- 2.43.0