예제 #1
0
BOOL RegisterHotKey(HWND hWnd, int id, UINT fsModifiers, UINT vk)
{
	MWHOTKEY *pHotkey;

	if (MwFindHotkey (id) || !(pHotkey = GdItemNew (MWHOTKEY)))
		return FALSE;
	pHotkey->hWnd        = hWnd;
	pHotkey->id          = id;
	pHotkey->fsModifiers = fsModifiers;
	pHotkey->vk          = vk;
	GdListAdd(&mwHotkeyHead, &pHotkey->link);

	return TRUE;
}
예제 #2
0
파일: wingdi.c 프로젝트: EPiCS/reconos_v2
HBRUSH WINAPI
CreateSolidBrush(COLORREF crColor)
{
	MWBRUSHOBJ *hbr;

	hbr = GdItemNew(MWBRUSHOBJ);
	if(!hbr)
		return NULL;
	hbr->hdr.type = OBJ_BRUSH;
	hbr->hdr.stockobj = FALSE;
	hbr->style = BS_SOLID;
	hbr->color = crColor;
	return (HBRUSH)hbr;
}
예제 #3
0
파일: wingdi.c 프로젝트: EPiCS/reconos_v2
HPEN WINAPI
CreatePen(int nPenStyle, int nWidth, COLORREF crColor)
{
	MWPENOBJ *hpen;

	/* fix: nWidth > 1*/
	hpen = GdItemNew(MWPENOBJ);
	if(!hpen)
		return NULL;
	hpen->hdr.type = OBJ_PEN;
	hpen->hdr.stockobj = FALSE;
	hpen->style = nPenStyle;
	hpen->color = crColor;
	return (HPEN)hpen;
}
예제 #4
0
/*
 *          Create a new empty region.
 */
static HRGN
REGION_CreateRegion(void)
{
    MWRGNOBJ *obj;
    
    obj = GdItemNew(MWRGNOBJ);
    if(!obj)
    	return NULL;
    obj->hdr.type = OBJ_REGION;
    obj->hdr.stockobj = FALSE;
    if(!(obj->rgn = GdAllocRegion())) {
	GdItemFree(obj);
	return NULL;
    }
    return (HRGN)obj;
}
예제 #5
0
BOOL WINAPI
SetProp(HWND hWnd, LPCSTR lpString, HANDLE hData)
{
	MWPROP *pProp;

	if (!(pProp = GdItemNew(MWPROP)))
		return FALSE;
	if (HIWORD(lpString))
		pProp->Atom = GlobalAddAtom(lpString);
	else
		pProp->Atom = LOWORD((DWORD)lpString);
	pProp->hData = hData;

	GdListAdd (&hWnd->props, &pProp->link);
	return TRUE;
}
예제 #6
0
BOOL WINAPI
PostMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	MSG *	pMsg;

#if PAINTONCE
	/* don't queue paint msgs, set window paint status instead*/
	if(Msg == WM_PAINT) {
		hwnd->gotPaintMsg = PAINT_NEEDSPAINT;
		return TRUE;
	}
#endif
#if MOUSETEST
	/* replace multiple mouse messages with one for better mouse handling*/
	if(Msg == WM_MOUSEMOVE) {
		PMWLIST	p;
		for(p=mwMsgHead.head; p; p=p->next) {
			pMsg = GdItemAddr(p, MSG, link);
			if(pMsg->hwnd == hwnd && pMsg->message == Msg) {
				pMsg->wParam = wParam;
				pMsg->lParam = lParam;
				pMsg->time = GetTickCount();
				pMsg->pt.x = cursorx;
				pMsg->pt.y = cursory;
				return TRUE;
			}
		}
	}
#endif
	pMsg = GdItemNew(MSG);
	if(!pMsg)
		return FALSE;
	pMsg->hwnd = hwnd;
	pMsg->message = Msg;
	pMsg->wParam = wParam;
	pMsg->lParam = lParam;
	pMsg->time = GetTickCount();
	pMsg->pt.x = cursorx;
	pMsg->pt.y = cursory;
	GdListAdd(&mwMsgHead, &pMsg->link);
	return TRUE;
}
예제 #7
0
ATOM WINAPI
RegisterClass(CONST WNDCLASS *lpWndClass)
{
	PWNDCLASS	pClass;

	/* check if already present*/
	pClass = MwFindClassByName(lpWndClass->lpszClassName);
	if(pClass)
		return 0;
	
	/* copy class into new struct*/
	pClass = GdItemNew(WNDCLASS);
	if(!pClass)
		return 0;
	*pClass = *lpWndClass;
	strcpy(pClass->szClassName, lpWndClass->lpszClassName);
	GdListAdd(&mwClassHead, &pClass->link);

	return 1;
}
예제 #8
0
파일: winfont.c 프로젝트: EPiCS/reconos_v2
HFONT WINAPI
CreateFontIndirect(CONST LOGFONT *lplf)
{
	MWFONTOBJ * 	hfont;
	int		family, pitch;
	MWLOGFONT	mwlf;
	char	szFacename[32];

	/* create a gdi font object*/
	hfont = GdItemNew(MWFONTOBJ);
	if(!hfont)
		return NULL;
	hfont->hdr.type = OBJ_FONT;
	hfont->hdr.stockobj = FALSE;

	/* convert LOGFONT to MWLOGFONT*/
	memset(&mwlf, 0, sizeof(mwlf));
	mwlf.lfHeight = lplf->lfHeight;
	mwlf.lfWidth = lplf->lfWidth;
	mwlf.lfEscapement = lplf->lfEscapement;
	mwlf.lfOrientation = lplf->lfOrientation;
	mwlf.lfWeight = lplf->lfWeight;
	mwlf.lfItalic = lplf->lfItalic;
	mwlf.lfUnderline = lplf->lfUnderline;
	mwlf.lfStrikeOut = lplf->lfStrikeOut;
	mwlf.lfCharSet = lplf->lfCharSet;
	mwlf.lfOutPrecision = lplf->lfOutPrecision;
	mwlf.lfClipPrecision = lplf->lfClipPrecision;
	mwlf.lfQuality = lplf->lfQuality;
	strncpy(mwlf.lfFaceName, lplf->lfFaceName, sizeof(mwlf.lfFaceName));

	family = lplf->lfPitchAndFamily & 0xf0;
	switch(family) {
	case FF_DONTCARE:
		break;
	case FF_ROMAN:
		mwlf.lfRoman = 1;
		mwlf.lfSerif = 1;
		break;
	case FF_SWISS:
		mwlf.lfSansSerif = 1;
		break;
	case FF_MODERN:
		mwlf.lfModern = 1;
		break;
	}

	pitch = lplf->lfPitchAndFamily & 0x0f;
	switch(pitch) {
	case DEFAULT_PITCH:
		break;
	case FIXED_PITCH:
	case MONO_FONT:
		mwlf.lfMonospace = 1;
		break;
	case VARIABLE_PITCH:
		mwlf.lfProportional = 1;
		break;
	}
	/*mwlf.lfOblique = 0;*/
	/*mwlf.lfSmallCaps = 0;*/
	/*mwlf.lfPitch = 0;*/

	/* select a font based on facename, bold/italic and height*/
	strncpy(szFacename, lplf->lfFaceName, sizeof(szFacename));
	if (lplf->lfWeight==FW_BOLD)
		strcat(szFacename, "B");
	if (lplf->lfItalic)
		strcat(szFacename, "I");
	hfont->pfont = GdCreateFont(&scrdev, szFacename, lplf->lfHeight, &mwlf);

	return (HFONT)hfont;
}
예제 #9
0
/*
 * GdDecodeImage:
 * @psd: Drawing surface.
 * @src: The image data.
 * @flags: If nonzero, JPEG images will be loaded as grayscale.  Yuck!
 *
 * Load an image.
 */
static int
GdDecodeImage(PSD psd, buffer_t * src, char *path, int flags)
{
        int         loadOK = 0;
        PMWIMAGEHDR pimage;
        PIMAGEITEM  pItem;

	/* allocate image struct*/
	pimage = (PMWIMAGEHDR)malloc(sizeof(MWIMAGEHDR));
	if(!pimage) {
		return 0;
	}
	pimage->imagebits = NULL;
	pimage->palette = NULL;
	pimage->transcolor = MWNOCOLOR;

#if defined(HAVE_TIFF_SUPPORT)
	/* must be first... no buffer support yet*/
	if (path)
		loadOK = GdDecodeTIFF(path, pimage);
#endif
#if defined(HAVE_BMP_SUPPORT)
	if (loadOK == 0) 
		loadOK = GdDecodeBMP(src, pimage);
#endif
#if defined(HAVE_GIF_SUPPORT)
	if (loadOK == 0) 
		loadOK = GdDecodeGIF(src, pimage);
#endif
#if defined(HAVE_JPEG_SUPPORT)
	if (loadOK == 0) 
		loadOK = GdDecodeJPEG(src, pimage, psd, flags);
#endif
#if defined(HAVE_PNG_SUPPORT)
	if (loadOK == 0) 
		loadOK = GdDecodePNG(src, pimage);
#endif
#if defined(HAVE_PNM_SUPPORT)
	if(loadOK == 0)
		loadOK = GdDecodePNM(src, pimage);
#endif
#if defined(HAVE_XPM_SUPPORT)
	if (loadOK == 0) 
		loadOK = GdDecodeXPM(src, pimage, psd);
#endif

	if (loadOK == 0) {
		EPRINTF("GdLoadImageFromFile: unknown image type\n");
		goto err;		/* image loading error*/
	}
	if (loadOK != 1)
		goto err;		/* image loading error*/

	/* allocate id*/
	pItem = GdItemNew(IMAGEITEM);
	if (!pItem)
		goto err;
	pItem->id = nextimageid++;
	pItem->pimage = pimage;
	pItem->psd = psd;
	if(!imagehead_initialized) {
		imagehead_initialized=1;
		memset(&imagehead,0,sizeof(imagehead));
	}
	GdListAdd(&imagehead, &pItem->link);

	return pItem->id;

err:
	free(pimage);
	return 0;			/* image loading error*/
}