Subversion Repositories Kolibri OS

Rev

Rev 255 | Rev 2045 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;---------------------------------------------
  2. ;-------------interraction MOUSE--------------
  3. ;---------------------------------------------
  4. mouse:
  5.  
  6.         call GetMouseCoordinats
  7.  
  8.         ;panel
  9.         mov edx,[Window_SizeX]
  10.         sub edx,5
  11.  
  12.         cmp ebx,20
  13.         jle no_panel
  14.  
  15.         cmp ebx,20+15
  16.         jae no_panel
  17.  
  18.         cmp eax,5
  19.         jle no_panel
  20.  
  21.         cmp eax,edx ;585
  22.         jae no_panel
  23.  
  24.         call GetMouseCoordinats
  25.  
  26.         mov [counter],7
  27.         mov edi,panel_text
  28.         call panel_interraction
  29.  
  30.         jmp still
  31.         no_panel:
  32.  
  33.         cmp [Panel_flag],0
  34.         jz no_redraw_panel
  35.  
  36.         mov [counter],7
  37.         mov edi,panel_text
  38.         call panel_interraction
  39.  
  40.         no_redraw_panel:
  41.  
  42.         call GetMouseCoordinats
  43.         mov eax,[MouseX]
  44.         mov ebx,[MouseY]
  45.         mov ecx,[WorkScreen_SizeX]
  46.         mov edx,[WorkScreen_SizeY]
  47.         add ecx,9
  48.         add edx,89
  49.  
  50.         cmp eax,ecx
  51.         jae mouse_scroll
  52.  
  53.         cmp ebx,edx
  54.         jae mouse_scroll
  55.  
  56.         jmp no_scrollers
  57.  
  58.         mouse_scroll:
  59.  
  60.         mov [exit_from_work_arrea],1  ;mouse situated after work arrea
  61.  
  62.         ;scrollers
  63.         call GetMouseClick
  64.  
  65.         cmp eax,1
  66.         jne no_click
  67.  
  68.         call GetMouseCoordinats
  69.         ;interraction with horizontal scroller
  70.         mov eax,[Scroll1CoordinatX]
  71.         mov ebx,[Scroll1CoordinatY]
  72.         mov ecx,[MouseX]
  73.         mov edx,[MouseY]
  74.         mov esi,[Scroll1MaxSizeX]
  75.         mov edi,[Scroll1MaxSizeY]
  76.         call columnus
  77.  
  78.         test eax,eax
  79.         jz no_horizontal
  80.  
  81.  
  82.         mov eax,9
  83.         mov ebx,[Scroll1CoordinatY]
  84.         mov ecx,[Scroll1MaxSizeX]
  85.         mov edx,14+10
  86.         mov esi,7
  87.         inc ecx
  88.         call draw_volume_rectangle
  89.  
  90.         mov eax,[MouseX]
  91.         mov ebx,[Scroll1SizeX]
  92.         shr ebx,1
  93.         sub eax,ebx
  94.         mov ecx,[MouseX]
  95.         add ecx,ebx
  96.         mov edx,8+1
  97.         add edx,[Scroll1MaxSizeX]
  98.         mov [Scroll1CoordinatX],eax
  99.  
  100.         sub eax,9
  101.         jns no_min_scroll
  102.  
  103.         mov [Scroll1CoordinatX],9
  104.  
  105.         no_min_scroll:
  106.  
  107.         cmp ecx,edx
  108.         jl no_max_scroll
  109.  
  110.         sub edx,ebx
  111.         sub edx,ebx
  112.         mov [Scroll1CoordinatX],edx
  113.  
  114.         no_max_scroll:
  115.         ;
  116.         mov eax,[Scroll1CoordinatX]
  117.         sub eax,9
  118.         mov ebx,[Picture_SizeX]
  119.         imul eax,ebx
  120.         mov ebx,[Scroll1MaxSizeX]
  121.         cdq
  122.         idiv ebx
  123.         mov [PosX],eax
  124.  
  125.         jmp no_vertical
  126.  
  127.         no_horizontal:
  128.  
  129.         mov eax,[Scroll2CoordinatX]
  130.         mov ebx,[Scroll2CoordinatY]
  131.         mov ecx,[MouseX]
  132.         mov edx,[MouseY]
  133.         mov esi,[Scroll2MaxSizeX]
  134.         mov edi,[Scroll2MaxSizeY]
  135.         call columnus
  136.  
  137.         test eax,eax
  138.         jz no_vertical
  139.  
  140.         mov eax,[Scroll2CoordinatX]
  141.         mov ebx,89
  142.         mov ecx,14+10
  143.         mov edx,[Scroll2MaxSizeY]
  144.         mov esi,7
  145.         inc edx
  146.         call draw_volume_rectangle
  147.  
  148.         mov eax,[MouseY]
  149.         mov ebx,[Scroll2SizeY]
  150.         shr ebx,1
  151.         sub eax,ebx
  152.         mov ecx,[MouseY]
  153.         add ecx,ebx
  154.         mov edx,89
  155.         add edx,[Scroll2MaxSizeY]
  156.         mov [Scroll2CoordinatY],eax
  157.  
  158.         sub eax,89
  159.         jns no_min_scroll2
  160.  
  161.         mov [Scroll2CoordinatY],89
  162.  
  163.         no_min_scroll2:
  164.  
  165.         cmp ecx,edx
  166.         jl no_max_scroll2
  167.  
  168.         sub edx,ebx
  169.         sub edx,ebx
  170.         mov [Scroll2CoordinatY],edx
  171.  
  172.         no_max_scroll2:
  173.         ;
  174.         mov eax,[Scroll2CoordinatY]
  175.         sub eax,89
  176.         mov ebx,[Picture_SizeY]
  177.         imul eax,ebx
  178.         mov ebx,[Scroll2MaxSizeY]
  179.         cdq
  180.         idiv ebx
  181.         mov [PosY],eax
  182.  
  183.         no_vertical:
  184.  
  185.         call CalculatePositionScreen
  186.  
  187.         call draw_scrollers
  188.         call MovePictureToWorkScreen
  189.  
  190.         no_click:
  191.  
  192.         jmp still
  193.         no_scrollers:
  194.  
  195.  
  196.         mov eax,[MouseX]
  197.         mov ebx,[MouseY]
  198.         mov ecx,[Window_SizeX]
  199.         mov edx,[Window_SizeY]
  200.         sub ecx,36
  201.         sub edx,35
  202.  
  203.         cmp eax,9
  204.         jle not_work_arrea
  205.  
  206.         cmp eax,ecx
  207.         jae not_work_arrea
  208.  
  209.         cmp ebx,20+15+1+50
  210.         jle not_work_arrea
  211.  
  212.         cmp ebx,edx
  213.         jae not_work_arrea
  214.  
  215.         jmp mouse_in_work_arrea
  216.  
  217.         not_work_arrea:
  218.  
  219.         mov [exit_from_work_arrea],1
  220.  
  221.         jmp still
  222.  
  223.         mouse_in_work_arrea:
  224.  
  225.         call GetScreenCordinats
  226.         call PrintMousePos
  227.         call GetMouseClick
  228.  
  229.  
  230.  
  231.         test eax,eax
  232.         jz no_use_instruments
  233.  
  234.         cmp [Activate_instrument],0
  235.  
  236.         jnz no_undo___
  237.         ;------------begin copy for undo-------------
  238.         inc [number_undo]
  239.  
  240.         cmp [number_undo],1
  241.         jne no_one__
  242.  
  243.         mov edi,[PointerToCopyPicture]
  244.  
  245.         no_one__:
  246.  
  247.         cmp [number_undo],2
  248.         jne no_two__
  249.  
  250.         mov edi,[PointerToCopyPicture2]
  251.  
  252.         no_two__:
  253.  
  254.         cmp [number_undo],3
  255.         jne no_three__
  256.  
  257.         ;copy bufer number two to bufer number one
  258.         mov esi,[PointerToCopyPicture2]
  259.         mov edi,[PointerToCopyPicture]
  260.         mov ecx,[Picture_SizeX]
  261.         imul ecx,[Picture_SizeY]
  262.         lea ecx,[ecx+ecx*2]
  263.         add ecx,4
  264.         shr ecx,2
  265.         inc ecx
  266.         cld
  267.         rep movsd
  268.         ;end copy
  269.         dec [number_undo]
  270.         mov edi,[PointerToCopyPicture2]
  271.  
  272.         no_three__:
  273.  
  274.         mov esi,[PointerToPicture]
  275.         mov ecx,[Picture_SizeX]
  276.         imul ecx,[Picture_SizeY]
  277.         lea ecx,[ecx+ecx*2]
  278.         add ecx,4
  279.         shr ecx,2
  280.         inc ecx
  281.         cld
  282.         rep movsd
  283.         ;--------------end copy for undo-------------
  284.         no_undo___:
  285.  
  286.         call TakeButtonInstruments
  287.         no_use_instruments:
  288.  
  289.         mov eax,[Current_instrument]
  290.         and [Activate_instrument],0
  291.  
  292.         jmp still
  293. ;-----------------------------------------------
  294. ;---------get mouse cordinats-------------------
  295. ;-----------------------------------------------
  296. GetMouseCoordinats:
  297.  
  298.         mov eax,37
  299.         mov ebx,1
  300.         mcall
  301.  
  302.         mov ebx,eax
  303.         shr eax,16
  304.         and ebx,0xffff
  305.  
  306.         mov [MouseX],eax
  307.         mov [MouseY],ebx
  308.  
  309.         ret
  310. ;------------------------------------------------
  311. ;-------get mouse attributs----------------------
  312. ;------------------------------------------------
  313. GetMouseClick:
  314.          mov eax,37
  315.          mov ebx,2
  316.          mcall
  317.  
  318.          ret