Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. void PipetteTool_activate() {
  3.         SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
  4. }
  5.  
  6. void PipetteTool_onKeyEvent() {
  7.         if (key_scancode == SCAN_CODE_ESC) setCurrentTool(previousTool);
  8. }
  9.  
  10. void PipetteTool_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
  11.         //if (!canvas.hovered()) return; //TODO: option "Restrict pipette to canvas area"
  12.         tool_color = GetPixelUnderMouse();
  13.         DrawBar(Form.cwidth-30, 5, 20, 20, tool_color);
  14.        
  15.         if (mouse.down) {
  16.                 DrawBar(Form.cwidth-30, 5, 20, 20, sc.work);
  17.                 SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
  18.                 if (mouse.key&MOUSE_LEFT) EventSetActiveColor(1, tool_color);
  19.                 if (mouse.key&MOUSE_RIGHT) EventSetActiveColor(2, tool_color);
  20.                
  21.                 setCurrentTool(previousTool);
  22.         }
  23. }
  24.