mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 19:26:32 +00:00
basic dialog for setting canvas properties.
svn path=/trunk/; revision=21238
This commit is contained in:
@@ -77,18 +77,44 @@ BEGIN
|
||||
END
|
||||
|
||||
|
||||
IDD_ABOUTBOX DIALOGEX 22,16,190,182
|
||||
IDD_ABOUTBOX DIALOGEX 22,16,210,182
|
||||
CAPTION "About ImageSoft"
|
||||
FONT 8,"Tahoma",0,0
|
||||
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
|
||||
//EXSTYLE WS_EX_LAYERED
|
||||
BEGIN
|
||||
LTEXT "ImageSoft v0.1\nCopyright (C) 2006\nby Ged Murphy ([email protected])", IDC_STATIC, 48, 7, 130, 26
|
||||
LTEXT "ImageSoft v0.1\nCopyright (C) 2006\nThomas Weidenmueller ([email protected])\nGed Murphy ([email protected])", IDC_STATIC, 48, 7, 150, 36
|
||||
PUSHBUTTON "Close", IDOK, 75, 162, 44, 15
|
||||
ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30
|
||||
EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
|
||||
EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
|
||||
END
|
||||
|
||||
|
||||
IDD_IMAGE_PROP DIALOGEX 6,6,194,107
|
||||
CAPTION "Image Properties"
|
||||
FONT 8,"MS Sans Serif",0,0
|
||||
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
|
||||
BEGIN
|
||||
CONTROL "", IDC_IMAGETYPE, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 50, 5, 76, 54
|
||||
EDITTEXT IDC_RES_EDIT, 50, 22, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||
EDITTEXT IDC_WIDTH_EDIT, 50, 38, 32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||
EDITTEXT IDC_HEIGHT_EDIT, 50, 55,32, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||
CONTROL "", IDC_UNIT, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 50, 72, 54, 50
|
||||
PUSHBUTTON "OK", IDOK, 134, 7, 54, 13
|
||||
PUSHBUTTON "Cancel", IDCANCEL, 134, 27, 54, 13
|
||||
LTEXT "Image type:", IDC_STATIC, 4, 7, 42, 9
|
||||
LTEXT "Resolution:", IDC_STATIC, 4, 24, 42, 9
|
||||
LTEXT "Width:", IDC_STATIC, 4, 40, 42, 9
|
||||
LTEXT "Height:", IDC_STATIC, 4, 57, 42, 9
|
||||
LTEXT "Unit:", IDC_STATIC, 4, 73, 42, 9
|
||||
LTEXT "Image size:", IDC_STATIC, 4, 92, 42, 9
|
||||
LTEXT "", IDC_RES_STAT, 86, 24, 40, 9
|
||||
LTEXT "", IDC_WIDTH_STAT, 86, 40, 40, 9
|
||||
LTEXT "", IDC_HEIGHT_STAT, 86, 57, 40, 9
|
||||
LTEXT "", IDC_MEMORY, 54, 92, 54, 9
|
||||
END
|
||||
|
||||
|
||||
/* floating toolbar */
|
||||
IDD_TOOLBAR DIALOGEX 1, 19, 32, 112
|
||||
STYLE WS_POPUP | WS_SYSMENU | WS_CAPTION | WS_VISIBLE
|
||||
@@ -116,12 +142,27 @@ BEGIN
|
||||
IDS_APPNAME "ImageSoft"
|
||||
IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA."
|
||||
IDS_READY " Ready."
|
||||
|
||||
|
||||
IDS_TOOLBAR_STANDARD "Standard"
|
||||
IDS_TOOLBAR_TEST "Test"
|
||||
IDS_IMAGE_NAME "Image %1!u!"
|
||||
END
|
||||
|
||||
/* imageprop.c */
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_IMAGE_MONOCHROME "Monochrome (1 bit)"
|
||||
IDS_IMAGE_GREYSCALE "Greyscale (8 bit)"
|
||||
IDS_IMAGE_PALETTE "Palette or 256 color (8 bit)"
|
||||
IDS_IMAGE_TRUECOLOR "True color (24 bit)"
|
||||
|
||||
IDS_UNIT_CM "Cm"
|
||||
IDS_UNIT_INCHES "Inches"
|
||||
IDS_UNIT_PIXELS "Pixels"
|
||||
IDS_UNIT_DOTSCM "Dots / Cm"
|
||||
IDS_UNIT_DPI "DPI"
|
||||
END
|
||||
|
||||
/* Tooltips */
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<library>comdlg32</library>
|
||||
<compilationunit name="unit.c">
|
||||
<file>about.c</file>
|
||||
<file>imageprop.c</file>
|
||||
<file>imagesoft.c</file>
|
||||
<file>imgedwnd.c</file>
|
||||
<file>mainwnd.c</file>
|
||||
|
||||
@@ -4,6 +4,7 @@ static const TCHAR szImageEditWndClass[] = TEXT("ImageSoftEditWndClass");
|
||||
|
||||
#define IMAGE_FRAME_SIZE 1
|
||||
|
||||
|
||||
static VOID
|
||||
EditWndUpdateScrollInfo(PEDIT_WND_INFO Info)
|
||||
{
|
||||
@@ -35,14 +36,37 @@ EditWndUpdateScrollInfo(PEDIT_WND_INFO Info)
|
||||
static BOOL
|
||||
InitEditWnd(PEDIT_WND_INFO Info)
|
||||
{
|
||||
HDC hDC;
|
||||
LONG cxBitmap, cyBitmap;
|
||||
|
||||
Info->Zoom = 100;
|
||||
|
||||
if (Info->OpenInfo != NULL)
|
||||
{
|
||||
/* set bitmap dimensions */
|
||||
cxBitmap = Info->OpenInfo->New.Width;
|
||||
cyBitmap = Info->OpenInfo->New.Height;
|
||||
|
||||
/* create bitmap */
|
||||
hDC = GetDC(Info->hSelf);
|
||||
Info->hBitmap = CreateCompatibleBitmap(hDC, cxBitmap, cyBitmap);
|
||||
Info->hDCMem = CreateCompatibleDC(hDC);
|
||||
ReleaseDC(Info->hSelf, hDC);
|
||||
|
||||
if (!Info->hBitmap)
|
||||
{
|
||||
DeleteDC(Info->hDCMem);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (Info->OpenInfo->CreateNew)
|
||||
{
|
||||
/* what is this for? Does Info->OpenInfo become obsolete? */
|
||||
Info->Width = Info->OpenInfo->New.Width;
|
||||
Info->Height = Info->OpenInfo->New.Height;
|
||||
|
||||
SelectObject(Info->hDCMem, Info->hBitmap);
|
||||
PatBlt(Info->hDCMem, 0, 0, cxBitmap, cxBitmap, WHITENESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -90,7 +114,7 @@ ImageEditWndRepaint(PEDIT_WND_INFO Info,
|
||||
HDC hDC,
|
||||
LPPAINTSTRUCT lpps)
|
||||
{
|
||||
/* FIXME */
|
||||
BitBlt(hDC, 0, 0, Info->Width, Info->Height, Info->hDCMem, 0, 0, SRCCOPY);
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK
|
||||
@@ -244,8 +268,8 @@ CreateImageEditWindow(struct _MAIN_WND_INFO *MainWnd,
|
||||
WS_HSCROLL | WS_VSCROLL,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
OpenInfo->New.Width,
|
||||
OpenInfo->New.Height,
|
||||
MainWnd->hMdiClient,
|
||||
hInstance,
|
||||
(LPARAM)Info);
|
||||
@@ -275,8 +299,8 @@ InitImageEditWindowImpl(VOID)
|
||||
wc.hIcon = LoadIcon(hInstance,
|
||||
MAKEINTRESOURCE(IDI_ICON));
|
||||
wc.hCursor = LoadCursor(NULL,
|
||||
IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
||||
IDC_CROSS);
|
||||
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
|
||||
wc.lpszClassName = szImageEditWndClass;
|
||||
wc.hIconSm = (HICON)LoadImage(hInstance,
|
||||
MAKEINTRESOURCE(IDI_ICON),
|
||||
|
||||
@@ -462,6 +462,7 @@ MainWndCommand(PMAIN_WND_INFO Info,
|
||||
case ID_NEW:
|
||||
{
|
||||
OPEN_IMAGE_EDIT_INFO OpenInfo;
|
||||
PIMAGE_PROP ImageProp = NULL;
|
||||
LPTSTR lpCaption = NULL;
|
||||
|
||||
LoadAndFormatString(hInstance,
|
||||
@@ -469,13 +470,27 @@ MainWndCommand(PMAIN_WND_INFO Info,
|
||||
&lpCaption,
|
||||
++Info->ImagesCreated);
|
||||
|
||||
OpenInfo.CreateNew = TRUE;
|
||||
OpenInfo.New.Width = 400;
|
||||
OpenInfo.New.Height = 300;
|
||||
ImageProp = (PIMAGE_PROP)DialogBox(hInstance,
|
||||
MAKEINTRESOURCE(IDD_IMAGE_PROP),
|
||||
Info->hSelf,
|
||||
ImagePropDialogProc);
|
||||
|
||||
CreateImageEditWindow(Info,
|
||||
lpCaption,
|
||||
&OpenInfo);
|
||||
if (ImageProp != 0)
|
||||
{
|
||||
OpenInfo.CreateNew = TRUE;
|
||||
OpenInfo.Type = ImageProp->Type;
|
||||
OpenInfo.Resolution = ImageProp->Resolution;
|
||||
OpenInfo.New.Width = ImageProp->Width;
|
||||
OpenInfo.New.Height = ImageProp->Height;
|
||||
|
||||
HeapFree(ProcessHeap,
|
||||
0,
|
||||
ImageProp);
|
||||
|
||||
CreateImageEditWindow(Info,
|
||||
lpCaption,
|
||||
&OpenInfo);
|
||||
}
|
||||
|
||||
if (lpCaption != NULL)
|
||||
LocalFree((HLOCAL)lpCaption);
|
||||
|
||||
@@ -39,11 +39,50 @@ INT_PTR CALLBACK AboutDialogProc(HWND hDlg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
|
||||
/* imageprop.c */
|
||||
typedef struct _IMAGE_PROP
|
||||
{
|
||||
/* Canvas properties */
|
||||
USHORT Type;
|
||||
LONG Resolution;
|
||||
/* size of drawing area */
|
||||
LONG Width;
|
||||
LONG Height;
|
||||
} IMAGE_PROP, *PIMAGE_PROP;
|
||||
|
||||
INT_PTR CALLBACK
|
||||
ImagePropDialogProc(HWND hDlg,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
|
||||
|
||||
/* imagesoft.c */
|
||||
extern HINSTANCE hInstance;
|
||||
extern HANDLE ProcessHeap;
|
||||
|
||||
/* imgedwnd.c */
|
||||
typedef enum
|
||||
{
|
||||
tSelect = 0,
|
||||
tMove,
|
||||
tLasso,
|
||||
tZoom,
|
||||
tMagicWand,
|
||||
tBrush,
|
||||
tEraser,
|
||||
tPencil,
|
||||
tColorPick,
|
||||
tStamp,
|
||||
tFill,
|
||||
tLine,
|
||||
tPolyline,
|
||||
tRectangle,
|
||||
tRoundRectangle,
|
||||
tPolygon,
|
||||
tElipse,
|
||||
} TOOL;
|
||||
|
||||
typedef struct _OPEN_IMAGE_EDIT_INFO
|
||||
{
|
||||
BOOL CreateNew;
|
||||
@@ -59,6 +98,8 @@ typedef struct _OPEN_IMAGE_EDIT_INFO
|
||||
LPCTSTR lpFileName;
|
||||
} Open;
|
||||
};
|
||||
USHORT Type;
|
||||
LONG Resolution;
|
||||
} OPEN_IMAGE_EDIT_INFO, *POPEN_IMAGE_EDIT_INFO;
|
||||
|
||||
typedef struct _EDIT_WND_INFO
|
||||
@@ -66,6 +107,8 @@ typedef struct _EDIT_WND_INFO
|
||||
MDI_EDITOR_TYPE MdiEditorType; /* Must be first member! */
|
||||
|
||||
HWND hSelf;
|
||||
HBITMAP hBitmap;
|
||||
HDC hDCMem;
|
||||
struct _MAIN_WND_INFO *MainWnd;
|
||||
struct _EDIT_WND_INFO *Next;
|
||||
POINT ScrollPos;
|
||||
@@ -73,11 +116,16 @@ typedef struct _EDIT_WND_INFO
|
||||
|
||||
POPEN_IMAGE_EDIT_INFO OpenInfo; /* Only valid during initialization */
|
||||
|
||||
/* Bitmap size */
|
||||
/* Canvas properties */
|
||||
USHORT Type;
|
||||
LONG Resolution;
|
||||
/* size of drawing area */
|
||||
LONG Width;
|
||||
LONG Height;
|
||||
|
||||
} EDIT_WND_INFO, *PEDIT_WND_INFO;
|
||||
|
||||
|
||||
BOOL CreateImageEditWindow(struct _MAIN_WND_INFO *MainWnd,
|
||||
LPCTSTR lpCaption,
|
||||
POPEN_IMAGE_EDIT_INFO OpenInfo);
|
||||
|
||||
@@ -94,3 +94,27 @@
|
||||
#define IDS_HINT_SYS_MAXIMIZE 21005
|
||||
#define IDS_HINT_SYS_CLOSE 21006
|
||||
#define IDS_HINT_SYS_NEXT 21007
|
||||
|
||||
|
||||
|
||||
|
||||
/* image property dialog */
|
||||
#define IDD_IMAGE_PROP 4000
|
||||
#define IDC_IMAGETYPE 4001
|
||||
#define IDC_RES_EDIT 4002
|
||||
#define IDC_WIDTH_EDIT 4003
|
||||
#define IDC_HEIGHT_EDIT 4004
|
||||
#define IDC_UNIT 4005
|
||||
#define IDC_RES_STAT 4006
|
||||
#define IDC_WIDTH_STAT 4007
|
||||
#define IDC_HEIGHT_STAT 4008
|
||||
#define IDC_MEMORY 4009
|
||||
#define IDS_IMAGE_MONOCHROME 4100
|
||||
#define IDS_IMAGE_GREYSCALE 4101
|
||||
#define IDS_IMAGE_PALETTE 4102
|
||||
#define IDS_IMAGE_TRUECOLOR 4103
|
||||
#define IDS_UNIT_CM 4104
|
||||
#define IDS_UNIT_INCHES 4105
|
||||
#define IDS_UNIT_PIXELS 4106
|
||||
#define IDS_UNIT_DOTSCM 4107
|
||||
#define IDS_UNIT_DPI 4108
|
||||
|
||||
Reference in New Issue
Block a user