FAUST compiler  0.9.9.6b8
Functions
blockSchema.cpp File Reference
#include "blockSchema.h"
#include <assert.h>
Include dependency graph for blockSchema.cpp:

Go to the source code of this file.

Functions

static double quantize (int n)
 
schemamakeBlockSchema (unsigned int inputs, unsigned int outputs, const string &text, const string &color, const string &link)
 Build a simple colored blockSchema with a certain number of inputs and outputs, a text to be displayed, and an optional link. More...
 

Function Documentation

schema* makeBlockSchema ( unsigned int  inputs,
unsigned int  outputs,
const string &  text,
const string &  color,
const string &  link 
)

Build a simple colored blockSchema with a certain number of inputs and outputs, a text to be displayed, and an optional link.

Computes the size of the box according to the length of the text and the maximum number of ports.

Definition at line 41 of file blockSchema.cpp.

References dHorz, dVert, dWire, max(), and quantize().

Referenced by generateBargraphSchema(), generateDiagramSchema(), generateInputSlotSchema(), generateInsideSchema(), generateOutputSlotSchema(), and generateUserInterfaceSchema().

46 {
47  // determine the optimal size of the box
48  double minimal = 3*dWire;
49  double w = 2*dHorz + max( minimal, quantize((int)text.size()) );
50  double h = 2*dVert + max( minimal, max(inputs, outputs) * dWire );
51 
52  return new blockSchema(inputs, outputs, w, h, text, color, link);
53 }
const double dWire
distance between two wires
Definition: schema.h:33
const double dVert
marge verticale
Definition: schema.h:37
double max(double x, double y)
Definition: interval.hh:60
static double quantize(int n)
Definition: blockSchema.cpp:28
A simple rectangular box with a text and inputs and outputs.
Definition: blockSchema.h:35
const double dHorz
marge horizontale
Definition: schema.h:36

Here is the call graph for this function:

Here is the caller graph for this function:

static double quantize ( int  n)
static

Definition at line 28 of file blockSchema.cpp.

References dLetter.

Referenced by makeBlockSchema().

29 {
30  int q = 3;
31  return dLetter * (q *((n+q-1)/q));
32 }
const double dLetter
width of a letter
Definition: schema.h:35

Here is the caller graph for this function: