Subversion Repositories Kolibri OS

Rev

Rev 2000 | Rev 2188 | 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_thread_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. .still:
  20.         mov     eax,10  ; wait here for event
  21.         mcall
  22.  
  23.         cmp     eax,1   ; redraw request ?
  24.         je      .red
  25.  
  26.         cmp     eax,2   ; key in buffer ?
  27.         je      .key
  28.  
  29.         cmp     eax,3   ; button in buffer ?
  30.         je      .button
  31.  
  32.         cmp     eax,6   ; mouse in buffer ?
  33.         je      .mouse
  34.  
  35.         jmp     .still
  36. ;---------------------------------------------------------------------
  37. .mouse:
  38.         push    dword option_boxes_bcgr
  39.         call    [option_box_mouse]
  40.        
  41.         cmp     [option_group1],op1
  42.         jne     @f
  43.         mov     [bgrmode],dword 1
  44.         jmp     .still
  45. ;---------------------------------------------------------------------
  46. @@:
  47.         cmp     [option_group1],op2
  48.         jne     @f
  49.         mov     [bgrmode],dword 2
  50.         jmp     .still
  51. ;---------------------------------------------------------------------
  52. @@:
  53.         cmp     [option_group1],op3
  54.         jne     @f
  55.         mov     [bgrmode],dword 3
  56.         jmp     .still
  57. ;---------------------------------------------------------------------
  58. @@:
  59. ;       cmp     [option_group1],op4
  60. ;       jne     .still
  61.         mov     [bgrmode],dword 4
  62.         jmp     .still
  63. ;---------------------------------------------------------------------
  64. .key:
  65.         mcall
  66.         cmp     ah,27
  67.         je      .close
  68.        
  69.         cmp     ah,13
  70.         je      .kok
  71.        
  72.         cmp     ah,178 ;up
  73.         jne     .nofup
  74.        
  75.         cmp     dword [bgrmode],1
  76.         je      .fdn
  77. .fup:
  78.         dec     dword [bgrmode]
  79.         jmp     .flagcont
  80. ;---------------------------------------------------------------------
  81. .nofup:
  82.         cmp     ah,177 ;down
  83.         jne     .still
  84.        
  85.         cmp     dword [bgrmode],4
  86.         je      .fup
  87. .fdn:
  88.         inc     dword [bgrmode]
  89. .flagcont:
  90.         cmp     [bgrmode],dword 1
  91.         jne     @f
  92.        
  93.         mov     [option_group1],op1
  94.         call    .draw_opt_boxes
  95.         jmp     .still
  96. ;---------------------------------------------------------------------
  97. @@:
  98.         cmp     [bgrmode],dword 2
  99.         jne     @f
  100.        
  101.         mov     [option_group1],op2
  102.         call    .draw_opt_boxes
  103.         jmp     .still
  104. ;---------------------------------------------------------------------
  105. @@:
  106.         cmp     [bgrmode],dword 3
  107.         jne     @f
  108.        
  109.         mov     [option_group1],op3
  110.         call    .draw_opt_boxes
  111.         jmp     .still
  112. ;---------------------------------------------------------------------
  113. @@:
  114.         mov     [option_group1],op4
  115.         call    .draw_opt_boxes
  116.         jmp     .still
  117. ;---------------------------------------------------------------------
  118. .button:                ; button
  119.         mov     eax,17  ; get id
  120.         mcall
  121.  
  122.         cmp     ah,1    ; button id=1 ?
  123.         jne     .noclose
  124. .close:
  125.         xor     dword [status],8
  126.         xor     eax,eax
  127.         mov     [PID4],eax
  128.  
  129.         mcall   68,13,[thread_stack_4]
  130.         mov     eax,-1  ; close this program
  131.         mcall
  132. .noclose:
  133. .kok:
  134.         call    background
  135.         jmp     .close
  136. ;---------------------------------------------------------------------
  137. ;       *********************************************
  138. ;       ******* WINDOW DEFINITIONS AND DRAW ********
  139. ;       *********************************************
  140. .draw_window:
  141.         mcall   12,1
  142.         xor     eax,eax
  143.         xor     esi,esi
  144.         mcall   ,<100,200>,<100,200>,0x13909090,,labelt4
  145.         mcall   8,<70,40>,<110,20>,4,0xdddddd
  146.         mcall   4,<46,28>,0xffffff,bgrdtext,bgrdtext.size
  147.         add     ebx,40*65536+88
  148.         xor     ecx,ecx
  149.         mcall   ,,,ok_btn,ok_btn.size
  150.         call    .draw_opt_boxes
  151. ;       mcall   47,0x80000,[PID4],<200, 5>,0xffffff
  152.         mcall   12,2
  153.         ret
  154. ;---------------------------------------------------------------------
  155. .draw_opt_boxes:
  156.         push    dword option_boxes_bcgr
  157.         call    [option_box_draw]
  158.         ret