23 GraphDisplayerCanvas::GraphDisplayerCanvas(NoteBookTab & mainw) : |
23 GraphDisplayerCanvas::GraphDisplayerCanvas(NoteBookTab & mainw) : |
24 nodesmap(mainw.mapstorage.graph), edgesmap(mainw.mapstorage.graph), edgetextmap(mainw.mapstorage.graph), |
24 nodesmap(mainw.mapstorage.graph), edgesmap(mainw.mapstorage.graph), edgetextmap(mainw.mapstorage.graph), |
25 nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0), |
25 nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0), |
26 isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""), |
26 isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""), |
27 edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10), |
27 edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10), |
28 was_redesigned(false), is_drawn(false), mytab(mainw) |
28 was_redesigned(false), is_drawn(false), mytab(mainw), |
|
29 background_set(false) |
29 { |
30 { |
30 //base event handler is move tool |
31 //base event handler is move tool |
31 actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false); |
32 actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false); |
32 actual_tool=MOVE; |
33 actual_tool=MOVE; |
33 |
34 |
34 active_node=INVALID; |
35 active_node=INVALID; |
35 active_edge=INVALID; |
36 active_edge=INVALID; |
36 forming_edge=INVALID; |
37 forming_edge=INVALID; |
|
38 |
|
39 setBackground(); |
|
40 } |
|
41 |
|
42 void GraphDisplayerCanvas::setBackground() |
|
43 { |
|
44 if (background_set) |
|
45 { |
|
46 delete background; |
|
47 } |
|
48 if (mytab.mapstorage.isBackgroundSet()) |
|
49 { |
|
50 background_set = true; |
|
51 refBackground = Gdk::Pixbuf::create_from_file( |
|
52 mytab.mapstorage.getBackgroundFilename()); |
|
53 background = new Gnome::Canvas::Pixbuf( |
|
54 *(root()), |
|
55 0.0 - refBackground->get_width() / 2.0, |
|
56 0.0 - refBackground->get_height() / 2.0, |
|
57 refBackground); |
|
58 background->lower_to_bottom(); |
|
59 } |
|
60 else |
|
61 { |
|
62 background_set = false; |
|
63 } |
37 } |
64 } |
38 |
65 |
39 GraphDisplayerCanvas::~GraphDisplayerCanvas() |
66 GraphDisplayerCanvas::~GraphDisplayerCanvas() |
40 { |
67 { |
41 for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n) |
68 for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n) |