Removed this extra widget thing, because it is now developed in my private branch.
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
22 bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e)
24 if(e->keyval==GDK_Escape)
32 MapWin::MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, NoteBookTab & mw):mytab(mw)
35 set_default_size(200, 50);
39 signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed));
41 mytab.signal_title_ch().connect(sigc::mem_fun(*this, &MapWin::set_title));
43 e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM];
45 table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false);
47 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
49 e_combo_array[i]=new MapSelector(eml, mytab.getActiveEdgeMap(i), edge_property_strings[i], true);
51 (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
53 e_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::edgeMapChanged), i));
54 e_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded));
57 vbox.pack_start(*(new Gtk::Label("Edge properties")));
59 vbox.pack_start(*table);
61 vbox.pack_start(*(new Gtk::HSeparator));
63 n_combo_array=new MapSelector * [NODE_PROPERTY_NUM];
65 table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false);
67 for(int i=0;i<NODE_PROPERTY_NUM;i++)
69 n_combo_array[i]=new MapSelector(nml, mytab.getActiveNodeMap(i), node_property_strings[i], false);
71 (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
73 n_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::nodeMapChanged), i));
74 n_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded));
79 vbox.pack_start(*(new Gtk::Label("Node properties")));
81 vbox.pack_start(*table);
87 void MapWin::nodeMapChanged(std::string mapname, int prop)
89 mytab.propertyChange(false, prop, mapname);
92 void MapWin::edgeMapChanged(std::string mapname, int prop)
94 mytab.propertyChange(true, prop, mapname);
97 void MapWin::newMapWinNeeded(bool itisedge)
99 mytab.popupNewMapWin(itisedge);
102 void MapWin::update(std::vector<std::string> eml, std::vector<std::string> nml)
104 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
106 e_combo_array[i]->update_list(eml);
109 for(int i=0;i<NODE_PROPERTY_NUM;i++)
111 n_combo_array[i]->update_list(nml);
114 mytab.active_maps_needed();
117 void MapWin::registerNewEdgeMap(std::string newmapname)
119 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
121 //filling in combo box with choices
122 e_combo_array[i]->append_text((Glib::ustring)newmapname);
126 void MapWin::registerNewNodeMap(std::string newmapname)
128 for(int i=0;i<NODE_PROPERTY_NUM;i++)
130 //filling in combo box with choices
131 n_combo_array[i]->append_text((Glib::ustring)newmapname);
135 bool MapWin::on_delete_event(GdkEventAny * event)
142 void MapWin::changeEntry(bool isitedge, int prop, std::string mapname)
146 e_combo_array[prop]->set_active_text(mapname);
150 n_combo_array[prop]->set_active_text(mapname);
154 void MapWin::set_title(std::string tabname)
156 Gtk::Window::set_title("Map Setup - "+tabname);