[Lemon-commits] ladanyi: r3128 - glemon/branches/akos

Lemon SVN svn at lemon.cs.elte.hu
Wed Jan 10 16:01:53 CET 2007


Author: ladanyi
Date: Wed Jan 10 16:01:48 2007
New Revision: 3128

Added:
   glemon/branches/akos/map_value.cc
   glemon/branches/akos/map_value.h
   glemon/branches/akos/save_details_dialog.cc
   glemon/branches/akos/save_details_dialog.h
   glemon/branches/akos/save_details_widget.cc
   glemon/branches/akos/save_details_widget.h
Modified:
   glemon/branches/akos/Makefile.am
   glemon/branches/akos/file_chooser_extra_widget.cc
   glemon/branches/akos/file_chooser_extra_widget.h
   glemon/branches/akos/graph-displayer.cc
   glemon/branches/akos/main_win.cc
   glemon/branches/akos/main_win.h
   glemon/branches/akos/mapstorage.cc
   glemon/branches/akos/mapstorage.h

Log:
Committing accumulated changes. Still not finished. Added a dialog to set where
the gui section should be saved (.lgf or .conf file) and where each map should
be saved (nodeset/edgeset section or gui section). Added a new class (MapValue)
which can store int, double and string values. This is for supporting map
teypes other than double.


Modified: glemon/branches/akos/Makefile.am
==============================================================================
--- glemon/branches/akos/Makefile.am	(original)
+++ glemon/branches/akos/Makefile.am	Wed Jan 10 16:01:48 2007
@@ -50,7 +50,13 @@
 	file_chooser_extra_widget.h \
 	file_chooser_extra_widget.cc \
 	file_import_window.h \
-	file_import_window.cc
+	file_import_window.cc \
+	map_value.h \
+	map_value.cc \
+	save_details_widget.h \
+	save_details_widget.cc \
+	save_details_dialog.h \
+	save_details_dialog.cc
 
 glemon_CXXFLAGS = $(GTK_CFLAGS) $(LEMON_CFLAGS)
 # glemon_LDFLAGS = $(GTK_LIBS) $(LEMON_LIBS)

Modified: glemon/branches/akos/file_chooser_extra_widget.cc
==============================================================================
--- glemon/branches/akos/file_chooser_extra_widget.cc	(original)
+++ glemon/branches/akos/file_chooser_extra_widget.cc	Wed Jan 10 16:01:48 2007
@@ -20,44 +20,16 @@
 #include "mapstorage.h"
 
 FileChooserExtraWidget::FileChooserExtraWidget(MapStorage* ms) :
-  Gtk::Expander("_Options", true),
-  lblGUIData("Save GUI specific data to:"),
-  rbGUISection("_GUI section", true),
-  rbConfFile("s_eparate .conf file", true)
+  Gtk::Expander("_Details", true),
+  SaveDetails(ms)
 {
   std::cout << "FileChooserExtraWidget()" << std::endl;
 
-  Gtk::RadioButtonGroup group = rbGUISection.get_group();
-  rbConfFile.set_group(group);
-
-  /*
-  switch (pMapStorage->getGUIDataSaveLocation())
-  {
-    case GUI_SECTION:
-      break;
-    case CONF_FILE:
-      break;
-  }
-  */
-
-  add(box);
-  box.pack_start(lblGUIData, Gtk::PACK_SHRINK);
-  box.pack_start(rbGUISection, Gtk::PACK_SHRINK);
-  box.pack_start(rbConfFile, Gtk::PACK_SHRINK);
-
-  rbConfFile.signal_group_changed().connect(
-      sigc::mem_fun(*this, &FileChooserExtraWidget::onRbToggled));
-  rbGUISection.signal_group_changed().connect(
-      sigc::mem_fun(*this, &FileChooserExtraWidget::onRbToggled));
+  add(SaveDetails);
 
   show_all_children();
 }
 
-void FileChooserExtraWidget::onRbToggled()
-{
-  std::cout << "onRbToggled()" << std::endl;
-}
-
 FileChooserExtraWidget::~FileChooserExtraWidget()
 {
   std::cout << "~FileChooserExtraWidget()" << std::endl;

Modified: glemon/branches/akos/file_chooser_extra_widget.h
==============================================================================
--- glemon/branches/akos/file_chooser_extra_widget.h	(original)
+++ glemon/branches/akos/file_chooser_extra_widget.h	Wed Jan 10 16:01:48 2007
@@ -19,22 +19,16 @@
 #ifndef FILE_CHOOSER_EXTRA_WIDGET
 #define FILE_CHOOSER_EXTRA_WIDGET
 
+#include "save_details_widget.h"
 #include <gtkmm/expander.h>
-#include <gtkmm/box.h>
-#include <gtkmm/radiobutton.h>
-#include <gtkmm/label.h>
 
 class MapStorage;
 
 class FileChooserExtraWidget : public Gtk::Expander
 {
   private:
-    Gtk::VBox box;
-    Gtk::Label lblGUIData;
-    Gtk::RadioButton rbGUISection;
-    Gtk::RadioButton rbConfFile;
+    SaveDetailsWidget SaveDetails;
     MapStorage* pMapStorage;
-    void onRbToggled();
   public:
     FileChooserExtraWidget(MapStorage* ms);
     ~FileChooserExtraWidget();

Modified: glemon/branches/akos/graph-displayer.cc
==============================================================================
--- glemon/branches/akos/graph-displayer.cc	(original)
+++ glemon/branches/akos/graph-displayer.cc	Wed Jan 10 16:01:48 2007
@@ -96,15 +96,15 @@
 //       mytab.readFile(argv[1]);
 //     }
   if(argc>=2)
+  {
+    for(int i=1;i<argc;i++)
     {
-      for(int i=1;i<argc;i++)
-	{
-	  if(Glib::file_test(argv[i], Glib::FILE_TEST_IS_REGULAR))
-	    {
-	      mytab.readFile(argv[i]);
-	    }
-	}
+      if(Glib::file_test(argv[i], Glib::FILE_TEST_IS_REGULAR))
+      {
+        mytab.readFile(argv[i]);
+      }
     }
+  }
   else
     {
       mytab.newTab();

Modified: glemon/branches/akos/main_win.cc
==============================================================================
--- glemon/branches/akos/main_win.cc	(original)
+++ glemon/branches/akos/main_win.cc	Wed Jan 10 16:01:48 2007
@@ -22,6 +22,7 @@
 
 #include "main_win.h"
 #include "guipixbufs.h"
+#include "save_details_dialog.h"
 
 #include "i18n.h"
 
@@ -99,6 +100,8 @@
       sigc::mem_fun(*this, &MainWin::saveFile));
   ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS),
       sigc::mem_fun(*this, &MainWin::saveFileAs));
+  ag->add( Gtk::Action::create("SaveDetails", _("Save _Details...")),
+	   sigc::mem_fun(*this, &MainWin::createSaveDetailsDialog));
   ag->add( Gtk::Action::create("Close", Gtk::Stock::CLOSE),
       sigc::mem_fun(*this, &MainWin::closeTab));
   ag->add( Gtk::Action::create("Quit", Gtk::Stock::QUIT),
@@ -167,6 +170,7 @@
       "      <menuitem action='FileClearTab'/>"
       "      <menuitem action='FileSave'/>"
       "      <menuitem action='FileSaveAs'/>"
+      "      <menuitem action='SaveDetails'/>"
       "      <menuitem action='Close'/>"
       "      <menuitem action='Quit'/>"
       "    </menu>"
@@ -591,3 +595,9 @@
 {
   tabs[active_tab]->reDesignGraph();
 }
+
+void MainWin::createSaveDetailsDialog()
+{
+  SaveDetailsDialog dialog(&(tabs[active_tab]->mapstorage));
+  dialog.run();
+}

Modified: glemon/branches/akos/main_win.h
==============================================================================
--- glemon/branches/akos/main_win.h	(original)
+++ glemon/branches/akos/main_win.h	Wed Jan 10 16:01:48 2007
@@ -263,6 +263,9 @@
   virtual void nodeViewChanged();
 
   virtual void reDesignGraph();
+
+  /// Pops up a SaveDetailsDialog.
+  void createSaveDetailsDialog();
 };
 
 #endif //MAIN_WIN_H

Added: glemon/branches/akos/map_value.cc
==============================================================================
--- (empty file)
+++ glemon/branches/akos/map_value.cc	Wed Jan 10 16:01:48 2007
@@ -0,0 +1,74 @@
+#include "map_value.h"
+#include <sstream>
+
+MapValue::MapValue(int i)
+{
+  value = i;
+  type = INTEGER;
+}
+
+MapValue::MapValue(double d)
+{
+  value = d;
+  type = SCALAR;
+}
+
+MapValue::MapValue(std::string str)
+{
+  value = str;
+  type = STRING;
+}
+
+MapValue::operator int()
+{
+  switch (type)
+  {
+    case INTEGER:
+      return boost::any_cast<int>(value);
+    case SCALAR:
+      return (int) boost::any_cast<double>(value);
+    case STRING:
+      throw BadMapValueCast();
+  }
+}
+
+MapValue::operator double()
+{
+  switch (type)
+  {
+    case INTEGER:
+      return (double) boost::any_cast<int>(value);
+    case SCALAR:
+      return boost::any_cast<double>(value);
+    case STRING:
+      throw BadMapValueCast();
+  }
+}
+
+MapValue::operator std::string()
+{
+  std::string ret;
+  switch (type)
+  {
+    case INTEGER:
+      {
+        int i = boost::any_cast<int>(value);
+        std::ostringstream ostr;
+        ostr << i;
+        ret = ostr.str();
+      }
+      break;
+    case SCALAR:
+      {
+        double d = boost::any_cast<double>(value);
+        std::ostringstream ostr;
+        ostr << d;
+        ret = ostr.str();
+      }
+      break;
+    case STRING:
+      ret = boost::any_cast<std::string>(value);
+      break;
+  }
+  return ret;
+}

Added: glemon/branches/akos/map_value.h
==============================================================================
--- (empty file)
+++ glemon/branches/akos/map_value.h	Wed Jan 10 16:01:48 2007
@@ -0,0 +1,25 @@
+#include <boost/any.hpp>
+#include <exception>
+
+class MapValue
+{
+  public:
+    class BadMapValueCast : public std::exception
+    {
+      virtual const char* what() const throw()
+      {
+        return "Bad MapValue cast.";
+      }
+    };
+    typedef enum { INTEGER, SCALAR, STRING } Type;
+  private:
+    boost::any value;
+    MapValue::Type type;
+  public:
+    MapValue(int);
+    MapValue(double);
+    MapValue(std::string);
+    operator std::string();
+    operator int();
+    operator double();
+};

Modified: glemon/branches/akos/mapstorage.cc
==============================================================================
--- glemon/branches/akos/mapstorage.cc	(original)
+++ glemon/branches/akos/mapstorage.cc	Wed Jan 10 16:01:48 2007
@@ -26,6 +26,7 @@
 #include <fstream>
 #include <string>
 #include <gtkmm.h>
+#include <lemon/time_measure.h>
 
 const int i_d=20;
 const double a_d=0.05;
@@ -43,23 +44,25 @@
   //coords.setXMap(*nodemap_storage["coordinates_x"]);
   //nodemap_storage["coordinates_y"] = new Graph::NodeMap<double>(graph);
   //coords.setYMap(*nodemap_storage["coordinates_y"]);
-  /*
-  coords.setXMap(node_x_coord);
-  coords.setYMap(node_y_coord);
-  */
 
   //edgemap_storage["arrow_pos_x"] = new Graph::EdgeMap<double>(graph);
   //arrow_pos.setXMap(*edgemap_storage["arrow_pos_x"]);
   //edgemap_storage["arrow_pos_y"] = new Graph::EdgeMap<double>(graph);
   //arrow_pos.setYMap(*edgemap_storage["arrow_pos_y"]);
-  arrow_pos.setXMap(arrow_x_coord);
-  arrow_pos.setYMap(arrow_y_coord);
+  
+  node_coords.setXMap(node_x_coord);
+  node_coords.setYMap(node_y_coord);
 
+  arrow_coords.setXMap(arrow_x_coord);
+  arrow_coords.setYMap(arrow_y_coord);
+
+  /*
   nodemap_storage["label"] = new Graph::NodeMap<double>(graph);
   edgemap_storage["label"] = new Graph::EdgeMap<double>(graph);
 
   nodemap_default["label"] = 1.0;
   edgemap_default["label"] = 1.0;
+  */
 
   active_nodemaps.resize(NODE_PROPERTY_NUM);
   for(int i=0;i<NODE_PROPERTY_NUM;i++)
@@ -259,10 +262,18 @@
 
 int MapStorage::readFromFile(const std::string &filename)
 {
+  std::cout << "MapStorage::readFromFile()" << std::endl;
+  lemon::Timer timer;
+
   // check whether the .conf file exists
-  bool conf_exists = g_file_test((filename + ".conf").c_str(),
+  bool conf_file_exists = g_file_test((filename + ".conf").c_str(),
       (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR));
 
+  if (conf_file_exists)
+    std::cout << ".conf: exists" << std::endl;
+  else
+    std::cout << ".conf: not found" << std::endl;
+
   // check whether the file contains a gui section
   bool gui_section_exists = false;
   {
@@ -287,9 +298,14 @@
     }
   }
 
+  if (gui_section_exists)
+    std::cout << "gui section: exists" << std::endl;
+  else
+    std::cout << "gui section: not found" << std::endl;
+
   // ask for user input if both exist
-  bool use_gui_section;
-  if (conf_exists && gui_section_exists)
+  bool prefer_gui_section = false;
+  if (conf_file_exists && gui_section_exists)
   {
     Gtk::MessageDialog mdialog(_("<b>Found both ") + filename +
         _(".conf and a gui section in ") + filename + _(".</b>"), true,
@@ -299,19 +315,20 @@
     switch (mdialog.run())
     {
       case 1:
-        use_gui_section = false;
+        prefer_gui_section = false;
         break;
       case 2:
-        use_gui_section = true;
+        prefer_gui_section = true;
         break;
       case Gtk::RESPONSE_NONE:
         return 1;
     }
   }
+
+  if (prefer_gui_section)
+    std::cout << "prefer gui section: yes" << std::endl;
   else
-  {
-    use_gui_section = gui_section_exists;
-  }
+    std::cout << "prefer gui section: no" << std::endl;
 
   bool read_x = false;
   bool read_y = false;
@@ -385,8 +402,23 @@
         greader.readEdgeMap(*it, *edgemap_storage[*it]);
       }
     }
-    GuiReader gui_reader(greader, this);
+    if ((gui_section_exists && !conf_file_exists) ||
+        (gui_section_exists && conf_file_exists && prefer_gui_section))
+    {
+      std::cout << "reading gui section" << std::endl;
+      GuiReader gui_reader(greader, this);
+    }
     greader.run();
+
+    if ((!gui_section_exists && conf_file_exists) ||
+        (gui_section_exists && conf_file_exists && !prefer_gui_section))
+    {
+      std::cout << "reading .conf file" << std::endl;
+      LemonReader lreader(filename + ".conf");
+      GuiReader gui_reader(lreader, this);
+      lreader.run();
+    }
+
   } catch (Exception& error) {
     Gtk::MessageDialog mdialog(error.what());
     mdialog.run();
@@ -401,6 +433,31 @@
     {
       edge_label[e] = i++;
     }
+    max_edge_label = i--;
+  }
+  else
+  {
+    EdgeIt e(graph);
+    double max_edge_label = edge_label[e];
+    for (++e; e != INVALID; ++e)
+    {
+      if (edge_label[e] > max_edge_label)
+      {
+        max_edge_label = edge_label[e];
+      }
+    }
+  }
+
+  {
+    NodeIt n(graph);
+    double max_node_label = node_label[n];
+    for (++n; n != INVALID; ++n)
+    {
+      if (node_label[n] > max_node_label)
+      {
+        max_node_label = node_label[n];
+      }
+    }
   }
 
   if (!read_x || !read_y)
@@ -482,6 +539,9 @@
     }
   }
 
+  std::cout << "Reading finished" << std::endl;
+  std::cout << "Time elapsed: " << timer << std::endl;
+
   return 0;
 }
 
@@ -628,22 +688,22 @@
 
 XY MapStorage::getNodeCoords(Node n) const
 {
-  return coords[n];
+  return node_coords[n];
 }
 
 void MapStorage::setNodeCoords(Node n, XY c)
 {
-  coords.set(n, c);
+  node_coords.set(n, c);
 }
 
 XY MapStorage::getArrowCoords(Edge e) const
 {
-  return arrow_pos[e];
+  return arrow_coords[e];
 }
 
 void MapStorage::setArrowCoords(Edge e, XY c)
 {
-  arrow_pos.set(e, c);
+  arrow_coords.set(e, c);
 }
 
 double MapStorage::get(const std::string& map, Node n) const

Modified: glemon/branches/akos/mapstorage.h
==============================================================================
--- glemon/branches/akos/mapstorage.h	(original)
+++ glemon/branches/akos/mapstorage.h	Wed Jan 10 16:01:48 2007
@@ -38,13 +38,36 @@
 ///\todo too many things are public!!
 class MapStorage
 {
-private:
-  /// the coordinates of the nodes
-  XYMap<Graph::NodeMap<double> > coords;
-
-  /// the coordinates of the arrows on the edges
-  XYMap<Graph::EdgeMap<double> > arrow_pos;
+  /*
+public:
+  template <typename M>
+  struct MapData
+  {
+    /// element type (INTEGER, SCALAR, STRING)
+    /// the default value of the map
+    typename M::Value default_value;
+    /// save the map to the nodeset or edgeset section
+    bool save_to_gui_sect;
+    /// save the map to the nodeset or edgeset section
+    bool save_to_main_part;
+    /// read-only or read-write
+    bool writeable;
+    /// the map
+    M map;
+    MapBase(Graph &g) :
+      map(g) {}
+  };
+  struct DoubleEdgeMapData : public MapBase<Graph::EdgeMap<double> >
+  {
+    DoubleEdgeMap(Graph& g) :
+      MapData<Graph::EdgeMap<double> >(g)
+  };
+  */
+public:
+  ///The graph for which the datas are stored.
+  Graph graph;
 
+private:
   Graph::NodeMap<double> node_x_coord;
   Graph::NodeMap<double> node_y_coord;
 
@@ -55,6 +78,12 @@
 
   Graph::EdgeMap<double> edge_label;
 
+  /// the coordinates of the nodes
+  XYMap<Graph::NodeMap<double> > node_coords;
+
+  /// the coordinates of the arrows on the edges
+  XYMap<Graph::EdgeMap<double> > arrow_coords;
+
   ///Stores double type EdgeMaps
   std::map< std::string,Graph::EdgeMap<double> * > edgemap_storage;
 
@@ -69,12 +98,10 @@
 
   // the largest node label
   double max_node_label;
+
   // the largest edge label
   double max_edge_label;
 public:
-  ///The graph for which the datas are stored.
-  Graph graph;
-
   ///Stores the default values for the different visualization node attributes
   std::vector<Graph::NodeMap<double> > default_nodemaps;
 

Added: glemon/branches/akos/save_details_dialog.cc
==============================================================================
--- (empty file)
+++ glemon/branches/akos/save_details_dialog.cc	Wed Jan 10 16:01:48 2007
@@ -0,0 +1,14 @@
+#include "save_details_dialog.h"
+#include <gtkmm/stock.h>
+
+SaveDetailsDialog::SaveDetailsDialog(MapStorage *ms) :
+  Gtk::Dialog("Save Details", true),
+  SaveDetails(ms)
+{
+  Gtk::VBox* pVBox = get_vbox();
+  pVBox->pack_start(SaveDetails, Gtk::PACK_SHRINK);
+
+  add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
+
+  show_all_children();
+}

Added: glemon/branches/akos/save_details_dialog.h
==============================================================================
--- (empty file)
+++ glemon/branches/akos/save_details_dialog.h	Wed Jan 10 16:01:48 2007
@@ -0,0 +1,15 @@
+#ifndef SAVE_DETAILS_DIALOG
+#define SAVE_DETAILS_DIALOG
+
+#include <gtkmm/dialog.h>
+#include "save_details_widget.h"
+
+class SaveDetailsDialog : public Gtk::Dialog
+{
+  private:
+    SaveDetailsWidget SaveDetails;
+  public:
+    SaveDetailsDialog(MapStorage*);
+};
+
+#endif

Added: glemon/branches/akos/save_details_widget.cc
==============================================================================
--- (empty file)
+++ glemon/branches/akos/save_details_widget.cc	Wed Jan 10 16:01:48 2007
@@ -0,0 +1,136 @@
+#include "save_details_widget.h"
+#include "mapstorage.h"
+
+SaveDetailsWidget::SaveDetailsWidget(MapStorage* ms) :
+  pMapStorage(ms),
+  lblGuiSectionSave("<b>Save GUI section to</b>", 0.0, 0.5),
+  lblMapsSave("<b>Save maps to</b>", 0.0, 0.5),
+  rbLgfFile(".lgf file", true),
+  rbConfFile("separate .conf file", true)
+{
+  std::cout << "SaveDetailsWidget::SaveDetailsWidget()" << std::endl;
+
+  Gtk::RadioButtonGroup group = rbLgfFile.get_group();
+  rbConfFile.set_group(group);
+
+  lblGuiSectionSave.set_use_markup();
+  lblMapsSave.set_use_markup();
+
+  nbMaps.set_tab_pos(Gtk::POS_BOTTOM);
+
+  /*
+  switch (pMapStorage->getGUIDataSaveLocation())
+  {
+    case GUI_SECTION:
+      break;
+    case CONF_FILE:
+      break;
+  }
+  */
+
+  pack_start(lblGuiSectionSave, Gtk::PACK_SHRINK);
+  pack_start(box, Gtk::PACK_SHRINK);
+
+  box.pack_start(rbLgfFile, Gtk::PACK_SHRINK);
+  box.pack_start(rbConfFile, Gtk::PACK_SHRINK);
+
+  rbLgfFile.signal_group_changed().connect(
+      sigc::mem_fun(*this, &SaveDetailsWidget::onRbToggled));
+  rbConfFile.signal_group_changed().connect(
+      sigc::mem_fun(*this, &SaveDetailsWidget::onRbToggled));
+
+  pack_start(lblMapsSave, Gtk::PACK_SHRINK);
+  pack_start(nbMaps, Gtk::PACK_EXPAND_WIDGET);
+
+  nbMaps.append_page(swNodeMaps, "NodeMaps");
+  nbMaps.append_page(swEdgeMaps, "EdgeMaps");
+
+  swNodeMaps.add(twNodeMaps);
+  swEdgeMaps.add(twEdgeMaps);
+
+  refNodeMapStore = Gtk::ListStore::create(NodeMapColumns);
+  //refMapStore->signal_row_changed().connect(sigc::mem_fun(*this, &Phy sicalProperties::onChannelChanged));
+
+  std::vector<std::string> node_maps = pMapStorage->getNodeMapList();
+  for (std::vector<std::string>::const_iterator it = node_maps.begin();
+      it != node_maps.end(); ++it)
+  {
+    Gtk::TreeModel::Row row = *(refNodeMapStore->append());
+    row[NodeMapColumns.colName] = *it;
+    row[NodeMapColumns.colSaveToMainSect] = true;
+    row[NodeMapColumns.colSaveToGuiSect] = false;
+  }
+
+  twNodeMaps.set_model(refNodeMapStore);
+  twNodeMaps.append_column("Name", NodeMapColumns.colName);
+  twNodeMaps.append_column_editable("Nodeset section",
+      NodeMapColumns.colSaveToMainSect);
+  twNodeMaps.append_column_editable("GUI section",
+      NodeMapColumns.colSaveToGuiSect);
+  /*
+  {
+    Gtk::TreeView::Column* pViewColumn =
+      Gtk::manage(
+        new Gtk::TreeView::Column("Value type", NodeMapColumns.colValue));
+    twMap.append_column(*pViewColumn);
+  }
+  {
+    Gtk::TreeView::Column* pViewColumn =
+      Gtk::manage(
+        new Gtk::TreeView::Column("Map type", NodeMapColumns.colType));
+    twMap.append_column(*pViewColumn);
+  }
+  */
+
+  swNodeMaps.set_size_request(250, 200);
+  swNodeMaps.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+
+  refEdgeMapStore = Gtk::ListStore::create(EdgeMapColumns);
+  //refMapStore->signal_row_changed().connect(sigc::mem_fun(*this, &Phy sicalProperties::onChannelChanged));
+
+  std::vector<std::string> edge_maps = pMapStorage->getEdgeMapList();
+  for (std::vector<std::string>::const_iterator it = edge_maps.begin();
+      it != edge_maps.end(); ++it)
+  {
+    Gtk::TreeModel::Row row = *(refEdgeMapStore->append());
+    row[EdgeMapColumns.colName] = *it;
+    row[EdgeMapColumns.colSaveToMainSect] = true;
+    row[EdgeMapColumns.colSaveToGuiSect] = false;
+  }
+
+  twEdgeMaps.set_model(refEdgeMapStore);
+  twEdgeMaps.append_column("Name", EdgeMapColumns.colName);
+  twEdgeMaps.append_column_editable("Edgeset section",
+      EdgeMapColumns.colSaveToMainSect);
+  twEdgeMaps.append_column_editable("GUI section",
+      EdgeMapColumns.colSaveToGuiSect);
+  /*
+  {
+    Gtk::TreeView::Column* pViewColumn =
+      Gtk::manage(
+        new Gtk::TreeView::Column("Value type", EdgeMapColumns.colValue));
+    twMap.append_column(*pViewColumn);
+  }
+  {
+    Gtk::TreeView::Column* pViewColumn =
+      Gtk::manage(
+        new Gtk::TreeView::Column("Map type", EdgeMapColumns.colType));
+    twMap.append_column(*pViewColumn);
+  }
+  */
+
+  swEdgeMaps.set_size_request(250, 200);
+  swEdgeMaps.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+
+  show_all_children();
+}
+
+void SaveDetailsWidget::onRbToggled()
+{
+  std::cout << "SaveDetailsWidget::onRbToggled()" << std::endl;
+}
+
+SaveDetailsWidget::~SaveDetailsWidget()
+{
+  std::cout << "SaveDetailsWidget::~SaveDetailsWidget()" << std::endl;
+}

Added: glemon/branches/akos/save_details_widget.h
==============================================================================
--- (empty file)
+++ glemon/branches/akos/save_details_widget.h	Wed Jan 10 16:01:48 2007
@@ -0,0 +1,52 @@
+#ifndef SAVE_DETAILS_WIDGET
+#define SAVE_DETAILS_WIDGET
+
+#include <gtkmm/box.h>
+#include <gtkmm/radiobutton.h>
+#include <gtkmm/label.h>
+#include <gtkmm/notebook.h>
+#include <gtkmm/treemodel.h>
+#include <gtkmm/liststore.h>
+#include <gtkmm/treeview.h>
+#include <gtkmm/scrolledwindow.h>
+
+class MapStorage;
+
+class SaveDetailsWidget : public Gtk::VBox
+{
+  public:
+    struct MapModelColumns : public Gtk::TreeModel::ColumnRecord
+    {
+      MapModelColumns()
+      {
+        add(colName);
+        add(colSaveToMainSect);
+        add(colSaveToGuiSect);
+      }
+      Gtk::TreeModelColumn<Glib::ustring> colName;
+      Gtk::TreeModelColumn<bool> colSaveToMainSect;
+      Gtk::TreeModelColumn<bool> colSaveToGuiSect;
+    };
+  private:
+    Gtk::Label lblGuiSectionSave;
+    Gtk::Label lblMapsSave;
+    Gtk::RadioButton rbLgfFile;
+    Gtk::RadioButton rbConfFile;
+    Gtk::Notebook nbMaps;
+    Gtk::VBox box;
+    Gtk::ScrolledWindow swNodeMaps;
+    Gtk::ScrolledWindow swEdgeMaps;
+    Gtk::TreeView twNodeMaps;
+    Gtk::TreeView twEdgeMaps;
+    MapModelColumns NodeMapColumns;
+    MapModelColumns EdgeMapColumns;
+    Glib::RefPtr<Gtk::ListStore> refNodeMapStore;
+    Glib::RefPtr<Gtk::ListStore> refEdgeMapStore;
+    MapStorage* pMapStorage;
+    void onRbToggled();
+  public:
+    SaveDetailsWidget(MapStorage* ms);
+    ~SaveDetailsWidget();
+};
+
+#endif



More information about the Lemon-commits mailing list