Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ;---------------------------------------------------------------------
  2. mouse:
  3.     mcall 18,7
  4.     cmp  [active_process],eax
  5.     jne  still
  6.        
  7.     mcall 37,7
  8.     mov   [mouse_scroll_data],eax
  9.        
  10.         mov  eax,[mouse_position]
  11.         mov  [mouse_position_old],eax
  12.         mcall 37,1
  13.     mov  [mouse_position],eax
  14.        
  15.         mov  eax,[mouse_keys]
  16.         mov  [mouse_keys_old],eax
  17.     mcall 37,2
  18.     mov  [mouse_keys],eax
  19.        
  20.         cmp [soi],dword 0
  21.         je  .menu_bar
  22.         cmp [scaling_mode],dword 0
  23.         je  .menu_bar
  24.        
  25.         cmp  [capture_image_area_flag],1
  26.         je   capture_image_area
  27. ;-----------------------------------------------------
  28.     cmp   [scroll_bar_data_vertical.delta2],0
  29.         jne   .vertical
  30. .horizontal:
  31.     mov   eax,[scroll_bar_data_horizontal.max_area]
  32.     cmp   eax,[scroll_bar_data_horizontal.cur_area]
  33.     jbe   .vertical
  34.        
  35.         push    dword scroll_bar_data_horizontal
  36.         call    [scrollbar_hor_mouse]
  37.        
  38.         ;    mouse_scroll_bar_horizontal scroll_bar_data_horizontal
  39.     cmp   [scroll_bar_data_horizontal.redraw],0
  40.     je    @f
  41.        
  42.     mov   [scroll_bar_data_horizontal.redraw],0
  43.     jmp   .draw
  44. @@:
  45.     cmp   [scroll_bar_data_horizontal.delta2],0
  46.         jne   still
  47. ;-----------------------------------------------------
  48. .vertical:
  49.     mov   eax,[scroll_bar_data_vertical.max_area]
  50.     cmp   eax,[scroll_bar_data_vertical.cur_area]
  51.     jbe   .menu_bar
  52.        
  53.         push    dword scroll_bar_data_vertical
  54.         call    [scrollbar_ver_mouse]
  55.        
  56. ;    mouse_scroll_bar_vertical scroll_bar_data_vertical
  57.     cmp   [scroll_bar_data_vertical.redraw],0  
  58.     je    .menu_bar   ;still
  59.     mov   [scroll_bar_data_vertical.redraw],0
  60. .draw:
  61.     call  drawimage
  62.     jmp   still
  63. ;---------------------------------------------------
  64. .clear_mouse_keys_old:
  65.         xor  eax,eax
  66.     mov  [mouse_keys],eax
  67.         mov  [mouse_keys_old],eax
  68.         ret
  69. ;---------------------------------------------------
  70. .menu_bar:
  71.         cmp  [scroll_bar_data_vertical.delta2],0
  72.         jne   still
  73.         cmp  [scroll_bar_data_horizontal.delta2],0
  74.         jne   still
  75. ;       xor   eax,eax
  76. ;       mov   [menu_data_1.get_mouse_flag],eax
  77. ;       mov   [menu_data_2.get_mouse_flag],eax
  78. ;       mov   [menu_data_3.get_mouse_flag],eax
  79. ;       mov   [menu_data_4.get_mouse_flag],eax
  80. ;       mov   [menu_data_5.get_mouse_flag],eax
  81. ;       mov   [menu_data_6.get_mouse_flag],eax
  82.        
  83. .menu_bar_1:
  84.         call   .set_mouse_flag
  85. @@:
  86.         push    dword menu_data_1
  87.         call    [menu_bar_mouse]
  88. ;    mouse_menubar menu_data_1
  89.     cmp   [menu_data_1.click],dword 1
  90.         jne   .menu_bar_2
  91.         call  .clear_mouse_keys_old
  92.         cmp   [menu_data_1.cursor_out],dword 0
  93.         jne    analyse_out_menu_1
  94.         jmp    .menu_bar_1
  95. ;--------------------------------------------
  96. .menu_bar_2:
  97. ; Edit
  98.         push    dword menu_data_2
  99.         call    [menu_bar_mouse]
  100. ;    mouse_menubar menu_data_2
  101.     cmp   [menu_data_2.click],dword 1
  102.         jne   .menu_bar_3
  103.         call  .clear_mouse_keys_old
  104.         cmp   [menu_data_2.cursor_out],dword 0
  105.         jne    analyse_out_menu_2
  106.     jmp    .menu_bar_1
  107. ;--------------------------------------------
  108. .menu_bar_3:
  109. ; View
  110.         push    dword menu_data_3
  111.         call    [menu_bar_mouse]
  112. ;    mouse_menubar menu_data_3
  113.     cmp   [menu_data_3.click],dword 1
  114.         jne   .menu_bar_4
  115.         call  .clear_mouse_keys_old
  116.         cmp   [menu_data_3.cursor_out],dword 0
  117.         jne    analyse_out_menu_3 ;still
  118.     jmp    .menu_bar_1
  119. ;--------------------------------------------
  120. .menu_bar_4:
  121. ; Zoom
  122.         push    dword menu_data_4
  123.         call    [menu_bar_mouse]
  124. ;    mouse_menubar menu_data_4
  125.     cmp   [menu_data_4.click],dword 1
  126.         jne   .menu_bar_5
  127.         call  .clear_mouse_keys_old
  128.         cmp   [menu_data_4.cursor_out],dword 0
  129.         jne    analyse_out_menu_4
  130.     jmp    .menu_bar_1
  131. ;--------------------------------------------
  132. .menu_bar_5:
  133. ; Tools
  134.         push    dword menu_data_5
  135.         call    [menu_bar_mouse]
  136. ;    mouse_menubar menu_data_5
  137.     cmp   [menu_data_5.click],dword 1
  138.         jne   .menu_bar_6
  139.         call  .clear_mouse_keys_old
  140.         cmp   [menu_data_5.cursor_out],dword 0
  141.         jne    analyse_out_menu_5
  142.     jmp    .menu_bar_1
  143. ;--------------------------------------------
  144. .menu_bar_6:
  145. ; Help
  146.         push    dword menu_data_6
  147.         call    [menu_bar_mouse]
  148. ;    mouse_menubar menu_data_6
  149.     cmp   [menu_data_6.click],dword 1
  150.         jne   .mouse_dinamic_button
  151.         call  .clear_mouse_keys_old
  152.         cmp   [menu_data_6.cursor_out],dword 0
  153.         jne    analyse_out_menu_6
  154.         jmp   .menu_bar_1
  155. ;---------------------------------------------------
  156. .mouse_dinamic_button:
  157. ; open file
  158.         push    dword dinamic_button_data_1
  159.         call    [dinamic_button_mouse]
  160. ;    mouse_dinamic_button dinamic_button_data_1
  161.         mov   eax,dinamic_button_data_1.click
  162.     cmp   [eax],dword 1
  163.         jne   @f
  164.     mov   [eax],dword 0
  165.         jmp   kfile
  166. ;-------------------------------------------------
  167. @@:
  168. ; reload file
  169.         push    dword dinamic_button_data_2
  170.         call    [dinamic_button_mouse]
  171. ;    mouse_dinamic_button dinamic_button_data_2
  172.         mov   eax,dinamic_button_data_2.click
  173.     cmp   [eax],dword 1
  174.         jne   @f
  175.     mov   [eax],dword 0
  176.         jmp   kopen
  177. ;-------------------------------------------------
  178. @@:
  179. ; left limit
  180.         push    dword dinamic_button_data_3
  181.         call    [dinamic_button_mouse]
  182. ;    mouse_dinamic_button dinamic_button_data_3
  183.         mov   eax,dinamic_button_data_3.click
  184.     cmp   [eax],dword 1
  185.         jne   @f
  186.     mov   [eax],dword 0
  187.         jmp   left_limit
  188. ;-------------------------------------------------
  189. @@:
  190. ; left arrow
  191.         push    dword dinamic_button_data_4
  192.         call    [dinamic_button_mouse]
  193. ;    mouse_dinamic_button dinamic_button_data_4
  194.         mov   eax,dinamic_button_data_4.click
  195.     cmp   [eax],dword 1
  196.         jne   @f
  197.     mov   [eax],dword 0
  198.         jmp   move_to_left
  199. ;-------------------------------------------------
  200. @@:
  201. ; slide show
  202.         push    dword dinamic_button_data_5
  203.         call    [dinamic_button_mouse]
  204. ;    mouse_dinamic_button dinamic_button_data_5
  205.         mov   eax,dinamic_button_data_5.click
  206.     cmp   [eax],dword 1
  207.         jne   @f
  208.     mov   [eax],dword 0
  209.         jmp   slide_show.3
  210. ;-------------------------------------------------
  211. @@:
  212. ; right arrow
  213.         push    dword dinamic_button_data_6
  214.         call    [dinamic_button_mouse]
  215. ;    mouse_dinamic_button dinamic_button_data_6
  216.         mov   eax,dinamic_button_data_6.click
  217.     cmp   [eax],dword 1
  218.         jne   @f
  219.     mov   [eax],dword 0
  220.         jmp   move_to_right
  221. ;-------------------------------------------------
  222. @@:
  223. ; right limit
  224.         push    dword dinamic_button_data_7
  225.         call    [dinamic_button_mouse]
  226. ;    mouse_dinamic_button dinamic_button_data_7
  227.         mov   eax,dinamic_button_data_7.click
  228.     cmp   [eax],dword 1
  229.         jne   @f
  230.     mov   [eax],dword 0
  231.         jmp   right_limit
  232. ;-------------------------------------------------
  233. @@:
  234. ; zoom +
  235.         push    dword dinamic_button_data_8
  236.         call    [dinamic_button_mouse]
  237. ;    mouse_dinamic_button dinamic_button_data_8
  238.         mov   eax,dinamic_button_data_8.click
  239.     cmp   [eax],dword 1
  240.         jne   @f
  241.     mov   [eax],dword 0
  242.         jmp   zoom_plus  ;still
  243. ;-------------------------------------------------
  244. @@:
  245. ; zoom -
  246.         push    dword dinamic_button_data_9
  247.         call    [dinamic_button_mouse]
  248. ;    mouse_dinamic_button dinamic_button_data_9
  249.         mov   eax,dinamic_button_data_9.click
  250.     cmp   [eax],dword 1
  251.         jne   @f
  252.     mov   [eax],dword 0
  253.         jmp   zoom_minus  ;still
  254. ;-------------------------------------------------
  255. @@:
  256. ; zoom 100%
  257.         push    dword dinamic_button_data_10
  258.         call    [dinamic_button_mouse]
  259. ;    mouse_dinamic_button dinamic_button_data_10
  260.         mov   eax,dinamic_button_data_10.click
  261.     cmp   [eax],dword 1
  262.         jne   @f
  263.     mov   [eax],dword 0
  264.         jmp   no_scaling  ;still
  265. ;-------------------------------------------------
  266. @@:
  267. ; rotate clockwise
  268.         push    dword dinamic_button_data_11
  269.         call    [dinamic_button_mouse]
  270. ;    mouse_dinamic_button dinamic_button_data_11
  271.         mov   eax,dinamic_button_data_11.click
  272.     cmp   [eax],dword 1
  273.         jne   @f
  274.     mov   [eax],dword 0
  275.         jmp   rotate_clockwise
  276. ;-------------------------------------------------
  277. @@:
  278. ; rotate counter-clockwise
  279.         push    dword dinamic_button_data_12
  280.         call    [dinamic_button_mouse]
  281. ;    mouse_dinamic_button dinamic_button_data_12
  282.         mov   eax,dinamic_button_data_12.click
  283.     cmp   [eax],dword 1
  284.         jne   @f
  285.     mov   [eax],dword 0
  286.         jmp   rotate_counter_clockwise
  287. ;-------------------------------------------------
  288. @@:
  289. ; file information
  290.         push    dword dinamic_button_data_13
  291.         call    [dinamic_button_mouse]
  292. ;    mouse_dinamic_button dinamic_button_data_13
  293.         mov   eax,dinamic_button_data_13.click
  294.     cmp   [eax],dword 1
  295.         jne   @f
  296.     mov   [eax],dword 0
  297.         jmp   kinfo
  298. ;-------------------------------------------------
  299. @@:
  300. ; wallpaper
  301.         push    dword dinamic_button_data_14
  302.         call    [dinamic_button_mouse]
  303. ;    mouse_dinamic_button dinamic_button_data_14
  304.         mov   eax,dinamic_button_data_14.click
  305.     cmp   [eax],dword 1
  306.         jne   @f
  307.     mov   [eax],dword 0
  308.         jmp   k_background
  309. ;-------------------------------------------------
  310. @@:
  311. ; settings
  312.         push    dword dinamic_button_data_15
  313.         call    [dinamic_button_mouse]
  314. ;    mouse_dinamic_button dinamic_button_data_15
  315.         mov   eax,dinamic_button_data_15.click
  316.     cmp   [eax],dword 1
  317.         jne   @f
  318.     mov   [eax],dword 0
  319.         jmp   k_option  ;still
  320. ;-------------------------------------------------
  321. @@:
  322.         jmp  check_scroll_event
  323. ;    jmp   still
  324. ;---------------------------------------------------------------------
  325. .set_mouse_flag:
  326.         xor   eax,eax
  327.         inc   eax
  328.         mov   [menu_data_1.get_mouse_flag],eax
  329.         mov   [menu_data_2.get_mouse_flag],eax
  330.         mov   [menu_data_3.get_mouse_flag],eax
  331.         mov   [menu_data_4.get_mouse_flag],eax
  332.         mov   [menu_data_5.get_mouse_flag],eax
  333.         mov   [menu_data_6.get_mouse_flag],eax
  334.         ret
  335. ;---------------------------------------------------------------------
  336. analyse_out_menu_1:
  337. ; File
  338.         mov eax,[menu_data_1.cursor_out]
  339.         cmp eax,dword 1
  340.         je   kfile
  341.         cmp eax,dword 2
  342.         je   kinfo     
  343.         cmp eax,dword 3
  344.         je   START.exit  
  345.     jmp   still
  346. ;---------------------------------------------------------------------
  347. analyse_out_menu_2:
  348. ; Edit
  349.         mov eax,[menu_data_2.cursor_out]
  350.         cmp eax,dword 1
  351.         je   rotate_clockwise
  352.         cmp eax,dword 2
  353.         je   rotate_counter_clockwise  
  354.         cmp eax,dword 3
  355.         je   invert_left_to_right
  356.         cmp eax,dword 4
  357.         je   invert_up_to_down 
  358.     jmp   still
  359. ;---------------------------------------------------------------------
  360. analyse_out_menu_3:
  361. ; View
  362.         mov  eax,[menu_data_3.cursor_out]
  363.         cmp eax,dword 1
  364.         je   k_sort_directory
  365.         cmp eax,dword 2
  366.         je   full_screen
  367.         cmp eax,dword 3
  368.         je   kopen
  369.     jmp   still
  370. ;---------------------------------------------------------------------
  371. analyse_out_menu_4:
  372. ; Zoom
  373.         mov eax,[menu_data_4.cursor_out]
  374.         cmp eax,dword 1
  375.         je   no_scaling
  376.         cmp eax,dword 2
  377.         je   zoom_plus
  378.         cmp eax,dword 3
  379.         je   zoom_minus
  380.         cmp eax,dword 4
  381.         je   scaling
  382.     jmp   still
  383. ;---------------------------------------------------------------------
  384. analyse_out_menu_5:
  385. ; Tools
  386.         mov eax,[menu_data_5.cursor_out]
  387.         cmp eax,dword 1
  388.         je  image_editor
  389.         cmp eax,dword 2
  390.         je  k_background
  391.         cmp eax,dword 3
  392.         je   slide_show.3
  393.         cmp eax,dword 4
  394.         je  k_option
  395.     jmp still
  396. ;---------------------------------------------------------------------
  397. analyse_out_menu_6:
  398. ; Help
  399.         cmp [menu_data_6.cursor_out],dword 1
  400.         je   open_help
  401.         cmp [menu_data_6.cursor_out],dword 2
  402.         je   kabout
  403.     jmp   still
  404. ;---------------------------------------------------------------------
  405. check_scroll_event:
  406. ;       jmp  capture_image_area
  407.         mov  eax,[mouse_scroll_data]
  408.         test eax,eax
  409.         jz   capture_image_area ;still
  410.         test ax,0x8000
  411.         jnz  .decr
  412.         shr  eax,16
  413.         test ax,0x8000
  414.         jnz  .decr_1
  415.         pusha
  416.         mov  eax,[scaling_mode]
  417.         test eax,eax   
  418.         jnz  .continue_1
  419.         call  calculation_next_value_minus
  420.         mov  [calc_next_value_minus],1
  421. .continue_1:
  422.         popa
  423.         mov  eax,zoom_factors
  424.         cmp  [eax],dword zoom_factors.min
  425.         jbe  still
  426.         xor  ecx,ecx
  427.         mov  cx,[mouse_scroll_data.vertical]
  428.         test ecx,ecx
  429.         jnz  @f
  430.         mov  cx,[mouse_scroll_data.horizontal]
  431.         test ecx,ecx
  432.         jz   still
  433. @@:
  434. ;----------------------------------------
  435.         cmp  [calc_next_value_minus],1
  436.         jne  @f
  437.         mov  [calc_next_value_minus],0
  438.         dec  ecx
  439.         jz   zoom_plus.1
  440. @@:
  441.         mov  ebx,4
  442. @@:
  443.         cmp  [eax],dword zoom_factors.min
  444.         jbe  @f
  445.         sub  [eax],ebx
  446.         dec  ecx
  447.         jnz  @r
  448.         jmp  zoom_plus.1
  449. @@:
  450.         mov  [eax],dword zoom_factors.min
  451.         jmp  zoom_plus.1
  452. ;----------------------------------------
  453. .decr:
  454.         xor  ebx,ebx
  455.         mov  bx,[mouse_scroll_data.vertical]
  456.         jmp    @f
  457. .decr_1:
  458.         xor  ebx,ebx
  459.         mov  bx,[mouse_scroll_data.horizontal]
  460. @@:
  461.         pusha
  462.         mov  eax,[scaling_mode]
  463.         test eax,eax   
  464.         jnz  .continue_2
  465.         call  calculation_next_value_plus
  466.         mov  [calc_next_value_plus],1
  467. .continue_2:
  468.         popa
  469.         mov  eax,zoom_factors
  470.         cmp  [eax],dword zoom_factors.max
  471.         jae  still
  472.         mov  ecx,0xffff
  473.         sub  ecx,ebx
  474.         inc  ecx
  475. ;---------------------------------------
  476.         cmp  [calc_next_value_plus],1
  477.         jne  @f
  478.         mov  [calc_next_value_plus],0
  479.         dec  ecx
  480.         jz   zoom_plus.1
  481. @@:
  482.         mov  ebx,4
  483. @@:
  484.         cmp  [eax],dword zoom_factors.max
  485.         jae  @f
  486.         add  [eax],ebx
  487.         dec  ecx
  488.         jnz  @r
  489.         jmp  zoom_plus.1
  490. @@:
  491.         mov  [eax],dword zoom_factors.max
  492.         jmp  zoom_plus.1
  493. ;---------------------------------------------------------------------
  494. capture_image_area:
  495.         cmp  [scroll_bar_data_vertical.delta2],0
  496.         jne   .no_capture
  497.         cmp  [scroll_bar_data_horizontal.delta2],0
  498.         jne   .no_capture
  499.         xor   eax,eax
  500.         mov   [draw_scrollbar_counter],eax
  501.     mov   eax,[scroll_bar_data_vertical.max_area]
  502.     cmp   eax,[scroll_bar_data_vertical.cur_area]
  503.     jbe   @f
  504.         inc  [draw_scrollbar_counter]
  505. @@:    
  506.     mov   eax,[scroll_bar_data_horizontal.max_area]
  507.     cmp   eax,[scroll_bar_data_horizontal.cur_area]
  508.     jbe   @f
  509.         inc  [draw_scrollbar_counter]
  510. @@:
  511.         cmp  [draw_scrollbar_counter],0
  512.         je   still
  513.  
  514.         mov  eax,[mouse_position]
  515.         xor  ebx,ebx
  516.         mov  bx,ax  ; EBX mouse y
  517.         shr  eax,16 ; EAX mouse x
  518.        
  519.         mov  ecx,[image_start_coordinates]
  520.         xor  edx,edx
  521.         mov  dx,cx  ; EDX start y
  522.         shr  ecx,16 ; ECX start x
  523.        
  524.         cmp  ax,cx
  525.         jb   still ; min x
  526.  
  527.         cmp  bx,dx
  528.         jb   still ; min y
  529.  
  530.         add  cx,[wa_width_2]
  531.         cmp  ax,cx     
  532.         ja   still ; max x
  533.  
  534.         add  dx,[wa_high_2]
  535.         cmp  bx,dx
  536.         ja   still ; max y
  537.  
  538.         mov  ecx,[mouse_keys]
  539.         test ecx,1b  ; left button
  540.         jz   .no_capture ;still
  541.  
  542.         mov  ecx,[mouse_keys_old]
  543.         test ecx,1b  ; left button old
  544.         jz   .no_capture ;still
  545.  
  546.         mov  [capture_image_area_flag],1
  547.        
  548.         mov  ecx,[mouse_position_old]
  549.         xor  edx,edx
  550.         mov  dx,cx  ; EDX mouse y old
  551.         shr  ecx,16 ; ECX mouse x old
  552.        
  553.         cmp  eax,ecx
  554.         je   .y
  555.         ja   @f
  556.         sub  ecx,eax
  557.         add  [scroll_bar_data_horizontal.position],ecx
  558.         jmp  .y
  559. @@:
  560.         sub  eax,ecx
  561.         cmp  eax,[scroll_bar_data_horizontal.position]
  562.         jb   @f
  563.         xor  eax,eax
  564.         mov  [scroll_bar_data_horizontal.position],eax
  565.         jmp  .y
  566. @@:
  567.         sub  [scroll_bar_data_horizontal.position],eax
  568.        
  569. .y:
  570.         cmp  ebx,edx
  571.         je   .draw
  572.         ja   @f
  573.         sub  edx,ebx
  574.         add  [scroll_bar_data_vertical.position],edx
  575.         jmp  .draw
  576. @@:
  577.         sub  ebx,edx
  578.        
  579.         cmp  ebx,[scroll_bar_data_vertical.position]
  580.         jb   @f
  581.         xor  eax,eax
  582.         mov  [scroll_bar_data_vertical.position],eax
  583.         jmp  .draw
  584. @@:
  585.         sub  [scroll_bar_data_vertical.position],ebx
  586.        
  587. .draw:
  588.         call  drawimage
  589.         call  draw_scrollbars
  590.         jmp   still
  591.        
  592. .no_capture:
  593.         mov  [capture_image_area_flag],0
  594. .end:
  595.         jmp   still
  596. ;---------------------------------------------------------------------