2018-04-25 21:09:26 +02:00
|
|
|
dword screen_copy;
|
|
|
|
|
|
|
|
void ScreenCopy_activate() {
|
|
|
|
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
|
2018-05-08 20:35:13 +02:00
|
|
|
screen_copy = malloc(image.columns * image.rows * 3 +4);
|
2018-04-25 21:09:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScreenCopy_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
|
|
|
|
dword i;
|
2018-05-06 17:02:12 +02:00
|
|
|
int x, y;
|
|
|
|
|
|
|
|
x = mouse.x + Form.left + 5 - calc(image.columns/2);
|
2022-01-08 20:52:20 +01:00
|
|
|
y = mouse.y + Form.top + skin_h - calc(image.rows/2);
|
2018-05-06 17:02:12 +02:00
|
|
|
|
|
|
|
CopyScreen(
|
|
|
|
screen_copy,
|
2022-01-08 20:52:20 +01:00
|
|
|
math.in(x, 0, screen.w - image.columns),
|
|
|
|
math.in(y, 0, screen.h - image.rows),
|
2018-05-06 17:02:12 +02:00
|
|
|
image.columns,
|
|
|
|
image.rows
|
|
|
|
);
|
|
|
|
|
2018-04-25 21:09:26 +02:00
|
|
|
for (i = 0; i < image.columns*image.rows; i++;)
|
|
|
|
{
|
2018-10-29 12:39:31 +01:00
|
|
|
image.mas[i] = ESDWORD[i*3+screen_copy]; // & 0xFFFFFF;
|
2018-04-25 21:09:26 +02:00
|
|
|
}
|
|
|
|
DrawCanvas();
|
|
|
|
|
|
|
|
if (mouse.down) {
|
2018-10-09 21:12:02 +02:00
|
|
|
ScreenCopy_onKeyEvent(SCAN_CODE_ENTER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScreenCopy_onKeyEvent(dword keycode) {
|
|
|
|
if (SCAN_CODE_ENTER == keycode) {
|
|
|
|
actionsHistory.saveCurrentState();
|
2018-04-25 21:09:26 +02:00
|
|
|
screen_copy = free(screen_copy);
|
|
|
|
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
|
|
|
|
setCurrentTool(previousTool);
|
2018-05-02 18:32:29 +02:00
|
|
|
if (!CheckActiveProcess(Form.ID)) ActivateWindow(GetProcessSlot(Form.ID));
|
2018-04-25 21:09:26 +02:00
|
|
|
}
|
2018-10-09 21:12:02 +02:00
|
|
|
if (SCAN_CODE_ESC == keycode) {
|
|
|
|
ScreenCopy_onKeyEvent(SCAN_CODE_ENTER);
|
|
|
|
actionsHistory.undoLastAction();
|
|
|
|
}
|
2018-04-25 21:09:26 +02:00
|
|
|
}
|