Rev 7271 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7271 | Rev 7422 | ||
---|---|---|---|
1 | void PipetteTool_activate() { |
1 | void PipetteTool_activate() { |
2 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE); |
2 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE); |
3 | } |
3 | } |
4 | 4 | ||
5 | void PipetteTool_onKeyEvent() { |
5 | void PipetteTool_onKeyEvent() { |
6 | if (key_scancode == SCAN_CODE_ESC) setCurrentTool(previousTool); |
6 | if (key_scancode == SCAN_CODE_ESC) setCurrentTool(previousTool); |
7 | } |
7 | } |
8 | 8 | ||
9 | void PipetteTool_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) { |
9 | void PipetteTool_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) { |
10 | if (!canvas.hovered()) return; //TODO: option "Restrict pipette to canvas area" |
10 | //if (!canvas.hovered()) return; //TODO: option "Restrict pipette to canvas area" |
11 | tool_color = GetPixelUnderMouse(); |
11 | tool_color = GetPixelUnderMouse(); |
12 | DrawBar(Form.cwidth-30, 5, 20, 20, tool_color); |
12 | DrawBar(Form.cwidth-30, 5, 20, 20, tool_color); |
13 | 13 | ||
14 | if (mouse.down) { |
14 | if (mouse.down) { |
15 | DrawBar(Form.cwidth-30, 5, 20, 20, system.color.work); |
15 | DrawBar(Form.cwidth-30, 5, 20, 20, system.color.work); |
16 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
16 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
17 | if (mouse.key&MOUSE_LEFT) EventSetActiveColor(1, tool_color); |
17 | if (mouse.key&MOUSE_LEFT) EventSetActiveColor(1, tool_color); |
18 | if (mouse.key&MOUSE_RIGHT) EventSetActiveColor(2, tool_color); |
18 | if (mouse.key&MOUSE_RIGHT) EventSetActiveColor(2, tool_color); |
19 | 19 | ||
20 | setCurrentTool(previousTool); |
20 | setCurrentTool(previousTool); |
21 | } |
21 | } |
22 | } |
22 | } |