void playlists_dropdown::fonts_callback_impl::on_font_changed() const {
	g_update_all_fonts();
	g_update_all_sizes();
	g_redraw_all();
}
示例#2
0
LRESULT console_window::on_message(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
{

	switch(msg)
	{
	case WM_CREATE:
		{
			/**
			* Store a pointer to ourselve in this list, used for global notifications (in the main thread)
			* which updates instances of our panel.
			*/
			list_wnd.add_item(this);
			{
				insync(sync);
				/** Store a window handle in this list, used in global notifications (in any thread) which
				* updates the panels */
				g_notify_list.add_item(wnd);
			}

			long flags = 0;
			if (cfg_frame == 1) flags |= WS_EX_CLIENTEDGE;
			else if (cfg_frame == 2) flags |= WS_EX_STATICEDGE;

			/** Create our edit window */
			wnd_edit = CreateWindowEx(flags, WC_EDIT, _T(""),
				WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOVSCROLL | WS_VSCROLL | ES_READONLY | ES_MULTILINE, 0, 0, 0, 0,
				wnd, HMENU(IDC_EDIT), core_api::get_my_instance(), NULL);

			if (wnd_edit)
			{
				if (g_font)
				{
					/** Nth, n>1, instance; use exisiting font handle */
					SendMessage(wnd_edit,WM_SETFONT,(WPARAM)g_font,MAKELPARAM(0,0));
				}
				else
					/** First window - create the font handle */
					g_update_all_fonts();

				/** Store a pointer to ourself in the user data field of the edit window */
				SetWindowLongPtr(wnd_edit,GWL_USERDATA,(LPARAM)(this));
				/** Subclass the edit window */
				m_editproc = (WNDPROC)SetWindowLongPtr(wnd_edit,GWL_WNDPROC,(LPARAM)(hook_proc));

				SendMessage(wnd, MSG_UPDATE, 0, 0);
			}
		}
		break;
	/** Update the edit window's text */
	case MSG_UPDATE:
		{
			insync(sync);
			pfc::string8_fastalloc buffer;
			buffer.prealloc(1024);
			unsigned n, count = g_messages.get_count();
			for (n=0; n<count; n++)
			{
				buffer << "[" << pfc::format_int(g_messages[n].m_time.wHour, 2)
					<< ":" << pfc::format_int(g_messages[n].m_time.wMinute, 2)
					<< ":" << pfc::format_int(g_messages[n].m_time.wSecond, 2)
					<< "] " << g_messages[n].m_message;
#if 0				
				buffer.add_string(pfc::string_printf("[%02u:%02u:%02u] ",(unsigned)g_messages[n].m_time.wHour
					,(unsigned)g_messages[n].m_time.wMinute
					,(unsigned)g_messages[n].m_time.wSecond));
				buffer.add_string(g_messages[n].m_message);
				//if (n != count-1)
				//	buffer.add_string("\r\n",2);
#endif
			}
			uSetWindowText(wnd_edit, buffer);
			LONG_PTR len = SendMessage(wnd_edit, EM_GETLINECOUNT , 0, 0);
			SendMessage(wnd_edit, EM_LINESCROLL , 0, len);
		}
		break;
	case WM_GETMINMAXINFO:
		break;
	case WM_SIZE:
		/** Reposition the edit window. */
		SetWindowPos(wnd_edit, 0, 0, 0, LOWORD(lp), HIWORD(lp), SWP_NOZORDER);
		break;
	case WM_ERASEBKGND:
		return FALSE;
	case WM_DESTROY:
		{
			wnd_edit=0;
			list_wnd.remove_item(this);
			SendMessage(wnd_edit,WM_SETFONT,NULL,MAKELPARAM(0,0));
			if (list_wnd.get_count() == 0)
			{
				DeleteFont(g_font);
				g_font = 0;
			}
			{
				insync(sync);
				g_notify_list.remove_item(wnd);
			}
		}
		break;
	}
	return DefWindowProc(wnd, msg, wp, lp);
}