map_win.cc
branchgui
changeset 30 f70bbee5350a
parent 28 fa28f1071bd6
child 31 66e85f44a66f
equal deleted inserted replaced
4:85df76b66480 5:88871e5dfb40
     1 #include <map_win.h>
     1 #include <map_win.h>
     2 #include <set>
     2 #include <set>
     3 
     3 
     4 bool MapWin::close_if_escape_is_pressed(GdkEventKey* e)
     4 bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e)
     5 {
     5 {
     6   if(e->keyval==GDK_Escape)
     6   if(e->keyval==GDK_Escape)
     7   {
     7   {
     8     hide();
     8     hide();
     9   }
     9   }
    13 MapWin::MapWin(const std::string& title, MapStorage & mapst, GraphDisplayerCanvas & grdispc):gdc(grdispc),ms(mapst)
    13 MapWin::MapWin(const std::string& title, MapStorage & mapst, GraphDisplayerCanvas & grdispc):gdc(grdispc),ms(mapst)
    14 {
    14 {
    15   set_title(title);
    15   set_title(title);
    16   set_default_size(200, 50);
    16   set_default_size(200, 50);
    17 
    17 
    18   signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::close_if_escape_is_pressed));
    18   signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed));
    19 
    19 
    20   e_combo_array=new Gtk::Combo [EDGE_PROPERTY_NUM];
    20   e_combo_array=new Gtk::Combo [EDGE_PROPERTY_NUM];
    21 
    21 
    22   table=new Gtk::Table(EDGE_PROPERTY_NUM, 2, false);
    22   table=new Gtk::Table(EDGE_PROPERTY_NUM, 2, false);
    23 
    23 
    72     //binding signal to the actual entry
    72     //binding signal to the actual entry
    73     e_combo_array[i].get_entry()->signal_changed().connect
    73     e_combo_array[i].get_entry()->signal_changed().connect
    74     (
    74     (
    75      sigc::bind
    75      sigc::bind
    76      (
    76      (
    77       sigc::mem_fun(*this, &MapWin::e_combo_changed),
    77       sigc::mem_fun(*this, &MapWin::eComboChanged),
    78       i
    78       i
    79      )
    79      )
    80     );
    80     );
    81 
    81 
    82     //placing actual entry in the right place
    82     //placing actual entry in the right place
   151     //binding signal to thew actual entry
   151     //binding signal to thew actual entry
   152     n_combo_array[i].get_entry()->signal_changed().connect
   152     n_combo_array[i].get_entry()->signal_changed().connect
   153     (
   153     (
   154      sigc::bind
   154      sigc::bind
   155      (
   155      (
   156       sigc::mem_fun(*this, &MapWin::n_combo_changed),
   156       sigc::mem_fun(*this, &MapWin::nComboChanged),
   157       i
   157       i
   158      )
   158      )
   159     );
   159     );
   160 
   160 
   161     //placing actual entry in the right place
   161     //placing actual entry in the right place
   177 
   177 
   178   show_all_children();
   178   show_all_children();
   179 
   179 
   180 }
   180 }
   181 
   181 
   182 void MapWin::e_combo_changed(int prop)
   182 void MapWin::eComboChanged(int prop)
   183 {
   183 {
   184   Gtk::Entry* entry = e_combo_array[prop].get_entry();
   184   Gtk::Entry* entry = e_combo_array[prop].get_entry();
   185 
   185 
   186   if(entry)
   186   if(entry)
   187   {
   187   {
   212       }
   212       }
   213     }
   213     }
   214   }
   214   }
   215 };
   215 };
   216 
   216 
   217 void MapWin::n_combo_changed(int prop)
   217 void MapWin::nComboChanged(int prop)
   218 {
   218 {
   219 
   219 
   220   Gtk::Entry* entry = n_combo_array[prop].get_entry();
   220   Gtk::Entry* entry = n_combo_array[prop].get_entry();
   221 
   221 
   222   if(entry)
   222   if(entry)
   248       }
   248       }
   249     }
   249     }
   250   }
   250   }
   251 };
   251 };
   252 
   252 
   253 void MapWin::update_node(Graph::Node node)
   253 void MapWin::updateNode(Graph::Node node)
   254 {
   254 {
   255   for(int i=0;i<NODE_PROPERTY_NUM;i++)
   255   for(int i=0;i<NODE_PROPERTY_NUM;i++)
   256     {
   256     {
   257       Gtk::Entry* entry = n_combo_array[i].get_entry();
   257       Gtk::Entry* entry = n_combo_array[i].get_entry();
   258 
   258 
   287 	    }
   287 	    }
   288 	}
   288 	}
   289     }
   289     }
   290 }
   290 }
   291 
   291 
   292 void MapWin::update_edge(Graph::Edge edge)
   292 void MapWin::updateEdge(Graph::Edge edge)
   293 {
   293 {
   294   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   294   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   295     {
   295     {
   296 
   296 
   297       Gtk::Entry* entry = e_combo_array[i].get_entry();
   297       Gtk::Entry* entry = e_combo_array[i].get_entry();