2015-05-08 16:02:36 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: PAINT for ReactOS
|
|
|
|
* LICENSE: LGPL
|
2015-09-09 13:13:35 +00:00
|
|
|
* FILE: base/applications/mspaint/history.h
|
2015-05-08 16:02:36 +00:00
|
|
|
* PURPOSE: Undo and redo functionality
|
|
|
|
* PROGRAMMERS: Benedikt Freisen
|
|
|
|
*/
|
|
|
|
|
2017-12-09 12:36:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-12-28 01:44:56 +00:00
|
|
|
/* HISTORYSIZE = number of possible undo-steps + 1 */
|
|
|
|
#define HISTORYSIZE 11
|
|
|
|
|
2015-07-07 11:56:37 +00:00
|
|
|
class ImageModel
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
void NotifyDimensionsChanged();
|
|
|
|
void NotifyImageChanged();
|
2015-07-23 13:52:02 +00:00
|
|
|
HDC hDrawingDC;
|
2015-07-07 11:56:37 +00:00
|
|
|
public:
|
|
|
|
HBITMAP hBms[HISTORYSIZE];
|
2015-07-23 13:11:54 +00:00
|
|
|
private:
|
2015-07-07 11:56:37 +00:00
|
|
|
int currInd;
|
|
|
|
int undoSteps;
|
|
|
|
int redoSteps;
|
2015-07-23 13:11:54 +00:00
|
|
|
public:
|
2015-07-23 07:48:32 +00:00
|
|
|
ImageModel();
|
2015-07-07 11:56:37 +00:00
|
|
|
void CopyPrevious(void);
|
2022-01-30 03:05:23 +00:00
|
|
|
void Undo(BOOL bClearRedo = FALSE);
|
2015-07-07 11:56:37 +00:00
|
|
|
void Redo(void);
|
|
|
|
void ResetToPrevious(void);
|
|
|
|
void ClearHistory(void);
|
|
|
|
void Insert(HBITMAP hbm);
|
|
|
|
void Crop(int nWidth, int nHeight, int nOffsetX = 0, int nOffsetY = 0);
|
|
|
|
void SaveImage(LPTSTR lpFileName);
|
2021-12-28 00:49:36 +00:00
|
|
|
BOOL IsImageSaved() const;
|
|
|
|
BOOL HasUndoSteps() const;
|
|
|
|
BOOL HasRedoSteps() const;
|
2015-07-07 11:56:37 +00:00
|
|
|
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX = 0, int nSkewDegY = 0);
|
2021-12-28 00:49:36 +00:00
|
|
|
int GetWidth() const;
|
|
|
|
int GetHeight() const;
|
2015-07-07 11:56:37 +00:00
|
|
|
void InvertColors();
|
|
|
|
void Clear(COLORREF color = 0x00ffffff);
|
2015-07-23 13:52:02 +00:00
|
|
|
HDC GetDC();
|
|
|
|
void FlipHorizontally();
|
|
|
|
void FlipVertically();
|
|
|
|
void RotateNTimes90Degrees(int iN);
|
2022-01-30 03:05:23 +00:00
|
|
|
void DrawSelectionBackground(COLORREF rgbBG);
|
|
|
|
void DeleteSelection();
|
|
|
|
void Bound(POINT& pt);
|
2015-07-07 11:56:37 +00:00
|
|
|
};
|