gui/main_win.cc
changeset 1599 c2f95eac652b
parent 1592 4708b716d2f4
child 1601 70d169a8313a
equal deleted inserted replaced
8:28821de12fc8 9:c31e0132245f
     1 #include <main_win.h>
     1 #include <main_win.h>
     2 
     2 
     3 MainWin::MainWin(const std::string& title, Graph & graph, CoordinatesMap & cm,
     3 MainWin::MainWin(const std::string& title, Graph & graph, CoordinatesMap & cm,
     4     MapStorage & ms):mapwin("Map Setup", ms, gd_canvas),editwin("Editorial Window", gd_canvas),newmapwin("Creating new map",gd_canvas),gd_canvas(graph, cm, ms, &mapwin)
     4     MapStorage & ms):mapwin("Map Setup", ms, gd_canvas),newmapwin("Creating new map",gd_canvas),gd_canvas(graph, cm, ms, &mapwin)
     5 {
     5 {
     6   //Creating a window for setting new maps.
       
     7 //   newmapwin=new NewMapWi("Creating new map",*this);
       
     8 
       
     9 
     6 
    10   set_title (title);
     7   set_title (title);
    11   set_default_size(WIN_WIDTH,WIN_HEIGHT);
     8   set_default_size(WIN_WIDTH,WIN_HEIGHT);
    12   add(vbox);
     9   add(vbox);
    13 
    10 
    21   ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE),
    18   ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE),
    22       sigc::mem_fun(*this, &MainWin::saveFile));
    19       sigc::mem_fun(*this, &MainWin::saveFile));
    23   ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS),
    20   ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS),
    24       sigc::mem_fun(*this, &MainWin::saveFileAs));
    21       sigc::mem_fun(*this, &MainWin::saveFileAs));
    25   ag->add( Gtk::Action::create("FileQuit", Gtk::Stock::QUIT),
    22   ag->add( Gtk::Action::create("FileQuit", Gtk::Stock::QUIT),
    26       sigc::mem_fun(*this, &MainWin::quit));
    23       sigc::mem_fun(*this, &MainWin::hide));
    27 
    24 
    28   ag->add( Gtk::Action::create("ViewMenu", "_View") );
    25   ag->add( Gtk::Action::create("ViewMenu", "_View") );
    29   ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN),
    26   ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN),
    30       sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomIn));
    27       sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomIn));
    31   ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
    28   ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
    35   ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
    32   ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
    36       sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoom100));
    33       sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoom100));
    37   
    34   
    38   ag->add( Gtk::Action::create("ShowMenu", "_Show") );
    35   ag->add( Gtk::Action::create("ShowMenu", "_Show") );
    39   ag->add( Gtk::Action::create("ShowMaps", "_Maps"),
    36   ag->add( Gtk::Action::create("ShowMaps", "_Maps"),
    40       sigc::mem_fun(*this, &MainWin::showMaps));
    37       sigc::mem_fun(this->mapwin, &MapWin::show));
    41   ag->add( Gtk::Action::create("ShowEditorials", "_Editorials"),
       
    42       sigc::mem_fun(*this, &MainWin::showEditorials));
       
    43 
    38 
    44   ag->add( Gtk::Action::create("CreateNode", Gtk::Stock::NO),
    39   ag->add( Gtk::Action::create("CreateNode", Gtk::Stock::NO),
    45       sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 1) );
    40       sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 1) );
    46   ag->add( Gtk::Action::create("CreateEdge", Gtk::Stock::REMOVE),
    41   ag->add( Gtk::Action::create("CreateEdge", Gtk::Stock::REMOVE),
    47       sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 2) );
    42       sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 2) );
    79       "      <menuitem action='ViewZoomFit' />"
    74       "      <menuitem action='ViewZoomFit' />"
    80       "      <menuitem action='ViewZoom100' />"
    75       "      <menuitem action='ViewZoom100' />"
    81       "    </menu>"
    76       "    </menu>"
    82       "    <menu action='ShowMenu'>"
    77       "    <menu action='ShowMenu'>"
    83       "      <menuitem action='ShowMaps'/>"
    78       "      <menuitem action='ShowMaps'/>"
    84       "      <menuitem action='ShowEditorials'/>"
       
    85       "    </menu>"
    79       "    </menu>"
    86       "  </menubar>"
    80       "  </menubar>"
    87       "  <toolbar name='ToolBar'>"
    81       "  <toolbar name='ToolBar'>"
    88       "    <toolitem action='FileNew' />"
    82       "    <toolitem action='FileNew' />"
    89       "    <toolitem action='FileOpen' />"
    83       "    <toolitem action='FileOpen' />"
   130   //vbox.pack_start(gd_canvas);
   124   //vbox.pack_start(gd_canvas);
   131 
   125 
   132   show_all_children();
   126   show_all_children();
   133 }
   127 }
   134 
   128 
   135 void MainWin::showMaps()
       
   136 {
       
   137   mapwin.show();
       
   138 }
       
   139 
       
   140 void MainWin::showEditorials()
       
   141 {
       
   142   editwin.show();
       
   143 }
       
   144 
       
   145 void MainWin::quit()
       
   146 {
       
   147   hide();
       
   148 }
       
   149 
       
   150 void MainWin::newFile()
   129 void MainWin::newFile()
   151 {
   130 {
   152   std::cerr << "MainWin::newFile(): not yet implemented" << std::endl;
   131   std::cerr << "MainWin::newFile(): not yet implemented" << std::endl;
   153 }
   132 }
   154 
   133