]> git.llucax.com Git - z.facultad/75.52/treemulator.git/commitdiff
Muestro los datos borrados y que son recuperables.
authorRicardo Markiewicz <rmarkie@fi.uba.ar>
Mon, 5 Dec 2005 01:38:05 +0000 (01:38 +0000)
committerRicardo Markiewicz <rmarkie@fi.uba.ar>
Mon, 5 Dec 2005 01:38:05 +0000 (01:38 +0000)
viewer/Makefile
viewer/list_dialog.cpp [new file with mode: 0644]
viewer/list_dialog.h [new file with mode: 0644]
viewer/main.cpp
viewer/view_properties.cpp
viewer/view_properties.h

index dd7bd7d4c415c60b8be968d7b3f3db26ddb0573e..72b76b754fead470752fad59daf998ecab7a193d 100644 (file)
@@ -1,6 +1,6 @@
 TARGET=viewer
 CXXFLAGS=-Wall -g `pkg-config gtkmm-2.4 libgnomecanvasmm-2.6 --cflags` -I../src
-OBJECTS=main.o view_btree.o view_btree_data.o view_properties.o view_node.o new_tree_dialog.o view_debug.o
+OBJECTS=main.o view_btree.o view_btree_data.o view_properties.o view_node.o new_tree_dialog.o key_dialog.o view_debug.o list_dialog.o
 
 all: $(TARGET)
 
diff --git a/viewer/list_dialog.cpp b/viewer/list_dialog.cpp
new file mode 100644 (file)
index 0000000..5eb0f98
--- /dev/null
@@ -0,0 +1,28 @@
+
+#include "list_dialog.h"
+
+#include <iostream>
+
+ListDialog::ListDialog(const Glib::ustring& title, std::list<uint> &l):
+       Gtk::Dialog(title, true, true)
+{
+       list_store = Gtk::ListStore::create (columns);
+  list.set_model (list_store);
+
+       list.append_column ("Valor", columns.col_key);
+
+       std::list<uint>::iterator it = l.begin ();
+       while (it != l.end ()) {
+               Gtk::TreeModel::iterator iter = list_store->append();
+               Gtk::TreeModel::Row row = *iter;
+               row[columns.col_key] = *it;
+               it++;
+       }
+
+       get_vbox()->add (list);
+
+       add_button(Gtk::StockID("gtk-ok"), Gtk::RESPONSE_OK);
+       set_size_request (200, 300);
+       show_all ();
+}
+
diff --git a/viewer/list_dialog.h b/viewer/list_dialog.h
new file mode 100644 (file)
index 0000000..1efabb1
--- /dev/null
@@ -0,0 +1,28 @@
+
+#ifndef _LIST_DIALOG_
+#define _LIST_DIALOG_
+
+#include <gtkmm.h>
+#include <list>
+
+class ListDialog : public Gtk::Dialog {
+       public:
+               ListDialog (const Glib::ustring& title, std::list<uint> &l);
+       private:
+               Gtk::ScrolledWindow area;
+               Gtk::TreeView list;
+               Glib::RefPtr<Gtk::ListStore> list_store;
+
+               class ModelColumns : public Gtk::TreeModel::ColumnRecord {
+                       public:
+                               ModelColumns(){ 
+                                       add (col_key);
+                               }
+                               Gtk::TreeModelColumn<uint> col_key;
+               };
+
+               ModelColumns columns;
+};
+
+#endif
+
index 59f34f77bc20179fcfbee67da22d2e890583f496..e6a7a86a9f80fc150e8500f125945f10c687e37d 100644 (file)
@@ -150,6 +150,7 @@ void nuevo_arbol ()
                int type = d.getKeyType ();
                int atype = d.getTreeType ();
                tree = Glib::RefPtr<ViewBTree>(new ViewBTree (real_canvas->root(), "test.idx", d.getBlockSize (), atype, type));
+               real_frame->SetTree (tree);
                tree->signal_selected ().connect ( sigc::mem_fun (*real_frame, &ViewProperties::ShowItem) );
                if (type == BTree::KEY_FIXED) {
                        std::list<int> lst;
index 0e789df53b51a265edc6664801e6ef87c283e8a4..b7be8dd5e00351f77da3adfd13f2c00c6d1f3d1d 100644 (file)
@@ -1,7 +1,8 @@
 
 #include "view_properties.h"
 
-ViewProperties::ViewProperties ():Frame ()
+ViewProperties::ViewProperties ():Frame (),
+       view_deleted_nodes ("Nodos\nRecuperables"),view_deleted_data ("Datos\nRecuperables")
 {
        lnode_num.set_use_markup (true);
        lnode_level.set_use_markup (true);
@@ -46,13 +47,20 @@ ViewProperties::ViewProperties ():Frame ()
        table.property_column_spacing () = 8;
        table.property_row_spacing () = 8;
 
+       bbox.pack_start (view_deleted_nodes, true, false, 8);
+       bbox.pack_start (view_deleted_data, true, false, 8);
+
        hbox.pack_start (table, false, true, 8);
        hbox.pack_start (raw_view, true, true, 8);
+       hbox.pack_end (bbox, false, true, 8);
 
        table.set_size_request (250, 0);
 
        add (hbox);
        
+       view_deleted_nodes.signal_clicked ().connect ( sigc::mem_fun (*this, &ViewProperties::ViewDeletedNodes) );
+       view_deleted_data.signal_clicked ().connect ( sigc::mem_fun (*this, &ViewProperties::ViewDeletedDatas) );
+
        property_label_xalign () = 0;
        set_label ("Propiedades");
        set_shadow_type(Gtk::SHADOW_NONE);
@@ -138,3 +146,25 @@ std::string ViewProperties::ToRaw (BTreeData *p)
        return ss.str ();
 }
 
+void ViewProperties::ViewDeletedNodes (void)
+{
+       ListDialog *l = new ListDialog ("Nodos Borrados", tree->deleted_nodes);
+
+       l->run ();
+
+       delete l;
+}
+
+void ViewProperties::ViewDeletedDatas (void)
+{
+       ListDialog *l = new ListDialog ("Datos Borrados", tree->deleted_block_data);
+
+       l->run ();
+
+       delete l;
+}
+
+void ViewProperties::SetTree (Glib::RefPtr<ViewBTree> _tree)
+{
+       tree = _tree;
+}
index 2036513035b41ce3edd800183c6a4198919a018a..8026c1b391d9b757a983812987e6b3cfb1362e3f 100644 (file)
@@ -5,19 +5,29 @@
 #include <gtkmm.h>
 #include "btree.h"
 #include "btree_data.h"
+#include "list_dialog.h"
+#include "view_btree.h"
 
 class ViewProperties:public Gtk::Frame {
        public:
                ViewProperties ();
+               
+               void SetTree (Glib::RefPtr<ViewBTree> tree);
 
                void ShowItem (BTreeData *, BTreeNodeHeader &header);
        private:
+               Glib::RefPtr<ViewBTree> tree;
+               void ViewProperties::ViewDeletedNodes (void);
+               void ViewProperties::ViewDeletedDatas (void);
                std::string ToRaw (BTreeData *);
 
                Gtk::Table table;
                Gtk::HBox hbox;
                Gtk::TextView raw_view;
-
+               Gtk::VButtonBox bbox;
+               Gtk::Button view_deleted_nodes;
+               Gtk::Button view_deleted_data;
+       
                /* Node Info */
                Gtk::Label node_num;
                Gtk::Label node_level;