5 #include <libgnomecanvasmm.h>
7 #include "view_btree.h"
8 #include "view_properties.h"
9 #include "new_tree_dialog.h"
10 #include "view_debug.h"
12 using namespace Gnome::Canvas;
14 Glib::ustring ui_info =
16 " <menubar name='MenuBar'>"
17 " <menu action='MenuFile'>"
18 " <menuitem action='Nuevo'/>"
20 " <menuitem action='Salir'/>"
22 " <menu action='MenuZoom'>"
23 " <menuitem action='Alejar'/>"
24 " <menuitem action='Acercar'/>"
26 " <menuitem action='100 %'/>"
36 Glib::RefPtr<ViewBTree> tree;
38 Gnome::Canvas::Canvas *real_canvas;
39 ViewProperties *real_frame;
41 int main(int argc, char *argv[])
43 Gtk::Main kit(argc, argv);
45 Gnome::Canvas::init ();
51 Gtk::ScrolledWindow area;
52 Gnome::Canvas::Canvas canvas;
56 real_canvas = &canvas;
60 canvas.set_scroll_region (0, 0, 5000, 5000);
63 hbox.pack_start (frame, false, false, 10);
64 hbox.pack_start (area);
65 hbox.pack_end (debug, false, true, 10);
67 Glib::RefPtr<Gtk::ActionGroup> actiongroup = Gtk::ActionGroup::create();
69 actiongroup->add( Gtk::Action::create("MenuFile", "_Arbol") );
70 actiongroup->add( Gtk::Action::create("Nuevo", Gtk::Stock::NEW), &nuevo_arbol);
71 actiongroup->add( Gtk::Action::create("Salir", Gtk::Stock::QUIT), &Gtk::Main::quit);
72 actiongroup->add( Gtk::Action::create("MenuZoom", "_Zoom"));
73 actiongroup->add( Gtk::Action::create("Alejar", Gtk::Stock::ZOOM_OUT), Gtk::AccelKey ("<control>z"), &zoom_out );
74 actiongroup->add( Gtk::Action::create("Acercar", Gtk::Stock::ZOOM_IN), Gtk::AccelKey ("<control>x"), &zoom_in);
75 actiongroup->add( Gtk::Action::create("100 %", Gtk::Stock::ZOOM_100), Gtk::AccelKey ("<control>1"), &zoom_normal);
77 Glib::RefPtr<Gtk::UIManager> m_refUIManager = Gtk::UIManager::create();
78 m_refUIManager->insert_action_group (actiongroup);
80 m_refUIManager->add_ui_from_string(ui_info);
81 Gtk::Widget* menubar = m_refUIManager->get_widget("/MenuBar");
84 vbox.pack_start (*menubar, false, true, 0);
85 vbox.pack_end (hbox, true, true, 5);
87 window.add_accel_group (m_refUIManager->get_accel_group ());
89 window.set_size_request (640, 480);
92 /* Conecto el Canvas con el Frame */
93 Gtk::Main::run(window);
101 if (d.run () == Gtk::RESPONSE_OK) {
102 uint tot = d.getAmount ();
103 tree = Glib::RefPtr<ViewBTree>(new ViewBTree (real_canvas->root(), "test.idx", d.getBlockSize ()));
104 tree->signal_selected ().connect ( sigc::mem_fun (*real_frame, &ViewProperties::ShowItem) );
105 vdebug->SetTree (tree);
106 for (uint i=0; i <= tot; i++) {
118 double r = real_canvas->get_pixels_per_unit ();
122 real_canvas->set_pixels_per_unit (r);
127 double r = real_canvas->get_pixels_per_unit ();
131 real_canvas->set_pixels_per_unit (r);
136 real_canvas->set_pixels_per_unit (1.0f);