4 bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e)
6 if(e->keyval==GDK_Escape)
14 MapWin::MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, MainWin & mw):mainwin(mw)
17 set_default_size(200, 50);
19 signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed));
21 e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM];
23 table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false);
25 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
27 e_combo_array[i]=new MapSelector(eml, mainwin.getActiveEdgeMap(i), i, true);
29 (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
31 e_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::edgeMapChanged), i));
32 e_combo_array[i]->signal_newmapwin_needed().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::newMapWinNeeded), i));
35 vbox.pack_start(*(new Gtk::Label("Edge properties")));
37 vbox.pack_start(*table);
39 vbox.pack_start(*(new Gtk::HSeparator));
41 n_combo_array=new MapSelector * [NODE_PROPERTY_NUM];
43 table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false);
45 for(int i=0;i<NODE_PROPERTY_NUM;i++)
47 n_combo_array[i]=new MapSelector(nml, mainwin.getActiveNodeMap(i), i, false);
49 (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
51 n_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::nodeMapChanged), i));
52 n_combo_array[i]->signal_newmapwin_needed().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::newMapWinNeeded), i));
57 vbox.pack_start(*(new Gtk::Label("Node properties")));
59 vbox.pack_start(*table);
69 void MapWin::nodeMapChanged(std::string mapname, int prop)
71 mainwin.propertyChange(false, prop, mapname);
74 void MapWin::edgeMapChanged(std::string mapname, int prop)
76 mainwin.propertyChange(true, prop, mapname);
79 void MapWin::newMapWinNeeded(bool itisedge, int prop)
81 mainwin.popupNewMapWin(itisedge, prop);
84 void MapWin::update(std::vector<std::string> eml, std::vector<std::string> nml)
86 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
88 e_combo_array[i]->update_list(eml);
91 for(int i=0;i<NODE_PROPERTY_NUM;i++)
93 n_combo_array[i]->update_list(nml);
97 void MapWin::registerNewEdgeMap(std::string newmapname)
99 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
101 //filling in combo box with choices
102 e_combo_array[i]->append_text((Glib::ustring)newmapname);
106 void MapWin::registerNewNodeMap(std::string newmapname)
108 for(int i=0;i<NODE_PROPERTY_NUM;i++)
110 //filling in combo box with choices
111 n_combo_array[i]->append_text((Glib::ustring)newmapname);
115 bool MapWin::on_delete_event(GdkEventAny * event)
118 mainwin.closeMapWin();