summaryrefslogtreecommitdiff
path: root/modules/compatibility_functions/macros/mtlb_grid.sci
blob: 62884a5e25e0569ba7836cd82212728a04911feb (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
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2002-2004 - INRIA - Vincent COUVERT
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt

function mtlb_grid(arg1,arg2)
    // Emulation function for Matlab grid

    rhs=argn(2)
    if rhs<=0 then // toggle
        a=gca();
        if and(a.grid==[-1 -1]) then
            a.grid=[1 1]
        else
            a.grid=[-1 -1]
        end
    elseif rhs==1 then
        if type(arg1)==9 then // toggle
            if and(arg1.grid==[-1 -1]) then
                arg1.grid=[1 1]
            else
                arg1.grid=[-1 -1]
            end
        else
            a=gca();
            if arg1=="on" then
                a.grid=[1 1]
            elseif arg1=="off" then
                a.grid=[-1 -1]
            elseif arg1=="minor" then
                warning(msprintf(gettext("%s: No minor grid in Scilab.\n"), "mtlb_grid"));
                if and(a.grid==[-1 -1]) then
                    a.grid=[1 1]
                else
                    a.grid=[-1 -1]
                end
            else
                error(msprintf(gettext("%s: Wrong value for input argument #%d: ''%s'', ''%s'' or ''%s'' expected.\n"), "mtlb_grid", 1, "on", "off", "minor"));
            end
        end
    elseif rhs==2 then
        if arg2=="on" then
            arg1.grid=[1 1]
        elseif arg2=="off" then
            arg1.grid=[-1 -1]
        elseif arg2=="minor" then
            warning(msprintf(gettext("%s: No minor grid in Scilab.\n"), "mtlb_grid"));
            if and(arg1.grid==[-1 -1]) then
                arg1.grid=[1 1]
            else
                arg1.grid=[-1 -1]
            end
        else
            error(msprintf(gettext("%s: Wrong value for input argument #%d: ''%s'', ''%s'' or ''%s'' expected.\n"), "mtlb_grid", 2, "on", "off", "minor"));
        end
    end
endfunction