- split the main header file into seperate files as it was becoming annoying to maintain

- split the open / new file code
- Add a dialog for adjusting the brightness. The code for adjusting the brightness will follow soon, as will many other image adjusting dialogs.
- change the menus to show the image adjustment tools which will be present
- remove the horrible image property dialog code. I'll rewrite it at a later stage
- Set Arial as the default font
- fix a few API's to be 64-bit compatable
- reduce msvc warnings

svn path=/trunk/; revision=24761
This commit is contained in:
Ged Murphy 2006-11-14 23:15:02 +00:00
parent 3047ba1df7
commit 6e572dc57a
16 changed files with 668 additions and 815 deletions

View file

@ -201,13 +201,13 @@ VOID MakeFlatCombo(HWND hwndCombo)
LONG OldComboProc;
/* Remember old window procedure */
OldComboProc = GetWindowLong(hwndCombo, GWL_WNDPROC);
SetWindowLong(hwndCombo,
OldComboProc = GetWindowLongPtr(hwndCombo, GWL_WNDPROC);
SetWindowLongPtr(hwndCombo,
GWL_USERDATA,
OldComboProc);
/* Perform the subclass */
OldComboProc = SetWindowLong(hwndCombo,
SetWindowLongPtr(hwndCombo,
GWL_WNDPROC,
(LONG)FlatComboProc);
(LONG_PTR)FlatComboProc);
}

View file

@ -365,9 +365,9 @@ FloatToolbarWndProc(HWND hwnd,
FltInfo->bOpaque = FALSE;
SetWindowLong(hwnd,
SetWindowLongPtr(hwnd,
GWL_EXSTYLE,
GetWindowLong(hwnd,
GetWindowLongPtr(hwnd,
GWL_EXSTYLE) | WS_EX_LAYERED);
/* set the tranclucency to 60% */
@ -404,9 +404,9 @@ FloatToolbarWndProc(HWND hwnd,
FltInfo->bOpaque = FALSE;
SetWindowLong(hwnd,
SetWindowLongPtr(hwnd,
GWL_EXSTYLE,
GetWindowLong(hwnd,
GetWindowLongPtr(hwnd,
GWL_EXSTYLE) | WS_EX_LAYERED);
/* set the tranclucency to 60% */
@ -426,9 +426,9 @@ FloatToolbarWndProc(HWND hwnd,
{
if (FltInfo->bOpaque == FALSE)
{
SetWindowLong(hwnd,
SetWindowLongPtr(hwnd,
GWL_EXSTYLE,
GetWindowLong(hwnd,
GetWindowLongPtr(hwnd,
GWL_EXSTYLE) & ~WS_EX_LAYERED);
RedrawWindow(hwnd,

View file

@ -1,6 +1,5 @@
#include <precomp.h>
int CALLBACK
EnumFontSizes(ENUMLOGFONTEX *lpelfe,
NEWTEXTMETRICEX *lpntme,
@ -20,8 +19,16 @@ EnumFontSizes(ENUMLOGFONTEX *lpelfe,
for (i = 0; i < (sizeof(ttsizes) / sizeof(ttsizes[0])); i++)
{
wsprintf(ach, _T("%d"), ttsizes[i]);
idx = (INT)SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)ach);
SendMessage(hwndCombo, CB_SETITEMDATA, idx, ttsizes[i]);
idx = (INT)SendMessage(hwndCombo,
CB_ADDSTRING,
0,
(LPARAM)ach);
SendMessage(hwndCombo,
CB_SETITEMDATA,
idx,
ttsizes[i]);
}
return 0;
}
@ -92,25 +99,42 @@ FillFontSizeComboList(HWND hwndCombo)
lf.lfPitchAndFamily = 0;
/* empty the list */
SendMessage(hwndCombo, CB_RESETCONTENT, 0, 0);
SendMessage(hwndCombo,
CB_RESETCONTENT,
0,
0);
/* enumerate font sizes */
EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontSizes, (LONG)hwndCombo, 0);
EnumFontFamiliesEx(hdc,
&lf,
(FONTENUMPROC)EnumFontSizes,
(LPARAM)hwndCombo,
0);
/* set selection to first item */
count = (INT)SendMessage(hwndCombo, CB_GETCOUNT, 0, 0);
count = (INT)SendMessage(hwndCombo,
CB_GETCOUNT,
0,
0);
for(i = 0; i < count; i++)
{
INT n = (INT)SendMessage(hwndCombo, CB_GETITEMDATA, i, 0);
INT n = (INT)SendMessage(hwndCombo,
CB_GETITEMDATA,
i,
0);
if (n <= cursize)
nearest = i;
}
SendMessage(hwndCombo, CB_SETCURSEL, nearest, 0);
SendMessage(hwndCombo,
CB_SETCURSEL,
nearest,
0);
ReleaseDC(hwndCombo, hdc);
ReleaseDC(hwndCombo,
hdc);
}
@ -144,8 +168,11 @@ FillFontStyleComboList(HWND hwndCombo)
ReleaseDC(hwndCombo,
hdc);
/* set default to Arial */
SendMessage(hwndCombo,
CB_SETCURSEL,
0,
0);
CB_SELECTSTRING,
-1,
(LPARAM)_T("Arial"));
}

View file

@ -1,261 +1,112 @@
#include <precomp.h>
static HWND hImageType, hUnitType, hHeightUnit, hWidthUnit, hResUnit;
UINT ConvertValue(HWND hDlg, UINT EdBoxChanged, UINT LastUnitSel)
{
LONG Resolution = GetDlgItemInt(hDlg, IDC_RES_EDIT, NULL, FALSE);
FLOAT Width = (FLOAT)GetDlgItemInt(hDlg, IDC_WIDTH_EDIT, NULL, FALSE);
FLOAT Height = (FLOAT)GetDlgItemInt(hDlg, IDC_HEIGHT_EDIT, NULL, FALSE);
USHORT CurUnit = (USHORT)SendMessage(hUnitType, CB_GETCURSEL, 0, 0);
/* if the user typed in the resolution box */
if ((EdBoxChanged == IDC_RES_EDIT) && (CurUnit != PIXELS))
{
Width = Width / Resolution * 100;
Height = Height / Resolution * 100;
/* something wrong with these */
SetDlgItemInt(hDlg, IDC_WIDTH_EDIT, Width, TRUE);
SetDlgItemInt(hDlg, IDC_HEIGHT_EDIT, Height, FALSE);
return LastUnitSel;
}
/* if the user changed the unit combobox */
if (EdBoxChanged == IDC_UNIT)
{
switch(LastUnitSel)
{
case PIXELS:
if (CurUnit == CENTIMETERS)
;
else if (CurUnit == INCHES)
;
break;
case CENTIMETERS:
if (CurUnit == PIXELS)
;
else if (CurUnit == INCHES)
{
Width /= 2.54;
Height /= 2.54;
Resolution *= 2.54;
SetDlgItemInt(hDlg, IDC_WIDTH_EDIT, Width, FALSE);
SetDlgItemInt(hDlg, IDC_HEIGHT_EDIT, Height, FALSE);
SetDlgItemInt(hDlg, IDC_RES_EDIT, Resolution, FALSE);
}
break;
case INCHES:
if (CurUnit == PIXELS)
;
else if (CurUnit == CENTIMETERS)
{
Width *= 2.54;
Height *= 2.54;
Resolution /= 2.54;
SetDlgItemInt(hDlg, IDC_WIDTH_EDIT, Width, FALSE);
SetDlgItemInt(hDlg, IDC_HEIGHT_EDIT, Height, FALSE);
SetDlgItemInt(hDlg, IDC_RES_EDIT, Resolution, FALSE);
}
break;
}
}
return CurUnit;
}
VOID SetImageSize(HWND hDlg)
{
DWORD Size;
USHORT Type = 0;
TCHAR buf[20];
TCHAR SizeUnit[25];
FLOAT Width = GetDlgItemInt(hDlg, IDC_WIDTH_EDIT, NULL, FALSE);
FLOAT Height = GetDlgItemInt(hDlg, IDC_HEIGHT_EDIT, NULL, FALSE);
USHORT sel = SendMessage(hImageType, CB_GETCURSEL, 0, 0);
if (sel == 0)
Type = MONOCHROMEBITS;
else if (sel == 1)
Type = GREYSCALEBITS;
else if (sel == 2)
Type = PALLETEBITS;
else if (sel == 3)
Type = TRUECOLORBITS;
Size = ((Width * Height * Type) / 8) / 1024;
if (Size > 1000)
{
Size /= 1024;
LoadString(hInstance, IDS_UNIT_MB, SizeUnit, sizeof(SizeUnit) / sizeof(TCHAR));
}
else
LoadString(hInstance, IDS_UNIT_KB, SizeUnit, sizeof(SizeUnit) / sizeof(TCHAR));
_sntprintf(buf, sizeof(buf) / sizeof(TCHAR), SizeUnit, Size);
SendDlgItemMessage(hDlg, IDC_IMAGE_SIZE, WM_SETTEXT, 0, (LPARAM)buf);
}
INT_PTR CALLBACK
ImagePropDialogProc(HWND hDlg,
BrightnessProc(HWND hDlg,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
static PIMAGE_PROP ImageProp = NULL;
static UINT LastUnitSel;
TCHAR buf[35];
static PMAIN_WND_INFO Info = NULL;
switch (message)
{
case WM_INITDIALOG:
ImageProp = (PIMAGE_PROP)lParam;
/* get handles to the windows */
hImageType = GetDlgItem(hDlg, IDC_IMAGETYPE);
hUnitType = GetDlgItem(hDlg, IDC_UNIT);
hWidthUnit = GetDlgItem(hDlg, IDC_WIDTH_STAT);
hHeightUnit = GetDlgItem(hDlg, IDC_HEIGHT_STAT);
hResUnit = GetDlgItem(hDlg, IDC_RES_STAT);
/* fill image type combo box */
LoadString(hInstance, IDS_IMAGE_MONOCHROME, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hImageType, CB_ADDSTRING, 0, (LPARAM)buf);
LoadString(hInstance, IDS_IMAGE_GREYSCALE, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hImageType, CB_ADDSTRING, 0, (LPARAM)buf);
LoadString(hInstance, IDS_IMAGE_PALETTE, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hImageType, CB_ADDSTRING, 0, (LPARAM)buf);
LoadString(hInstance, IDS_IMAGE_TRUECOLOR, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hImageType, CB_ADDSTRING, 0, (LPARAM)buf);
/* default 24bit */
SendMessage(hImageType, CB_SETCURSEL, 3, 0);
/* fill unit combo box */
LoadString(hInstance, IDS_UNIT_PIXELS, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hUnitType, CB_ADDSTRING, 0, (LPARAM)buf);
LoadString(hInstance, IDS_UNIT_CM, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hUnitType, CB_ADDSTRING, 0, (LPARAM)buf);
LoadString(hInstance, IDS_UNIT_INCHES, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hUnitType, CB_ADDSTRING, 0, (LPARAM)buf);
/* default pixels */
SendMessage(hUnitType, CB_SETCURSEL, 0, 0);
/* default pixels */
LoadString(hInstance, IDS_UNIT_PIXELS, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hWidthUnit, WM_SETTEXT, 0, (LPARAM)buf);
SendMessage(hHeightUnit, WM_SETTEXT, 0, (LPARAM)buf);
LoadString(hInstance, IDS_UNIT_DPI, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hResUnit, WM_SETTEXT, 0, (LPARAM)buf);
LastUnitSel = PIXELS;
/* temperary. Default vals should be loaded from registry */
SendDlgItemMessage(hDlg, IDC_WIDTH_EDIT, WM_SETTEXT, 0, (LPARAM)_T("400"));
SendDlgItemMessage(hDlg, IDC_HEIGHT_EDIT, WM_SETTEXT, 0, (LPARAM)_T("300"));
SendDlgItemMessage(hDlg, IDC_RES_EDIT, WM_SETTEXT, 0, (LPARAM)_T("50"));
SetImageSize(hDlg);
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
Info = (PMAIN_WND_INFO)lParam;
SendDlgItemMessage(hDlg,
IDC_BRI_FULL,
BM_SETCHECK,
BST_CHECKED,
0);
SendDlgItemMessage(hDlg,
IDC_BRI_TRACKBAR,
TBM_SETRANGE,
TRUE,
(LPARAM)MAKELONG(0, 200));
SendDlgItemMessage(hDlg,
IDC_BRI_TRACKBAR,
TBM_SETPOS,
TRUE,
(LPARAM)100);
SetDlgItemText(hDlg,
IDC_BRI_EDIT,
_T("100"));
return TRUE;
}
case WM_DRAWITEM:
{
/* FIXME: default vals should be taken from registry */
LPDRAWITEMSTRUCT lpDrawItem;
HWND hPicPrev = GetDlgItem(hDlg, IDC_PICPREVIEW);
RECT ImageRect = {0};
HDC hdcMem;
INT Ret = GetTextFromEdit(ImageProp->lpImageName, hDlg, IDC_IMAGE_NAME_EDIT);
if (Ret == 0)
ImageProp->lpImageName = NULL;
lpDrawItem = (LPDRAWITEMSTRUCT)lParam;
ImageProp->Type = SendMessage(hImageType, CB_GETCURSEL, 0, 0);
ImageProp->Resolution = GetDlgItemInt(hDlg, IDC_RES_EDIT, NULL, FALSE);
ImageProp->Width = GetDlgItemInt(hDlg, IDC_WIDTH_EDIT, NULL, FALSE);
ImageProp->Height = GetDlgItemInt(hDlg, IDC_HEIGHT_EDIT, NULL, FALSE);
ImageProp->Unit = SendMessage(hUnitType, CB_GETCURSEL, 0, 0);
GetClientRect(hPicPrev,
&ImageRect);
EndDialog(hDlg, 1);
}
break;
hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
case IDCANCEL:
ImageProp = NULL;
EndDialog(hDlg, 0);
break;
case IDC_UNIT:
if (HIWORD(wParam) == CBN_SELCHANGE)
if(lpDrawItem->CtlID == IDC_PICPREVIEW)
{
INT unit = SendMessage(hUnitType, CB_GETCURSEL, 0, 0);
SelectObject(hdcMem,
Info->ImageEditors->hBitmap);
LastUnitSel = ConvertValue(hDlg, IDC_UNIT, LastUnitSel);
StretchBlt(lpDrawItem->hDC,
ImageRect.left,
ImageRect.top,
ImageRect.right,
ImageRect.bottom,
hdcMem,
0,
0,
Info->ImageEditors->Width,
Info->ImageEditors->Height,
SRCCOPY);
switch (unit)
DeleteDC(hdcMem);
}
return TRUE;
}
case WM_HSCROLL:
{
case 0: /* pixels */
if (LOWORD(wParam) == TB_THUMBTRACK ||
LOWORD(wParam) == TB_ENDTRACK)
{
LoadString(hInstance, IDS_UNIT_PIXELS, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hWidthUnit, WM_SETTEXT, 0, (LPARAM)buf);
SendMessage(hHeightUnit, WM_SETTEXT, 0, (LPARAM)buf);
LoadString(hInstance, IDS_UNIT_DPI, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hResUnit, WM_SETTEXT, 0, (LPARAM)buf);
}
break;
case 1:
/* cm */
LoadString(hInstance, IDS_UNIT_CM, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hWidthUnit, WM_SETTEXT, 0, (LPARAM)buf);
SendMessage(hHeightUnit, WM_SETTEXT, 0, (LPARAM)buf);
LoadString(hInstance, IDS_UNIT_DOTSCM, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hResUnit, WM_SETTEXT, 0, (LPARAM)buf);
break;
case 2:
/* inch */
LoadString(hInstance, IDS_UNIT_INCHES, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hWidthUnit, WM_SETTEXT, 0, (LPARAM)buf);
SendMessage(hHeightUnit, WM_SETTEXT, 0, (LPARAM)buf);
LoadString(hInstance, IDS_UNIT_DPI, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hResUnit, WM_SETTEXT, 0, (LPARAM)buf);
break;
}
}
break;
case IDC_IMAGETYPE:
if (HIWORD(wParam) == CBN_SELCHANGE)
SetImageSize(hDlg);
break;
case IDC_WIDTH_EDIT:
case IDC_HEIGHT_EDIT:
if (HIWORD(wParam) == EN_UPDATE)
SetImageSize(hDlg);
break;
case IDC_RES_EDIT:
if (HIWORD(wParam) == EN_UPDATE)
ConvertValue(hDlg, IDC_RES_EDIT, LastUnitSel);
break;
}
break;
default:
return FALSE;
DWORD Pos = (DWORD)SendDlgItemMessage(hDlg,
IDC_BRI_TRACKBAR,
TBM_GETPOS,
0,
0);
SetDlgItemInt(hDlg,
IDC_BRI_EDIT,
Pos,
FALSE);
}
return TRUE;
}
case WM_COMMAND:
{
if (LOWORD(wParam) == IDOK ||
LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg,
LOWORD(wParam));
return TRUE;
}
}
break;
}
return FALSE;
}

View file

@ -3,9 +3,6 @@
HINSTANCE hInstance;
HANDLE ProcessHeap;
#ifdef _MSC_VER
#pragma warning(disable : 4100)
#endif
int WINAPI
WinMain(HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,

View file

@ -5,7 +5,7 @@
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS image editor\0"
#define REACTOS_STR_INTERNAL_NAME "imagesoft\0"
#define REACTOS_STR_ORIGINAL_FILENAME "imagesoft.exe\0"
#include <reactos/version.rc>
//#include <reactos/version.rc>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@ -25,7 +25,6 @@ IDB_MAINPRINTICON BITMAP DISCARDABLE "res/icons/std/MainPrintIcon.bmp"
IDB_MAINPRINTPREICON BITMAP DISCARDABLE "res/icons/std/MainPrintPreIcon.bmp"
IDB_MAINSAVEICON BITMAP DISCARDABLE "res/icons/std/MainSaveIcon.bmp"
/* text toolbar icons */
IDB_TEXTBOLD BITMAP DISCARDABLE "res/icons/text/TextBoldIcon.bmp"
IDB_TEXTITALIC BITMAP DISCARDABLE "res/icons/text/TextItalicIcon.bmp"

View file

@ -4,7 +4,6 @@ static const TCHAR szImageEditWndClass[] = TEXT("ImageSoftEditWndClass");
#define IMAGE_FRAME_SIZE 1
static VOID
EditWndUpdateScrollInfo(PEDIT_WND_INFO Info)
{
@ -33,35 +32,24 @@ EditWndUpdateScrollInfo(PEDIT_WND_INFO Info)
TRUE);
}
static BOOL
InitEditWnd(PEDIT_WND_INFO Info)
static VOID
LoadBlankCanvas(PEDIT_WND_INFO Info)
{
BITMAPFILEHEADER bmfh;
PBITMAPINFO pbmi = NULL;
PBYTE pBits;
HANDLE hFile;
BITMAP bitmap;
Info->Zoom = 100;
if (Info->OpenInfo != NULL)
{
HDC hDC = GetDC(Info->hSelf);
Info->hDCMem = CreateCompatibleDC(hDC);
ReleaseDC(Info->hSelf, hDC);
if (Info->OpenInfo->CreateNew)
{
/* FIXME: convert this to a DIB Section */
/* set bitmap dimensions */
Info->Width = Info->OpenInfo->New.Width;
Info->Height = Info->OpenInfo->New.Height;
}
}
else
{
DWORD InfoSize, BytesRead;
BOOL bSuccess;
static BOOL
LoadDIBImage(PEDIT_WND_INFO Info)
{
BITMAPFILEHEADER bmfh;
HANDLE hFile;
BITMAP bitmap;
DWORD BytesRead;
BOOL bSuccess, bRet = FALSE;
hFile = CreateFile(Info->OpenInfo->Open.lpImagePath,
GENERIC_READ,
@ -71,7 +59,7 @@ InitEditWnd(PEDIT_WND_INFO Info)
FILE_FLAG_SEQUENTIAL_SCAN,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
return FALSE;
return bRet;
bSuccess = ReadFile(hFile,
&bmfh,
@ -79,16 +67,19 @@ InitEditWnd(PEDIT_WND_INFO Info)
&BytesRead,
NULL);
if ( bSuccess && (BytesRead == sizeof(BITMAPFILEHEADER))
/* FIXME: Why is this failing?? */
/*&& (bmfh.bfType == *(WORD *)_T("BM"))*/)
if (bSuccess && (BytesRead == sizeof(BITMAPFILEHEADER))
&& (bmfh.bfType == *(WORD *)"BM"))
{
PBITMAPINFO pbmi;
DWORD InfoSize;
InfoSize = bmfh.bfOffBits - sizeof(BITMAPFILEHEADER);
pbmi = HeapAlloc(ProcessHeap,
0,
InfoSize);
if (pbmi)
{
bSuccess = ReadFile(hFile,
pbmi,
InfoSize,
@ -97,6 +88,8 @@ InitEditWnd(PEDIT_WND_INFO Info)
if (bSuccess && (BytesRead == InfoSize))
{
PBYTE pBits;
Info->hBitmap = CreateDIBSection(NULL,
pbmi,
DIB_RGB_COLORS,
@ -110,34 +103,6 @@ InitEditWnd(PEDIT_WND_INFO Info)
bmfh.bfSize - bmfh.bfOffBits,
&BytesRead,
NULL);
}
else
{
goto fail;
}
}
else
{
goto fail;
}
}
else
{
if (! bSuccess)
GetError(0);
goto fail;
}
CloseHandle(hFile);
HeapFree(ProcessHeap,
0,
pbmi);
}
Info->OpenInfo = NULL;
}
/* get bitmap dimensions */
GetObject(Info->hBitmap,
@ -147,6 +112,57 @@ InitEditWnd(PEDIT_WND_INFO Info)
Info->Width = bitmap.bmWidth;
Info->Height = bitmap.bmHeight;
bRet = TRUE;
}
}
HeapFree(ProcessHeap,
0,
pbmi);
}
}
else if (!bSuccess)
{
GetError(0);
}
CloseHandle(hFile);
return bRet;
}
static BOOL
InitEditWnd(PEDIT_WND_INFO Info)
{
Info->Zoom = 100;
if (Info->OpenInfo != NULL)
{
HDC hDC;
if (Info->hDCMem)
{
DeleteObject(Info->hDCMem);
Info->hDCMem = NULL;
}
hDC = GetDC(Info->hSelf);
Info->hDCMem = CreateCompatibleDC(hDC);
ReleaseDC(Info->hSelf, hDC);
if (Info->OpenInfo->CreateNew)
{
LoadBlankCanvas(Info);
}
else
{
LoadDIBImage(Info);
}
Info->OpenInfo = NULL;
}
EditWndUpdateScrollInfo(Info);
/* Add image editor to the list */
@ -159,18 +175,6 @@ InitEditWnd(PEDIT_WND_INFO Info)
/* FIXME - if returning FALSE, remove the image editor from the list! */
return TRUE;
fail:
if (! hFile)
CloseHandle(hFile);
if (! pbmi)
HeapFree(ProcessHeap,
0,
pbmi);
return FALSE;
}
static VOID
@ -452,7 +456,7 @@ SetImageEditorEnvironment(PEDIT_WND_INFO Info,
}
BOOL
CreateImageEditWindow(struct _MAIN_WND_INFO *MainWnd,
CreateImageEditWindow(PMAIN_WND_INFO MainWnd,
POPEN_IMAGE_EDIT_INFO OpenInfo)
{
PEDIT_WND_INFO Info;

View file

@ -0,0 +1,92 @@
#define MONOCHROMEBITS 1
#define GREYSCALEBITS 8
#define PALLETEBITS 8
#define TRUECOLORBITS 24
#define PIXELS 0
#define CENTIMETERS 1
#define INCHES 2
/* generic definitions and forward declarations */
struct _MAIN_WND_INFO;
struct _EDIT_WND_INFO;
typedef enum _MDI_EDITOR_TYPE {
metUnknown = 0,
metImageEditor,
} MDI_EDITOR_TYPE, *PMDI_EDITOR_TYPE;
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;
union
{
struct
{
LONG Width;
LONG Height;
} New;
struct
{
LPTSTR lpImagePath;
} Open;
};
LPTSTR lpImageName;
USHORT Type;
LONG Resolution;
} OPEN_IMAGE_EDIT_INFO, *POPEN_IMAGE_EDIT_INFO;
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;
USHORT Zoom;
DWORD Tool;
POPEN_IMAGE_EDIT_INFO OpenInfo; /* Only valid during initialization */
/* 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,
POPEN_IMAGE_EDIT_INFO OpenInfo);
VOID SetImageEditorEnvironment(PEDIT_WND_INFO Info,
BOOL Setup);
BOOL InitImageEditWindowImpl(VOID);
VOID UninitImageEditWindowImpl(VOID);

View file

@ -14,12 +14,12 @@ BEGIN
MENUITEM "&Open...", ID_OPEN
MENUITEM SEPARATOR
MENUITEM "&Close\tCtrl+F4", ID_CLOSE, GRAYED
MENUITEM "C&lose all", ID_CLOSEALL, GRAYED
MENUITEM "C&lose all", ID_CLOSEALL,GRAYED
MENUITEM SEPARATOR
MENUITEM "&Save", ID_SAVE, GRAYED
MENUITEM "Save &As...", ID_SAVEAS, GRAYED
MENUITEM SEPARATOR
MENUITEM "Print Pre&view", ID_PRINTPRE, GRAYED
MENUITEM "Print Pre&view", ID_PRINTPRE,GRAYED
MENUITEM "&Print...", ID_PRINT, GRAYED
MENUITEM SEPARATOR
MENUITEM "Pr&operties...", ID_PROP, GRAYED
@ -45,17 +45,22 @@ BEGIN
MENUITEM "&History", ID_HISTORY
MENUITEM "&Status Bar", ID_STATUSBAR
END
POPUP "&Image"
POPUP "&Adjust"
BEGIN
MENUITEM "&Crop...", -1, GRAYED
MENUITEM "&Resize...", -1, GRAYED
MENUITEM "R&otate...", -1, GRAYED
MENUITEM "&Flip...", -1, GRAYED
MENUITEM "&Stretch...", -1, GRAYED
MENUITEM "S&kew...", -1, GRAYED
MENUITEM "&Invert Colors", -1, GRAYED
MENUITEM "Brightness...", ID_BRIGHTNESS
MENUITEM "Contrast...", -1, GRAYED
MENUITEM "Hue/Saturation...", -1, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Attributes...", -1, GRAYED
MENUITEM "Blur", -1, GRAYED
MENUITEM "Sharpen", -1, GRAYED
MENUITEM "Smooth Edges", -1, GRAYED
MENUITEM "Add Shadow", -1, GRAYED
MENUITEM SEPARATOR
MENUITEM "Image Size...", -1, GRAYED
MENUITEM "Flip", -1, GRAYED
MENUITEM "Mirror", -1, GRAYED
MENUITEM "Rotate", -1, GRAYED
END
POPUP "&Colors"
BEGIN
@ -87,9 +92,27 @@ BEGIN
END
IDD_BRIGHTNESS DIALOGEX 6, 5, 193, 120
CAPTION "Brightness"
FONT 8,"MS Sans Serif", 0, 0
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
BEGIN
LTEXT "", IDC_PICPREVIEW, 0, 1, 132, 96, SS_OWNERDRAW | SS_SUNKEN
LTEXT "Color form:", IDC_STATIC, 135, 5, 36, 9
GROUPBOX "", IDC_BRI_GROUP, 138 ,30, 50, 48
CONTROL "Full (RGB)", IDC_BRI_FULL, "Button", BS_AUTORADIOBUTTON, 138, 18, 46, 9
CONTROL "Red", IDC_BRI_RED, "Button", BS_AUTORADIOBUTTON, 142, 38, 42, 9
CONTROL "Green", IDC_BRI_GREEN, "Button", BS_AUTORADIOBUTTON, 142, 51, 42, 9
CONTROL "Blue", IDC_BRI_BLUE, "Button", BS_AUTORADIOBUTTON, 142, 64, 42, 9
EDITTEXT IDC_BRI_EDIT, 98, 103, 28, 13
CONTROL "", IDC_BRI_TRACKBAR, "msctls_trackbar32", TBS_BOTH | TBS_NOTICKS | WS_TABSTOP, 2, 105, 90, 11
PUSHBUTTON "OK", IDOK, 142, 88, 48, 13
PUSHBUTTON "Cancel", IDCANCEL, 142, 105, 48, 13
END
IDD_ABOUTBOX DIALOGEX 22,16,210,182
CAPTION "About ImageSoft"
FONT 8,"Tahoma",0,0
FONT 8,"MS Sans Serif",0,0
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
//EXSTYLE WS_EX_LAYERED
BEGIN

View file

@ -817,49 +817,8 @@ MainWndCommand(PMAIN_WND_INFO Info,
{
case ID_NEW:
{
OPEN_IMAGE_EDIT_INFO OpenInfo;
PIMAGE_PROP ImageProp = NULL;
ImageProp = HeapAlloc(ProcessHeap,
0,
sizeof(IMAGE_PROP));
if (ImageProp == NULL)
break;
/* load the properties dialog */
if (DialogBoxParam(hInstance,
MAKEINTRESOURCE(IDD_IMAGE_PROP),
Info->hSelf,
ImagePropDialogProc,
(LPARAM)ImageProp))
{
/* if an image name isn't provided, load a default name */
if (! ImageProp->lpImageName)
LoadAndFormatString(hInstance,
IDS_IMAGE_NAME,
&OpenInfo.lpImageName,
++Info->ImagesCreated);
else
OpenInfo.lpImageName = ImageProp->lpImageName;
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,
&OpenInfo);
MessageBox(NULL, _T("Not yet implemented"), NULL, 0);
}
}
break;
case ID_BOLD:
MessageBox(NULL, _T("Bingo"), NULL, 0);
break;
case ID_OPEN:
@ -939,6 +898,14 @@ MainWndCommand(PMAIN_WND_INFO Info,
}
break;
case ID_BRIGHTNESS:
DialogBoxParam(hInstance,
MAKEINTRESOURCE(IDD_BRIGHTNESS),
Info->hSelf,
BrightnessProc,
(LPARAM)Info);
break;
case ID_EXIT:
SendMessage(Info->hSelf,
WM_CLOSE,

View file

@ -0,0 +1,41 @@
typedef struct _MENU_HINT
{
WORD CmdId;
UINT HintId;
} MENU_HINT, *PMENU_HINT;
typedef struct _MAIN_WND_INFO
{
HWND hSelf;
HWND hMdiClient;
HWND hStatus;
int nCmdShow;
struct _FLT_WND *fltTools;
struct _FLT_WND *fltColors;
struct _FLT_WND *fltHistory;
struct _TOOLBAR_DOCKS ToolDocks;
/* Editors */
PEDIT_WND_INFO ImageEditors;
UINT ImagesCreated;
PVOID ActiveEditor;
/* status flags */
BOOL InMenuLoop : 1;
} MAIN_WND_INFO, *PMAIN_WND_INFO;
BOOL InitMainWindowImpl(VOID);
VOID UninitMainWindowImpl(VOID);
HWND CreateMainWindow(LPCTSTR lpCaption,
int nCmdShow);
BOOL MainWndTranslateMDISysAccel(HWND hwnd,
LPMSG lpMsg);
VOID MainWndSwitchEditorContext(PMAIN_WND_INFO Info,
HWND hDeactivate,
HWND hActivate);
MDI_EDITOR_TYPE MainWndGetCurrentEditor(PMAIN_WND_INFO MainWnd,
PVOID *Info);

View file

@ -249,7 +249,7 @@ ToolbarUpdateControlSpaces(HWND hWndToolbar,
0,
0) & CCS_VERT) != 0);
nButtons = SendMessage(hWndToolbar,
nButtons = (DWORD)SendMessage(hWndToolbar,
TB_BUTTONCOUNT,
0,
0);
@ -376,7 +376,8 @@ InitImageList(UINT NumImages, UINT StartResource)
{
HBITMAP hBitmap;
HIMAGELIST hImageList;
INT i, k, Ret;
UINT i, k;
INT Ret;
/* Create the toolbar icon image list */

View file

@ -0,0 +1,44 @@
INT AllocAndLoadString(OUT LPTSTR *lpTarget,
IN HINSTANCE hInst,
IN UINT uID);
DWORD LoadAndFormatString(IN HINSTANCE hInstance,
IN UINT uID,
OUT LPTSTR *lpTarget,
...);
BOOL StatusBarLoadAndFormatString(IN HWND hStatusBar,
IN INT PartId,
IN HINSTANCE hInstance,
IN UINT uID,
...);
BOOL StatusBarLoadString(IN HWND hStatusBar,
IN INT PartId,
IN HINSTANCE hInstance,
IN UINT uID);
INT GetTextFromEdit(OUT LPTSTR lpString,
IN HWND hDlg,
IN UINT Res);
VOID GetError(DWORD err);
BOOL ToolbarDeleteControlSpace(HWND hWndToolbar,
const TBBUTTON *ptbButton);
typedef VOID (*ToolbarChangeControlCallback)(HWND hWndToolbar,
HWND hWndControl,
BOOL Vert);
VOID ToolbarUpdateControlSpaces(HWND hWndToolbar,
ToolbarChangeControlCallback ChangeCallback);
BOOL ToolbarInsertSpaceForControl(HWND hWndToolbar,
HWND hWndControl,
INT Index,
INT iCmd,
BOOL HideVertical);
HIMAGELIST InitImageList(UINT NumButtons,
UINT StartResource);

View file

@ -3,26 +3,16 @@
//#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h> /* GET_X/Y_LPARAM */
#include <windowsx.h>
#include <stdio.h>
#include <tchar.h>
#include <commctrl.h>
#include "resource.h"
/* FIXME - add to headers !!! */
#ifndef SB_SIMPLEID
#define SB_SIMPLEID 0xFF
#endif
#ifndef RBBS_USECHEVRON
#define RBBS_USECHEVRON 0x200
#endif
#ifndef RBN_CHEVRONPUSHED
#define RBN_CHEVRONPUSHED (RBN_FIRST - 10)
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4100)
#endif
#include "tooldock.h"
#include "imgedwnd.h"
#include "mainwnd.h"
#include "misc.h"
#define MAX_KEY_LENGTH 256
#define NUM_MAINTB_IMAGES 10
@ -33,28 +23,8 @@
#define COLORS 1
#define HISTORY 2
#define MONOCHROMEBITS 1
#define GREYSCALEBITS 8
#define PALLETEBITS 8
#define TRUECOLORBITS 24
#define PIXELS 0
#define CENTIMETERS 1
#define INCHES 2
#ifdef _MSC_VER
#pragma warning(disable : 4100)
#endif
/* generic definitions and forward declarations */
struct _MAIN_WND_INFO;
struct _EDIT_WND_INFO;
struct _FLT_WND;
typedef enum _MDI_EDITOR_TYPE {
metUnknown = 0,
metImageEditor,
} MDI_EDITOR_TYPE, *PMDI_EDITOR_TYPE;
extern HINSTANCE hInstance;
extern HANDLE ProcessHeap;
/* about.c */
INT_PTR CALLBACK AboutDialogProc(HWND hDlg,
@ -63,306 +33,14 @@ INT_PTR CALLBACK AboutDialogProc(HWND hDlg,
LPARAM lParam);
/* imageprop.c */
typedef struct _IMAGE_PROP
{
LPTSTR lpImageName;
/* Canvas properties */
USHORT Type;
USHORT Unit;
LONG Resolution;
/* size of drawing area */
LONG Width;
LONG Height;
} IMAGE_PROP, *PIMAGE_PROP;
INT_PTR CALLBACK
ImagePropDialogProc(HWND hDlg,
INT_PTR CALLBACK ImagePropDialogProc(HWND hDlg,
UINT message,
WPARAM wParam,
LPARAM lParam);
INT_PTR CALLBACK BrightnessProc(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;
union
{
struct
{
LONG Width;
LONG Height;
} New;
struct
{
LPTSTR lpImagePath;
} Open;
};
LPTSTR lpImageName;
USHORT Type;
LONG Resolution;
} OPEN_IMAGE_EDIT_INFO, *POPEN_IMAGE_EDIT_INFO;
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;
USHORT Zoom;
DWORD Tool;
POPEN_IMAGE_EDIT_INFO OpenInfo; /* Only valid during initialization */
/* 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,
POPEN_IMAGE_EDIT_INFO OpenInfo);
VOID SetImageEditorEnvironment(PEDIT_WND_INFO Info,
BOOL Setup);
BOOL InitImageEditWindowImpl(VOID);
VOID UninitImageEditWindowImpl(VOID);
/* tooldock.c */
typedef enum
{
TOP_DOCK = 0,
LEFT_DOCK,
RIGHT_DOCK,
BOTTOM_DOCK,
NO_DOCK
} DOCK_POSITION;
typedef struct _DOCKBAR
{
UINT BarId;
LPCTSTR lpName;
UINT DisplayTextId;
DOCK_POSITION Position;
} DOCKBAR, *PDOCKBAR;
struct _TOOLBAR_DOCKS;
typedef BOOL (CALLBACK *PDOCKBAR_CREATECLIENT)(struct _TOOLBAR_DOCKS *TbDocks,
const DOCKBAR *Dockbar,
PVOID Context,
HWND hParent,
HWND *hwnd);
typedef BOOL (CALLBACK *PDOCKBAR_DESTROYCLIENT)(struct _TOOLBAR_DOCKS *TbDocks,
const DOCKBAR *Dockbar,
PVOID Context,
HWND hwnd);
typedef BOOL (CALLBACK *PDOCKBAR_INSERTBAND)(struct _TOOLBAR_DOCKS *TbDocks,
const DOCKBAR *Dockbar,
PVOID Context,
UINT *Index,
LPREBARBANDINFO rbi);
typedef VOID (CALLBACK *PDOCKBAR_DOCKBAND)(struct _TOOLBAR_DOCKS *TbDocks,
const DOCKBAR *Dockbar,
PVOID Context,
DOCK_POSITION DockFrom,
DOCK_POSITION DockTo,
LPREBARBANDINFO rbi);
typedef VOID (CALLBACK *PDOCKBAR_CHEVRONPUSHED)(struct _TOOLBAR_DOCKS *TbDocks,
const DOCKBAR *Dockbar,
PVOID Context,
HWND hwndChild,
LPNMREBARCHEVRON lpnm);
typedef struct _DOCKBAR_ITEM_CALLBACKS
{
PDOCKBAR_CREATECLIENT CreateClient;
PDOCKBAR_DESTROYCLIENT DestroyClient;
PDOCKBAR_INSERTBAND InsertBand;
PDOCKBAR_DOCKBAND DockBand;
PDOCKBAR_CHEVRONPUSHED ChevronPushed;
} DOCKBAR_ITEM_CALLBACKS, *PDOCKBAR_ITEM_CALLBACKS;
typedef struct _DOCKBAR_ITEM
{
struct _DOCKBAR_ITEM *Next;
DOCKBAR DockBar;
PVOID Context;
HWND hWndTool;
HWND hWndClient;
DOCK_POSITION PrevDock;
UINT PrevBandIndex;
const DOCKBAR_ITEM_CALLBACKS *Callbacks;
} DOCKBAR_ITEM, *PDOCKBAR_ITEM;
typedef VOID (CALLBACK *PDOCKBAR_PARENTRESIZE)(PVOID Context,
WORD cx,
WORD cy);
#define DOCKS_COUNT 4
typedef struct _TOOLBAR_DOCKS
{
HWND hParent;
PVOID Context;
HWND hRebar[DOCKS_COUNT];
RECT rcRebar[DOCKS_COUNT];
RECT rcClient;
PDOCKBAR_ITEM Items;
PDOCKBAR_PARENTRESIZE ParentResize;
PDOCKBAR_ITEM Dragging;
UINT DraggingBandId;
TCHAR szTempText[255];
} TOOLBAR_DOCKS, *PTOOLBAR_DOCKS;
VOID TbdInitializeDocks(PTOOLBAR_DOCKS TbDocks,
HWND hWndParent,
PVOID Context,
PDOCKBAR_PARENTRESIZE ParentResizeProc);
INT TbdAdjustUpdateClientRect(PTOOLBAR_DOCKS TbDocks,
PRECT rcClient);
HDWP TbdDeferDocks(HDWP hWinPosInfo,
PTOOLBAR_DOCKS TbDocks);
BOOL TbdAddToolbar(PTOOLBAR_DOCKS TbDocks,
const DOCKBAR *Dockbar,
PVOID Context,
const DOCKBAR_ITEM_CALLBACKS *DockbarCallbacks);
BOOL TbdDockBarIdFromClientWindow(PTOOLBAR_DOCKS TbDocks,
HWND hWndClient,
UINT *Id);
BOOL TbdHandleNotifications(PTOOLBAR_DOCKS TbDocks,
LPNMHDR pnmh,
LRESULT *Result);
VOID TbdHandleEnabling(PTOOLBAR_DOCKS TbDocks,
HWND hWnd,
BOOL Enable);
VOID TbdHandleActivation(PTOOLBAR_DOCKS TbDocks,
HWND hWnd,
WPARAM *wParam,
LPARAM *lParam);
VOID TbdShowFloatingToolbars(PTOOLBAR_DOCKS TbDocks,
BOOL Show);
BOOL TbdInitImpl(VOID);
VOID TbdUninitImpl(VOID);
/* mainwnd.c */
typedef struct _MENU_HINT
{
WORD CmdId;
UINT HintId;
} MENU_HINT, *PMENU_HINT;
typedef struct _MAIN_WND_INFO
{
HWND hSelf;
HWND hMdiClient;
HWND hStatus;
int nCmdShow;
struct _FLT_WND *fltTools;
struct _FLT_WND *fltColors;
struct _FLT_WND *fltHistory;
TOOLBAR_DOCKS ToolDocks;
/* Editors */
PEDIT_WND_INFO ImageEditors;
UINT ImagesCreated;
PVOID ActiveEditor;
/* status flags */
BOOL InMenuLoop : 1;
} MAIN_WND_INFO, *PMAIN_WND_INFO;
BOOL InitMainWindowImpl(VOID);
VOID UninitMainWindowImpl(VOID);
HWND CreateMainWindow(LPCTSTR lpCaption,
int nCmdShow);
BOOL MainWndTranslateMDISysAccel(HWND hwnd,
LPMSG lpMsg);
VOID MainWndSwitchEditorContext(PMAIN_WND_INFO Info,
HWND hDeactivate,
HWND hActivate);
MDI_EDITOR_TYPE MainWndGetCurrentEditor(PMAIN_WND_INFO MainWnd,
PVOID *Info);
/* misc.c */
INT AllocAndLoadString(OUT LPTSTR *lpTarget,
IN HINSTANCE hInst,
IN UINT uID);
DWORD LoadAndFormatString(IN HINSTANCE hInstance,
IN UINT uID,
OUT LPTSTR *lpTarget,
...);
BOOL StatusBarLoadAndFormatString(IN HWND hStatusBar,
IN INT PartId,
IN HINSTANCE hInstance,
IN UINT uID,
...);
BOOL StatusBarLoadString(IN HWND hStatusBar,
IN INT PartId,
IN HINSTANCE hInstance,
IN UINT uID);
INT GetTextFromEdit(OUT LPTSTR lpString,
IN HWND hDlg,
IN UINT Res);
VOID GetError(DWORD err);
BOOL ToolbarDeleteControlSpace(HWND hWndToolbar,
const TBBUTTON *ptbButton);
typedef VOID (*ToolbarChangeControlCallback)(HWND hWndToolbar,
HWND hWndControl,
BOOL Vert);
VOID ToolbarUpdateControlSpaces(HWND hWndToolbar,
ToolbarChangeControlCallback ChangeCallback);
BOOL ToolbarInsertSpaceForControl(HWND hWndToolbar,
HWND hWndControl,
INT Index,
INT iCmd,
BOOL HideVertical);
HIMAGELIST InitImageList(UINT NumButtons,
UINT StartResource);
/* opensave.c */
VOID FileInitialize(HWND hwnd);

View file

@ -78,7 +78,10 @@
#define ID_TEXT 2068
#define ID_ZOOM 2069
#define ID_ABOUT 2100
/* Adjust */
#define ID_BRIGHTNESS 2100
#define ID_ABOUT 2400
#define ID_REFRESH 3000
#define ID_HELP 3001
@ -240,6 +243,17 @@
/* DIALOGS */
#define IDC_PICPREVIEW 2999
/* brightness dialog */
#define IDD_BRIGHTNESS 3000
#define IDC_BRI_GROUP 3001
#define IDC_BRI_FULL 3002
#define IDC_BRI_RED 3003
#define IDC_BRI_GREEN 3004
#define IDC_BRI_BLUE 3005
#define IDC_BRI_EDIT 3006
#define IDC_BRI_TRACKBAR 3007
/* image property dialog */
#define IDD_IMAGE_PROP 4000

View file

@ -0,0 +1,115 @@
typedef enum
{
TOP_DOCK = 0,
LEFT_DOCK,
RIGHT_DOCK,
BOTTOM_DOCK,
NO_DOCK
} DOCK_POSITION;
typedef struct _DOCKBAR
{
UINT BarId;
LPCTSTR lpName;
UINT DisplayTextId;
DOCK_POSITION Position;
} DOCKBAR, *PDOCKBAR;
struct _TOOLBAR_DOCKS;
typedef BOOL (CALLBACK *PDOCKBAR_CREATECLIENT)(struct _TOOLBAR_DOCKS *TbDocks,
const DOCKBAR *Dockbar,
PVOID Context,
HWND hParent,
HWND *hwnd);
typedef BOOL (CALLBACK *PDOCKBAR_DESTROYCLIENT)(struct _TOOLBAR_DOCKS *TbDocks,
const DOCKBAR *Dockbar,
PVOID Context,
HWND hwnd);
typedef BOOL (CALLBACK *PDOCKBAR_INSERTBAND)(struct _TOOLBAR_DOCKS *TbDocks,
const DOCKBAR *Dockbar,
PVOID Context,
UINT *Index,
LPREBARBANDINFO rbi);
typedef VOID (CALLBACK *PDOCKBAR_DOCKBAND)(struct _TOOLBAR_DOCKS *TbDocks,
const DOCKBAR *Dockbar,
PVOID Context,
DOCK_POSITION DockFrom,
DOCK_POSITION DockTo,
LPREBARBANDINFO rbi);
typedef VOID (CALLBACK *PDOCKBAR_CHEVRONPUSHED)(struct _TOOLBAR_DOCKS *TbDocks,
const DOCKBAR *Dockbar,
PVOID Context,
HWND hwndChild,
LPNMREBARCHEVRON lpnm);
typedef struct _DOCKBAR_ITEM_CALLBACKS
{
PDOCKBAR_CREATECLIENT CreateClient;
PDOCKBAR_DESTROYCLIENT DestroyClient;
PDOCKBAR_INSERTBAND InsertBand;
PDOCKBAR_DOCKBAND DockBand;
PDOCKBAR_CHEVRONPUSHED ChevronPushed;
} DOCKBAR_ITEM_CALLBACKS, *PDOCKBAR_ITEM_CALLBACKS;
typedef struct _DOCKBAR_ITEM
{
struct _DOCKBAR_ITEM *Next;
DOCKBAR DockBar;
PVOID Context;
HWND hWndTool;
HWND hWndClient;
DOCK_POSITION PrevDock;
UINT PrevBandIndex;
const DOCKBAR_ITEM_CALLBACKS *Callbacks;
} DOCKBAR_ITEM, *PDOCKBAR_ITEM;
typedef VOID (CALLBACK *PDOCKBAR_PARENTRESIZE)(PVOID Context,
WORD cx,
WORD cy);
#define DOCKS_COUNT 4
typedef struct _TOOLBAR_DOCKS
{
HWND hParent;
PVOID Context;
HWND hRebar[DOCKS_COUNT];
RECT rcRebar[DOCKS_COUNT];
RECT rcClient;
PDOCKBAR_ITEM Items;
PDOCKBAR_PARENTRESIZE ParentResize;
PDOCKBAR_ITEM Dragging;
UINT DraggingBandId;
TCHAR szTempText[255];
} TOOLBAR_DOCKS, *PTOOLBAR_DOCKS;
VOID TbdInitializeDocks(PTOOLBAR_DOCKS TbDocks,
HWND hWndParent,
PVOID Context,
PDOCKBAR_PARENTRESIZE ParentResizeProc);
INT TbdAdjustUpdateClientRect(PTOOLBAR_DOCKS TbDocks,
PRECT rcClient);
HDWP TbdDeferDocks(HDWP hWinPosInfo,
PTOOLBAR_DOCKS TbDocks);
BOOL TbdAddToolbar(PTOOLBAR_DOCKS TbDocks,
const DOCKBAR *Dockbar,
PVOID Context,
const DOCKBAR_ITEM_CALLBACKS *DockbarCallbacks);
BOOL TbdDockBarIdFromClientWindow(PTOOLBAR_DOCKS TbDocks,
HWND hWndClient,
UINT *Id);
BOOL TbdHandleNotifications(PTOOLBAR_DOCKS TbDocks,
LPNMHDR pnmh,
LRESULT *Result);
VOID TbdHandleEnabling(PTOOLBAR_DOCKS TbDocks,
HWND hWnd,
BOOL Enable);
VOID TbdHandleActivation(PTOOLBAR_DOCKS TbDocks,
HWND hWnd,
WPARAM *wParam,
LPARAM *lParam);
VOID TbdShowFloatingToolbars(PTOOLBAR_DOCKS TbDocks,
BOOL Show);
BOOL TbdInitImpl(VOID);
VOID TbdUninitImpl(VOID);