mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 00:45:49 +00:00
Change Paint to use Unicode
svn path=/trunk/; revision=41147
This commit is contained in:
parent
73bb488c7a
commit
2d3b058e33
7 changed files with 81 additions and 77 deletions
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
/* DEFINES **********************************************************/
|
/* DEFINES **********************************************************/
|
||||||
|
|
||||||
|
#define SIZEOF(a) (sizeof(a) / sizeof((a)[0]))
|
||||||
|
|
||||||
#define IDI_APPICON 500
|
#define IDI_APPICON 500
|
||||||
|
|
||||||
#define IDB_TOOLBARICONS 510
|
#define IDB_TOOLBARICONS 510
|
||||||
|
|
|
@ -43,7 +43,7 @@ int GetDIBHeight(HBITMAP hbm)
|
||||||
return bm.bmHeight;
|
return bm.bmHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveDIBToFile(HBITMAP hbm, LPSTR name, HDC hdc)
|
void SaveDIBToFile(HBITMAP hbm, LPTSTR name, HDC hdc)
|
||||||
{
|
{
|
||||||
BITMAP bm;
|
BITMAP bm;
|
||||||
GetObject(hbm, sizeof(BITMAP), &bm);
|
GetObject(hbm, sizeof(BITMAP), &bm);
|
||||||
|
@ -77,7 +77,7 @@ void SaveDIBToFile(HBITMAP hbm, LPSTR name, HDC hdc)
|
||||||
HeapFree(GetProcessHeap(), 0, buffer);
|
HeapFree(GetProcessHeap(), 0, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
HBITMAP LoadDIBFromFile(LPSTR name)
|
HBITMAP LoadDIBFromFile(LPTSTR name)
|
||||||
{
|
{
|
||||||
HBITMAP bm;
|
HBITMAP bm;
|
||||||
BITMAPFILEHEADER bfh;
|
BITMAPFILEHEADER bfh;
|
||||||
|
|
|
@ -12,6 +12,6 @@ int GetDIBWidth(HBITMAP hbm);
|
||||||
|
|
||||||
int GetDIBHeight(HBITMAP hbm);
|
int GetDIBHeight(HBITMAP hbm);
|
||||||
|
|
||||||
void SaveDIBToFile(HBITMAP hbm, LPSTR name, HDC hdc);
|
void SaveDIBToFile(HBITMAP hbm, LPTSTR name, HDC hdc);
|
||||||
|
|
||||||
HBITMAP LoadDIBFromFile(LPSTR name);
|
HBITMAP LoadDIBFromFile(LPTSTR name);
|
||||||
|
|
|
@ -68,6 +68,6 @@ extern HWND hToolBtn[16];
|
||||||
|
|
||||||
extern HINSTANCE hProgInstance;
|
extern HINSTANCE hProgInstance;
|
||||||
|
|
||||||
extern char filename[256];
|
extern TCHAR filename[256];
|
||||||
extern char filepathname[1000];
|
extern TCHAR filepathname[1000];
|
||||||
extern BOOL isAFile;
|
extern BOOL isAFile;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <tchar.h>
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
|
|
||||||
#include "drawing.h"
|
#include "drawing.h"
|
||||||
|
@ -97,11 +98,11 @@ HWND hToolBtn[16];
|
||||||
|
|
||||||
HINSTANCE hProgInstance;
|
HINSTANCE hProgInstance;
|
||||||
|
|
||||||
char filename[256];
|
TCHAR filename[256];
|
||||||
char filepathname[1000];
|
TCHAR filepathname[1000];
|
||||||
BOOL isAFile = FALSE;
|
BOOL isAFile = FALSE;
|
||||||
|
|
||||||
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
|
int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument, int nFunsterStil)
|
||||||
{
|
{
|
||||||
hProgInstance = hThisInstance;
|
hProgInstance = hThisInstance;
|
||||||
HWND hwnd; /* This is the handle for our window */
|
HWND hwnd; /* This is the handle for our window */
|
||||||
|
@ -113,7 +114,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||||
//initializing and registering the window class used for the main window
|
//initializing and registering the window class used for the main window
|
||||||
WNDCLASSEX wincl;
|
WNDCLASSEX wincl;
|
||||||
wincl.hInstance = hThisInstance;
|
wincl.hInstance = hThisInstance;
|
||||||
wincl.lpszClassName = "WindowsApp";
|
wincl.lpszClassName = _T("WindowsApp");
|
||||||
wincl.lpfnWndProc = WindowProcedure;
|
wincl.lpfnWndProc = WindowProcedure;
|
||||||
wincl.style = CS_DBLCLKS;
|
wincl.style = CS_DBLCLKS;
|
||||||
wincl.cbSize = sizeof (WNDCLASSEX);
|
wincl.cbSize = sizeof (WNDCLASSEX);
|
||||||
|
@ -130,7 +131,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||||
|
|
||||||
WNDCLASSEX wclScroll;
|
WNDCLASSEX wclScroll;
|
||||||
wclScroll.hInstance = hThisInstance;
|
wclScroll.hInstance = hThisInstance;
|
||||||
wclScroll.lpszClassName = "Scrollbox";
|
wclScroll.lpszClassName = _T("Scrollbox");
|
||||||
wclScroll.lpfnWndProc = WindowProcedure;
|
wclScroll.lpfnWndProc = WindowProcedure;
|
||||||
wclScroll.style = 0;
|
wclScroll.style = 0;
|
||||||
wclScroll.cbSize = sizeof (WNDCLASSEX);
|
wclScroll.cbSize = sizeof (WNDCLASSEX);
|
||||||
|
@ -147,7 +148,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||||
|
|
||||||
WNDCLASSEX wclPal;
|
WNDCLASSEX wclPal;
|
||||||
wclPal.hInstance = hThisInstance;
|
wclPal.hInstance = hThisInstance;
|
||||||
wclPal.lpszClassName = "Palette";
|
wclPal.lpszClassName = _T("Palette");
|
||||||
wclPal.lpfnWndProc = PalWinProc;
|
wclPal.lpfnWndProc = PalWinProc;
|
||||||
wclPal.style = CS_DBLCLKS;
|
wclPal.style = CS_DBLCLKS;
|
||||||
wclPal.cbSize = sizeof (WNDCLASSEX);
|
wclPal.cbSize = sizeof (WNDCLASSEX);
|
||||||
|
@ -164,7 +165,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||||
|
|
||||||
WNDCLASSEX wclSettings;
|
WNDCLASSEX wclSettings;
|
||||||
wclSettings.hInstance = hThisInstance;
|
wclSettings.hInstance = hThisInstance;
|
||||||
wclSettings.lpszClassName = "ToolSettings";
|
wclSettings.lpszClassName = _T("ToolSettings");
|
||||||
wclSettings.lpfnWndProc = SettingsWinProc;
|
wclSettings.lpfnWndProc = SettingsWinProc;
|
||||||
wclSettings.style = CS_DBLCLKS;
|
wclSettings.style = CS_DBLCLKS;
|
||||||
wclSettings.cbSize = sizeof (WNDCLASSEX);
|
wclSettings.cbSize = sizeof (WNDCLASSEX);
|
||||||
|
@ -181,7 +182,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||||
|
|
||||||
WNDCLASSEX wclSelection;
|
WNDCLASSEX wclSelection;
|
||||||
wclSelection.hInstance = hThisInstance;
|
wclSelection.hInstance = hThisInstance;
|
||||||
wclSelection.lpszClassName = "Selection";
|
wclSelection.lpszClassName = _T("Selection");
|
||||||
wclSelection.lpfnWndProc = SelectionWinProc;
|
wclSelection.lpfnWndProc = SelectionWinProc;
|
||||||
wclSelection.style = CS_DBLCLKS;
|
wclSelection.style = CS_DBLCLKS;
|
||||||
wclSelection.cbSize = sizeof (WNDCLASSEX);
|
wclSelection.cbSize = sizeof (WNDCLASSEX);
|
||||||
|
@ -194,15 +195,15 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||||
wclSelection.hbrBackground = NULL;//GetSysColorBrush(COLOR_BTNFACE);
|
wclSelection.hbrBackground = NULL;//GetSysColorBrush(COLOR_BTNFACE);
|
||||||
RegisterClassEx (&wclSelection);
|
RegisterClassEx (&wclSelection);
|
||||||
|
|
||||||
LoadString(hThisInstance, IDS_DEFAULTFILENAME, (LPTSTR)filename, sizeof(filename));
|
LoadString(hThisInstance, IDS_DEFAULTFILENAME, filename, SIZEOF(filename));
|
||||||
char progtitle[1000];
|
TCHAR progtitle[1000];
|
||||||
char resstr[100];
|
TCHAR resstr[100];
|
||||||
LoadString(hThisInstance, IDS_WINDOWTITLE, (LPTSTR)resstr, sizeof(resstr));
|
LoadString(hThisInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
|
||||||
sprintf(progtitle, resstr, filename);
|
_stprintf(progtitle, resstr, filename);
|
||||||
|
|
||||||
|
|
||||||
// create main window
|
// create main window
|
||||||
hwnd = CreateWindowEx (0, "WindowsApp", (LPTSTR)progtitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 544, 375, HWND_DESKTOP, NULL, hThisInstance, NULL);
|
hwnd = CreateWindowEx (0, _T("WindowsApp"), progtitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 544, 375, HWND_DESKTOP, NULL, hThisInstance, NULL);
|
||||||
|
|
||||||
hMainWnd = hwnd;
|
hMainWnd = hwnd;
|
||||||
|
|
||||||
|
@ -222,7 +223,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||||
hCurPen = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_PEN));
|
hCurPen = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_PEN));
|
||||||
hCurAirbrush = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_AIRBRUSH));
|
hCurAirbrush = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_AIRBRUSH));
|
||||||
|
|
||||||
HWND hLine = CreateWindowEx (0, "STATIC", "", WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL, hThisInstance, NULL);
|
HWND hLine = CreateWindowEx (0, _T("STATIC"), _T(""), WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL, hThisInstance, NULL);
|
||||||
|
|
||||||
// creating the 16 bitmap radio buttons and setting the bitmap
|
// creating the 16 bitmap radio buttons and setting the bitmap
|
||||||
|
|
||||||
|
@ -236,12 +237,12 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||||
DeleteObject(tempBm);
|
DeleteObject(tempBm);
|
||||||
SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
||||||
int i;
|
int i;
|
||||||
char tooltips[16][30];
|
TCHAR tooltips[16][30];
|
||||||
for (i=0; i<16; i++)
|
for (i=0; i<16; i++)
|
||||||
{
|
{
|
||||||
int wrapnow = 0;
|
int wrapnow = 0;
|
||||||
if (i % 2 == 1) wrapnow = TBSTATE_WRAP;
|
if (i % 2 == 1) wrapnow = TBSTATE_WRAP;
|
||||||
LoadString(hThisInstance, IDS_TOOLTIP1 + i, (LPTSTR)tooltips[i], 30);
|
LoadString(hThisInstance, IDS_TOOLTIP1 + i, tooltips[i], 30);
|
||||||
TBBUTTON tbbutton = { i, ID_FREESEL + i, TBSTATE_ENABLED | wrapnow, TBSTYLE_CHECKGROUP, {0}, 0, (INT_PTR)tooltips[i] };
|
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_ADDBUTTONS, 1, (LPARAM)&tbbutton);
|
||||||
}
|
}
|
||||||
|
@ -256,25 +257,25 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||||
|
|
||||||
|
|
||||||
// creating the tool settings child window
|
// creating the tool settings child window
|
||||||
hToolSettings = CreateWindowEx(0, "ToolSettings", "", WS_CHILD | WS_VISIBLE, 7, 210, 42, 140, hwnd, NULL, hThisInstance, NULL);
|
hToolSettings = CreateWindowEx(0, _T("ToolSettings"), _T(""), WS_CHILD | WS_VISIBLE, 7, 210, 42, 140, hwnd, NULL, hThisInstance, NULL);
|
||||||
|
|
||||||
// creating the palette child window
|
// creating the palette child window
|
||||||
hPalWin = CreateWindowEx(0, "Palette", "", WS_CHILD | WS_VISIBLE, 56, 9, 255, 32, hwnd, NULL, hThisInstance, NULL);
|
hPalWin = CreateWindowEx(0, _T("Palette"), _T(""), WS_CHILD | WS_VISIBLE, 56, 9, 255, 32, hwnd, NULL, hThisInstance, NULL);
|
||||||
|
|
||||||
// creating the scroll box
|
// creating the scroll box
|
||||||
hScrollbox = CreateWindowEx (WS_EX_CLIENTEDGE, "Scrollbox", "", WS_CHILD | WS_GROUP | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE, 56, 49, 472, 248, hwnd, NULL, hThisInstance, NULL);
|
hScrollbox = CreateWindowEx (WS_EX_CLIENTEDGE, _T("Scrollbox"), _T(""), WS_CHILD | WS_GROUP | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE, 56, 49, 472, 248, hwnd, NULL, hThisInstance, NULL);
|
||||||
|
|
||||||
// creating the status bar
|
// creating the status bar
|
||||||
hStatusBar = CreateWindowEx (0, STATUSCLASSNAME, "", SBARS_SIZEGRIP | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd, NULL, hThisInstance, NULL);
|
hStatusBar = CreateWindowEx (0, STATUSCLASSNAME, _T(""), SBARS_SIZEGRIP | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd, NULL, hThisInstance, NULL);
|
||||||
SendMessage(hStatusBar, SB_SETMINHEIGHT, 21, 0);
|
SendMessage(hStatusBar, SB_SETMINHEIGHT, 21, 0);
|
||||||
|
|
||||||
hScrlClient = CreateWindowEx(0, "Scrollbox", "", WS_CHILD | WS_VISIBLE, 0, 0, 500, 500, hScrollbox, NULL, hThisInstance, NULL);
|
hScrlClient = CreateWindowEx(0, _T("Scrollbox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 500, 500, hScrollbox, NULL, hThisInstance, NULL);
|
||||||
|
|
||||||
// create selection window (initially hidden)
|
// create selection window (initially hidden)
|
||||||
hSelection = CreateWindowEx(WS_EX_TRANSPARENT, "Selection", "", WS_CHILD | BS_OWNERDRAW, 350, 0, 100, 100, hScrlClient, NULL, hThisInstance, NULL);
|
hSelection = CreateWindowEx(WS_EX_TRANSPARENT, _T("Selection"), _T(""), WS_CHILD | BS_OWNERDRAW, 350, 0, 100, 100, hScrlClient, NULL, hThisInstance, NULL);
|
||||||
|
|
||||||
// creating the window inside the scroll box, on which the image in hDrawingDC's bitmap is drawn
|
// creating the window inside the scroll box, on which the image in hDrawingDC's bitmap is drawn
|
||||||
hImageArea = CreateWindowEx (0, "Scrollbox", "", WS_CHILD | WS_VISIBLE, 3, 3, imgXRes, imgYRes, hScrlClient, NULL, hThisInstance, NULL);
|
hImageArea = CreateWindowEx (0, _T("Scrollbox"), _T(""), WS_CHILD | WS_VISIBLE, 3, 3, imgXRes, imgYRes, hScrlClient, NULL, hThisInstance, NULL);
|
||||||
|
|
||||||
hDrawingDC = CreateCompatibleDC(GetDC(hImageArea));
|
hDrawingDC = CreateCompatibleDC(GetDC(hImageArea));
|
||||||
hSelDC = CreateCompatibleDC(GetDC(hImageArea));
|
hSelDC = CreateCompatibleDC(GetDC(hImageArea));
|
||||||
|
@ -299,41 +300,41 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||||
choosecolor.lpfnHook = NULL;
|
choosecolor.lpfnHook = NULL;
|
||||||
choosecolor.lpTemplateName = NULL;
|
choosecolor.lpTemplateName = NULL;
|
||||||
|
|
||||||
char *c;
|
TCHAR *c;
|
||||||
|
|
||||||
// initializing the OPENFILENAME structure for use with GetOpenFileName and GetSaveFileName
|
// initializing the OPENFILENAME structure for use with GetOpenFileName and GetSaveFileName
|
||||||
char ofnFilename[1000];
|
TCHAR ofnFilename[1000];
|
||||||
CopyMemory(ofnFilename, filename, sizeof(filename));
|
CopyMemory(ofnFilename, filename, sizeof(filename));
|
||||||
char ofnFiletitle[256];
|
TCHAR ofnFiletitle[256];
|
||||||
char ofnFilter[1000];
|
TCHAR ofnFilter[1000];
|
||||||
LoadString(hThisInstance, IDS_OPENFILTER, (LPTSTR)ofnFilter, sizeof(ofnFilter));
|
LoadString(hThisInstance, IDS_OPENFILTER, ofnFilter, SIZEOF(ofnFilter));
|
||||||
for (c = ofnFilter; *c; c++) if (*c == '\1') *c = '\0';
|
for (c = ofnFilter; *c; c++) if (*c == '\1') *c = '\0';
|
||||||
ZeroMemory(&ofn, sizeof(OPENFILENAME));
|
ZeroMemory(&ofn, sizeof(OPENFILENAME));
|
||||||
ofn.lStructSize = sizeof (OPENFILENAME);
|
ofn.lStructSize = sizeof (OPENFILENAME);
|
||||||
ofn.hwndOwner = hwnd;
|
ofn.hwndOwner = hwnd;
|
||||||
ofn.hInstance = hThisInstance;
|
ofn.hInstance = hThisInstance;
|
||||||
ofn.lpstrFilter = (LPCTSTR)ofnFilter;
|
ofn.lpstrFilter = ofnFilter;
|
||||||
ofn.lpstrFile = (LPTSTR)ofnFilename;
|
ofn.lpstrFile = ofnFilename;
|
||||||
ofn.nMaxFile = sizeof(ofnFilename);
|
ofn.nMaxFile = SIZEOF(ofnFilename);
|
||||||
ofn.lpstrFileTitle = (LPTSTR)ofnFiletitle;
|
ofn.lpstrFileTitle = ofnFiletitle;
|
||||||
ofn.nMaxFileTitle = sizeof(ofnFiletitle);
|
ofn.nMaxFileTitle = SIZEOF(ofnFiletitle);
|
||||||
ofn.Flags = OFN_HIDEREADONLY;
|
ofn.Flags = OFN_HIDEREADONLY;
|
||||||
|
|
||||||
char sfnFilename[1000];
|
TCHAR sfnFilename[1000];
|
||||||
CopyMemory(sfnFilename, filename, sizeof(filename));
|
CopyMemory(sfnFilename, filename, sizeof(filename));
|
||||||
char sfnFiletitle[256];
|
TCHAR sfnFiletitle[256];
|
||||||
char sfnFilter[1000];
|
TCHAR sfnFilter[1000];
|
||||||
LoadString(hThisInstance, IDS_SAVEFILTER, (LPTSTR)sfnFilter, sizeof(sfnFilter));
|
LoadString(hThisInstance, IDS_SAVEFILTER, sfnFilter, SIZEOF(sfnFilter));
|
||||||
for (c = sfnFilter; *c; c++) if (*c == '\1') *c = '\0';
|
for (c = sfnFilter; *c; c++) if (*c == '\1') *c = '\0';
|
||||||
ZeroMemory(&sfn, sizeof(OPENFILENAME));
|
ZeroMemory(&sfn, sizeof(OPENFILENAME));
|
||||||
sfn.lStructSize = sizeof (OPENFILENAME);
|
sfn.lStructSize = sizeof (OPENFILENAME);
|
||||||
sfn.hwndOwner = hwnd;
|
sfn.hwndOwner = hwnd;
|
||||||
sfn.hInstance = hThisInstance;
|
sfn.hInstance = hThisInstance;
|
||||||
sfn.lpstrFilter = (LPCTSTR)sfnFilter;
|
sfn.lpstrFilter = sfnFilter;
|
||||||
sfn.lpstrFile = (LPTSTR)sfnFilename;
|
sfn.lpstrFile = sfnFilename;
|
||||||
sfn.nMaxFile = sizeof(sfnFilename);
|
sfn.nMaxFile = SIZEOF(sfnFilename);
|
||||||
sfn.lpstrFileTitle = (LPTSTR)sfnFiletitle;
|
sfn.lpstrFileTitle = sfnFiletitle;
|
||||||
sfn.nMaxFileTitle = sizeof(sfnFiletitle);
|
sfn.nMaxFileTitle = SIZEOF(sfnFiletitle);
|
||||||
sfn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
|
sfn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||||
<module name="paint" type="win32gui" installbase="system32" installname="paint.exe" allowwarnings="true">
|
<module name="paint" type="win32gui" installbase="system32" installname="paint.exe" unicode="yes" allowwarnings="true">
|
||||||
<include base="paint">.</include>
|
<include base="paint">.</include>
|
||||||
<library>comdlg32</library>
|
<library>comdlg32</library>
|
||||||
<library>shell32</library>
|
<library>shell32</library>
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
//#include <htmlhelp.h>
|
//#include <htmlhelp.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <tchar.h>
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
#include "globalvar.h"
|
#include "globalvar.h"
|
||||||
#include "dialogs.h"
|
#include "dialogs.h"
|
||||||
|
@ -60,13 +61,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
if (undoSteps>0)
|
if (undoSteps>0)
|
||||||
{
|
{
|
||||||
char programname[20];
|
TCHAR programname[20];
|
||||||
char saveprompttext[100];
|
TCHAR saveprompttext[100];
|
||||||
LoadString(hProgInstance, IDS_PROGRAMNAME, (LPTSTR)programname, sizeof(programname));
|
LoadString(hProgInstance, IDS_PROGRAMNAME, programname, SIZEOF(programname));
|
||||||
LoadString(hProgInstance, IDS_SAVEPROMPTTEXT, (LPTSTR)saveprompttext, sizeof(saveprompttext));
|
LoadString(hProgInstance, IDS_SAVEPROMPTTEXT, saveprompttext, SIZEOF(saveprompttext));
|
||||||
char temptext[500];
|
TCHAR temptext[500];
|
||||||
sprintf(temptext, saveprompttext, filename);
|
_stprintf(temptext, saveprompttext, filename);
|
||||||
switch (MessageBox(hwnd, (LPTSTR)temptext, (LPTSTR)programname, MB_YESNOCANCEL | MB_ICONQUESTION))
|
switch (MessageBox(hwnd, temptext, programname, MB_YESNOCANCEL | MB_ICONQUESTION))
|
||||||
{
|
{
|
||||||
case IDNO:
|
case IDNO:
|
||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
|
@ -319,8 +320,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
{
|
{
|
||||||
if ((!drawing)||(activeTool<=9))
|
if ((!drawing)||(activeTool<=9))
|
||||||
{
|
{
|
||||||
char coordStr[100];
|
TCHAR coordStr[100];
|
||||||
sprintf(coordStr, "%d, %d", (short)LOWORD(lParam)*1000/zoom, (short)HIWORD(lParam)*1000/zoom);
|
_stprintf(coordStr, _T("%d, %d"), (short)LOWORD(lParam)*1000/zoom, (short)HIWORD(lParam)*1000/zoom);
|
||||||
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM)coordStr);
|
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM)coordStr);
|
||||||
}
|
}
|
||||||
if (drawing)
|
if (drawing)
|
||||||
|
@ -331,8 +332,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
||||||
if ((activeTool>=10)||(activeTool==2))
|
if ((activeTool>=10)||(activeTool==2))
|
||||||
{
|
{
|
||||||
char sizeStr[100];
|
TCHAR sizeStr[100];
|
||||||
sprintf(sizeStr, "%d x %d", (short)LOWORD(lParam)*1000/zoom-startX, (short)HIWORD(lParam)*1000/zoom-startY);
|
_stprintf(sizeStr, _T("%d x %d"), (short)LOWORD(lParam)*1000/zoom-startX, (short)HIWORD(lParam)*1000/zoom-startY);
|
||||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)sizeStr);
|
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)sizeStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,15 +343,15 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
||||||
if (activeTool>=10)
|
if (activeTool>=10)
|
||||||
{
|
{
|
||||||
char sizeStr[100];
|
TCHAR sizeStr[100];
|
||||||
sprintf(sizeStr, "%d x %d", (short)LOWORD(lParam)*1000/zoom-startX, (short)HIWORD(lParam)*1000/zoom-startY);
|
_stprintf(sizeStr, _T("%d x %d"), (short)LOWORD(lParam)*1000/zoom-startX, (short)HIWORD(lParam)*1000/zoom-startY);
|
||||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)sizeStr);
|
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)sizeStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM)"");
|
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM)_T(""));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -362,11 +363,11 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
case IDM_HELPINFO:
|
case IDM_HELPINFO:
|
||||||
{
|
{
|
||||||
HICON paintIcon = LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON));
|
HICON paintIcon = LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON));
|
||||||
char infotitle[100];
|
TCHAR infotitle[100];
|
||||||
char infotext[200];
|
TCHAR infotext[200];
|
||||||
LoadString(hProgInstance, IDS_INFOTITLE, (LPTSTR)infotitle, sizeof(infotitle));
|
LoadString(hProgInstance, IDS_INFOTITLE, infotitle, SIZEOF(infotitle));
|
||||||
LoadString(hProgInstance, IDS_INFOTEXT, (LPTSTR)infotext, sizeof(infotext));
|
LoadString(hProgInstance, IDS_INFOTEXT, infotext, SIZEOF(infotext));
|
||||||
ShellAbout(hMainWnd, (LPTSTR)infotitle, (LPTSTR)infotext, paintIcon);
|
ShellAbout(hMainWnd, infotitle, infotext, paintIcon);
|
||||||
DeleteObject(paintIcon);
|
DeleteObject(paintIcon);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -388,12 +389,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
{
|
{
|
||||||
insertReversible(bmNew);
|
insertReversible(bmNew);
|
||||||
updateCanvasAndScrollbars();
|
updateCanvasAndScrollbars();
|
||||||
char tempstr[1000];
|
TCHAR tempstr[1000];
|
||||||
char resstr[100];
|
TCHAR resstr[100];
|
||||||
CopyMemory(filename, ofn.lpstrFileTitle, sizeof(filename));
|
CopyMemory(filename, ofn.lpstrFileTitle, sizeof(filename));
|
||||||
CopyMemory(filepathname, ofn.lpstrFileTitle, sizeof(filepathname));
|
CopyMemory(filepathname, ofn.lpstrFileTitle, sizeof(filepathname));
|
||||||
LoadString(hProgInstance, IDS_WINDOWTITLE, (LPTSTR)resstr, sizeof(resstr));
|
LoadString(hProgInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
|
||||||
sprintf(tempstr, resstr, filename);
|
_stprintf(tempstr, resstr, filename);
|
||||||
SetWindowText(hMainWnd, tempstr);
|
SetWindowText(hMainWnd, tempstr);
|
||||||
clearHistory();
|
clearHistory();
|
||||||
isAFile = TRUE;
|
isAFile = TRUE;
|
||||||
|
@ -410,12 +411,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
if (GetSaveFileName(&sfn)!=0)
|
if (GetSaveFileName(&sfn)!=0)
|
||||||
{
|
{
|
||||||
SaveDIBToFile(hBms[currInd], sfn.lpstrFile, hDrawingDC);
|
SaveDIBToFile(hBms[currInd], sfn.lpstrFile, hDrawingDC);
|
||||||
char tempstr[1000];
|
TCHAR tempstr[1000];
|
||||||
char resstr[100];
|
TCHAR resstr[100];
|
||||||
CopyMemory(filename, sfn.lpstrFileTitle, sizeof(filename));
|
CopyMemory(filename, sfn.lpstrFileTitle, sizeof(filename));
|
||||||
CopyMemory(filepathname, sfn.lpstrFileTitle, sizeof(filepathname));
|
CopyMemory(filepathname, sfn.lpstrFileTitle, sizeof(filepathname));
|
||||||
LoadString(hProgInstance, IDS_WINDOWTITLE, (LPTSTR)resstr, sizeof(resstr));
|
LoadString(hProgInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
|
||||||
sprintf(tempstr, resstr, filename);
|
_stprintf(tempstr, resstr, filename);
|
||||||
SetWindowText(hMainWnd, tempstr);
|
SetWindowText(hMainWnd, tempstr);
|
||||||
isAFile = TRUE;
|
isAFile = TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue