# HG changeset patch # User hegyi # Date 1172597035 0 # Node ID 9d7489e8921ed382d987f548df602a48834f156f # Parent af2ed974ab68e978f7a5df0337d82c005aa868da Forgot the meat. diff -r af2ed974ab68 -r 9d7489e8921e eps_win.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/eps_win.cc Tue Feb 27 17:23:55 2007 +0000 @@ -0,0 +1,95 @@ +/* -*- 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 "eps_win.h" +#include + +bool EpsWin::closeIfEscapeIsPressed(GdkEventKey* e) +{ + if(e->keyval==GDK_Escape) + { + hide(); + } + return true; +} + +EpsWin::EpsWin(const std::string& title, NoteBookTab & mw):Gtk::Dialog(title, true, true),mytab(mw) +{ + set_default_size(200, 50); + + set_resizable(false); + + signal_key_press_event().connect(sigc::mem_fun(*this, &EpsWin::closeIfEscapeIsPressed)); + + mytab.signal_title_ch().connect(sigc::mem_fun(*this, &EpsWin::set_title)); + + table=new Gtk::Table(EPS_PROPERTY_NUM, 1, false); + + std::vector labels; + labels.resize(EPS_PROPERTY_NUM); + + labels[N_MAPS]="Dump visualized nodemaps"; + labels[E_MAPS]="Dump visualizes edgemaps"; + labels[ARROWS]="Show arrows in directed graphs"; + labels[PAR]="Indicate parallel edges"; + + options.resize(EPS_PROPERTY_NUM); + + for(int i=0;ipack_start(*table); + vbox->pack_start(hbox); + + //OK button + add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); + + show_all_children(); + +} + +bool EpsWin::on_delete_event(GdkEventAny * event) +{ + event=event; + mytab.closeEpsWin(); + return true; +} + +void EpsWin::on_response(int response_id) +{ + if(response_id==Gtk::RESPONSE_OK) + { + std::vector values; + values.resize(EPS_PROPERTY_NUM); + for(int i=0;iget_active(); + } + mytab.exportGraphToEPS(values, name.get_text()); + } + on_delete_event(NULL); +} diff -r af2ed974ab68 -r 9d7489e8921e eps_win.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/eps_win.h Tue Feb 27 17:23:55 2007 +0000 @@ -0,0 +1,86 @@ +/* -*- 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. + * + */ + +#ifndef EPS_WIN_H +#define EPS_WIN_H + +class EpsWin; + +#include +#include +#include +#include +#include + +///Graph visualization setup window. + +///This class is responsible for creating a window, +///on which the visualization attributes can be +///assigned to maps. +class EpsWin : public Gtk::Dialog +{ +protected: + ///\ref NoteBookTab to that the \ref EpsWin belongs to. + NoteBookTab & mytab; + + ///Designing element + Gtk::Table * table; + + ///Information holder + Gtk::Label * label; + + ///configuration + std::vector options; + + ///OK, Cancel + Gtk::Button * ok, * cancel; + + ///Container in which filename entry are organized. + Gtk::HBox hbox; + + ///Filename + Gtk::Entry name; + +public: + ///Constructor + + ///It creates the widgets shown in \ref EpsWin and + ///binds the needed signal to the correct place. + ///\param title title of window + ///\param eml edgemap list + ///\param nml nodemap list + ///\param mw the owner \ref NoteBookTab (\ref mytab) + EpsWin(const std::string& title, NoteBookTab & mw); + + ///Deregistrates \ref EpsWin in its \ref NoteBookTab (\ref mytab) + virtual bool on_delete_event(GdkEventAny *); + + ///Close window if Esc key pressed. + virtual bool closeIfEscapeIsPressed(GdkEventKey*); + + ///Callback function for OK button. It creates the map. + + ///If OK is pressed this function + ///transmits the collected data to + ///appropriate functions to be able + ///to create EPS + virtual void on_response(int response_id); + +}; + +#endif //EPS_WIN_H