Subversion Repositories Kolibri OS

Rev

Rev 9050 | Rev 9073 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9050 Rev 9060
Line 1... Line 1...
1
(*
1
(*
2
    Copyright 2021 Anton Krotov
2
    Copyright 2021 Anton Krotov
Line 3... Line 3...
3
 
3
 
Line 4... Line 4...
4
    This file is part of CEdit.
4
    This file is part of CEdit.
Line 24... Line 24...
24
CONST
24
CONST
Line 25... Line 25...
25
 
25
 
26
    btnID* = 100;
26
    btnID* = 100;
27
    tabHeight* = 22;
27
    tabHeight* = 22;
-
 
28
    curTabHeight = 26;
Line 28... Line 29...
28
    curTabHeight = 26;
29
    scrWidth = 10;
Line 29... Line 30...
29
 
30
 
Line 46... Line 47...
46
    END;
47
    END;
Line 47... Line 48...
47
 
48
 
48
 
49
 
49
PROCEDURE drawTab (t: tTabs; id, x, y, width, height: INTEGER; s: ARRAY OF CHAR);
50
PROCEDURE drawTab (t: tTabs; id, x, y, width, height: INTEGER; s: ARRAY OF CHAR);
50
VAR
51
VAR
51
    x2, y2: INTEGER;
52
    x2, y2, color: INTEGER;
52
BEGIN
53
BEGIN
53
    IF id = t.current THEN
54
    IF id = t.current THEN
-
 
55
        INC(height, curTabHeight - tabHeight);
-
 
56
        DEC(y, curTabHeight - tabHeight);
-
 
57
        (*color := K.lightColor
54
        INC(height, curTabHeight - tabHeight);
58
    ELSE
-
 
59
        color := K.darkColor*)
-
 
60
    END;
55
        DEC(y, curTabHeight - tabHeight)
61
    color := K.winColor;
56
    END;
62
    DEC(x); INC(width);
-
 
63
    x2 := x + width - 1;
57
    x2 := x + width - 1;
64
    y2 := y + height - 1;
58
    y2 := y + height - 1;
65
 
59
    K.DrawRect(x, y, width, height, K.winColor);
66
    K.DrawRect(x, y, width, height,color);
-
 
67
    K.DrawLine(x, y, x2, y, K.borderColor);
60
    K.DrawLine(x, y, x2, y, K.borderColor);
68
    K.DrawLine(x2, y, x2, y2, K.borderColor);
-
 
69
    IF id # t.current THEN
61
    K.DrawLine(x2, y, x2, y2, K.borderColor);
70
        K.DrawLine(x2 - 1, y2, x, y2, K.borderColor);
62
    K.DrawLine(x2, y2, x, y2, K.borderColor);
71
    END;
63
    K.DrawLine(x, y2, x, y, K.borderColor);
72
    K.DrawLine(x, y2, x, y, K.borderColor);
64
    K.DrawText866bk(x + K.fontWidth, y + (height - K.fontHeight) DIV 2, K.textColor, K.winColor, s);
73
    K.DrawText866bk(x + K.fontWidth, y + (height - K.fontHeight) DIV 2, K.textColor, color, s);
Line 65... Line 74...
65
    K.CreateButton(id + ORD({30}) + btnID, x, y - 1, width, height - 1, K.winColor, "");
74
    K.CreateButton(id + ORD({30}) + btnID, x, y - 1, width, height - 1, color, "");
66
END drawTab;
75
END drawTab;
Line 87... Line 96...
87
    RETURN res
96
    RETURN res
88
END Width;
97
END Width;
Line 89... Line 98...
89
 
98
 
90
 
-
 
91
PROCEDURE draw* (t: tTabs);
-
 
92
CONST
99
 
93
    scrWidth = 10;
100
PROCEDURE draw* (t: tTabs);
94
VAR
101
VAR
-
 
102
    x, y, xmax, n, width: INTEGER;
95
    x, y, xmax, n, width: INTEGER;
103
    item: List.tItem;
96
    item: List.tItem;
104
    scroll: BOOLEAN;
97
BEGIN
105
BEGIN
98
    y := t.y;
106
    y := t.y;
99
    x := t.x;
107
    x := t.x;
100
    K.DrawRect(x, y - (curTabHeight - tabHeight), t.width + 2*scrWidth, t.height + (curTabHeight - tabHeight), K.winColor);
108
    K.DrawRect(x, y - (curTabHeight - tabHeight), t.width + 2*scrWidth, t.height + (curTabHeight - tabHeight) - 1, K.winColor);
101
    IF Width(t, 0, t.strings.count - 1) > t.width THEN
109
    IF Width(t, 0, t.strings.count - 1) > t.width THEN
102
        INC(x, 2*scrWidth);
110
        INC(x, 2*scrWidth);
-
 
111
        K.CreateButton(btnID - 1, t.x, t.y, scrWidth, t.height - 1, K.btnColor, "<");
103
        K.CreateButton(btnID - 1, t.x, t.y, scrWidth, t.height - 1, K.btnColor, "<");
112
        K.CreateButton(btnID - 2, t.x + scrWidth, t.y, scrWidth, t.height - 1, K.btnColor, ">");
104
        K.CreateButton(btnID - 2, t.x + scrWidth, t.y, scrWidth, t.height - 1, K.btnColor, ">")
113
        scroll := TRUE
-
 
114
    ELSE
105
    ELSE
115
        t.first := 0;
106
        t.first := 0
116
        scroll := FALSE
Line 107... Line 117...
107
    END;
117
    END;
108
    xmax := x + t.width - 1;
118
    xmax := x + t.width - 1;
Line 118... Line 128...
118
    END;
128
    END;
119
    IF n < t.first THEN
129
    IF n < t.first THEN
120
        t.first := n
130
        t.first := n
121
    END;
131
    END;
Line 122... Line 132...
122
 
132
 
-
 
133
    K.DrawRect(x, y, t.width, t.height - 1, K.winColor);
123
    K.DrawRect(x, y, t.width, t.height, K.winColor);
134
    K.DrawLine(x, y + tabHeight - 1, x + t.width - 1 + 2*scrWidth*(1 - ORD(scroll)), y + tabHeight - 1, K.borderColor);
124
    item := List.getItem(t.strings, t.first);
135
    item := List.getItem(t.strings, t.first);
125
    n := t.first;
136
    n := t.first;
126
    WHILE (item # NIL) & (x <= xmax) DO
137
    WHILE (item # NIL) & (x <= xmax) DO
127
        width := tabWidth(item(tItem));
138
        width := tabWidth(item(tItem));
128
        IF x + width - 1 <= xmax THEN
139
        IF x + width - 1 <= xmax THEN
129
            drawTab(t, n, x, y, width, t.height, item(tItem).val)
140
            drawTab(t, n, x + 1, y, width, t.height, item(tItem).val)
130
        END;
141
        END;
131
        INC(n);
142
        INC(n);
132
        INC(x, width);
143
        INC(x, width);
133
        item := item.next
144
        item := item.next
Line 193... Line 204...
193
 
204
 
194
PROCEDURE setArea* (t: tTabs; x, y, width, height: INTEGER);
205
PROCEDURE setArea* (t: tTabs; x, y, width, height: INTEGER);
195
BEGIN
206
BEGIN
196
    t.x := x;
207
    t.x := x;
197
    t.y := y;
208
    t.y := y;
198
    t.width := width;
209
    t.width := width - 2*scrWidth;
199
    t.height := height
210
    t.height := height
Line 200... Line 211...
200
END setArea;
211
END setArea;