Subversion Repositories Kolibri OS

Rev

Rev 409 | Rev 485 | 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 '/RD/1/ICONS.DAT'
  16. ICON_APP equ '/RD/1/ICON'
  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
  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.     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.     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.     int  0x40
  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.     int 0x40
  143.  
  144.     ; (2) terminate all icons
  145.     mov  eax,9
  146.     mov  ebx,I_END
  147.     or      ecx,-1
  148.     int  0x40
  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.     int  0x40
  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.     int  0x40
  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.         int     0x40
  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.     int  0x40
  223.  
  224.     mov  eax,10
  225.     int  0x40
  226.     cmp  eax,3
  227.     jne  still
  228.     mov  eax,17
  229.     int  0x40
  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.     int  0x40
  289.  
  290.     mov  eax,10
  291.     int  0x40
  292.     cmp  eax,3
  293.     jne  no_f;ound
  294.     mov  eax,17
  295.     int  0x40
  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.     int  0x40
  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.     int  0x40
  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.     int  0x40
  508.     cmp  eax,2
  509.     jz   fbu
  510.     jmp  rs_done
  511.   fbu:
  512.     mov  eax,2
  513.     int  0x40
  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.     int  0x40
  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.     int  0x40
  564.  
  565.                                    ; DRAW WINDOW
  566.     xor  eax,eax
  567.     mov  ebx,210*65536+300
  568.     mov  ecx,30*65536+390-14
  569.     mov  edx,0x13ffffff
  570.     mov  edi,header       ; WINDOW LABEL
  571.     int  0x40
  572.  
  573.     mov  eax,13                    ; WINDOW AREA
  574.     mov  ebx,20*65536+260
  575.     mov  ecx,35*65536+200
  576.     mov  edx,0x3366cc
  577.     int  0x40
  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.     int  0x40
  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.     int  0x40
  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.     int  0x40
  597.     inc  edx
  598.     add  ecx,14*65536
  599.     int  0x40
  600.     inc  edx
  601.     add  ecx,14*65536
  602.     int  0x40
  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.     int  0x40
  610.  
  611. ;    mov  eax,8                     ; ADD ICON BUTTON
  612.     mov  ebx,20*65536+129-2
  613.     add  ecx,14*65536
  614.     inc  edx
  615.     int  0x40
  616.  
  617. ;    mov  eax,8                     ; REMOVE ICON BUTTON
  618.     add  ebx,(130+2)*65536
  619.     inc  edx
  620.     int  0x40
  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.     int  0x40
  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.     int  0x40
  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.     int  0x40
  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+12+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. add_text             db '€†Œˆ’… € Ž‡ˆ–ˆž …ˆ‘Ž‹œ‡“…ŒŽ‰ ˆŠŽŠˆ     ',0
  782.  
  783. rem_text             db '€†Œˆ’… € Ž‡ˆ–ˆž ˆ‘Ž‹œ‡“…ŒŽ‰ ˆŠŽŠˆ       ',0
  784. header                 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. add_text             db 'AUF UNBENUTZTE ICONPOSITION KLICKEN         ',0
  796.  
  797. rem_text             db 'ICON ANKLICKEN; DAS GELOESCHT WERDEN SOLL',0
  798. header     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.  
  811. rem_text            db 'CLICK ICON POSITION; YOU WANT TO DELETE',0
  812. header     db 'Icon Manager',0
  813.  
  814. end if
  815.  
  816. arrows db '</>'
  817. iconname:
  818.       db ICON_APP,0
  819.  
  820. icon_default:
  821.    db   'AA-SYSXTREE-000-/RD/1/SYSXTREE                '
  822.    db   '-                              *'
  823.    db   13,10
  824.  
  825. rep_text:
  826. if lang eq ru
  827.      db '‡€—Šˆ    -     ˆ‡    , ‚›€ #'
  828. else
  829.      db 'ICONS     -     OF    , SELECTED'
  830. end if
  831.  
  832. rep_text_len:
  833.  
  834. ;//////////////////////////
  835. get_bg_info:
  836.     mov  eax,39
  837.     mov  ebx,4
  838.     int  0x40
  839.     mov  [bgrdrawtype],eax
  840.  
  841.     mov  eax,39     ; get background size
  842.     mov  ebx,1
  843.     int  0x40
  844.     mov  [bgrxy],eax
  845.  
  846.     mov  ebx,eax
  847.     shr  eax,16
  848.     and  ebx,0xffff
  849.     mov  [bgrx],eax
  850.     mov  [bgry],ebx
  851.     ret
  852.  
  853. calc_icon_pos:
  854.     movzx eax,byte [ebp-20]    ; x position
  855.     sub  eax,'A'        ;eax - number of letter
  856.     cmp  eax,4
  857.     jg     no_left
  858.     shl  eax,6 ;imul eax,64
  859.     add  eax,16
  860.     movzx ebx,[warea.left]
  861.     add  eax,ebx
  862.     jmp  x_done
  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  [xpos],eax
  871.     mov  [ebp-12],eax
  872.  
  873.     movzx eax,byte [ebp-20+1]  ; y position
  874.     sub  eax,'A'        ; eax - number of letter
  875.     cmp  eax,4
  876.     jg     no_up
  877.     shl  eax,6            ;imul eax,80
  878.     add  eax,16
  879.     movzx ebx,[warea.top]
  880.     add  eax,ebx
  881.     jmp  y_done
  882.   no_up:
  883.     sub  eax,9
  884.     shl  eax,6            ;imul eax,80
  885.     sub  eax,16-1
  886.     movzx ebx,[warea.bottom]
  887.     add  eax,ebx
  888.   y_done:
  889. ;    mov  [ypos],eax
  890.     mov  [ebp-8],eax
  891.     ret
  892.  
  893. ;START2:
  894. load_icon_list2:
  895.     call  get_bg_info
  896.  
  897.         mcall   48,5
  898.         mov     [warea.by_x],eax
  899.         mov     [warea.by_y],ebx
  900.  
  901.         mov     eax,14
  902.         int     0x40
  903.         add     eax,0x00010001
  904.         mov     [scrxy],eax
  905.  
  906. apply_changes2:
  907.  
  908.     mov  edi,[icons]
  909.     mov  esi,icon_data
  910.     mov  ebp,0x5000 ; threads stack starting point
  911.  
  912.   start_new:
  913.     mov eax,[esi]
  914.     mov [ebp-20],eax
  915.     call calc_icon_pos
  916.  
  917.     mov  eax,51
  918.     mov  ebx,1
  919.     mov  ecx,thread
  920. ;    mov  edx,[thread_stack]
  921.     mov  edx,ebp
  922. ;    sub  edx,4
  923. ;    mov  [edx],esi
  924.     mov  dword[ebp-4],esi
  925.     int  0x40
  926. ;    add  [thread_stack],0x100
  927.     add  ebp,0x100
  928.  
  929.     mov  eax,5
  930.     mov  ebx,1
  931. wait_thread_start:         ;wait until thread draw itself first time
  932.     cmp  [create_thread_event],bl
  933.     jz     wait_thread_end
  934.     int  0x40
  935.     jmp  wait_thread_start
  936. wait_thread_end:
  937.     dec  [create_thread_event]     ;reset event
  938.  
  939.  
  940.     add  esi,REC_SIZE
  941.     dec  edi
  942.     jnz  start_new
  943.   close:
  944.     or     eax,-1
  945.     int  0x40
  946.  
  947. thread:
  948. ;   pop  ebp ;ebp - address of our icon
  949.     sub  esp,12
  950.     mov  ebp,esp
  951.     sub  esp,16
  952.     call draw_window2
  953.     mov  [create_thread_event],1
  954.     mov  eax,40
  955.     mov  ebx,010101b
  956.     int  0x40
  957.  
  958. still2:
  959.  
  960.     mov  eax,10
  961.     int  0x40
  962.  
  963.     cmp  eax,1
  964.     je     red2
  965.     cmp  eax,3
  966.     je     button2
  967.     cmp  eax,5
  968.     jne  still2
  969.  
  970.     call  get_bg_info
  971.     mov   eax,5
  972.     mov   ebx,1
  973.     call  draw_icon2
  974.  
  975.     jmp  still2
  976.  
  977.   red2:
  978.         mcall   14
  979.         add     eax,0x00010001
  980.         mov     [scrxy],eax
  981.         mcall   48,5
  982.         mov     [warea.by_x],eax
  983.         mov     [warea.by_y],ebx
  984.         add     ebp,+12
  985.         call    calc_icon_pos
  986.         add     ebp,-12
  987.         mcall   9,I_END,-1
  988.         mov     eax,[I_END+process_information.x_start]
  989.         cmp     eax,[ebp+0]
  990.         jne     @f
  991.         mov     eax,[I_END+process_information.y_start]
  992.         cmp     eax,[ebp+4]
  993.         je      .lp1
  994.     @@: call    get_bg_info
  995.         mcall   67,[ebp+0],[ebp+4],51,51
  996.  
  997.   .lp1: call    draw_window2
  998.         jmp     still2
  999.  
  1000.   key2:
  1001.     mov  al,2
  1002.     int  0x40
  1003.  
  1004.     jmp  still2
  1005.  
  1006.   button2:
  1007.     mov  al,17
  1008.     int  0x40
  1009.  
  1010.  
  1011.     mov  esi,[ebp+8]
  1012.           mov  ebx,1
  1013.           mov  edi,finfo.path
  1014.           call fill_paths
  1015.           inc  ebx
  1016.        mov  edi,param_str
  1017.     mov  dword[finfo_start+8],edi
  1018.           call fill_paths
  1019.           cmp  byte[edi],0
  1020.     jne  .no0
  1021.     and  dword[finfo_start+8],0
  1022.   .no0:
  1023. ;    lea  ebx,[ebp+19]
  1024.     mov  ebx,finfo_start
  1025.     mov  eax,70
  1026.     int  0x40
  1027. ;    dph  eax
  1028. ;    cmp  eax,1024
  1029. ;    jae  still2
  1030.     jmp  still2
  1031.  
  1032. fill_paths:
  1033.         push esi edi
  1034. ;        dps  '>'
  1035.         movzx ecx,byte[str_lens+ebx]
  1036.         add  esi,[positions+ebx*4]
  1037.         push esi
  1038. ;  mov  edx,esi
  1039.         add  esi,ecx
  1040.  
  1041.     .l1:
  1042.         dec  esi
  1043.         cmp  byte[esi],' '
  1044.         jnz   .found
  1045.         loop .l1
  1046.   pop  esi
  1047.   jmp  .noms
  1048.     .found:
  1049.         lea  ecx,[esi+1]
  1050.         pop  esi
  1051.         sub  ecx,esi
  1052.         rep  movsb
  1053.  .noms:
  1054.         and  byte[edi],0
  1055. ;        call debug_outstr
  1056. ;        dps  <'<',13,10>
  1057.         pop  edi esi
  1058.         ret
  1059.  
  1060. atoi:
  1061.         push esi
  1062.         xor  eax,eax
  1063.         xor  ebx,ebx
  1064.   .nxt:
  1065.     lodsb
  1066.     cmp  al,'0'
  1067.     jb   .done
  1068.     cmp  al,'9'
  1069.     ja   .done
  1070.     sub  eax,'0'
  1071.     imul ebx,10
  1072.     add  ebx,eax
  1073.     jmp  .nxt
  1074.   .done:
  1075.       pop  esi
  1076.       mov  eax,ebx
  1077.         ret
  1078.  
  1079. itoa:
  1080. ;        mov  esi,[current_icon]
  1081.         add  esi,2
  1082.     mov ebx,10
  1083.     mov ecx,3
  1084.   .l0:
  1085.     xor edx,edx
  1086.     div ebx
  1087.     add dl,'0'
  1088.     mov [esi],dl
  1089.     dec esi
  1090.     loop .l0
  1091. ;    and byte[esi],0
  1092.         ret
  1093.  
  1094. draw_picture:
  1095.     mov  [image],0x3000
  1096.     mov  edi,[ebp+8]
  1097.     lea  esi,[edi+12]
  1098.     call atoi
  1099.           cmp  eax,[icon_count]
  1100.           ja  toponly.ex
  1101.           imul eax,(32*3*32)
  1102.           lea  edi,[eax+strip_file+12]
  1103.     xor  ebx,ebx
  1104.     xor  ecx,ecx
  1105.     mov  esi,edi;strip_file+12+(32*3*32)*2
  1106.  
  1107.     mov  [pixpos],0
  1108.   newb:
  1109.     push ebx
  1110.     push ecx
  1111.  
  1112.     cmp  ebx,10
  1113.     jb     yesbpix
  1114.     cmp  ebx,42
  1115.     jge  yesbpix
  1116.     cmp  ecx,31;2
  1117.     jg     yesbpix
  1118.  
  1119.     push esi
  1120.     mov  esi,edi
  1121.     add  esi,[pixpos]
  1122.  
  1123. no_correction_pixpos:
  1124.     add  [pixpos],3
  1125.     mov  eax,[esi]
  1126.     and  eax,0xffffff
  1127.  
  1128.     pop  esi
  1129.  
  1130.     cmp eax,0
  1131.     je    yesbpix
  1132.     cmp eax,0xfffcff ;f5f5f5
  1133.     je    yesbpix
  1134.     jmp nobpix
  1135.  
  1136.   yesbpix:
  1137.  
  1138.   stretch:
  1139.     cmp   [bgrdrawtype],dword 2
  1140.     jne   nostretch
  1141. ;    mov   eax,[ypos]
  1142.     mov   eax,[ebp+4]
  1143.     add   eax,ecx
  1144.     imul  eax,[bgry]
  1145.     cdq
  1146.     movzx ebx,word [scrxy]
  1147.     div   ebx
  1148.     imul  eax,[bgrx]
  1149.     push  eax
  1150. ;    mov   eax,[xpos]
  1151.     mov   eax,[ebp+0]
  1152.     add   eax,[esp+8]
  1153.     imul  eax,[bgrx]
  1154.     cdq
  1155.     movzx ebx,word [scrxy+2]
  1156.     div   ebx
  1157.     add   eax,[esp]
  1158.     add   esp,4
  1159.  
  1160.     jmp   notiled
  1161.  
  1162.   nostretch:
  1163.  
  1164.     cmp   [bgrdrawtype],dword 1
  1165.     jne   notiled
  1166. ;    mov   eax,[ypos]
  1167.     mov   eax,[ebp+4]
  1168.     add   eax,ecx
  1169.     cdq
  1170.     movzx ebx,word [bgrxy]
  1171.     div   ebx
  1172.     mov   eax,edx
  1173.     imul  eax,[bgrx]
  1174.     push  eax
  1175. ;    mov   eax,[xpos]
  1176.     mov   eax,[ebp+0]
  1177.     add   eax,[esp+8]
  1178.     movzx ebx,word [bgrxy+2]
  1179.     cdq
  1180.     div   ebx
  1181.     mov   eax,edx
  1182.     add   eax,[esp]
  1183.     add   esp,4
  1184.  
  1185.   notiled:
  1186.  
  1187.     lea  ecx,[eax+eax*2]
  1188.     mov  eax,39
  1189.     mov  ebx,2
  1190.     int  0x40
  1191.  
  1192.   nobpix:
  1193.  
  1194.     pop  ecx
  1195.     pop  ebx
  1196.  
  1197.     mov  edx,eax
  1198.     mov  eax,[image]
  1199.     mov  [eax],edx
  1200.     mov  [eax],dl
  1201.     inc  eax
  1202.     ror  edx,8
  1203.     mov  [eax],dl
  1204.     inc  eax
  1205.     ror  edx,8
  1206.     mov  [eax],dl
  1207.     inc  eax
  1208.     mov  [image],eax
  1209.     inc  ebx
  1210.     mov  eax,[yw]
  1211.     inc  eax
  1212.     cmp  ebx,eax
  1213.     jnz  newb
  1214.     xor  ebx,ebx
  1215.  
  1216.     inc  ecx
  1217.  
  1218.     mov  eax,[ya]
  1219.     add  [pixpos],eax
  1220.  
  1221.     cmp  [top],1
  1222.     jne  notop
  1223.     cmp  ecx,38
  1224.     je     toponly
  1225.  
  1226.   notop:
  1227.  
  1228.     cmp  ecx,52
  1229.     jnz  newb
  1230.  
  1231.   toponly:
  1232.  
  1233.     mov  eax,7
  1234.     mov  ebx,0x3000
  1235.     mov  ecx,52 shl 16 + 52
  1236.     xor  edx,edx
  1237.     int  0x40
  1238.   .ex:
  1239.     mov  [load_pic],0
  1240.     ret
  1241.  
  1242. draw_text:
  1243.  
  1244.     mov  esi,[ebp+8]
  1245.     add  esi,3
  1246.     push edi
  1247.     mov  edi,header
  1248.     mov  ecx,8
  1249.     cld
  1250.     rep  movsb
  1251.     pop  edi
  1252.     mov   eax,header
  1253.   news2:
  1254.     cmp   [eax],byte 33
  1255.     jb      founde
  1256.     inc   eax
  1257.     cmp   eax,header+8;11
  1258.     jb      news2
  1259.    founde:
  1260.     sub   eax,header
  1261.     mov   [tl],eax
  1262.  
  1263.     mov   eax,[tl]
  1264.     lea   eax,[eax+eax*2]  ; eax *= char_width/2
  1265.     shl   eax,16
  1266.  
  1267.     mov   ebx,27*65536+40
  1268.     sub   ebx,eax
  1269.  
  1270.     mov   eax,4
  1271.     xor   ecx,ecx         ; black shade of text
  1272.     mov   edx,header
  1273.     mov   esi,[tl]
  1274.     add   ebx,1 shl 16      ;*65536+1
  1275.     int   0x40
  1276.     inc   ebx
  1277.     int   0x40
  1278.     add   ebx,1 shl 16
  1279.     int   0x40
  1280.     inc   ebx
  1281.     int   0x40
  1282.     sub   ebx,1 shl 16
  1283.     int   0x40
  1284.     dec   ebx
  1285.     sub   ebx,1 shl 16
  1286.     int   0x40
  1287.     sub   ebx,1 shl 16
  1288.     dec   ebx
  1289.     int   0x40
  1290.     dec   ebx
  1291.     add   ebx,1 shl 16
  1292.     int   0x40
  1293.     inc   ebx
  1294.     mov   ecx,0xffffff
  1295.  
  1296.     int   0x40
  1297.     mov   [draw_pic],0
  1298.     ret
  1299.  
  1300. ;   *********************************************
  1301. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  1302. ;   *********************************************
  1303.  
  1304.  
  1305. draw_window2:
  1306.  
  1307.     mov  eax,12            ; function 12:tell os about windowdraw
  1308.     mov  ebx,1               ; 1, start of draw
  1309.     int  0x40
  1310.  
  1311.                    ; DRAW WINDOW
  1312.     xor  eax,eax             ; function 0 : define and draw window
  1313. ;    mov  ebx,[xpos-2]
  1314.     mov  ebx,[ebp+0-2]
  1315. ;    mov  ecx,[ypos-2]
  1316.     mov  ecx,[ebp+4-2]
  1317.     add  ebx,[yw]           ; [x start] *65536 + [x size]
  1318.     add  ecx,51            ; [y start] *65536 + [y size]
  1319.     mov  edx,0x01000000        ; color of work area RRGGBB,8->color gl
  1320.     int  0x40
  1321.  
  1322.     mov  eax,8      ; button
  1323.     mov  ebx,51
  1324.     mov  ecx,50
  1325.     mov  edx,0x40000001
  1326.     int  0x40
  1327.  
  1328.     mov  eax,5
  1329.     mov  ebx,1
  1330. draw_icon2:
  1331.     xchg [load_pic],bl
  1332.     test bl,bl
  1333.     je     draw_icon_end
  1334.     int  0x40
  1335.     jmp  draw_icon2
  1336. draw_icon_end:
  1337.  
  1338.     mov  eax,5
  1339.     mov  ebx,1
  1340. draw_icon_2:
  1341.     xchg [draw_pic],bl
  1342.     test bl,bl
  1343.     je     draw_icon_end_2
  1344.     int  0x40
  1345.     jmp  draw_icon_2
  1346. draw_icon_end_2:
  1347.  
  1348.     mov  eax,9
  1349.     mov  ebx,process_table
  1350.     mov  ecx,-1
  1351.     int  0x40
  1352.  
  1353.     call draw_picture
  1354.     call draw_text
  1355.  
  1356.     mov  eax,12
  1357.     mov  ebx,2
  1358.     int  0x40
  1359.  
  1360.     ret
  1361.  
  1362. tl        dd      8
  1363. yw        dd     51
  1364. ya        dd      0
  1365. cur_btn   dd 40
  1366.  
  1367. ;xpos       dd   15
  1368. ;ypos       dd  185
  1369. draw_pic    db      0
  1370. load_pic    db      0
  1371. create_thread_event db 0
  1372.  
  1373.  
  1374. image          dd  0x3000
  1375. ;thread_stack  dd  0x5000
  1376.  
  1377. ;icons dd 0
  1378.  
  1379.  
  1380. I_Param:
  1381.  
  1382.  icon_data = I_END+0x1400
  1383.  process_table = I_END+0x2400
  1384.  
  1385. ;I_END:
  1386.  
  1387. bgrx dd ?
  1388. bgry dd ?
  1389. param_str rb 31
  1390.  
  1391. ;//////////////////////////
  1392.  
  1393. bgrxy        dd    ?
  1394. warea:
  1395.  .by_x:
  1396.   .right  dw ?
  1397.   .left   dw ?
  1398.  .by_y:
  1399.   .bottom dw ?
  1400.   .top    dw ?
  1401. scrxy        dd    ?
  1402. bgrdrawtype  dd    ?
  1403.  
  1404. pixpos dd    ?
  1405. top      dd ?
  1406. icons dd ?
  1407. addr  dd ?
  1408. cur_str    dd ?
  1409. cur_band   dd ?
  1410. sel_icon1  rd 1
  1411. icon_count rd 1
  1412. gif_file  rb  GIF_SIZE
  1413. strip_file rb RAW_SIZE
  1414. ;I_Param:
  1415.  
  1416. ; icon_data = I_END+256
  1417.  
  1418. I_END:
  1419.