Refactoring of process classes in faustexp.ml.
[Faustine.git] / interpretor / faust-0.9.47mr3 / compiler / headers / blockSchema.h
1 /************************************************************************
2 ************************************************************************
3 FAUST compiler
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.
10
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.
15
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 ************************************************************************/
21
22 #ifndef __BLOCKSCHEMA__
23 #define __BLOCKSCHEMA__
24
25
26 #include "schema.h"
27 #include <vector>
28 #include <string>
29
30 /**
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
34 */
35 class blockSchema : public schema
36 {
37 protected:
38 const string fText; ///< Text to be displayed
39 const string fColor; ///< color of the box
40 const string fLink; ///< option URL link
41
42 // fields only defined after place() is called
43 vector<point> fInputPoint; ///< input connection points
44 vector<point> fOutputPoint; ///< output connection points
45
46
47 public:
48 friend schema* makeBlockSchema ( unsigned int inputs,
49 unsigned int outputs,
50 const string& name,
51 const string& color,
52 const string& link);
53
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;
58
59 protected:
60 blockSchema ( unsigned int inputs, unsigned int outputs,
61 double width, double height,
62 const string& name, const string& color,
63 const string& link);
64
65 void placeInputPoints();
66 void placeOutputPoints();
67
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);
73
74 void collectTraits(collector& c);
75 void collectInputWires(collector& c);
76 void collectOutputWires(collector& c);
77
78 };
79
80 #endif
81
82