Exemplo n.º 1
0
	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();
			}
		}
	}
Exemplo n.º 2
0
static void file_list_remove_duplicates(pfc::ptr_list_t<char> & out)
{
	t_size n, m = out.get_count();
	out.sort_t(metadb::path_compare);
	bit_array_bittable mask(m);
	t_size duplicates = 0;
	for(n=1;n<m;n++) {
		if (!metadb::path_compare(out[n-1],out[n])) {duplicates++;mask.set(n,true);}
	}
	if (duplicates>0) {
		out.free_mask(mask);
	}
}
Exemplo n.º 3
0
void spectrum_extension::disable()
{
	b_active = false;

	list_vis.remove_item(this);

	static_api_ptr_t<play_callback_manager>()->unregister_callback(this);
	if (static_api_ptr_t<play_control>()->is_playing())
		g_deregister_stream(this);

	if (!list_vis.get_count())
		g_stream.release();

	p_host.release();
}
Exemplo n.º 4
0
	static void g_deregister_stream(spectrum_extension * p_ext, bool b_paused = false)
	{
		//console::printf("deregistering %x",p_ext);
		g_visualisations.remove_item(p_ext);
		if (!g_visualisations.get_count())
		{
			g_destroy_timer();
			//g_stream.release();
		}
		if (!b_paused)
		{
			if (p_ext->b_active)
				p_ext->clear();
			p_ext->flush_brushes();
		}
	}
Exemplo n.º 5
0
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);
}
Exemplo n.º 6
0
void console_window::update_all_window_frames()
{
	unsigned n, count = list_wnd.get_count();
	long flags = 0;
	if (cfg_frame == 1) flags |= WS_EX_CLIENTEDGE;
	if (cfg_frame == 2) flags |= WS_EX_STATICEDGE;

	for (n=0; n<count; n++)
	{
		HWND wnd = list_wnd[n]->wnd_edit;
		if (wnd)
		{
			SetWindowLongPtr(wnd, GWL_EXSTYLE, flags);
			SetWindowPos(wnd,0,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
		}
	}
}
Exemplo n.º 7
0
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);
}
Exemplo n.º 8
0
	static bool g_is_stream_active(spectrum_extension * p_ext)
	{
		return g_visualisations.have_item(p_ext);
	}
Exemplo n.º 9
0
		void library_callback_multiplex_t::on_items_modified(const pfc::list_base_const_t<metadb_handle_ptr> & p_data)
		{
			t_size i, count = m_callbacks.get_count();
			for (i=0; i<count; i++)
				m_callbacks[i]->on_items_modified(p_data);
		}
Exemplo n.º 10
0
		void library_callback_multiplex_t::deregister_callback (library_callback_t * p_callback)
		{
			m_callbacks.remove_item(p_callback);
		}
Exemplo n.º 11
0
		void library_callback_multiplex_t::register_callback (library_callback_t * p_callback)
		{
			m_callbacks.add_item(p_callback);
		}
Exemplo n.º 12
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);
}