Subversion Repositories Kolibri OS

Rev

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

  1. ;#___________________________________________________________________________________________________
  2. ;****************************************************************************************************|
  3. ; Program Palitra (c) Sergei Steshin (Akyltist)                                                      |
  4. ;----------------------------------------------------------------------------------------------------|
  5. ;; Charset:DOS-866 Font:Courier New Size:9pt                                                         |
  6. ;.....................................................................................................
  7. ;; compiler:     FASM 1.69.31                                                                        |
  8. ;; version:      0.3.0                                                                               |
  9. ;; last update:  08/11/2012                                                                          |
  10. ;; e-mail:       dr.steshin@gmail.com                                                                |
  11. ;.....................................................................................................
  12. ;; History:                                                                                          |
  13. ;; 0.1.0 - ¥à¢ ï ¢¥àá¨ï ¯à®£à ¬¬ë.                                                                  |
  14. ;; 0.2.0 - ˆá¯à ¢«¥­® ¯®¯ ¤ ­¨¥ ¢ á¥âªã, ¡¥à¥âáï ¡«¨¦ ©è¨© ¯® ¤¨ £®­ «¨ ¯¨ªá¥«ì.                     |
  15. ;;       - „®¡ ¢«¥­ë ¯®«§ã­ª¨, ¤«ï ॣ㫨஢ ­¨ï rgb á®áâ ¢«ïîé¨å æ¢¥â  ¨ ¢ë¢®¤ íâ¨å á®áâ ¢«ïîé¨å.   |
  16. ;;       - “¡à ­ ¢ë¢®¤ æ¢¥â  ¢ ¡¨­ à­®¬ ¢¨¤¥ (¯®ª  §  ­¥ ­ ¤®¡­®áâìî ¨ ­¥  ªâã «ì­®áâìî).            |
  17. ;;       - Œ¥«ª ï ª®á¬¥â¨ª .                                                                         |
  18. ;; 0.3.0 - „®¡ ¢«¥­® ¯¥à¥ª«î祭¨¥ ¢¨¤®¢ 梥⮢ëå á奬 (ª­®¯ª  NEXT)                                  |
  19. ;;       - “«ãçè¥­ë ¯®«§ã­ª¨, ¯à®¨§¢®¤¨âáï ®¡à ¡®âª  ­ ¦ â¨ï à冷¬ á ¯®«§ã­ª®¬.                      |
  20. ;;       - —¨á«® á¥â®ª ¢ 梥⮢®© á奬¥ 㬥­ì襭® á 6 ¤® 4 (ªà â­®áâì 256, ¨­ ç¥ ¤ã¡«¨à®¢ ­¨¥ 梥â ).|
  21. ;;       - Œ¥«ª ï ª®á¬¥â¨ª .                                                                         |
  22. ;; 0.4.0 - „®¡ ¢«¥­® ¯¥à¥ª«î祭¨¥ ¬¥¦¤ã ¤¢ã¬ï 梥⠬¨                                                |
  23. ;;       - „®¡ ¢«¥­ ¯®«§ã­®ª ॣ㫨஢ ­¨ï ¯à®§à ç­®á⨠(¡¥§ ¢¨§ã «¨§ æ¨¨).                          |
  24. ;;       - „®¡ ¢«¥­® ¢ëà ¢­¨¢ ­¨¥ §­ ç¥­¨© rgba ¯® 業âàã, ¢ § ¢¨á¨¬®á⨠®â ¤«¨­­ë.                  |
  25. ;;       - Š®á¬¥â¨ç¥áª¨¥ ¯à ¢ª¨.                                                                     |
  26. ;;       - ¥¡®«ìè ï ®¯â¨¬¨§ æ¨ï.                                                                    |
  27. ;; 0.5.0 - „®¡ ¢«¥­  ª­®¯ª  ᬥ­ë ä®­  à ¡®ç¥£® á⮫  (®â Leency).                                   |
  28. ;;       - „®¡ ¢«¥­® ¨§¬¥­¥­¨¥ ä®­  à ¡®ç¥£® á⮫  £à ¤¨¥­â­®© § «¨¢ª®©.                             |
  29. ;;       - Š®á¬¥â¨ç¥áª¨¥ ¯à ¢ª¨.                                                                     |
  30. ;;       - ¥¡®«ìè ï ¤¥®¯â¨¬¨§ æ¨ï.                                                                  |
  31. ;; 0.6.0 - „®¡ ¢«¥­  ¢®§¬®¦­®áâì § ¯ã᪠ á ¯ à ¬¥âà ¬¨                                               |
  32. ;;       - „®¡ ¢«¥­ ०¨¬ H (hidden) ¯à®¨§¢®¤¨â § ¬¥­ã ä®­  à ¡®ç¥£® á⮫  £à ¤¨¥­â­®© § «¨¢ª®©.     |
  33. ;;       - ®«ìè ï ¤¥®¯â¨¬¨§ æ¨ï.                                                                    |
  34. ;; 0.7.0 - „®¡ ¢«¥­  ¯¨¯¥âª  - ¢ë¡®à ­  á।­îî ª­®¯ªã ¬ëè¨                                          |
  35. ;; 0.7.5 -  ¦ â¨¥ ¯à ¢®© ª« ¢¨è¥© ¬ëè¨ ­  ï祩ªã á 梥⮬ ãáâ ­ ¢«¨¢ ¥â ­¥ ®á­®¢®©,   ¤®¯®«­. æ¢¥â  |
  36. ;;       - “¬¥­ì襭® ¬¥àæ ­¨¥ ¯à¨ à ¡®â¥ ¯¨¯¥âª¨                                                     |
  37. ;; 0.7.6 - „®¡ ¢«¥­ ०¨¬ B, ª®â®àë© ¯à®¨§¢®¤¨â § ¬¥­ã ä®­  à ¡®ç¥£® á⮫  è㬭®© § «¨¢ª®© (e-andrew)|
  38. ;.....................................................................................................
  39. ;; All rights reserved.                                                                              |
  40. ;;                                                                                                   |
  41. ;; Redistribution and use in source and binary forms, with or without modification, are permitted    |
  42. ;; provided that the following conditions are met:                                                   |
  43. ;;       * Redistributions of source code must retain the above copyright notice, this list of       |
  44. ;;         conditions and the following disclaimer.                                                  |
  45. ;;       * Redistributions in binary form must reproduce the above copyright notice, this list of    |
  46. ;;         conditions and the following disclaimer in the documentation and/or other materials       |
  47. ;;         provided with the distribution.                                                           |
  48. ;;       * Neither the name of the <organization> nor the names of its contributors may be used to   |
  49. ;;         endorse or promote products derived from this software without specific prior written     |
  50. ;;         permission.                                                                               |
  51. ;;                                                                                                   |
  52. ;; THIS SOFTWARE IS PROVIDED BY Sergei Steshin ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,      |
  53. ;; INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A        |
  54. ;; PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY DIRECT, |
  55. ;; INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED    |
  56. ;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS       |
  57. ;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
  58. ;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  |
  59. ;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                                      |
  60. ;....................................................................................................|
  61.  
  62.  
  63. ;#___________________________________________________________________________________________________
  64. ;****************************************************************************************************|
  65. ; ‡€ƒŽ‹Ž‚ŽŠ ˆ‘Ž‹Ÿ…ŒŽƒŽ ”€‰‹€ ˆ‹Ž†…ˆŸ „‹Ÿ ŠŽ‹ˆˆ Ž‘                                             |
  66. ;----------------------------------------------------------------------------------------------------/
  67.   use32
  68.   org    0
  69.   db     'MENUET01'
  70.   dd     1,START,I_END,I_MEM,stacktop,params,sys_path
  71.  
  72.   include '../../../macros.inc'
  73.   include '../../../proc32.inc'
  74.   include '../../../KOSfuncs.inc'
  75.   include '../../../dll.inc'
  76.  
  77.   include 'draw_sliders.inc'
  78.   include 'draw_utils.inc'
  79.   include 'draw_palitra.inc'
  80.  
  81.  
  82.  
  83.   WIN_W  = 394            ; è¨à¨­  ®ª­ 
  84.   WIN_H  = 251            ; ¢ëá®â  ®ª­ 
  85.   WIN_X  = 250            ; ª®®à¤¨­ â  å ®ª­ 
  86.   WIN_Y  = 190            ; ª®®à¤¨­ â  ã ®ª­ 
  87.  
  88.   Left_Border=4
  89.   SliderPanel_W = 110
  90.   DRAWY  = 9
  91.  
  92.   CELLW  = 11; 11            ; not used yet, but has to be :)
  93.  
  94.   ICONX  = WIN_W - 35
  95.   SLIDEW = 25
  96.  
  97.   palitra_x = Left_Border+SliderPanel_W+12
  98.   palitra_w = CELLW*(8)+8+1
  99.   palitra_xw = palitra_x shl 16 + palitra_w
  100.   palitra_yw = DRAWY shl 16 + palitra_w
  101.  
  102. START:
  103.     mcall   SF_SYS_MISC,SSF_HEAP_INIT ; ¨­¨æ¨ «¨§ æ¨ï ªãç¨
  104.     mcall SF_SYS_MISC, SSF_MEM_OPEN, i18_name
  105.     mov [icons18], eax
  106.     mcall SF_SYS_MISC, SSF_MEM_OPEN, i18bg_name
  107.     mov [icons18bg], eax
  108.  
  109.     stdcall dll.Load, @IMPORT
  110.     or      eax,eax
  111.     jnz     bexit
  112.     mcall   SF_SET_EVENTS_MASK,EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE ; ãáâ ­ ¢«¨¢ ¥¬ ¬ áªã ᮡë⨩
  113.     include 'params_init.inc'             ; ®¡à ¡®âª  ¯ à ¬¥â஢ ª®¬ ­¤­®© áâப¨
  114.  
  115. ;#___________________________________________________________________________________________________
  116. ;****************************************************************************************************|
  117. ; Ž‘Ž‚Ž‰ –ˆŠ‹ Žƒ€ŒŒ› - Ž€Ž’Š€ ‘Ž›’ˆ‰                                                        |
  118. ;----------------------------------------------------------------------------------------------------/
  119. red:
  120.     call draw_main                        ; ¢ë§ë¢ ¥¬ ¯¥à¥à¨á®¢ªã ®ª­  ¯à¨«®¦¥­¨ï
  121. still:
  122.     mcall   SF_WAIT_EVENT         ; äã­ªæ¨ï 10 - ¦¤ âì ᮡëâ¨ï
  123.     cmp     eax,EV_REDRAW                 ; ¯¥à¥à¨á®¢ âì ®ª­® ?
  124.     je      red                           ; ¥á«¨ ¤  - ­  ¬¥âªã red
  125.     cmp     eax,EV_KEY                    ; ­ ¦ â  ª« ¢¨è  ?
  126.     je      key                           ; ¥á«¨ ¤  - ­  key
  127.     cmp     eax,EV_BUTTON                 ; ­ ¦ â  ª­®¯ª  ?
  128.     je      button                        ; ¥á«¨ ¤  - ­  button
  129.     cmp     eax,EV_MOUSE                  ; ᮡë⨥ ®â ¬ëè¨ ¢­¥ ®ª­ 
  130.     je      mouse                         ; ¥á«¨ ¤  - ­  button
  131.     jmp     still                         ; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ­ ç «® 横« 
  132. ;end_still
  133.  
  134. key:                                      ; ­ ¦ â  ª« ¢¨è  ­  ª« ¢¨ âãà¥
  135.     mcall   SF_GET_KEY    ; äã­ªæ¨ï 2 - áç¨â âì ª®¤ ᨬ¢®«  (¢ ah) (âãâ ¢ ¯à¨­æ¨¯¥ ­¥ ­ã¦­ )
  136.     jmp     still                         ; ¢¥à­ãâìáï ª ­ ç «ã 横« 
  137. ;end_key
  138.  
  139. mouse:
  140.     cmp     [renmode],2
  141.     jne     left
  142.     call    cyrcle_draw
  143.     jmp     center
  144.   left:
  145.     mcall   SF_MOUSE_GET,SSF_BUTTON
  146.     cmp     al,1b
  147.     jne     right
  148.     mov     [mouse_f],1
  149.     jmp     still
  150.   right:
  151.     cmp     al,10b
  152.     jne     still
  153.     mov     [mouse_f],2
  154.     jmp     still
  155.   center:
  156.     mcall   SF_MOUSE_GET,SSF_BUTTON
  157.     cmp     al,100b
  158.     jne     still
  159.     mov     [mouse_f],3
  160.     mov     [color],edx
  161.     call    draw_result
  162.     jmp     still                         ; ¢¥à­ãâìáï ª ­ ç «ã 横« 
  163. ;end_mouse
  164.  
  165. button:
  166.     mcall   SF_GET_BUTTON         ; 17 - ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
  167.     cmp     ah, 1                         ; ¥á«¨ ­ ¦ â  ª­®¯ª  á ­®¬¥à®¬ 1,
  168.     jz      bexit                         ; ¢ë室¨¬
  169.   ;®¡à ¡®âª  ª­®¯ª¨ Next
  170.     cmp     ah, 12                        ; ¥á«¨ ­ ¦ â  ª­®¯ª  NEXT
  171.     jne     next_bg                       ; ¢ë室¨¬
  172.     inc     [pnext]                       ; 㢥«¨ç¨¢ ¥¬ ¯à¨ ­ ¦ â¨¨ ­®¬¥à ¯ «¨âàë
  173.     mov     [renmode],0                   ; ¢ª«îç ¥¬ æ¢¥â®¢ë¥ á奬ë
  174.     mov     eax,[pnext]                   ; § ­®á¨¬ §­ ç¥­¨¥ ¢ ¥ å
  175.     cmp     al,6                          ; áà ¢­¨¢ ¥¬ á § ï¢«¥­­ë¬ ª®«¨ç¥á⢮¬ ¯ «¨âà
  176.     jne     next_redraw                   ; ¥á«¨ ­¥ ¡®«ìè¥ ¬ ªá¨¬ã¬  â® ­  ¢ë§®¢ ®âà¨á®¢ª¨
  177.     xor     eax,eax                       ; ¨­ ç¥ § ­ã«ï¥¬ ¯ «¨âàã ­  default
  178.     mov     [pnext],eax                   ; ¨ § ¯®¬¨­ ¥¬ çâ® á¡à®á¨«¨ ¯ «¨âàã ­  default
  179.   next_redraw:
  180.     call    draw_palitra                  ; ˆ‘“…Œ €‹ˆ’“
  181.     jmp     still                         ; “室¨¬ ­  ®¦¨¤ ­¨¥ ¤à㣮£® ᮡëâ¨ï
  182.   next_bg:
  183.     cmp     ah, 14                        ; Š­®¯ª  BACKGROUND
  184.     jne     next_bg2                      ; ¥á«¨ ­¥ ­ ¦ â  â® ¢ë室¨¬
  185.     call    set_background                ; ¨­ ç¥ ãáâ ­ ¢«¨¢ ¥¬ ä®­
  186.     jmp     still                         ; ¨ ­  ®¦¨¤ ­¨¥ ᮡëâ¨ï
  187.   next_bg2:
  188.     cmp     ah, 16                        ; Š­®¯ª  BACKGROUND
  189.     jne     circle_bg                     ; ¥á«¨ ­¥ ­ ¦ â  â® ¢ë室¨¬
  190.     call    set_background2               ; ¨­ ç¥ ãáâ ­ ¢«¨¢ ¥¬ ä®­
  191.     jmp     still                         ; ¨ ­  ®¦¨¤ ­¨¥ ᮡëâ¨ï
  192.   circle_bg:
  193.     cmp     ah, 15                        ; Š­®¯ª  Šà㣮¢ ï ¯ «¨âà 
  194.     jne     next_end                      ; ¥á«¨ ­¥ ­ ¦ â  â® ¢ë室¨¬
  195.     mov     [renmode],2                   ; ¢ª«îç ¥¬ ®âà¨á®¢ªã ªà㣮¢®© ¯ «¨âàë
  196.     call    draw_palitra                  ; ˆ‘“…Œ €‹ˆ’“
  197.     jmp     still                         ; ¨ ­  ®¦¨¤ ­¨¥ ᮡëâ¨ï
  198.   next_end:
  199.     cmp     ah,13                         ; COLOR SWAP
  200.     jne     color_swap_end
  201.     push    [color2]
  202.     push    [color]
  203.     pop     [color2]
  204.     pop     [color]
  205.     call    draw_result
  206.     jmp     still                         ; ˆ ã室¨¬ ­  ®¦¨¤ ­¨¥ ¤à㣮£® ᮡëâ¨ï
  207.   color_swap_end:
  208.     cmp     ah, 7                         ; à®¢¥à塞 ­ ¦ â  ª­®¯ª  á ID=7
  209.     jne     color_button                  ; …᫨ ­¥ ­ ¦ â , â® ¨¤ñ¬ ¤ «ìè¥
  210.     call    mouse_get                     ; ˆ­ ç¥ ¢ª«îç ¥¬ ®¡à ¡®â稪 ¬ëè¨, ç⮡ë áç¨â âì §­ ç¥­¨¥ æ¢¥â  á ¯ «¨âàë
  211.     jmp     still                         ; ˆ ã室¨¬ ­  ®¦¨¤ ­¨¥ ¤à㣮£® ᮡëâ¨ï
  212.   color_button:                           ; €‘—ð’ ª®®à¤¨­ â ¤«ï ¯®«§ã­ª®¢ RGBA
  213.     push    eax                           ; § ¯®¬¨­ ¥¬ ¥ å
  214.     call    mouse_local                   ; ¯®«ãç ¥¬ «®ª «ì­ë¥ ª®®à¤¨­ âë
  215.     mov     ebx, 188;137                       ; ­¨¦­ïï £à ­¨æ  ¯®«§ã­ª  ¯® “
  216.     mov     ecx,[mouse_y]                 ; § ­¨á¨¬ ¢ ¥áå §­ ç¥­¨¥ ªãàá®à  ¯® “
  217.     sub     ebx,ecx                       ; ­ å®¤¨¬ à §­®áâì (â.¥. ªã¤  ᬥ頥âáï ¯®«§ã­®ª)
  218.     mov     ecx, 2;3                         ; § ­®á¨¬ ¢ ¥áå æ¨äàã 3 (256/3=85, £¤¥ 85-¢ëá®â  ¯®«§ã­ª®¢)
  219.     imul    ecx,ebx                       ; ­ å®¤¨¬ ¨á⨭­ë© ¯ à ¬¥âà æ¢¥â  á ãçñ⮬ ¬ áèâ ¡  ¯®«§ã­ª ---+
  220.     pop     eax                           ; ¢®ááâ ­ ¢«¨¢ ¥¬ ¥ å                                          :
  221.   ;red_button:                            ; Šà á­ë© ’४¡ à                                              :
  222.     cmp     ah, 8                         ; ID=8                                                         :
  223.     jne     green_button                  ; ¥á«¨ ­¥â, â® ¯à®¢¥à塞 §¥«ñ­ë© â४¡ à                       :
  224.     mov     [cred],cl                     ; ¨­ ç¥ ¯à¨á¢ ¨¢ ¥¬ §­ ç¥­¨¥, ªà á­®¬ã 梥âã ᯥªâà     <------+
  225.     call    set_spectr                    ; ãáâ ­ ¢«¨¢ ¥¬ ᯥªâà
  226.     jmp     still                         ; “室¨¬ ­  ®¦¨¤ ­¨¥ ¤à㣮£® ᮡëâ¨ï
  227.   green_button:
  228.     cmp     ah, 9
  229.     jne     blue_button
  230.     mov     [cgreen],cl
  231.     call    set_spectr
  232.     jmp     still                         ; “室¨¬ ­  ®¦¨¤ ­¨¥ ¤à㣮£® ᮡëâ¨ï
  233.   blue_button:
  234.     cmp     ah, 10
  235.     jne     alpha_button
  236.     mov     [cblue],cl
  237.     call    set_spectr
  238.     jmp     still                         ; “室¨¬ ­  ®¦¨¤ ­¨¥ ¤à㣮£® ᮡëâ¨ï
  239.   alpha_button:
  240.     cmp     ah, 11
  241.     jne     still
  242.     mov     [calpha],cl
  243.     call    set_spectr
  244.     jmp     still                         ; “室¨¬ ­  ®¦¨¤ ­¨¥ ¤à㣮£® ᮡëâ¨ï
  245.   bexit:
  246.     mcall SF_TERMINATE_PROCESS ; ¨­ ç¥ ª®­¥æ ¯à®£à ¬¬ë
  247. ;end_button
  248.  
  249. ;#___________________________________________________________________________________________________
  250. ;****************************************************************************************************|
  251. ; ƒ‹€‚›‰ ŒŽ„“‹œ Ž’ˆ‘Ž‚Šˆ ŽŠ€ ˆ ‹…Œ…’Ž‚ ˆ‹Ž†…ˆŸ                                               |
  252. ;----------------------------------------------------------------------------------------------------/
  253. draw_main:
  254.     ; äã­ªæ¨ï 12: ®§­ ç ¥â, çâ® ¡ã¤¥â à¨á®¢ âìáï ®ª­®
  255.     mcall   SF_REDRAW,SSF_BEGIN_DRAW
  256.  
  257.     ; ”ã­ªæ¨ï 48 - á⨫¨ ®â®¡à ¦¥­¨ï ®ª®­
  258.     mcall   SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
  259.  
  260.     ; ”ã­ªæ¨ï 48 - á⨫¨ ®â®¡à ¦¥­¨ï ®ª®­
  261.     mcall   SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
  262.     mov     ecx,eax                       ; ‡ ¯®¬¨­ ¥¬ ¢ëá®âã ᪨­ 
  263.  
  264.     mov     edi,[runmode]
  265.     cmp     edi,2
  266.     jne     no_hiddenmode
  267.     mov     edi,hidden
  268.     jmp     set_title
  269.   no_hiddenmode:
  270.     cmp     edi,3
  271.     jne     no_dialogmode
  272.     mov     edi,hidden
  273.     jmp     set_title
  274.   no_dialogmode:
  275.     mov     edi,title                     ; ‡ £®«®¢®ª ®ª­ 
  276.   set_title:
  277.  
  278.     xor     eax,eax                       ; Žç¨é ¥¬ eax (mov eax,0) (”ã­ªæ¨ï 0)
  279.     mov     ebx,WIN_X shl 16+WIN_W        ; [ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ x]
  280.     add     ecx,WIN_Y shl 16+WIN_H        ; ‚ëá®â  ᪨­  + [ª®®à¤¨­ â  ¯® y]*65536 + [à §¬¥à ¯® y] (168 ¤«ï ¢¥àᨨ 0.2)
  281.     mov     edx,[sc.work]                 ; ‚¨¤¨¬® áâ¨«ì ®ª­  ¯® ¤¥ä®«âã
  282.     or      edx,0x34000000                ; ˆ«¨ ®ª­® ᮠ᪨­®¬ 䨪á¨à®¢ ­­ëå à §¬¥à®¢
  283.  
  284.     int     0x40                          ; à¥à뢠­¨¥
  285.  
  286.  
  287.     call    draw_palitra                  ; ˆ‘“…Œ €‹ˆ’“
  288.     call    draw_result                   ; ˆ‘“…Œ …‡“‹œ’€’
  289.  
  290.     mcall   SF_DEFINE_BUTTON, <palitra_x,palitra_w*2+1  > , <DRAWY,palitra_w*2+2>, 0x07+BT_HIDE ; palitra
  291.  
  292.     add     edx,1++BT_NOFRAME
  293.     mcall   , <10,22>, <62,128>           ; ¨á㥬 ­¥¢¨¤¨¬ãî ª­®¯ªã ¯®¤ á« ©¤¥à®¬ red
  294.     add     ebx,25*65536                  ; „®¡ ¢«ï¥¬
  295.     inc     edx                           ; ID = 9
  296.     int     0x40                          ; ¨á㥬 ­¥¢¨¤¨¬ãî ª­®¯ªã ¯®¤ á« ©¤¥à®¬ green
  297.     add     ebx,25*65536                  ; „®¡ ¢«ï¥¬
  298.     inc     edx                           ; ID = 10
  299.     int     0x40                          ; ¨á㥬 ­¥¢¨¤¨¬ãî ª­®¯ªã ¯®¤ á« ©¤¥à®¬ blue
  300.     add     ebx,25*65536                  ; „®¡ ¢«ï¥¬
  301.     inc     edx                           ; ID = 11
  302.     int     0x40                          ; ¨á㥬 ­¥¢¨¤¨¬ãî ª­®¯ªã ¯®¤ á« ©¤¥à®¬ alpha
  303.  
  304.     ; ”ã­ªæ¨ï 8 - ®¯à¥¤¥«¨âì/㤠«¨âì ª­®¯ªã (‘Œ…€ –‚…’€)
  305.     mcall   , <13,19>, <20,18>, 0x0D+BT_HIDE
  306.  
  307.     call    draw_bottom_panel
  308.     call    draw_left_panel
  309.  
  310.     ; äã­ªæ¨ï 12: ®§­ ç ¥â, çâ® ¡ã¤¥â à¨á®¢ âìáï ®ª­®
  311.     mcall SF_REDRAW,SSF_END_DRAW
  312.     ret
  313.  
  314.  
  315.  
  316. ;#___________________________________________________________________________________________________
  317. ;****************************************************************************************************|
  318. ; ‹ŽŠ ‚‘ŽŒŽƒ€’…‹œ›• Ž–…„“ ˆ ”“Š–ˆ‰ ˆ‹Ž†…ˆŸ                                                 |
  319. ;----------------------------------------------------------------------------------------------------/
  320.  
  321.  
  322.     ;------------------------------------------------------------------------------------------------+
  323.     draw_left_panel:                      ; Žâà¨á®¢ª  ¡®ª®¢®© ¯ ­¥«¨  SL97:   á ¬®¬ ¤¥«¥ ¯à ¢®©.
  324.     ;.................................................................................................
  325.     ; button_next_colorsheme
  326.     mcall   SF_DEFINE_BUTTON, <ICONX,21>, <DRAWY,21>, 12+BT_HIDE
  327.  
  328.     ; palitra button                    ; ID = 14
  329.     mcall , ,(DRAWY+150) shl 16 + 21, 14+BT_HIDE
  330.  
  331.     ; pipet button                        ; ID = 15
  332.     mcall , , (DRAWY+150) shl 16 + 21, 15+BT_HIDE
  333.  
  334.     mov     ebx,[icons18bg]
  335.     add     ebx,18*18*4*53
  336.     mcall   SF_PUT_IMAGE_EXT, ebx, <18,18>, <ICONX+2,DRAWY+2>, 32, 0, 0
  337.  
  338.     add     ebx,18*18*4*(39-53)
  339.     mov     edx,(ICONX+2)*65536+WIN_H-90
  340.     mcall
  341.  
  342.     mov     ebx,[icons18]
  343.     add     ebx,18*18*4*(53-1)
  344.     sub     edx,40
  345.     mcall
  346.  
  347.     stdcall DrawDeepRectangle, ICONX, DRAWY, 22, 22, [sc.work_light], [sc.work_dark]
  348.  
  349.     stdcall DrawDeepRectangle, ICONX, DRAWY+110, 22, 22, [sc.work_light], [sc.work_dark]
  350.  
  351.     stdcall DrawDeepRectangle, ICONX, DRAWY+150, 22, 22, [sc.work_light], [sc.work_dark]
  352.  
  353.     ;stdcall DrawRectangle3D, ICONX, DRAWY, 22, 22, [sc.work_light], [sc.work_dark]   ;Leency: draw rectangle around the button, buggy now
  354.  
  355.     ;mov     eax,13                        ; draw rect
  356.     ;mov     ebx,266 shl 16+16             ; [x] + [size]
  357.     ;mov     ecx,9 shl 16+16               ; [y] + [size]
  358.     ;mov     edx,0x666666                  ; RGB
  359.     ;push    esi                           ; backup esi
  360.     ;mov     esi,8                         ; counter=8
  361.     ;draw_lpanel:                          ; loop label
  362.     ;  int     0x40                        ; call draw black rect
  363.     ;  add     ecx,19 shl 16               ; move rect
  364.     ;  dec     esi                         ; decrement counter
  365.     ;  cmp     esi,0                       ; if counter!=zero
  366.     ;  jne     draw_lpanel                 ; then goto label
  367.     ;  mov     esi,8                       ; else counter=8
  368.     ;  mov     ebx,267 shl 16+14           ; [x] + [size]
  369.     ;  mov     ecx,10 shl 16+14            ; [y] + [size]
  370.     ;  mov     edx,0xF3F3F3                ; RGB
  371.     ;draw_lpanel2:                         ; 2 loop label
  372.     ;  int     0x40                        ; call draw white rect
  373.     ;  add     ecx,19 shl 16               ; move rect
  374.     ;  dec     esi                         ; decrement counter
  375.     ;  cmp     esi,0                       ; if counter!=0
  376.     ;  jne     draw_lpanel2                ; then goto label2
  377.     ;pop     esi                           ; restore esi
  378.     ; draw_left_arrow for button_next_colorsheme
  379.     ;mov     eax,4                         ; Write string
  380.     ;mov     ebx,272 shl 16+13             ; [x] + [y]
  381.     ;mov     ecx,0x0                       ; RGB
  382.     ;mov     edx,larrow                    ; string pointer
  383.     ;mov     esi,1                         ; count symbol
  384.     ;int     0x40                          ; call
  385.     ;mov     eax,38                        ; draw line
  386.     ;mov     ebx,270 shl 16+272            ; [start x] + [end x]
  387.     ;mov     ecx,16 shl 16+16              ; [start y] + [end y]
  388.     ;mov     edx,0x0                       ; RGB
  389.     ;int     0x40                          ; call
  390.     ret                                   ; return
  391.     ;.................................................................................................
  392.  
  393.  
  394.     ;------------------------------------------------------------------------------------------------+
  395.     draw_bottom_panel:                    ; Žâà¨á®¢ª  ­¨¦­¥© ¯ ­¥«¨
  396.     ;.................................................................................................
  397.     mcall   SF_DEFINE_BUTTON, ((60+70) shl 16)+90, ((WIN_H-26) shl 16)+16, 14, [sc.work_button]
  398.  
  399.     add     ebx, 100 shl 16
  400.     add     edx, 2
  401.     int     0x40
  402.  
  403.     ; Write string
  404.     mov     ecx,[sc.work_text]            ; RGB
  405.     or      ecx, 1 shl 31
  406.     mcall   SF_DRAW_TEXT, (60) shl 16+(WIN_H-21), ,bground
  407.  
  408.     mov     ecx, [sc.work_button_text]
  409.     or      ecx, 1 shl 31
  410.  
  411.     add     ebx, 90 shl 16
  412.     mov     edx, bground1
  413.     int     0x40
  414.  
  415.     add     ebx, 108 shl 16
  416.     mov     edx, bground2
  417.     int     0x40
  418.  
  419.     mcall SF_DRAW_LINE, 4 shl 16+(WIN_W-14), (WIN_H-32) shl 16+(WIN_H-32), 0x00666666
  420.     ret                                   ; return
  421.     ;.................................................................................................
  422.  
  423. mouse_global:
  424.     ;.................................................................................................
  425.     ; ®«ãç ¥¬ ª®®à¤¨­ âë ¬ëè¨
  426.     ;.................................................................................................
  427.     mcall   SF_MOUSE_GET,SSF_SCREEN_POSITION
  428.     ; eax = x*65536 + y, (x,y)=ª®®à¤¨­ âë ªãàá®à  ¬ëè¨
  429.     mov     ecx,eax                       ;
  430.     shr     ecx,16                        ; ecx = x+1
  431.     movzx   edx,ax                        ; edx = y+1
  432.     dec     ecx                           ; ecx = x
  433.     dec     edx                           ; edx = y
  434.     mov     [mouse_x],ecx                 ; mouse_x = x
  435.     mov     [mouse_y],edx                 ; mouse_y = y
  436.     ret                                   ; ‚®§¢à é ¥¬ ã¯à ¢«¥­¨¥
  437. ;end_mouse_global
  438.  
  439. mouse_local:
  440.     ;.................................................................................................
  441.     ; ®«ãç ¥¬ ª®®à¤¨­ âë ¬ëè¨ ®â­®á¨â¥«ì­® ®ª­ 
  442.     ;.................................................................................................
  443.     mcall   SF_MOUSE_GET,SSF_WINDOW_POSITION
  444.         ; eax = x*65536 + y, (x,y)=ª®®à¤¨­ âë ªãàá®à  ¬ëè¨
  445.     mov     ecx,eax                       ;
  446.     shr     ecx,16                        ; ecx = x+1
  447.     movzx   edx,ax                        ; edx = y+1
  448.     dec     ecx                           ; ecx = x
  449.     dec     edx                           ; edx = y
  450.     mov     [mouse_x],ecx                 ; mouse_x = x
  451.     mov     [mouse_y],edx                 ; mouse_y = y
  452.     ret                                   ; ‚®§¢à é ¥¬ ã¯à ¢«¥­¨¥
  453. ;end_mouse_local
  454.  
  455. set_background:
  456.     ;.................................................................................................
  457.     ; “áâ ­ ¢«¨¢ ¥â ä®­ à ¡®ç¥£® á⮫ 
  458.     ;.................................................................................................
  459.     ; ”ã­ªæ¨ï 15 - à ¡®â  á ä®­®¢®© £à ä¨ª®©
  460.     ; ®¤äã­ªæ¨ï 4 - ãáâ ­®¢¨âì ०¨¬ ®âà¨á®¢ª¨ ä®­ .
  461.     ; ¥¦¨¬ ®âà¨á®¢ª¨ - § ¬®áâ¨âì (1), à áâï­ãâì (2)
  462.     mcall   SF_BACKGROUND_SET,SSF_MODE_BG,2
  463.  
  464.     ; ”ã­ªæ¨ï 15 - à ¡®â  á ä®­®¢®© £à ä¨ª®©
  465.     ; ®¤äã­ªæ¨ï 1 - ãáâ ­®¢¨âì à §¬¥à ä®­®¢®£® ¨§®¡à ¦¥­¨ï.
  466.     mcall   SF_BACKGROUND_SET,SSF_SIZE_BG,2,2
  467.  
  468.     mov     eax,[color]
  469.     mov     [cm+0],al
  470.     mov     [cm+9],al
  471.     shr     eax,8
  472.     mov     [cm+1],al
  473.     mov     [cm+10],al
  474.     shr     eax,8
  475.     mov     [cm+2],al
  476.     mov     [cm+11],al
  477.  
  478.     mov     eax,[color2]
  479.     mov     [cm+3],al
  480.     mov     [cm+6],al
  481.     shr     eax,8
  482.     mov     [cm+4],al
  483.     mov     [cm+7],al
  484.     shr     eax,8
  485.     mov     [cm+5],al
  486.     mov     [cm+8],al
  487.  
  488.     ; ”ã­ªæ¨ï 15 - à ¡®â  á ä®­®¢®© £à ä¨ª®©
  489.     ; ®¤äã­ªæ¨ï 5 - ¯®¬¥áâ¨âì ¡«®ª ¯¨ªá¥«¥© ­  ä®­.
  490.     ; - “ª § â¥«ì ­  ¤ ­­ë¥ ¢ ä®à¬ â¥ BBGGRRBBGGRR
  491.     ; - C¬¥é¥­¨¥ ¢ ¤ ­­ëå ä®­®¢®£® ¨§®¡à ¦¥­¨ï
  492.     ; -  §¬¥à ¤ ­­ëå ¢ ¡ ©â å = 3 * ç¨á«® ¯¨ªá¥«¥©
  493.     mcall   SF_BACKGROUND_SET,SSF_IMAGE_BG,cm,0,3*4
  494.  
  495.     ; ”ã­ªæ¨ï 15 - à ¡®â  á ä®­®¢®© £à ä¨ª®©
  496.     ; ®¤äã­ªæ¨ï 3 - ¯¥à¥à¨á®¢ âì ä®­.
  497.     mcall   SF_BACKGROUND_SET,SSF_REDRAW_BG
  498.  
  499.     stdcall save_eskin_ini, 'H '
  500.  
  501.     ret
  502. ;end_set_background
  503.  
  504. desktop_get:
  505.     ;.................................................................................................
  506.     ; Ž¯à¥¤¥«ï¥¬ è¨à¨­ã íªà ­ 
  507.     ;.................................................................................................
  508.     ; Ž¯à¥¤¥«ï¥¬ è¨à¨­ã íªà ­  (eax = [xsize]*65536 + [ysize])
  509.     mcall   SF_GET_SCREEN_SIZE ; xsize = à §¬¥à ¯® £®à¨§®­â «¨ - 1
  510.     mov     ebx,eax                       ;
  511.     shr     ebx,16                        ; ebx = xsize-1
  512.     movzx   edx,ax                        ; edx = ysize-1 («¨è­¨© ª®¤)
  513.     inc     ebx                           ; ebx = xsize
  514.     inc     edx                           ; edx = ysize («¨è­¨© ª®¤)
  515.     mov     [desctop_w],ebx
  516.     mov     [desctop_h],edx
  517.     ret
  518. ;end_desktop_get
  519.  
  520. mouse_get:
  521.     mov     esi,2                         ; ŠŽ‘’›‹œ: ä« £ ¤«ï ¨§¡¥¦ ­¨ï § æ¨ª«¨¢ ­¨ï
  522.     call    mouse_global
  523.     call    desktop_get
  524.     re_mouse_loop:                        ; ŠŽ‘’›‹œ: ¬¥âª  ¤«ï ¢®§¢à â  ¥á«¨ ¯®¯ «¨ ¢ á¥âªã
  525.       mov     ebx,[desctop_w]
  526.       imul    ebx,[mouse_y]               ; ebx = y*xsize
  527.       add     ebx,[mouse_x]               ; ebx = y*xsize+x
  528.  
  529.       ;.................................................................................................
  530.       ; ¥à¥¬ 梥â á ¯ «¨âàë ¢ ¯¥à¥¬¥­­ãî
  531.       ;.................................................................................................
  532.        ;mov     ebx,ecx                    ;; ebx = y*xsize+x («¨è­¨© ª®¤)
  533.       mcall   SF_GET_PIXEL    ; ®«ãç ¥¬ 梥⠢ eax
  534.       cmp     eax,[sc.work]               ; ‘à ¢­¨¢ ¥¬ á ä®­®¬ ¯à¨«®¦¥­¨ï
  535.       je      mouse_err                   ; …᫨ íâ® ®­ - â® ­¨ç¥£® ­¥ ¤¥« ¥¬
  536.       cmp     eax,0x222222                ; ‘à ¢­¨¢ ¥¬ á 梥⮬ á¥âª¨
  537.       je      mouse_err                   ; …᫨ íâ® ®­ - â® ­¨ç¥£® ­¥ ¤¥« ¥¬
  538.       jmp     mouse_set                   ; ŠŽ‘’›‹œ: ¯à룠¥¬ çâ®¡ë ­¥ ¡à âì 梥â á¥âª¨
  539.     mouse_err:                            ; ŠŽ‘’›‹œ: ¥á«¨ ¯®¯ «¨ ¢ á¥âªã ¨«¨ ä®­
  540.       inc     [mouse_y]                   ; ŠŽ‘’›‹œ: ᬥ頥¬ ¯® ¤¨ £®­ «¨ á­ ç «  ¯® å
  541.       inc     [mouse_x]                   ; ŠŽ‘’›‹œ: ᬥ頥¬ ¯® ¤¨ £®­ «¨ ¯®â®¬ ¯® ã
  542.       dec     esi                         ; ŠŽ‘’›‹œ: “¬¥­ìè ¥¬ ä« £
  543.       cmp     esi,0                       ; ŠŽ‘’›‹œ: ‘à ¢­¨¢ ¥¬ á ­ã«¥¬
  544.     jz        mouse_exit                  ; ŠŽ‘’›‹œ: …᫨ ­®«ì ⮠ᤥ« «¨ ¢áñ çâ® ¬®£«¨
  545.     jmp    re_mouse_loop                  ; ŠŽ‘’›‹œ: …᫨ ­¥ ­®«ì â® ¯®¯à®¡ã¥¬ ¢§ïâì á®á¥«­¨© ¯¨ªá¥«ì
  546.     mouse_set:                            ; ˆ­ ç¥ § ¯®¬¨­ ¥¬ ­®¢ë© 梥â
  547.       cmp     [mouse_f],1
  548.       jne     was_right
  549.       mov     [color],eax
  550.       call    draw_result
  551.       jmp     mouse_exit
  552.     was_right:
  553.       cmp     [mouse_f],2
  554.       jne     mouse_exit
  555.       mov     [color2],eax
  556.       call    draw_result                   ; ‚뢮¤¨¬ १ã«ìâ â
  557.     mouse_exit:
  558.     ret                                   ; ‚®§¢à é ¥¬ ã¯à ¢«¥­¨¥
  559. ;end_mouse_get----------------------------------------------------------------------------------------
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566. draw_value:
  567.     ;.................................................................................................
  568.     ; ‚뢮¤ ç¨á«  ¨§ áâப¨ ¢ 㪠§ ­­®© ®¡« áâ¨
  569.     ;.................................................................................................
  570.     push    ebx                           ; á®å࠭塞 ¯à¨á« ­­ë¥ ª®®à¤¨­ âë
  571.     mov     ebx,10                        ; ãáâ ­ ¢«¨¢ ¥¬ ®á­®¢ ­¨¥ á¨á⥬ë áç¨á«¥­¨ï
  572.     mov     edi,buff              ; 㪠§ â¥«ì ­  áâப㠡ãä¥à 
  573.         call    int2ascii         ; ª®­¢¥àâ¨à㥬 ç¨á«® ¨ «®¦¨¬ ª ª áâப㠢 ¡ãä¥à + esi ¤«¨­ 
  574.     mov     eax,SF_DRAW_TEXT  ; äã­ªæ¨ï 4: ­ ¯¨á âì ⥪áâ ¢ ®ª­¥
  575.     pop     ebx                           ; ¤®áâ ¥¬ ¨§ á⥪  ¯à¨á« ­­ë¥ ª®®à¤¨­ âë
  576.     cmp     esi,2                         ; –…’ˆŽ‚€ˆ… ’…Š‘’€
  577.     jne     draw_value_1
  578.     add     ebx,4 shl 16
  579.     jmp     draw_value_e
  580.   draw_value_1:
  581.     cmp     esi,1
  582.     jne     draw_value_e
  583.     add     ebx,7 shl 16
  584.   draw_value_e:
  585.     mov     ecx,0x0;0x10000000                 ; 梥â ⥪áâ  RRGGBB
  586.     add     ecx,[sc.work_text]
  587.     mov     edx,buff                      ; 㪠§ â¥«ì ­  ­ ç «® ⥪áâ 
  588.     int     0x40
  589.     ret                                   ; ‚®§¢à é ¥¬ ã¯à ¢«¥­¨¥
  590. ;end_draw_value
  591.  
  592.   _read_params:
  593.  
  594.       mov eax,dword[params+2]
  595.       mov dword[params_c+0],eax
  596.  
  597.       mov eax,dword[params+6]
  598.       mov dword[params_c+4],eax
  599.  
  600.       mov   esi,params_c
  601.       mov   ecx,16
  602.       call  ascii2int
  603.       mov   [color],eax
  604.  
  605.       mov eax,dword[params+11]
  606.       mov dword[params_c+0],eax
  607.  
  608.       mov eax,dword[params+15]
  609.       mov dword[params_c+4],eax
  610.  
  611.       mov   esi,params_c
  612.       mov   ecx,16
  613.       call  ascii2int
  614.       mov   [color2],eax
  615.  
  616.       ret
  617.  
  618. hex_digit:
  619.     ;.................................................................................................
  620.     ; à¥®¡à §®¢ ­¨¥ ¢ ASCII (¢­¥ § ¢¨á¨¬®á⨠®â á¨á⥬ë áç¨á«¥­¨ï)
  621.     ;.................................................................................................
  622.     cmp    dl,10                          ; ¢ dl ®¦¨¤ ¥âáï ç¨á«® ®â 0 ¤® 15
  623.     jb     .less                          ; ¥á«¨ dl<10 â® ¯¥à¥å®¤¨¬
  624.     add    dl,'A'-10                      ; 10->A 11->B 12->C ...
  625.     ret                                   ; ‚®§¢à é ¥¬ ã¯à ¢«¥­¨¥
  626.     .less:
  627.     or     dl,'0'                         ; …᫨ á¨á⥬  áç¨á«¥­¨ï 10-ï ¨ ¬¥­¥¥
  628.     ret                                   ; ‚®§¢à é ¥¬ ã¯à ¢«¥­¨¥
  629. ;end_hex_digit
  630.  
  631. int2ascii:
  632.     ;.................................................................................................
  633.     ; à¥®¡à §®¢ ­¨¥ ç¨á«  ¢ áâபã
  634.     ;.................................................................................................
  635.     ; eax - 32-å §­ ç­®¥ ç¨á«®
  636.     ; ebx - ®á­®¢ ­¨¥ á¨á⥬ë áç¨á«¥­¨ï
  637.     ; edi - 㪠§ â¥«ì ­  áâப㠡ãä¥à 
  638.     ; ‚®§¢à é ¥â § ¯®«­¥­­ë© ¡ãä¥à ¨ esi - ¤«¨­  áâப¨
  639.     push    edi
  640.     xor     esi,esi                       ; § ­ã«ï¥¬ áç¥â稪 ᨬ¢®«®¢
  641.     convert_loop:
  642.     xor     edx,edx                       ; § ­ã«ï¥¬ ॣ¨áâà ¯®¤ ®áâ â®ª
  643.     div     ebx                           ; eax/ebx - ®áâ â®ª ¢ edx
  644.     call    hex_digit                     ; ¯à¥®¡à §ã¥¬ ᨬ¢®«
  645.     push    edx                           ; «®¦¨¬ ¢ á⥪
  646.     inc     esi                           ; 㢥«¨ç¨¢ ¥¬ áç¥â稪
  647.     test    eax,eax                       ; ¥á«¨ ¥é¥ ¬®¦­® ¤¥«¨âì
  648.     jnz     convert_loop                  ; â® ¤¥«¨¥¬ ¥é¥
  649.     cld                                   ; ŽŸ‡€’…‹œŽ á¡à á뢠¥¬ ä« £ ­ ¯à ¢«¥­¨ï DF (§ ¯¨áì ¢¯¥àñ¤)
  650.     write_loop:                           ; ¨­ ç¥
  651.     pop     eax                           ; ¤®áâ ¥¬ ¨§ á⥪  ¢ ¥ å
  652.     stosb                                 ; § ¯¨á뢠¥¬ ¢ ¡ãä¥à ¯®  ¤à¥áã ES:(E)DI
  653.     dec     esi                           ; 㬥­ìè ¥¬ áç¥â稪
  654.     test    esi,esi                       ; ¥á«¨ ¥áâì çâ® ¤®áâ ¢ âì ¨§ á⥪ 
  655.     jnz     write_loop                    ; â® ¤®áâ ñ¬
  656.     mov     byte [edi],0                  ; ¨­ ç¥ ¤®¯¨áë뢠¥¬ ­ã«¥¢®© ¡ ©â
  657.     pop     edi
  658.     ; ª®¤ ­¨¦¥ ­¥ ¨¬¥¥â ­¨ç¥£® ®¡é¥£® ª ä㭪樨, ¯à®áâ® ¢®§¢à é ¥â ¥é¥ ¤«¨­­ã ¯®«ã祭­®© áâப¨
  659.     call    str_len
  660.     mov     esi,eax
  661.     ret                                   ; ¨ ¢®§¢à é ¥¬ ã¯à ¢«¥­¨¥
  662. ;end_int2ascii
  663.  
  664. char2byte:
  665.     sub al,'0'
  666.     cmp al,10
  667.     jb  done
  668.     add al,'0'
  669.     and al,0x5f
  670.     sub al,'A'-10
  671.     and al,0x0f
  672.     done:
  673.     ret
  674. ;end_char2byte
  675.  
  676. ascii2int:
  677.     ;.................................................................................................
  678.     ; à¥®¡à §®¢ ­¨¥ áâப¨ ¢ ç¨á«®
  679.     ;.................................................................................................
  680.     ; esi - 㪠§ â¥«ì ­  ­ã«ìâ¥à¬¨­¨à®¢ ­­ãî áâபã
  681.     ; ecx - ®á­®¢ ­¨¥ á¨á⥬ë áç¨á«¥­¨ï
  682.     ; ‚®§¢à é ¥â eax - ç¨á«®
  683.     push esi
  684.     xor eax,eax
  685.     xor ebx,ebx
  686.     cmp byte [esi],'-'
  687.     jnz .next
  688.     inc esi
  689.     .next:
  690.     lodsb
  691.     or al,al
  692.     jz .done
  693.     call char2byte
  694.     imul ebx,ecx
  695.     add ebx,eax
  696.     jmp .next
  697.     .done:
  698.     xchg ebx,eax
  699.     pop esi
  700.     cmp byte [esi],'-'
  701.     jz .negate
  702.     ret
  703.     .negate:
  704.     neg eax
  705.     ret
  706. ;end_ascii2int
  707.  
  708. get_spectr:
  709.     ;.................................................................................................
  710.     ; ¢®§¢à é ¥â r,g,b á®á⮢«ïî騥 梥â 
  711.     ;.................................................................................................
  712.     mov     ecx,[color]
  713.     mov     [cblue],cl
  714.     shr     ecx,8
  715.     mov     [cgreen],cl
  716.     shr     ecx,8
  717.     mov     [cred],cl
  718.     shr     ecx,8
  719.     mov     [calpha],cl
  720.     ret                                   ; ¨ ¢®§¢à é ¥¬ ã¯à ¢«¥­¨¥
  721. ;end_get_spectr
  722.  
  723. set_spectr:
  724.     ;.................................................................................................
  725.     ; ãáâ ­ ¢«¨¢ ¥â ¨§ r,g,b 梥â
  726.     ;.................................................................................................
  727.     movzx   eax,[calpha]
  728.     shl     eax,8
  729.     mov     al,[cred]
  730.     shl     eax,8
  731.     mov     al,[cgreen]
  732.     shl     eax,8
  733.     mov     al,[cblue]
  734.     mov     [color],eax
  735.     call    draw_result                   ; ‚뢮¤¨¬ १ã«ìâ â
  736.     ret                                   ; ¨ ¢®§¢à é ¥¬ ã¯à ¢«¥­¨¥
  737. ;end_get_spectr
  738.  
  739. str_len:
  740.     ;.................................................................................................
  741.     ; ®¯à¥¤¥«ï¥â ¤«¨­ã áâப¨ (¢å®¤->EDI ZS offset ; ¢ë室->EAX ZS length)
  742.     ;.................................................................................................
  743.         push ecx esi edi
  744.  
  745.         cld
  746.         xor   al, al
  747.         mov ecx, 0FFFFFFFFh
  748.         mov esi, edi
  749.         repne scasb
  750.         sub edi, esi
  751.         mov eax, edi
  752.         dec eax
  753.  
  754.         pop edi esi ecx
  755.  
  756.         ret
  757. ;end_str_len
  758.  
  759.  
  760.  ;-------------------------------
  761.  
  762.  proc random uses ebx ecx edx, max_value
  763.     mov     ebx, 0
  764.     mov     eax, ebx
  765.     or      eax, eax
  766.     jnz     @f
  767.     rdtsc
  768.     xor     eax, edx
  769.     mov     ebx, eax
  770.  
  771.  @@:
  772.     xor     edx, edx
  773.     mov     ecx, 127773
  774.     div     ecx
  775.     mov     ecx, eax
  776.     mov     eax, 16807
  777.     mul     edx
  778.     mov     edx, ecx
  779.     mov     ecx, eax
  780.     mov     eax, 2836
  781.     mul     edx
  782.     sub     ecx, eax
  783.     xor     edx, edx
  784.     mov     eax, ecx
  785.     mov     ebx, ecx
  786.     mov     ecx, 100000
  787.     div     ecx
  788.     mov     eax, edx
  789.  
  790.     xor     edx, edx
  791.     mov     ebx, [max_value]
  792.     div     ebx
  793.     mov     eax, edx
  794.  
  795.     ret
  796.  endp
  797.  
  798. set_background2:
  799.     mcall   SF_SYS_MISC, SSF_HEAP_INIT
  800.     mcall   SF_SYS_MISC, SSF_MEM_ALLOC, 256 * 256 * 3
  801.     mov     [bgimg_buf], eax
  802.  
  803.     mov     edx, eax
  804.     mov     ecx, 256 * 256
  805.   @@:
  806.     stdcall random, 15 + 1
  807.     sub     al, 15 / 2
  808.  
  809.     mov     bh, byte [color + 0]
  810.     add     bh, al
  811.     mov     [edx + 0], bh
  812.     mov     bh, byte [color + 1]
  813.     add     bh, al
  814.     mov     [edx + 1], bh
  815.     mov     bh, byte [color + 2]
  816.     add     bh, al
  817.     mov     [edx + 2], bh
  818.     add     edx, 3
  819.     loop    @b
  820.  
  821.     mcall   SF_BACKGROUND_SET, SSF_SIZE_BG, 256, 256
  822.     mcall   SF_BACKGROUND_SET, SSF_MODE_BG, 1
  823.     mcall   SF_BACKGROUND_SET, SSF_IMAGE_BG, [bgimg_buf], 0, 256 * 256 * 3
  824.     mcall   SF_BACKGROUND_SET, SSF_REDRAW_BG
  825.  
  826.     mcall   SF_SYS_MISC, SSF_MEM_FREE, [bgimg_buf]
  827.     stdcall save_eskin_ini, 'B '
  828. ret
  829.  
  830. align 4
  831. proc save_eskin_ini, opt_HB:dword
  832.         ;save to file eskin.ini
  833.         xor     al,al
  834.         mov     ecx,1024
  835.         mov     edi,sys_path+2
  836.         repne   scasb
  837.         sub     edi,sys_path+3
  838.         invoke  ini_set_str, inifileeskin, amain, aprogram, sys_path+2, edi
  839.         ;add param 'H '
  840.         mov     eax,[opt_HB]
  841.         mov     word[params],ax
  842.         mov     eax,[color]
  843.         or      eax,0xf ;¤«ï ¨§¡¥¦ ­¨ï ¢¥ç­®£® 横«  ¥á«¨ eax=0
  844.         mov     edi,params+2
  845.         @@:
  846.         rol     eax,8
  847.         or      al,al
  848.         jnz     @f
  849.         mov     word[edi],'00' ;­ã«¨ ¯¥à¥¤ ç¨á«®¬
  850.         add     edi,2
  851.         jmp     @b
  852.         @@:
  853.         and     al,0xf0
  854.         jnz     @f
  855.         mov     byte[edi],'0'
  856.         inc     edi
  857.         @@:
  858.         mov     eax,[color]
  859.         mov     ebx,16
  860.         call    int2ascii
  861.         mov     byte[params+10],' '
  862.         ;add color2
  863.         mov     eax,[color2]
  864.         or      eax,0xf ;¤«ï ¨§¡¥¦ ­¨ï ¢¥ç­®£® 横«  ¥á«¨ eax=0
  865.         mov     edi,params+11
  866.         @@:
  867.         rol     eax,8
  868.         or      al,al
  869.         jnz     @f
  870.         mov     word[edi],'00' ;­ã«¨ ¯¥à¥¤ ç¨á«®¬
  871.         add     edi,2
  872.         jmp     @b
  873.         @@:
  874.         and     al,0xf0
  875.         jnz     @f
  876.         mov     byte[edi],'0'
  877.         inc     edi
  878.         @@:
  879.         mov     eax,[color2]
  880.         mov     ebx,16
  881.         call    int2ascii
  882.  
  883.         invoke  ini_set_str, inifileeskin, amain, aparam, params, 19
  884.         ret
  885. endp
  886.  
  887. ;#___________________________________________________________________________________________________
  888. ;****************************************************************************************************|
  889. ; ‹ŽŠ ……Œ…›• ˆ ŠŽ‘’€’                                                                         |
  890. ;----------------------------------------------------------------------------------------------------/
  891. circle:
  892.     title       db 'Palitra v0.77',0      ; åà ­¨â ¨¬ï ¯à®£à ¬¬ë
  893.     hidden      db 'Hidden',0
  894. ;    hex         db '#',0                 ; ¤«ï ¢ë¢®¤  à¥èñ⪨ ª ª ⥪áâ 
  895.     cname       db 'RGBAx'                ; åà ­¨â à §àï¤ë 梥⮢ (red,green,blue) x-¬¥âª  ª®­æ 
  896.     larrow      db 0x1A,0
  897.     buff        db '000',0
  898.     bground     db 'BACKGROUND',0         ; ¨¬ï ª­®¯ª¨ - 14
  899.     bground1    db 'Gradient',0           ; ¨¬ï ª­®¯ª¨ - 15
  900.     bground2    db 'Noisy',0              ; ¨¬ï ª­®¯ª¨ - 16
  901.     runmode     dd 1                      ; ०¨¬ § ¯ã᪠ (1-normal, 2-hidden, 3-colordialog)
  902.     color2      dd 00FFFFFFh              ; åà ­¨â §­ ç¥­¨¥ ¢â®à®£® ¢ë¡à ­­®£® 梥â 
  903.  
  904.     inifileeskin db '/sys/settings/system.ini',0
  905.     amain       db 'style',0
  906.     aprogram    db 'bg_program',0
  907.     aparam      db 'bg_param',0
  908.  
  909.     i18_name    db 'ICONS18',0
  910.     i18bg_name  db 'ICONS18W',0
  911.  
  912.  
  913. align 16
  914. @IMPORT:
  915.  
  916. library \
  917.     libini , 'libini.obj'
  918.  
  919. import  libini, \
  920.         ini_set_str, 'ini_set_str'
  921.  
  922. I_END:
  923.     cm          rb 12
  924.     color       rd 1                      ; åà ­¨â §­ ç¥­¨¥ ¢ë¡à ­­®£® 梥â 
  925.     mouse_x     rd 1                      ; åà ­¨â £«®¡ «ì­ãî å ª®®à¤¨­ âã ¬ëè¨
  926.     mouse_y     rd 1                      ; åà ­¨â £«®¡ «ì­ãî ã ª®®à¤¨­ âã ¬ëè¨
  927.     mouse_f     rd 1                      ; åà ­¨â ¤ ­­ë¥ ® ⮬ ª ª ï ª­®¯ª  ¬ëè¨ ¡ë«  ­ ¦ â 
  928.     desctop_w   rd 1                      ; åà ­¨â è¨à¨­ã íªà ­ 
  929.     desctop_h   rd 1                      ; åà ­¨â ¢ëá®âã íªà ­ 
  930.     sc          system_colors             ; åà ­¨â áâàãªâãàã á¨á⥬­ëå 梥⮢ ᪨­ 
  931.     cred        rb 1                      ; åà ­¨¬ ªà á­ë© ᯥªâà
  932.     cgreen      rb 1                      ; åà ­¨¬ §¥«¥­ë© ᯥªâà
  933.     cblue       rb 1                      ; åà ­¨¬ ᨭ¨© ᯥªâà
  934.     calpha      rb 1                      ; åà ­¨¬ ¯à®§à ç­®áâì
  935.     pnext       rd 1                      ; áç¥â稪 ¯¥à¥ª«î祭¨ï ¯ «¨âàë
  936.     renmode     rd 1                      ; ०¨¬ ®âà¨á®¢ª¨ (1-梥⮢ ï á奬 ,2-¯¨¯¥âª ,3-ªà㣮¢ ï)
  937.     params      rb 20                     ; ¯à¨ñ¬ ¯ à ¬¥â஢
  938.     params_c    rb 9                      ; ¯à¨ñ¬­¨ª ¤«ï 梥â 
  939.     bgimg_buf   rd 1                      ; buffer for a generated image
  940.     icons18     dd ?                      ; pointer to a shared memory of icons18.png
  941.     icons18bg   dd ?                      ; pointer to a shared memory of icons18.png with filled bg
  942.  
  943.         rd 1024
  944. stacktop:
  945.         sys_path rb 1024
  946. I_MEM: