diff -r b7c36be1e35c -r 603b85626bc0 main_win.cc --- a/main_win.cc Wed Jun 01 23:30:13 2005 +0000 +++ b/main_win.cc Wed Jun 01 23:33:26 2005 +0000 @@ -1,133 +1,133 @@ -#include - -MainWin::MainWin(const std::string& title, Graph & graph, CoordinatesMap & cm, - MapStorage & ms):mapwin("Map Setup", ms, gd_canvas),gd_canvas(graph, cm, ms) -{ - set_title (title); - set_default_size(WIN_WIDTH,WIN_HEIGHT); - add(vbox); - - ag=Gtk::ActionGroup::create(); - - ag->add( Gtk::Action::create("FileMenu", "_File") ); - ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW), - sigc::mem_fun(*this, &MainWin::newFile)); - ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN), - sigc::mem_fun(*this, &MainWin::openFile)); - ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE), - sigc::mem_fun(*this, &MainWin::saveFile)); - ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS), - sigc::mem_fun(*this, &MainWin::saveFileAs)); - ag->add( Gtk::Action::create("FileQuit", Gtk::Stock::QUIT), - sigc::mem_fun(*this, &MainWin::quit)); - - ag->add( Gtk::Action::create("ViewMenu", "_View") ); - ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN), - sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomIn)); - ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT), - sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomOut)); - ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT), - sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomFit)); - ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100), - sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoom100)); - - ag->add( Gtk::Action::create("ShowMenu", "_Show") ); - ag->add( Gtk::Action::create("ShowMaps", "_Maps"), - sigc::mem_fun(*this, &MainWin::showMaps)); - - uim=Gtk::UIManager::create(); - uim->insert_action_group(ag); - add_accel_group(uim->get_accel_group()); - - try - { - - Glib::ustring ui_info = - "" - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - ""; - - uim->add_ui_from_string(ui_info); - - } - catch(const Glib::Error& ex) - { - std::cerr << "building menus failed: " << ex.what(); - } - - Gtk::Widget* menubar = uim->get_widget("/MenuBar"); - if (menubar){ - vbox.pack_start(*menubar, Gtk::PACK_SHRINK); - } - - Gtk::Widget* toolbar = uim->get_widget("/ToolBar"); - if (toolbar) - { - static_cast(toolbar)->set_toolbar_style(Gtk::TOOLBAR_ICONS); - vbox.pack_start(*toolbar, Gtk::PACK_SHRINK); - } - - Gtk::ScrolledWindow* pScrolledWindow = manage(new Gtk::ScrolledWindow()); - pScrolledWindow->add(gd_canvas); - vbox.pack_start(*pScrolledWindow); - //vbox.pack_start(gd_canvas); - - show_all_children(); -} - -void MainWin::showMaps() -{ - mapwin.show(); -} - -void MainWin::quit() -{ - hide(); -} - -void MainWin::newFile() -{ - std::cerr << "MainWin::newFile(): not yet implemented" << std::endl; -} - -void MainWin::openFile() -{ - std::cerr << "MainWin::openFile(): not yet implemented" << std::endl; -} - -void MainWin::saveFile() -{ - std::cerr << "MainWin::saveFile(): not yet implemented" << std::endl; -} - -void MainWin::saveFileAs() -{ - std::cerr << "MainWin::saveFileAs(): not yet implemented" << std::endl; -} +#include + +MainWin::MainWin(const std::string& title, Graph & graph, CoordinatesMap & cm, + MapStorage & ms):mapwin("Map Setup", ms, gd_canvas),gd_canvas(graph, cm, ms) +{ + set_title (title); + set_default_size(WIN_WIDTH,WIN_HEIGHT); + add(vbox); + + ag=Gtk::ActionGroup::create(); + + ag->add( Gtk::Action::create("FileMenu", "_File") ); + ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW), + sigc::mem_fun(*this, &MainWin::newFile)); + ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN), + sigc::mem_fun(*this, &MainWin::openFile)); + ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE), + sigc::mem_fun(*this, &MainWin::saveFile)); + ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS), + sigc::mem_fun(*this, &MainWin::saveFileAs)); + ag->add( Gtk::Action::create("FileQuit", Gtk::Stock::QUIT), + sigc::mem_fun(*this, &MainWin::quit)); + + ag->add( Gtk::Action::create("ViewMenu", "_View") ); + ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN), + sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomIn)); + ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT), + sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomOut)); + ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT), + sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomFit)); + ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100), + sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoom100)); + + ag->add( Gtk::Action::create("ShowMenu", "_Show") ); + ag->add( Gtk::Action::create("ShowMaps", "_Maps"), + sigc::mem_fun(*this, &MainWin::showMaps)); + + uim=Gtk::UIManager::create(); + uim->insert_action_group(ag); + add_accel_group(uim->get_accel_group()); + + try + { + + Glib::ustring ui_info = + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; + + uim->add_ui_from_string(ui_info); + + } + catch(const Glib::Error& ex) + { + std::cerr << "building menus failed: " << ex.what(); + } + + Gtk::Widget* menubar = uim->get_widget("/MenuBar"); + if (menubar){ + vbox.pack_start(*menubar, Gtk::PACK_SHRINK); + } + + Gtk::Widget* toolbar = uim->get_widget("/ToolBar"); + if (toolbar) + { + static_cast(toolbar)->set_toolbar_style(Gtk::TOOLBAR_ICONS); + vbox.pack_start(*toolbar, Gtk::PACK_SHRINK); + } + + Gtk::ScrolledWindow* pScrolledWindow = manage(new Gtk::ScrolledWindow()); + pScrolledWindow->add(gd_canvas); + vbox.pack_start(*pScrolledWindow); + //vbox.pack_start(gd_canvas); + + show_all_children(); +} + +void MainWin::showMaps() +{ + mapwin.show(); +} + +void MainWin::quit() +{ + hide(); +} + +void MainWin::newFile() +{ + std::cerr << "MainWin::newFile(): not yet implemented" << std::endl; +} + +void MainWin::openFile() +{ + std::cerr << "MainWin::openFile(): not yet implemented" << std::endl; +} + +void MainWin::saveFile() +{ + std::cerr << "MainWin::saveFile(): not yet implemented" << std::endl; +} + +void MainWin::saveFileAs() +{ + std::cerr << "MainWin::saveFileAs(): not yet implemented" << std::endl; +}