gui/map_win.cc
author klao
Tue, 15 Nov 2005 20:50:21 +0000
changeset 1795 ed3c253b9c29
parent 1733 5e0d97823ba2
child 1823 cb082cdf3667
permissions -rw-r--r--
bugfix in undir_graph_extender -> graph_extender transition
     1 #include "map_win.h"
     2 #include <set>
     3 
     4 bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e)
     5 {
     6   if(e->keyval==GDK_Escape)
     7   {
     8     hide();
     9   }
    10   return true;
    11 }
    12 
    13 MapWin::MapWin(const std::string& title, MapStorage & mapst, GraphDisplayerCanvas & grdispc, NewMapWin & newmapwin):gdc(grdispc),ms(mapst), nmw(newmapwin)
    14 {
    15   set_title(title);
    16   set_default_size(200, 50);
    17 
    18   signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed));
    19 
    20   e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM];
    21 
    22   table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false);
    23 
    24   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    25   {
    26     e_combo_array[i]=new MapSelector(gdc, ms, nmw, i, true);
    27 
    28     (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
    29   }
    30 
    31   vbox.pack_start(*(new Gtk::Label("Edge properties")));
    32 
    33   vbox.pack_start(*table);
    34 
    35   vbox.pack_start(*(new Gtk::HSeparator));
    36 
    37   n_combo_array=new MapSelector * [NODE_PROPERTY_NUM];
    38 
    39   table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false);
    40 
    41   for(int i=0;i<NODE_PROPERTY_NUM;i++)
    42   {
    43     n_combo_array[i]=new MapSelector(gdc, ms, nmw, i, false);
    44 
    45     (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
    46   }
    47 
    48   add(vbox);
    49 
    50   vbox.pack_start(*(new Gtk::Label("Node properties")));
    51 
    52   vbox.pack_start(*table);
    53 
    54   show_all_children();
    55 
    56 }
    57 
    58 void MapWin::update()
    59 {
    60   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    61   {
    62     e_combo_array[i]->update_list();
    63   }
    64 
    65   for(int i=0;i<NODE_PROPERTY_NUM;i++)
    66   {
    67     n_combo_array[i]->update_list();
    68   }
    69 }
    70 
    71 
    72 void MapWin::updateNode(Node node)
    73 {
    74   for(int i=0;i<NODE_PROPERTY_NUM;i++)
    75     {
    76       n_combo_array[i]->update(node);
    77     }
    78 }
    79 
    80 void MapWin::updateEdge(Edge edge)
    81 {
    82   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    83     {
    84       e_combo_array[i]->update(edge);
    85     }
    86 }
    87 
    88 void MapWin::registerNewEdgeMap(std::string newmapname)
    89 {
    90   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    91   {
    92     //filling in combo box with choices
    93     e_combo_array[i]->append_text((Glib::ustring)newmapname);
    94   }
    95 }
    96 
    97 void MapWin::registerNewNodeMap(std::string newmapname)
    98 {
    99   for(int i=0;i<NODE_PROPERTY_NUM;i++)
   100   {
   101     //filling in combo box with choices
   102     n_combo_array[i]->append_text((Glib::ustring)newmapname);
   103   }
   104 }