]> git.llucax.com Git - z.facultad/75.52/treemulator.git/commitdiff
Abrir Arbol en la vista.
authorRicardo Markiewicz <rmarkie@fi.uba.ar>
Wed, 23 Nov 2005 16:40:53 +0000 (16:40 +0000)
committerRicardo Markiewicz <rmarkie@fi.uba.ar>
Wed, 23 Nov 2005 16:40:53 +0000 (16:40 +0000)
viewer/view_btree.cpp
viewer/view_btree.h

index eb2e067249ff5bcdaa1fa6a8a7ea74eaa6a88f50..d85a909eb1c6acc22e0b0e8077164f611392517e 100644 (file)
@@ -19,6 +19,30 @@ ViewBTree::ViewBTree (Canvas::Group *parent, std::string filename, uint block_si
        last_visited = 0;
 }
 
+ViewBTree::ViewBTree (Canvas::Group *parent, const std::string filename)
+       :Canvas::Group (*parent, 0, 0), BTree (filename)
+{
+       /* Cada bytes lo hago de 5 units de ancho */
+       node_width = 4 * header.block_size;
+       node_height = 50;
+       byte_to_pixels  = node_width/header.block_size;
+
+       last_selected = NULL;
+       last_visited = 0;
+}
+
+ViewBTree* Open (Canvas::Group *parent, const std::string &filename)
+{
+       ViewBTree *tree = new ViewBTree (parent, filename);
+
+       if (tree->fp == NULL) {
+               delete tree;
+               return NULL;
+       }
+
+       return tree;
+}
+
 void ViewBTree::GoBack ()
 {
        uint l = back.top ();
index 18f4df7ec162cda5d4ca5e162e3bf851d27e50b4..f4e3c4781293431a8f45672eab4d67e241dc5857 100644 (file)
@@ -16,6 +16,9 @@ class ViewNode;
 class ViewBTree : public Canvas::Group, public BTree {
        public:
                ViewBTree (Canvas::Group *parent, std::string filename, uint block_size, int tree_type, int type);
+               ViewBTree (Canvas::Group *parent, const std::string filename);
+
+               static ViewBTree* Open (const std::string &filename);
 
                void Clear ();
                void HighliteKey (Clave &k);