summaryrefslogtreecommitdiff
path: root/modules/graphics/macros/TitleLabel.sci
blob: 9438f9ae8d6f12205859bafc138d8d7bec08d495 (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
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2004-2006 - INRIA - Farid Belahcene
// 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 TitleLabel(varargin)
    // TITLELABEL function
    // is used by the functions title, xlabel, ylabel, zlabel

    [lhs,rhs]=argn(0);

    //CurColor = 0; // current color used if no color specified via LineSpec
    // nor PropertyName

    ListArg = varargin;
    titlelabel = ListArg(1);
    ListArg(1) = null(); // remove this parameter from the list

    //detect and set the current axes now:
    if type(ListArg(1)) == 9
        hdle = ListArg(1);
        if (hdle.type == "Axes")
            sca(ListArg(1));
            ListArg(1) = null(); // remove this parameter from the list
        else
            warning(msprintf(gettext("%s: Wrong type for input argument #%d: Axes handle expected.\n"),"TitleLabel",1));
            return;
        end
    end

    monaxe = gca();

    nv = size(ListArg);
    // detect and set the string now:
    if  type(ListArg(1))== 10 & modulo(nv,2) == 1 then
        st = ListArg(1);
        execstr("monaxe."+ titlelabel +".text"+"=st")
        ListArg(1) = null();
        nv=nv-1
    else
        error(msprintf(gettext("%s: Wrong size or type for input argument #%d: A string expected.\n"),"TitleLabel",1));
    end

    T=[];

    //given_data = 2;

    for k=1:nv
        T(k,1) = type(ListArg(k))
    end

    given_data = 0;
    P1 = 0;

    for i=1:nv
        if T(i) == 1
            given_data = given_data +1;
        else
            P1 = i;  // Position of the first PropertyName field
            break;
        end
    end


    // delay the drawing commands
    // smart drawlater
    current_figure=gcf();
    cur_draw_mode = current_figure.immediate_drawing;
    current_figure.immediate_drawing = "off";

    ///////////////////////////////////
    //Global Property treatment      //
    //PropertyName and PropertyValue //
    ///////////////////////////////////

    // P1 is the position of the first PropertyName field.
    Property = P1;

    current_titlelabel=get(monaxe,titlelabel)

    while ((Property <> 0) & (Property <= nv-1))
        setTitleLabelProperty(ListArg(Property),ListArg(Property+1),current_titlelabel,current_figure,cur_draw_mode)
        //setLabelProperty(ListArg(Property),ListArg(Property+1),monaxe.title,current_figure,cur_draw_mode)
        Property = Property+2;
    end

    //postponed drawings are done now !
    // smart drawnow
    ResetFigureDDM(current_figure, cur_draw_mode);


endfunction