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: hegyi@1: #include hegyi@1: hegyi@1: #include hegyi@1: hegyi@1: bool EpsWin::closeIfEscapeIsPressed(GdkEventKey* e) hegyi@1: { hegyi@1: if(e->keyval==GDK_Escape) hegyi@1: { hegyi@1: hide(); hegyi@1: } hegyi@1: return true; hegyi@1: } hegyi@1: hegyi@1: EpsWin::EpsWin(const std::string& title, std::vector n_nml, std::vector s_nml):Gtk::Dialog(title, true, true) hegyi@1: { 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, &EpsWin::closeIfEscapeIsPressed)); hegyi@1: hegyi@1: table=new Gtk::Table(EPS_PROPERTY_NUM, 1, false); hegyi@1: hegyi@1: std::vector labels; hegyi@1: labels.resize(EPS_PROPERTY_NUM); hegyi@1: hegyi@1: labels[N_MAPS]="Dump visualized nodemaps"; hegyi@1: labels[E_MAPS]="Dump visualizes arcmaps"; hegyi@1: labels[ARROWS]="Show arrows in directed digraphs"; hegyi@1: labels[PAR]="Indicate parallel arcs"; hegyi@1: hegyi@1: options.resize(EPS_PROPERTY_NUM); hegyi@1: hegyi@1: for(int i=0;isignal_newmapwin_needed().connect(sigc::mem_fun(*this, &EpsWin::newMapWinNeeded)); hegyi@1: hegyi@1: hbox.pack_start(*(new Gtk::Label("Filename"))); hegyi@1: hbox.pack_start(name); hegyi@1: hegyi@1: Gtk::VBox * vbox=get_vbox(); hegyi@1: hegyi@1: vbox->pack_start(*table); hegyi@1: vbox->pack_start(*mapselector); hegyi@1: vbox->pack_start(hbox); hegyi@1: hegyi@1: //OK button hegyi@1: add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); hegyi@1: add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); hegyi@1: hegyi@1: show_all_children(); hegyi@1: hegyi@1: } hegyi@1: hegyi@1: bool EpsWin::on_delete_event(GdkEventAny * event) hegyi@1: { hegyi@1: event=event; hegyi@1: signal_eps_close.emit(); hegyi@1: return true; hegyi@1: } hegyi@1: hegyi@1: void EpsWin::on_response(int response_id) hegyi@1: { hegyi@1: if(response_id==Gtk::RESPONSE_OK) hegyi@1: { hegyi@1: std::vector values; hegyi@1: values.resize(EPS_PROPERTY_NUM); hegyi@1: for(int i=0;iget_active(); hegyi@1: } hegyi@1: signal_eps_details.emit(values, name.get_text(), mapselector->get_active_text()); hegyi@1: } hegyi@1: on_delete_event(NULL); hegyi@1: } hegyi@1: hegyi@1: void EpsWin::newMapWinNeeded(bool isitarc) hegyi@1: { hegyi@1: signal_new_map.emit(false); hegyi@1: } hegyi@1: hegyi@1: void EpsWin::registerNewNodeMap(std::string newmapname, MapValue::Type type) hegyi@1: { hegyi@1: mapselector->append_text((Glib::ustring)newmapname, type); hegyi@1: }