default:
return FALSE;
}
+ return TRUE;
}
int mirrorRotateDlg()
default:
return FALSE;
}
+ return TRUE;
}
int attributesDlg()
default:
return FALSE;
}
+ return TRUE;
}
int changeSizeDlg()
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);
HeapFree(GetProcessHeap(), 0, buffer);
}
-HBITMAP LoadDIBFromFile(char name[])
+HBITMAP LoadDIBFromFile(LPSTR name)
{
HBITMAP bm;
BITMAPFILEHEADER bfh;
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);
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);
/* FUNCTIONS ********************************************************/
+extern void updateCanvasAndScrollbars(void);
+
void setImgXYRes(int x, int y)
{
if ((imgXRes!=x)||(imgYRes!=y))
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
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);
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;
/* INCLUDES *********************************************************/
#include "globalvar.h"
+#include "dib.h"
+#include "drawing.h"
+#include "history.h"
/* FUNCTIONS ********************************************************/
#include <windows.h>
#include "globalvar.h"
+#include "drawing.h"
+#include "history.h"
+#include "mouse.h"
/* FUNCTIONS ********************************************************/
#include <windows.h>
#include "globalvar.h"
+#include "drawing.h"
/* FUNCTIONS ********************************************************/
#include "definitions.h"
#include "globalvar.h"
#include "dialogs.h"
+#include "dib.h"
+#include "drawing.h"
#include "history.h"
+#include "mouse.h"
/* FUNCTIONS ********************************************************/
{
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);
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;
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;
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;
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;
}
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);