gdc-broken_edge.cc
changeset 151 72f1c33f89d4
parent 147 10ef59f6633c
child 152 d99e115d0d26
equal deleted inserted replaced
3:2465b34adaa4 4:1165d4860966
   153   line.property_fill_color_gdk().set_value(c);
   153   line.property_fill_color_gdk().set_value(c);
   154 }
   154 }
   155 
   155 
   156 GraphDisplayerCanvas::LoopEdge::LoopEdge(Gnome::Canvas::Group& _group,
   156 GraphDisplayerCanvas::LoopEdge::LoopEdge(Gnome::Canvas::Group& _group,
   157     Edge _edge, GraphDisplayerCanvas& _canvas) :
   157     Edge _edge, GraphDisplayerCanvas& _canvas) :
   158   EdgeBase(_group, _edge, _canvas), line(*this)
   158   EdgeBase(_group, _edge, _canvas), line(*this), isbutton(false)
   159 {
   159 {
   160   line.property_fill_color().set_value("green");
   160   arrow.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::LoopEdge::edgeFormerEventHandler));
   161   line.property_width_units().set_value(10);    
   161 
       
   162   line.property_outline_color().set_value("green");
       
   163   line.property_width_units().set_value(10);
   162   line.lower_to_bottom();
   164   line.lower_to_bottom();
   163 
   165 
   164   draw();
   166   draw();
   165 }
   167 }
   166 
   168 
   197   line.property_width_units().set_value(w);
   199   line.property_width_units().set_value(w);
   198 }
   200 }
   199 
   201 
   200 void GraphDisplayerCanvas::LoopEdge::setFillColor(Gdk::Color c)
   202 void GraphDisplayerCanvas::LoopEdge::setFillColor(Gdk::Color c)
   201 {
   203 {
   202   line.property_fill_color_gdk().set_value(c);
   204   line.property_outline_color_gdk().set_value(c);
   203 }
   205 }
       
   206 
       
   207 bool GraphDisplayerCanvas::LoopEdge::edgeFormerEventHandler(GdkEvent* e)
       
   208 {
       
   209   switch(e->type)
       
   210   {
       
   211     case GDK_BUTTON_PRESS:
       
   212       if(canvas.getActualTool()!=CREATE_NODE)
       
   213       {
       
   214         canvas.toggleEdgeActivity(this, true);
       
   215         isbutton=true;
       
   216       }
       
   217       break;
       
   218     case GDK_BUTTON_RELEASE:
       
   219       if(canvas.getActualTool()!=CREATE_NODE)
       
   220       {
       
   221         canvas.toggleEdgeActivity(this, false);
       
   222         isbutton=false;
       
   223       }
       
   224       break;
       
   225     case GDK_MOTION_NOTIFY:
       
   226       if(isbutton)
       
   227       {
       
   228         canvas.mytab.mapstorage.arrow_pos.set(edge, XY(e->motion.x, e->motion.y));
       
   229 
       
   230         draw();
       
   231         canvas.textReposition(canvas.mytab.mapstorage.arrow_pos[edge]);
       
   232       }
       
   233     default: break;
       
   234   }
       
   235   return true;
       
   236 }