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_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.         mov     eax,option_group1
  39.         mov     ecx,[eax]
  40.         push    dword option_boxes_bcgr
  41.         call    [option_box_mouse]
  42.         cmp     ecx,[eax]
  43.         je      .option_boxes_SCC
  44.        
  45.         mov     ebx,bgrmode
  46.         cmp     [eax],dword op1
  47.         jne     @f
  48.         mov     [ebx],dword 1
  49.         jmp     .option_group1_color_set
  50. ;---------------------------------------------------------------------
  51. @@:
  52.         cmp     [eax],dword op2
  53.         jne     @f
  54.         mov     [ebx],dword 2
  55.         jmp     .option_group1_color_set
  56. ;---------------------------------------------------------------------
  57. @@:
  58.         cmp     [eax],dword op3
  59.         jne     @f
  60.         mov     [ebx],dword 3
  61.         jmp     .option_group1_color_set
  62. ;---------------------------------------------------------------------
  63. @@:
  64.         cmp     [eax],dword op4
  65.         jne     .option_boxes_SCC
  66.         mov     [ebx],dword 4
  67. .option_group1_color_set:
  68.         mov     [bcgr_group_pointer],0
  69.         call    .option_boxes_redraw
  70.         jmp     .still
  71. ;---------------------------------------------------------------------
  72. .option_boxes_SCC:
  73.         mov     eax,[option_group3]
  74.         push    dword option_boxes_SCC
  75.         call    [option_box_mouse]
  76.         cmp     eax,[option_group3]
  77.         je      .still
  78.        
  79.         call    .convert_1
  80.         mov     [bcgr_group_pointer],1
  81.         call    .option_boxes_redraw
  82.         jmp     .still
  83. ;---------------------------------------------------------------------
  84. .tab:
  85.         mov     al,[bcgr_group_pointer]
  86.         inc     al
  87.         and     al,1
  88.         mov     [bcgr_group_pointer],al
  89.         call    .option_boxes_redraw
  90.         jmp     .still
  91. ;---------------------------------------------------------------------
  92. .key:
  93.         mcall
  94.         cmp     ah,27
  95.         je      .close
  96.        
  97.         cmp     ah,13
  98.         je      .kok
  99.        
  100.         cmp     ah,9
  101.         je      .tab
  102.        
  103.         cmp     [bcgr_group_pointer],1
  104.         je      .key_option_group3
  105. ;---------------------------------------------------------------------
  106. .key_option_group1:
  107.         mov     ebx,bgrmode
  108.        
  109.         cmp     ah,178 ;up
  110.         jne     .nofup
  111.        
  112.         cmp     [ebx],dword 1
  113.         je      .fdn
  114. .fup:
  115.         dec     dword [ebx]
  116.         jmp     .flagcont
  117. ;--------------------------------------
  118. .nofup:
  119.         cmp     ah,177 ;down
  120.         jne     .still
  121.        
  122.         cmp     [ebx],dword 4
  123.         je      .fup
  124. .fdn:
  125.         inc     dword [ebx]
  126. .flagcont:
  127.         mov     eax,option_group1
  128.         cmp     [ebx],dword 1
  129.         jne     @f
  130.        
  131.         mov     [eax],dword op1
  132.         call    .draw_opt_boxes_bcgr
  133.         jmp     .still
  134. ;---------------------------------------
  135. @@:
  136.         cmp     [ebx],dword 2
  137.         jne     @f
  138.        
  139.         mov     [eax],dword op2
  140.         call    .draw_opt_boxes_bcgr
  141.         jmp     .still
  142. ;----------------------------------------
  143. @@:
  144.         cmp     [ebx],dword 3
  145.         jne     @f
  146.        
  147.         mov     [eax],dword op3
  148.         call    .draw_opt_boxes_bcgr
  149.         jmp     .still
  150. ;-----------------------------------------
  151. @@:
  152.         mov     [eax],dword op4
  153.         call    .draw_opt_boxes_bcgr
  154.         jmp     .still
  155. ;---------------------------------------------------------------------
  156. .key_option_group3:
  157.         push    eax
  158.         call    .convert_1
  159.         pop     eax
  160.  
  161.         cmp     ah,178  ;up
  162.         jne     @f
  163.  
  164.         dec     word [ebx+2]
  165.         jmp     .flagcont_1
  166. ;------------------------------------------
  167. @@:
  168.         cmp     ah,177  ;down
  169.         jne     @f
  170.  
  171.         inc     word [ebx+2]
  172.         jmp     .flagcont_1    
  173. ;------------------------------------------    
  174. @@:
  175.         cmp     ah,176  ;left
  176.         jne     @f
  177.  
  178.         dec     word [ebx]
  179.         jmp     .flagcont_1
  180. ;------------------------------------------
  181. @@:
  182.         cmp     ah,179  ;right
  183.         jne     .still
  184.  
  185.         inc     word [ebx]
  186. ;------------------------------------------
  187. .flagcont_1:   
  188.         call    .convert_2
  189.         call    .convert_1      ;for additional check
  190.         call    .draw_opt_boxes_SCC
  191.         jmp     .still
  192. ;---------------------------------------------------------------------
  193. .convert_1:
  194.         mov     eax,option_group3
  195.         mov     ebx,Stretch_Crop_Corner
  196.         cmp     [eax],dword op_UL
  197.         jne     @f
  198.         mov     [ebx],dword 0 shl 16+0
  199.         jmp     .option_group3_color_set
  200. ;----------------------------------------
  201. @@:
  202.         cmp     [eax],dword op_UC
  203.         jne     @f
  204.         mov     [ebx],dword 0 shl 16+1
  205.         jmp     .option_group3_color_set
  206. ;-----------------------------------------
  207. @@:
  208.         cmp     [eax],dword op_UR
  209.         jne     @f
  210.         mov     [ebx],dword 0 shl 16+2
  211.         jmp     .option_group3_color_set
  212. ;-----------------------------------------
  213. @@:
  214.         cmp     [eax],dword op_CL
  215.         jne     @f
  216.         mov     [ebx],dword 1 shl 16+0
  217.         jmp     .option_group3_color_set
  218. ;------------------------------------------
  219. @@:
  220.         cmp     [eax],dword op_CC
  221.         jne     @f
  222.         mov     [ebx],dword 1 shl 16+1
  223.         jmp     .option_group3_color_set
  224. ;-------------------------------------------
  225. @@:
  226.         cmp     [eax],dword op_CR
  227.         jne     @f
  228.         mov     [ebx],dword 1 shl 16+2
  229.         jmp     .option_group3_color_set
  230. ;--------------------------------------------
  231. @@:
  232.         cmp     [eax],dword op_DL
  233.         jne     @f
  234.         mov     [ebx],dword 2 shl 16+0
  235.         jmp     .option_group3_color_set
  236. ;--------------------------------------------
  237. @@:
  238.         cmp     [eax],dword op_DC
  239.         jne     @f
  240.         mov     [ebx],dword 2 shl 16+1
  241.         jmp     .option_group3_color_set
  242. ;--------------------------------------------
  243. @@:
  244.         cmp     [eax],dword op_DR
  245.         jne     .option_group3_color_set
  246.         mov     [ebx],dword 2 shl 16+2
  247. .option_group3_color_set:
  248.         ret
  249. ;--------------------------------------------------------------------- 
  250. .convert_2:
  251.         mov     eax,Stretch_Crop_Corner
  252.         mov     ebx,option_group3
  253.         cmp     [eax],dword 0 shl 16+0
  254.         jne     @f
  255.         mov     [ebx],dword op_UL
  256.         jmp     .Stretch_Crop_Corner_set
  257. ;----------------------------------------
  258. @@:
  259.         cmp     [eax],dword 0 shl 16+1
  260.         jne     @f
  261.         mov     [ebx],dword op_UC
  262.         jmp     .Stretch_Crop_Corner_set
  263. ;-----------------------------------------
  264. @@:
  265.         cmp     [eax],dword 0 shl 16+2
  266.         jne     @f
  267.         mov     [ebx],dword op_UR
  268.         jmp     .Stretch_Crop_Corner_set
  269. ;-----------------------------------------
  270. @@:
  271.         cmp     [eax],dword 1 shl 16+0
  272.         jne     @f
  273.         mov     [ebx],dword op_CL
  274.         jmp     .Stretch_Crop_Corner_set
  275. ;------------------------------------------
  276. @@:
  277.         cmp     [eax],dword 1 shl 16+1
  278.         jne     @f
  279.         mov     [ebx],dword op_CC
  280.         jmp     .Stretch_Crop_Corner_set
  281. ;-------------------------------------------
  282. @@:
  283.         cmp     [eax],dword 1 shl 16+2
  284.         jne     @f
  285.         mov     [ebx],dword op_CR
  286.         jmp     .Stretch_Crop_Corner_set
  287. ;--------------------------------------------
  288. @@:
  289.         cmp     [eax],dword 2 shl 16+0
  290.         jne     @f
  291.         mov     [ebx],dword op_DL
  292.         jmp     .Stretch_Crop_Corner_set
  293. ;--------------------------------------------
  294. @@:
  295.         cmp     [eax],dword 2 shl 16+1
  296.         jne     @f
  297.         mov     [ebx],dword op_DC
  298.         jmp     .Stretch_Crop_Corner_set
  299. ;--------------------------------------------
  300. @@:
  301.         cmp     [eax],dword 2 shl 16+2
  302.         jne     .Stretch_Crop_Corner_set
  303.         mov     [ebx],dword op_DR
  304. .Stretch_Crop_Corner_set:
  305.         ret    
  306. ;---------------------------------------------------------------------
  307. .button:                ; button
  308.         mcall   17      ; get id
  309.         cmp     ah,1    ; button id=1 ?
  310.         jne     .noclose
  311. .close:
  312.         xor     dword [status],8
  313.         xor     eax,eax
  314.         mov     [PID4],eax
  315.  
  316.         mcall   68,13,[thread_stack_4]
  317.         mov     eax,-1  ; close this program
  318.         mcall
  319. .noclose:
  320. .kok:
  321.         call    background
  322.         jmp     .close
  323. ;---------------------------------------------------------------------
  324. ;       *********************************************
  325. ;       ******* WINDOW DEFINITIONS AND DRAW ********
  326. ;       *********************************************
  327. .draw_window:
  328.         mcall   12,1
  329.         xor     eax,eax
  330.         xor     esi,esi
  331.         mcall   ,<100,300>,<100,150>,0x13909090,,labelt4
  332.         mcall   8,<70,40>,<110,20>,4,0xdddddd
  333.         mcall   4,<46,28>,0xffffff,bgrdtext,bgrdtext.size
  334.         add     ebx,40*65536+88
  335.         xor     ecx,ecx
  336.         mcall   ,,,ok_btn,ok_btn.size
  337.         call    .option_boxes_redraw
  338. ;       mcall   47,0x80000,[PID4],<200, 5>,0xffffff
  339.         mcall   12,2
  340.         ret
  341. ;---------------------------------------------------------------------
  342. .option_boxes_redraw:
  343.         call    .draw_opt_boxes_bcgr
  344.         call    .draw_opt_boxes_SCC
  345.         ret
  346. ;---------------------------------------------------------------------
  347. .draw_opt_boxes_bcgr:
  348.         mov     edx,0x13909090
  349.         cmp     [bcgr_group_pointer],0
  350.         jne     @f
  351.        
  352.         mov     edx,0xffff80
  353. @@:
  354.         mcall   13,<59,14>,<39,59>,
  355.         push    dword option_boxes_bcgr
  356.         call    [option_box_draw]
  357.         ret
  358. ;---------------------------------------------------------------------
  359. .draw_opt_boxes_SCC:
  360.         mov     edx,0x13909090
  361.         cmp     [bcgr_group_pointer],1
  362.         jne     @f
  363.        
  364.         mov     edx,0xffff80
  365. @@:
  366.         mcall   13,<198,70>,<38,70>,
  367.         push    dword option_boxes_SCC
  368.         call    [option_box_draw]
  369.         ret