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)
--- /dev/null
+
+#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 ();
+}
+
--- /dev/null
+
+#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
+
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;
#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);
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);
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;
+}
#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;