Subversion Repositories Kolibri OS

Rev

Rev 408 | Rev 411 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
51 mikedld 1
;********************************
2
;*                              *
3
;*     DESKTOP ICON MANAGER     *
4
;*                              *
5
;*  Compile with flat assembler *
6
;*                              *
7
;********************************
8
;  22.02.05 was modified for work with new multi-thread ICON.
408 halyavin 9
;  8.03.07 переход на 70 функцию by SPraid
51 mikedld 10
;******************************************************************************
11
RAW_SIZE equ 350000
12
ICON_SIZE equ 32*32*3
13
GIF_SIZE equ 45000
14
REC_SIZE equ 80
195 heavyiron 15
ICONS_DAT equ '/RD/1/ICONS.DAT'
16
ICON_APP equ '/RD/1/ICON'
51 mikedld 17
ICON_STRIP equ '/RD/1/ICONSTRP.GIF'
18
 
19
  use32
20
  org    0x0
21
  db     'MENUET01'     ; 8 byte id
22
  dd     0x01           ; header version
23
  dd     START          ; start of code
24
  dd     I_END          ; size of image
25
  dd     icon_data+0x30000        ; memory for app
26
  dd     icon_data+0x30000        ; esp
27
  dd     I_Param , 0x0  ; I_Param , I_Icon
135 diamond 28
include  'macros.inc'
132 diamond 29
include  'lang.inc'
51 mikedld 30
COLOR_ORDER equ MENUETOS
31
include  'gif_lite.inc'
32
;include  'debug.inc'
33
purge newline
34
;******************************************************************************
35
START:                       ; start of execution
408 halyavin 36
    mcall 70,finfo
51 mikedld 37
    cmp   ebx,GIF_SIZE
38
    ja    close
39
    mov   esi,gif_file
40
    mov   edi,strip_file
41
    mov   eax,icon_data
42
    call  ReadGIF
43
    movzx eax,word[strip_file+10]
44
    shr  eax,5
45
    mov  [icon_count],eax
46
    call load_ic
47
  boot_str:
48
    cmp   [I_Param],dword 'BOOT'
49
    je   load_icon_list2
50
      call  load_icon_list
51
 red:
52
    call draw_window         ; at first, draw the window
53
    mov  esi,[current_icon]
54
    jmp  band
55
still:
56
 
57
    mov  eax,10              ; wait here for event
58
    int  0x40
59
 
60
    cmp  eax,1               ; redraw request ?
61
    je   red
62
    cmp  eax,2               ; key in buffer ?
63
    je   key
64
    cmp  eax,3               ; button in buffer ?
65
    je   button
66
 
67
    jmp  still
68
 
69
  key:                       ; key
70
    mov  eax,2               ; just read it and ignore
71
    int  0x40
72
    jmp  still
73
 
74
  button:                    ; button
75
    mov  eax,17              ; get id
76
    int  0x40
77
 
78
    shr  eax,8
79
 
80
    cmp  eax,1               ; button id=1 ?
81
    je   close
82
  noclose:
83
      mov  esi,[current_icon]
84
      add  esi,12
85
    mov  ebx,[cur_band];eax
86
    cmp  eax,31
87
    jne  .no_back
88
    add  ebx,8
89
    mov  eax,[icon_count]
90
    cmp  eax,ebx
91
    jae  .drwic2
92
    xor  ebx,ebx
93
    jmp  .drwic2
94
  .no_back:
95
    cmp  eax,30
96
    jne  .no_side
97
    test ebx,ebx
98
    jnz  .dec
99
    mov  ebx,[icon_count]
100
         and  ebx,0xfffffff8
101
    add  ebx,8
102
  .dec:
103
    sub  ebx,8
104
  .drwic2:
105
    mov  [cur_band],ebx
106
  .drwic1:
107
    call draw_icon
108
    jmp  still
109
    .no_side:
110
       cmp  eax,32
111
       jne  .no_ico
112
       push ebx
113
       mcall 37,1
114
       pop  ebx
115
          shr  eax,16
116
       sub  eax,33-19
117
          mov  edi,34
118
          xor  edx,edx
119
          div  edi
120
    lea  ecx,[ebx+eax]
121
    cmp  ecx,[icon_count]
122
    jae  still
123
          mov  [sel_icon1],eax
124
          mov  ecx,eax
125
    add  eax,ebx
126
    call itoa
127
          jmp  .drwic1
128
  .no_ico:
129
    cmp  eax,11
130
    jb   no_str
131
    cmp  eax,13
132
    jg   no_str
133
    call read_string
134
    jmp  still
135
  no_str:
136
 
137
 
138
    cmp  eax,21              ; apply changes
139
    jne  no_apply
140
 
141
    ; (1) save list
142
 
408 halyavin 143
    mov  ebx,finfo							; Change by spraid
144
    mov  dword[ebx],2
51 mikedld 145
    mov  edx,REC_SIZE
146
    imul edx,dword [icons]
408 halyavin 147
    mov  [ebx+12],edx
51 mikedld 148
    mov  esi,iconlst
149
    call lst_path
409 heavyiron 150
    mov eax,70
408 halyavin 151
    int 0x40
51 mikedld 152
 
153
    ; (2) terminate all icons
154
    mov  eax,9
155
    mov  ebx,I_END
156
    mov  ecx,-1
157
    int  0x40
158
    mov  edi,[ebx+30]
159
     newread2:
160
    mov  esi,1
161
   newread:
162
    inc  esi
163
    mov  eax,9
164
    mov  ebx,I_END
165
    mov  ecx,esi
166
    int  0x40
167
    cmp  edi,[ebx+30]
168
    je   newread
169
    cmp  esi,eax
170
    jg   all_terminated
171
 
409 heavyiron 172
    cmp  [I_END+10],dword '@ICO'
51 mikedld 173
    jne  newread
174
    mov  eax,51
175
    cmp  eax,[I_END+42]
176
    jne  newread
177
    cmp  eax,[I_END+46]
178
    jne  newread
179
 
180
    mov  eax,18
181
    mov  ebx,2
182
    mov  ecx,esi
183
    int  0x40
184
 
185
    jmp  newread2
186
 
184 heavyiron 187
finfo_start:
188
        dd      7
189
        dd      0
190
.params dd      0
191
        dd      0
192
        dd      0
193
        db      0
194
        dd      finfo.path
195
 
408 halyavin 196
 
197
 
51 mikedld 198
finfo:
199
        dd 0
200
        dd 0
408 halyavin 201
        dd 0
202
        dd GIF_SIZE
51 mikedld 203
        dd gif_file
204
  .path:
205
        db ICON_STRIP,0
206
        rb 31-($-.path)
207
 
408 halyavin 208
 
51 mikedld 209
   all_terminated:
210
 
211
   apply_changes:
212
 
184 heavyiron 213
        mov     ebx, finfo_start
214
        mov     dword [ebx+8], boot_str+6
215
        mov     esi, iconname
216
        call    lst_path
217
        mov     eax, 70
218
        int     0x40
51 mikedld 219
    jmp   still
220
 
221
  no_apply:
222
 
223
    cmp  eax,22                 ; user pressed the 'add icon' button
224
    jne  no_add_icon
225
 
226
    mov  eax,13
227
    mov  ebx,24*65536+270
228
    mov  ecx,(250+8*14)*65536+8
229
    mov  edx,0xffffff
230
    int  0x40
231
    mov  eax,4
232
    mov  ebx,24*65536+250+8*14
233
    mov  ecx,0xff0000
234
    mov  edx,add_text
235
    mov  esi,add_text_len-add_text
236
    int  0x40
237
 
238
    mov  eax,10
239
    int  0x40
240
    cmp  eax,3
241
    jne  still
242
    mov  eax,17
243
    int  0x40
244
    shr  eax,8
245
    cmp  eax,40
246
    jb   no_f
247
    mov  edi,eax
248
    sub  eax,40
249
 
250
    xor  edx,edx  ; bcd -> 10
251
    mov  ebx,16
252
    div  ebx
253
    imul eax,10
254
    add  eax,edx
255
 
256
    mov  ebx,eax
257
    add  ebx,icons_reserved
258
    cmp  [ebx],byte 'x'
259
    je   no_f
260
    mov  [ebx],byte 'x'
261
 
262
    mov  [cur_btn],edi
263
    xor  edx,edx
264
    mov  ebx,10
265
    div  ebx
266
    add  eax,65
267
    add  edx,65
268
    mov  [icon_default+0],dl
269
    mov  [icon_default+1],al
270
 
271
    inc  dword [icons]
272
    mov  edi,[icons]
273
    dec  edi
274
    imul edi,REC_SIZE
275
    add  edi,icon_data
276
 
277
    mov  [current_icon],edi
278
 
279
    mov  esi,icon_default
280
    mov  ecx,REC_SIZE
281
    cld
282
    rep  movsb
283
    mov  esi,[current_icon]
284
    jmp  band
285
  no_f:
286
 
287
    call draw_btns;draw_window
288
 
289
    jmp  still
290
 
291
  no_add_icon:
292
 
293
 
294
    cmp  eax,23                     ; user pressed the remove icon button
295
    jne  no_remove_icon
296
 
297
    mov  eax,13
298
    mov  ebx,24*65536+270
299
    mov  ecx,(250+8*14)*65536+8
300
    mov  edx,0xffffff
301
    int  0x40
302
    mov  eax,4
303
    mov  ebx,24*65536+250+8*14
304
    mov  ecx,0xff0000
305
    mov  edx,rem_text
306
    mov  esi,rem_text_len-rem_text
307
    int  0x40
308
 
309
    mov  eax,10
310
    int  0x40
311
    cmp  eax,3
312
    jne  no_f;ound
313
    mov  eax,17
314
    int  0x40
315
    shr  eax,8
316
    cmp  eax,40
317
    jb   red;no_f;ound
318
    sub  eax,40
319
 
320
    xor  edx,edx
321
    mov  ebx,16
322
    div  ebx
323
    imul eax,10
324
    add  eax,edx
325
 
326
    mov  ebx,eax
327
    add  ebx,icons_reserved
328
    cmp  [ebx],byte 'x'
329
    jne  red
330
    mov  [ebx],byte ' '
331
 
332
    xor  edx,edx
333
    mov  ebx,10
334
    div  ebx
335
    shl  eax,8
336
    mov  al,dl
337
 
338
    add  eax,65*256+65
339
 
340
    mov  esi,icon_data
341
    mov  edi,REC_SIZE
342
    imul edi,[icons]
343
    add  edi,icon_data
344
  news:
345
    cmp  word [esi],ax
346
    je   foundi
347
    add  esi,REC_SIZE
348
    cmp  esi,edi
349
    jb   news
350
    jmp  red
351
 
352
  foundi:
353
 
354
    mov  ecx,edi
355
    sub  ecx,esi
356
 
357
    mov  edi,esi
358
    add  esi,REC_SIZE
359
 
360
    cld
361
    rep  movsb
362
 
363
    dec  [icons]
364
 
365
    mov  eax,icon_data
366
    mov  [current_icon],eax
367
    movzx ebx,word[eax]
368
    sub  bx,'AA'
369
    shl  bl,4
370
    shr  ebx,4
371
    add  ebx,40
372
    mov  [cur_btn],ebx
373
 
374
    jmp  red
375
 
376
  no_remove_icon:
377
 
378
    cmp  eax,40                 ; user pressed button for icon position
379
    jb   no_on_screen_button
380
    mov  edi,eax
381
    sub  eax,40
382
    mov  edx,eax
383
    shl  eax,4
384
    and  edx,0xf
385
    mov  dh,ah
386
    add  edx,65*256+65
387
 
388
    mov  esi,icon_data
389
    mov  ecx,[icons]
390
    cld
391
   findl1:
392
    cmp  dx,[esi]
393
    je   foundl1
394
    add  esi,REC_SIZE
395
    loop findl1
396
    jmp  still
397
 
398
   foundl1:
399
 
400
    mov  [current_icon],esi
401
    mov  [cur_btn],edi
402
   band:
403
    add  esi,12
404
    call atoi
405
    and  eax,0xfffff8
406
    mov  [cur_band],eax
407
    call draw_btns
408
 
409
    jmp  still
410
 
411
  no_on_screen_button:
412
 
413
 
414
    jmp  still
415
 
416
 
417
current_icon dd icon_data
418
 
419
 
420
print_strings:
421
 
422
    pusha
423
 
424
    mov  eax,13              ; clear text area
425
    mov  ebx,100*65536+180
426
    mov  ecx,(278+12)*65536+40
427
    mov  edx,0xffffff
428
    int  0x40
429
 
430
          xor  edi,edi
431
    mov  eax,4               ; icon text
432
    mov  ebx,100*65536+278+14
433
    mov  ecx,3
434
  .ll:
435
    push ecx
436
    mov  ecx,0x000000
437
    mov  edx,[current_icon]
438
    add  edx,[positions+edi*4]
439
    movzx esi,byte[str_lens+edi]
440
    inc  edi
441
    int  0x40
442
    add  ebx,14
443
    pop  ecx
444
    loop .ll
445
 
446
    popa
447
    ret
448
 
195 heavyiron 449
iconlst db ICONS_DAT,0
51 mikedld 450
 
451
load_icon_list:
452
 
453
    mov   edi,icons_reserved   ; clear reserved area
454
    mov   eax,32
455
    mov   ecx,10*9
456
    cld
457
    rep   stosb
458
 
459
    mov   ecx,[icons]          ; set used icons to reserved area
460
    mov   esi,icon_data
461
  ldl1:
462
    movzx ebx,byte [esi+1]
463
    sub   ebx,65
464
    imul  ebx,10
465
    movzx eax,byte [esi]
466
    add   ebx,eax
467
    sub   ebx,65
468
    add   ebx,icons_reserved
469
    mov   [ebx],byte 'x'
470
    add   esi,REC_SIZE
471
    loop  ldl1
472
    ret
473
 
474
lst_path:
475
    mov   ecx,30
476
    mov   edi,finfo.path
477
    rep   movsb
478
    ret
479
 
480
load_ic:
481
    mov   ebx,finfo
408 halyavin 482
    mov   dword[ebx+12],48*REC_SIZE
483
    mov   dword[ebx+16],icon_data
51 mikedld 484
    mov   esi,iconlst
485
    call  lst_path
408 halyavin 486
    mcall 70
51 mikedld 487
    lea   eax,[ebx+10]
488
    xor   edx,edx
489
    mov   ebx,REC_SIZE
490
    div   ebx
491
    mov   [icons],eax
492
        ret
493
 
494
 
495
positions dd 3,16,47
496
str_lens db 8,30,30
497
 
498
read_string:
499
    pusha
500
    sub  eax,11
501
    movzx ecx,byte[str_lens+eax]
502
    mov  [cur_str],ecx
503
    mov  eax,[positions+eax*4]
504
 
505
    mov  edi,[current_icon]
506
    add  edi,eax
507
    mov  [addr],edi
508
 
509
          add  edi,ecx
510
 
511
  .l1:
512
    dec  edi
513
    cmp  byte[edi],' '
514
    jne  .found
515
    mov  byte[edi],'_'
516
    loop .l1
517
    dec  edi
518
  .found:
519
    inc  edi
520
    push  edi
521
    call print_strings
522
 
523
    pop  edi
524
  f11:
525
    mov  eax,10
526
    int  0x40
527
    cmp  eax,2
528
    jz   fbu
529
    jmp  rs_done
530
  fbu:
531
    mov  eax,2
532
    int  0x40
533
    shr  eax,8
534
    cmp  eax,13
535
    je   rs_done
536
    cmp  eax,8
537
    jnz  nobsl
538
    cmp  edi,[addr]
539
    jz   f11
540
    dec  edi
541
    mov  [edi],byte '_'
542
    call print_strings
543
    jmp  f11
544
  nobsl:
545
    cmp  eax,31
546
    jbe  f11
547
    mov  [edi],al
548
    call print_strings
549
 
550
    inc  edi
551
    mov  esi,[addr]
552
    add  esi,[cur_str]
553
    cmp  esi,edi
554
    jnz  f11
555
 
556
   rs_done:
557
 
558
    mov  ecx,[addr]
559
    add  ecx,[cur_str]
560
    sub  ecx,edi
561
    mov  eax,32
562
    cld
563
    rep  stosb
564
    call print_strings
565
    popa
566
    ret
567
 
568
;   *********************************************
569
;   *******  WINDOW DEFINITIONS AND DRAW ********
570
;   *********************************************
571
 
572
 
573
draw_window:
574
 
575
    mov  eax,12                    ; function 12:tell os about windowdraw
576
    mov  ebx,1                     ; 1, start of draw
577
    int  0x40
578
 
579
                                   ; DRAW WINDOW
580
    mov  eax,0
581
    mov  ebx,210*65536+300
582
    mov  ecx,30*65536+390-14
583
    mov  edx,0x03ffffff
584
    mov  esi,0x808899ff
585
    mov  edi,0x008899ff
586
    int  0x40
587
 
588
                                   ; WINDOW LABEL
589
    mov  eax,4
590
    mov  ebx,8*65536+8
591
    mov  ecx,0x10ffffff
592
    mov  edx,labelt
593
    mov  esi,labellen-labelt
594
    int  0x40
595
 
596
    mov  eax,13                    ; WINDOW AREA
597
    mov  ebx,20*65536+260
598
    mov  ecx,35*65536+200
599
    mov  edx,0x3366cc
600
    int  0x40
601
 
602
    mov  eax,38                    ; VERTICAL LINE ON WINDOW AREA
603
    mov  ebx,150*65536+150
604
    mov  ecx,35*65536+235
605
    mov  edx,0xffffff
606
    int  0x40
607
 
608
    mov  eax,38                    ; HOROZONTAL LINE ON WINDOW AREA
609
    mov  ebx,20*65536+280
610
    mov  ecx,135*65536+135
611
    mov  edx,0xffffff
612
    int  0x40
613
 
614
    mov  eax,8                     ; TEXT ENTER BUTTONS
615
    mov  ebx,20*65536+72
616
    mov  ecx,(275+1+14)*65536+13-2
617
    mov  edx,11
618
    mov  esi,[bcolor]
619
    int  0x40
620
    inc  edx
621
    add  ecx,14*65536
622
    int  0x40
623
    inc  edx
624
    add  ecx,14*65536
625
    int  0x40
626
 
627
;    mov  eax,8                     ; APPLY AND SAVE CHANGES BUTTON
628
    mov  ebx,20*65536+259
629
    mov  ecx,(329+2)*65536+15-4
630
    mov  edx,21
631
    mov  esi,[bcolor]
632
    int  0x40
633
 
634
;    mov  eax,8                     ; ADD ICON BUTTON
635
    mov  ebx,20*65536+129-2
636
    add  ecx,14*65536
637
    inc  edx
638
    int  0x40
639
 
640
;    mov  eax,8                     ; REMOVE ICON BUTTON
641
    add  ebx,(130+2)*65536
642
    inc  edx
643
    int  0x40
644
 
645
    mcall ,<20-14,8>,<260-23,32>,30+1 shl 30    ; IMAGE BUTTON
646
    inc  edx
647
    add  ebx,(36*7+26) shl 16
648
    mcall
649
    add  edx,1+1 shl 29
650
    mov  ebx,(33-19) shl 16+(34*8)
651
    mcall
652
    mcall 4,<23-15,273-24>,0,arrows,1
653
    add  ebx,(36*7+27)shl 16
654
    add  edx,2
655
    mcall
656
    dec  edx
657
    mcall ,<120,250>
658
    lea  edx,[ebx+8 shl 16]
659
    mov  ecx,[icon_count]
660
    mcall 47,0x30000,,,0
661
 
662
;;
663
    mov  ebx,24*65536+250+14+14+14
664
    mov  ecx,0xffffff
665
    mov  edx,text
666
    mov  esi,47
667
  newline:
668
    mov  ecx,[edx]
669
    add  edx,4
670
    mov  eax,4
671
    int  0x40
672
    add  ebx,14
673
    add  edx,47
674
    cmp  [edx],byte 'x'
675
    jne  newline
676
draw_btns:
677
;;
678
    mov  eax,0                     ; DRAW BUTTONS ON WINDOW AREA
679
    mov  ebx,20*65536+25
680
    mov  ecx,35*65536+19
681
    mov  edi,icon_table
682
    mov  edx,40
683
   newbline:
684
 
685
    cmp  [edi],byte 'x'
686
    jne  no_button
687
 
688
    mov  esi,0x5577cc
689
    cmp  [edi+90],byte 'x'
690
    jne  nores
691
    mov  esi,0xcc5555
692
    cmp  edx,[cur_btn]
693
    jne  nores
694
    mov  esi,0xe7e05a
695
  nores:
696
 
697
    push eax
698
    mov  eax,8
699
    int  0x40
700
    pop  eax
701
 
702
  no_button:
703
 
704
    add  ebx,26*65536
705
 
706
    inc  edi
707
    inc  edx
708
 
709
    inc  al
710
    cmp  al,9
711
    jbe  newbline
712
    mov  al,0
713
 
714
    add  edx,6
715
 
716
    ror  ebx,16
717
    mov  bx,20
718
    ror  ebx,16
719
    add  ecx,20*65536
720
 
721
    inc  ah
722
    cmp  ah,8;9
723
    jbe  newbline
724
    call print_strings
725
    call draw_icon
726
    mov  eax,12                    ; function 12:tell os about windowdraw
727
    mov  ebx,2                     ; 2, end of draw
728
    int  0x40
729
 
730
    ret
731
 
732
draw_icon:
733
    mcall 13,<33-20,34*8+2>,<260-24,37+15-2>,0xffffff
734
    mov  esi,[current_icon]
735
    add  esi,12
736
    call atoi
737
    push eax
738
    cmp  eax,[cur_band]
739
    jb   .nou
740
    sub  eax,[cur_band]
741
    cmp  eax,7
742
    ja   .nou
743
    imul eax,34 shl 16
744
    lea  ebx,[eax+(33-19) shl 16]
745
    mov  bx,34
746
    mcall 13,,<236+35,3>,0xff0000
747
    mov  eax,[esp]
748
  .nou:
749
    mov  eax,[cur_band]
750
    and  eax,0xfffffff8
751
    push eax
752
    imul eax,ICON_SIZE
753
    lea  ebx,[strip_file+12+eax]
754
    mov  ecx,8
755
    mov  edx,(33-18) shl 16+238
756
  .nxt:
757
    push ecx
758
    mcall 7,,<32,32>
759
    pop  ecx
760
    add  ebx,ICON_SIZE
761
    add  edx,34 shl 16
762
    loop .nxt
763
 
764
    mcall 4,<45,280-2>,0,rep_text,rep_text_len-rep_text
765
    lea  edx,[ebx+(8*5)shl 16]
766
    pop  ecx
767
    mcall 47,0x30000,,,0xff
768
    add  ecx,7
769
    add  edx,(3*8+4)shl 16
770
    mcall
771
    mov  ecx,[icon_count]
772
    add  edx,(5*8+4)shl 16
773
    mcall
774
    pop  ecx
775
    add  edx,(10*8+4)shl 16
776
    mcall ,,,,0xff0000
777
    ret
778
 
779
; DATA AREA
780
 
781
 
782
bcolor dd 0x335599
783
 
784
icon_table:
785
 
786
    times 4  db  'xxxx  xxxx'
787
    times 2  db  '          '
788
    times 1  db  '          '
789
    times 2  db  'xxxx  xxxx'
790
;    times 1  db  '          '
791
 
792
icons_reserved:
793
    times 9  db  '          '
794
 
795
if lang eq ru
796
  text:
797
      db 255,255,255,0,   '   ’…Љ‘’                                       '
798
      db 255,255,255,0,   ' ЏђЋѓђЂЊЊЂ                                     '
799
      db 255,255,255,0,   ' ЏЂђЂЊ…’ђ›                                     '
800
      db 255,255,255,0,   '                 Џђ€Њ…Ќ€’њ                     '
801
      db 255,255,255,0,   '      „ЋЃЂ‚€’њ              “„Ђ‹€’њ            '
802
      db 0,0,0,0,         'ЌЂ†Њ€’… ЌЂ ЏЋ‡€–€ћ €ЉЋЌЉ€ „‹џ ђ…„ЂЉ’€ђЋ‚ЂЌ€џ   '
803
      db                  'x' ; <- END MARKER, DONT DELETE
135 diamond 804
add_text db 'ЌЂ†Њ€’… ЌЂ ЏЋ‡€–€ћ Ќ…€‘ЏЋ‹њ‡“…ЊЋ‰ €ЉЋЌЉ€'
805
add_text_len:
51 mikedld 806
 
135 diamond 807
rem_text db 'ЌЂ†Њ€’… ЌЂ ЏЋ‡€–€ћ €‘ЏЋ‹њ‡“…ЊЋ‰ €ЉЋЌЉ€'
808
rem_text_len:
51 mikedld 809
  labelt:
810
       db 'Ќ бва®©Є  а Ў®зҐЈ® бв®« '
811
  labellen:
135 diamond 812
else if lang eq en
51 mikedld 813
  text:
814
      db 255,255,255,0,   '   TITLE                                       '
815
      db 255,255,255,0,   '  APP NAME                                     '
816
      db 255,255,255,0,   ' PARAMETERS                                    '
817
      db 255,255,255,0,   '                APPLY CHANGES                  '
818
      db 255,255,255,0,   '      ADD ICON              REMOVE ICON        '
135 diamond 819
      db 0,0,0,0,         'CLICK BUTTON ON ICON POSITION FOR EDIT         '
51 mikedld 820
      db                  'x' ; <- END MARKER, DONT DELETE
135 diamond 821
add_text db 'CLICK ON A NOT USED POSITION'
822
add_text_len:
51 mikedld 823
 
135 diamond 824
rem_text db 'CLICK ICON POSITION; YOU WANT TO DELETE'
825
rem_text_len:
51 mikedld 826
  labelt:
827
       db 'Icon Manager'
828
  labellen:
135 diamond 829
else
830
  text:
831
      db 255,255,255,0,   '   TITLE                                       '
832
      db 255,255,255,0,   '  APP NAME                                     '
833
      db 255,255,255,0,   ' PARAMETER                                     '
834
      db 255,255,255,0,   '                ANWENDEN                       '
835
      db 255,255,255,0,   '     HINZUFUEGEN              ENTFERNEN        '
836
      db 0,0,0,0,         'AUF BUTTON KLICKEN, UM ICON ZU EDITIEREN       '
837
      db                  'x' ; <- END MARKER, DONT DELETE
838
add_text db 'AUF UNBENUTZTE ICONPOSITION KLICKEN'
51 mikedld 839
add_text_len:
840
 
135 diamond 841
rem_text db 'ICON ANKLICKEN; DAS GELOESCHT WERDEN SOLL'
51 mikedld 842
rem_text_len:
135 diamond 843
  labelt:
844
       db 'Icon Manager'
845
  labellen:
132 diamond 846
 
847
end if
135 diamond 848
 
849
;ya    dd 0
850
 
51 mikedld 851
arrows db ''
852
iconname:
853
      db ICON_APP,0
854
 
855
icon_default:
856
   db   'AA-SYSXTREE-000-/RD/1/SYSXTREE                '
857
   db   '-                              *'
858
   db   13,10
859
 
860
rep_text:
861
if lang eq ru
862
     db '‡ЌЂ—Љ€    -     €‡    , ‚›ЃђЂЌ #'
863
else
864
     db 'ICONS     -     OF    , SELECTED'
865
end if
866
 
867
rep_text_len:
868
 
869
;//////////////////////////
870
get_bg_info:
871
    mov  eax,39
872
    mov  ebx,4
873
    int  0x40
874
    mov  [bgrdrawtype],eax
875
 
876
    mov  eax,39     ; get background size
877
    mov  ebx,1
878
    int  0x40
879
    mov  [bgrxy],eax
880
 
881
    mov  ebx,eax
882
    shr  eax,16
883
    and  ebx,0xffff
884
    mov  [bgrx],eax
885
    mov  [bgry],ebx
886
    ret
887
 
888
calc_icon_pos:
889
    movzx eax,byte [ebp-20]    ; x position
890
    sub  eax,'A'        ;eax - number of letter
891
    cmp  eax,4
892
    jg     no_left
893
    shl  eax,6 ;imul eax,64
894
    add  eax,16
895
    movzx ebx,[warea.left]
896
    add  eax,ebx
897
    jmp  x_done
898
  no_left:
899
    sub  eax,9
900
    sal  eax,6 ;imul eax,64
901
    sub  eax,16+52-1
902
    movzx ebx,[warea.right]
903
    add  eax,ebx
904
  x_done:
905
;    mov  [xpos],eax
906
    mov  [ebp-12],eax
907
 
908
    movzx eax,byte [ebp-20+1]  ; y position
909
    sub  eax,'A'        ; eax - number of letter
910
    cmp  eax,4
911
    jg     no_up
912
    shl  eax,6            ;imul eax,80
913
    add  eax,16
914
    movzx ebx,[warea.top]
915
    add  eax,ebx
916
    jmp  y_done
917
  no_up:
918
    sub  eax,9
919
    shl  eax,6            ;imul eax,80
920
    sub  eax,16-1
921
    movzx ebx,[warea.bottom]
922
    add  eax,ebx
923
  y_done:
924
;    mov  [ypos],eax
925
    mov  [ebp-8],eax
926
    ret
927
 
928
;START2:
929
load_icon_list2:
930
    call  get_bg_info
931
 
932
        mcall   48,5
933
        mov     [warea.by_x],eax
934
        mov     [warea.by_y],ebx
935
 
936
        mov     eax,14
937
        int     0x40
938
        add     eax,0x00010001
939
        mov     [scrxy],eax
940
 
941
apply_changes2:
942
 
943
    mov  edi,[icons]
944
    mov  esi,icon_data
945
    mov  ebp,0x5000 ; threads stack starting point
946
 
947
  start_new:
948
    mov eax,[esi]
949
    mov [ebp-20],eax
950
    call calc_icon_pos
951
 
952
    mov  eax,51
953
    mov  ebx,1
954
    mov  ecx,thread
955
;    mov  edx,[thread_stack]
956
    mov  edx,ebp
957
;    sub  edx,4
958
;    mov  [edx],esi
959
    mov  dword[ebp-4],esi
960
    int  0x40
961
;    add  [thread_stack],0x100
962
    add  ebp,0x100
963
 
964
    mov  eax,5
965
    mov  ebx,1
966
wait_thread_start:         ;wait until thread draw itself first time
967
    cmp  [create_thread_event],bl
968
    jz     wait_thread_end
969
    int  0x40
970
    jmp  wait_thread_start
971
wait_thread_end:
972
    dec  [create_thread_event]     ;reset event
973
 
974
 
975
    add  esi,REC_SIZE
976
    dec  edi
977
    jnz  start_new
978
  close:
979
    or     eax,-1
980
    int  0x40
981
 
982
thread:
983
;   pop  ebp ;ebp - address of our icon
984
    sub  esp,12
985
    mov  ebp,esp
986
    sub  esp,16
987
    call draw_window2
988
    mov  [create_thread_event],1
989
    mov  eax,40
990
    mov  ebx,010101b
991
    int  0x40
992
 
993
still2:
994
 
995
    mov  eax,10
996
    int  0x40
997
 
998
    cmp  eax,1
999
    je     red2
1000
    cmp  eax,3
1001
    je     button2
1002
    cmp  eax,5
1003
    jne  still2
1004
 
1005
    call  get_bg_info
1006
    mov   eax,5
1007
    mov   ebx,1
1008
    call  draw_icon2
1009
 
1010
    jmp  still2
1011
 
1012
  red2:
1013
        mcall   14
1014
        add     eax,0x00010001
1015
        mov     [scrxy],eax
1016
        mcall   48,5
1017
        mov     [warea.by_x],eax
1018
        mov     [warea.by_y],ebx
1019
        add     ebp,+12
1020
        call    calc_icon_pos
1021
        add     ebp,-12
1022
        mcall   9,I_END,-1
1023
        mov     eax,[I_END+process_information.x_start]
1024
        cmp     eax,[ebp+0]
1025
        jne     @f
1026
        mov     eax,[I_END+process_information.y_start]
1027
        cmp     eax,[ebp+4]
1028
        je      .lp1
1029
    @@: call    get_bg_info
1030
        mcall   67,[ebp+0],[ebp+4],51,51
1031
 
1032
  .lp1: call    draw_window2
1033
        jmp     still2
1034
 
1035
  key2:
1036
    mov  eax,2
1037
    int  0x40
1038
 
1039
    jmp  still2
1040
 
1041
  button2:
1042
    mov  eax,17
1043
    int  0x40
1044
 
1045
;    mcall 55,eax, , ,klick_music
1046
 
1047
    mov  esi,[ebp+8]
1048
          mov  ebx,1
1049
          mov  edi,finfo.path
1050
          call fill_paths
1051
          inc  ebx
1052
       mov  edi,param_str
184 heavyiron 1053
    mov  dword[finfo_start+8],edi
51 mikedld 1054
          call fill_paths
1055
          cmp  byte[edi],0
1056
    jne  .no0
184 heavyiron 1057
    and  dword[finfo_start+8],0
51 mikedld 1058
  .no0:
1059
;    lea  ebx,[ebp+19]
184 heavyiron 1060
    mov  ebx,finfo_start
1061
    mov  eax,70
51 mikedld 1062
    int  0x40
1063
;    dph  eax
1064
    cmp  eax,1024
1065
    jae  still2
1066
    mcall 55,eax, , ,klick_music
1067
    jmp  still2
1068
 
1069
klick_music db 0x85,0x60,0x85,0x70,0x85,0x65,0
1070
 
1071
fill_paths:
1072
        push esi edi
1073
;        dps  '>'
1074
        movzx ecx,byte[str_lens+ebx]
1075
        add  esi,[positions+ebx*4]
1076
        push esi
1077
;  mov  edx,esi
1078
        add  esi,ecx
1079
 
1080
    .l1:
1081
        dec  esi
1082
        cmp  byte[esi],' '
1083
        jnz   .found
1084
        loop .l1
1085
  pop  esi
1086
  jmp  .noms
1087
    .found:
1088
        lea  ecx,[esi+1]
1089
        pop  esi
1090
        sub  ecx,esi
1091
        rep  movsb
1092
 .noms:
1093
        and  byte[edi],0
1094
;        call debug_outstr
1095
;        dps  <'<',13,10>
1096
        pop  edi esi
1097
        ret
1098
 
1099
atoi:
1100
        push esi
1101
        xor  eax,eax
1102
        xor  ebx,ebx
1103
  .nxt:
1104
    lodsb
1105
    cmp  al,'0'
1106
    jb   .done
1107
    cmp  al,'9'
1108
    ja   .done
1109
    sub  eax,'0'
1110
    imul ebx,10
1111
    add  ebx,eax
1112
    jmp  .nxt
1113
  .done:
1114
      pop  esi
1115
      mov  eax,ebx
1116
        ret
1117
 
1118
itoa:
1119
;        mov  esi,[current_icon]
1120
        add  esi,2
1121
    mov ebx,10
1122
    mov ecx,3
1123
  .l0:
1124
    xor edx,edx
1125
    div ebx
1126
    add dl,'0'
1127
    mov [esi],dl
1128
    dec esi
1129
    loop .l0
1130
;    and byte[esi],0
1131
        ret
1132
 
1133
draw_picture:
1134
    mov  [image],0x3000
1135
    mov  edi,[ebp+8]
1136
    lea  esi,[edi+12]
1137
    call atoi
1138
          cmp  eax,[icon_count]
1139
          ja  toponly.ex
1140
          imul eax,(32*3*32)
1141
          lea  edi,[eax+strip_file+12]
1142
    xor  ebx,ebx
1143
    xor  ecx,ecx
1144
    mov  esi,edi;strip_file+12+(32*3*32)*2
1145
 
1146
    mov  [pixpos],0
1147
  newb:
1148
    push ebx
1149
    push ecx
1150
 
1151
    cmp  ebx,10
1152
    jb     yesbpix
1153
    cmp  ebx,42
1154
    jge  yesbpix
1155
    cmp  ecx,31;2
1156
    jg     yesbpix
1157
 
1158
    push esi
1159
    mov  esi,edi
1160
    add  esi,[pixpos]
1161
 
1162
no_correction_pixpos:
1163
    add  [pixpos],3
1164
    mov  eax,[esi]
1165
    and  eax,0xffffff
1166
 
1167
    pop  esi
1168
 
1169
    cmp eax,0
1170
    je    yesbpix
1171
    cmp eax,0xfffcff ;f5f5f5
1172
    je    yesbpix
1173
    jmp nobpix
1174
 
1175
  yesbpix:
1176
 
1177
  stretch:
1178
    cmp   [bgrdrawtype],dword 2
1179
    jne   nostretch
1180
;    mov   eax,[ypos]
1181
    mov   eax,[ebp+4]
1182
    add   eax,ecx
1183
    imul  eax,[bgry]
1184
    cdq
1185
    movzx ebx,word [scrxy]
1186
    div   ebx
1187
    imul  eax,[bgrx]
1188
    push  eax
1189
;    mov   eax,[xpos]
1190
    mov   eax,[ebp+0]
1191
    add   eax,[esp+8]
1192
    imul  eax,[bgrx]
1193
    cdq
1194
    movzx ebx,word [scrxy+2]
1195
    div   ebx
1196
    add   eax,[esp]
1197
    add   esp,4
1198
 
1199
    jmp   notiled
1200
 
1201
  nostretch:
1202
 
1203
    cmp   [bgrdrawtype],dword 1
1204
    jne   notiled
1205
;    mov   eax,[ypos]
1206
    mov   eax,[ebp+4]
1207
    add   eax,ecx
1208
    cdq
1209
    movzx ebx,word [bgrxy]
1210
    div   ebx
1211
    mov   eax,edx
1212
    imul  eax,[bgrx]
1213
    push  eax
1214
;    mov   eax,[xpos]
1215
    mov   eax,[ebp+0]
1216
    add   eax,[esp+8]
1217
    movzx ebx,word [bgrxy+2]
1218
    cdq
1219
    div   ebx
1220
    mov   eax,edx
1221
    add   eax,[esp]
1222
    add   esp,4
1223
 
1224
  notiled:
1225
 
1226
    lea  ecx,[eax+eax*2]
1227
    mov  eax,39
1228
    mov  ebx,2
1229
    int  0x40
1230
 
1231
  nobpix:
1232
 
1233
    pop  ecx
1234
    pop  ebx
1235
 
1236
    mov  edx,eax
1237
    mov  eax,[image]
1238
    mov  [eax],edx
1239
    mov  [eax],dl
1240
    inc  eax
1241
    ror  edx,8
1242
    mov  [eax],dl
1243
    inc  eax
1244
    ror  edx,8
1245
    mov  [eax],dl
1246
    inc  eax
1247
    mov  [image],eax
1248
    inc  ebx
1249
    mov  eax,[yw]
1250
    inc  eax
1251
    cmp  ebx,eax
1252
    jnz  newb
1253
    xor  ebx,ebx
1254
 
1255
    inc  ecx
1256
 
1257
    mov  eax,[ya]
1258
    add  [pixpos],eax
1259
 
1260
    cmp  [top],1
1261
    jne  notop
1262
    cmp  ecx,38
1263
    je     toponly
1264
 
1265
  notop:
1266
 
1267
    cmp  ecx,52
1268
    jnz  newb
1269
 
1270
  toponly:
1271
 
1272
    mov  eax,7
1273
    mov  ebx,0x3000
1274
    mov  ecx,52 shl 16 + 52
1275
    xor  edx,edx
1276
    int  0x40
1277
  .ex:
1278
    mov  [load_pic],0
1279
    ret
1280
 
1281
draw_text:
1282
 
1283
    mov  esi,[ebp+8]
1284
    add  esi,3
1285
    push edi
1286
    mov  edi,labelt
1287
    mov  ecx,8
1288
    cld
1289
    rep  movsb
1290
    pop  edi
1291
    mov   eax,labelt
1292
  news2:
1293
    cmp   [eax],byte 33
1294
    jb      founde
1295
    inc   eax
1296
    cmp   eax,labelt+8;11
1297
    jb      news2
1298
   founde:
1299
    sub   eax,labelt
1300
    mov   [tl],eax
1301
 
1302
    mov   eax,[tl]
1303
    lea   eax,[eax+eax*2]  ; eax *= char_width/2
1304
    shl   eax,16
1305
 
1306
    mov   ebx,27*65536+42
1307
    sub   ebx,eax
1308
 
1309
    mov   eax,4
1310
    xor   ecx,ecx         ; black shade of text
1311
    mov   edx,labelt
1312
    mov   esi,[tl]
1313
    add   ebx,1 shl 16      ;*65536+1
1314
    int   0x40
1315
    inc   ebx
1316
    int   0x40
1317
    add   ebx,1 shl 16
1318
    int   0x40
1319
    inc   ebx
1320
    int   0x40
1321
    sub   ebx,1 shl 16
1322
    int   0x40
1323
    dec   ebx
1324
    sub   ebx,1 shl 16
1325
    int   0x40
1326
    sub   ebx,1 shl 16
1327
    dec   ebx
1328
    int   0x40
1329
    dec   ebx
1330
    add   ebx,1 shl 16
1331
    int   0x40
1332
    inc   ebx
1333
    mov   ecx,0xffffff
1334
 
1335
    int   0x40
1336
    mov   [draw_pic],0
1337
    ret
1338
 
1339
;   *********************************************
1340
;   *******  WINDOW DEFINITIONS AND DRAW ********
1341
;   *********************************************
1342
 
1343
 
1344
draw_window2:
1345
 
1346
    mov  eax,12            ; function 12:tell os about windowdraw
1347
    mov  ebx,1               ; 1, start of draw
1348
    int  0x40
1349
 
1350
                   ; DRAW WINDOW
1351
    xor  eax,eax             ; function 0 : define and draw window
1352
;    mov  ebx,[xpos-2]
1353
    mov  ebx,[ebp+0-2]
1354
;    mov  ecx,[ypos-2]
1355
    mov  ecx,[ebp+4-2]
1356
    add  ebx,[yw]           ; [x start] *65536 + [x size]
1357
    add  ecx,51            ; [y start] *65536 + [y size]
1358
    mov  edx,0x01000000        ; color of work area RRGGBB,8->color gl
1359
    int  0x40
1360
 
1361
    mov  eax,8      ; button
1362
    mov  ebx,51
1363
    mov  ecx,50
1364
    mov  edx,1+20000000 ; or 0x40000000
1365
    int  0x40
1366
 
1367
    mov  eax,5
1368
    mov  ebx,1
1369
draw_icon2:
1370
    xchg [load_pic],bl
1371
    test bl,bl
1372
    je     draw_icon_end
1373
    int  0x40
1374
    jmp  draw_icon2
1375
draw_icon_end:
1376
 
1377
    mov  eax,5
1378
    mov  ebx,1
1379
draw_icon_2:
1380
    xchg [draw_pic],bl
1381
    test bl,bl
1382
    je     draw_icon_end_2
1383
    int  0x40
1384
    jmp  draw_icon_2
1385
draw_icon_end_2:
1386
 
1387
    mov  eax,9
1388
    mov  ebx,process_table
1389
    mov  ecx,-1
1390
    int  0x40
1391
 
1392
    call draw_picture
1393
    call draw_text
1394
 
1395
    mov  eax,12
1396
    mov  ebx,2
1397
    int  0x40
1398
 
1399
    ret
1400
 
1401
tl        dd      8
1402
yw        dd     51
1403
ya        dd      0
1404
cur_btn   dd 40
1405
 
1406
;xpos       dd   15
1407
;ypos       dd  185
1408
draw_pic    db      0
1409
load_pic    db      0
1410
create_thread_event db 0
1411
 
1412
 
1413
image          dd  0x3000
1414
;thread_stack  dd  0x5000
1415
 
1416
;icons dd 0
1417
 
1418
 
1419
I_Param:
1420
 
1421
 icon_data = I_END+0x1400
1422
 process_table = I_END+0x2400
1423
 
1424
;I_END:
1425
 
1426
bgrx dd ?
1427
bgry dd ?
1428
param_str rb 31
1429
 
1430
;//////////////////////////
1431
 
1432
bgrxy        dd    ?
1433
warea:
1434
 .by_x:
1435
  .right  dw ?
1436
  .left   dw ?
1437
 .by_y:
1438
  .bottom dw ?
1439
  .top    dw ?
1440
scrxy        dd    ?
1441
bgrdrawtype  dd    ?
1442
 
1443
pixpos dd    ?
1444
top      dd ?
1445
icons dd ?
1446
addr  dd ?
1447
cur_str    dd ?
1448
cur_band   dd ?
1449
sel_icon1  rd 1
1450
icon_count rd 1
1451
gif_file  rb  GIF_SIZE
1452
strip_file rb RAW_SIZE
1453
;I_Param:
1454
 
1455
; icon_data = I_END+256
1456
 
1457
I_END: