Exemplo n.º 1
0
void CPpcKeyCtrlDlg::OnInitDialog(HWND hDlg)
{
	m_dwStart = GetTickCount();
	SetTimer(hDlg, ID_TIMER_KEYCTRLCLOSE, INT_TIMER_KEYCTRLCLOSE, NULL);

	m_hBrushBack = CreateSolidBrush(m_nColorBack); 

	RECT rc;
	int nXDiff, nYDiff;
	GetWindowRect(hDlg, &rc);
	nXDiff = (RECT_WIDTH(&m_rcDlg) - RECT_WIDTH(&rc)) / 2;
	nYDiff = (RECT_HEIGHT(&m_rcDlg) - RECT_HEIGHT(&rc)) / 2;
	MoveWindow(hDlg, m_rcDlg.left, m_rcDlg.top, RECT_WIDTH(&m_rcDlg), RECT_HEIGHT(&m_rcDlg), TRUE);

	GetWindowRect(GetDlgItem(hDlg, IDC_STATIC_UP), &rc);
	ScreenToClient(hDlg, (LPPOINT)&rc);
	SetWindowPos(GetDlgItem(hDlg, IDC_STATIC_UP), 0, rc.left + nXDiff, rc.top + nYDiff, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
	GetWindowRect(GetDlgItem(hDlg, IDC_STATIC_DOWN), &rc);
	ScreenToClient(hDlg, (LPPOINT)&rc);
	SetWindowPos(GetDlgItem(hDlg, IDC_STATIC_DOWN), 0, rc.left + nXDiff, rc.top + nYDiff, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
	GetWindowRect(GetDlgItem(hDlg, IDC_STATIC_LEFT), &rc);
	ScreenToClient(hDlg, (LPPOINT)&rc);
	SetWindowPos(GetDlgItem(hDlg, IDC_STATIC_LEFT), 0, rc.left + nXDiff, rc.top + nYDiff, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
	GetWindowRect(GetDlgItem(hDlg, IDC_STATIC_RIGHT), &rc);
	ScreenToClient(hDlg, (LPPOINT)&rc);
	SetWindowPos(GetDlgItem(hDlg, IDC_STATIC_RIGHT), 0, rc.left + nXDiff, rc.top + nYDiff, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
	GetWindowRect(GetDlgItem(hDlg, IDC_STATIC_CENTER), &rc);
	ScreenToClient(hDlg, (LPPOINT)&rc);
	SetWindowPos(GetDlgItem(hDlg, IDC_STATIC_CENTER), 0, rc.left + nXDiff, rc.top + nYDiff, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
Exemplo n.º 2
0
void RMMMobileObject::setSpecialBBoxToAnalyze(Rectangle<int> *bboxResult, Rectangle<int> *realBBox, double visualSupport) {

    int
        Xc = RECT_XCENTER(bboxResult),
        Yc = RECT_YCENTER(bboxResult),
        Xb = RECT_XCENTER(realBBox),
        Yb = RECT_YCENTER(realBBox),
        Wc = RECT_WIDTH(bboxResult),
        Hc = RECT_HEIGHT(bboxResult),
        Wb = RECT_WIDTH(realBBox),
        Hb = RECT_HEIGHT(realBBox);
    double
        visualComplement = 1.0 - visualSupport,
        X  = visualSupport * Xc + visualComplement * Xb,
        Y  = visualSupport * Yc + visualComplement * Yb,
        W  = visualSupport * Wc + visualComplement * Wb,
        H  = visualSupport * Hc + visualComplement * Hb;

    RECT_XRIGHT(bboxResult)  = (int) ( (2.0*X + W - 1) / 2.0 );
    RECT_XLEFT(bboxResult)   = (int) ( RECT_XRIGHT(bboxResult) - W + 1 );
    RECT_WIDTH(bboxResult)   = (int) W;

    RECT_YBOTTOM(bboxResult) = (int) ( (2.0*Y + H - 1) / 2.0 );
    RECT_YTOP(bboxResult)    = (int) ( RECT_YBOTTOM(bboxResult) - H + 1 );
    RECT_HEIGHT(bboxResult)  = (int) H;
}
Exemplo n.º 3
0
void CSearchPanel::ShowPanel(bool bIsShow)
{
	if (m_pSearchBar == NULL || m_pSearchBar->GetOwnerWindow() == NULL || m_bIsShow == bIsShow)
		return;

	m_bIsShow = bIsShow;
	if (bIsShow)
	{
		RECT ctrlRct = m_pSearchBar->GetWindowRect();
		RectClientToScreen(m_pSearchBar->GetOwnerWindow()->GetSafeHandle(), ctrlRct);

		RECT wndRct = this->GetWindowRect();
		int nH = RECT_HEIGHT(wndRct);
		wndRct.top = ctrlRct.bottom + 25;
		wndRct.bottom = wndRct.top + nH;

		this->MoveWindow(wndRct);

		this->ShowWindow(SW_SHOW);
		m_pSearchBar->SetEditFocus();
	}
	else
	{
		this->ShowWindow(SW_HIDE);
	}
}
Exemplo n.º 4
0
		static void __( frame_ptr const& f, frame_coord const& coord, bool const cf, paint_param_t& pp, RECT r ) {
			HDC dc = pp.dcb.dc;
			RECT rt;
			int const rw = RECT_WIDTH( r );
			int const rh = RECT_HEIGHT( r );
			rt.left 	= r.left + coord.left.get_n() * rw / coord.left.get_d();
			rt.top 		= r.top + coord.top.get_n() * rh / coord.top.get_d();
			rt.right	= rt.left + rw / coord.width;
			rt.bottom	= rt.top + rh / coord.height;
			//
			//
			FrameRect( dc, &rt, ( cf )?( pp.borderActive ):( pp.borderInactive ) );
			InflateRect( &rt, -1, -1 );
			//
			SetBkMode( dc, TRANSPARENT );
			//
			atom::shared_gdiobj<HRGN> rgn = CreateRectRgn( rt.left, rt.top, rt.right, rt.bottom );
			SelectClipRgn( dc, rgn );
			{
				SelectObject( dc, pp.sysFont.font);
				SetTextColor( dc, pp.sysFont.color );
				atom::stringstream_t ss;
				ss << _T( " #" ) << f->get_index();
				DrawText( dc, ss.str().c_str(), -1, &rt, DT_RIGHT | DT_TOP | DT_SINGLELINE );
				//
				SelectObject( dc, pp.textFont.font );
				SetTextColor( dc, pp.textFont.color );
				f->paint( dc, rt, pp.textFont.height );
			}
			SelectClipRgn( dc, NULL );
		}
Exemplo n.º 5
0
void CRenderUtility::DrawText( HDC hDC,LPCTSTR lpszText,RECT& rctSrc,COLORREF color/*= RGB(0,0,0)*/, LPCTSTR lpszFontFamily /*=L"΢ÈíÑźÚ"*/,int nFontSize /*= 12*/,DWORD dwAlignStyle /*= SS_CENTER*/,DWORD dwFontStyle /*= FontStyleRegular*/, int nAlpha /*= 255*/ )
{
	if(0 == nAlpha || NULL == lpszText) return;

	Graphics graphics(hDC);
	FontFamily fontFamily(lpszFontFamily);
	FontStyle fontStyle = (FontStyle)dwFontStyle;

	Gdiplus::Font font(&fontFamily,(float)nFontSize,fontStyle,UnitPixel);
	RectF rcText((float)rctSrc.left,(float)rctSrc.top,(float)RECT_WIDTH(rctSrc),(float)RECT_HEIGHT(rctSrc));
	SolidBrush brush(Color(nAlpha,GetRValue(color),GetGValue(color),GetBValue(color)));
	StringFormat txtFormat;
	if(dwAlignStyle & SS_CENTERIMAGE)
	{
		txtFormat.SetLineAlignment(StringAlignmentCenter);
	}
	if(dwAlignStyle & SS_CENTER){
		txtFormat.SetAlignment(StringAlignmentCenter);
	}
	else if(dwAlignStyle & SS_RIGHT){
		txtFormat.SetFormatFlags(StringFormatFlagsDirectionRightToLeft);
		txtFormat.SetAlignment(StringAlignmentNear);
	}

	graphics.DrawString(lpszText,-1,&font,rcText,&txtFormat,&brush);
}
int
_setDeviceConfig (VideoDevice * vd)
{
  VS_FLOW ("Fun %s in\n", __FUNCTION__);

  struct fb_var_screeninfo fb_var;
  struct fb_fix_screeninfo fb_fix;
  struct mxcfb_pos pos;
  Rect *rect;
  int i;

  int fd = _getDevicefd (vd);

  /* Workaround for ipu hardware, it need set to 0,0 before change another offset */
  pos.x = 0;
  pos.y = 0;
  VS_IOCTL (fd, MXCFB_SET_OVERLAY_POS, here1, &pos);
here1:
  VS_IOCTL (fd, FBIOBLANK, done, FB_BLANK_POWERDOWN);

  //VS_MESSAGE("Set device win"WIN_FMT"\n", WIN_ARGS(&vd->disp));

  rect = &vd->disp;

  VS_IOCTL (fd, FBIOGET_VSCREENINFO, done, &fb_var);

  fb_var.xres = RECT_WIDTH (rect);
  fb_var.xres_virtual = fb_var.xres;
  fb_var.yres = RECT_HEIGHT (rect);
  fb_var.yres_virtual = fb_var.yres * FB_NUM_BUFFERS;
  fb_var.activate |= FB_ACTIVATE_FORCE;
  fb_var.nonstd = vd->fmt;

  fb_var.bits_per_pixel = fmt2bit (vd->fmt);
  VS_IOCTL (fd, FBIOPUT_VSCREENINFO, done, &fb_var);

  VS_IOCTL (fd, FBIOGET_VSCREENINFO, done, &fb_var);
  VS_IOCTL (fd, FBIOGET_FSCREENINFO, done, &fb_fix);

  pos.x = vd->disp.left;
  pos.y = vd->disp.top;
  VS_IOCTL (fd, MXCFB_SET_OVERLAY_POS, here2, &pos);
here2:

  VS_IOCTL (fd, FBIOBLANK, done, FB_BLANK_UNBLANK);

  for (i = 0; i < FB_NUM_BUFFERS; i++) {
    vd->bufaddr[i] =
        (void *) (fb_fix.smem_start + fb_var.yres * fb_fix.line_length * i);
  }


  if (fmt2cs (vd->fmt) == 0) {
    _clearBackground (vd, NULL);
  }


done:
  return 0;
}
Exemplo n.º 7
0
void
placeSelWin()
{
    MoveWindow(hSelection, rectSel_dest.left * zoom / 1000, rectSel_dest.top * zoom / 1000,
               RECT_WIDTH(rectSel_dest) * zoom / 1000 + 6, RECT_HEIGHT(rectSel_dest) * zoom / 1000 + 6, TRUE);
    BringWindowToTop(hSelection);
    InvalidateRect(hImageArea, NULL, FALSE);
}
Exemplo n.º 8
0
void CPpcMainWnd::OnMouseMove(int fKey, int x, int y)
{
	if (m_fListDrag) {
		RECT rcItem;
		if (!ListView_GetItemRect(m_hwndLV, 0, &rcItem, LVIR_BOUNDS))
			return;

		POINT pt = {x, y};
		ClientToScreen(m_hWnd, &pt);
		ScreenToClient(m_hwndLV, &pt);

		RECT rcLV;
		GetClientRect(m_hwndLV, &rcLV);
		if (pt.y < RECT_HEIGHT(&rcItem)) {
			ListView_Scroll(m_hwndLV, 0, -RECT_HEIGHT(&rcItem));
			OnFileUp();
			m_nListDragItem = max(m_nListDragItem - 1, 0);
		}
		else if (pt.y > rcLV.bottom - RECT_HEIGHT(&rcItem)) {
			ListView_Scroll(m_hwndLV, 0, RECT_HEIGHT(&rcItem));
			OnFileDown();
			m_nListDragItem = min(m_nListDragItem + 1, ListView_GetItemCount(m_hwndLV) - 1);
		}
		else {
			LVHITTESTINFO lvhti;
			lvhti.pt.x = pt.x; 
			lvhti.pt.y = pt.y;
			int nItem = ListView_HitTest(m_hwndLV, &lvhti);
			if (nItem == -1)
				return;

			if (nItem - m_nListDragItem > 0) {
				for (int i = 0; i < nItem - m_nListDragItem; i++)
					OnFileDown();
				m_nListDragItem = nItem;
			}
			else if (nItem - m_nListDragItem < 0) {
				for (int i = 0; i < m_nListDragItem - nItem; i++)
					OnFileUp();
				m_nListDragItem = nItem;
			}
		}
	}
	else
		CMainWnd::OnMouseMove(fKey, x, y);
}
Exemplo n.º 9
0
static void Trak_read(int player, int *deltax, int *deltay)
{
    if (player != 0 || !This.m_bUseAxis)
    {
        *deltax = *deltay = 0;
        return;
    }

    GetCursorPos(&This.m_Pos);

    if (This.m_Rect.right < This.m_Pos.x)
    {
        This.m_Large.x++;
        This.m_Pos.x -= RECT_WIDTH(This.m_Rect);
        SetCursorPos(This.m_Pos.x, This.m_Pos.y);
    }
    else
    if (This.m_Pos.x < This.m_Rect.left)
    {
        This.m_Large.x--;
        This.m_Pos.x += RECT_WIDTH(This.m_Rect);
        SetCursorPos(This.m_Pos.x, This.m_Pos.y);
    }

    if (This.m_Rect.bottom < This.m_Pos.y)
    {
        This.m_Large.y++;
        This.m_Pos.y -= RECT_HEIGHT(This.m_Rect);
        SetCursorPos(This.m_Pos.x, This.m_Pos.y);
    }
    else
    if (This.m_Pos.y < This.m_Rect.top)
    {
        This.m_Large.y--;
        This.m_Pos.y += RECT_HEIGHT(This.m_Rect);
        SetCursorPos(This.m_Pos.x, This.m_Pos.y);
    }

    *deltax = ((This.m_Large.x * RECT_WIDTH(This.m_Rect))  + This.m_Pos.x - This.m_ptCenter.x);
    *deltay = ((This.m_Large.y * RECT_HEIGHT(This.m_Rect)) + This.m_Pos.y - This.m_ptCenter.y);

    This.m_Large.x = 0;
    This.m_Large.y = 0;
    SetCursorPos(This.m_ptCenter.x, This.m_ptCenter.y);
}
Exemplo n.º 10
0
void CPlayListDlg::OnMove(int x, int y)
{
	RECT rc;
	GetWindowRect(m_hWnd, &rc);

	RECT rcWork;
	SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWork, FALSE);

	int nLeft = rc.left;
	int nTop = rc.top;
	if (nLeft > rcWork.left - WINDOW_FIT_MARGIN && nLeft < rcWork.left + WINDOW_FIT_MARGIN)
		nLeft = rcWork.left;
	else if (nLeft + RECT_WIDTH(&rc) > rcWork.left + RECT_WIDTH(&rcWork) - WINDOW_FIT_MARGIN &&
			nLeft + RECT_WIDTH(&rc) < rcWork.left + RECT_WIDTH(&rcWork) + WINDOW_FIT_MARGIN)
		nLeft = rcWork.left + RECT_WIDTH(&rcWork) - RECT_WIDTH(&rc);

	if (nTop > rcWork.top - WINDOW_FIT_MARGIN && nTop < rcWork.top + WINDOW_FIT_MARGIN)
		nTop = rcWork.top;
	else if (nTop + RECT_HEIGHT(&rc) > rcWork.top + RECT_HEIGHT(&rcWork) - WINDOW_FIT_MARGIN &&
			nTop + RECT_HEIGHT(&rc) < rcWork.top + RECT_HEIGHT(&rcWork) + WINDOW_FIT_MARGIN)
		nTop = rcWork.top + RECT_HEIGHT(&rcWork) - RECT_HEIGHT(&rc);

	if (nLeft != rc.left || nTop != rc.top)
		MoveWindow(m_hWnd, nLeft, nTop, RECT_WIDTH(&rc), RECT_HEIGHT(&rc), TRUE);
}
Exemplo n.º 11
0
void CPlayListDlg::OnMouseMove(int x, int y)
{
	if (m_fListDrag) {
		RECT rcItem;
		HWND hwndLV = GetDlgItem(m_hWnd, IDC_PLAY_LIST);
		if (!ListView_GetItemRect(hwndLV, 0, &rcItem, LVIR_BOUNDS))
			return;

		POINT pt = {x, y};
		ClientToScreen(m_hWnd, &pt);
		ScreenToClient(hwndLV, &pt);

		RECT rcLV;
		GetClientRect(hwndLV, &rcLV);
		if (pt.y < RECT_HEIGHT(&rcItem)) {
			ListView_Scroll(hwndLV, 0, -RECT_HEIGHT(&rcItem));
			OnUp(FALSE);
			m_nDragItem = max(m_nDragItem - 1, 0);
		}
		else if (pt.y > rcLV.bottom - RECT_HEIGHT(&rcItem)) {
			ListView_Scroll(hwndLV, 0, RECT_HEIGHT(&rcItem));
			OnDown(FALSE);
			m_nDragItem = min(m_nDragItem + 1, ListView_GetItemCount(hwndLV) - 1);
		}
		else {
			LVHITTESTINFO lvhti;
			lvhti.pt.x = pt.x; 
			lvhti.pt.y = pt.y;
			int nItem = ListView_HitTest(hwndLV, &lvhti);
			if (nItem == -1)
				return;

			if (nItem - m_nDragItem > 0) {
				for (int i = 0; i < nItem - m_nDragItem; i++)
					OnDown(FALSE);
				m_nDragItem = nItem;
			}
			else if (nItem - m_nDragItem < 0) {
				for (int i = 0; i < m_nDragItem - nItem; i++)
					OnUp(FALSE);
				m_nDragItem = nItem;
			}
		}
	}
}
Exemplo n.º 12
0
void CRenderUtility::DrawImage( HDC hDC, Image* pImage, RECT &rctDst, RECT&rctSrc, int nAlpha /*= 255*/ )
{
	if(pImage == NULL || nAlpha == 0) return;

	float fAlpha = (float)nAlpha / 255.0f;
	Graphics	graph(hDC);
	ColorMatrix colorMatrix={1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
		0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
		0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
		0.0f, 0.0f, 0.0f, fAlpha, 0.0f,
		0.0f, 0.0f, 0.0f, 0.0f, 1.0f};

	ImageAttributes imgAtt;
	imgAtt.SetColorMatrix(&colorMatrix);

	Rect rcDst(rctDst.left, rctDst.top, RECT_WIDTH(rctDst), RECT_HEIGHT(rctDst));
	graph.DrawImage(pImage, rcDst, rctSrc.left, rctSrc.top, RECT_WIDTH(rctSrc), RECT_HEIGHT(rctSrc), UnitPixel, &imgAtt);
}
Exemplo n.º 13
0
PRIVATE GWorldPtr
gworld_from_pict (PicHandle ph)
{
  GWorldPtr retval;

  retval = NULL;
  if (ph)
    {
      CGrafPtr save_port;
      GDHandle save_device;
      Rect r;
      OSErr err;

      GetGWorld (&save_port, &save_device);
      save_port = MR (save_port);
      save_device = MR (save_device);
      r = HxX (ph, picFrame);
      err = NewGWorld (&retval, 32, &r, NULL, NULL, keepLocal);
      if (retval)
	{
	  PixMapHandle pm;

	  retval = MR (retval);
	  SetGWorld (retval, NULL);
	  pm = GetGWorldPixMap (retval);
	  LockPixels (pm);
	  DrawPicture (ph, &r);
#if 0
#warning THIS INTERFERES WITH PICT PASTING
	  {
	    char *p;

	    EraseRect (&r);
	    p = GetPixBaseAddr (pm);
	    memset (p, 0x00, 4 * RECT_HEIGHT(&r) * RECT_WIDTH (&r));
	    memset (p, 0xFF, 4 * RECT_HEIGHT(&r) * RECT_WIDTH (&r) / 2);
	  }
#endif
	  UnlockPixels (pm);
	}
      SetGWorld (save_port, save_device);
    }
  return retval;
}
Exemplo n.º 14
0
	// 应用程序的初始化
	virtual BOOL Init()
	{
		// 初始化 COM 组件
		CoInitializeEx(0, COINIT_MULTITHREADED);

		// 创建主窗口
		RECT rcWork = MzGetWorkArea();
		m_MainWnd.Create(rcWork.left,rcWork.top,RECT_WIDTH(rcWork),RECT_HEIGHT(rcWork), 0, 0, 0);
		m_MainWnd.Show();

		// 成功则返回TRUE
		return TRUE;
	}
Exemplo n.º 15
0
void frame::paint( HDC dc, RECT const& rt, unsigned int const lineHeight ) {
	bridge::lines_t lines;
	this->console2Proxy.getLines( lines );
	//
	size_t view_lines = RECT_HEIGHT(rt) / lineHeight;
	size_t total_lines = lines.size();
	//
	int y = 0;
	for ( size_t i = ( view_lines < total_lines )?( total_lines - view_lines ):( 0 ); i < total_lines; i++ ) {
		TextOut( dc, rt.left, rt.top + y, lines[i].c_str(), lines[i].length() );
		y += lineHeight;
	}
}
Exemplo n.º 16
0
CCacheDC::CCacheDC(HDC hDC, RECT& rcPaint):
m_hOriginal(hDC),
m_rcPaint(rcPaint)
{
	CreateCompatibleDC(m_hOriginal);
	ATLASSERT(m_hDC != NULL);

	HBITMAP hBmp = CreateCompatibleBitmap(hDC,RECT_WIDTH(rcPaint),RECT_HEIGHT(rcPaint));
	m_hCanvasBmp.Attach(hBmp);
	ATLASSERT(m_hCanvasBmp.m_hBitmap != NULL);

	m_hOldBmp = SelectBitmap(m_hCanvasBmp);
}
Exemplo n.º 17
0
// 转屏后如果需要调整窗口的位置,重载此函数响应 WM_SETTINGCHANGE 消息
void CNewSmsWnd::OnSettingChange(DWORD wFlag, LPCTSTR pszSectionName)
{
  //设置新的屏幕方向的窗口大小及控件位置
  DEVMODE  devMode;
  memset(&devMode, 0, sizeof(DEVMODE));
  devMode.dmSize = sizeof(DEVMODE);
  devMode.dmFields = DM_DISPLAYORIENTATION;
  ChangeDisplaySettingsEx(NULL, &devMode, NULL, CDS_TEST, NULL);

 //竖屏
  if (devMode.dmDisplayOrientation == DMDO_90 || devMode.dmDisplayOrientation == DMDO_270)
  {
		g_bH = TRUE;
		RECT rc = MzGetWorkArea();
		//modify begin by zhaodsh  2010/03/21 12:27
		//SetWindowPos(m_hWnd, rc.left, rc.top,RECT_HEIGHT(rc)+rc.top, RECT_WIDTH(rc)  );
		SetWindowPos(m_hWnd, rc.left, rc.top,RECT_WIDTH(rc), RECT_HEIGHT(rc) );
		// modify end 2010/03/21 12:27
		
		m_Recievers.SetPos(2, 0, GetWidth()-BUTTON_WIDTH_V-2, BUTTON_HEIGHT_VH);

		m_SmsMsgEdit->SetPos(2, m_Recievers.GetHeight()+3, GetWidth()-4, (GetHeight()-m_Recievers.GetHeight()));

		m_SendSmsBtn.SetPos((GetWidth()-BUTTON_WIDTH_V),0,BUTTON_WIDTH_V-2,BUTTON_HEIGHT_VH);
  }

  //横屏
	if (devMode.dmDisplayOrientation == DMDO_180 || devMode.dmDisplayOrientation == DMDO_0)
	{
		g_bH = FALSE;
		RECT rc = MzGetWorkArea();
		SetWindowPos(m_hWnd, rc.left, rc.top,RECT_WIDTH(rc), RECT_HEIGHT(rc) );
		m_Recievers.SetPos(2, 0, GetWidth()-BUTTON_WIDTH_H-2, BUTTON_HEIGHT_VH);

		m_SmsMsgEdit->SetPos(2, m_Recievers.GetHeight()+3, GetWidth()-4, (GetHeight()-m_Recievers.GetHeight()));

		m_SendSmsBtn.SetPos((GetWidth()-BUTTON_WIDTH_H),0,BUTTON_WIDTH_H-2,BUTTON_HEIGHT_VH);
	}
}
Exemplo n.º 18
0
void QTCode_PositionMovieRectInClientWindow(Movie	theMovie,
											HWND	hwnd)
{
	Rect movieBounds;

	GetMovieBox(theMovie, &movieBounds);

	CenterMovieRectInWindow(hwnd,					/* window where we are placing the image */
							RECT_WIDTH(movieBounds), RECT_HEIGHT(movieBounds),	/* width, height, of the image */
							&movieBounds			/* on output, a Mac Rect centered in the window */
							);

	SetMovieBox(theMovie, &movieBounds);
}
Exemplo n.º 19
0
void CLapPainter::DrawSelectLapsPrompt() const
{
  RECT rcClient;
  GetClientRect(OGL_GetHWnd(),&rcClient);

  glPushMatrix();
  glLoadIdentity();
  glScalef(1.0f, 0.90f, 1.0f);	//	Keep the same scaling - KDJ
  glOrtho(0, RECT_WIDTH(&rcClient),0, RECT_HEIGHT(&rcClient),-1.0,1.0);

  DrawText(20.0, 20, "No laps selected.  Select some laps in the lap list");

  glPopMatrix();
}
Exemplo n.º 20
0
static int
ui_window_get_placement(lua_State* L)
{
	HWND hwnd = NULL;
	RECT rect;
	Crj_ParseArgs(L, "| u", &hwnd);
	hwnd = GetTargetWindow(hwnd);

	GetWindowRect(hwnd, &rect);
	lua_pushinteger(L, RECT_X(rect));
	lua_pushinteger(L, RECT_Y(rect));
	lua_pushinteger(L, RECT_WIDTH(rect));
	lua_pushinteger(L, RECT_HEIGHT(rect));
	return 4;
}
Exemplo n.º 21
0
	// 窗口的初始化
	virtual BOOL OnInitDialog()
	{
		// 必须先调用基类的初始化
		if (!CMzWndEx::OnInitDialog())
		{
			return FALSE;
		}

		//开启acc功能
		MzAccOpen();  

		//获取XYZ轴加速度值 1 == 18mg, 56 == 1g 
		//注意以下几点, 
		//1 要先调用MzAccGetXYZ,再调用
		//MzAccGetX/MzAccGetY/MzAccGetZ后,才能获得正确的值
		//2 获得的加速度值范围是-55~+55, 绝对值起大,加速度越大. 
		//
		MzAccGetXYZ(&m_XAxis, &m_YAxis, &m_ZAxis);

		MzAccGetX(&m_XAxis);
		//获得Y轴加速度
		MzAccGetY(&m_YAxis);
		MzAccGetZ(&m_ZAxis);

		RECT rRect = MzGetWorkArea();

		m_XButton.SetPos(0, 0, 150, 100);
		AddUiWin(&m_XButton);

		m_nMaxXPos = RECT_WIDTH(rRect) - m_XButton.GetWidth();
		m_nMinXPos = 0;

		m_nMaxYPos = RECT_HEIGHT(rRect) - m_XButton.GetHeight();
		m_nMinYPos = 0;

		SetTimer(m_hWnd, 10, 10, NULL);  

		//设置初始的速度和位置
		m_XPos = m_nMinXPos;
		m_YPos = m_nMinYPos;

		m_YSpeed = 0;
		m_XSpeed = 0;

		m_nCount = 0;

		return TRUE;
	}
Exemplo n.º 22
0
void ShellResizeEditCtrlWidth(HWND hwndEdit)
{
#ifdef _WIN32_WCE_PPC
    POINT pt;
    RECT rc;
    int nWidth;

    GetWindowRect(GetParent(hwndEdit), &rc);
    nWidth = RECT_WIDTH(&rc);
    GetWindowRect(hwndEdit, &rc);
    pt.x = rc.left;
    pt.y = rc.top;
    ScreenToClient(GetParent(hwndEdit), &pt);
    MoveWindow(hwndEdit, pt.x, pt.y, nWidth - pt.x * 2, RECT_HEIGHT(&rc), TRUE);
#endif
}
Exemplo n.º 23
0
void MzBarDecoder::GrayImage(RECT *prcRegion){
    int i,j;
    RECT rc;
    if(prcRegion == NULL){
        rc.left = 0; rc.right = m_dib.GetImageWidth();
        rc.top = 0; rc.bottom = m_dib.GetImageHeight();
        ImageWidth = m_dib.GetWidth();
        ImageHeight = m_dib.GetHeight();
    }else{
        rc.left = prcRegion->left; rc.right = prcRegion->right;
        rc.top = prcRegion->top; rc.bottom = prcRegion->bottom;
        ImageWidth = RECT_WIDTH(rc);
        ImageHeight = RECT_HEIGHT(rc);
    }

    BYTE    *colorTable;   
    colorTable = m_dib.GetBits(&rc);   

    int byteBitCount  = m_dib.GetBiBitCount()/8;

    m_tOriPixelArray  = new RGBQUAD*[ImageHeight];

    ImageArray = new BYTE*[ImageHeight];
    for(int l = 0 ; l < ImageHeight; l++) {
        m_tOriPixelArray[l] = new RGBQUAD[ImageWidth];
        ImageArray[l] = new BYTE[ImageWidth];
    }
    int count=0;
    for(i = ImageHeight-1; i >= 0; i--)
    {
        for(j = 0; j < ImageWidth; j++)
        {
            m_tOriPixelArray[i][j].rgbBlue = colorTable[count++];
            m_tOriPixelArray[i][j].rgbGreen = colorTable[count++]; 
            m_tOriPixelArray[i][j].rgbRed = colorTable[count++]; 
            m_tOriPixelArray[i][j].rgbReserved=0;
            //灰度化
            ImageArray[i][j] = (BYTE)((
                (unsigned int)m_tOriPixelArray[i][j].rgbBlue*11 + 
                (unsigned int)m_tOriPixelArray[i][j].rgbGreen*59 +
                (unsigned int)m_tOriPixelArray[i][j].rgbRed*30
                ) / 100);
            count += byteBitCount-3;
        }
		count += (4-(ImageWidth*byteBitCount)%4)%4;
    }
}
Exemplo n.º 24
0
bool RMMMobileObject::mobileOutOfScene() {
    int pixelTolerance = 3;
    double R;
    Rectangle<int> r = multiModel.binterface.bbox;
    int
        X = RECT_XCENTER(&r),
        Y = RECT_YCENTER(&r),
        W_2 = RECT_WIDTH(&r) / 2,
        H_2 = RECT_HEIGHT(&r) / 2;
    if(X + W_2 < pixelTolerance || X - W_2 > m_data->currentImage->width() - pixelTolerance || Y + H_2 < pixelTolerance || Y - H_2 > m_data->currentImage->height() - pixelTolerance )
        return true;

    //If some while present, but lost for a while, assume it is out.
    if(   numberOfFramesSinceFirstTimeSeen > m_blobsBufferSize
        && numberOfFramesNotSeen > numberOfFramesSinceFirstTimeSeen  )
        return true;
    return false;
}
Exemplo n.º 25
0
PRIVATE SDL_Surface *
surface_from_gworld (GWorldPtr gp)
{
  SDL_Surface *retval;

  if (!gp)
    retval = NULL;
  else
    {
      int pixels_per_line;
      int n_lines;
      PixMapHandle pm;
      enum { A = 0x00000000,
	     R = 0x0000FF00,
	     G = 0x00FF0000,
	     B = 0xFF000000 };
      mac_pixel32 *ip;
      sdl_pixel24 *op;
      Rect r;

      pm = GetGWorldPixMap (gp);
      LockPixels (pm);

      r = PIXMAP_BOUNDS (pm);
      n_lines = RECT_HEIGHT (&r);
      pixels_per_line = RECT_WIDTH (&r);
      retval = SDL_AllocSurface (SDL_SWSURFACE, pixels_per_line, n_lines, 32,
				 R, G, B, A);
      SDL_LockSurface (retval);
      op = SDL_Surface_pixels (retval);
      ip = (typeof (ip)) GetPixBaseAddr (pm);
      memcpy (op, ip, n_lines * pixels_per_line * sizeof *ip);
#if 0
#warning THIS IS BROKEN
      memset (op, 0x00, 4 * n_lines * pixels_per_line);
      memset (op, 0xFF, 4 * n_lines * pixels_per_line / 2);
#endif
      SDL_UnlockSurface (retval);
      UnlockPixels (pm);
    }

  return retval;
}
Exemplo n.º 26
0
  /* 应用程序的初始化*/
  virtual BOOL Init()
  {
	/* 初始化 COM 组件*/
    CoInitializeEx(0, COINIT_MULTITHREADED);

	/* 创建主窗口*/
    RECT rcWork = MzGetWorkArea();
    m_LoginWnd.Create(rcWork.left,rcWork.top,RECT_WIDTH(rcWork),RECT_HEIGHT(rcWork), 0, 0, 0);
    if(MzGetParam(MZGP_APP_START_ANIMATION)==TRUE){
	    m_LoginWnd.AnimateWindow(MZ_ANIMTYPE_ZOOM_IN,true);

	// m_LoginWnd.SetShellHomekeyReturnValue(SHK_RET_APPNOEXIT_SHELLTOP);
	    m_LoginWnd.Show();

	    //m_LoginWnd.SetBgColor(RGB(0,0,0));

    }

	/* 成功则返回TRUE*/
    return TRUE;
  }
Exemplo n.º 27
0
// 移动、设置控件位置
void ICtrlTabBarImpl::OnSize()
{
	RECT ClientRct = this->GetWindowRect();
	if (IS_RECT_EMPTY(ClientRct) || (int)m_ButtonVec.size() <= 0)
		return;

	int nW = RECT_WIDTH(ClientRct) / ((int)m_ButtonVec.size());
	int nH = RECT_HEIGHT(ClientRct);

	POINT BeginPt = {ClientRct.left, ClientRct.top};
	for (BUTTON_VEC::iterator pItem = m_ButtonVec.begin(); pItem != m_ButtonVec.end(); pItem++)
	{
		ICtrlButton* pButton = *pItem;
		if (pButton == NULL)
			continue;

		RECT BtnRct;
		SET_RECT_WH(BtnRct, BeginPt.x, BeginPt.y, nW, nH);
		pButton->SetControlLayoutType(CL_L_USER_DEF);
		pButton->SetWindowRect(BtnRct, true);
		BeginPt.x += nW;
	}
}
Exemplo n.º 28
0
void CLapPainter::OGL_Paint()
{
  if (m_pLapSupplier->GetDisplayOptions().fColorScheme)
  {
		glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );  //  Background color is black.
  }
  else
  {
		glClearColor( 0.95f, 0.95f, 0.95f, 0.95f );  //  Background color is grey.
  }
  glClear( GL_COLOR_BUFFER_BIT );
  
  RECT rcClient;
  GetClientRect(OGL_GetHWnd(), &rcClient);
  
  LAPDISPLAYSTYLE eDisplayStyle = m_pLapSupplier->GetLapDisplayStyle(m_iSupplierId);
  const LAPSUPPLIEROPTIONS& sfLapOpts = m_pLapSupplier->GetDisplayOptions();
  switch(eDisplayStyle)
  {
  case LAPDISPLAYSTYLE_MAP:
    glViewport(0,0,RECT_WIDTH(&rcClient), RECT_HEIGHT(&rcClient));
    DrawLapLines(sfLapOpts);	//	Draws the lap as a map on primary display
    break;
  case LAPDISPLAYSTYLE_PLOT:
    DrawGeneralGraph(sfLapOpts, true);	//	Draws the data graphs on the primary display
    break;
  case LAPDISPLAYSTYLE_RECEPTION:
    DrawReceptionMap(sfLapOpts);	//	Draws the reception map on the primary display
    break;
  case LAPDISPLAYSTYLE_NOLAPS:
    // user doesn't have any laps selected, so we should tell them to select some
    DrawSelectLapsPrompt();
    break;
  }
  
	SwapBuffers( OGL_GetDC() );
}
Exemplo n.º 29
0
BOOL CALLBACK CPlayListDlg::PlayListDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	static CPlayListDlg* pDlg;
	switch (uMsg) {
	case WM_INITDIALOG:
		pDlg = (CPlayListDlg*)lParam;
		pDlg->OnInitDialog(hwndDlg);
		return TRUE;
	case WM_COMMAND:
		switch (LOWORD(wParam)) {
			case IDCANCEL:
				pDlg->Close();
				return TRUE;
			case IDOK:
			case IDM_PLAY_SELECTED:
				pDlg->OnOK();
				return TRUE;
			case IDC_DELETE:
			case IDM_FILE_DELETE:
				pDlg->OnDelete();
				return TRUE;
			case IDC_UP:
			case IDM_FILE_UP:
				pDlg->OnUp();
				return TRUE;
			case IDC_DOWN:
			case IDM_FILE_DOWN:
				pDlg->OnDown();
				return TRUE;
			case IDC_ADD:
				pDlg->OnAdd();
				return TRUE;
			case IDC_SAVE:
				pDlg->OnSave();
				return TRUE;
			case IDC_CTRLKEY:
				pDlg->OnCtrlKey();
				return TRUE;
			case IDM_FILE_SORT_BYNAME:
			case IDM_FILE_SORT_BYPATH:
				pDlg->OnSort(LOWORD(wParam));
				return TRUE;
		}
		return FALSE;
	case WM_CLOSE:
		pDlg->Close();
		return TRUE;
	case WM_DESTROY:
		pDlg->m_hWnd = NULL;
		return TRUE;
	case WM_MOVE:
		pDlg->OnMove(LOWORD(lParam), HIWORD(lParam));
		return TRUE;
	case WM_NOTIFY:
	{
		NMHDR* pnmh = (NMHDR*)lParam;
		switch (pnmh->code) {
		case LVN_KEYDOWN:
			pDlg->OnListKeyDown((NMLVKEYDOWN*)pnmh);
			return TRUE;
		case NM_DBLCLK:
			pDlg->OnListDblClk(pnmh);
			return TRUE;
		case LVN_BEGINDRAG:
			pDlg->OnListBeginDrag((NMLISTVIEW*)pnmh);
			return TRUE;
		case NM_RETURN:
			pDlg->OnOK();
			return TRUE;
		case GN_CONTEXTMENU:
			pDlg->OnContextMenu((NMRGINFO*)pnmh);
			return TRUE;
		}
		return FALSE;
	}
	case WM_MOUSEMOVE:
		pDlg->OnMouseMove((short)LOWORD(lParam), (short)HIWORD(lParam));
		return TRUE;
	case WM_LBUTTONUP:
	case WM_RBUTTONUP:
		pDlg->OnLButtonUp();
		return TRUE;
	case WM_CTLCOLORSTATIC:
		return DefDlgCtlColorStaticProc(hwndDlg, wParam, lParam);
	case WM_SIZE:
	{
		RECT rc;
		HWND hwnd;
		POINT pt;

		hwnd = GetDlgItem(hwndDlg, IDCANCEL);
		GetWindowRect(hwnd, &rc);
		pt.x = rc.left; pt.y = rc.top;
		ScreenToClient(hwndDlg, &pt);
		MoveWindow(hwnd, LOWORD(lParam) - RECT_WIDTH(&rc) - 2, pt.y, RECT_WIDTH(&rc), RECT_HEIGHT(&rc), TRUE);

		hwnd = GetDlgItem(hwndDlg, IDC_PLAY_LIST);
		GetWindowRect(hwnd, &rc);
		pt.x = rc.left; pt.y = rc.top;
		ScreenToClient(hwndDlg, &pt);
		MoveWindow(hwnd, pt.x, pt.y, LOWORD(lParam) - pt.x * 2, HIWORD(lParam) - pt.y - pt.x, TRUE);

		GetWindowRect(hwnd, &rc);
		SendMessage(hwnd, LVM_SETCOLUMNWIDTH, 0, 
			MAKELPARAM(RECT_WIDTH(&rc) - GetSystemMetrics(SM_CXVSCROLL) - GetSystemMetrics(SM_CXBORDER) * 2, 0));
	}
	default:
		return FALSE;
	}
}
Exemplo n.º 30
0
void badge::onMouseMove(HWND hWnd, int x, int y, UINT state){
	if (this->inputIsCaptured(mouse)){
		POINT cPoint;
		cPoint.x = x;
		cPoint.y = y;
		MapWindowPoints(this->getHWND(), NULL, &cPoint, 1);
		//
		MoveWindow(this->getHWND(), startRect.left + (cPoint.x - startPoint.x), startRect.top + (cPoint.y - startPoint.y), RECT_WIDTH(startRect), RECT_HEIGHT(startRect), TRUE);
	}
}