Forgot the meat.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/eps_win.cc Tue Feb 27 17:23:55 2007 +0000
1.3 @@ -0,0 +1,95 @@
1.4 +/* -*- C++ -*-
1.5 + *
1.6 + * This file is a part of LEMON, a generic C++ optimization library
1.7 + *
1.8 + * Copyright (C) 2003-2006
1.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
1.11 + *
1.12 + * Permission to use, modify and distribute this software is granted
1.13 + * provided that this copyright notice appears in all copies. For
1.14 + * precise terms see the accompanying LICENSE file.
1.15 + *
1.16 + * This software is provided "AS IS" with no warranty of any kind,
1.17 + * express or implied, and with no claim as to its suitability for any
1.18 + * purpose.
1.19 + *
1.20 + */
1.21 +
1.22 +#include "eps_win.h"
1.23 +#include <set>
1.24 +
1.25 +bool EpsWin::closeIfEscapeIsPressed(GdkEventKey* e)
1.26 +{
1.27 + if(e->keyval==GDK_Escape)
1.28 + {
1.29 + hide();
1.30 + }
1.31 + return true;
1.32 +}
1.33 +
1.34 +EpsWin::EpsWin(const std::string& title, NoteBookTab & mw):Gtk::Dialog(title, true, true),mytab(mw)
1.35 +{
1.36 + set_default_size(200, 50);
1.37 +
1.38 + set_resizable(false);
1.39 +
1.40 + signal_key_press_event().connect(sigc::mem_fun(*this, &EpsWin::closeIfEscapeIsPressed));
1.41 +
1.42 + mytab.signal_title_ch().connect(sigc::mem_fun(*this, &EpsWin::set_title));
1.43 +
1.44 + table=new Gtk::Table(EPS_PROPERTY_NUM, 1, false);
1.45 +
1.46 + std::vector<std::string> labels;
1.47 + labels.resize(EPS_PROPERTY_NUM);
1.48 +
1.49 + labels[N_MAPS]="Dump visualized nodemaps";
1.50 + labels[E_MAPS]="Dump visualizes edgemaps";
1.51 + labels[ARROWS]="Show arrows in directed graphs";
1.52 + labels[PAR]="Indicate parallel edges";
1.53 +
1.54 + options.resize(EPS_PROPERTY_NUM);
1.55 +
1.56 + for(int i=0;i<EPS_PROPERTY_NUM;i++)
1.57 + {
1.58 + options[i]=new Gtk::CheckButton(labels[i]);
1.59 + (*table).attach(*(options[i]),0,1,i,i+1,Gtk::FILL,Gtk::SHRINK,10,3);
1.60 + }
1.61 +
1.62 + hbox.pack_start(*(new Gtk::Label("Filename")));
1.63 + hbox.pack_start(name);
1.64 +
1.65 + Gtk::VBox * vbox=get_vbox();
1.66 +
1.67 + vbox->pack_start(*table);
1.68 + vbox->pack_start(hbox);
1.69 +
1.70 + //OK button
1.71 + add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
1.72 + add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
1.73 +
1.74 + show_all_children();
1.75 +
1.76 +}
1.77 +
1.78 +bool EpsWin::on_delete_event(GdkEventAny * event)
1.79 +{
1.80 + event=event;
1.81 + mytab.closeEpsWin();
1.82 + return true;
1.83 +}
1.84 +
1.85 +void EpsWin::on_response(int response_id)
1.86 +{
1.87 + if(response_id==Gtk::RESPONSE_OK)
1.88 + {
1.89 + std::vector <bool> values;
1.90 + values.resize(EPS_PROPERTY_NUM);
1.91 + for(int i=0;i<EPS_PROPERTY_NUM;i++)
1.92 + {
1.93 + values[i]=options[i]->get_active();
1.94 + }
1.95 + mytab.exportGraphToEPS(values, name.get_text());
1.96 + }
1.97 + on_delete_event(NULL);
1.98 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/eps_win.h Tue Feb 27 17:23:55 2007 +0000
2.3 @@ -0,0 +1,86 @@
2.4 +/* -*- C++ -*-
2.5 + *
2.6 + * This file is a part of LEMON, a generic C++ optimization library
2.7 + *
2.8 + * Copyright (C) 2003-2006
2.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
2.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
2.11 + *
2.12 + * Permission to use, modify and distribute this software is granted
2.13 + * provided that this copyright notice appears in all copies. For
2.14 + * precise terms see the accompanying LICENSE file.
2.15 + *
2.16 + * This software is provided "AS IS" with no warranty of any kind,
2.17 + * express or implied, and with no claim as to its suitability for any
2.18 + * purpose.
2.19 + *
2.20 + */
2.21 +
2.22 +#ifndef EPS_WIN_H
2.23 +#define EPS_WIN_H
2.24 +
2.25 +class EpsWin;
2.26 +
2.27 +#include <all_include.h>
2.28 +#include <nbtab.h>
2.29 +#include <mapselector.h>
2.30 +#include <libgnomecanvasmm.h>
2.31 +#include <libgnomecanvasmm/polygon.h>
2.32 +
2.33 +///Graph visualization setup window.
2.34 +
2.35 +///This class is responsible for creating a window,
2.36 +///on which the visualization attributes can be
2.37 +///assigned to maps.
2.38 +class EpsWin : public Gtk::Dialog
2.39 +{
2.40 +protected:
2.41 + ///\ref NoteBookTab to that the \ref EpsWin belongs to.
2.42 + NoteBookTab & mytab;
2.43 +
2.44 + ///Designing element
2.45 + Gtk::Table * table;
2.46 +
2.47 + ///Information holder
2.48 + Gtk::Label * label;
2.49 +
2.50 + ///configuration
2.51 + std::vector<Gtk::CheckButton *> options;
2.52 +
2.53 + ///OK, Cancel
2.54 + Gtk::Button * ok, * cancel;
2.55 +
2.56 + ///Container in which filename entry are organized.
2.57 + Gtk::HBox hbox;
2.58 +
2.59 + ///Filename
2.60 + Gtk::Entry name;
2.61 +
2.62 +public:
2.63 + ///Constructor
2.64 +
2.65 + ///It creates the widgets shown in \ref EpsWin and
2.66 + ///binds the needed signal to the correct place.
2.67 + ///\param title title of window
2.68 + ///\param eml edgemap list
2.69 + ///\param nml nodemap list
2.70 + ///\param mw the owner \ref NoteBookTab (\ref mytab)
2.71 + EpsWin(const std::string& title, NoteBookTab & mw);
2.72 +
2.73 + ///Deregistrates \ref EpsWin in its \ref NoteBookTab (\ref mytab)
2.74 + virtual bool on_delete_event(GdkEventAny *);
2.75 +
2.76 + ///Close window if Esc key pressed.
2.77 + virtual bool closeIfEscapeIsPressed(GdkEventKey*);
2.78 +
2.79 + ///Callback function for OK button. It creates the map.
2.80 +
2.81 + ///If OK is pressed this function
2.82 + ///transmits the collected data to
2.83 + ///appropriate functions to be able
2.84 + ///to create EPS
2.85 + virtual void on_response(int response_id);
2.86 +
2.87 +};
2.88 +
2.89 +#endif //EPS_WIN_H