[Lemon-commits] hegyi: r3205 - glemon/trunk
Lemon SVN
svn at lemon.cs.elte.hu
Wed Feb 28 19:20:30 CET 2007
Author: hegyi
Date: Wed Feb 28 19:20:28 2007
New Revision: 3205
Modified:
glemon/trunk/algobox.cc
glemon/trunk/algobox.h
glemon/trunk/algowin.cc
glemon/trunk/algowin.h
glemon/trunk/background_chooser_dialog.cc
glemon/trunk/design_win.cc
glemon/trunk/design_win.h
glemon/trunk/dijkstrabox.cc
glemon/trunk/dijkstrabox.h
glemon/trunk/eps_win.cc
glemon/trunk/eps_win.h
glemon/trunk/gdc-broken_edge.cc
glemon/trunk/graph-displayer.cc
glemon/trunk/graph_displayer_canvas-edge.cc
glemon/trunk/graph_displayer_canvas-event.cc
glemon/trunk/graph_displayer_canvas-node.cc
glemon/trunk/graph_displayer_canvas-zoom.cc
glemon/trunk/graph_displayer_canvas.cc
glemon/trunk/graph_displayer_canvas.h
glemon/trunk/gui_reader.cc
glemon/trunk/gui_reader.h
glemon/trunk/gui_writer.cc
glemon/trunk/gui_writer.h
glemon/trunk/kruskalbox.cc
glemon/trunk/kruskalbox.h
glemon/trunk/main_win.cc
glemon/trunk/main_win.h
glemon/trunk/map_win.cc
glemon/trunk/map_win.h
glemon/trunk/mapselector.cc
glemon/trunk/mapselector.h
glemon/trunk/mapstorage.cc
glemon/trunk/mapstorage.h
glemon/trunk/nbtab.cc
glemon/trunk/nbtab.h
glemon/trunk/new_map_win.cc
glemon/trunk/new_map_win.h
Log:
Header reorganising
Modified: glemon/trunk/algobox.cc
==============================================================================
--- glemon/trunk/algobox.cc (original)
+++ glemon/trunk/algobox.cc Wed Feb 28 19:20:28 2007
@@ -17,6 +17,8 @@
*/
#include <algobox.h>
+#include <mapstorage.h>
+#include <mapselector.h>
enum {N_DEMO1, N_DEMO2, NODE_INPUT_NUM}; // input IDs for nodes;
enum {E_DEMO1, EDGE_INPUT_NUM}; // input IDs for edges;
Modified: glemon/trunk/algobox.h
==============================================================================
--- glemon/trunk/algobox.h (original)
+++ glemon/trunk/algobox.h Wed Feb 28 19:20:28 2007
@@ -19,11 +19,10 @@
#ifndef ALGOBOX_H
#define ALGOBOX_H
-class AlgoBox;
+class MapStorage;
+class MapSelector;
#include <all_include.h>
-#include <mapstorage.h>
-#include <mapselector.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/trunk/algowin.cc
==============================================================================
--- glemon/trunk/algowin.cc (original)
+++ glemon/trunk/algowin.cc Wed Feb 28 19:20:28 2007
@@ -17,6 +17,7 @@
*/
#include <algowin.h>
+#include <algobox.h>
#include <kruskalbox.h>
#include <dijkstrabox.h>
Modified: glemon/trunk/algowin.h
==============================================================================
--- glemon/trunk/algowin.h (original)
+++ glemon/trunk/algowin.h Wed Feb 28 19:20:28 2007
@@ -19,14 +19,11 @@
#ifndef ALGOWIN_H
#define ALGOWIN_H
-class AlgoWin;
-
#include <all_include.h>
-//#include <mapstorage.h>
-#include <algobox.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
+class AlgoBox;
class MapStorage;
///Algorithm identifiers.
Modified: glemon/trunk/background_chooser_dialog.cc
==============================================================================
--- glemon/trunk/background_chooser_dialog.cc (original)
+++ glemon/trunk/background_chooser_dialog.cc Wed Feb 28 19:20:28 2007
@@ -1,6 +1,6 @@
-#include "background_chooser_dialog.h"
+#include <background_chooser_dialog.h>
#include <gtkmm/stock.h>
-#include "mapstorage.h"
+#include <mapstorage.h>
BackgroundChooserDialog::BackgroundChooserDialog(MapStorage* ms) :
mapstorage(ms),
Modified: glemon/trunk/design_win.cc
==============================================================================
--- glemon/trunk/design_win.cc (original)
+++ glemon/trunk/design_win.cc Wed Feb 28 19:20:28 2007
@@ -16,6 +16,7 @@
*
*/
+#include <nbtab.h>
#include <design_win.h>
bool DesignWin::closeIfEscapeIsPressed(GdkEventKey* e)
Modified: glemon/trunk/design_win.h
==============================================================================
--- glemon/trunk/design_win.h (original)
+++ glemon/trunk/design_win.h Wed Feb 28 19:20:28 2007
@@ -19,10 +19,9 @@
#ifndef DESWIN_H
#define DESWIN_H
-class DesignWin;
+class NoteBookTab;
#include <all_include.h>
-#include <nbtab.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/trunk/dijkstrabox.cc
==============================================================================
--- glemon/trunk/dijkstrabox.cc (original)
+++ glemon/trunk/dijkstrabox.cc Wed Feb 28 19:20:28 2007
@@ -16,7 +16,11 @@
*
*/
+#include <mapstorage.h>
+#include <mapselector.h>
+#include <algobox.h>
#include <dijkstrabox.h>
+
#include <lemon/dijkstra.h>
#include <lemon/suurballe.h>
#include <lemon/path.h>
Modified: glemon/trunk/dijkstrabox.h
==============================================================================
--- glemon/trunk/dijkstrabox.h (original)
+++ glemon/trunk/dijkstrabox.h Wed Feb 28 19:20:28 2007
@@ -19,10 +19,9 @@
#ifndef DIJKSTRABOX_H
#define DIJKSTRABOX_H
-class DijkstraBox;
+class AlgoBox;
#include <all_include.h>
-#include <algobox.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/trunk/eps_win.cc
==============================================================================
--- glemon/trunk/eps_win.cc (original)
+++ glemon/trunk/eps_win.cc Wed Feb 28 19:20:28 2007
@@ -16,7 +16,8 @@
*
*/
-#include "eps_win.h"
+#include <nbtab.h>
+#include <eps_win.h>
#include <set>
bool EpsWin::closeIfEscapeIsPressed(GdkEventKey* e)
Modified: glemon/trunk/eps_win.h
==============================================================================
--- glemon/trunk/eps_win.h (original)
+++ glemon/trunk/eps_win.h Wed Feb 28 19:20:28 2007
@@ -19,11 +19,9 @@
#ifndef EPS_WIN_H
#define EPS_WIN_H
-class EpsWin;
+class NoteBookTab;
#include <all_include.h>
-#include <nbtab.h>
-#include <mapselector.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/trunk/gdc-broken_edge.cc
==============================================================================
--- glemon/trunk/gdc-broken_edge.cc (original)
+++ glemon/trunk/gdc-broken_edge.cc Wed Feb 28 19:20:28 2007
@@ -16,7 +16,9 @@
*
*/
-#include "graph_displayer_canvas.h"
+#include <graph_displayer_canvas.h>
+#include <mapstorage.h>
+#include <nbtab.h>
#include <cmath>
GraphDisplayerCanvas::EdgeBase::EdgeBase(Gnome::Canvas::Group& _group, Edge _edge, GraphDisplayerCanvas& _canvas) :
@@ -33,7 +35,7 @@
void GraphDisplayerCanvas::EdgeBase::drawArrow(XY unit_vector_in_dir)
{
- MapStorage& ms = canvas.mytab.mapstorage;
+ MapStorage& ms = *canvas.mytab.mapstorage;
XY center(ms.arrow_pos[edge]);
XY unit_norm_vector(0-unit_vector_in_dir.y, unit_vector_in_dir.x);
@@ -84,7 +86,7 @@
void GraphDisplayerCanvas::BrokenEdge::draw()
{
- MapStorage& ms = canvas.mytab.mapstorage;
+ MapStorage& ms = *canvas.mytab.mapstorage;
//calculating coordinates of the direction indicator arrow
XY head(ms.coords[ms.graph.target(edge)]);
@@ -150,10 +152,10 @@
Gnome::Canvas::Points points_new;
- canvas.mytab.mapstorage.arrow_pos.set(edge, canvas.mytab.mapstorage.arrow_pos[edge] + XY(dx, dy));
+ canvas.mytab.mapstorage->arrow_pos.set(edge, canvas.mytab.mapstorage->arrow_pos[edge] + XY(dx, dy));
draw();
- canvas.textReposition(canvas.mytab.mapstorage.arrow_pos[edge]);
+ canvas.textReposition(canvas.mytab.mapstorage->arrow_pos[edge]);
clicked_x=e->motion.x;
clicked_y=e->motion.y;
@@ -194,7 +196,7 @@
void GraphDisplayerCanvas::LoopEdge::draw()
{
- MapStorage& ms = canvas.mytab.mapstorage;
+ MapStorage& ms = *canvas.mytab.mapstorage;
Node node = ms.graph.source(edge);
XY center = (ms.coords[node] + ms.arrow_pos[edge]) / 2.0;
@@ -247,10 +249,10 @@
case GDK_MOTION_NOTIFY:
if(isbutton)
{
- canvas.mytab.mapstorage.arrow_pos.set(edge, XY(e->motion.x, e->motion.y));
+ canvas.mytab.mapstorage->arrow_pos.set(edge, XY(e->motion.x, e->motion.y));
draw();
- canvas.textReposition(canvas.mytab.mapstorage.arrow_pos[edge]);
+ canvas.textReposition(canvas.mytab.mapstorage->arrow_pos[edge]);
}
default: break;
}
Modified: glemon/trunk/graph-displayer.cc
==============================================================================
--- glemon/trunk/graph-displayer.cc (original)
+++ glemon/trunk/graph-displayer.cc Wed Feb 28 19:20:28 2007
@@ -21,7 +21,6 @@
#endif
#include "all_include.h"
-#include "mapstorage.h"
#include "main_win.h"
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/trunk/graph_displayer_canvas-edge.cc
==============================================================================
--- glemon/trunk/graph_displayer_canvas-edge.cc (original)
+++ glemon/trunk/graph_displayer_canvas-edge.cc Wed Feb 28 19:20:28 2007
@@ -16,7 +16,9 @@
*
*/
-#include "graph_displayer_canvas.h"
+#include <graph_displayer_canvas.h>
+#include <mapstorage.h>
+#include <nbtab.h>
#include <cmath>
const int minimum_edge_width=0;
@@ -27,11 +29,11 @@
min=edge_property_defaults[E_WIDTH];
max=edge_property_defaults[E_WIDTH];
- Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_WIDTH]);
+ Graph::EdgeMap<double> actual_map((mytab.mapstorage)->graph,edge_property_defaults[E_WIDTH]);
if(edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
double v=fabs(actual_map[i]);
int w;
@@ -68,13 +70,13 @@
Graph::EdgeMap<double> * actual_map;
double min, max;
- min=(mytab.mapstorage).minOfEdgeMap(mapname);
- max=(mytab.mapstorage).maxOfEdgeMap(mapname);
- actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
+ min=(mytab.mapstorage)->minOfEdgeMap(mapname);
+ max=(mytab.mapstorage)->maxOfEdgeMap(mapname);
+ actual_map=((mytab.mapstorage)->edgemap_storage)[mapname];
if(edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
double v=(*actual_map)[i];
int w;
@@ -131,16 +133,16 @@
//the minimum of the nodemap to the range of
//green in RGB
Graph::EdgeMap<double> * actual_map;
- actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
+ actual_map=((mytab.mapstorage)->edgemap_storage)[mapname];
double max, min;
- max=(mytab.mapstorage).maxOfEdgeMap(mapname);
- min=(mytab.mapstorage).minOfEdgeMap(mapname);
+ max=(mytab.mapstorage)->maxOfEdgeMap(mapname);
+ min=(mytab.mapstorage)->minOfEdgeMap(mapname);
if(edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
double w=(*actual_map)[i];
@@ -182,7 +184,7 @@
//function maps the range of the maximum and
//the minimum of the nodemap to the range of
//green in RGB
- Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_COLOR]);
+ Graph::EdgeMap<double> actual_map((mytab.mapstorage)->graph,edge_property_defaults[E_COLOR]);
double max, min;
@@ -191,7 +193,7 @@
if(edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
double w=actual_map[i];
@@ -236,10 +238,10 @@
if(edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
edgemap_to_edit=mapname;
- double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[i];
+ double number=(*((mytab.mapstorage)->edgemap_storage)[mapname])[i];
std::ostringstream ostr;
ostr << number;
@@ -250,7 +252,7 @@
}
else
{
- double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[edge];
+ double number=(*((mytab.mapstorage)->edgemap_storage)[mapname])[edge];
std::ostringstream ostr;
ostr << number;
@@ -271,7 +273,7 @@
if(edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
edgemap_to_edit="";
edgetextmap[i]->property_text().set_value("");
Modified: glemon/trunk/graph_displayer_canvas-event.cc
==============================================================================
--- glemon/trunk/graph_displayer_canvas-event.cc (original)
+++ glemon/trunk/graph_displayer_canvas-event.cc Wed Feb 28 19:20:28 2007
@@ -16,7 +16,9 @@
*
*/
-#include "graph_displayer_canvas.h"
+#include <graph_displayer_canvas.h>
+#include <mapstorage.h>
+#include <nbtab.h>
#include <cmath>
@@ -145,7 +147,7 @@
active_item=(get_item_at(clicked_x, clicked_y));
active_node=INVALID;
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
if(nodesmap[i]==active_item)
{
@@ -168,7 +170,7 @@
//we only have to do sg. if the mouse button is pressed AND the click was on a node that was found in the set of nodes
if(active_node!=INVALID)
{
- (mytab.mapstorage).modified = true;
+ (mytab.mapstorage)->modified = true;
//new coordinates will be the old values,
//because the item will be moved to the
@@ -190,25 +192,25 @@
// reposition the coordinates text
std::ostringstream ostr;
ostr << "(" <<
- (mytab.mapstorage).coords[active_node].x << ", " <<
- (mytab.mapstorage).coords[active_node].y << ")";
+ (mytab.mapstorage)->coords[active_node].x << ", " <<
+ (mytab.mapstorage)->coords[active_node].y << ")";
double radius =
(nodesmap[active_node]->property_x2().get_value() -
nodesmap[active_node]->property_x1().get_value()) / 2.0;
if (coord_text)
{
coord_text->property_text().set_value(ostr.str());
- coord_text->property_x().set_value((mytab.mapstorage).coords[active_node].x +
+ coord_text->property_x().set_value((mytab.mapstorage)->coords[active_node].x +
radius);
- coord_text->property_y().set_value((mytab.mapstorage).coords[active_node].y -
+ coord_text->property_y().set_value((mytab.mapstorage)->coords[active_node].y -
radius);
}
else
{
coord_text = new Gnome::Canvas::Text(
displayed_graph,
- (mytab.mapstorage).coords[active_node].x + radius,
- (mytab.mapstorage).coords[active_node].y - radius,
+ (mytab.mapstorage)->coords[active_node].x + radius,
+ (mytab.mapstorage)->coords[active_node].y - radius,
ostr.str());
coord_text->property_fill_color().set_value("black");
coord_text->property_anchor().set_value(Gtk::ANCHOR_SOUTH_WEST);
@@ -299,35 +301,35 @@
}
case GDK_BUTTON_RELEASE:
- (mytab.mapstorage).modified = true;
+ (mytab.mapstorage)->modified = true;
is_drawn=true;
isbutton=1;
- active_node=(mytab.mapstorage).graph.addNode();
+ active_node=(mytab.mapstorage)->graph.addNode();
//initiating values corresponding to new node in maps
window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
// update coordinates
- (mytab.mapstorage).coords.set(active_node, XY(clicked_x, clicked_y));
+ (mytab.mapstorage)->coords.set(active_node, XY(clicked_x, clicked_y));
// update all other maps
for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
- (mytab.mapstorage).nodemap_storage.begin(); it !=
- (mytab.mapstorage).nodemap_storage.end(); ++it)
+ (mytab.mapstorage)->nodemap_storage.begin(); it !=
+ (mytab.mapstorage)->nodemap_storage.end(); ++it)
{
if ((it->first != "coordinates_x") &&
(it->first != "coordinates_y"))
{
(*(it->second))[active_node] =
- (mytab.mapstorage).nodemap_default[it->first];
+ (mytab.mapstorage)->nodemap_default[it->first];
}
}
// increment the id map's default value
- (mytab.mapstorage).nodemap_default["label"] += 1.0;
+ (mytab.mapstorage)->nodemap_default["label"] += 1.0;
nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph,
clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
@@ -377,7 +379,7 @@
active_item=(get_item_at(clicked_x, clicked_y));
active_node=INVALID;
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
if(nodesmap[i]==active_item)
{
@@ -406,7 +408,7 @@
window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
target_item=(get_item_at(clicked_x, clicked_y));
Node target_node=INVALID;
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
if(nodesmap[i]==target_item)
{
@@ -416,31 +418,31 @@
//the clicked item is a node, the edge can be drawn
if(target_node!=INVALID)
{
- (mytab.mapstorage).modified = true;
+ (mytab.mapstorage)->modified = true;
*(nodesmap[target_node]) <<
Gnome::Canvas::Properties::fill_color("red");
//creating new edge
- active_edge=(mytab.mapstorage).graph.addEdge(active_node,
+ active_edge=(mytab.mapstorage)->graph.addEdge(active_node,
target_node);
// update maps
for (std::map<std::string,
Graph::EdgeMap<double>*>::const_iterator it =
- (mytab.mapstorage).edgemap_storage.begin(); it !=
- (mytab.mapstorage).edgemap_storage.end(); ++it)
+ (mytab.mapstorage)->edgemap_storage.begin(); it !=
+ (mytab.mapstorage)->edgemap_storage.end(); ++it)
{
(*(it->second))[active_edge] =
- (mytab.mapstorage).edgemap_default[it->first];
+ (mytab.mapstorage)->edgemap_default[it->first];
}
// increment the id map's default value
- (mytab.mapstorage).edgemap_default["label"] += 1.0;
+ (mytab.mapstorage)->edgemap_default["label"] += 1.0;
if(target_node!=active_node)
{
// set the coordinates of the arrow on the new edge
- MapStorage& ms = mytab.mapstorage;
+ MapStorage& ms = *mytab.mapstorage;
ms.arrow_pos.set(active_edge,
(ms.coords[ms.graph.source(active_edge)] +
ms.coords[ms.graph.target(active_edge)])/ 2.0);
@@ -452,7 +454,7 @@
else
{
// set the coordinates of the arrow on the new edge
- MapStorage& ms = mytab.mapstorage;
+ MapStorage& ms = *mytab.mapstorage;
ms.arrow_pos.set(active_edge,
(ms.coords[ms.graph.source(active_edge)] +
XY(0.0, 80.0)));
@@ -463,7 +465,7 @@
}
//initializing edge-text as well, to empty string
- XY text_pos=mytab.mapstorage.arrow_pos[active_edge];
+ XY text_pos=mytab.mapstorage->arrow_pos[active_edge];
text_pos+=(XY(10,10));
edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,
@@ -497,7 +499,7 @@
}
if(target_item)
{
- propertyUpdate((mytab.mapstorage).graph.target(active_edge),N_COLOR);
+ propertyUpdate((mytab.mapstorage)->graph.target(active_edge),N_COLOR);
target_item=NULL;
}
active_node=INVALID;
@@ -521,7 +523,7 @@
active_node=INVALID;
active_edge=INVALID;
//was it a node?
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
if(nodesmap[i]==active_item)
{
@@ -531,7 +533,7 @@
//or was it an edge?
if(active_node==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
if(edgesmap[i]->getLine()==active_item)
{
@@ -560,16 +562,16 @@
//a node was found
if(active_node!=INVALID)
{
- (mytab.mapstorage).modified = true;
+ (mytab.mapstorage)->modified = true;
std::set<Graph::Edge> edges_to_delete;
- for(OutEdgeIt e((mytab.mapstorage).graph,active_node);e!=INVALID;++e)
+ for(OutEdgeIt e((mytab.mapstorage)->graph,active_node);e!=INVALID;++e)
{
edges_to_delete.insert(e);
}
- for(InEdgeIt e((mytab.mapstorage).graph,active_node);e!=INVALID;++e)
+ for(InEdgeIt e((mytab.mapstorage)->graph,active_node);e!=INVALID;++e)
{
edges_to_delete.insert(e);
}
@@ -635,7 +637,7 @@
active_item=(get_item_at(clicked_x, clicked_y));
//find the activated item between text of nodes
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
//at the same time only one can be active
if(nodetextmap[i]==active_item)
@@ -647,7 +649,7 @@
//if there was not, search for it between nodes
if(clicked_node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
//at the same time only one can be active
if(nodesmap[i]==active_item)
@@ -660,7 +662,7 @@
if(clicked_node==INVALID)
{
//find the activated item between texts
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
//at the same time only one can be active
if(edgetextmap[i]==active_item)
@@ -672,7 +674,7 @@
//if it was not between texts, search for it between edges
if(clicked_edge==INVALID)
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
//at the same time only one can be active
if((edgesmap[i]->getLine())==active_item)
@@ -714,7 +716,7 @@
break;
case Gtk::RESPONSE_ACCEPT:
double new_value = spin.get_value();
- (*(mytab.mapstorage).nodemap_storage[nodemap_to_edit])[active_node] =
+ (*(mytab.mapstorage)->nodemap_storage[nodemap_to_edit])[active_node] =
new_value;
std::ostringstream ostr;
ostr << new_value;
@@ -757,7 +759,7 @@
break;
case Gtk::RESPONSE_ACCEPT:
double new_value = spin.get_value();
- (*(mytab.mapstorage).edgemap_storage[edgemap_to_edit])[active_edge] =
+ (*(mytab.mapstorage)->edgemap_storage[edgemap_to_edit])[active_edge] =
new_value;
std::ostringstream ostr;
ostr << new_value;
@@ -782,14 +784,14 @@
{
delete(nodetextmap[node_to_delete]);
delete(nodesmap[node_to_delete]);
- (mytab.mapstorage).graph.erase(node_to_delete);
+ (mytab.mapstorage)->graph.erase(node_to_delete);
}
void GraphDisplayerCanvas::deleteItem(Edge edge_to_delete)
{
delete(edgetextmap[edge_to_delete]);
delete(edgesmap[edge_to_delete]);
- (mytab.mapstorage).graph.erase(edge_to_delete);
+ (mytab.mapstorage)->graph.erase(edge_to_delete);
}
void GraphDisplayerCanvas::textReposition(XY new_place)
@@ -809,7 +811,7 @@
}
else
{
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
if(edgesmap[i]==active_bre)
{
@@ -851,62 +853,62 @@
nodetextmap[moved_node]->move(dx, dy);
// the new coordinates of the centre of the node
- double coord_x = dx + (mytab.mapstorage).coords[moved_node].x;
- double coord_y = dy + (mytab.mapstorage).coords[moved_node].y;
+ double coord_x = dx + (mytab.mapstorage)->coords[moved_node].x;
+ double coord_y = dy + (mytab.mapstorage)->coords[moved_node].y;
// write back the new coordinates to the coords map
- (mytab.mapstorage).coords.set(moved_node, XY(coord_x, coord_y));
+ (mytab.mapstorage)->coords.set(moved_node, XY(coord_x, coord_y));
//all the edges connected to the moved point has to be redrawn
- for(OutEdgeIt ei((mytab.mapstorage).graph,moved_node);ei!=INVALID;++ei)
+ for(OutEdgeIt ei((mytab.mapstorage)->graph,moved_node);ei!=INVALID;++ei)
{
XY arrow_pos;
- if (mytab.mapstorage.graph.source(ei) == mytab.mapstorage.graph.target(ei))
+ if (mytab.mapstorage->graph.source(ei) == mytab.mapstorage->graph.target(ei))
{
- arrow_pos = mytab.mapstorage.arrow_pos[ei] + XY(dx, dy);
+ arrow_pos = mytab.mapstorage->arrow_pos[ei] + XY(dx, dy);
}
else
{
XY moved_node_1(coord_x - dx, coord_y - dy);
XY moved_node_2(coord_x, coord_y);
- Node target = mytab.mapstorage.graph.target(ei);
- XY fix_node(mytab.mapstorage.coords[target].x,
- mytab.mapstorage.coords[target].y);
- XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
+ Node target = mytab.mapstorage->graph.target(ei);
+ XY fix_node(mytab.mapstorage->coords[target].x,
+ mytab.mapstorage->coords[target].y);
+ XY old_arrow_pos(mytab.mapstorage->arrow_pos[ei]);
arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
}
- mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
+ mytab.mapstorage->arrow_pos.set(ei, arrow_pos);
edgesmap[ei]->draw();
//reposition of edgetext
- XY text_pos=mytab.mapstorage.arrow_pos[ei];
+ XY text_pos=mytab.mapstorage->arrow_pos[ei];
text_pos+=(XY(10,10));
edgetextmap[ei]->property_x().set_value(text_pos.x);
edgetextmap[ei]->property_y().set_value(text_pos.y);
}
- for(InEdgeIt ei((mytab.mapstorage).graph,moved_node);ei!=INVALID;++ei)
+ for(InEdgeIt ei((mytab.mapstorage)->graph,moved_node);ei!=INVALID;++ei)
{
- if (mytab.mapstorage.graph.source(ei) != mytab.mapstorage.graph.target(ei))
+ if (mytab.mapstorage->graph.source(ei) != mytab.mapstorage->graph.target(ei))
{
XY moved_node_1(coord_x - dx, coord_y - dy);
XY moved_node_2(coord_x, coord_y);
- Node source = mytab.mapstorage.graph.source(ei);
- XY fix_node(mytab.mapstorage.coords[source].x,
- mytab.mapstorage.coords[source].y);
- XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
+ Node source = mytab.mapstorage->graph.source(ei);
+ XY fix_node(mytab.mapstorage->coords[source].x,
+ mytab.mapstorage->coords[source].y);
+ XY old_arrow_pos(mytab.mapstorage->arrow_pos[ei]);
XY arrow_pos;
arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
- mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
+ mytab.mapstorage->arrow_pos.set(ei, arrow_pos);
edgesmap[ei]->draw();
//reposition of edgetext
- XY text_pos=mytab.mapstorage.arrow_pos[ei];
+ XY text_pos=mytab.mapstorage->arrow_pos[ei];
text_pos+=(XY(10,10));
edgetextmap[ei]->property_x().set_value(text_pos.x);
edgetextmap[ei]->property_y().set_value(text_pos.y);
Modified: glemon/trunk/graph_displayer_canvas-node.cc
==============================================================================
--- glemon/trunk/graph_displayer_canvas-node.cc (original)
+++ glemon/trunk/graph_displayer_canvas-node.cc Wed Feb 28 19:20:28 2007
@@ -16,7 +16,9 @@
*
*/
-#include "graph_displayer_canvas.h"
+#include <graph_displayer_canvas.h>
+#include <mapstorage.h>
+#include <nbtab.h>
#include <cmath>
const int minimum_node_radius=5;
@@ -25,13 +27,13 @@
{
Graph::NodeMap<double> * actual_map;
double min, max;
- min=(mytab.mapstorage).minOfNodeMap(mapname);
- max=(mytab.mapstorage).maxOfNodeMap(mapname);
- actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
+ min=(mytab.mapstorage)->minOfNodeMap(mapname);
+ max=(mytab.mapstorage)->maxOfNodeMap(mapname);
+ actual_map=((mytab.mapstorage)->nodemap_storage)[mapname];
if(node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
double v=fabs((*actual_map)[i]);
int w;
@@ -103,11 +105,11 @@
double min, max;
min=node_property_defaults[N_RADIUS];
max=node_property_defaults[N_RADIUS];
- Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_RADIUS]);
+ Graph::NodeMap<double> actual_map((mytab.mapstorage)->graph,node_property_defaults[N_RADIUS]);
if(node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
double v=fabs(actual_map[i]);
int w;
@@ -167,17 +169,17 @@
//green in RGB
Graph::NodeMap<double> * actual_map;
- actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
+ actual_map=((mytab.mapstorage)->nodemap_storage)[mapname];
double max, min;
- max=(mytab.mapstorage).maxOfNodeMap(mapname);
- min=(mytab.mapstorage).minOfNodeMap(mapname);
+ max=(mytab.mapstorage)->maxOfNodeMap(mapname);
+ min=(mytab.mapstorage)->minOfNodeMap(mapname);
if(node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
Gdk::Color color;
@@ -222,7 +224,7 @@
//the minimum of the nodemap to the range of
//green in RGB
- Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_COLOR]);
+ Graph::NodeMap<double> actual_map((mytab.mapstorage)->graph,node_property_defaults[N_COLOR]);
double max, min;
@@ -232,7 +234,7 @@
if(node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
Gdk::Color color;
@@ -279,11 +281,11 @@
//that is the deleter map
Graph::NodeMap<double> * actual_map=NULL;
- actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
+ actual_map=((mytab.mapstorage)->nodemap_storage)[mapname];
if(node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
nodemap_to_edit=mapname;
double number=(*actual_map)[i];
@@ -316,7 +318,7 @@
if(node==INVALID)
{
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
nodemap_to_edit="";
nodetextmap[i]->property_text().set_value("");
Modified: glemon/trunk/graph_displayer_canvas-zoom.cc
==============================================================================
--- glemon/trunk/graph_displayer_canvas-zoom.cc (original)
+++ glemon/trunk/graph_displayer_canvas-zoom.cc Wed Feb 28 19:20:28 2007
@@ -16,7 +16,7 @@
*
*/
-#include "graph_displayer_canvas.h"
+#include <graph_displayer_canvas.h>
#include <cmath>
void GraphDisplayerCanvas::zoomIn()
Modified: glemon/trunk/graph_displayer_canvas.cc
==============================================================================
--- glemon/trunk/graph_displayer_canvas.cc (original)
+++ glemon/trunk/graph_displayer_canvas.cc Wed Feb 28 19:20:28 2007
@@ -16,13 +16,15 @@
*
*/
-#include "graph_displayer_canvas.h"
+#include <mapstorage.h>
+#include <nbtab.h>
+#include <graph_displayer_canvas.h>
#include <lemon/random.h>
#include <cmath>
GraphDisplayerCanvas::GraphDisplayerCanvas(NoteBookTab & mainw) :
- nodesmap(mainw.mapstorage.graph), edgesmap(mainw.mapstorage.graph), edgetextmap(mainw.mapstorage.graph),
- nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0),
+ nodesmap(mainw.mapstorage->graph), edgesmap(mainw.mapstorage->graph), edgetextmap(mainw.mapstorage->graph),
+ nodetextmap(mainw.mapstorage->graph), displayed_graph(*(root()), 0, 0),
isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""),
edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10),
was_redesigned(false), is_drawn(false), mytab(mainw),
@@ -49,11 +51,11 @@
{
delete background;
}
- if (mytab.mapstorage.isBackgroundSet())
+ if (mytab.mapstorage->isBackgroundSet())
{
background_set = true;
refBackground = Gdk::Pixbuf::create_from_file(
- mytab.mapstorage.getBackgroundFilename());
+ mytab.mapstorage->getBackgroundFilename());
background = new Gnome::Canvas::Pixbuf(
*(root()),
0.0 - refBackground->get_width() / 2.0,
@@ -69,13 +71,13 @@
GraphDisplayerCanvas::~GraphDisplayerCanvas()
{
- for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
+ for (NodeIt n((mytab.mapstorage)->graph); n != INVALID; ++n)
{
delete nodesmap[n];
delete nodetextmap[n];
}
- for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
+ for (EdgeIt e((mytab.mapstorage)->graph); e != INVALID; ++e)
{
delete edgesmap[e];
delete edgetextmap[e];
@@ -118,7 +120,7 @@
{
if(mapname!="")
{
- if( ( ((mytab.mapstorage).nodemap_storage).find(mapname) != ((mytab.mapstorage).nodemap_storage).end() ) )
+ if( ( ((mytab.mapstorage)->nodemap_storage).find(mapname) != ((mytab.mapstorage)->nodemap_storage).end() ) )
{
switch(prop)
{
@@ -165,7 +167,7 @@
{
if(mapname!="")
{
- if( ( ((mytab.mapstorage).edgemap_storage).find(mapname) != ((mytab.mapstorage).edgemap_storage).end() ) )
+ if( ( ((mytab.mapstorage)->edgemap_storage).find(mapname) != ((mytab.mapstorage)->edgemap_storage).end() ) )
{
switch(prop)
{
@@ -207,9 +209,9 @@
{
//first edges are drawn, to hide joining with nodes later
- for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
- if (mytab.mapstorage.graph.source(i) == mytab.mapstorage.graph.target(i))
+ if (mytab.mapstorage->graph.source(i) == mytab.mapstorage->graph.target(i))
{
edgesmap[i]=new LoopEdge(displayed_graph, i, *this);
}
@@ -219,7 +221,7 @@
}
//initializing edge-text as well, to empty string
- XY text_pos=mytab.mapstorage.arrow_pos[i];
+ XY text_pos=mytab.mapstorage->arrow_pos[i];
text_pos+=(XY(10,10));
edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
@@ -230,16 +232,16 @@
//afterwards nodes come to be drawn
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
//drawing bule nodes, with black line around them
nodesmap[i]=new Gnome::Canvas::Ellipse(
displayed_graph,
- (mytab.mapstorage).coords[i].x-20,
- (mytab.mapstorage).coords[i].y-20,
- (mytab.mapstorage).coords[i].x+20,
- (mytab.mapstorage).coords[i].y+20);
+ (mytab.mapstorage)->coords[i].x-20,
+ (mytab.mapstorage)->coords[i].y-20,
+ (mytab.mapstorage)->coords[i].x+20,
+ (mytab.mapstorage)->coords[i].y+20);
*(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue");
*(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black");
nodesmap[i]->raise_to_top();
@@ -247,8 +249,8 @@
//initializing edge-text as well, to empty string
XY text_pos(
- ((mytab.mapstorage).coords[i].x+node_property_defaults[N_RADIUS]+5),
- ((mytab.mapstorage).coords[i].y+node_property_defaults[N_RADIUS]+5));
+ ((mytab.mapstorage)->coords[i].x+node_property_defaults[N_RADIUS]+5),
+ ((mytab.mapstorage)->coords[i].y+node_property_defaults[N_RADIUS]+5));
nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph,
text_pos.x, text_pos.y, "");
@@ -281,13 +283,13 @@
active_edge=INVALID;
forming_edge=INVALID;
- for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
+ for (NodeIt n((mytab.mapstorage)->graph); n != INVALID; ++n)
{
delete nodesmap[n];
delete nodetextmap[n];
}
- for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
+ for (EdgeIt e((mytab.mapstorage)->graph); e != INVALID; ++e)
{
delete edgesmap[e];
delete edgetextmap[e];
@@ -323,7 +325,7 @@
void GraphDisplayerCanvas::reDesignGraph()
{
- NodeIt firstnode((mytab.mapstorage).graph);
+ NodeIt firstnode((mytab.mapstorage)->graph);
//is it not an empty graph?
if(firstnode!=INVALID)
{
@@ -333,7 +335,7 @@
if(!was_redesigned)
{
- NodeIt i((mytab.mapstorage).graph);
+ NodeIt i((mytab.mapstorage)->graph);
dim2::Point<double> init(init_vector_length*rnd(),
init_vector_length*rnd());
@@ -345,28 +347,28 @@
double propulsation;
int iterations;
- (mytab.mapstorage).get_design_data(attraction, propulsation, iterations);
+ (mytab.mapstorage)->get_design_data(attraction, propulsation, iterations);
//iteration counter
for(int l=0;l<iterations;l++)
{
- Graph::NodeMap<double> x(mytab.mapstorage.graph);
- Graph::NodeMap<double> y(mytab.mapstorage.graph);
+ Graph::NodeMap<double> x(mytab.mapstorage->graph);
+ Graph::NodeMap<double> y(mytab.mapstorage->graph);
XYMap<Graph::NodeMap<double> > actual_forces;
actual_forces.setXMap(x);
actual_forces.setYMap(y);
//count actual force for each nodes
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
//propulsation of nodes
- for (NodeIt j((mytab.mapstorage).graph); j!=INVALID; ++j)
+ for (NodeIt j((mytab.mapstorage)->graph); j!=INVALID; ++j)
{
if(i!=j)
{
lemon::dim2::Point<double> delta =
- ((mytab.mapstorage).coords[i]-
- (mytab.mapstorage).coords[j]);
+ ((mytab.mapstorage)->coords[i]-
+ (mytab.mapstorage)->coords[j]);
const double length_sqr=std::max(delta.normSquare(),min_dist);
@@ -381,11 +383,11 @@
}
}
//attraction of nodes, to which actual node is bound
- for(OutEdgeIt ei((mytab.mapstorage).graph,i);ei!=INVALID;++ei)
+ for(OutEdgeIt ei((mytab.mapstorage)->graph,i);ei!=INVALID;++ei)
{
lemon::dim2::Point<double> delta =
- ((mytab.mapstorage).coords[i]-
- (mytab.mapstorage).coords[mytab.mapstorage.
+ ((mytab.mapstorage)->coords[i]-
+ (mytab.mapstorage)->coords[mytab.mapstorage->
graph.target(ei)]);
//calculating attraction strength
@@ -394,11 +396,11 @@
actual_forces.set(i,actual_forces[i]-delta);
}
- for(InEdgeIt ei((mytab.mapstorage).graph,i);ei!=INVALID;++ei)
+ for(InEdgeIt ei((mytab.mapstorage)->graph,i);ei!=INVALID;++ei)
{
lemon::dim2::Point<double> delta =
- ((mytab.mapstorage).coords[i]-
- (mytab.mapstorage).coords[mytab.mapstorage.
+ ((mytab.mapstorage)->coords[i]-
+ (mytab.mapstorage)->coords[mytab.mapstorage->
graph.source(ei)]);
//calculating attraction strength
@@ -408,27 +410,27 @@
actual_forces.set(i,actual_forces[i]-delta);
}
}
- for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
+ for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i)
{
- if(((mytab.mapstorage).coords[i].x)+actual_forces[i].x>max_coord)
+ if(((mytab.mapstorage)->coords[i].x)+actual_forces[i].x>max_coord)
{
- actual_forces[i].x=max_coord-((mytab.mapstorage).coords[i].x);
- std::cout << "Correction! " << (((mytab.mapstorage).coords[i].x)+actual_forces[i].x) << std::endl;
+ actual_forces[i].x=max_coord-((mytab.mapstorage)->coords[i].x);
+ std::cout << "Correction! " << (((mytab.mapstorage)->coords[i].x)+actual_forces[i].x) << std::endl;
}
- else if(((mytab.mapstorage).coords[i].x)+actual_forces[i].x<(0-max_coord))
+ else if(((mytab.mapstorage)->coords[i].x)+actual_forces[i].x<(0-max_coord))
{
- actual_forces[i].x=0-max_coord-((mytab.mapstorage).coords[i].x);
- std::cout << "Correction! " << (((mytab.mapstorage).coords[i].x)+actual_forces[i].x) << std::endl;
+ actual_forces[i].x=0-max_coord-((mytab.mapstorage)->coords[i].x);
+ std::cout << "Correction! " << (((mytab.mapstorage)->coords[i].x)+actual_forces[i].x) << std::endl;
}
- if(((mytab.mapstorage).coords[i].y)+actual_forces[i].y>max_coord)
+ if(((mytab.mapstorage)->coords[i].y)+actual_forces[i].y>max_coord)
{
- actual_forces[i].y=max_coord-((mytab.mapstorage).coords[i].y);
- std::cout << "Correction! " << (((mytab.mapstorage).coords[i].y)+actual_forces[i].y) << std::endl;
+ actual_forces[i].y=max_coord-((mytab.mapstorage)->coords[i].y);
+ std::cout << "Correction! " << (((mytab.mapstorage)->coords[i].y)+actual_forces[i].y) << std::endl;
}
- else if(((mytab.mapstorage).coords[i].y)+actual_forces[i].y<(0-max_coord))
+ else if(((mytab.mapstorage)->coords[i].y)+actual_forces[i].y<(0-max_coord))
{
- actual_forces[i].y=0-max_coord-((mytab.mapstorage).coords[i].y);
- std::cout << "Correction! " << (((mytab.mapstorage).coords[i].y)+actual_forces[i].y) << std::endl;
+ actual_forces[i].y=0-max_coord-((mytab.mapstorage)->coords[i].y);
+ std::cout << "Correction! " << (((mytab.mapstorage)->coords[i].y)+actual_forces[i].y) << std::endl;
}
moveNode(actual_forces[i].x, actual_forces[i].y, nodesmap[i], i);
}
Modified: glemon/trunk/graph_displayer_canvas.h
==============================================================================
--- glemon/trunk/graph_displayer_canvas.h (original)
+++ glemon/trunk/graph_displayer_canvas.h Wed Feb 28 19:20:28 2007
@@ -19,13 +19,11 @@
#ifndef GRAPH_DISPLAYER_CANVAS_H
#define GRAPH_DISPLAYER_CANVAS_H
-class GraphDisplayerCanvas;
+class NoteBookTab;
#include "all_include.h"
-#include "nbtab.h"
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
-#include <lemon/dim2.h>
///This class is the canvas, on which the graph can be drawn.
class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
Modified: glemon/trunk/gui_reader.cc
==============================================================================
--- glemon/trunk/gui_reader.cc (original)
+++ glemon/trunk/gui_reader.cc Wed Feb 28 19:20:28 2007
@@ -16,9 +16,10 @@
*
*/
-#include "gui_reader.h"
-#include "xml.h"
-#include "mapstorage.h"
+#include <gui_reader.h>
+#include <mapstorage.h>
+
+#include <xml.h>
#include <lemon/dim2.h>
#include <vector>
Modified: glemon/trunk/gui_reader.h
==============================================================================
--- glemon/trunk/gui_reader.h (original)
+++ glemon/trunk/gui_reader.h Wed Feb 28 19:20:28 2007
@@ -18,10 +18,10 @@
#ifndef GUI_READER_H
#define GUI_READER_H
-
-#include "mapstorage.h"
#include <lemon/lemon_reader.h>
+class MapStorage;
+
using lemon::LemonReader;
class GuiReader : public LemonReader::SectionReader
Modified: glemon/trunk/gui_writer.cc
==============================================================================
--- glemon/trunk/gui_writer.cc (original)
+++ glemon/trunk/gui_writer.cc Wed Feb 28 19:20:28 2007
@@ -16,12 +16,13 @@
*
*/
-#include "gui_writer.h"
-#include "xml.h"
-#include "mapstorage.h"
+#include <xml.h>
#include <lemon/dim2.h>
#include <vector>
+#include <gui_writer.h>
+#include <mapstorage.h>
+
std::string GuiWriter::header()
{
return "@gui";
Modified: glemon/trunk/gui_writer.h
==============================================================================
--- glemon/trunk/gui_writer.h (original)
+++ glemon/trunk/gui_writer.h Wed Feb 28 19:20:28 2007
@@ -19,9 +19,10 @@
#ifndef GUI_WRITER_H
#define GUI_WRITER_H
-#include "mapstorage.h"
#include <lemon/lemon_writer.h>
+class MapStorage;
+
using lemon::LemonWriter;
class GuiWriter : public LemonWriter::SectionWriter
Modified: glemon/trunk/kruskalbox.cc
==============================================================================
--- glemon/trunk/kruskalbox.cc (original)
+++ glemon/trunk/kruskalbox.cc Wed Feb 28 19:20:28 2007
@@ -16,6 +16,11 @@
*
*/
+#include <lemon/kruskal.h>
+
+#include <mapstorage.h>
+#include <mapselector.h>
+#include <algobox.h>
#include <kruskalbox.h>
enum {INPUT, OUTPUT, MAP_NUM};
Modified: glemon/trunk/kruskalbox.h
==============================================================================
--- glemon/trunk/kruskalbox.h (original)
+++ glemon/trunk/kruskalbox.h Wed Feb 28 19:20:28 2007
@@ -19,11 +19,9 @@
#ifndef KRUSKALBOX_H
#define KRUSKALBOX_H
-class KruskalBox;
+class AlgoBox;
#include <all_include.h>
-#include <algobox.h>
-#include <lemon/kruskal.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/trunk/main_win.cc
==============================================================================
--- glemon/trunk/main_win.cc (original)
+++ glemon/trunk/main_win.cc Wed Feb 28 19:20:28 2007
@@ -20,9 +20,15 @@
#include <config.h>
#endif
-#include "main_win.h"
-#include "guipixbufs.h"
-#include "background_chooser_dialog.h"
+#include <main_win.h>
+#include <guipixbufs.h>
+#include <background_chooser_dialog.h>
+
+#include <mapstorage.h>
+#include <graph_displayer_canvas.h>
+#include <algowin.h>
+#include <new_map_win.h>
+#include <nbtab.h>
#include "i18n.h"
@@ -364,7 +370,7 @@
{
if(active_tab!=-1)
{
- if (tabs[active_tab]->mapstorage.modified)
+ if (tabs[active_tab]->mapstorage->modified)
{
Gtk::MessageDialog mdialog(_("<b>Save changes before closing?</b>"), true,
Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
@@ -553,7 +559,7 @@
for(;(i<(int)tabnames.size())&&(tabnames[i]!=tabname);i++)
{
}
- awp->update_maplist(&(tabs[i]->mapstorage));
+ awp->update_maplist(tabs[i]->mapstorage);
}
void MainWin::deRegisterAlgoWin(AlgoWin * awp)
@@ -632,6 +638,6 @@
void MainWin::createBackgroundChooser()
{
- BackgroundChooserDialog dialog(&(tabs[active_tab]->mapstorage));
+ BackgroundChooserDialog dialog(tabs[active_tab]->mapstorage);
dialog.run();
}
Modified: glemon/trunk/main_win.h
==============================================================================
--- glemon/trunk/main_win.h (original)
+++ glemon/trunk/main_win.h Wed Feb 28 19:20:28 2007
@@ -20,13 +20,11 @@
#define MAIN_WIN_H
#include "all_include.h"
-#include "algowin.h"
-#include "map_win.h"
-#include "new_map_win.h"
-#include "nbtab.h"
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
+class AlgoWin;
+class NoteBookTab;
///This class is the main window of GUI.
Modified: glemon/trunk/map_win.cc
==============================================================================
--- glemon/trunk/map_win.cc (original)
+++ glemon/trunk/map_win.cc Wed Feb 28 19:20:28 2007
@@ -16,7 +16,9 @@
*
*/
-#include "map_win.h"
+#include <map_win.h>
+#include <nbtab.h>
+#include <mapselector.h>
#include <set>
bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e)
Modified: glemon/trunk/map_win.h
==============================================================================
--- glemon/trunk/map_win.h (original)
+++ glemon/trunk/map_win.h Wed Feb 28 19:20:28 2007
@@ -19,11 +19,10 @@
#ifndef MAP_WIN_H
#define MAP_WIN_H
-class MapWin;
+class NoteBookTab;
+class MapSelector;
#include <all_include.h>
-#include <nbtab.h>
-#include <mapselector.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/trunk/mapselector.cc
==============================================================================
--- glemon/trunk/mapselector.cc (original)
+++ glemon/trunk/mapselector.cc Wed Feb 28 19:20:28 2007
@@ -16,7 +16,7 @@
*
*/
-#include "mapselector.h"
+#include <mapselector.h>
MapSelector::MapSelector(std::vector<std::string> ml, std::string act, std::string labeltext, bool edge, bool d):def(d),itisedge(edge),set_new_map(false)
{
Modified: glemon/trunk/mapselector.h
==============================================================================
--- glemon/trunk/mapselector.h (original)
+++ glemon/trunk/mapselector.h Wed Feb 28 19:20:28 2007
@@ -19,10 +19,7 @@
#ifndef MAPSELECTOR_H
#define MAPSELECTOR_H
-class MapSelector;
-
#include <all_include.h>
-#include <map_win.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
Modified: glemon/trunk/mapstorage.cc
==============================================================================
--- glemon/trunk/mapstorage.cc (original)
+++ glemon/trunk/mapstorage.cc Wed Feb 28 19:20:28 2007
@@ -16,14 +16,16 @@
*
*/
-#include "mapstorage.h"
-#include "nbtab.h"
-#include "gui_writer.h"
-#include "gui_reader.h"
#include <limits>
#include <cmath>
#include <gtkmm.h>
-#include<lemon/graph_to_eps.h>
+
+#include <mapstorage.h>
+#include <graph_displayer_canvas.h> //kivenni
+#include <nbtab.h> //kivenni
+#include <gui_writer.h>
+#include <gui_reader.h>
+#include <lemon/graph_to_eps.h>
const int i_d=20;
const double a_d=0.05;
Modified: glemon/trunk/mapstorage.h
==============================================================================
--- glemon/trunk/mapstorage.h (original)
+++ glemon/trunk/mapstorage.h Wed Feb 28 19:20:28 2007
@@ -19,10 +19,8 @@
#ifndef MAPSTORAGE_H
#define MAPSTORAGE_H
-class Mapstorage;
-
-#include "all_include.h"
-#include "xymap.h"
+#include <all_include.h>
+#include <xymap.h>
#include <libgnomecanvasmm.h>
class NoteBookTab;
Modified: glemon/trunk/nbtab.cc
==============================================================================
--- glemon/trunk/nbtab.cc (original)
+++ glemon/trunk/nbtab.cc Wed Feb 28 19:20:28 2007
@@ -17,39 +17,47 @@
*/
#include <nbtab.h>
+#include <mapstorage.h>
#include <eps_win.h>
+#include <map_win.h>
+#include <design_win.h>
+#include <graph_displayer_canvas.h>
-NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false), mapstorage(*this)
+
+
+NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false)
{
+ mapstorage=new MapStorage(*this);
+
Gtk::ScrolledWindow *pScrolledWindow = manage(new Gtk::ScrolledWindow);
gd_canvas=new GraphDisplayerCanvas(*this);
pScrolledWindow->add(*gd_canvas);
add(*pScrolledWindow);
//connecting signals - controller character
- mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
- mapstorage.signal_node_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewNodeMap));
- mapstorage.signal_edge_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewEdgeMap));
+ mapstorage->signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
+ mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewNodeMap));
+ mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewEdgeMap));
show_all_children();
show();
}
void NoteBookTab::readFile(const std::string &file)
{
- mapstorage.readFromFile(file);
- mapstorage.file_name = file;
- mapstorage.modified = false;
+ mapstorage->readFromFile(file);
+ mapstorage->file_name = file;
+ mapstorage->modified = false;
gd_canvas->drawGraph();
if(mapwinexists)
{
- mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
+ mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
}
signal_title.emit(Glib::filename_display_basename(file));
}
void NoteBookTab::newFile()
{
- if (mapstorage.modified)
+ if (mapstorage->modified)
{
Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
@@ -68,17 +76,17 @@
}
}
gd_canvas->clear();
- mapstorage.clear();
+ mapstorage->clear();
if(mapwinexists)
{
- mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
+ mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
}
signal_title.emit("unsaved file");
}
void NoteBookTab::openFile()
{
- if (mapstorage.modified)
+ if (mapstorage->modified)
{
Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
@@ -102,16 +110,16 @@
if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
{
gd_canvas->clear();
- mapstorage.clear();
+ mapstorage->clear();
Glib::ustring filename = fcdialog.get_filename();
- if (!mapstorage.readFromFile(filename))
+ if (!mapstorage->readFromFile(filename))
{
- mapstorage.file_name = filename;
- mapstorage.modified = false;
+ mapstorage->file_name = filename;
+ mapstorage->modified = false;
gd_canvas->drawGraph();
if(mapwinexists)
{
- mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
+ mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
}
signal_title.emit(Glib::filename_display_basename(filename));
}
@@ -120,14 +128,14 @@
void NoteBookTab::saveFile()
{
- if (mapstorage.file_name == "") {
+ if (mapstorage->file_name == "") {
saveFileAs();
}
else
{
- mapstorage.writeToFile(mapstorage.file_name);
- mapstorage.modified = false;
- signal_title.emit(Glib::filename_display_basename(mapstorage.file_name));
+ mapstorage->writeToFile(mapstorage->file_name);
+ mapstorage->modified = false;
+ signal_title.emit(Glib::filename_display_basename(mapstorage->file_name));
}
}
@@ -139,16 +147,16 @@
if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
{
Glib::ustring filename = fcdialog.get_filename();
- mapstorage.file_name = filename;
- mapstorage.writeToFile(filename);
- mapstorage.modified = false;
+ mapstorage->file_name = filename;
+ mapstorage->writeToFile(filename);
+ mapstorage->modified = false;
signal_title.emit(Glib::filename_display_basename(filename));
}
}
void NoteBookTab::close()
{
- if (mapstorage.modified)
+ if (mapstorage->modified)
{
Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
@@ -167,17 +175,17 @@
}
}
gd_canvas->clear();
- mapstorage.clear();
+ mapstorage->clear();
if(mapwinexists)
{
- mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
+ mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
}
signal_title.emit("unsaved file");
}
void NoteBookTab::propertyChange(bool itisedge, int prop, std::string mapname)
{
- mapstorage.changeActiveMap(itisedge, prop, mapname);
+ mapstorage->changeActiveMap(itisedge, prop, mapname);
}
sigc::signal<void, NoteBookTab *, bool> NoteBookTab::signal_newmap_needed()
@@ -192,12 +200,12 @@
std::string NoteBookTab::getActiveEdgeMap(int prop)
{
- return mapstorage.getActiveEdgeMap(prop);
+ return mapstorage->getActiveEdgeMap(prop);
}
std::string NoteBookTab::getActiveNodeMap(int prop)
{
- return mapstorage.getActiveNodeMap(prop);
+ return mapstorage->getActiveNodeMap(prop);
}
void NoteBookTab::registerNewEdgeMap(std::string mapname)
@@ -220,8 +228,8 @@
{
if(!mapwinexists)
{
- mapwin=new MapWin("Map Setup - "+name, mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
- mapst2mapwin=mapstorage.signal_map_win_ch().connect(sigc::mem_fun(*mapwin, &MapWin::changeEntry));
+ mapwin=new MapWin("Map Setup - "+name, mapstorage->getEdgeMapList(), mapstorage->getNodeMapList(), *this);
+ mapst2mapwin=mapstorage->signal_map_win_ch().connect(sigc::mem_fun(*mapwin, &MapWin::changeEntry));
mapwin->show();
mapwinexists=true;
}
@@ -244,7 +252,7 @@
{
double attraction, propulsation;
int iterations;
- mapstorage.get_design_data(attraction, propulsation, iterations);
+ mapstorage->get_design_data(attraction, propulsation, iterations);
designwin=new DesignWin("Design Setup - "+name, attraction, propulsation, iterations, *this);
designwin->signal_attraction().connect(sigc::mem_fun(mapstorage, &MapStorage::set_attraction));
@@ -254,7 +262,7 @@
designwin->signal_delete_event().connect(sigc::mem_fun(*this, &NoteBookTab::closeDesignWin));
- mapst2designwin=mapstorage.signal_design_win_ch().connect(sigc::mem_fun(*designwin, &DesignWin::set_data));
+ mapst2designwin=mapstorage->signal_design_win_ch().connect(sigc::mem_fun(*designwin, &DesignWin::set_data));
designwin->show();
designwinexists=true;
@@ -306,10 +314,10 @@
void NoteBookTab::active_maps_needed()
{
- mapstorage.broadcastActiveMaps();
+ mapstorage->broadcastActiveMaps();
}
void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename)
{
- mapstorage.exportGraphToEPS(options, filename);
+ mapstorage->exportGraphToEPS(options, filename);
}
Modified: glemon/trunk/nbtab.h
==============================================================================
--- glemon/trunk/nbtab.h (original)
+++ glemon/trunk/nbtab.h Wed Feb 28 19:20:28 2007
@@ -19,14 +19,12 @@
#ifndef NBTAB_H
#define NBTAB_H
-class NoteBookTab;
-
-#include "mapstorage.h"
-#include "map_win.h"
-//#include "eps_win.h"
+class MapStorage;
class EpsWin;
-#include "design_win.h"
-#include "graph_displayer_canvas.h"
+class MapWin;
+class DesignWin;
+class GraphDisplayerCanvas;
+
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
@@ -59,7 +57,7 @@
NoteBookTab();
///Maps assigned to the graph displayed in this \ref NoteBookTab of notebook.
- MapStorage mapstorage;
+ MapStorage * mapstorage;
///Title changement indicator.
Modified: glemon/trunk/new_map_win.cc
==============================================================================
--- glemon/trunk/new_map_win.cc (original)
+++ glemon/trunk/new_map_win.cc Wed Feb 28 19:20:28 2007
@@ -17,6 +17,8 @@
*/
#include <new_map_win.h>
+#include <nbtab.h>
+#include <mapstorage.h>
bool NewMapWin::closeIfEscapeIsPressed(GdkEventKey* e)
{
@@ -119,13 +121,13 @@
if(edge.get_active())
{
//create the new map
- Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mytab.mapstorage.graph, def_val);
+ Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mytab.mapstorage->graph, def_val);
if(!only_nums)
{
std::stack<double> polishstack;
- for(EdgeIt k(mytab.mapstorage.graph); k!=INVALID; ++k)
+ for(EdgeIt k(mytab.mapstorage->graph); k!=INVALID; ++k)
{
for(int i=0;i<(int)polishform.size();i++)
{
@@ -144,11 +146,11 @@
break;
default:
//substitute variable
- std::map< std::string,Graph::EdgeMap<double> * > ems=mytab.mapstorage.edgemap_storage;
+ std::map< std::string,Graph::EdgeMap<double> * > ems=mytab.mapstorage->edgemap_storage;
bool itisvar=(ems.find(ch2var[ polishform[i] ])!=ems.end());
if(itisvar)
{
- polishstack.push( (*(mytab.mapstorage.edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
+ polishstack.push( (*(mytab.mapstorage->edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
}
else
{
@@ -187,7 +189,7 @@
//if addition was not successful addEdgeMap returns one.
//cause can be that there is already a map named like the new one
- if(mytab.mapstorage.addEdgeMap(mapname, emptr, def_val))
+ if(mytab.mapstorage->addEdgeMap(mapname, emptr, def_val))
{
abortion=1;
}
@@ -202,13 +204,13 @@
else //!edge.get_active()
{
//create the new map
- Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mytab.mapstorage.graph, def_val);
+ Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mytab.mapstorage->graph, def_val);
if(!only_nums)
{
std::stack<double> polishstack;
- for(NodeIt k(mytab.mapstorage.graph); k!=INVALID; ++k)
+ for(NodeIt k(mytab.mapstorage->graph); k!=INVALID; ++k)
{
for(int i=0;i<(int)polishform.size();i++)
{
@@ -226,11 +228,11 @@
polishstack.pop();
break;
default:
- std::map< std::string,Graph::NodeMap<double> * > nms=mytab.mapstorage.nodemap_storage;
+ std::map< std::string,Graph::NodeMap<double> * > nms=mytab.mapstorage->nodemap_storage;
bool itisvar=(nms.find(ch2var[ polishform[i] ])!=nms.end());
if(itisvar)
{
- polishstack.push( (*(mytab.mapstorage.nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
+ polishstack.push( (*(mytab.mapstorage->nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
}
else
{
@@ -268,7 +270,7 @@
}
//if addition was not successful addNodeMap returns one.
//cause can be that there is already a map named like the new one
- if(mytab.mapstorage.addNodeMap(mapname,emptr, def_val))
+ if(mytab.mapstorage->addNodeMap(mapname,emptr, def_val))
{
abortion=1;
}
@@ -479,11 +481,11 @@
//is it mapname?
if(itisedge)
{
- cancel=(mytab.mapstorage.edgemap_storage.find(variable)==mytab.mapstorage.edgemap_storage.end());
+ cancel=(mytab.mapstorage->edgemap_storage.find(variable)==mytab.mapstorage->edgemap_storage.end());
}
else
{
- cancel=(mytab.mapstorage.nodemap_storage.find(variable)==mytab.mapstorage.nodemap_storage.end());
+ cancel=(mytab.mapstorage->nodemap_storage.find(variable)==mytab.mapstorage->nodemap_storage.end());
}
//maybe it is number
int point_num=0;
Modified: glemon/trunk/new_map_win.h
==============================================================================
--- glemon/trunk/new_map_win.h (original)
+++ glemon/trunk/new_map_win.h Wed Feb 28 19:20:28 2007
@@ -19,14 +19,13 @@
#ifndef NEWMAPWIN_H
#define NEWMAPWIN_H
-class NewMapWin;
-
#include <all_include.h>
-#include <nbtab.h>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
#include <stack>
+class NoteBookTab;
+
///Graphical interface for node/edge map creation.
///This class is responsible for creating a window,
More information about the Lemon-commits
mailing list