| [1606] | 1 | #include "map_win.h" | 
|---|
| [1442] | 2 | #include <set> | 
|---|
 | 3 |  | 
|---|
| [1524] | 4 | bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e) | 
|---|
| [1442] | 5 | { | 
|---|
| [1446] | 6 |   if(e->keyval==GDK_Escape) | 
|---|
 | 7 |   { | 
|---|
| [1849] | 8 |     mytab.closeMapWin(); | 
|---|
| [1838] | 9 |     //    hide(); | 
|---|
| [1446] | 10 |   } | 
|---|
 | 11 |   return true; | 
|---|
 | 12 | } | 
|---|
| [1442] | 13 |  | 
|---|
| [1849] | 14 | MapWin::MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, NoteBookTab & mw):mytab(mw) | 
|---|
| [1446] | 15 | { | 
|---|
 | 16 |   set_title(title); | 
|---|
 | 17 |   set_default_size(200, 50); | 
|---|
| [1442] | 18 |  | 
|---|
| [1524] | 19 |   signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed)); | 
|---|
| [1442] | 20 |  | 
|---|
| [1731] | 21 |   e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM]; | 
|---|
| [1446] | 22 |  | 
|---|
| [1731] | 23 |   table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false); | 
|---|
| [1512] | 24 |  | 
|---|
 | 25 |   for(int i=0;i<EDGE_PROPERTY_NUM;i++) | 
|---|
| [1442] | 26 |   { | 
|---|
| [1884] | 27 |     e_combo_array[i]=new MapSelector(eml, mytab.getActiveEdgeMap(i), edge_property_strings[i], true); | 
|---|
| [1446] | 28 |  | 
|---|
| [1731] | 29 |     (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3); | 
|---|
| [1837] | 30 |  | 
|---|
 | 31 |     e_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::edgeMapChanged), i)); | 
|---|
| [1891] | 32 |     e_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded)); | 
|---|
| [1442] | 33 |   } | 
|---|
 | 34 |  | 
|---|
| [1512] | 35 |   vbox.pack_start(*(new Gtk::Label("Edge properties"))); | 
|---|
| [1446] | 36 |  | 
|---|
| [1512] | 37 |   vbox.pack_start(*table); | 
|---|
 | 38 |  | 
|---|
 | 39 |   vbox.pack_start(*(new Gtk::HSeparator)); | 
|---|
 | 40 |  | 
|---|
| [1731] | 41 |   n_combo_array=new MapSelector * [NODE_PROPERTY_NUM]; | 
|---|
| [1512] | 42 |  | 
|---|
| [1731] | 43 |   table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false); | 
|---|
| [1512] | 44 |  | 
|---|
 | 45 |   for(int i=0;i<NODE_PROPERTY_NUM;i++) | 
|---|
 | 46 |   { | 
|---|
| [1884] | 47 |     n_combo_array[i]=new MapSelector(nml, mytab.getActiveNodeMap(i), node_property_strings[i], false); | 
|---|
| [1512] | 48 |  | 
|---|
| [1731] | 49 |     (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3); | 
|---|
| [1837] | 50 |  | 
|---|
 | 51 |     n_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::nodeMapChanged), i)); | 
|---|
| [1891] | 52 |     n_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded)); | 
|---|
| [1512] | 53 |   } | 
|---|
 | 54 |  | 
|---|
 | 55 |   add(vbox); | 
|---|
 | 56 |  | 
|---|
 | 57 |   vbox.pack_start(*(new Gtk::Label("Node properties"))); | 
|---|
 | 58 |  | 
|---|
 | 59 |   vbox.pack_start(*table); | 
|---|
| [1442] | 60 |  | 
|---|
 | 61 |   show_all_children(); | 
|---|
 | 62 |  | 
|---|
 | 63 | } | 
|---|
 | 64 |  | 
|---|
| [1837] | 65 | void MapWin::nodeMapChanged(std::string mapname, int prop) | 
|---|
 | 66 | { | 
|---|
| [1849] | 67 |   mytab.propertyChange(false, prop, mapname); | 
|---|
| [1837] | 68 | } | 
|---|
 | 69 |  | 
|---|
 | 70 | void MapWin::edgeMapChanged(std::string mapname, int prop) | 
|---|
 | 71 | { | 
|---|
| [1849] | 72 |   mytab.propertyChange(true, prop, mapname); | 
|---|
| [1837] | 73 | } | 
|---|
 | 74 |  | 
|---|
| [1891] | 75 | void MapWin::newMapWinNeeded(bool itisedge) | 
|---|
| [1837] | 76 | { | 
|---|
| [1891] | 77 |   mytab.popupNewMapWin(itisedge); | 
|---|
| [1837] | 78 | } | 
|---|
 | 79 |  | 
|---|
 | 80 | void MapWin::update(std::vector<std::string> eml, std::vector<std::string> nml) | 
|---|
| [1606] | 81 | { | 
|---|
 | 82 |   for(int i=0;i<EDGE_PROPERTY_NUM;i++) | 
|---|
 | 83 |   { | 
|---|
| [1837] | 84 |     e_combo_array[i]->update_list(eml); | 
|---|
| [1731] | 85 |   } | 
|---|
| [1606] | 86 |  | 
|---|
 | 87 |   for(int i=0;i<NODE_PROPERTY_NUM;i++) | 
|---|
 | 88 |   { | 
|---|
| [1837] | 89 |     n_combo_array[i]->update_list(nml); | 
|---|
| [1606] | 90 |   } | 
|---|
 | 91 | } | 
|---|
 | 92 |  | 
|---|
| [1589] | 93 | void MapWin::registerNewEdgeMap(std::string newmapname) | 
|---|
| [1586] | 94 | { | 
|---|
| [1589] | 95 |   for(int i=0;i<EDGE_PROPERTY_NUM;i++) | 
|---|
 | 96 |   { | 
|---|
 | 97 |     //filling in combo box with choices | 
|---|
| [1731] | 98 |     e_combo_array[i]->append_text((Glib::ustring)newmapname); | 
|---|
| [1589] | 99 |   } | 
|---|
| [1586] | 100 | } | 
|---|
 | 101 |  | 
|---|
| [1589] | 102 | void MapWin::registerNewNodeMap(std::string newmapname) | 
|---|
| [1586] | 103 | { | 
|---|
| [1592] | 104 |   for(int i=0;i<NODE_PROPERTY_NUM;i++) | 
|---|
| [1589] | 105 |   { | 
|---|
 | 106 |     //filling in combo box with choices | 
|---|
| [1733] | 107 |     n_combo_array[i]->append_text((Glib::ustring)newmapname); | 
|---|
| [1589] | 108 |   } | 
|---|
| [1586] | 109 | } | 
|---|
| [1838] | 110 |  | 
|---|
 | 111 | bool MapWin::on_delete_event(GdkEventAny * event) | 
|---|
 | 112 | { | 
|---|
 | 113 |   event=event; | 
|---|
| [1849] | 114 |   mytab.closeMapWin(); | 
|---|
| [1838] | 115 |   return true; | 
|---|
 | 116 | } | 
|---|