kolibrios/programs/cmm/iconedit/tools/screen_copy.h
Kirill Lipatov (Leency) 2a5b8498fd Notes 1.1:
- fixed bugs found by TheOnlyMirage
- if CPU frequency < 1000 then while drag show only window frame else whow window contents
- add to autobuild
CPUid: 
- fix app crash at unknown Intel CPU name by Sh@dy
- non-cropped "intel.gif" logo
- delete redundant knopka* files
icons32.png:
- new Notes icon
- better icons: CPUid, Gmon
- reduce file size
IconEdit 0.58:
- update preview
- rotate squire images
- Ctrl+KeyArrow moves image on the canvas
- screen copy key events
- triangle gradient marker
- improve window appearance for dark skins

git-svn-id: svn://kolibrios.org@7444 a494cfbc-eb01-0410-851d-a64ba20cac60
2018-10-09 19:12:02 +00:00

47 lines
1.2 KiB
C

dword screen_copy;
void ScreenCopy_activate() {
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
screen_copy = malloc(image.columns * image.rows * 3 +4);
}
void ScreenCopy_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
dword i;
int x, y;
x = mouse.x + Form.left + 5 - calc(image.columns/2);
y = mouse.y + Form.top + skin_height - calc(image.rows/2);
CopyScreen(
screen_copy,
math.in(x, 0, screen.width - image.columns),
math.in(y, 0, screen.height - image.rows),
image.columns,
image.rows
);
for (i = 0; i < image.columns*image.rows; i++;)
{
image.mas[i] = ESDWORD[i*3+screen_copy] & 0xFFFFFF;
}
DrawCanvas();
if (mouse.down) {
ScreenCopy_onKeyEvent(SCAN_CODE_ENTER);
}
}
void ScreenCopy_onKeyEvent(dword keycode) {
if (SCAN_CODE_ENTER == keycode) {
actionsHistory.saveCurrentState();
screen_copy = free(screen_copy);
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
setCurrentTool(previousTool);
if (!CheckActiveProcess(Form.ID)) ActivateWindow(GetProcessSlot(Form.ID));
}
if (SCAN_CODE_ESC == keycode) {
ScreenCopy_onKeyEvent(SCAN_CODE_ENTER);
actionsHistory.undoLastAction();
}
}