cout->cerr, node radius and edge width is now scaled, maps are editable by clicking on texts.
3 MainWin::MainWin(const std::string& title, Graph & graph, CoordinatesMap & cm,
4 MapStorage & ms):mapwin("Map Setup", ms, gd_canvas),newmapwin("Creating new map",gd_canvas),gd_canvas(graph, cm, ms, &mapwin)
8 set_default_size(WIN_WIDTH,WIN_HEIGHT);
11 ag=Gtk::ActionGroup::create();
13 ag->add( Gtk::Action::create("FileMenu", "_File") );
14 ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
15 sigc::mem_fun(*this, &MainWin::newFile));
16 ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN),
17 sigc::mem_fun(*this, &MainWin::openFile));
18 ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE),
19 sigc::mem_fun(*this, &MainWin::saveFile));
20 ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS),
21 sigc::mem_fun(*this, &MainWin::saveFileAs));
22 ag->add( Gtk::Action::create("FileQuit", Gtk::Stock::QUIT),
23 sigc::mem_fun(*this, &MainWin::hide));
25 ag->add( Gtk::Action::create("ViewMenu", "_View") );
26 ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN),
27 sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomIn));
28 ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
29 sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomOut));
30 ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT),
31 sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomFit));
32 ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
33 sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoom100));
35 ag->add( Gtk::Action::create("ShowMenu", "_Show") );
36 ag->add( Gtk::Action::create("ShowMaps", "_Maps"),
37 sigc::mem_fun(this->mapwin, &MapWin::show));
39 ag->add( Gtk::Action::create("CreateNode", Gtk::Stock::NO),
40 sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 1) );
41 ag->add( Gtk::Action::create("CreateEdge", Gtk::Stock::REMOVE),
42 sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 2) );
43 ag->add( Gtk::Action::create("EraseItem", Gtk::Stock::DELETE),
44 sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 3) );
45 ag->add( Gtk::Action::create("MoveItem", Gtk::Stock::CONVERT),
46 sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 0) );
47 ag->add( Gtk::Action::create("EditEdgeMap", Gtk::Stock::PROPERTIES),
48 sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 4) );
49 ag->add( Gtk::Action::create("EditNodeMap", Gtk::Stock::PREFERENCES),
50 sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 5) );
51 ag->add( Gtk::Action::create("AddMap", Gtk::Stock::NEW),
52 sigc::mem_fun ( this->newmapwin, &NewMapWin::show ) );
54 uim=Gtk::UIManager::create();
55 uim->insert_action_group(ag);
56 add_accel_group(uim->get_accel_group());
61 Glib::ustring ui_info =
63 " <menubar name='MenuBar'>"
64 " <menu action='FileMenu'>"
65 " <menuitem action='FileNew'/>"
66 " <menuitem action='FileOpen'/>"
67 " <menuitem action='FileSave'/>"
68 " <menuitem action='FileSaveAs'/>"
69 " <menuitem action='FileQuit'/>"
71 " <menu action='ViewMenu'>"
72 " <menuitem action='ViewZoomIn' />"
73 " <menuitem action='ViewZoomOut' />"
74 " <menuitem action='ViewZoomFit' />"
75 " <menuitem action='ViewZoom100' />"
77 " <menu action='ShowMenu'>"
78 " <menuitem action='ShowMaps'/>"
81 " <toolbar name='ToolBar'>"
82 " <toolitem action='FileNew' />"
83 " <toolitem action='FileOpen' />"
84 " <toolitem action='FileSave' />"
86 " <toolitem action='ViewZoomIn' />"
87 " <toolitem action='ViewZoomOut' />"
88 " <toolitem action='ViewZoomFit' />"
89 " <toolitem action='ViewZoom100' />"
91 " <toolitem action='CreateNode' />"
92 " <toolitem action='CreateEdge' />"
93 " <toolitem action='EraseItem' />"
94 " <toolitem action='MoveItem' />"
95 " <toolitem action='EditEdgeMap' />"
96 " <toolitem action='EditNodeMap' />"
97 " <toolitem action='AddMap' />"
101 uim->add_ui_from_string(ui_info);
104 catch(const Glib::Error& ex)
106 std::cerr << "building menus failed: " << ex.what();
109 Gtk::Widget* menubar = uim->get_widget("/MenuBar");
111 vbox.pack_start(*menubar, Gtk::PACK_SHRINK);
114 Gtk::Widget* toolbar = uim->get_widget("/ToolBar");
117 static_cast<Gtk::Toolbar*>(toolbar)->set_toolbar_style(Gtk::TOOLBAR_ICONS);
118 vbox.pack_start(*toolbar, Gtk::PACK_SHRINK);
121 Gtk::ScrolledWindow* pScrolledWindow = manage(new Gtk::ScrolledWindow());
122 pScrolledWindow->add(gd_canvas);
123 vbox.pack_start(*pScrolledWindow);
124 //vbox.pack_start(gd_canvas);
129 void MainWin::newFile()
131 std::cerr << "MainWin::newFile(): not yet implemented" << std::endl;
134 void MainWin::openFile()
136 std::cerr << "MainWin::openFile(): not yet implemented" << std::endl;
139 void MainWin::saveFile()
141 std::cerr << "MainWin::saveFile(): not yet implemented" << std::endl;
144 void MainWin::saveFileAs()
146 std::cerr << "MainWin::saveFileAs(): not yet implemented" << std::endl;