xref: /reactos/base/applications/mspaint/history.h (revision 2752c42f)
1 /*
2  * PROJECT:     PAINT for ReactOS
3  * LICENSE:     LGPL
4  * FILE:        base/applications/mspaint/history.h
5  * PURPOSE:     Undo and redo functionality
6  * PROGRAMMERS: Benedikt Freisen
7  */
8 
9 #pragma once
10 
11 /* HISTORYSIZE = number of possible undo-steps + 1 */
12 #define HISTORYSIZE 11
13 
14 class ImageModel
15 {
16 private:
17     void NotifyDimensionsChanged();
18     void NotifyImageChanged();
19     HDC hDrawingDC;
20 public:
21     HBITMAP hBms[HISTORYSIZE];
22 private:
23     int currInd;
24     int undoSteps;
25     int redoSteps;
26 public:
27     ImageModel();
28     void CopyPrevious(void);
29     void Undo(BOOL bClearRedo = FALSE);
30     void Redo(void);
31     void ResetToPrevious(void);
32     void ClearHistory(void);
33     void Insert(HBITMAP hbm);
34     void Crop(int nWidth, int nHeight, int nOffsetX = 0, int nOffsetY = 0);
35     void SaveImage(LPTSTR lpFileName);
36     BOOL IsImageSaved() const;
37     BOOL HasUndoSteps() const;
38     BOOL HasRedoSteps() const;
39     void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX = 0, int nSkewDegY = 0);
40     int GetWidth() const;
41     int GetHeight() const;
42     void InvertColors();
43     void Clear(COLORREF color = 0x00ffffff);
44     HDC GetDC();
45     void FlipHorizontally();
46     void FlipVertically();
47     void RotateNTimes90Degrees(int iN);
48     void DrawSelectionBackground(COLORREF rgbBG);
49     void DeleteSelection();
50     void Bound(POINT& pt);
51 };
52