Subversion Repositories Kolibri OS

Rev

Rev 2191 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;
  2. ;   PANEL SETUP
  3. ;
  4. ;------------------------------------------------------------------------------
  5. ; last update:  09/04/2012
  6. ; changed by:   Marat Zakiyanov aka Mario79, aka Mario
  7. ; changes:      Code optimizing and refactoring.
  8. ;              
  9. ;------------------------------------------------------------------------------
  10.         use32
  11.         org 0x0
  12.         db 'MENUET01'           ; 8 byte id
  13.         dd 0x01                 ; header version
  14.         dd START                ; start of code
  15.         dd IM_END               ; size of image
  16.         dd I_END        ;0x8000         ; memory for app
  17.         dd stack_top            ; esp
  18.         dd 0x0                  ; boot parameters
  19.         dd 0x0                  ; path
  20. ;------------------------------------------------------------------------------
  21. include '../../../macros.inc'
  22. ;------------------------------------------------------------------------------
  23. START:
  24. ;------------------------------------------------------------------------------
  25. align 4
  26. red:
  27.         call    draw_window
  28. ;------------------------------------------------------------------------------
  29. align 4
  30. still:
  31.         mcall   10
  32.        
  33.         cmp     eax,1   ; redraw request ?
  34.         je      red
  35.  
  36.         cmp     eax,2   ; key in buffer ?
  37.         je      key
  38.  
  39.         cmp     eax,3   ; button in buffer ?
  40.         je      button
  41.        
  42.         jmp     still
  43. ;------------------------------------------------------------------------------
  44. align 4
  45. key:
  46.         mcall   2
  47.        
  48.         shr     eax,8
  49.         cmp     eax,'0'
  50.         jb      still
  51.  
  52.         cmp     eax,'9'
  53.         jg      still
  54.        
  55.         mov     edi,[ent]
  56.         add     edi,text
  57.         mov     esi,edi
  58.         inc     esi
  59.         mov     ecx,3
  60.         cld
  61.         rep     movsb
  62.        
  63.         mov     [edi],al
  64.        
  65.         jmp     red
  66. ;------------------------------------------------------------------------------
  67. align 4
  68. button:
  69.         mcall   17
  70.        
  71.         cmp     ah,1    ; button id=1 ?
  72.         jne     noclose
  73.  
  74.         mcall   -1      ; close this program
  75. ;--------------------------------------
  76. align 4
  77. noclose:
  78.         cmp     ah,10
  79.         jne     no_apply
  80.        
  81.         mov     esi,text+17
  82.         mov     edi,panel_ini_data_area ;I_END+10
  83.         mov     ecx,12
  84. ;--------------------------------------
  85. align 4
  86. newfe:
  87.         mov     ebx,[esi]
  88.         mov     [edi],ebx
  89.         mov     [edi+4],byte ';'
  90.         add     edi,5
  91.         add     esi,55
  92.         loop    newfe
  93.  
  94.         mov     [edi],byte 'x'
  95.         mcall   70,dat_write
  96.         mov     esi,1
  97. ;--------------------------------------
  98. align 4
  99. newread:
  100.         inc     esi
  101.         mcall   9,proc_info,esi
  102.         cmp     esi,eax
  103.         jg      all_terminated
  104.        
  105.         mov     eax,[ebx+10]
  106.         and     eax,not 0x20202000
  107.         cmp     eax,'@PAN'
  108.         jne     newread
  109.  
  110.         mov     eax,[ebx+14]
  111.         and     eax,not 0x2020
  112.         cmp     ax,'EL'
  113.         jne     newread
  114.        
  115.         mcall   18,2,esi
  116.        
  117.         mcall   5,5
  118.        
  119.         mov     esi,1
  120.         jmp     newread
  121. ;--------------------------------------
  122. align 4
  123. all_terminated:
  124.         mcall   5,25
  125.  
  126.         mcall   70,panel_start
  127. ;--------------------------------------
  128. align 4
  129. no_apply:
  130.         cmp     ah,11
  131.         jb      still
  132.  
  133.         shr     eax,8
  134.         sub     eax,11
  135.         imul    eax,55
  136.         add     eax,17
  137.         mov     [ent],eax
  138.         mov     [text+eax],dword '0000'
  139.         jmp     red
  140. ;------------------------------------------------------------------------------
  141. ;   *********************************************
  142. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  143. ;   *********************************************
  144. ;------------------------------------------------------------------------------
  145. align 4
  146. draw_window:
  147.         mcall   12,1
  148. ; DRAW WINDOW
  149.         xor     eax,eax
  150.         xor     esi,esi
  151.         mcall   ,<100,385>,<100,190>,0x14ffffff,,labelt
  152.  
  153.         mcall   8,<25,335>,<162,12>,10,0x80a0c0 ;0x6677cc
  154.  
  155.         mov     ebx,340*65536+20
  156.         mov     ecx,34*65536+10
  157.         inc     edx     ;11 - button
  158. ;--------------------------------------
  159. align 4
  160. newb:
  161.         mcall
  162.         add     ecx,10*65536
  163.         inc     edx
  164.         cmp     edx,23
  165.         jb      newb
  166.  
  167.         mov     ebx,25*65536+35           ; draw info text with function 4
  168.         mov     ecx,0x224466
  169.         mov     edx,text
  170.         mov     esi,55
  171.         mov     eax,4
  172. ;--------------------------------------
  173. align 4
  174. newline:
  175.         mcall
  176.         add     ebx,10
  177.         add     edx,55
  178.         cmp     [edx],byte 'x'
  179.         jne     newline
  180.  
  181.         mcall   12,2
  182.         ret
  183. ;------------------------------------------------------------------------------
  184. align 4
  185. ; DATA AREA
  186. text:
  187.         db 'width            0000  :  0 for full screen width     <'
  188.         db 'buttons          0000  :  0 no frames  , 1 frames     <'
  189.         db 'soften_up        0001  :  0 no         , 1 yes        <'
  190.         db 'soften_down      0001  :  0 no         , 1 yes        <'
  191.         db 'minimize_left    0001  :  0 no         , 1 yes        <'
  192.         db 'minimize_right   0001  :  0 no         , 1 yes        <'
  193.         db 'icons_position   0100  :  position in pixels          <'
  194.         db 'menu_enable      0001  :  0 no         , 1 yes        <'
  195.         db 'setup_enable     0001  :  0 no         , 1 yes        <'
  196.         db 'graph_text       0001  :  0 graphics   , 1 text       <'
  197.         db 'soften_middle    0001  :  0 no         , 1 yes        <'
  198.         db 'icons            0001  :  0 start      , 1 activate   <'
  199.         db '                                                       '
  200.         db '                         APPLY                         '
  201.         db 'x'
  202. ;------------------------------------------------------------------------------
  203. labelt:
  204.         db 'Panel setup'
  205. labellen:
  206. ;------------------------------------------------------------------------------
  207. align 4
  208. ent     dd  17
  209. ;------------------------------------------------------------------------------
  210. align 4
  211. panel_start:
  212.         dd 7
  213.         dd 0
  214.         dd 0
  215.         dd 0
  216.         dd 0
  217.         db '/RD/1/@PANEL',0
  218. ;------------------------------------------------------------------------------
  219. align 4
  220. dat_write:
  221.         dd 2
  222.         dd 0
  223.         dd 0
  224.         dd 5*12+1
  225.         dd panel_ini_data_area  ;I_END+10
  226.         db 'PANEL.DAT',0
  227. ;------------------------------------------------------------------------------
  228. IM_END:
  229. ;------------------------------------------------------------------------------
  230. align 4
  231. proc_info:
  232.         rb 1024
  233. ;------------------------------------------------------------------------------
  234. align 4
  235.         rb 1024
  236. stack_top:
  237. ;------------------------------------------------------------------------------
  238. align 4
  239. panel_ini_data_area:
  240.         rb 61
  241. ;------------------------------------------------------------------------------
  242. I_END:
  243. ;------------------------------------------------------------------------------
  244.