COIN-OR::LEMON - Graph Library

Changeset 184:4e8704aae278 in glemon-0.x for graph_displayer_canvas.cc


Ignore:
Timestamp:
01/10/07 15:37:46 (17 years ago)
Author:
Akos Ladanyi
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3125
Message:

Added support for setting the background form an image file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • graph_displayer_canvas.cc

    r180 r184  
    2626  isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""),
    2727  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)
    2930{
    3031  //base event handler is move tool
     
    3536  active_edge=INVALID;
    3637  forming_edge=INVALID;
     38
     39  setBackground();
     40}
     41
     42void 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  }
    3764}
    3865
Note: See TracChangeset for help on using the changeset viewer.