graph_displayer_canvas.cc
changeset 184 4e8704aae278
parent 180 911c6ba0e3c8
child 187 b465e2c34f23
     1.1 --- a/graph_displayer_canvas.cc	Thu Dec 28 15:31:39 2006 +0000
     1.2 +++ b/graph_displayer_canvas.cc	Wed Jan 10 14:37:46 2007 +0000
     1.3 @@ -25,7 +25,8 @@
     1.4    nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0),
     1.5    isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""),
     1.6    edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10),
     1.7 -  was_redesigned(false), is_drawn(false), mytab(mainw)
     1.8 +  was_redesigned(false), is_drawn(false), mytab(mainw),
     1.9 +  background_set(false)
    1.10  {
    1.11    //base event handler is move tool
    1.12    actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
    1.13 @@ -34,6 +35,32 @@
    1.14    active_node=INVALID;
    1.15    active_edge=INVALID;
    1.16    forming_edge=INVALID;
    1.17 +
    1.18 +  setBackground();
    1.19 +}
    1.20 +
    1.21 +void GraphDisplayerCanvas::setBackground()
    1.22 +{
    1.23 +  if (background_set)
    1.24 +  {
    1.25 +    delete background;
    1.26 +  }
    1.27 +  if (mytab.mapstorage.isBackgroundSet())
    1.28 +  {
    1.29 +    background_set = true;
    1.30 +    refBackground = Gdk::Pixbuf::create_from_file(
    1.31 +      mytab.mapstorage.getBackgroundFilename());
    1.32 +    background = new Gnome::Canvas::Pixbuf(
    1.33 +        *(root()),
    1.34 +        0.0 - refBackground->get_width() / 2.0,
    1.35 +        0.0 - refBackground->get_height() / 2.0,
    1.36 +        refBackground);
    1.37 +    background->lower_to_bottom();
    1.38 +  }
    1.39 +  else
    1.40 +  {
    1.41 +    background_set = false;
    1.42 +  }
    1.43  }
    1.44  
    1.45  GraphDisplayerCanvas::~GraphDisplayerCanvas()