Subversion Repositories Kolibri OS

Rev

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

  1. ;---------------------------------------------------------------------
  2. k_background:
  3.         test    dword [status],8
  4.         jnz     still
  5.         or      dword [status],8
  6.  
  7.         call    get_memory_for_tread_stack
  8.         mov     [thread_stack_4],eax
  9.         mcall   51,1,thread4    ;, thread_stack_4
  10.         jmp     still
  11. ;---------------------------------------------------------------------
  12. thread4:        ; start of bgrd thread
  13.         mcall   9, procinfo_threads, -1
  14.         mov     eax,[ebx+30]
  15.         mov     [PID4],eax
  16.         mcall   40, 0x27
  17. .red:
  18.         call    .draw_window
  19.  
  20. .still:
  21.  
  22.         mov     eax,10  ; wait here for event
  23.         mcall
  24.  
  25.         cmp     eax,1   ; redraw request ?
  26.         je      .red
  27.         cmp     eax,2   ; key in buffer ?
  28.         je      .key
  29.         cmp     eax,3   ; button in buffer ?
  30.         je      .button
  31.         cmp     eax,6   ; mouse in buffer ?
  32.         je      .mouse
  33.         jmp     .still
  34.  
  35. .mouse:
  36.         push    dword option_boxes_bcgr
  37.         call    [option_box_mouse]
  38.        
  39.         cmp     [option_group1],op1
  40.         jne     @f
  41.         mov     [bgrmode],dword 1
  42.         jmp     .still
  43. @@:
  44.         mov     [bgrmode],dword 2
  45.         jmp     .still
  46.  
  47. .key:
  48.         mcall
  49.         cmp     ah,27
  50.         je      .close
  51.         cmp     ah,13
  52.         je      .kok
  53.         cmp     ah,178 ;up
  54.         jne     .nofup
  55.         cmp     dword [bgrmode],1
  56.         je      .fdn
  57. .fup:
  58.         dec     dword [bgrmode]
  59.         jmp     .flagcont
  60. .nofup:
  61.         cmp     ah,177 ;down
  62.         jne     .still
  63.         cmp     dword [bgrmode],2
  64.         je      .fup
  65. .fdn:
  66.         inc     dword [bgrmode]
  67. .flagcont:
  68.         cmp     [bgrmode],dword 1
  69.         jne     @f
  70.         mov     [option_group1],op1
  71.         call    .draw_opt_boxes
  72.         jmp     .still
  73. @@:
  74.         mov     [option_group1],op2
  75.         call    .draw_opt_boxes
  76.         jmp     .still
  77.  
  78.  
  79. .button:                ; button
  80.         mov     eax,17  ; get id
  81.         mcall
  82.  
  83.         cmp     ah,1    ; button id=1 ?
  84.         jne     .noclose
  85. .close:
  86.         xor     dword [status],8
  87.         xor     eax,eax
  88.         mov     [PID4],eax
  89.  
  90.         mcall   68,13,[thread_stack_4]
  91.         mov     eax,-1  ; close this program
  92.         mcall
  93. .noclose:
  94. .kok:
  95.         call    background
  96.         jmp     .close
  97.  
  98. ;       *********************************************
  99. ;       ******* WINDOW DEFINITIONS AND DRAW ********
  100. ;       *********************************************
  101.  
  102.  
  103. .draw_window:
  104.         mcall   12,1
  105.                                         ; DRAW WINDOW
  106.         xor     eax,eax                 ; function 0 : define and draw window
  107.         mov     ebx,100*65536+200        ; [x start] *65536 + [x size]
  108.         mov     ecx,100*65536+100        ; [y start] *65536 + [y size]
  109.         mov     edx,0x03909090          ; color of work area RRGGBB,8->color gl
  110.         mcall
  111.  
  112.         mov     eax,8
  113.         mov     ebx,70*65536+40
  114.         mov     ecx,70*65536+20
  115.         mov     edx,4
  116.         mov     esi,0xdddddd
  117.         mcall
  118.  
  119.                                         ; WINDOW LABEL
  120.         mcall   71,1, labelt4
  121.  
  122.         mov     eax,4                   ; function 4 : write text to window
  123.         mov     ebx,46*65536+28         ; [x start] *65536 + [y start]
  124.         mov     ecx,0xffffff
  125.         mov     edx, bgrdtext
  126.         mov     esi, bgrdtext.size
  127.         mcall
  128.         add     ebx,40*65536+48
  129.         mov     edx, ok_btn
  130.         mov     esi, ok_btn.size ;2
  131.         mov     ecx,0
  132.         mcall
  133.  
  134.         call    .draw_opt_boxes
  135. ;       mcall 47,0x80000,[PID4],<200, 5>,0xffffff
  136.         mcall   12,2
  137.  
  138.         ret
  139. ;---------------------------------------------------------------------
  140. .draw_opt_boxes:
  141.         push    dword option_boxes_bcgr
  142.         call    [option_box_draw]
  143.         ret