1 /************************************************************************
2 ************************************************************************
4 Copyright (C) 2003-2004 GRAME, Centre National de Creation Musicale
5 ---------------------------------------------------------------------
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 ************************************************************************
20 ************************************************************************/
22 #ifndef __BLOCKSCHEMA__
23 #define __BLOCKSCHEMA__
31 * A simple rectangular box with a text and inputs and outputs.
32 * The constructor is private in order to make sure
33 * makeBlockSchema is used instead
35 class blockSchema
: public schema
38 const string fText
; ///< Text to be displayed
39 const string fColor
; ///< color of the box
40 const string fLink
; ///< option URL link
42 // fields only defined after place() is called
43 vector
<point
> fInputPoint
; ///< input connection points
44 vector
<point
> fOutputPoint
; ///< output connection points
48 friend schema
* makeBlockSchema ( unsigned int inputs
,
54 virtual void place(double x
, double y
, int orientation
);
55 virtual void draw(device
& dev
);
56 virtual point
inputPoint(unsigned int i
) const;
57 virtual point
outputPoint(unsigned int i
) const;
60 blockSchema ( unsigned int inputs
, unsigned int outputs
,
61 double width
, double height
,
62 const string
& name
, const string
& color
,
65 void placeInputPoints();
66 void placeOutputPoints();
68 void drawRectangle(device
& dev
);
69 void drawText(device
& dev
);
70 void drawOrientationMark(device
& dev
);
71 void drawInputWires(device
& dev
);
72 void drawOutputWires(device
& dev
);
74 void collectTraits(collector
& c
);
75 void collectInputWires(collector
& c
);
76 void collectOutputWires(collector
& c
);