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 +}