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