/* -*- 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 "map_win.h" #include bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e) { if(e->keyval==GDK_Escape) { mytab.closeMapWin(); // hide(); } return true; } MapWin::MapWin(const std::string& title, std::vector eml, std::vector 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::edgeMapChanged), i)); e_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded)); } vbox.pack_start(*(new Gtk::Label("Edge 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); show_all_children(); } void MapWin::nodeMapChanged(std::string mapname, int prop) { mytab.propertyChange(false, prop, mapname); } void MapWin::edgeMapChanged(std::string mapname, int prop) { mytab.propertyChange(true, prop, mapname); } void MapWin::newMapWinNeeded(bool itisedge) { mytab.popupNewMapWin(itisedge); } void MapWin::update(std::vector eml, std::vector nml) { for(int i=0;iupdate_list(eml); } for(int i=0;iupdate_list(nml); } mytab.active_maps_needed(); } void MapWin::registerNewEdgeMap(std::string newmapname) { for(int i=0;iappend_text((Glib::ustring)newmapname); } } void MapWin::registerNewNodeMap(std::string newmapname) { for(int i=0;iappend_text((Glib::ustring)newmapname); } } bool MapWin::on_delete_event(GdkEventAny * event) { event=event; mytab.closeMapWin(); return true; } void MapWin::changeEntry(bool isitedge, int prop, std::string mapname) { if(isitedge) { 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); }