mirror of
https://github.com/reactos/reactos.git
synced 2025-07-29 10:12:00 +00:00
Fix some bugs in Paint.
svn path=/trunk/; revision=41141
This commit is contained in:
parent
1692e98b17
commit
acf1233799
9 changed files with 59 additions and 44 deletions
|
@ -59,6 +59,7 @@ LRESULT CALLBACK MRDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lP
|
|||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int mirrorRotateDlg()
|
||||
|
@ -93,6 +94,7 @@ LRESULT CALLBACK ATTDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l
|
|||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int attributesDlg()
|
||||
|
@ -125,6 +127,7 @@ LRESULT CALLBACK CHSIZEDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
|
|||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int changeSizeDlg()
|
||||
|
|
|
@ -43,7 +43,7 @@ int GetDIBHeight(HBITMAP hbm)
|
|||
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 @@ void SaveDIBToFile(HBITMAP hbm, char name[], HDC hdc)
|
|||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
}
|
||||
|
||||
HBITMAP LoadDIBFromFile(char name[])
|
||||
HBITMAP LoadDIBFromFile(LPSTR name)
|
||||
{
|
||||
HBITMAP bm;
|
||||
BITMAPFILEHEADER bfh;
|
||||
|
@ -88,7 +88,7 @@ HBITMAP LoadDIBFromFile(char name[])
|
|||
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);
|
||||
|
|
|
@ -12,6 +12,6 @@ int GetDIBWidth(HBITMAP hbm);
|
|||
|
||||
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);
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
extern void updateCanvasAndScrollbars(void);
|
||||
|
||||
void setImgXYRes(int x, int y)
|
||||
{
|
||||
if ((imgXRes!=x)||(imgYRes!=y))
|
||||
|
|
|
@ -194,11 +194,11 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
|||
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 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
|||
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 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
|||
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;
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
/* INCLUDES *********************************************************/
|
||||
|
||||
#include "globalvar.h"
|
||||
#include "dib.h"
|
||||
#include "drawing.h"
|
||||
#include "history.h"
|
||||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include "globalvar.h"
|
||||
#include "drawing.h"
|
||||
#include "history.h"
|
||||
#include "mouse.h"
|
||||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include "globalvar.h"
|
||||
#include "drawing.h"
|
||||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
|
|
|
@ -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 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
{
|
||||
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 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
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 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
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 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
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 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
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 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue