Subversion Repositories Kolibri OS

Rev

Rev 6371 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;---------------------------------------------
  2. ;-------------interraction MOUSE--------------
  3. ;---------------------------------------------
  4. mouse:
  5.         stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
  6.  
  7.         or ecx,-1
  8.         mcall SF_THREAD_INFO,procinfo
  9.        
  10.         mov     eax,[procinfo+70] ;staus of window
  11.         test eax,100b
  12.         jne     still
  13.        
  14.         call GetMouseClick
  15.  
  16.         call GetMouseCoordinats
  17.         mov     eax,[MouseX]
  18.         mov     ebx,[MouseY]
  19.         mov     ecx,[WorkScreen_SizeX]
  20.         mov     edx,[WorkScreen_SizeY]
  21.         add     ecx,ci_scrollh_coord_x_min
  22.         add     edx,ci_scrollv_coord_y_min
  23.  
  24.         cmp     eax,ecx
  25.         jae     mouse_scroll
  26.  
  27.         cmp     ebx,edx
  28.         jae     mouse_scroll
  29.         jmp     no_scrollers
  30.  
  31. mouse_scroll:
  32.         mov     [exit_from_work_arrea],1 ;mouse situated after work arrea
  33. ;scrollers
  34.         cmp [MouseBut],0
  35.         je still
  36.  
  37.         ;call GetMouseCoordinats
  38. ;interraction with horizontal scroller
  39.         mov     eax,[Scroll1CoordinatX]
  40.         mov     ebx,[Scroll1CoordinatY]
  41.         mov     ecx,[MouseX]
  42.         mov     edx,[MouseY]
  43.         mov     esi,[Scroll1MaxSizeX]
  44.         mov     edi,[Scroll1MaxSizeY]
  45.         call    columnus
  46.         test    eax,eax
  47.         jz      no_horizontal
  48.  
  49.         mov     eax,ci_scrollh_coord_x_min
  50.         mov     ebx,[Scroll1CoordinatY]
  51.         mov     ecx,[Scroll1MaxSizeX]
  52.         inc ecx
  53.         mov     edx,ci_scroll_dim-6
  54.         mov     esi,7
  55.         call draw_volume_rectangle ; horizontal scrollbar clear
  56.  
  57.         mov     eax,[MouseX]
  58.         mov     ebx,[Scroll1SizeX]
  59.         shr     ebx,1
  60.         sub     eax,ebx
  61.         mov     ecx,[MouseX]
  62.         add     ecx,ebx
  63.         mov     edx,ci_scrollh_coord_x_min
  64.         add     edx,[Scroll1MaxSizeX]
  65.         mov     [Scroll1CoordinatX],eax
  66.         sub     eax,ci_scrollh_coord_x_min
  67.         jns     no_min_scroll
  68.  
  69.         mov     [Scroll1CoordinatX],ci_scrollh_coord_x_min
  70.  
  71. no_min_scroll:
  72.         cmp     ecx,edx
  73.         jl      no_max_scroll
  74.  
  75.         sub     edx,ebx
  76.         sub     edx,ebx
  77.         mov     [Scroll1CoordinatX],edx
  78.  
  79. no_max_scroll:
  80.         mov     eax,[Scroll1CoordinatX]
  81.         sub     eax,ci_scrollh_coord_x_min
  82.         mov     ebx,[Picture_SizeX]
  83.         imul    eax,ebx
  84.         mov     ebx,[Scroll1MaxSizeX]
  85.         cdq
  86.         idiv    ebx
  87.         mov     [PosX],eax
  88.         jmp     no_vertical
  89.  
  90. no_horizontal:
  91.         mov     eax,[Scroll2CoordinatX]
  92.         mov     ebx,[Scroll2CoordinatY]
  93.         mov     ecx,[MouseX]
  94.         mov     edx,[MouseY]
  95.         mov     esi,[Scroll2MaxSizeX]
  96.         mov     edi,[Scroll2MaxSizeY]
  97.         call    columnus
  98.         test    eax,eax
  99.         jz      no_vertical
  100.  
  101.         mov     eax,[Scroll2CoordinatX]
  102.         mov     ebx,ci_scrollv_coord_y_min
  103.         mov     ecx,ci_scroll_dim-6
  104.         mov     edx,[Scroll2MaxSizeY]
  105.         inc edx
  106.         mov     esi,7
  107.         call draw_volume_rectangle ; vertical scrollbar clear
  108.  
  109.         mov     eax,[MouseY]
  110.         mov     ebx,[Scroll2SizeY]
  111.         shr     ebx,1
  112.         sub     eax,ebx
  113.         mov     ecx,[MouseY]
  114.         add     ecx,ebx
  115.         mov     edx,ci_scrollv_coord_y_min
  116.         add     edx,[Scroll2MaxSizeY]
  117.         mov     [Scroll2CoordinatY],eax
  118.  
  119.         sub     eax,ci_scrollv_coord_y_min
  120.         jns     no_min_scroll2
  121.  
  122.         mov     [Scroll2CoordinatY],ci_scrollv_coord_y_min
  123.  
  124. no_min_scroll2:
  125.         cmp     ecx,edx
  126.         jl      no_max_scroll2
  127.  
  128.         sub     edx,ebx
  129.         sub     edx,ebx
  130.         mov     [Scroll2CoordinatY],edx
  131.  
  132. no_max_scroll2:
  133.         mov     eax,[Scroll2CoordinatY]
  134.         sub     eax,ci_scrollv_coord_y_min
  135.         mov     ebx,[Picture_SizeY]
  136.         imul    eax,ebx
  137.         mov     ebx,[Scroll2MaxSizeY]
  138.         cdq
  139.         idiv    ebx
  140.         mov     [PosY],eax
  141.  
  142. no_vertical:
  143.         call    CalculatePositionScreen
  144.         call    draw_scrollers
  145.         call    MovePictureToWorkScreen
  146.         jmp     still
  147.  
  148. no_scrollers:
  149.         mov     eax,[MouseX]
  150.         mov     ebx,[MouseY]
  151.         mov     ecx,[Window_SizeX]
  152.         mov     edx,[Window_SizeY]
  153.         sub     ecx,ci_scroll_dim+ci_edit_wnd_border+5+ci_offs_skin_w
  154.         sub     edx,ci_scroll_dim+ci_edit_wnd_border+5+ci_offs_skin_h
  155.  
  156.         cmp     eax,ci_scrollh_coord_x_min
  157.         jle     not_work_arrea
  158.  
  159.         cmp     eax,ecx
  160.         jae     not_work_arrea
  161.  
  162.         cmp     ebx,ci_scrollv_coord_y_min
  163.         jle     not_work_arrea
  164.  
  165.         cmp     ebx,edx
  166.         jae     not_work_arrea
  167.         jmp     mouse_in_work_arrea
  168.  
  169. not_work_arrea:
  170.         mov     [exit_from_work_arrea],1
  171.         mcall SF_MOUSE_GET, SSF_SET_CURSOR, 0 ;set standart cursor
  172.         jmp     still
  173.  
  174. mouse_in_work_arrea:
  175.         call    GetScreenCordinats
  176.         call    PrintMousePos
  177.  
  178.         ;set cursor for current instrument
  179.         mov eax,CursorsID
  180.         mov ebx,[Current_instrument]
  181.         call set_cursor
  182.  
  183.         cmp [MouseBut],0
  184.         je no_use_instruments
  185.  
  186.         cmp     [Activate_instrument],0
  187.         jne     no_undo___
  188. ;------------begin copy for undo-------------
  189. ;copy bufer_0 -> bufer_2
  190.         mov edi,[PointerToCopyPicture2]
  191.         mov esi,[PointerToPicture]
  192.         mov ecx,[Picture_SizeX]
  193.         imul ecx,[Picture_SizeY]
  194.         lea ecx,[ecx+ecx*2]
  195.         mov ebx,ecx
  196.         shr ecx,2
  197.         cld
  198.         rep movsd
  199.         mov ecx,ebx
  200.         and ecx,3
  201.         rep movsb
  202. ;rotate bufers +1
  203.         and     [number_undo],0 ;erase all undo
  204.         mov eax,[PointerToPicture]
  205.         mov ebx,[PointerToCopyPicture]
  206.         mov ecx,[PointerToCopyPicture2]
  207.         mov [PointerToPicture],ecx
  208.         mov [PointerToCopyPicture],eax
  209.         mov [PointerToCopyPicture2],ebx
  210. ;--------------end copy for undo-------------
  211. no_undo___:
  212.         call TakeButtonInstruments
  213.         jmp still
  214.  
  215. no_use_instruments:
  216.         and     [Activate_instrument],0
  217.         jmp     still
  218. ;-----------------------------------------------
  219. ;---------get mouse cordinats-------------------
  220. ;-----------------------------------------------
  221. GetMouseCoordinats:
  222.         mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
  223.         mov     ebx,eax
  224.         shr     eax,16
  225.         and     ebx,0xffff
  226.         mov     [MouseX],eax
  227.         mov     [MouseY],ebx
  228.         ret
  229. ;------------------------------------------------
  230. ;-------get mouse attributs----------------------
  231. ;------------------------------------------------
  232. GetMouseClick:
  233.         mcall SF_MOUSE_GET,SSF_BUTTON_EXT
  234.         mov [MouseBut],eax
  235.         ret