Subversion Repositories Kolibri OS

Rev

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