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

Lemon SVN svn at lemon.cs.elte.hu
Sat Nov 3 23:00:06 CET 2007


Author: ladanyi
Date: Sat Nov  3 23:00:04 2007
New Revision: 3356

Modified:
   glemon/branches/akos/algobox.cc
   glemon/branches/akos/graph_displayer_canvas-event.cc
   glemon/branches/akos/map_win.cc
   glemon/branches/akos/map_win.h
   glemon/branches/akos/mapselector.cc
   glemon/branches/akos/mapselector.h
   glemon/branches/akos/mapstorage.cc
   glemon/branches/akos/nbtab.cc
   glemon/branches/akos/new_map_win.cc

Log:
MapSelector bugfix.

Modified: glemon/branches/akos/algobox.cc
==============================================================================
--- glemon/branches/akos/algobox.cc	(original)
+++ glemon/branches/akos/algobox.cc	Sat Nov  3 23:00:04 2007
@@ -80,19 +80,27 @@
 void AlgoBox::update_maplist(MapStorage * ms)
 {
   mapstorage=ms;
+  std::vector<std::string> n_nml;
+  std::vector<std::string> s_nml;
+  std::vector<std::string> n_eml;
+  std::vector<std::string> s_eml;
   if(mapstorage!=NULL)
     {
       mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::nodemaplist_changed));
       mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::edgemaplist_changed));
+      n_nml=mapstorage->getNodeMapList(NUM);
+      s_nml=mapstorage->getNodeMapList(STR);
+      n_eml=mapstorage->getEdgeMapList(NUM);
+      s_eml=mapstorage->getEdgeMapList(STR);
     }
   for(int i=0;i<(int)nodemapcbts.size();i++)
     {
-      (nodemapcbts[i])->update_list(ms);
+      (nodemapcbts[i])->update_list(n_nml, s_nml);
       //update_cbt(nml, *(nodemapcbts[i]));
     }
   for(int i=0;i<(int)edgemapcbts.size();i++)
     {
-      (edgemapcbts[i])->update_list(ms);
+      (edgemapcbts[i])->update_list(n_eml, s_eml);
       //update_cbt(eml, *(edgemapcbts[i]));
     }
   signal_maplist_updated.emit();
@@ -156,7 +164,9 @@
 
 void AlgoBox::addMapSelector(std::string inputname, bool itisedge, MapType type)
 {
-  MapSelector * msp=new MapSelector(inputname,itisedge, false, type);
+  std::vector<std::string> empty_vector;
+
+  MapSelector * msp=new MapSelector(empty_vector,empty_vector,"",inputname,itisedge, false, type);
 
   if(itisedge)
     {

Modified: glemon/branches/akos/graph_displayer_canvas-event.cc
==============================================================================
--- glemon/branches/akos/graph_displayer_canvas-event.cc	(original)
+++ glemon/branches/akos/graph_displayer_canvas-event.cc	Sat Nov  3 23:00:04 2007
@@ -692,7 +692,7 @@
                   case Gtk::RESPONSE_CANCEL:
                     break;
                   case Gtk::RESPONSE_ACCEPT:
-                    switch (mytab.mapstorage.getNodeMapElementType(edgemap_to_edit))
+                    switch (mytab.mapstorage.getEdgeMapElementType(edgemap_to_edit))
                     {
                       case MapValue::NUMERIC:
                         mytab.mapstorage.set(edgemap_to_edit, active_edge,

Modified: glemon/branches/akos/map_win.cc
==============================================================================
--- glemon/branches/akos/map_win.cc	(original)
+++ glemon/branches/akos/map_win.cc	Sat Nov  3 23:00:04 2007
@@ -29,7 +29,12 @@
   return true;
 }
 
-MapWin::MapWin(const std::string& title, NoteBookTab & mw):mytab(mw)
+MapWin::MapWin(const std::string& title,
+    std::vector<std::string> n_eml,
+    std::vector<std::string> s_eml,
+    std::vector<std::string> n_nml,
+    std::vector<std::string> s_nml,
+    NoteBookTab & mw):mytab(mw)
 {
   set_title(title);
   set_default_size(200, 50);
@@ -49,16 +54,19 @@
     switch (i)
     {
       case E_WIDTH:
-        e_combo_array[i]=new MapSelector(edge_property_strings[i], true,
-            mytab.getActiveEdgeMap(i), true, NUM);
+        e_combo_array[i]=new MapSelector(n_eml, s_eml,
+            mytab.getActiveEdgeMap(i), edge_property_strings[i],
+            true, true, NUM);
         break;
       case E_COLOR:
-        e_combo_array[i]=new MapSelector(edge_property_strings[i], true,
-            mytab.getActiveEdgeMap(i), true, NUM);
+        e_combo_array[i]=new MapSelector(n_eml, s_eml,
+            mytab.getActiveEdgeMap(i), edge_property_strings[i],
+            true, true, NUM);
         break;
       case E_TEXT:
-        e_combo_array[i]=new MapSelector(edge_property_strings[i], true,
-            mytab.getActiveEdgeMap(i), true, ALL);
+        e_combo_array[i]=new MapSelector(n_eml, s_eml,
+            mytab.getActiveEdgeMap(i), edge_property_strings[i],
+            true, true, ALL);
         break;
     }
 
@@ -83,16 +91,19 @@
     switch (i)
     {
       case N_RADIUS:
-        n_combo_array[i]=new MapSelector(node_property_strings[i], false,
-            mytab.getActiveNodeMap(i), true, NUM);
+        n_combo_array[i]=new MapSelector(n_nml, s_nml,
+            mytab.getActiveNodeMap(i), node_property_strings[i],
+            false, true, NUM);
         break;
       case N_COLOR:
-        n_combo_array[i]=new MapSelector(node_property_strings[i], false,
-            mytab.getActiveNodeMap(i), true, NUM);
+        n_combo_array[i]=new MapSelector(n_nml, s_nml,
+            mytab.getActiveNodeMap(i), node_property_strings[i],
+            false, true, NUM);
         break;
       case N_TEXT:
-        n_combo_array[i]=new MapSelector(node_property_strings[i], false,
-            mytab.getActiveNodeMap(i), true, ALL);
+        n_combo_array[i]=new MapSelector(n_nml, s_nml,
+            mytab.getActiveNodeMap(i), node_property_strings[i],
+            false, true, ALL);
         break;
     }
 
@@ -108,7 +119,7 @@
 
   vbox.pack_start(*table);
 
-  update();
+  update(n_eml, s_eml, n_nml, s_nml);
 
   show_all_children();
 
@@ -129,16 +140,20 @@
   mytab.popupNewMapWin(itisedge);
 }
 
-void MapWin::update()
+void MapWin::update(
+    std::vector<std::string> n_eml,
+    std::vector<std::string> s_eml,
+    std::vector<std::string> n_nml,
+    std::vector<std::string> s_nml)
 {
   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   {
-    e_combo_array[i]->update_list(&mytab.mapstorage);
+    e_combo_array[i]->update_list(n_eml, s_eml);
   }
 
   for(int i=0;i<NODE_PROPERTY_NUM;i++)
   {
-    n_combo_array[i]->update_list(&mytab.mapstorage);
+    n_combo_array[i]->update_list(n_nml, s_nml);
   }
 
   mytab.active_maps_needed();

Modified: glemon/branches/akos/map_win.h
==============================================================================
--- glemon/branches/akos/map_win.h	(original)
+++ glemon/branches/akos/map_win.h	Sat Nov  3 23:00:04 2007
@@ -66,7 +66,12 @@
   ///binds the needed signal to the correct place.
   ///\param title title of window
   ///\param mw the owner \ref NoteBookTab (\ref mytab)
-  MapWin(const std::string& title, NoteBookTab & mw);
+  MapWin(const std::string& title, 
+      std::vector<std::string> n_eml,
+      std::vector<std::string> s_eml,
+      std::vector<std::string> n_nml,
+      std::vector<std::string> s_nml,
+      NoteBookTab & mw);
 
   ///Deregistrates \ref MapWin in its \ref NoteBookTab (\ref mytab)
   virtual bool on_delete_event(GdkEventAny *);
@@ -123,7 +128,11 @@
   ///have changed as well. \ref NoteBookTab knows, whether it
   ///has to call this function or not from the \ref NoteBookTab::mapwinexists
   ///variable.
-  void update();
+  void update(
+    std::vector<std::string> n_eml,
+    std::vector<std::string> s_eml,
+    std::vector<std::string> n_nml,
+    std::vector<std::string> s_nml);
 
   void changeEntry(bool, int, std::string);
 

Modified: glemon/branches/akos/mapselector.cc
==============================================================================
--- glemon/branches/akos/mapselector.cc	(original)
+++ glemon/branches/akos/mapselector.cc	Sat Nov  3 23:00:04 2007
@@ -18,8 +18,9 @@
 
 #include "mapselector.h"
 
-MapSelector::MapSelector(std::string labeltext, bool
-    edge, std::string act, bool d, MapType type) :
+MapSelector::MapSelector(std::vector<std::string> n_ml,
+    std::vector<std::string> s_ml, std::string act,
+    std::string labeltext, bool edge, bool d, MapType type) :
   def(d),
   itisedge(edge),
   set_new_map(false),
@@ -27,7 +28,8 @@
   map_type(type),
   newbut(Gtk::Stock::NEW)
 {
-  set_sensitive(false);
+  update_list(n_ml, s_ml);
+
   if(act=="")
   {
     cbt.set_active(0);
@@ -81,26 +83,31 @@
   signal_newmapwin.emit(itisedge);
 }
 
-void MapSelector::update_list(MapStorage* ms)
+void MapSelector::update_list(std::vector<std::string> n_ml,
+    std::vector<std::string> s_ml)
 {
-  set_sensitive();
-
   int prev_act=cbt.get_active_row_number();
   cbt.clear();
   cbt_content.clear();
 
-  std::vector<std::string> ml;
-  if (itisedge)
-    ml = ms->getEdgeMaps(map_type);
-  else
-    ml = ms->getNodeMaps(map_type);
-
-  std::vector< std::string >::iterator emsi=ml.begin();
-  for(;emsi!=ml.end();emsi++)
+  if (map_type & NUM)
+  {
+    std::vector< std::string >::iterator emsi=n_ml.begin();
+    for(;emsi!=n_ml.end();emsi++)
+    {
+      cbt.append_text(*emsi);
+      cbt_content.push_back(*emsi);
+    }
+  }
+  if (map_type & STR)
+  {
+    std::vector< std::string >::iterator emsi=s_ml.begin();
+    for(;emsi!=s_ml.end();emsi++)
     {
       cbt.append_text(*emsi);
       cbt_content.push_back(*emsi);
     }
+  }
   if(def)
     {
       cbt.prepend_text("Default values");

Modified: glemon/branches/akos/mapselector.h
==============================================================================
--- glemon/branches/akos/mapselector.h	(original)
+++ glemon/branches/akos/mapselector.h	Sat Nov  3 23:00:04 2007
@@ -110,8 +110,9 @@
   ///\param itisedge do \ref MapSelector contains edgemap names or nodemapnames.
   ///\param def do we need 'Default' option. See \ref def.
   ///\param type Specifies which types of maps to display.
-  MapSelector(std::string purpose, bool itisedge, std::string act = std::string(),
-      bool def=true, MapType type = ALL);
+  MapSelector(std::vector<std::string> n_ml,
+      std::vector<std::string> s_ml, std::string act, std::string labeltext,
+      bool edge, bool d = true, MapType type = ALL);
 
   ///Returns signal emitted if the user has changed the selection. (\ref signal_cbt)
   sigc::signal<void, std::string> signal_cbt_ch();
@@ -124,7 +125,8 @@
   ///Fills in \ref cbt with names, taking
   ///into account that the previously selected option
   ///has to be set back after the operation.
-  void update_list(MapStorage* ms);
+  void update_list(std::vector<std::string> n_ml,
+      std::vector<std::string> s_ml);
 
   ///Handles changement in \ref cbt.
 

Modified: glemon/branches/akos/mapstorage.cc
==============================================================================
--- glemon/branches/akos/mapstorage.cc	(original)
+++ glemon/branches/akos/mapstorage.cc	Sat Nov  3 23:00:04 2007
@@ -234,10 +234,12 @@
   bool gui_data_in_conf = g_file_test((filename + ".conf").c_str(),
       (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR));
 
+  /*
   if (gui_data_in_conf)
     std::cerr << filename << ".conf file exists" << std::endl;
   else
     std::cerr << filename << ".conf file not found" << std::endl;
+  */
 
   // check whether the .lgf file contains a gui section
   bool gui_data_in_lgf = false;
@@ -263,10 +265,12 @@
     }
   }
 
+  /*
   if (gui_data_in_lgf)
     std::cerr << "found gui section in " << filename << std::endl;
   else
     std::cerr << "no gui section in " << filename << std::endl;
+  */
 
   bool gui_data_found = gui_data_in_lgf || gui_data_in_conf;
 
@@ -311,7 +315,7 @@
       // read the gui section from the .lgf file
       try
       {
-        std::cerr << "reading gui section form file " << filename << std::endl;
+        //std::cerr << "reading gui section form file " << filename << std::endl;
         LemonReader lreader(filename);
         GuiReader gui_reader(lreader, this, gui_data);
         lreader.run();
@@ -319,8 +323,7 @@
       }
       catch (Exception& error)
       {
-        std::cerr << "reading gui section from file " << filename << "failed"
-          << std::endl;
+        //std::cerr << "reading gui section from file " << filename << "failed" << std::endl;
         clear();
         return 1;
       }
@@ -330,7 +333,7 @@
       // read the gui section from the .conf file
       try
       {
-        std::cerr << "reading " << filename << ".conf file" << std::endl;
+        //std::cerr << "reading " << filename << ".conf file" << std::endl;
         LemonReader lreader(filename + ".conf");
         GuiReader gui_reader(lreader, this, gui_data);
         lreader.run();
@@ -338,7 +341,7 @@
       }
       catch (Exception& error)
       {
-        std::cerr << "reading " << filename << ".conf file failed" << std::endl;
+        //std::cerr << "reading " << filename << ".conf file failed" << std::endl;
         clear();
         return 1;
       }
@@ -347,8 +350,7 @@
     // read the graph and maps form the .lgf file
     try
     {
-      std::cerr << "reading the graph and maps form " << filename
-        << " file" << std::endl;
+      //std::cerr << "reading the graph and maps form " << filename << " file" << std::endl;
       GraphReader<Graph> greader(filename, graph);
 
       // read the label maps
@@ -785,7 +787,7 @@
   }
   */
 
-  std::cerr << "reading finished" << std::endl;
+  //std::cerr << "reading finished" << std::endl;
 
 
   // set max_node_label

Modified: glemon/branches/akos/nbtab.cc
==============================================================================
--- glemon/branches/akos/nbtab.cc	(original)
+++ glemon/branches/akos/nbtab.cc	Sat Nov  3 23:00:04 2007
@@ -42,7 +42,11 @@
   gd_canvas->drawGraph();
   if(mapwinexists)
     {
-      mapwin->update();
+      mapwin->update(
+          mapstorage.getEdgeMapList(NUM),
+          mapstorage.getEdgeMapList(STR),
+          mapstorage.getNodeMapList(NUM),
+          mapstorage.getNodeMapList(STR));
     }
   signal_title.emit(Glib::filename_display_basename(file));
 }
@@ -71,7 +75,11 @@
   mapstorage.clear();
   if(mapwinexists)
     {
-      mapwin->update();
+      mapwin->update(
+          mapstorage.getEdgeMapList(NUM),
+          mapstorage.getEdgeMapList(STR),
+          mapstorage.getNodeMapList(NUM),
+          mapstorage.getNodeMapList(STR));
     }
   signal_title.emit("unsaved file");
 }
@@ -111,7 +119,11 @@
       gd_canvas->drawGraph();
       if(mapwinexists)
 	{
-	  mapwin->update();
+          mapwin->update(
+              mapstorage.getEdgeMapList(NUM),
+              mapstorage.getEdgeMapList(STR),
+              mapstorage.getNodeMapList(NUM),
+              mapstorage.getNodeMapList(STR));
 	}
       signal_title.emit(Glib::filename_display_basename(filename));
     }
@@ -172,7 +184,11 @@
   mapstorage.clear();
   if(mapwinexists)
     {
-      mapwin->update();
+      mapwin->update(
+          mapstorage.getEdgeMapList(NUM),
+          mapstorage.getEdgeMapList(STR),
+          mapstorage.getNodeMapList(NUM),
+          mapstorage.getNodeMapList(STR));
     }
   signal_title.emit("unsaved file");
 }
@@ -222,7 +238,12 @@
 {
   if(!mapwinexists)
     {
-      mapwin=new MapWin("Map Setup - "+name, *this);
+      mapwin=new MapWin("Map Setup - "+name,
+          mapstorage.getEdgeMapList(NUM),
+          mapstorage.getEdgeMapList(STR),
+          mapstorage.getNodeMapList(NUM),
+          mapstorage.getNodeMapList(STR),
+          *this);
       mapst2mapwin=mapstorage.signal_map_win_ch().connect(sigc::mem_fun(*mapwin, &MapWin::changeEntry));
       mapwin->show();
       mapwinexists=true;

Modified: glemon/branches/akos/new_map_win.cc
==============================================================================
--- glemon/branches/akos/new_map_win.cc	(original)
+++ glemon/branches/akos/new_map_win.cc	Sat Nov  3 23:00:04 2007
@@ -214,21 +214,13 @@
       }
       else
       {
-        // TODO
-        if (edge.get_active())
-          mytab.mapstorage.createEdgeMap(map_name, MapValue::NUMERIC,
-              MapValue(0.0));
-        else
-          mytab.mapstorage.createNodeMap(map_name, MapValue::NUMERIC,
-              MapValue(0.0));
         // let't try to evaluate the string as an arithmetic expression
-        /*
         std::vector<double>* values;
         values = evaluate_expr(string2Polishform(def_val, edge.get_active()));
         if (edge.get_active())
         {
           mytab.mapstorage.createEdgeMap(map_name, MapValue::NUMERIC,
-              MapValue(d));
+              MapValue(0.0));
           std::vector<double>::const_iterator vit = values->begin();
           for (NodeIt it(mytab.mapstorage.graph); it != INVALID; ++it)
           {
@@ -239,7 +231,7 @@
         else
         {
           mytab.mapstorage.createNodeMap(map_name, MapValue::NUMERIC,
-              MapValue(d));
+              MapValue(0.0));
           std::vector<double>::const_iterator vit = values->begin();
           for (NodeIt it(mytab.mapstorage.graph); it != INVALID; ++it)
           {
@@ -248,7 +240,6 @@
           }
         }
         delete values;
-        */
       }
     }
     else if (text == "String")



More information about the Lemon-commits mailing list