Subversion Repositories Kolibri OS

Rev

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

Rev 503 Rev 872
Line 19... Line 19...
19
 
19
 
20
; params 4 xpos 4 ypos 30 iconfile 30 startfile 10 label
20
; params 4 xpos 4 ypos 30 iconfile 30 startfile 10 label
Line 21... Line 21...
21
;          +0     +4      +8          +38          +68
21
;          +0     +4      +8          +38          +68
-
 
22
 
22
 
23
include  '..\..\..\macros.inc'
23
include  '..\..\..\macros.inc'
24
 
24
;__DEBUG__ fix 1
25
;__DEBUG__ fix 1
-
 
26
;__DEBUG_LEVEL__ fix 1
25
;__DEBUG_LEVEL__ fix 1
27
;include  'debug-fdo.inc'
Line 26... Line 28...
26
;include  'debug-fdo.inc'
28
 
Line 27... Line 29...
27
flipdelay = 7
29
flipdelay = 5
28
 
30
 
29
START:           ; start of execution
-
 
30
 
31
START:           ; start of execution
31
    cmp  [I_PARAM],byte 0
-
 
Line -... Line 32...
-
 
32
 
32
    jne  nohalt
33
    cmp   [I_PARAM],byte 0
33
    or   eax,-1
34
    jne   nohalt
34
    mcall
35
    mcall -1
35
  nohalt:
36
  
36
 
37
 nohalt:
Line 51... Line 52...
51
;DEBUGF 1,"fname: '%s'\n",fname
52
;DEBUGF 1,"fname: '%s'\n",fname
Line 52... Line 53...
52
 
53
 
53
    mov  esi,I_PARAM+8+30
54
    mov   esi,I_PARAM+8+30
54
    mov  edi,start_file
55
    mov   edi,start_file
-
 
56
    mov   ecx,30
55
    mov  ecx,30
57
    cld
56
    rep  movsb
58
    rep   movsb
Line 57... Line 59...
57
    call fill_paths
59
    call  fill_paths
58
 
60
 
59
    mov  esi,I_PARAM+8+30+30
61
    mov   esi,I_PARAM+8+30+30
60
    mov  edi,labelt
62
    mov   edi,labelt
61
    mov  ecx,10
63
    mov   ecx,10
Line 62... Line -...
62
    cld
-
 
63
    rep  movsb
64
    cld
64
 
-
 
Line -... Line 65...
-
 
65
    rep   movsb
-
 
66
 
-
 
67
    mcall 40,110001b
Line -... Line 68...
-
 
68
 
65
    mov  eax,40          ; get also event background change
69
    mcall 37,4,hand,1
66
    mov  ebx,10101b
-
 
67
    mcall
-
 
68
 
70
    mov   ecx,eax
Line 69... Line 71...
69
 
71
    mcall 37,5
Line 70... Line 72...
70
    call get_bg
72
 
71
 
-
 
Line 72... Line 73...
72
  red:           ; redraw
73
red:
73
    call draw_window
74
    call  get_bg
74
 
75
    call  draw_window
75
still:
76
 
Line 76... Line -...
76
 
-
 
77
    mov  eax,10          ; wait here for event
77
still:
78
    mcall
78
 
79
 
79
    mcall  10          ; wait here for event
80
    cmp  eax,1          ; redraw request ?
80
 
Line 81... Line -...
81
    jz  red
-
 
82
    cmp  eax,3          ; button in buffer ?
-
 
83
    jz  button
-
 
Line -... Line 81...
-
 
81
    cmp   eax,1          ; redraw request ?
-
 
82
    jz    red
-
 
83
    cmp   eax,6
-
 
84
    jz    mouse
-
 
85
 
-
 
86
    call  get_bg
-
 
87
    call  draw_icon
-
 
88
    mcall 5,80
-
 
89
    jmp   still
-
 
90
 
-
 
91
 
-
 
92
  mouse:
84
 
93
 
-
 
94
    mcall 9,process,-1
-
 
95
    xor   ebx,ebx
-
 
96
    mov   bx,[process.window_stack_position]
-
 
97
    cmp   eax,ebx              ;check is this process is active
-
 
98
    jne   still
85
  check:
99
 
-
 
100
    cmp   [mouse_pressed],1
-
 
101
    je    @f
-
 
102
 
-
 
103
    mcall 37,2
-
 
104
    test  eax,1
-
 
105
    jz    still
-
 
106
 
-
 
107
    mov   [icon_moved],0
-
 
108
 
-
 
109
    mcall 37,0
-
 
110
    mov   ebx,eax
-
 
111
    shr   eax,16             ;   eax= abs x
-
 
112
    and   ebx,0xffff         ;   ebx= abs y
-
 
113
 
-
 
114
    mov   [xmouse_old],eax   ; saving mouse coordinates
-
 
115
    mov   [ymouse_old],ebx
-
 
116
 
-
 
117
    cmp   eax,[process.box.left]    ; check is mouse in icon area
-
 
118
    jl    still
-
 
119
    sub   eax,[process.box.left]
-
 
120
    cmp   eax,[process.box.width]
-
 
121
    ja    still
-
 
122
 
-
 
123
    cmp   ebx,[process.box.top]
-
 
124
    jl    still
-
 
125
    sub   ebx,[process.box.top]
86
    call get_bg
126
    cmp   ebx,[process.box.height]
-
 
127
    ja    still
-
 
128
 
Line -... Line 129...
-
 
129
    mov   [xmouse_rel],eax   ; saving relative coordinates
-
 
130
    mov   [ymouse_rel],ebx
-
 
131
 
-
 
132
    mov   [mouse_pressed],1
-
 
133
 
-
 
134
    jmp   still
-
 
135
 
-
 
136
  @@:
-
 
137
    mcall 37,2
-
 
138
    test  eax,1
-
 
139
    jnz   @F
-
 
140
 
-
 
141
    mov   [mouse_pressed],0
-
 
142
 
-
 
143
  @@:
-
 
144
    mcall 37,0
-
 
145
    mov   ecx,eax
-
 
146
    shr   eax,16             ;   eax= abs x
-
 
147
    and   ecx,0xffff         ;   ecx= abs y
-
 
148
    push  eax ecx
-
 
149
 
-
 
150
    cmp   [icon_moved],1
-
 
151
    je    move
-
 
152
 
-
 
153
    add   eax,2
-
 
154
    cmp   eax,[xmouse_old]
-
 
155
    jle   move
-
 
156
    sub   eax,4
-
 
157
    cmp   eax,[xmouse_old]
-
 
158
    jae   move
87
    call draw_icon
159
 
-
 
160
    add   ecx,2
-
 
161
    cmp   ecx,[ymouse_old]
-
 
162
    jle   move
-
 
163
    sub   ecx,4
-
 
164
    cmp   ecx,[ymouse_old]
-
 
165
    jae   move
-
 
166
 
-
 
167
    cmp   [mouse_pressed],1
-
 
168
    je    still
-
 
169
 
-
 
170
    mcall 70,finfo_start
Line 88... Line 171...
88
    mcall 5,80
171
    call  flip_icon
Line -... Line 172...
-
 
172
    jmp   still
-
 
173
 
-
 
174
 move:
-
 
175
    mov   [icon_moved],1
-
 
176
    pop   ecx ebx
-
 
177
    sub   ebx,[xmouse_rel]   ;   ebx=new_x
-
 
178
    sub   ecx,[ymouse_rel]   ;   ecx=new_y
-
 
179
    mov   [xpos],ebx
-
 
180
    mov   [ypos],ecx
-
 
181
 
89
    jmp  still
182
    mcall 67,,,-1,-1    ;   move
Line 90... Line 183...
90
 
183
 
91
  button:          ; button
184
    jmp   still
92
    mov  al,17          ; get id
185
 
93
    mcall
186
fill_paths:
94
 
187
     dec   edi
95
    mov  eax,70
188
     mov   ecx,30
96
    mov  ebx,finfo_start
189
     std
97
    mcall
190
     mov   al,' '
98
 
191
     repe  scasb
99
    call flip_icon
192
     cld
100
 
193
     mov   byte[edi+2],0
101
    jmp  still
194
     ret
102
 
195
 
103
flip_icon:
196
flip_icon:
104
 
197
 
105
     mov  eax,1
198
     mov   eax,1
106
     call flip
199
     call  flip
107
     mov  eax,2
200
     inc   eax
108
     call flip
201
     call  flip
109
     mov  eax,3
202
     inc   eax
Line 110... Line 203...
110
     call flip
203
     call  flip
Line 111... Line 204...
111
     mov  eax,4
204
     inc   eax
-
 
205
     call  flip
112
     call flip
206
     inc   eax
113
     mov  eax,5
207
     call  flip
114
     call flip
208
     dec   eax
115
     mov  eax,4
-
 
116
     call flip
209
     call  flip
117
     mov  eax,3
210
     dec   eax
118
     call flip
211
     call  flip
Line 119... Line -...
119
     mov  eax,2
-
 
120
     call flip
-
 
121
     mov  eax,1
-
 
122
     call flip
-
 
123
     mov  eax,0
-
 
124
     call flip
-
 
125
 
-
 
126
     ret
-
 
127
 
-
 
Line 128... Line 212...
128
flip:
212
     dec   eax
Line 129... Line 213...
129
     mov  [iconstate],eax
213
     call  flip
130
     call get_bg
-
 
131
     call draw_icon
-
 
Line 132... Line -...
132
     mov  eax,5
-
 
133
     mov  ebx,flipdelay
214
     dec   eax
134
     mcall
215
     call  flip
-
 
216
     xor   eax,eax
135
     ret
217
     call  flip
136
 
-
 
137
fill_paths:
218
 
138
     dec  edi
-
 
139
     mov  ecx,30
-
 
140
     std
-
 
141
     mov  al,' '
-
 
142
     repe scasb
219
     ret
143
     cld
-
 
144
     mov  byte[edi+2],0
220
 
145
     ret
221
flip:
Line 146... Line 222...
146
 
222
     push  eax
Line 147... Line 223...
147
draw_window:
223
     mov   [iconstate],eax
148
 
-
 
149
    mov  eax,12      ; function 12:tell os about windowdraw
-
 
Line 150... Line 224...
150
    mov  ebx,1      ; 1, start of draw
224
     call  get_bg
Line 151... Line 225...
151
    mcall
225
     call  draw_icon
Line 152... Line -...
152
 
-
 
153
       ; DRAW WINDOW
226
     mcall 5,flipdelay
154
    xor  eax,eax            ; function 0 : define and draw window
-
 
155
    mov  ebx,[xpos-2]
227
     pop   eax
Line 156... Line 228...
156
    mov  ecx,[ypos-2]
228
     ret
157
    add  ebx,[yw]           ; [x start] *65536 + [x size]
-
 
158
    add  ecx,67             ; [y start] *65536 + [y size]
-
 
159
    mov  edx,0x01000000     ; color of work area RRGGBB,8->color gl
229
 
Line 160... Line 230...
160
    mcall
230
 
161
 
-
 
162
    mov  eax,8      ; button
-
 
163
    mov  ebx,51
231
draw_window:
Line 164... Line -...
164
    mov  ecx,67
-
 
165
    mov  edx,0x60000001
232
 
166
    mcall
-
 
Line 167... Line 233...
167
 
233
     mcall 12,1             ; function 12,1 - tell os about start of draw window
168
    call draw_icon
234
 
169
 
235
     xor   eax,eax          ; function 0 : define and draw window
170
    mov  eax,12
236
     mov   ebx,[xpos-2]
171
    mov  ebx,2
237
     add   ebx,51           ; [x start] *65536 + [x size]
Line 172... Line 238...
172
    mcall
238
     mov   ecx,[ypos-2]
173
 
239
     add   ecx,67           ; [y start] *65536 + [y size]
174
    ret
240
     mov   edx,0x01000000
175
 
241
     mov   esi,0x01000000
Line 176... Line 242...
176
get_bg:
242
     mcall
Line 177... Line 243...
177
 
243
 
Line 178... Line 244...
178
    mov  eax,14
244
     call  draw_icon
Line 179... Line 245...
179
    mcall
245
 
180
    add  eax,0x00010001
246
     mcall 12,2             ; function 12,2 - tell os about end of draw window
Line 181... Line 247...
181
    mov  [scrxy],eax
247
 
182
 
248
     ret
183
    mov  eax,39        ; get background type
249
 
Line 238... Line 304...
238
    add   eax,[esp]
304
    add   eax,[esp]
239
    add   esp,4
305
    add   esp,4
Line 240... Line 306...
240
 
306
 
Line 241... Line 307...
241
  nostretch:
307
  nostretch:
242
 
308
 
Line 243... Line 309...
243
    cmp   [bgrdrawtype],dword 1
309
    cmp   [bgrdrawtype],1
244
    jne   notiled
310
    jne   notiled
245
 
311
 
Line 264... Line 330...
264
    add  esp,4
330
    add  esp,4
Line 265... Line 331...
265
 
331
 
Line 266... Line 332...
266
  notiled:
332
  notiled:
267
 
-
 
268
    lea  ecx,[eax+eax*2]
-
 
269
 
-
 
270
    mov  eax,39
-
 
271
    mov  ebx,2
333
 
Line 272... Line 334...
272
 
334
    lea  ecx,[eax+eax*2]
Line 273... Line 335...
273
    mcall
335
    mcall 39,2
Line 282... Line 344...
282
    mov  [esi+edi+2],al
344
    mov  [esi+edi+2],al
283
    sub  edi,3
345
    sub  edi,3
Line 284... Line 346...
284
 
346
 
285
    dec  ebx
347
    dec  ebx
286
    jge  newb
348
    jge  newb
Line 287... Line 349...
287
    mov  ebx,[yw]
349
    mov  ebx,51
288
 
350
 
289
    add  esi,52*3
351
    add  esi,52*3
290
    mov  edi,51*3
352
    mov  edi,51*3
Line 404... Line 466...
404
;*****************************************************************************
466
;*****************************************************************************
Line 405... Line 467...
405
 
467
 
Line 406... Line 468...
406
    ret
468
    ret
407
 
-
 
408
draw_picture:
469
 
409
    mov  eax,7
-
 
410
    mov  ebx,I_END+256+9662
-
 
411
    mov  ecx,52 shl 16 + 68
-
 
412
    xor  edx,edx
470
draw_picture:
Line 413... Line 471...
413
    mcall
471
    mcall 7,I_END+256+9662,52 shl 16+68,0
414
    ret
472
    ret
415
 
473
 
Line 436... Line 494...
436
    sub   ebx,eax
494
    sub   ebx,eax
437
    movzx ecx,byte [I_PARAM+8+30+30+10]
495
    movzx ecx,byte [I_PARAM+8+30+30+10]
438
    shl   ecx,16
496
    shl   ecx,16
439
    add   ebx,ecx
497
    add   ebx,ecx
Line 440... Line 498...
440
 
498
 
441
; replaced - delete commented lines below if you like that style
499
; black shade of text
Line 442... Line 500...
442
    mov   eax,4          ; white text
500
; uncomment lines below if you like that style
443
 
501
    
444
    xor   ecx,ecx
502
    xor   ecx,ecx
445
    mov   edx,labelt
503
    mov   edx,labelt
446
    mov   esi,labellen-labelt
504
    mov   esi,labellen-labelt
447
    add   ebx,1 shl 16      ;*65536+1
505
    add   ebx,1 shl 16
448
    mcall
506
    mcall 4
449
    inc   ebx
507
    inc   ebx
450
    mcall
508
    mcall
451
    add   ebx,1 shl 16
509
    add   ebx,1 shl 16
452
    mcall
510
    mcall
453
    inc   ebx
511
    inc   ebx
454
    mcall
512
    mcall
455
    sub   ebx,1 shl 16
513
    sub   ebx,1 shl 16
456
    mcall
514
    mcall
457
    sub   ebx,1 shl 16 +1
515
    sub   ebx,1*65536+1
458
    mcall
516
    mcall
459
    sub   ebx,1 shl 16 + 1
517
    sub   ebx,1*65536+1
460
    mcall
518
    mcall
461
    add   ebx,1 shl 16 - 1
519
    add   ebx,1*65536-1
462
    mcall
520
    mcall
463
    inc   ebx
521
    inc   ebx
Line 464... Line 522...
464
    mov   ecx,0xffffff
522
    or    ecx,0xffffff
465
    mcall
523
    mcall
466
 
524
 
467
    ;xor   ecx,ecx        ; black shade of text
-
 
468
    ;mov   edx,labelt
525
    ;xor   ecx,ecx        
469
    ;mov   esi,labellen-labelt
526
    ;mov   edx,labelt
470
    ;add   ebx,1*65536+1
527
    ;mov   esi,labellen-labelt
471
    ;mcall
528
    ;mcall 4
Line 472... Line 529...
472
    ;sub   ebx,1*65536+1
529
    ;sub   ebx,1*65536+1
Line 473... Line 530...
473
    ;mov   ecx,0xffffff
530
    ;or    ecx,0xffffff
Line 474... Line 531...
474
    ;mcall
531
    ;mcall
Line 475... Line -...
475
 
-
 
476
    ret
-
 
477
 
532
 
478
 
-
 
Line 479... Line -...
479
; DATA AREA
-
 
480
 
-
 
Line 481... Line 533...
481
itype       db 0
533
    ret
482
 
534
 
483
align 4
535
 
Line -... Line 536...
-
 
536
; DATA AREA
-
 
537
 
-
 
538
itype       db 0
-
 
539
 
484
 
540
tl          dd  2
Line 485... Line 541...
485
tl          dd  2
541
 
486
yw          dd  51
542
 
Line 528... Line 584...
528
            rb  10
584
            rb  10
529
labellen:
585
labellen:
Line 530... Line 586...
530
 
586
 
Line -... Line 587...
-
 
587
pixl dd ?
-
 
588
 
-
 
589
xpos        dd  ?
-
 
590
ypos        dd  ?
-
 
591
 
-
 
592
mouse_pressed  dd ?
-
 
593
 
-
 
594
xmouse_rel  dd ?
-
 
595
ymouse_rel  dd ?
-
 
596
 
-
 
597
xmouse_old  dd ?
-
 
598
ymouse_old  dd ?
-
 
599
processes   dd ?
-
 
600
pid         dd ?
-
 
601
 
531
pixl dd ?
602
process     process_information
-
 
603
 
532
 
604
;include_debug_strings
Line 533... Line 605...
533
;include_debug_strings
605