summaryrefslogtreecommitdiff
path: root/js/Sinks/AFFICH_m.js
blob: 5121a006b13a31e0cd83742a5be7d937e3355ec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* autogenerated from "macros/Sinks/AFFICH_m.sci" */
function AFFICH_m() {
    AFFICH_m.prototype.define = function AFFICH_m() {
        this.font = 1;
        this.fontsize = 1;
        this.colr = 1;
        this.nt = 5;
        this.nd = 1;
        this.in1 = [1,1];
        this.model = scicos_model();
        this.model.sim = list("affich2",4);
        this.model.in1 = new ScilabDouble(this.in1[1-1][1-1]);
        this.model.in2 = new ScilabDouble(this.in1[1-1][2-1]);
        this.model.evtin = new ScilabDouble(1);
        this.model.dstate = [[-1],[0],[0],[1],[1],[0],[zeros(this.in1[1-1][1-1]*this.in1[1-1][2-1],1)]];
        this.model.ipar = [[this.font],[this.fontsize],[this.colr],[1000],[this.nt],[this.nd],[this.in1[1-1][1-1]]];
        this.model.blocktype = new ScilabString("c");
        this.model.firing = [];
        this.model.dep_ut = [true,false];
        this.model.label = new ScilabString("");
        exprs = [[sci2exp([this.model.in1,this.model.in2])],[string(this.font)],[string(this.fontsize)],[string(this.colr)],[string(this.nt)],[string(this.nd)],[string(0)]];
        gr_i = [];
        this.x = standard_define([3,2],this.model,exprs,gr_i);
        return new AfficheBlock(this.x);
    }
    AFFICH_m.prototype.details = function AFFICH_m() {
        return this.x;
    }
    AFFICH_m.prototype.get = function AFFICH_m() {
        var options = {
            in1:["Input Size",this.in1],
            font:["Font number",this.font],
            fontsize:["Font size",this.fontsize],
            colr:["Color",this.colr],
            nt:["Total number of digits",this.nt],
            nd:["Number of rational part digits",this.nd],
            herit:["Block inherits (1) or not (0)",this.herit],
        }
        return options;
    }
    AFFICH_m.prototype.set = function AFFICH_m() {
        this.in1 = inverse(arguments[0]["in1"])
        this.font = parseFloat(arguments[0]["font"])
        this.fontsize = parseFloat(arguments[0]["fontsize"])
        this.colr = parseFloat(arguments[0]["colr"])
        this.nt = parseFloat(arguments[0]["nt"])
        this.nd = parseFloat(arguments[0]["nd"])
        this.herit = arguments[0]["herit"]
        this.x = arg1;
        graphics = arg1.graphics;
        exprs = graphics.exprs;
        this.model = arg1.model;
        while (true) {
            [ok,this.in1,this.font,this.fontsize,this.colr,this.nt,this.nd,this.herit,exprs] = scicos_getvalue("Set  parameters",["Input Size","Font number","Font size","Color","Total number of digits","Number of rational part digits","Block inherits (1) or not (0)"],list("mat",[1,2],"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs);
            if (!ok) {
                break;
            }
            mess = [];
            if (this.font<=0) {
                mess = [[mess],["Font number must be positive"],[" "]];
                ok = false;
            }
            if (this.fontsize<=0) {
                mess = [[mess],["Font size must be positive"],[" "]];
                ok = false;
            }
            if (this.nt<=3) {
                mess = [[mess],["Total number of digits must be greater than 3"],[" "]];
                ok = false;
            }
            if (this.nd<0) {
                mess = [[mess],["Number of rational part digits must be ","greater or equal 0"],[" "]];
                ok = false;
            }
            if (!ok) {
                message([["Some specified values are inconsistent:"],[" "],[mess]]);
            }
            if (!or(this.herit==[0,1])) {
                mess = [[mess],["Accept inherited values are 0 and 1"],[" "]];
                ok = false;
            }
            if (!ok) {
                message([["Some specified values are inconsistent:"],[" "],[mess]]);
            }
            if (ok) {
                [model,graphics,ok] = set_io(this.model,graphics,list(this.in1,1),list(),ones(1-this.herit,1),[]);
            }
            if (ok) {
                this.model.ipar = [[this.font],[this.fontsize],[this.colr],[this.nt],[this.nd],[this.in1[1-1][1-1]]];
                this.model.dstate = [[-1],[0],[0],[1],[1],[0],[zeros(this.in1[1-1][1-1]*this.in1[1-1][2-1],1)]];
                this.model.evtin = new ScilabDouble(ones(1-this.herit,1));
                graphics.exprs = exprs;
                this.x.graphics = graphics;
                this.x.model = this.model;
                break;
            }
        }
        return new AfficheBlock(this.x);
    }
}