[Lemon-commits] hegyi: r3203 - glemon/trunk

Lemon SVN svn at lemon.cs.elte.hu
Tue Feb 27 18:23:56 CET 2007


Author: hegyi
Date: Tue Feb 27 18:23:55 2007
New Revision: 3203

Added:
   glemon/trunk/eps_win.cc
   glemon/trunk/eps_win.h

Log:
Forgot the meat.

Added: glemon/trunk/eps_win.cc
==============================================================================
--- (empty file)
+++ glemon/trunk/eps_win.cc	Tue Feb 27 18:23:55 2007
@@ -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 <set>
+
+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<std::string> 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;i<EPS_PROPERTY_NUM;i++)
+    {
+      options[i]=new Gtk::CheckButton(labels[i]);
+      (*table).attach(*(options[i]),0,1,i,i+1,Gtk::FILL,Gtk::SHRINK,10,3);
+    }
+
+  hbox.pack_start(*(new Gtk::Label("Filename")));
+  hbox.pack_start(name);
+
+  Gtk::VBox * vbox=get_vbox();
+
+  vbox->pack_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 <bool> values;
+      values.resize(EPS_PROPERTY_NUM);
+      for(int i=0;i<EPS_PROPERTY_NUM;i++)
+	{
+	  values[i]=options[i]->get_active();
+	}
+      mytab.exportGraphToEPS(values, name.get_text());
+    }
+  on_delete_event(NULL);
+}

Added: glemon/trunk/eps_win.h
==============================================================================
--- (empty file)
+++ glemon/trunk/eps_win.h	Tue Feb 27 18:23:55 2007
@@ -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 <all_include.h>
+#include <nbtab.h>
+#include <mapselector.h>
+#include <libgnomecanvasmm.h>
+#include <libgnomecanvasmm/polygon.h>
+
+///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<Gtk::CheckButton *> 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



More information about the Lemon-commits mailing list