Subversion Repositories Kolibri OS

Rev

Rev 6364 | Go to most recent revision | 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 GetMouseCoordinats
  15.         mov     eax,[MouseX]
  16.         mov     ebx,[MouseY]
  17.         mov     ecx,[WorkScreen_SizeX]
  18.         mov     edx,[WorkScreen_SizeY]
  19.         add     ecx,ci_scrollh_coord_x_min
  20.         add     edx,ci_scrollv_coord_y_min
  21.  
  22.         cmp     eax,ecx
  23.         jae     mouse_scroll
  24.  
  25.         cmp     ebx,edx
  26.         jae     mouse_scroll
  27.         jmp     no_scrollers
  28.  
  29. mouse_scroll:
  30.         mov     [exit_from_work_arrea],1 ;mouse situated after work arrea
  31. ;scrollers
  32.         call GetMouseClick
  33.         cmp     eax,1
  34.         jne     still
  35.  
  36.         call    GetMouseCoordinats
  37. ;interraction with horizontal scroller
  38.         mov     eax,[Scroll1CoordinatX]
  39.         mov     ebx,[Scroll1CoordinatY]
  40.         mov     ecx,[MouseX]
  41.         mov     edx,[MouseY]
  42.         mov     esi,[Scroll1MaxSizeX]
  43.         mov     edi,[Scroll1MaxSizeY]
  44.         call    columnus
  45.         test    eax,eax
  46.         jz      no_horizontal
  47.  
  48.         mov     eax,ci_scrollh_coord_x_min
  49.         mov     ebx,[Scroll1CoordinatY]
  50.         mov     ecx,[Scroll1MaxSizeX]
  51.         inc ecx
  52.         mov     edx,ci_scroll_dim-6
  53.         mov     esi,7
  54.         call draw_volume_rectangle ; horizontal scrollbar clear
  55.  
  56.         mov     eax,[MouseX]
  57.         mov     ebx,[Scroll1SizeX]
  58.         shr     ebx,1
  59.         sub     eax,ebx
  60.         mov     ecx,[MouseX]
  61.         add     ecx,ebx
  62.         mov     edx,ci_scrollh_coord_x_min
  63.         add     edx,[Scroll1MaxSizeX]
  64.         mov     [Scroll1CoordinatX],eax
  65.         sub     eax,ci_scrollh_coord_x_min
  66.         jns     no_min_scroll
  67.  
  68.         mov     [Scroll1CoordinatX],ci_scrollh_coord_x_min
  69.  
  70. no_min_scroll:
  71.         cmp     ecx,edx
  72.         jl      no_max_scroll
  73.  
  74.         sub     edx,ebx
  75.         sub     edx,ebx
  76.         mov     [Scroll1CoordinatX],edx
  77.  
  78. no_max_scroll:
  79.         mov     eax,[Scroll1CoordinatX]
  80.         sub     eax,ci_scrollh_coord_x_min
  81.         mov     ebx,[Picture_SizeX]
  82.         imul    eax,ebx
  83.         mov     ebx,[Scroll1MaxSizeX]
  84.         cdq
  85.         idiv    ebx
  86.         mov     [PosX],eax
  87.         jmp     no_vertical
  88.  
  89. no_horizontal:
  90.         mov     eax,[Scroll2CoordinatX]
  91.         mov     ebx,[Scroll2CoordinatY]
  92.         mov     ecx,[MouseX]
  93.         mov     edx,[MouseY]
  94.         mov     esi,[Scroll2MaxSizeX]
  95.         mov     edi,[Scroll2MaxSizeY]
  96.         call    columnus
  97.         test    eax,eax
  98.         jz      no_vertical
  99.  
  100.         mov     eax,[Scroll2CoordinatX]
  101.         mov     ebx,ci_scrollv_coord_y_min
  102.         mov     ecx,ci_scroll_dim-6
  103.         mov     edx,[Scroll2MaxSizeY]
  104.         inc edx
  105.         mov     esi,7
  106.         call draw_volume_rectangle ; vertical scrollbar clear
  107.  
  108.         mov     eax,[MouseY]
  109.         mov     ebx,[Scroll2SizeY]
  110.         shr     ebx,1
  111.         sub     eax,ebx
  112.         mov     ecx,[MouseY]
  113.         add     ecx,ebx
  114.         mov     edx,ci_scrollv_coord_y_min
  115.         add     edx,[Scroll2MaxSizeY]
  116.         mov     [Scroll2CoordinatY],eax
  117.  
  118.         sub     eax,ci_scrollv_coord_y_min
  119.         jns     no_min_scroll2
  120.  
  121.         mov     [Scroll2CoordinatY],ci_scrollv_coord_y_min
  122.  
  123. no_min_scroll2:
  124.         cmp     ecx,edx
  125.         jl      no_max_scroll2
  126.  
  127.         sub     edx,ebx
  128.         sub     edx,ebx
  129.         mov     [Scroll2CoordinatY],edx
  130.  
  131. no_max_scroll2:
  132.         mov     eax,[Scroll2CoordinatY]
  133.         sub     eax,ci_scrollv_coord_y_min
  134.         mov     ebx,[Picture_SizeY]
  135.         imul    eax,ebx
  136.         mov     ebx,[Scroll2MaxSizeY]
  137.         cdq
  138.         idiv    ebx
  139.         mov     [PosY],eax
  140.  
  141. no_vertical:
  142.         call    CalculatePositionScreen
  143.         call    draw_scrollers
  144.         call    MovePictureToWorkScreen
  145.         jmp     still
  146.  
  147. no_scrollers:
  148.         mov     eax,[MouseX]
  149.         mov     ebx,[MouseY]
  150.         mov     ecx,[Window_SizeX]
  151.         mov     edx,[Window_SizeY]
  152.         sub     ecx,ci_scroll_dim+ci_edit_wnd_border+5+ci_offs_skin_w
  153.         sub     edx,ci_scroll_dim+ci_edit_wnd_border+5+ci_offs_skin_h
  154.  
  155.         cmp     eax,ci_scrollh_coord_x_min
  156.         jle     not_work_arrea
  157.  
  158.         cmp     eax,ecx
  159.         jae     not_work_arrea
  160.  
  161.         cmp     ebx,ci_scrollv_coord_y_min
  162.         jle     not_work_arrea
  163.  
  164.         cmp     ebx,edx
  165.         jae     not_work_arrea
  166.         jmp     mouse_in_work_arrea
  167.  
  168. not_work_arrea:
  169.         mov     [exit_from_work_arrea],1
  170.         mcall SF_MOUSE_GET, SSF_SET_CURSOR, 0 ;set standart cursor
  171.         jmp     still
  172.  
  173. mouse_in_work_arrea:
  174.         call    GetScreenCordinats
  175.         call    PrintMousePos
  176.  
  177.         ;set cursor for current instrument
  178.         mov eax,CursorsID
  179.         mov ebx,[Current_instrument]
  180.         call set_cursor
  181.  
  182.         call    GetMouseClick
  183.         test    eax,eax
  184.         jz      no_use_instruments
  185.  
  186.         cmp     [Activate_instrument],0
  187.         jnz     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.  
  214.         jmp still
  215.  
  216. no_use_instruments:
  217.         mov     eax,[Current_instrument]
  218.         and     [Activate_instrument],0
  219.         jmp     still
  220. ;-----------------------------------------------
  221. ;---------get mouse cordinats-------------------
  222. ;-----------------------------------------------
  223. GetMouseCoordinats:
  224.         mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
  225.         mov     ebx,eax
  226.         shr     eax,16
  227.         and     ebx,0xffff
  228.         mov     [MouseX],eax
  229.         mov     [MouseY],ebx
  230.         ret
  231. ;------------------------------------------------
  232. ;-------get mouse attributs----------------------
  233. ;------------------------------------------------
  234. GetMouseClick:
  235.         mcall SF_MOUSE_GET,SSF_BUTTON
  236.         ret