Subversion Repositories Kolibri OS

Rev

Rev 2188 | 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,4
  310.         je      .kok
  311.        
  312.         cmp     ah,5
  313.         je      .start_ColorDialog
  314. ;       cmp     ah,1    ; button id=1 ?
  315. ;       jne     .noclose
  316. .close:
  317.         xor     dword [status],8
  318.         xor     eax,eax
  319.         mov     [PID4],eax
  320.  
  321.         mcall   68,13,[thread_stack_4]
  322.         mov     eax,-1  ; close this program
  323.         mcall
  324. .noclose:
  325. .kok:
  326.         call    background
  327.         jmp     .close
  328. ;--------------------------------------------------------------------- 
  329. .start_ColorDialog:
  330.         push    dword ColorDialog_data
  331.         call    [ColorDialog_Start]
  332.         call    clear_control_key_flag
  333. ; 2 - use another method/not found program
  334.         cmp     [ColorDialog_data.status],2
  335.         je      .still
  336. ; 1 - OK, color selected       
  337.         cmp     [ColorDialog_data.status],1
  338.         jne     .still
  339.        
  340.         mov     eax,[ColorDialog_data.color]
  341.         mov     [background_color],eax
  342.         jmp     .still
  343. ;---------------------------------------------------------------------
  344. ;       *********************************************
  345. ;       ******* WINDOW DEFINITIONS AND DRAW ********
  346. ;       *********************************************
  347. .draw_window:
  348.         mcall   12,1
  349.         xor     eax,eax
  350.         xor     esi,esi
  351.         mcall   ,<100,300>,<100,170>,0x13909090,,labelt4
  352.         mcall   8,<60,40>,<120,20>,4,0xdddddd
  353.         mcall   ,<220,40>,<120,20>,5,[background_color] ; 0xdddddd
  354.         mcall   4,<36,28>,0xffffff,bgrdtext,bgrdtext.size
  355.         push    ebx
  356.         add     ebx,170*65536
  357.         mcall   ,,,scc_text,scc_text.size
  358.         pop     ebx
  359.         add     ebx,40*65536+98
  360.         xor     ecx,ecx
  361.         mcall   ,,,ok_btn,ok_btn.size
  362.         add     ebx,40*65536
  363.         mcall   ,,0xffffff,color_btn,color_btn.size
  364.         call    .option_boxes_redraw
  365. ;       mcall   47,0x80000,[PID4],<200, 5>,0xffffff
  366.         mcall   12,2
  367.         ret
  368. ;---------------------------------------------------------------------
  369. .option_boxes_redraw:
  370.         call    .draw_opt_boxes_bcgr
  371.         call    .draw_opt_boxes_SCC
  372.         ret
  373. ;---------------------------------------------------------------------
  374. .draw_opt_boxes_bcgr:
  375.         mov     edx,0x13909090
  376.         cmp     [bcgr_group_pointer],0
  377.         jne     @f
  378.        
  379.         mov     edx,0xffff80
  380. @@:
  381.         mcall   13,<59,14>,<44,59>,
  382.         push    dword option_boxes_bcgr
  383.         call    [option_box_draw]
  384.         ret
  385. ;---------------------------------------------------------------------
  386. .draw_opt_boxes_SCC:
  387.         mov     edx,0x13909090
  388.         cmp     [bcgr_group_pointer],1
  389.         jne     @f
  390.        
  391.         mov     edx,0xffff80
  392. @@:
  393.         mcall   13,<198,70>,<38,70>,
  394.         push    dword option_boxes_SCC
  395.         call    [option_box_draw]
  396.         ret