COIN-OR::LEMON - Graph Library

source: glemon-0.x/eps_win.cc @ 194:6b2b718420eb

Last change on this file since 194:6b2b718420eb was 194:6b2b718420eb, checked in by Hegyi Péter, 17 years ago

Header reorganising

File size: 2.3 KB
Line 
1/* -*- C++ -*-
2 *
3 * This file is a part of LEMON, a generic C++ optimization library
4 *
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 *
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
12 *
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
15 * purpose.
16 *
17 */
18
19#include <nbtab.h>
20#include <eps_win.h>
21#include <set>
22
23bool EpsWin::closeIfEscapeIsPressed(GdkEventKey* e)
24{
25  if(e->keyval==GDK_Escape)
26  {
27    hide();
28  }
29  return true;
30}
31
32EpsWin::EpsWin(const std::string& title, NoteBookTab & mw):Gtk::Dialog(title, true, true),mytab(mw)
33{
34  set_default_size(200, 50);
35
36  set_resizable(false);
37
38  signal_key_press_event().connect(sigc::mem_fun(*this, &EpsWin::closeIfEscapeIsPressed));
39
40  mytab.signal_title_ch().connect(sigc::mem_fun(*this, &EpsWin::set_title));
41
42  table=new Gtk::Table(EPS_PROPERTY_NUM, 1, false);
43
44  std::vector<std::string> labels;
45  labels.resize(EPS_PROPERTY_NUM);
46
47  labels[N_MAPS]="Dump visualized nodemaps";
48  labels[E_MAPS]="Dump visualizes edgemaps";
49  labels[ARROWS]="Show arrows in directed graphs";
50  labels[PAR]="Indicate parallel edges";
51
52  options.resize(EPS_PROPERTY_NUM);
53
54  for(int i=0;i<EPS_PROPERTY_NUM;i++)
55    {
56      options[i]=new Gtk::CheckButton(labels[i]);
57      (*table).attach(*(options[i]),0,1,i,i+1,Gtk::FILL,Gtk::SHRINK,10,3);
58    }
59
60  hbox.pack_start(*(new Gtk::Label("Filename")));
61  hbox.pack_start(name);
62
63  Gtk::VBox * vbox=get_vbox();
64
65  vbox->pack_start(*table);
66  vbox->pack_start(hbox);
67
68  //OK button
69  add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
70  add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
71
72  show_all_children();
73
74}
75
76bool EpsWin::on_delete_event(GdkEventAny * event)
77{
78  event=event;
79  mytab.closeEpsWin();
80  return true;
81}
82
83void EpsWin::on_response(int response_id)
84{
85  if(response_id==Gtk::RESPONSE_OK)
86    {
87      std::vector <bool> values;
88      values.resize(EPS_PROPERTY_NUM);
89      for(int i=0;i<EPS_PROPERTY_NUM;i++)
90        {
91          values[i]=options[i]->get_active();
92        }
93      mytab.exportGraphToEPS(values, name.get_text());
94    }
95  on_delete_event(NULL);
96}
Note: See TracBrowser for help on using the repository browser.