Subversion Repositories Kolibri OS

Rev

Rev 4813 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4813 Rev 6253
1
struct new_button
1
struct new_button
2
    x       dw ?
2
    x       dw ?
3
    y       dw ?
3
    y       dw ?
4
    w       dw ?
4
    w       dw ?
5
    h       dw ?
5
    h       dw ?
6
    f       dw ?
6
    f       dw ?
7
    face    dd ?
7
    face    dd ?
8
    frame   dd ?
8
    frame   dd ?
9
    event   dd ?
9
    event   dd ?
10
ends
10
ends
11
 
11
 
12
button_event_next:
12
button_event_next:
13
    pusha
13
    pusha
14
    mov    eax,[edit_cnt]
14
    mov    eax,[edit_cnt]
15
    cmp    eax,4
15
    cmp    eax,4
16
    je     @f
16
    je     @f
17
    inc    eax
17
    inc    eax
18
    jmp    ben_exit
18
    jmp    ben_exit
19
  @@:
19
  @@:
20
    mov    eax,1
20
    mov    eax,1
21
  ben_exit:
21
  ben_exit:
22
    mov    [edit_cnt],eax
22
    mov    [edit_cnt],eax
23
    call    draw_edit
23
    call    draw_edit
24
    call    list_draw
24
    call    list_draw
25
    popa
25
    popa
26
    ret
26
    ret
27
 
27
 
28
button_event_back:
28
button_event_back:
29
    pusha
29
    pusha
30
    mov    eax,[edit_cnt]
30
    mov    eax,[edit_cnt]
31
    cmp    eax,1
31
    cmp    eax,1
32
    je     @f
32
    je     @f
33
    dec    eax
33
    dec    eax
34
    jmp    ben_exit
34
    jmp    ben_exit
35
  @@:
35
  @@:
36
    mov    eax,4
36
    mov    eax,4
37
  beb_exit:
37
  beb_exit:
38
    mov    [edit_cnt],eax
38
    mov    [edit_cnt],eax
39
    call    draw_edit
39
    call    draw_edit
40
    call    list_draw
40
    call    list_draw
41
    popa
41
    popa
42
    ret
42
    ret
43
 
43
 
44
 
44
 
45
button_init:
45
button_init:
46
    ;;  nex init ------------
46
    ;;  nex init ------------
47
    mov     ax, 36
47
    mov     ax, 36
48
    mov     [bnext.x],ax
48
    mov     [bnext.x],ax
49
    mov     ax, 8
49
    mov     ax, 8
50
    mov     [bnext.y],ax
50
    mov     [bnext.y],ax
51
    mov     ax, 26
51
    mov     ax, 26
52
    mov     [bnext.w],ax
52
    mov     [bnext.w],ax
53
    mov     ax, 19
53
    mov     ax, 19
54
    mov     [bnext.h],ax
54
    mov     [bnext.h],ax
55
    mov     ax, 0
55
    mov     ax, 0
56
    mov     [bnext.f],ax
56
    mov     [bnext.f],ax
57
    mov     eax,[sc.btn_face]
57
    mov     eax,[sc.btn_face]
58
    mov     [bnext.face],eax
58
    mov     [bnext.face],eax
59
    mov     eax,[sc.btn_frame]
59
    mov     eax,[sc.btn_frame]
60
    mov     [bnext.frame],eax
60
    mov     [bnext.frame],eax
61
    mov     eax,button_event_next
61
    mov     eax,button_event_next
62
    mov     [bnext.event],eax
62
    mov     [bnext.event],eax
63
 
63
 
64
    mov     ax, 7
64
    mov     ax, 7
65
    mov     [bback.x],ax
65
    mov     [bback.x],ax
66
    mov     ax, 8
66
    mov     ax, 8
67
    mov     [bback.y],ax
67
    mov     [bback.y],ax
68
    mov     ax, 26
68
    mov     ax, 26
69
    mov     [bback.w],ax
69
    mov     [bback.w],ax
70
    mov     ax, 19
70
    mov     ax, 19
71
    mov     [bback.h],ax
71
    mov     [bback.h],ax
72
    mov     ax, 0
72
    mov     ax, 0
73
    mov     [bback.f],ax
73
    mov     [bback.f],ax
74
    mov     eax,[sc.btn_face]
74
    mov     eax,[sc.btn_face]
75
    mov     [bback.face],eax
75
    mov     [bback.face],eax
76
    mov     eax,[sc.btn_frame]
76
    mov     eax,[sc.btn_frame]
77
    mov     [bback.frame],eax
77
    mov     [bback.frame],eax
78
    mov     eax,button_event_back
78
    mov     eax,button_event_back
79
    mov     [bback.event],eax
79
    mov     [bback.event],eax
80
    ret
80
    ret
81
 
81
 
82
button_calc:
82
button_calc:
83
    mov     eax, bnext
83
    mov     eax, bnext
84
    call    button_focus
84
    call    button_focus
85
    mov     eax, bback
85
    mov     eax, bback
86
    call    button_focus
86
    call    button_focus
87
    ret
87
    ret
88
 
88
 
89
button_focus:
89
button_focus:
90
    pusha
90
    pusha
91
    xor     ecx,ecx
91
    xor     ecx,ecx
92
    xor     ebx,ebx
92
    xor     ebx,ebx
93
    mov     edi,[mouse_x]
93
    mov     edi,[mouse_x]
94
    mov     bx, word [eax]
94
    mov     bx, word [eax]
95
    cmp     ebx,edi
95
    cmp     ebx,edi
96
    jg      button_focus_out
96
    jg      button_focus_out
97
    add     bx, word [eax + 4]
97
    add     bx, word [eax + 4]
98
    cmp     ebx,edi
98
    cmp     ebx,edi
99
    jb      button_focus_out
99
    jb      button_focus_out
100
    mov     edi,[mouse_y]
100
    mov     edi,[mouse_y]
101
    mov     bx,[eax + 2]
101
    mov     bx,[eax + 2]
102
    cmp     ebx,edi
102
    cmp     ebx,edi
103
    jg      button_focus_out
103
    jg      button_focus_out
104
    add     bx,[eax + 6]
104
    add     bx,[eax + 6]
105
    cmp     ebx,edi
105
    cmp     ebx,edi
106
    jb      button_focus_out
106
    jb      button_focus_out
107
    ;----
107
    ;----
108
    push    eax
108
    push    eax
109
    call    mouse_left
109
    call    mouse_left
110
    mov     ecx,[mouse_l]
110
    mov     ecx,[mouse_l]
111
    cmp     ecx,0
111
    cmp     ecx,0
112
    je      button_focus_set
112
    je      button_focus_set
113
    xor     ecx,ecx
113
    xor     ecx,ecx
114
    mov     [mouse_l],ecx
114
    mov     [mouse_l],ecx
115
    call    dword [eax+18]
115
    call    dword [eax+18]
116
    
116
    
117
  button_focus_set:
117
  button_focus_set:
118
    pop     eax
118
    pop     eax
119
    ;----
119
    ;----
120
    mov     ecx,1
120
    mov     ecx,1
121
  button_focus_out:
121
  button_focus_out:
122
    mov     word [eax + 8],cx
122
    mov     word [eax + 8],cx
123
    popa
123
    popa
124
    ret
124
    ret
125
 
125
 
126
button_draw:
126
button_draw:
127
    mov     eax, bnext
127
    mov     eax, bnext
128
    call    button_draw_all
128
    call    button_draw_all
129
    mov     eax, bback
129
    mov     eax, bback
130
    call    button_draw_all
130
    call    button_draw_all
131
    ; arrow
131
    ; arrow
132
    pusha
132
    pusha
133
    mov     eax , 7
-
 
134
    mov     ebx , arrowa
-
 
135
    mov     ecx , 6 shl 16 + 10
133
    mov	ecx,[sc.btn_text]
136
    mov     edx , 46 shl 16 + 13
-
 
137
    int     0x40
134
    or	ecx,0x90000000
138
    mov     ebx , arrowb
135
    mcall	4,<15,11>, ,arrowa
139
    mov     edx , 17 shl 16 + 13
136
    mcall	 ,<45,11>, ,arrowb
140
    int     0x40
-
 
141
    popa
137
    popa
142
    ret
138
    ret
143
 
139
 
144
button_draw_all:
140
button_draw_all:
145
    pusha
141
    pusha
146
    mov     ebx,[win_slot]
142
    mov     ebx,[win_slot]
147
    cmp     ebx,1
143
    cmp     ebx,1
148
    je      @f
144
    je      @f
149
    mov     ebx,[sc.btn_inface]
145
    mov     ebx,[sc.btn_inface]
150
    mov     dword [eax + 10],ebx
146
    mov     dword [eax + 10],ebx
151
    mov     ebx,[sc.btn_inframe]
147
    mov     ebx,[sc.btn_inframe]
152
    mov     dword [eax + 14],ebx
148
    mov     dword [eax + 14],ebx
153
    jmp     button_draw_run
149
    jmp     button_draw_run
154
  @@: ;act
150
  @@: ;act
155
    xor     ebx,ebx
151
    xor     ebx,ebx
156
    mov     bx,word [eax + 8]
152
    mov     bx,word [eax + 8]
157
    cmp     ebx,1
153
    cmp     ebx,1
158
    je      @f
154
    je      @f
159
    mov     ebx,[sc.btn_face]
155
    mov     ebx,[sc.btn_face]
160
    mov     dword [eax + 10],ebx
156
    mov     dword [eax + 10],ebx
161
    mov     ebx,[sc.btn_frame]
157
    mov     ebx,[sc.btn_frame]
162
    mov     dword [eax + 14],ebx
158
    mov     dword [eax + 14],ebx
163
    jmp     button_draw_run
159
    jmp     button_draw_run
164
  @@: ; foc
160
  @@: ; foc
165
    mov     ebx,[sc.btn_fcface]
161
    mov     ebx,[sc.btn_fcface]
166
    mov     dword [eax + 10],ebx
162
    mov     dword [eax + 10],ebx
167
    mov     ebx,[sc.btn_fcframe]
163
    mov     ebx,[sc.btn_fcframe]
168
    mov     dword [eax + 14],ebx
164
    mov     dword [eax + 14],ebx
169
 
165
 
170
  button_draw_run:
166
  button_draw_run:
171
 
167
 
172
    ; ïðÿìîóãîëüíûé ôîí
168
    ; ïðÿìîóãîëüíûé ôîí
173
    mov     bx, word [eax]         ; x
169
    mov     bx, word [eax]         ; x
174
    add     bx, 2                  ; x+2
170
    add     bx, 2                  ; x+2
175
    shl     ebx,16
171
    shl     ebx,16
176
    mov     bx, word [eax+4]       ; w
172
    mov     bx, word [eax+4]       ; w
177
    sub     bx, 4                  ; w-4
173
    sub     bx, 4                  ; w-4
178
    mov     cx, word [eax+2]       ; y
174
    mov     cx, word [eax+2]       ; y
179
    add     cx,2                   ; y+2
175
    add     cx,2                   ; y+2
180
    shl     ecx,16
176
    shl     ecx,16
181
    mov     cx, word [eax+6]       ; h
177
    mov     cx, word [eax+6]       ; h
182
    sub     cx, 4                  ; h-4
178
    sub     cx, 4                  ; h-4
183
    mov     edx, dword [eax + 10]  ; color
179
    mov     edx, dword [eax + 10]  ; color
184
    push    eax
180
    push    eax
185
    mov     eax, 13                ; rect
181
    mov     eax, 13                ; rect
186
    int     0x40                   ; draw
182
    int     0x40                   ; draw
187
    pop     eax
183
    pop     eax
188
 
184
 
189
    ; âåðõíÿÿ ëèíèÿ [frame]
185
    ; âåðõíÿÿ ëèíèÿ [frame]
190
    mov     edx, dword [eax + 14]  ; color
186
    mov     edx, dword [eax + 14]  ; color
191
    mov     bx, word [eax]         ; x
187
    mov     bx, word [eax]         ; x
192
    inc     bx                     ; x+1
188
    inc     bx                     ; x+1
193
    shl     ebx,16
189
    shl     ebx,16
194
    mov     bx, word [eax]         ; x2=x
190
    mov     bx, word [eax]         ; x2=x
195
    add     bx, word [eax + 4]     ; x2=x+w
191
    add     bx, word [eax + 4]     ; x2=x+w
196
    sub     bx,2                   ; x2=x2-2
192
    sub     bx,2                   ; x2=x2-2
197
    mov     cx, word [eax + 2]     ; y
193
    mov     cx, word [eax + 2]     ; y
198
    shl     ecx,16
194
    shl     ecx,16
199
    mov     cx, word [eax + 2]     ; y2=y
195
    mov     cx, word [eax + 2]     ; y2=y
200
    push    eax
196
    push    eax
201
    mov     eax, 38                ; line
197
    mov     eax, 38                ; line
202
    int     0x40                   ; draw
198
    int     0x40                   ; draw
203
    ; âåðõíÿÿ ëèíèÿ [3d]
199
    ; âåðõíÿÿ ëèíèÿ [3d]
204
    mov     edx, [sc.3d_light]     ; color
200
    mov     edx, [sc.3d_light]     ; color
205
    add     ecx, 1 shl 16 + 1      ; y=y+1 y2=y2+1
201
    add     ecx, 1 shl 16 + 1      ; y=y+1 y2=y2+1
206
    int     0x40                   ; draw
202
    int     0x40                   ; draw
207
    pop     eax
203
    pop     eax
208
 
204
 
209
    ; íèæíÿÿ ëèíèÿ [frame]
205
    ; íèæíÿÿ ëèíèÿ [frame]
210
 
206
 
211
    mov     cx, word [eax + 2]     ; y
207
    mov     cx, word [eax + 2]     ; y
212
    add     cx, word [eax + 6]     ; y = y+h
208
    add     cx, word [eax + 6]     ; y = y+h
213
    push    cx
209
    push    cx
214
    shl     ecx,16
210
    shl     ecx,16
215
    pop     cx
211
    pop     cx
216
    sub     ecx, 1 shl 16 + 1      ; y=y+1 y2=y2+1
212
    sub     ecx, 1 shl 16 + 1      ; y=y+1 y2=y2+1
217
    mov     edx, dword [eax + 14]  ; color
213
    mov     edx, dword [eax + 14]  ; color
218
    push    eax
214
    push    eax
219
    mov     eax, 38                ; line
215
    mov     eax, 38                ; line
220
    int     0x40                   ; draw
216
    int     0x40                   ; draw
221
    ; íèæíÿÿ ëèíèÿ [3d]
217
    ; íèæíÿÿ ëèíèÿ [3d]
222
    sub     ebx, 1 shl 16          ; x = x-1
218
    sub     ebx, 1 shl 16          ; x = x-1
223
    mov     edx, [sc.3d_dark]      ; color
219
    mov     edx, [sc.3d_dark]      ; color
224
    sub     ecx, 1 shl 16 + 1      ; y=y+1 y2=y2+1
220
    sub     ecx, 1 shl 16 + 1      ; y=y+1 y2=y2+1
225
    int     0x40                   ; draw
221
    int     0x40                   ; draw
226
    pop     eax
222
    pop     eax
227
 
223
 
228
 
224
 
229
    ; ïåðåäíÿÿ áîêîâàÿ [frame]
225
    ; ïåðåäíÿÿ áîêîâàÿ [frame]
230
    mov     edx, dword [eax + 14]  ; color
226
    mov     edx, dword [eax + 14]  ; color
231
    mov     bx, word [eax]         ; x
227
    mov     bx, word [eax]         ; x
232
    shl     ebx,16
228
    shl     ebx,16
233
    mov     bx, word [eax]         ; x2=x
229
    mov     bx, word [eax]         ; x2=x
234
    mov     cx, word [eax + 2]     ; y
230
    mov     cx, word [eax + 2]     ; y
235
    inc     cx                     ; y=y+1
231
    inc     cx                     ; y=y+1
236
    shl     ecx,16
232
    shl     ecx,16
237
    mov     cx, word [eax + 2]     ; y2=y
233
    mov     cx, word [eax + 2]     ; y2=y
238
    add     cx, word [eax + 6]     ; y2=y+h
234
    add     cx, word [eax + 6]     ; y2=y+h
239
    sub     cx,2                   ; y2=y2-2
235
    sub     cx,2                   ; y2=y2-2
240
    push    eax
236
    push    eax
241
    mov     eax, 38                ; line
237
    mov     eax, 38                ; line
242
    int     0x40                   ; draw
238
    int     0x40                   ; draw
243
    ; ïåðåäíÿÿ áîêîâàÿ [3d]
239
    ; ïåðåäíÿÿ áîêîâàÿ [3d]
244
    mov     edx, [sc.3d_light]     ; color
240
    mov     edx, [sc.3d_light]     ; color
245
    add     ebx, 1 shl 16 + 1      ; x=x+1 x2=x2+1
241
    add     ebx, 1 shl 16 + 1      ; x=x+1 x2=x2+1
246
    sub     ecx,1                  ; y2=y2-1
242
    sub     ecx,1                  ; y2=y2-1
247
    int     0x40                   ; draw
243
    int     0x40                   ; draw
248
    pop     eax
244
    pop     eax
249
 
245
 
250
    ; çàäíÿÿ áîêîâàÿ [frame]
246
    ; çàäíÿÿ áîêîâàÿ [frame]
251
    mov     edx, dword [eax + 14]  ; color
247
    mov     edx, dword [eax + 14]  ; color
252
    mov     bx, word [eax]         ; x
248
    mov     bx, word [eax]         ; x
253
    add     bx, word [eax + 4]     ; x=x+w
249
    add     bx, word [eax + 4]     ; x=x+w
254
    dec     bx
250
    dec     bx
255
    push    bx
251
    push    bx
256
    shl     ebx,16
252
    shl     ebx,16
257
    pop     bx
253
    pop     bx
258
    inc     ecx
254
    inc     ecx
259
    push    eax
255
    push    eax
260
    mov     eax, 38                ; line
256
    mov     eax, 38                ; line
261
    int     0x40                   ; draw
257
    int     0x40                   ; draw
262
    ; çàäíÿÿ áîêîâàÿ [3d]
258
    ; çàäíÿÿ áîêîâàÿ [3d]
263
    mov     edx, [sc.3d_dark]     ; color
259
    mov     edx, [sc.3d_dark]     ; color
264
    sub     ebx, 1 shl 16 + 1      ; x=x+1 x2=x2+1
260
    sub     ebx, 1 shl 16 + 1      ; x=x+1 x2=x2+1
265
    int     0x40                   ; draw
261
    int     0x40                   ; draw
266
    pop     eax
262
    pop     eax
267
 
263
 
268
    popa
264
    popa
269
    ret
265
    ret