3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
21 #include <mapselector.h>
24 bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e)
26 if(e->keyval==GDK_Escape)
34 MapWin::MapWin(const std::string& title,
35 std::vector<std::string> n_eml,
36 std::vector<std::string> s_eml,
37 std::vector<std::string> n_nml,
38 std::vector<std::string> s_nml,
39 NoteBookTab & mw):mytab(mw)
42 set_default_size(200, 50);
46 signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed));
48 mytab.signal_title_ch().connect(sigc::mem_fun(*this, &MapWin::set_title));
50 e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM];
52 table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false);
54 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
59 e_combo_array[i]=new MapSelector(n_eml, s_eml,
60 mytab.getActiveArcMap(i), arc_property_strings[i],
64 e_combo_array[i]=new MapSelector(n_eml, s_eml,
65 mytab.getActiveArcMap(i), arc_property_strings[i],
69 e_combo_array[i]=new MapSelector(n_eml, s_eml,
70 mytab.getActiveArcMap(i), arc_property_strings[i],
75 (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
77 e_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::arcMapChanged), i));
78 e_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded));
81 vbox.pack_start(*(new Gtk::Label("Arc properties")));
83 vbox.pack_start(*table);
85 vbox.pack_start(*(new Gtk::HSeparator));
87 n_combo_array=new MapSelector * [NODE_PROPERTY_NUM];
89 table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false);
91 for(int i=0;i<NODE_PROPERTY_NUM;i++)
96 n_combo_array[i]=new MapSelector(n_nml, s_nml,
97 mytab.getActiveNodeMap(i), node_property_strings[i],
101 n_combo_array[i]=new MapSelector(n_nml, s_nml,
102 mytab.getActiveNodeMap(i), node_property_strings[i],
106 n_combo_array[i]=new MapSelector(n_nml, s_nml,
107 mytab.getActiveNodeMap(i), node_property_strings[i],
112 (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
114 n_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::nodeMapChanged), i));
115 n_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded));
120 vbox.pack_start(*(new Gtk::Label("Node properties")));
122 vbox.pack_start(*table);
124 update(n_eml, s_eml, n_nml, s_nml);
130 void MapWin::nodeMapChanged(std::string mapname, int prop)
132 mytab.propertyChange(false, prop, mapname);
135 void MapWin::arcMapChanged(std::string mapname, int prop)
137 mytab.propertyChange(true, prop, mapname);
140 void MapWin::newMapWinNeeded(bool itisarc)
142 mytab.popupNewMapWin(itisarc);
146 std::vector<std::string> n_eml,
147 std::vector<std::string> s_eml,
148 std::vector<std::string> n_nml,
149 std::vector<std::string> s_nml)
151 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
153 e_combo_array[i]->update_list(n_eml, s_eml);
156 for(int i=0;i<NODE_PROPERTY_NUM;i++)
158 n_combo_array[i]->update_list(n_nml, s_nml);
161 mytab.active_maps_needed();
164 void MapWin::registerNewArcMap(std::string newmapname, MapValue::Type type)
166 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
168 //filling in combo box with choices
169 e_combo_array[i]->append_text((Glib::ustring)newmapname, type);
173 void MapWin::registerNewNodeMap(std::string newmapname, MapValue::Type type)
175 for(int i=0;i<NODE_PROPERTY_NUM;i++)
177 //filling in combo box with choices
178 n_combo_array[i]->append_text((Glib::ustring)newmapname, type);
182 bool MapWin::on_delete_event(GdkEventAny * event)
189 void MapWin::changeEntry(bool isitarc, int prop, std::string mapname)
193 e_combo_array[prop]->set_active_text(mapname);
197 n_combo_array[prop]->set_active_text(mapname);
201 void MapWin::set_title(std::string tabname)
203 Gtk::Window::set_title("Map Setup - "+tabname);