Subversion Repositories Kolibri OS

Rev

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

Rev 316 Rev 485
Line 18... Line 18...
18
               dd     0x1000                  ; memory for app
18
               dd     0x1000                  ; memory for app
19
               dd     0x1000                  ; esp
19
               dd     0x1000                  ; esp
20
               dd     0x0 , 0x0               ; I_Param , I_Icon
20
               dd     0x0 , 0x0               ; I_Param , I_Icon
Line 21... Line 21...
21
 
21
 
-
 
22
include 'lang.inc'
22
include 'lang.inc'
23
include '..\..\..\macros.inc'
Line 23... Line 24...
23
START:                          ; start of execution
24
START:                          ; start of execution
Line 24... Line 25...
24
 
25
 
25
    call draw_window            ; at first, draw the window
26
    call draw_window            ; at first, draw the window
Line 26... Line 27...
26
 
27
 
27
still:
28
still:
28
    call mouse_info
29
    call mouse_info
Line 29... Line 30...
29
 
30
 
30
    mov  eax,23
31
    mov  eax,23
31
    mov  ebx,2
32
    mov  ebx,2
32
    int  0x40
33
    mcall
Line 44... Line 45...
44
    call draw_window
45
    call draw_window
45
    jmp  still
46
    jmp  still
Line 46... Line 47...
46
 
47
 
47
  key:                          ; key
48
  key:                          ; key
48
    mov  eax,2                  ; just read it and ignore
49
    mov  eax,2                  ; just read it and ignore
49
    int  0x40
50
    mcall
Line 50... Line 51...
50
    jmp  still
51
    jmp  still
51
 
52
 
52
  button:                       ; button
53
  button:                       ; button
Line 53... Line 54...
53
    mov  eax,17                 ; get id
54
    mov  eax,17                 ; get id
Line 54... Line 55...
54
    int  0x40
55
    mcall
55
 
56
 
56
    shr  eax,8
57
    shr  eax,8
57
 
58
 
58
    cmp  eax,1                   ; button id=1 ?
59
    cmp  eax,1                   ; button id=1 ?
Line 59... Line 60...
59
    jne  noclose
60
    jne  noclose
60
    mov  eax,-1                 ; close this program
61
    mov  eax,-1                 ; close this program
Line 72... Line 73...
72
 
73
 
73
 
74
 
74
draw_window:
75
draw_window:
75
    mov  eax,12                    ; function 12:tell os about windowdraw
76
    mov  eax,12                    ; function 12:tell os about windowdraw
76
    mov  ebx,1                     ; 1, start of draw
77
    mov  ebx,1                     ; 1, start of draw
77
    int  0x40
78
    mcall
78
                                   ; DRAW WINDOW
79
                                   ; DRAW WINDOW
79
    mov  eax,0                     ; function 0 : define and draw window
80
    mov  eax,0                     ; function 0 : define and draw window
80
    mov  ebx,100*65536+200         ; [x start] *65536 + [x size]
81
    mov  ebx,100*65536+200         ; [x start] *65536 + [x size]
81
    mov  ecx,100*65536+200         ; [y start] *65536 + [y size]
82
    mov  ecx,100*65536+200         ; [y start] *65536 + [y size]
82
    mov  edx,0x13ffffff            ; color of work area RRGGBB,8->color gl
83
    mov  edx,0x13ffffff            ; color of work area RRGGBB,8->color gl
Line 83... Line 84...
83
    mov  edi,header                ; WINDOW LABEL
84
    mov  edi,title                 ; WINDOW LABEL
Line 84... Line 85...
84
    int  0x40
85
    mcall
85
 
86
 
Line 96... Line 97...
96
Draw_Controls_Done:
97
Draw_Controls_Done:
Line 97... Line 98...
97
 
98
 
98
 
99
 
99
    mov  eax,12                    ; function 12:tell os about windowdraw
100
    mov  eax,12                    ; function 12:tell os about windowdraw
Line 100... Line 101...
100
    mov  ebx,2                     ; 2, end of draw
101
    mov  ebx,2                     ; 2, end of draw
Line 101... Line 102...
101
    int  0x40
102
    mcall
Line 111... Line 112...
111
mouseb dd 0
112
mouseb dd 0
Line 112... Line 113...
112
 
113
 
113
mouse_info:
114
mouse_info:
114
   mov eax, 37            ;get mouse cordinates
115
   mov eax, 37            ;get mouse cordinates
115
   mov ebx, 1             ;
116
   mov ebx, 1             ;
116
   int 0x40               ;
117
   mcall               ;
117
   mov ecx, eax           ;
118
   mov ecx, eax           ;
118
   push ecx               ;
119
   push ecx               ;
119
   mov eax, 37            ;get mouse buttons
120
   mov eax, 37            ;get mouse buttons
120
   mov ebx, 2             ;
121
   mov ebx, 2             ;
121
   int 0x40               ;
122
   mcall               ;
122
   cmp [mouseb], eax      ;compare old mouse states to new states
123
   cmp [mouseb], eax      ;compare old mouse states to new states
123
   jne redraw_mouse_info  ;
124
   jne redraw_mouse_info  ;
124
   cmp [mousey], cx       ;
125
   cmp [mousey], cx       ;
125
   jne redraw_mouse_info  ;
126
   jne redraw_mouse_info  ;
Line 172... Line 173...
172
;Repaint value background
173
;Repaint value background
173
   mov eax, 13
174
   mov eax, 13
174
   mov ebx, 0x00960028
175
   mov ebx, 0x00960028
175
   mov ecx, 0x00240010
176
   mov ecx, 0x00240010
176
   mov edx, 0x00ffffff
177
   mov edx, 0x00ffffff
177
   int 0x40
178
   mcall
178
;Draw Color Box
179
;Draw Color Box
179
   xor edx, edx
180
   xor edx, edx
180
   movzx ecx,word [slider_1+12]
181
   movzx ecx,word [slider_1+12]
181
   mov dh, cl
182
   mov dh, cl
182
   movzx ecx,word [slider_2+12]
183
   movzx ecx,word [slider_2+12]
Line 185... Line 186...
185
   movzx ecx,word [slider_3+12]
186
   movzx ecx,word [slider_3+12]
186
   mov dl,cl
187
   mov dl,cl
187
   mov ebx, 0x00860035
188
   mov ebx, 0x00860035
188
   mov ecx, 0x00590040
189
   mov ecx, 0x00590040
189
   mov eax, 13
190
   mov eax, 13
190
   int 0x40
191
   mcall
191
;draw current value of slider
192
;draw current value of slider
192
   mov ecx, edx
193
   mov ecx, edx
193
   mov eax, 47
194
   mov eax, 47
194
   mov ebx, 0x00060100
195
   mov ebx, 0x00060100
195
   mov esi, 0
196
   mov esi, 0
196
   mov edx, 0x009A0029
197
   mov edx, 0x009A0029
197
   int 0x40
198
   mcall
198
ret
199
ret
Line 199... Line 200...
199
 
200
 
200
 
201
 
Line 265... Line 266...
265
;Draw slider background
266
;Draw slider background
266
   mov   eax, 13         ;slider background
267
   mov   eax, 13         ;slider background
267
   mov   ebx, [ebp]      ;x start/width
268
   mov   ebx, [ebp]      ;x start/width
268
   mov   ecx, [ebp+4]    ;y start/height
269
   mov   ecx, [ebp+4]    ;y start/height
269
   mov   edx, 0x002288DD ;color
270
   mov   edx, 0x002288DD ;color
270
   int   0x40            ;draw bar
271
   mcall                 ;draw bar
271
;Draw line for slide rail
272
;Draw line for slide rail
272
   mov   eax, 38         ;draw vertical slide line
273
   mov   eax, 38         ;draw vertical slide line
273
   movzx ebx,word [ebp]  ;x
274
   movzx ebx,word [ebp]  ;x
274
   shr   ebx, 1          ;
275
   shr   ebx, 1          ;
275
   add    bx,word [ebp+2];
276
   add    bx,word [ebp+2];
Line 279... Line 280...
279
   mov   ecx, [ebp+4]    ;y start / height
280
   mov   ecx, [ebp+4]    ;y start / height
280
   add   ecx, 0x000A0000 ;
281
   add   ecx, 0x000A0000 ;
281
   add   ecx, [ebp+6]    ;y start
282
   add   ecx, [ebp+6]    ;y start
282
   sub   ecx, 10         ;
283
   sub   ecx, 10         ;
283
   mov   edx, 0x00         ;color
284
   mov   edx, 0x00         ;color
284
   int 0x40              ;
285
   mcall              ;
285
;Draw slider box
286
;Draw slider box
286
   movzx eax,word [ebp+4]  ;height
287
   movzx eax,word [ebp+4]  ;height
287
   sub   eax, 20           ;
288
   sub   eax, 20           ;
288
   movzx ebx,word [ebp+10] ;max value
289
   movzx ebx,word [ebp+10] ;max value
289
   sub    bx,word [ebp+8]  ;min value
290
   sub    bx,word [ebp+8]  ;min value
Line 299... Line 300...
299
   sub   ecx, eax          ;*slide box y position
300
   sub   ecx, eax          ;*slide box y position
300
   shl   ecx, 16           ;
301
   shl   ecx, 16           ;
301
   mov    cx, [box_h]      ;height
302
   mov    cx, [box_h]      ;height
302
   mov   eax, 13           ;draw bar sys function
303
   mov   eax, 13           ;draw bar sys function
303
   mov   edx, 0x00         ;color
304
   mov   edx, 0x00         ;color
304
   int  0x40               ;draw slider box
305
   mcall               ;draw slider box
305
   pop edx
306
   pop edx
306
   pop ecx
307
   pop ecx
307
   pop ebx
308
   pop ebx
308
   pop eax
309
   pop eax
309
ret
310
ret
Line 372... Line 373...
372
;**************************************************
373
;**************************************************
373
;* End Slider Code
374
;* End Slider Code
374
;**************************************************
375
;**************************************************
Line 375... Line 376...
375
 
376
 
376
; DATA AREA
377
; DATA AREA
377
header     db  'Color Slider',0
378
title     db  'Color Slider',0
378
I_END:
379
I_END: