[Lemon-commits] [lemon_svn] hegyi: r2368 - hugo/trunk/gui
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:52:06 CET 2006
Author: hegyi
Date: Mon Nov 21 13:07:05 2005
New Revision: 2368
Added:
hugo/trunk/gui/gdc-broken_edge.cc
- copied, changed from r2367, /hugo/trunk/gui/broken_edge.cc
hugo/trunk/gui/mw-mapselector.cc
- copied, changed from r2367, /hugo/trunk/gui/mapselector.cc
Removed:
hugo/trunk/gui/broken_edge.cc
hugo/trunk/gui/broken_edge.h
hugo/trunk/gui/mapselector.cc
hugo/trunk/gui/mapselector.h
Modified:
hugo/trunk/gui/Makefile.am
hugo/trunk/gui/graph_displayer_canvas-edge.cc
hugo/trunk/gui/graph_displayer_canvas-event.cc
hugo/trunk/gui/graph_displayer_canvas-node.cc
hugo/trunk/gui/graph_displayer_canvas-zoom.cc
hugo/trunk/gui/graph_displayer_canvas.cc
hugo/trunk/gui/graph_displayer_canvas.h
hugo/trunk/gui/map_win.h
hugo/trunk/gui/new_map_win.cc
Log:
Reorganizing.
Modified: hugo/trunk/gui/Makefile.am
==============================================================================
--- hugo/trunk/gui/Makefile.am (original)
+++ hugo/trunk/gui/Makefile.am Mon Nov 21 13:07:05 2005
@@ -15,20 +15,18 @@
graph_displayer_canvas-zoom.cc \
graph_displayer_canvas.h \
graph-displayer.cc \
+ gdc-broken_edge.cc \
main_win.cc \
main_win.h \
mapstorage.cc \
mapstorage.h \
map_win.cc \
map_win.h \
- broken_edge.cc \
- broken_edge.h \
+ mw-mapselector.cc \
new_map_win.cc \
new_map_win.h \
xymap.h \
- icons/guipixbufs.h\
- mapselector.h\
- mapselector.cc
+ icons/guipixbufs.h
glemon_CXXFLAGS = $(GTK_CFLAGS)
Copied: hugo/trunk/gui/gdc-broken_edge.cc (from r2367, /hugo/trunk/gui/broken_edge.cc)
==============================================================================
--- /hugo/trunk/gui/broken_edge.cc (original)
+++ hugo/trunk/gui/gdc-broken_edge.cc Mon Nov 21 13:07:05 2005
@@ -1,23 +1,23 @@
-#include "broken_edge.h"
+#include "graph_displayer_canvas.h"
#include <cmath>
-BrokenEdge::BrokenEdge(Gnome::Canvas::Group & g, Gnome::Canvas::Points p, GraphDisplayerCanvas & gc) : Line(g), gdc(gc), isbutton(false)
+GraphDisplayerCanvas::BrokenEdge::BrokenEdge(Gnome::Canvas::Group & g, Gnome::Canvas::Points p, GraphDisplayerCanvas & gc) : Line(g), gdc(gc), isbutton(false)
{
my_points=new Gnome::Art::Point[3];
arrow=new Gnome::Canvas::Polygon(g);
*arrow << Gnome::Canvas::Properties::fill_color("red");
- arrow->signal_event().connect(sigc::mem_fun(*this, &BrokenEdge::edgeFormerEventHandler));
+ arrow->signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::BrokenEdge::edgeFormerEventHandler));
arrow->lower_to_bottom();
setPoints(p);
}
-BrokenEdge::~BrokenEdge()
+GraphDisplayerCanvas::BrokenEdge::~BrokenEdge()
{
if(arrow)delete(arrow);
}
-void BrokenEdge::setPoints(Gnome::Canvas::Points p, bool move)
+void GraphDisplayerCanvas::BrokenEdge::setPoints(Gnome::Canvas::Points p, bool move)
{
bool set_arrow=false;
//red arrow losts its position-right button
@@ -155,7 +155,7 @@
}
}
-bool BrokenEdge::edgeFormerEventHandler(GdkEvent* e)
+bool GraphDisplayerCanvas::BrokenEdge::edgeFormerEventHandler(GdkEvent* e)
{
switch(e->type)
{
@@ -207,7 +207,7 @@
return true;
}
-xy<double> BrokenEdge::getArrowPos()
+xy<double> GraphDisplayerCanvas::BrokenEdge::getArrowPos()
{
xy<double> ret_val(my_points[1].get_x(),my_points[1].get_y());
return ret_val;
Modified: hugo/trunk/gui/graph_displayer_canvas-edge.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-edge.cc (original)
+++ hugo/trunk/gui/graph_displayer_canvas-edge.cc Mon Nov 21 13:07:05 2005
@@ -1,5 +1,4 @@
#include "graph_displayer_canvas.h"
-#include "broken_edge.h"
#include <cmath>
Modified: hugo/trunk/gui/graph_displayer_canvas-event.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-event.cc (original)
+++ hugo/trunk/gui/graph_displayer_canvas-event.cc Mon Nov 21 13:07:05 2005
@@ -1,5 +1,4 @@
#include "graph_displayer_canvas.h"
-#include "broken_edge.h"
#include <cmath>
Modified: hugo/trunk/gui/graph_displayer_canvas-node.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-node.cc (original)
+++ hugo/trunk/gui/graph_displayer_canvas-node.cc Mon Nov 21 13:07:05 2005
@@ -1,5 +1,4 @@
#include "graph_displayer_canvas.h"
-#include "broken_edge.h"
#include <cmath>
Modified: hugo/trunk/gui/graph_displayer_canvas-zoom.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-zoom.cc (original)
+++ hugo/trunk/gui/graph_displayer_canvas-zoom.cc Mon Nov 21 13:07:05 2005
@@ -1,5 +1,4 @@
#include "graph_displayer_canvas.h"
-#include "broken_edge.h"
#include <cmath>
void GraphDisplayerCanvas::zoomIn()
Modified: hugo/trunk/gui/graph_displayer_canvas.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas.cc (original)
+++ hugo/trunk/gui/graph_displayer_canvas.cc Mon Nov 21 13:07:05 2005
@@ -1,5 +1,4 @@
#include "graph_displayer_canvas.h"
-#include "broken_edge.h"
#include <cmath>
GraphDisplayerCanvas::GraphDisplayerCanvas(MapStorage & ms, MapWin & mw, Gtk::Window * mainwin) :
Modified: hugo/trunk/gui/graph_displayer_canvas.h
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas.h (original)
+++ hugo/trunk/gui/graph_displayer_canvas.h Mon Nov 21 13:07:05 2005
@@ -7,14 +7,36 @@
#include "all_include.h"
#include "mapstorage.h"
-#include "broken_edge.h"
#include "map_win.h"
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
+#include <lemon/xy.h>
///This class is the canvas, on which the graph can be drawn.
class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
{
+ class BrokenEdge : public Gnome::Canvas::Line
+ {
+ GraphDisplayerCanvas & gdc;
+ Gnome::Canvas::Polygon * arrow;
+ Gnome::Art::Point * my_points;
+
+
+ ///Indicates whether the button of mouse is pressed or not
+ bool isbutton;
+
+ ///At this location was the mousebutton pressed.
+ ///It helps to calculate the distance of dragging.
+ double clicked_x, clicked_y;
+
+ ///event handler for forming edges
+ bool edgeFormerEventHandler(GdkEvent*);
+ public:
+ BrokenEdge(Gnome::Canvas::Group &, Gnome::Canvas::Points, GraphDisplayerCanvas &);
+ ~BrokenEdge();
+ void setPoints(Gnome::Canvas::Points, bool move=false);
+ xy<double> getArrowPos();
+ };
typedef Gnome::Canvas::CanvasAA Parent;
public:
Modified: hugo/trunk/gui/map_win.h
==============================================================================
--- hugo/trunk/gui/map_win.h (original)
+++ hugo/trunk/gui/map_win.h Mon Nov 21 13:07:05 2005
@@ -9,7 +9,6 @@
#include "graph_displayer_canvas.h"
#include "mapstorage.h"
#include "new_map_win.h"
-#include "mapselector.h"
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
@@ -18,6 +17,61 @@
///assigned to maps.
class MapWin : public Gtk::Window
{
+
+ class MapSelector : public Gtk::HBox
+ {
+ protected:
+ GraphDisplayerCanvas & gdc;
+ ///The \ref MapStorage in which the visualizable maps are stored
+ MapStorage & ms;
+ NewMapWin & nmw;
+
+ int id;
+
+ bool itisedge;
+
+ bool default_state;
+
+ bool set_new_map;
+
+ Gtk::ComboBoxText cbt;
+
+ Gtk::Button * newbut, * defbut;
+
+ Gtk::HBox hbox;
+
+ Gtk::Label * label;
+
+ Node node_to_update;
+ Edge edge_to_update;
+
+
+ public:
+
+ MapSelector(GraphDisplayerCanvas &, MapStorage &, NewMapWin &, int, bool);
+
+ void update_list();
+
+ ///If a radiobutton is clicked, this function determines
+ ///which button was that and after that calls the
+ ///appropriate function of the \ref GraphDisplayerCanvas
+ ///to change the visible values of that attribute.
+ virtual void comboChanged();
+
+ virtual void new_but_pressed();
+
+ virtual void reset();
+
+ virtual void update(Node node);
+ virtual void update(Edge edge);
+
+ Glib::ustring get_active_text();
+ void set_active_text(Glib::ustring);
+ void append_text(Glib::ustring);
+ };
+
+
+
protected:
///The \ref GraphDisplayerCanvas on which the graph will be drawn.
///It has to be known for this class, because
Copied: hugo/trunk/gui/mw-mapselector.cc (from r2367, /hugo/trunk/gui/mapselector.cc)
==============================================================================
--- /hugo/trunk/gui/mapselector.cc (original)
+++ hugo/trunk/gui/mw-mapselector.cc Mon Nov 21 13:07:05 2005
@@ -1,6 +1,6 @@
-#include "mapselector.h"
+#include "map_win.h"
-MapSelector::MapSelector(GraphDisplayerCanvas & grdispc, MapStorage & mapst, NewMapWin & newmapw, int identifier, bool edge):gdc(grdispc),ms(mapst),nmw(newmapw),id(identifier),itisedge(edge),default_state(true),set_new_map(false),node_to_update(INVALID),edge_to_update(INVALID)
+MapWin::MapSelector::MapSelector(GraphDisplayerCanvas & grdispc, MapStorage & mapst, NewMapWin & newmapw, int identifier, bool edge):gdc(grdispc),ms(mapst),nmw(newmapw),id(identifier),itisedge(edge),default_state(true),set_new_map(false),node_to_update(INVALID),edge_to_update(INVALID)
{
update_list();
@@ -9,7 +9,7 @@
//binding signal to the actual entry
cbt.signal_changed().connect
(
- sigc::mem_fun((*this), &MapSelector::comboChanged),
+ sigc::mem_fun((*this), &MapWin::MapSelector::comboChanged),
false
);
@@ -29,14 +29,14 @@
defbut->signal_pressed().connect
(
- sigc::mem_fun(*this, &MapSelector::reset)
+ sigc::mem_fun(*this, &MapWin::MapSelector::reset)
);
newbut=new Gtk::Button(Gtk::Stock::NEW);
newbut->signal_pressed().connect
(
- sigc::mem_fun(*this, &MapSelector::new_but_pressed)
+ sigc::mem_fun(*this, &MapWin::MapSelector::new_but_pressed)
);
add(*label);
@@ -47,13 +47,13 @@
add(*newbut);
}
-void MapSelector::new_but_pressed()
+void MapWin::MapSelector::new_but_pressed()
{
set_new_map=true;
nmw.showByPreChoose(itisedge);
}
-void MapSelector::update_list()
+void MapWin::MapSelector::update_list()
{
cbt.clear();
if(itisedge)
@@ -75,7 +75,7 @@
cbt.prepend_text("Default values");
}
-void MapSelector::comboChanged()
+void MapWin::MapSelector::comboChanged()
{
if(cbt.get_active_row_number()!=0)
{
@@ -133,7 +133,7 @@
}
}
-void MapSelector::reset()
+void MapWin::MapSelector::reset()
{
default_state=true;
cbt.set_active(0);
@@ -176,7 +176,7 @@
}
}
-void MapSelector::update(Node node)
+void MapWin::MapSelector::update(Node node)
{
node_to_update=node;
if(default_state)
@@ -190,7 +190,7 @@
node_to_update=INVALID;
}
-void MapSelector::update(Edge edge)
+void MapWin::MapSelector::update(Edge edge)
{
edge_to_update=edge;
if(default_state)
@@ -204,17 +204,17 @@
edge_to_update=INVALID;
}
-Glib::ustring MapSelector::get_active_text()
+Glib::ustring MapWin::MapSelector::get_active_text()
{
return cbt.get_active_text();
}
-void MapSelector::set_active_text(Glib::ustring text)
+void MapWin::MapSelector::set_active_text(Glib::ustring text)
{
cbt.set_active_text(text);
}
-void MapSelector::append_text(Glib::ustring text)
+void MapWin::MapSelector::append_text(Glib::ustring text)
{
cbt.append_text(text);
if(set_new_map)
Modified: hugo/trunk/gui/new_map_win.cc
==============================================================================
--- hugo/trunk/gui/new_map_win.cc (original)
+++ hugo/trunk/gui/new_map_win.cc Mon Nov 21 13:07:05 2005
@@ -318,8 +318,8 @@
{
unsigned int pr=10000;
bool prevmult=false;
- unsigned int prev_change;
- unsigned int prev_br=10000;
+ unsigned int prev_change=pr;
+ unsigned int prev_br=pr;
int counter=0;
std::string comm_nobr="";
std::vector<unsigned int> p;
@@ -392,7 +392,7 @@
NewMapWin::tree_node * NewMapWin::weightedString2Tree(std::string to_tree, std::vector<unsigned int> & p, int offset)
{
- int min=p[offset];
+ unsigned int min=p[offset];
int minplace=0;
for(int i=0;i<(int)to_tree.size();i++)
{
More information about the Lemon-commits
mailing list