Subversion Repositories Kolibri OS

Rev

Rev 551 | Rev 633 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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