hegyi@1: /* -*- C++ -*- hegyi@1: * hegyi@1: * This file is a part of LEMON, a generic C++ optimization library hegyi@1: * hegyi@1: * Copyright (C) 2003-2006 hegyi@1: * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport hegyi@1: * (Egervary Research Group on Combinatorial Optimization, EGRES). hegyi@1: * hegyi@1: * Permission to use, modify and distribute this software is granted hegyi@1: * provided that this copyright notice appears in all copies. For hegyi@1: * precise terms see the accompanying LICENSE file. hegyi@1: * hegyi@1: * This software is provided "AS IS" with no warranty of any kind, hegyi@1: * express or implied, and with no claim as to its suitability for any hegyi@1: * purpose. hegyi@1: * hegyi@1: */ hegyi@1: hegyi@1: #include hegyi@1: #include hegyi@1: #include hegyi@1: #include hegyi@1: hegyi@1: bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e) hegyi@1: { hegyi@1: if(e->keyval==GDK_Escape) hegyi@1: { hegyi@1: mytab.closeMapWin(); hegyi@1: // hide(); hegyi@1: } hegyi@1: return true; hegyi@1: } hegyi@1: hegyi@1: MapWin::MapWin(const std::string& title, hegyi@1: std::vector n_eml, hegyi@1: std::vector s_eml, hegyi@1: std::vector n_nml, hegyi@1: std::vector s_nml, hegyi@1: NoteBookTab & mw):mytab(mw) hegyi@1: { hegyi@1: set_title(title); hegyi@1: set_default_size(200, 50); hegyi@1: hegyi@1: set_resizable(false); hegyi@1: hegyi@1: signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed)); hegyi@1: hegyi@1: mytab.signal_title_ch().connect(sigc::mem_fun(*this, &MapWin::set_title)); hegyi@1: hegyi@1: e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM]; hegyi@1: hegyi@1: table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false); hegyi@1: hegyi@1: for(int i=0;isignal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::arcMapChanged), i)); hegyi@1: e_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded)); hegyi@1: } hegyi@1: hegyi@1: vbox.pack_start(*(new Gtk::Label("Arc properties"))); hegyi@1: hegyi@1: vbox.pack_start(*table); hegyi@1: hegyi@1: vbox.pack_start(*(new Gtk::HSeparator)); hegyi@1: hegyi@1: n_combo_array=new MapSelector * [NODE_PROPERTY_NUM]; hegyi@1: hegyi@1: table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false); hegyi@1: hegyi@1: for(int i=0;isignal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::nodeMapChanged), i)); hegyi@1: n_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded)); hegyi@1: } hegyi@1: hegyi@1: add(vbox); hegyi@1: hegyi@1: vbox.pack_start(*(new Gtk::Label("Node properties"))); hegyi@1: hegyi@1: vbox.pack_start(*table); hegyi@1: hegyi@1: update(n_eml, s_eml, n_nml, s_nml); hegyi@1: hegyi@1: show_all_children(); hegyi@1: hegyi@1: } hegyi@1: hegyi@1: void MapWin::nodeMapChanged(std::string mapname, int prop) hegyi@1: { hegyi@1: mytab.propertyChange(false, prop, mapname); hegyi@1: } hegyi@1: hegyi@1: void MapWin::arcMapChanged(std::string mapname, int prop) hegyi@1: { hegyi@1: mytab.propertyChange(true, prop, mapname); hegyi@1: } hegyi@1: hegyi@1: void MapWin::newMapWinNeeded(bool itisarc) hegyi@1: { hegyi@1: mytab.popupNewMapWin(itisarc); hegyi@1: } hegyi@1: hegyi@1: void MapWin::update( hegyi@1: std::vector n_eml, hegyi@1: std::vector s_eml, hegyi@1: std::vector n_nml, hegyi@1: std::vector s_nml) hegyi@1: { hegyi@1: for(int i=0;iupdate_list(n_eml, s_eml); hegyi@1: } hegyi@1: hegyi@1: for(int i=0;iupdate_list(n_nml, s_nml); hegyi@1: } hegyi@1: hegyi@1: mytab.active_maps_needed(); hegyi@1: } hegyi@1: hegyi@1: void MapWin::registerNewArcMap(std::string newmapname, MapValue::Type type) hegyi@1: { hegyi@1: for(int i=0;iappend_text((Glib::ustring)newmapname, type); hegyi@1: } hegyi@1: } hegyi@1: hegyi@1: void MapWin::registerNewNodeMap(std::string newmapname, MapValue::Type type) hegyi@1: { hegyi@1: for(int i=0;iappend_text((Glib::ustring)newmapname, type); hegyi@1: } hegyi@1: } hegyi@1: hegyi@1: bool MapWin::on_delete_event(GdkEventAny * event) hegyi@1: { hegyi@1: event=event; hegyi@1: mytab.closeMapWin(); hegyi@1: return true; hegyi@1: } hegyi@1: hegyi@1: void MapWin::changeEntry(bool isitarc, int prop, std::string mapname) hegyi@1: { hegyi@1: if(isitarc) hegyi@1: { hegyi@1: e_combo_array[prop]->set_active_text(mapname); hegyi@1: } hegyi@1: else hegyi@1: { hegyi@1: n_combo_array[prop]->set_active_text(mapname); hegyi@1: } hegyi@1: } hegyi@1: hegyi@1: void MapWin::set_title(std::string tabname) hegyi@1: { hegyi@1: Gtk::Window::set_title("Map Setup - "+tabname); hegyi@1: }