Subversion Repositories Kolibri OS

Rev

Rev 1951 | 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_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.         mov     [bgrmode],dword 2
  48.         jmp     .still
  49. ;---------------------------------------------------------------------
  50. .key:
  51.         mcall
  52.         cmp     ah,27
  53.         je      .close
  54.        
  55.         cmp     ah,13
  56.         je      .kok
  57.        
  58.         cmp     ah,178 ;up
  59.         jne     .nofup
  60.        
  61.         cmp     dword [bgrmode],1
  62.         je      .fdn
  63. .fup:
  64.         dec     dword [bgrmode]
  65.         jmp     .flagcont
  66. ;---------------------------------------------------------------------
  67. .nofup:
  68.         cmp     ah,177 ;down
  69.         jne     .still
  70.        
  71.         cmp     dword [bgrmode],4
  72.         je      .fup
  73. .fdn:
  74.         inc     dword [bgrmode]
  75. .flagcont:
  76.         cmp     [bgrmode],dword 1
  77.         jne     @f
  78.        
  79.         mov     [option_group1],op1
  80.         call    .draw_opt_boxes
  81.         jmp     .still
  82. ;---------------------------------------------------------------------
  83. @@:
  84.         cmp     [bgrmode],dword 2
  85.         jne     @f
  86.        
  87.         mov     [option_group1],op2
  88.         call    .draw_opt_boxes
  89.         jmp     .still
  90. ;---------------------------------------------------------------------
  91. @@:
  92.         cmp     [bgrmode],dword 3
  93.         jne     @f
  94.        
  95.         mov     [option_group1],op3
  96.         call    .draw_opt_boxes
  97.         jmp     .still
  98. ;---------------------------------------------------------------------
  99. @@:
  100.         mov     [option_group1],op4
  101.         call    .draw_opt_boxes
  102.         jmp     .still
  103. ;---------------------------------------------------------------------
  104. .button:                ; button
  105.         mov     eax,17  ; get id
  106.         mcall
  107.  
  108.         cmp     ah,1    ; button id=1 ?
  109.         jne     .noclose
  110. .close:
  111.         xor     dword [status],8
  112.         xor     eax,eax
  113.         mov     [PID4],eax
  114.  
  115.         mcall   68,13,[thread_stack_4]
  116.         mov     eax,-1  ; close this program
  117.         mcall
  118. .noclose:
  119. .kok:
  120.         call    background
  121.         jmp     .close
  122. ;---------------------------------------------------------------------
  123. ;       *********************************************
  124. ;       ******* WINDOW DEFINITIONS AND DRAW ********
  125. ;       *********************************************
  126. .draw_window:
  127.         mcall   12,1
  128.         xor     eax,eax
  129.         xor     esi,esi
  130.         mcall   ,<100,200>,<100,200>,0x13909090,,labelt4
  131.         mcall   8,<70,40>,<110,20>,4,0xdddddd
  132.         mcall   4,<46,28>,0xffffff,bgrdtext,bgrdtext.size
  133.         add     ebx,40*65536+88
  134.         xor     ecx,ecx
  135.         mcall   ,,,ok_btn,ok_btn.size
  136.         call    .draw_opt_boxes
  137. ;       mcall   47,0x80000,[PID4],<200, 5>,0xffffff
  138.         mcall   12,2
  139.         ret
  140. ;---------------------------------------------------------------------
  141. .draw_opt_boxes:
  142.         push    dword option_boxes_bcgr
  143.         call    [option_box_draw]
  144.         ret