Subversion Repositories Kolibri OS

Rev

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

  1. dword screen_copy;
  2.  
  3. void ScreenCopy_activate() {
  4.         SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
  5.         screen_copy = malloc(image.columns * image.rows * 3 +4);
  6. }
  7.  
  8. void ScreenCopy_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
  9.         dword i;
  10.         int x, y;
  11.  
  12.         x = mouse.x + Form.left + 5 - calc(image.columns/2);
  13.         y = mouse.y + Form.top + skin_h - calc(image.rows/2);
  14.  
  15.         CopyScreen(
  16.                 screen_copy,
  17.                 math.in(x, 0, screen.w - image.columns),
  18.                 math.in(y, 0, screen.h - image.rows),
  19.                 image.columns,
  20.                 image.rows
  21.         );
  22.  
  23.         for (i = 0; i < image.columns*image.rows; i++;)
  24.         {
  25.                 image.mas[i] = ESDWORD[i*3+screen_copy]; // & 0xFFFFFF;
  26.         }
  27.         DrawCanvas();
  28.        
  29.         if (mouse.down) {
  30.                 ScreenCopy_onKeyEvent(SCAN_CODE_ENTER);
  31.         }
  32. }
  33.  
  34. void ScreenCopy_onKeyEvent(dword keycode) {
  35.         if (SCAN_CODE_ENTER == keycode) {
  36.                 actionsHistory.saveCurrentState();
  37.                 screen_copy = free(screen_copy);
  38.                 SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
  39.                 setCurrentTool(previousTool);
  40.                 if (!CheckActiveProcess(Form.ID)) ActivateWindow(GetProcessSlot(Form.ID));
  41.         }
  42.         if (SCAN_CODE_ESC == keycode) {
  43.                 ScreenCopy_onKeyEvent(SCAN_CODE_ENTER);
  44.                 actionsHistory.undoLastAction();
  45.         }
  46. }
  47.