void CTutorialWindow::Draw(HDC hdc, CRect rcPaint) {
	// We will paint the background in the default window color.
	HBRUSH hBrush = GetSysColorBrush(COLOR_WINDOW);
	FillRect(hdc, rcPaint, hBrush);

	HICON hIcon = static_api_ptr_t<ui_control>()->get_main_icon();
	if (hIcon != NULL) {
		DrawIconEx(hdc, 2, 2, hIcon, 32, 32, 0, hBrush, DI_NORMAL);
	}

	try
	{
		static_api_ptr_t<play_control> pc;
		metadb_handle_ptr handle;;
		if (pc->get_now_playing(handle)) {
			pfc::string8 format;
			g_advconfig_string_format.get_static_instance().get_state(format);
			service_ptr_t<titleformat_object> script;
			static_api_ptr_t<titleformat_compiler>()->compile_safe(script, format);

			pfc::string_formatter text;
			pc->playback_format_title_ex(handle, NULL, text, script, NULL, play_control::display_level_titles);
			HFONT hFont = m_font;
			if (hFont == NULL)
				hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
			SelectObject(hdc, hFont);
			SetTextAlign(hdc, TA_TOP | TA_LEFT);
			uExtTextOut(hdc, 32+4, 2, ETO_CLIPPED, rcPaint, text, text.length(), 0);
		}
	}
	catch (const std::exception & exc) {
		console::formatter() << "Exception occurred while drawing " TUTORIAL " window:\n" << exc;
	}
}
Ejemplo n.º 2
0
BOOL uDrawPanelTitle(HDC dc, const RECT * rc_clip, const char * text, int len, bool vert, bool world)
{
	COLORREF cr_back = GetSysColor(COLOR_3DFACE);
	COLORREF cr_fore=GetSysColor(COLOR_MENUTEXT);
	COLORREF cr_line=GetSysColor(COLOR_3DSHADOW);

	{
		SetBkMode(dc,TRANSPARENT);
		SetTextColor(dc, cr_fore);

		SIZE sz;
		uGetTextExtentPoint32(dc, text, len, &sz);
		int extra = vert ? rc_clip->bottom - sz.cy: (rc_clip->bottom - rc_clip->top - sz.cy -1)/2;
		/*
		if (world)
		{
		SetGraphicsMode(dc, GM_ADVANCED);
		XFORM xf;
		xf.eM11 = 0;
		xf.eM21 = 1;
		xf.eDx = 0;
		xf.eM12 = -1;
		xf.eM22 = 0;
		xf.eDy = rc_clip->right;
		SetWorldTransform(dc, &xf); 
		}
		*/
		//		HFONT old = SelectFont(dc, fnt_menu);

		uExtTextOut(dc, 5+rc_clip->left, extra, ETO_CLIPPED, rc_clip, text, len, 0);
		//		SelectFont(dc, old);

		return TRUE;
	}
	return FALSE;
}