Author: dgorbachev
Date: Wed May 27 16:03:18 2009
New Revision: 41141
URL:
http://svn.reactos.org/svn/reactos?rev=41141&view=rev
Log:
Fix some bugs in Paint.
Modified:
trunk/reactos/base/applications/paint/dialogs.c
trunk/reactos/base/applications/paint/dib.c
trunk/reactos/base/applications/paint/dib.h
trunk/reactos/base/applications/paint/history.c
trunk/reactos/base/applications/paint/main.c
trunk/reactos/base/applications/paint/mouse.c
trunk/reactos/base/applications/paint/selection.c
trunk/reactos/base/applications/paint/toolsettings.c
trunk/reactos/base/applications/paint/winproc.c
Modified: trunk/reactos/base/applications/paint/dialogs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/di…
==============================================================================
--- trunk/reactos/base/applications/paint/dialogs.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/dialogs.c [iso-8859-1] Wed May 27 16:03:18 2009
@@ -59,6 +59,7 @@
default:
return FALSE;
}
+ return TRUE;
}
int mirrorRotateDlg()
@@ -93,6 +94,7 @@
default:
return FALSE;
}
+ return TRUE;
}
int attributesDlg()
@@ -125,6 +127,7 @@
default:
return FALSE;
}
+ return TRUE;
}
int changeSizeDlg()
Modified: trunk/reactos/base/applications/paint/dib.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/di…
==============================================================================
--- trunk/reactos/base/applications/paint/dib.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/dib.c [iso-8859-1] Wed May 27 16:03:18 2009
@@ -43,7 +43,7 @@
return bm.bmHeight;
}
-void SaveDIBToFile(HBITMAP hbm, char name[], HDC hdc)
+void SaveDIBToFile(HBITMAP hbm, LPSTR name, HDC hdc)
{
BITMAP bm;
GetObject(hbm, sizeof(BITMAP), &bm);
@@ -77,7 +77,7 @@
HeapFree(GetProcessHeap(), 0, buffer);
}
-HBITMAP LoadDIBFromFile(char name[])
+HBITMAP LoadDIBFromFile(LPSTR name)
{
HBITMAP bm;
BITMAPFILEHEADER bfh;
@@ -88,7 +88,7 @@
ReadFile(f, &bfh, 14, (LPDWORD)&bytesRead, NULL);
if (bfh.bfType!=0x4d42)
{
- fclose(f);
+ CloseHandle(f);
return NULL;
}
bi = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, bfh.bfOffBits-14);
Modified: trunk/reactos/base/applications/paint/dib.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/di…
==============================================================================
--- trunk/reactos/base/applications/paint/dib.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/dib.h [iso-8859-1] Wed May 27 16:03:18 2009
@@ -12,6 +12,6 @@
int GetDIBHeight(HBITMAP hbm);
-void SaveDIBToFile(HBITMAP hbm, char name[], HDC hdc);
+void SaveDIBToFile(HBITMAP hbm, LPSTR name, HDC hdc);
-HBITMAP LoadDIBFromFile(char name[]);
+HBITMAP LoadDIBFromFile(LPSTR name);
Modified: trunk/reactos/base/applications/paint/history.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/hi…
==============================================================================
--- trunk/reactos/base/applications/paint/history.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/history.c [iso-8859-1] Wed May 27 16:03:18 2009
@@ -14,6 +14,8 @@
#include "definitions.h"
/* FUNCTIONS ********************************************************/
+
+extern void updateCanvasAndScrollbars(void);
void setImgXYRes(int x, int y)
{
Modified: trunk/reactos/base/applications/paint/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/ma…
==============================================================================
--- trunk/reactos/base/applications/paint/main.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/main.c [iso-8859-1] Wed May 27 16:03:18 2009
@@ -194,11 +194,11 @@
wclSelection.hbrBackground = NULL;//GetSysColorBrush(COLOR_BTNFACE);
RegisterClassEx (&wclSelection);
- LoadString(hThisInstance, IDS_DEFAULTFILENAME, (LPTSTR)&filename, 256);
+ LoadString(hThisInstance, IDS_DEFAULTFILENAME, (LPTSTR)filename, sizeof(filename));
char progtitle[1000];
char resstr[100];
- LoadString(hThisInstance, IDS_WINDOWTITLE, (LPTSTR)&resstr, 100);
- sprintf(progtitle, resstr, &filename);
+ LoadString(hThisInstance, IDS_WINDOWTITLE, (LPTSTR)resstr, sizeof(resstr));
+ sprintf(progtitle, resstr, filename);
// create main window
@@ -240,9 +240,9 @@
for (i=0; i<16; i++)
{
int wrapnow = 0;
- if (i%2==1) wrapnow = TBSTATE_WRAP;
- LoadString(hThisInstance, IDS_TOOLTIP1+i, (LPTSTR)&tooltips[i], 30);
- TBBUTTON tbbutton = {i, (HMENU)(ID_FREESEL+i), TBSTATE_ENABLED | wrapnow,
TBSTYLE_CHECKGROUP, {0}, 0, &tooltips[i]};
+ if (i % 2 == 1) wrapnow = TBSTATE_WRAP;
+ LoadString(hThisInstance, IDS_TOOLTIP1 + i, (LPTSTR)tooltips[i], 30);
+ TBBUTTON tbbutton = { i, ID_FREESEL + i, TBSTATE_ENABLED | wrapnow,
TBSTYLE_CHECKGROUP, {0}, 0, (INT_PTR)tooltips[i] };
SendMessage(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&tbbutton);
}
// SendMessage(hToolbar, TB_SETROWS, MAKEWPARAM(8, FALSE), (LPARAM)NULL);
@@ -299,41 +299,41 @@
choosecolor.lpfnHook = NULL;
choosecolor.lpTemplateName = NULL;
- int c;
+ char *c;
// initializing the OPENFILENAME structure for use with GetOpenFileName and
GetSaveFileName
char ofnFilename[1000];
- CopyMemory(&ofnFilename, &filename, 256);
+ CopyMemory(ofnFilename, filename, sizeof(filename));
char ofnFiletitle[256];
char ofnFilter[1000];
- LoadString(hThisInstance, IDS_OPENFILTER, (LPTSTR)&ofnFilter, 1000);
- for (c=0; c<1000; c++) if (ofnFilter[c]==(char)1) ofnFilter[c] = (char)0;
+ LoadString(hThisInstance, IDS_OPENFILTER, (LPTSTR)ofnFilter, sizeof(ofnFilter));
+ for (c = ofnFilter; *c; c++) if (*c == '\1') *c = '\0';
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.hInstance = hThisInstance;
- ofn.lpstrFilter = (LPCTSTR)&ofnFilter;
- ofn.lpstrFile = (LPTSTR)&ofnFilename;
- ofn.nMaxFile = 1000;
- ofn.lpstrFileTitle = (LPTSTR)&ofnFiletitle;
- ofn.nMaxFileTitle = 256;
+ ofn.lpstrFilter = (LPCTSTR)ofnFilter;
+ ofn.lpstrFile = (LPTSTR)ofnFilename;
+ ofn.nMaxFile = sizeof(ofnFilename);
+ ofn.lpstrFileTitle = (LPTSTR)ofnFiletitle;
+ ofn.nMaxFileTitle = sizeof(ofnFiletitle);
ofn.Flags = OFN_HIDEREADONLY;
char sfnFilename[1000];
- CopyMemory(&sfnFilename, &filename, 256);
+ CopyMemory(sfnFilename, filename, sizeof(filename));
char sfnFiletitle[256];
char sfnFilter[1000];
- LoadString(hThisInstance, IDS_SAVEFILTER, (LPTSTR)&sfnFilter, 1000);
- for (c=0; c<1000; c++) if (sfnFilter[c]==(char)1) sfnFilter[c] = (char)0;
+ LoadString(hThisInstance, IDS_SAVEFILTER, (LPTSTR)sfnFilter, sizeof(sfnFilter));
+ for (c = sfnFilter; *c; c++) if (*c == '\1') *c = '\0';
ZeroMemory(&sfn, sizeof(OPENFILENAME));
sfn.lStructSize = sizeof (OPENFILENAME);
sfn.hwndOwner = hwnd;
sfn.hInstance = hThisInstance;
- sfn.lpstrFilter = (LPCTSTR)&sfnFilter;
- sfn.lpstrFile = (LPTSTR)&sfnFilename;
- sfn.nMaxFile = 1000;
- sfn.lpstrFileTitle = (LPTSTR)&sfnFiletitle;
- sfn.nMaxFileTitle = 256;
+ sfn.lpstrFilter = (LPCTSTR)sfnFilter;
+ sfn.lpstrFile = (LPTSTR)sfnFilename;
+ sfn.nMaxFile = sizeof(sfnFilename);
+ sfn.lpstrFileTitle = (LPTSTR)sfnFiletitle;
+ sfn.nMaxFileTitle = sizeof(sfnFiletitle);
sfn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
Modified: trunk/reactos/base/applications/paint/mouse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/mo…
==============================================================================
--- trunk/reactos/base/applications/paint/mouse.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/mouse.c [iso-8859-1] Wed May 27 16:03:18 2009
@@ -9,6 +9,9 @@
/* INCLUDES *********************************************************/
#include "globalvar.h"
+#include "dib.h"
+#include "drawing.h"
+#include "history.h"
/* FUNCTIONS ********************************************************/
Modified: trunk/reactos/base/applications/paint/selection.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/se…
==============================================================================
--- trunk/reactos/base/applications/paint/selection.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/selection.c [iso-8859-1] Wed May 27 16:03:18
2009
@@ -10,6 +10,9 @@
#include <windows.h>
#include "globalvar.h"
+#include "drawing.h"
+#include "history.h"
+#include "mouse.h"
/* FUNCTIONS ********************************************************/
Modified: trunk/reactos/base/applications/paint/toolsettings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/to…
==============================================================================
--- trunk/reactos/base/applications/paint/toolsettings.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/toolsettings.c [iso-8859-1] Wed May 27 16:03:18
2009
@@ -10,6 +10,7 @@
#include <windows.h>
#include "globalvar.h"
+#include "drawing.h"
/* FUNCTIONS ********************************************************/
Modified: trunk/reactos/base/applications/paint/winproc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/wi…
==============================================================================
--- trunk/reactos/base/applications/paint/winproc.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/winproc.c [iso-8859-1] Wed May 27 16:03:18 2009
@@ -16,7 +16,10 @@
#include "definitions.h"
#include "globalvar.h"
#include "dialogs.h"
+#include "dib.h"
+#include "drawing.h"
#include "history.h"
+#include "mouse.h"
/* FUNCTIONS ********************************************************/
@@ -59,11 +62,11 @@
{
char programname[20];
char saveprompttext[100];
- LoadString(hProgInstance, IDS_PROGRAMNAME, (LPTSTR)&programname,
20);
- LoadString(hProgInstance, IDS_SAVEPROMPTTEXT,
(LPTSTR)&saveprompttext, 100);
+ LoadString(hProgInstance, IDS_PROGRAMNAME, (LPTSTR)programname,
sizeof(programname));
+ LoadString(hProgInstance, IDS_SAVEPROMPTTEXT, (LPTSTR)saveprompttext,
sizeof(saveprompttext));
char temptext[500];
sprintf(temptext, saveprompttext, filename);
- switch (MessageBox(hwnd, (LPTSTR)&temptext, (LPTSTR)&programname,
MB_YESNOCANCEL | MB_ICONQUESTION))
+ switch (MessageBox(hwnd, (LPTSTR)temptext, (LPTSTR)programname,
MB_YESNOCANCEL | MB_ICONQUESTION))
{
case IDNO:
DestroyWindow(hwnd);
@@ -361,9 +364,9 @@
HICON paintIcon = LoadIcon(hProgInstance,
MAKEINTRESOURCE(IDI_APPICON));
char infotitle[100];
char infotext[200];
- LoadString(hProgInstance, IDS_INFOTITLE, (LPTSTR)&infotitle,
100);
- LoadString(hProgInstance, IDS_INFOTEXT, (LPTSTR)&infotext,
200);
- ShellAbout(hMainWnd, (LPTSTR)&infotitle,
(LPTSTR)&infotext, paintIcon);
+ LoadString(hProgInstance, IDS_INFOTITLE, (LPTSTR)infotitle,
sizeof(infotitle));
+ LoadString(hProgInstance, IDS_INFOTEXT, (LPTSTR)infotext,
sizeof(infotext));
+ ShellAbout(hMainWnd, (LPTSTR)infotitle, (LPTSTR)infotext,
paintIcon);
DeleteObject(paintIcon);
}
break;
@@ -387,10 +390,10 @@
updateCanvasAndScrollbars();
char tempstr[1000];
char resstr[100];
- CopyMemory(&filename, ofn.lpstrFileTitle, 256);
- CopyMemory(&filepathname, ofn.lpstrFileTitle, 1000);
- LoadString(hProgInstance, IDS_WINDOWTITLE,
(LPTSTR)&resstr, 100);
- sprintf(tempstr, resstr, &filename);
+ CopyMemory(filename, ofn.lpstrFileTitle, sizeof(filename));
+ CopyMemory(filepathname, ofn.lpstrFileTitle,
sizeof(filepathname));
+ LoadString(hProgInstance, IDS_WINDOWTITLE, (LPTSTR)resstr,
sizeof(resstr));
+ sprintf(tempstr, resstr, filename);
SetWindowText(hMainWnd, tempstr);
clearHistory();
isAFile = TRUE;
@@ -399,7 +402,7 @@
break;
case IDM_FILESAVE:
if (isAFile)
- SaveDIBToFile(hBms[currInd], &filepathname, hDrawingDC);
+ SaveDIBToFile(hBms[currInd], filepathname, hDrawingDC);
else
SendMessage(hwnd, WM_COMMAND, IDM_FILESAVEAS, 0);
break;
@@ -409,10 +412,10 @@
SaveDIBToFile(hBms[currInd], sfn.lpstrFile, hDrawingDC);
char tempstr[1000];
char resstr[100];
- CopyMemory(&filename, sfn.lpstrFileTitle, 256);
- CopyMemory(&filepathname, sfn.lpstrFileTitle, 1000);
- LoadString(hProgInstance, IDS_WINDOWTITLE, (LPTSTR)&resstr,
100);
- sprintf(tempstr, resstr, &filename);
+ CopyMemory(filename, sfn.lpstrFileTitle, sizeof(filename));
+ CopyMemory(filepathname, sfn.lpstrFileTitle,
sizeof(filepathname));
+ LoadString(hProgInstance, IDS_WINDOWTITLE, (LPTSTR)resstr,
sizeof(resstr));
+ sprintf(tempstr, resstr, filename);
SetWindowText(hMainWnd, tempstr);
isAFile = TRUE;
}
@@ -503,7 +506,7 @@
break;
case IDM_IMAGEATTRIBUTES:
{
- int attrdata[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+ //int attrdata[8] = {0, 0, 0, 0, 0, 0, 0, 0};
attributesDlg();
//cropReversible(640, 200);
//ZoomTo(zoom);