diff --git a/reactos/base/applications/paint/definitions.h b/reactos/base/applications/paint/definitions.h index 22a553ce853..eb6f025cc1a 100644 --- a/reactos/base/applications/paint/definitions.h +++ b/reactos/base/applications/paint/definitions.h @@ -8,6 +8,9 @@ /* DEFINES **********************************************************/ +#define HISTORYSIZE 11 +/* HISTORYSIZE = number of possible undo-steps + 1 */ + #define SIZEOF(a) (sizeof(a) / sizeof((a)[0])) #define IDI_APPICON 500 diff --git a/reactos/base/applications/paint/globalvar.h b/reactos/base/applications/paint/globalvar.h index b864586a169..e9e8e12fc3b 100644 --- a/reactos/base/applications/paint/globalvar.h +++ b/reactos/base/applications/paint/globalvar.h @@ -9,6 +9,7 @@ /* INCLUDES *********************************************************/ #include +#include "definitions.h" /* VARIABLES declared in main.c *************************************/ @@ -19,10 +20,11 @@ extern BITMAPINFO bitmapinfo; extern int imgXRes; extern int imgYRes; -extern HBITMAP hBms[4]; +extern HBITMAP hBms[HISTORYSIZE]; extern int currInd; extern int undoSteps; extern int redoSteps; +extern BOOL imageSaved; extern short startX; extern short startY; @@ -86,6 +88,8 @@ extern HWND hSizeboxLeftBottom; extern HWND hSizeboxCenterBottom; extern HWND hSizeboxRightBottom; +extern HWND hTrackbarZoom; + /* VARIABLES declared in mouse.c *************************************/ extern POINT pointStack[256]; diff --git a/reactos/base/applications/paint/history.c b/reactos/base/applications/paint/history.c index a0f434a4767..8331c9d6768 100644 --- a/reactos/base/applications/paint/history.c +++ b/reactos/base/applications/paint/history.c @@ -29,14 +29,15 @@ void setImgXYRes(int x, int y) void newReversible() { - DeleteObject(hBms[(currInd+1)%4]); - hBms[(currInd+1)%4] = CopyImage( hBms[currInd], IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG); - currInd = (currInd+1)%4; - if (undoSteps<3) undoSteps++; + DeleteObject(hBms[(currInd+1)%HISTORYSIZE]); + hBms[(currInd+1)%HISTORYSIZE] = CopyImage( hBms[currInd], IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG); + currInd = (currInd+1)%HISTORYSIZE; + if (undoSteps0) { ShowWindow(hSelection, SW_HIDE); - currInd = (currInd+3)%4; + currInd = (currInd+HISTORYSIZE-1)%HISTORYSIZE; SelectObject(hDrawingDC, hBms[currInd]); undoSteps--; - if (redoSteps<3) redoSteps++; + if (redoSteps0) { ShowWindow(hSelection, SW_HIDE); - currInd = (currInd+1)%4; + currInd = (currInd+1)%HISTORYSIZE; SelectObject(hDrawingDC, hBms[currInd]); redoSteps--; - if (undoSteps<3) undoSteps++; + if (undoSteps 2) || (dwTile > 2)) @@ -34,5 +36,5 @@ void SetWallpaper(TCHAR *FileName, DWORD dwStyle, DWORD dwTile) RegSetValueEx(hDesktop, _T("TileWallpaper"), 0, REG_SZ, (LPBYTE) szTile, _tcslen(szTile) * sizeof(TCHAR)); RegCloseKey(hDesktop); - } + }*/ } diff --git a/reactos/base/applications/paint/toolsettings.c b/reactos/base/applications/paint/toolsettings.c index 8f7de9eb1d3..6e7baddec15 100644 --- a/reactos/base/applications/paint/toolsettings.c +++ b/reactos/base/applications/paint/toolsettings.c @@ -9,8 +9,10 @@ /* INCLUDES *********************************************************/ #include +#include #include "globalvar.h" #include "drawing.h" +#include "winproc.h" /* FUNCTIONS ********************************************************/ @@ -18,6 +20,11 @@ LRESULT CALLBACK SettingsWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM { switch (message) { + case WM_VSCROLL: + { + ZoomTo(125<=13) DrawEdge(hdc, (LPRECT)&rectang2, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE); else diff --git a/reactos/base/applications/paint/winproc.c b/reactos/base/applications/paint/winproc.c index 9500bdb1aa6..8735774f1b1 100644 --- a/reactos/base/applications/paint/winproc.c +++ b/reactos/base/applications/paint/winproc.c @@ -31,6 +31,10 @@ void selectTool(int tool) activeTool = tool; pointSP = 0; // resets the point-buffer of the polygon and bezier functions SendMessage(hToolSettings, WM_PAINT, 0, 0); + if (tool==6) + ShowWindow(hTrackbarZoom, SW_SHOW); + else + ShowWindow(hTrackbarZoom, SW_HIDE); } void updateCanvasAndScrollbars() @@ -48,6 +52,14 @@ void ZoomTo(int newZoom) { zoom = newZoom; updateCanvasAndScrollbars(); + int tbPos = 0; + int tempZoom = newZoom; + while (tempZoom>125) + { + tbPos++; + tempZoom = tempZoom>>1; + } + SendMessage(hTrackbarZoom, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)tbPos); } HDC hdc; @@ -67,7 +79,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM showMiniature = FALSE; break; } - if (undoSteps>0) + if (!imageSaved) { TCHAR programname[20]; TCHAR saveprompttext[100]; @@ -503,7 +515,10 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM break; case IDM_FILESAVE: if (isAFile) + { SaveDIBToFile(hBms[currInd], filepathname, hDrawingDC); + imageSaved = TRUE; + } else SendMessage(hwnd, WM_COMMAND, IDM_FILESAVEAS, 0); break; @@ -514,11 +529,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM TCHAR resstr[100]; SaveDIBToFile(hBms[currInd], sfn.lpstrFile, hDrawingDC); CopyMemory(filename, sfn.lpstrFileTitle, sizeof(filename)); - CopyMemory(filepathname, sfn.lpstrFileTitle, sizeof(filepathname)); + CopyMemory(filepathname, sfn.lpstrFile, sizeof(filepathname)); LoadString(hProgInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr)); _stprintf(tempstr, resstr, filename); SetWindowText(hMainWnd, tempstr); isAFile = TRUE; + imageSaved = TRUE; } break; case IDM_FILEASWALLPAPERPLANE: diff --git a/reactos/base/applications/paint/winproc.h b/reactos/base/applications/paint/winproc.h index 6ded8695913..0b016be35ab 100644 --- a/reactos/base/applications/paint/winproc.h +++ b/reactos/base/applications/paint/winproc.h @@ -7,4 +7,6 @@ * PROGRAMMERS: Benedikt Freisen */ +void ZoomTo(int newZoom); + LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);