コード例 #1
0
ファイル: vis_spectrum.cpp プロジェクト: ttsping/columns_ui
	static void g_register_stream(spectrum_extension * p_ext)
	{
		if (!g_visualisations.have_item(p_ext))
		{
			//console::printf("registering %x",p_ext);
			if (g_visualisations.add_item(p_ext) == 0)
			{
				//static_api_ptr_t<visualisation_manager>()->create_stream(g_stream, NULL);
				g_create_timer();
			}
		}
	}
コード例 #2
0
ファイル: vis_spectrum.cpp プロジェクト: bolonik/columns_ui
void spectrum_extension::enable( const ui_extension::visualisation_host_ptr & p_vis_host)
{
	p_host = p_vis_host;
	b_active = true;

	const unsigned cx_dpi = QueryScreenDPIEx().cx;
	m_bar_width = MulDiv(cx_dpi, 3, 96);
	m_bar_gap = MulDiv(cx_dpi, 1, 96);
	
	if (list_vis.add_item(this) == 0)
		static_api_ptr_t<visualisation_manager>()->create_stream(g_stream, NULL);

	static_api_ptr_t<play_callback_manager>()->register_callback(this, play_callback::flag_on_playback_new_track|play_callback::flag_on_playback_stop|play_callback::flag_on_playback_pause, false);
	if (static_api_ptr_t<play_control>()->is_playing())
		g_register_stream(this);
}
コード例 #3
0
ファイル: vis_spectrum.cpp プロジェクト: ttsping/columns_ui
void spectrum_extension::enable( const ui_extension::visualisation_host_ptr & p_vis_host)
{
	p_host = p_vis_host;
	b_active = true;

	const unsigned cx_dpi = QueryScreenDPIEx().cx;
	m_bar_width = MulDiv(cx_dpi, 3, 96);
	m_bar_gap = MulDiv(cx_dpi, 1, 96);
	
	if (list_vis.add_item(this) == 0)
	{
		static_api_ptr_t<visualisation_manager>()->create_stream(g_stream, visualisation_manager::KStreamFlagNewFFT);
		visualisation_stream_v2::ptr p_stream_v2;
		if (g_stream->service_query_t(p_stream_v2))
			p_stream_v2->set_channel_mode(visualisation_stream_v2::channel_mode_mono);
	}

	static_api_ptr_t<play_callback_manager>()->register_callback(this, play_callback::flag_on_playback_new_track|play_callback::flag_on_playback_stop|play_callback::flag_on_playback_pause, false);
	if (static_api_ptr_t<play_control>()->is_playing())
		g_register_stream(this);
}
コード例 #4
0
ファイル: library.cpp プロジェクト: 9060/columns_ui
		void library_callback_multiplex_t::register_callback (library_callback_t * p_callback)
		{
			m_callbacks.add_item(p_callback);
		}
コード例 #5
0
ファイル: main.cpp プロジェクト: andinue/foo_alsong_lyric
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);
}