Пример #1
0
 FL_EXPORT_C(void,flc_curve)(double X0,double Y0,double X1,double Y1,double X2,double Y2,double X3,double Y3){
   fl_curve(X0,Y0,X1,Y1,X2,Y2,X3,Y3);
 }
Пример #2
0
void Fl_Canvas::DrawWires()
{
        fl_line_style( FL_SOLID, 2 );

	for(vector<CanvasWire>::iterator i=m_WireVec.begin();
		i!=m_WireVec.end(); i++)
	{
		Fl_DeviceGUI* SourceDevice = FindDevice(i->OutputID);
		Fl_DeviceGUI* DestDevice   = FindDevice(i->InputID);

		if (!SourceDevice || !DestDevice)
		{
			SpiralInfo::Alert("Cant find source or dest device while drawing wires");
			return;
		}

         Fl_Color col = (Fl_Color) WIRE_COL0;
         switch (SourceDevice->GetPortType(i->OutputPort+SourceDevice->GetInfo()->NumInputs)) {
             case 0:     col = (Fl_Color) WIRE_COL0; break;
             case 1:     col = (Fl_Color) WIRE_COL1; break;
             case 2:     col = (Fl_Color) WIRE_COL2; break;
             case 3:     col = (Fl_Color) WIRE_COL3; break;
             case 4:     col = (Fl_Color) WIRE_COL4; break;
             default:    col = (Fl_Color) WIRE_COL0;
         }
         fl_color(col);

#ifdef NTK_MAJOR_VERSION
         fl_color( fl_color_add_alpha( fl_color(), 127 ) );
#endif

                double ep1_x, ep1_y, ep2_x, ep2_y,
                    ep1_mix_x,
                    ep1_new_x,
                    ep1_mid_x,
                    ep2_mid_x,
                    ep2_new_x,
                    ep1_mid_y,
                    ep2_mid_y;
                
                ep1_x = SourceDevice->GetPortX(i->OutputPort+SourceDevice->GetInfo()->NumInputs);
                
                ep1_y = SourceDevice->GetPortY(i->OutputPort+SourceDevice->GetInfo()->NumInputs);
                ep1_mid_y = ep1_y + 7.5;
                
                
                ep2_x = DestDevice->GetPortX(i->InputPort);
                ep2_y = DestDevice->GetPortY(i->InputPort);
                ep2_mid_y = 7.5 + ep2_y;
                
                ep1_mid_x = fabs(ep1_x-ep2_x)/2;
                ep1_new_x = ep1_x+ep1_mid_x;
                
                ep2_mid_x = fabs(ep1_x-ep2_x)/2;
                ep2_new_x = ep2_x-ep2_mid_x;
                
                fl_begin_line();
                
                fl_curve( ep1_x, ep1_y, ep1_new_x, ep1_mid_y, ep2_new_x, ep2_mid_y, ep2_x, ep2_y );
                
                fl_end_line();

		/* fl_line(SourceDevice->GetPortX(i->OutputPort+SourceDevice->GetInfo()->NumInputs), */
		/* 		SourceDevice->GetPortY(i->OutputPort+SourceDevice->GetInfo()->NumInputs), */
		/* 		DestDevice->GetPortX(i->InputPort), */
		/* 		DestDevice->GetPortY(i->InputPort)); */
	}

	DrawIncompleteWire();
        
        fl_line_style( FL_SOLID, 0 );
}