示例#1
1
LRESULT menu_extension::on_message(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
{
	switch (msg) 
	{
		case WM_CREATE:
		{
			initialised = true;

			mainmenu_root_group::g_get_root_items(m_buttons);
			t_size button_count = m_buttons.get_count();

			pfc::array_t<TBBUTTON> tbb;
			tbb.set_size(button_count);
			memset(tbb.get_ptr(), 0, tbb.get_size() * sizeof(TBBUTTON));

			wnd_menu = CreateWindowEx(/*TBSTYLE_EX_MIXEDBUTTONS|*/WS_EX_TOOLWINDOW, TOOLBARCLASSNAME, NULL,
				WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_LIST | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER,
				0, 0, 0, 25, wnd, (HMENU)ID_MENU, core_api::get_my_instance(), NULL);

			if (wnd_menu)
			{
				SetWindowLongPtr(wnd_menu, GWLP_USERDATA, (LPARAM)(this));

				SendMessage(wnd_menu, TB_SETBITMAPSIZE, (WPARAM)0, MAKELONG(0, 0));
				SendMessage(wnd_menu, TB_SETBUTTONSIZE, (WPARAM)0, MAKELONG(0,/*GetSystemMetrics(SM_CYMENUSIZE)*/0));

				SendMessage(wnd_menu, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0);

				unsigned n, count = tbb.get_size();
				for (n = 0; n < count; n++)
				{
					tbb[n].iBitmap = I_IMAGECALLBACK;
					tbb[n].idCommand = n + 1;
					tbb[n].fsState = TBSTATE_ENABLED;
					tbb[n].fsStyle = BTNS_DROPDOWN | BTNS_AUTOSIZE;
					tbb[n].dwData = 0;
					tbb[n].iString = (int)m_buttons[n].m_name_with_accelerators.get_ptr();
				}

				SendMessage(wnd_menu, TB_ADDBUTTONS, (WPARAM)tbb.get_size(), (LPARAM)(LPTBBUTTON)tbb.get_ptr());

				//			SendMessage(wnd_menu, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS);

				//			SendMessage(wnd_menu, TB_AUTOSIZE, 0, 0); 

							//if (is_win2k_or_newer())
				{
					BOOL a = true;
					SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &a, 0);
					SendMessage(wnd_menu, WM_UPDATEUISTATE, MAKEWPARAM(a ? UIS_CLEAR : UIS_SET, UISF_HIDEACCEL), 0);
				}

				//			SendMessage(wnd_menu, TB_SETPARENT, (WPARAM) (HWND)wnd_host, 0);
				menuproc = (WNDPROC)SetWindowLongPtr(wnd_menu, GWLP_WNDPROC, (LPARAM)main_hook);
			}


			break;
		}
		case WM_WINDOWPOSCHANGED:
		{
			LPWINDOWPOS lpwp = (LPWINDOWPOS)lp;
			if (!(lpwp->flags & SWP_NOSIZE))
			{
				//SIZE sz = {0,0};
				//SendMessage(wnd_menu, TB_GETMAXSIZE, NULL, (LPARAM)&sz);

				RECT rc = { 0,0,0,0 };
				t_size count = m_buttons.get_count();
				int cx = lpwp->cx;
				int cy = lpwp->cy;
				int extra = 0;
				if (count && (BOOL)SendMessage(wnd_menu, TB_GETITEMRECT, count - 1, (LPARAM)(&rc)))
				{
					cx = min(cx, rc.right);
					cy = min(cy, rc.bottom);
					extra = (lpwp->cy - rc.bottom) / 2;
				}
				SetWindowPos(wnd_menu, 0, 0, extra, cx, cy, SWP_NOZORDER);
				RedrawWindow(wnd, 0, 0, RDW_ERASE | RDW_INVALIDATE);
			}
			break;
		}

		case WM_NOTIFY:
		{
			if (((LPNMHDR)lp)->idFrom == ID_MENU) {
				switch (((LPNMHDR)lp)->code)
				{
				case TBN_HOTITEMCHANGE:
				{
					if (!(((LPNMTBHOTITEM)lp)->dwFlags & HICF_LEAVING) && (((LPNMTBHOTITEM)lp)->dwFlags & HICF_MOUSE || ((LPNMTBHOTITEM)lp)->dwFlags & HICF_LMOUSE))
						redrop = true;
					break;
				}
				case TBN_DROPDOWN:
				{
					if (redrop)
						PostMessage(wnd, MSG_CREATE_MENU, ((LPNMTOOLBAR)lp)->iItem, 0);
					else
						redrop = true;

					return TBDDRET_DEFAULT;
				}
				}
			}
			break;
		}
		case MSG_HIDE_MENUACC:
		{
			//if (is_win2k_or_newer())
			{
				BOOL a = true;
				SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &a, 0);
				if ((SendMessage(wnd_menu, WM_QUERYUISTATE, 0, 0) & UISF_HIDEACCEL) != !a)
					SendMessage(wnd_menu, WM_UPDATEUISTATE, MAKEWPARAM(a ? UIS_CLEAR : UIS_SET, UISF_HIDEACCEL), 0);
			}
			break;
		}
		case MSG_SHOW_MENUACC:
		{
			//if (is_win2k_or_newer())
			{
				SendMessage(wnd_menu, WM_UPDATEUISTATE, MAKEWPARAM(UIS_CLEAR, UISF_HIDEACCEL), 0);
			}
			break;
		}
		case MSG_CREATE_MENU:
		{
			if (lp) SetFocus(wnd_menu);
			active_item = wp;

			make_menu(wp);
			break;
		}
		case WM_MENUSELECT:
		{
			if (HIWORD(wp) & MF_POPUP)
			{
				is_submenu = true;
				m_status_override.release();
			}
			else
			{
				is_submenu = false;
				if (p_manager.is_valid())
				{
					unsigned id = LOWORD(wp);

					bool set = false;

					pfc::string8 blah;

					set = p_manager->get_description(id - 1, blah);

					service_ptr_t<ui_status_text_override> p_status_override;

					if (set)
					{
						get_host()->override_status_text_create(p_status_override);

						if (p_status_override.is_valid())
						{
							p_status_override->override_text(blah);
						}
					}
					m_status_override = p_status_override;
				}
			}
			break;
		}
		case WM_INITMENUPOPUP:
		{
			sub_menu_ref_count++;
			break;
		}
		case WM_UNINITMENUPOPUP:
		{
			sub_menu_ref_count--;
			break;
		}
		case WM_GETMINMAXINFO:
		{
			LPMINMAXINFO mmi = LPMINMAXINFO(lp);

			RECT rc = { 0,0,0,0 };
			SendMessage(wnd_menu, TB_GETITEMRECT, m_buttons.get_count() - 1, (LPARAM)(&rc));

			//SIZE sz = {0,0};
			//SendMessage(wnd_menu, TB_GETMAXSIZE, NULL, (LPARAM)&sz);
			//console::formatter() << sz.cx << sz.cy;

			mmi->ptMinTrackSize.x = rc.right;
			mmi->ptMinTrackSize.y = rc.bottom;
			mmi->ptMaxTrackSize.y = rc.bottom;
			return 0;
		}
		case WM_SETTINGCHANGE:
		{
			if (wp == SPI_SETNONCLIENTMETRICS)
			{
				PostMessage(wnd, MSG_SIZE_LIMIT_CHANGE, 0, 0);
			}
			break;
		}
		case SPI_GETKEYBOARDCUES:
		{
			BOOL a = TRUE;
			SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &a, 0);
			SendMessage(wnd_menu, WM_UPDATEUISTATE, MAKEWPARAM((a || GetFocus() == wnd_menu) ? UIS_CLEAR : UIS_SET, UISF_HIDEACCEL), 0);
			break;
		}
		case MSG_SIZE_LIMIT_CHANGE:
		{
			get_host()->on_size_limit_change(wnd, uie::size_limit_minimum_height | uie::size_limit_maximum_height | uie::size_limit_minimum_width);
			break;
		}
		case WM_DESTROY:
		{
			DestroyWindow(wnd_menu);
			wnd_menu = NULL;
			m_buttons.remove_all();
			initialised = false;
			break;
		}
	}
	return DefWindowProc(wnd, msg, wp, lp);
}
示例#2
0
void dsp_preset_switcher::findDspNames( pfc::list_t<pfc::string8> &out ) const
{
	// storing menu handles may not be a good idea, since the user can change DSP preset settings without notify this component

	out.remove_all();

	// enumerate mainmenu items
	service_enum_t<mainmenu_commands> e;
	service_ptr_t<mainmenu_commands_v2> ptr;
	while( e.next( ptr ) )
	{
		for( t_uint32 i = 0 , imax = ptr->get_command_count(); i < imax; ++i )
		{
			// lock-on on DSP settings
			pfc::string8 group_name;
			ptr->get_name( i , group_name );
			const char *DSP_PARENT_STR = "DSP";  // partial match, hope to work with non-English locale
			if( strstr( group_name.toString() , DSP_PARENT_STR ) == nullptr )
				continue;

			// should be a dynamic item
			if( !ptr->is_command_dynamic( i ) )
			{
				console::printf( CONSOLE_HEADER "%s(): item is NOT dynamic!!" , __FUNCTION__ );
				continue;
			}
			const mainmenu_node::ptr dsp_group_node = ptr->dynamic_instantiate( i );

			// should be a group node
			if( dsp_group_node->get_type() != mainmenu_node::type_group )
			{
				console::printf( CONSOLE_HEADER "%s(): node is NOT type_group!!" , __FUNCTION__ );
				continue;
			}

			// enumerate dsp names
			for( t_size j = 0 , jmax = dsp_group_node->get_children_count(); ( j < jmax ) && ( jmax > 1 ) ; ++j )  // jmax == 1 when there only exist "Preferences" items
			{
				const mainmenu_node::ptr dsp_item_node = dsp_group_node->get_child( j );
				if( dsp_item_node->get_type() == mainmenu_node::type_command )
				{
					pfc::string8 n;
					t_uint32 d;
					dsp_item_node->get_display( n , d );
					out.add_item( n );
					//console::printf( CONSOLE_HEADER "%s" , n.toString() );
				}
				else if( dsp_item_node->get_type() == mainmenu_node::type_separator )
				{
					// stop when encountered type_separator
					break;
				}
			}
			return;
		}
	}

	return;
}
示例#3
0
	virtual void on_init(HWND p_wnd) {
		static_api_ptr_t<playlist_manager> pm;
		active_playlist = pm->get_active_playlist();
		pm->activeplaylist_get_all_items(all_items);
		pm->activeplaylist_get_selected_items(selected_items);
		playlist_length = all_items.get_count();
		first_pos = all_items.find_item(selected_items[0]);
		select_mask = bit_array_bittable(playlist_length);
		pm->activeplaylist_get_selection_mask(select_mask);
	}
示例#4
0
		void add_value (const char * p_value)
		{
			t_size index;
			if (!m_values.bsearch_t(stricmp_utf8, p_value, index))
			{
				if (m_values.get_count() < max_values)
					m_values.insert_item(p_value, index);
				else
					m_truncated = true;
			}
		}
示例#5
0
	void g_populate_tree ( HWND wnd_tree, cui::fcl::group_list & list, const cui::fcl::group_list_filtered & filtered, HTREEITEM ti_parent = TVI_ROOT)
	{
		t_size i, count = filtered.get_count();
		for (i=0; i<count; i++)
		{
			pfc::string8 name;
			filtered[i]->get_name(name);
			HTREEITEM item = treeview::insert_item(wnd_tree, name, m_nodes.get_count() , ti_parent);
			m_nodes.add_item(t_node(item, filtered[i]));
			TreeView_SetCheckState(wnd_tree, item, TRUE);
			cui::fcl::group_list_filtered filtered2(list, filtered[i]->get_guid());
			list.remove_by_guid(filtered[i]->get_guid());
			g_populate_tree(wnd_tree, list, filtered2, item);
		}
	}
示例#6
0
	void set_fields(pfc::list_t<field_t> & p_source)
	{
		t_size i, count = p_source.get_count();
		m_fields.set_count(count);
		for (i=0; i<count; i++)
			m_fields[i].m_name = p_source[i].m_name;
	}
示例#7
0
void dsp_preset_switcher::initEntries( pfc::list_t<pfc::string8> &out ) const
{
	// clear existing entries
	addEntry( "" );  // ensure a 1-item height empty item-list is displayed
	clearEntires();

	// get dsp names
	out.remove_all();
	findDspNames( out );

	// add to combo box
	for( t_size i = 0 , imax = out.get_count(); i < imax ; ++i )
	{
		addEntry( out[i] );
	}

	return;
}
void fields_list_view_t::get_insert_items(t_size base, t_size count, pfc::list_t<t_list_view::t_item_insert> & items)
{
	t_size i;
	items.set_count(count);
	for (i = 0; i < count; i++)
	{
		items[i].m_subitems.add_item(m_fields[base + i].m_name_friendly);
		items[i].m_subitems.add_item(m_fields[base + i].m_name);
	}
}
示例#9
0
	void get_insert_items(t_size base, t_size count, pfc::list_t<t_list_view::t_item_insert> & items)
	{
		t_size i;
		items.set_count(count);
		for (i=0; i<count; i++)
		{
			items[i].m_subitems.add_item(filter_panel::cfg_field_list[base+i].m_name);
			items[i].m_subitems.add_item(filter_panel::cfg_field_list[base+i].m_field);
		}
	}
示例#10
0
	bool have_node_checked (const GUID & pguid)
	{
		t_size i, count = m_nodes.get_count();
		for (i=0; i<count; i++)
		{
			if (m_nodes[i].group->get_guid() == pguid)
				return m_nodes[i].checked;
		}
		return false;
	}
示例#11
0
void enum_mobile_devices(pfc::list_t<device_instance_info_t> & p_out)
{
	HDEVINFO di = SetupDiGetClassDevs(&InterfaceClassGuid, NULL, NULL, DIGCF_PRESENT|DIGCF_DEVICEINTERFACE);

	if (di != INVALID_HANDLE_VALUE)
	{
		SP_DEVINFO_DATA did;
		memset(&did, 0, sizeof(did));
		did.cbSize = sizeof(did);

		DWORD i;
		for (i=0; SetupDiEnumDeviceInfo(di, i, &did); i++)
		{
			//if (did.ClassGuid == GUID_DEVCLASS_USB)
			{
				ULONG DevDiskLen=0;
				pfc::array_t<WCHAR> DevDisk;
				if (CR_SUCCESS == CM_Get_Device_ID_Size(&DevDiskLen, did.DevInst, NULL))
				{
					DevDisk.set_size(DevDiskLen+1);
					DevDisk.fill_null();
					if (CR_SUCCESS == CM_Get_Device_ID(did.DevInst, DevDisk.get_ptr(), DevDisk.get_size(), NULL))
					{
						if (g_check_devid_is_mobile_device(DevDisk.get_ptr()))
						{
							device_instance_info_t temp;
							temp.m_handle = did.DevInst;
							temp.m_path = DevDisk.get_ptr();
							p_out.add_item(temp);

							console::formatter() << "iPod manager: USB AMD enumerator: Found " << Tu(DevDisk.get_ptr());
						}
					}
				}
			}
		}

		SetupDiDestroyDeviceInfoList(di);
	}
	if (!p_out.get_count())
		console::formatter() << "iPod manager: USB AMD enumerator: No devices found!";
}
示例#12
0
FileTagMap::FileTagMap(Release &release, pfc::list_t<metadb_handle_ptr> tracks, size_t selected_medium) {
	auto current_medium = 0;
	auto current_track = 0;
	if (tracks.get_count() < release.track_count()) {
		current_medium = selected_medium;
	}
	for (unsigned int i = 0; i < tracks.get_count(); i++) {
		auto &medium = *release.get_medium(current_medium);
		auto &track = *medium.get_track(current_track);

		set(tracks[i], Tag(release, medium, track));

		if (++current_track < medium.track_count()) continue;
		if (++current_medium < release.medium_count()) {
			current_track = 0;
			continue;
		}
		return;
	}
}
void playlist_switcher_t::get_insert_items (t_size base, t_size count, pfc::list_t<t_list_view::t_item_insert> & p_out)
	{
		p_out.set_count(count);

		t_size i;
		for (i=0;i<count; i++)
		{
			p_out[i].m_subitems.set_count(1);
			pfc::string8 temp;
			m_playlist_api->playlist_get_name(i+base, temp);
			p_out[i].m_subitems[0].set_string( playlist_format_name_t(i+base, temp, get_playing_playlist()) );
		}
	}
示例#14
0
bool directory_callback_full_impl::on_entry(filesystem * owner, abort_callback & p_abort, const char * url, bool is_subdirectory, const t_filestats & p_stats)
{
	p_abort.check_e();
	m_data.add_item(pfc::rcnew_t<t_entry>(url, is_subdirectory, p_stats));
	if (is_subdirectory)
	{
		if (m_recur)
		{
			try
			{
				owner->list_directory(url, *this, p_abort);
			}
			catch (exception_io const &) {}
		}
	}
	return true;
}
//public:
   unsigned get_num_items()
   {
      //return 1;
      // see if we already cached all this jazz
      if ( g_mm_names.get_count() > 0 )
      {
         return g_mm_names.get_count();
      }

      unsigned total = 0;
	   service_enum_t<mainmenu_commands> e;
	   service_ptr_t<mainmenu_commands> ptr;

      g_mm_names.remove_all();
      g_mm_guids.remove_all();
      while(e.next(ptr)) 
      {
		   unsigned count = ptr->get_command_count();

         for ( unsigned n = 0; n < count; n++ )
         {
            pfc::string8 path;
            pfc::string8 name;
            GUID guid;

            t_uint32 p_flags;
            pfc::string8 str_display;

            ptr->get_display( n, str_display, p_flags );

            ptr->get_name( n, name );
            guid = ptr->get_command( n );
            find_menu_path( ptr->get_parent(), path );
            
            g_mm_names.add_item( name );
            g_mm_guids.add_item( guid );
            g_mm_paths.add_item( path );
         }

         total += count;
      }
      return total;
   }
示例#16
0
bool menu_extension::on_hooked_message(message_hook_manager::t_message_hook_type p_type, int code, WPARAM wp, LPARAM lp)
{
	static POINT last_pt;

	if (code == MSGF_MENU)
	{
		switch(((MSG*)lp)->message)
		{

		case WM_LBUTTONDOWN:
		case WM_RBUTTONDOWN:
			{
				SendMessage(wnd_menu, TB_SETHOTITEM, -1, 0);
				if (((MSG*)lp)->message == WM_LBUTTONDOWN)
				{
					POINT pt; RECT toolbar;
					GetClientRect(get_wnd(), &toolbar);
					pt.y = GET_Y_LPARAM(((MSG*)lp)->lParam);
					pt.x = GET_X_LPARAM(((MSG*)lp)->lParam);


					if (ScreenToClient(wnd_menu, &pt) && PtInRect(&toolbar, pt))
					{
						t_size idx = SendMessage(wnd_menu, TB_HITTEST, 0, (long)&pt);

						if (idx >= 0 && idx < m_buttons.get_count())
							redrop = false;
					}
				}
			}
			break;
		case WM_KEYDOWN:
			{
				switch ( ((MSG*)lp)->wParam )
				{
				case VK_LEFT:
					if (!sub_menu_ref_count) 
					{
						destroy_menu();
						if (active_item==1) active_item = m_buttons.get_count(); else active_item--;
						uPostMessage(get_wnd(), MSG_CREATE_MENU, active_item, 0);
					}

					break;
				case VK_RIGHT:
					if (!is_submenu) 
					{
						destroy_menu();
						if (active_item==m_buttons.get_count()) active_item = 1; else active_item++;
						uPostMessage(get_wnd(), MSG_CREATE_MENU, active_item, 0);
					}
					break;
				case VK_ESCAPE:
					if (!sub_menu_ref_count) 
					{
						SetFocus(wnd_menu);
						SendMessage(wnd_menu, TB_SETHOTITEM, active_item-1, 0);
						destroy_menu();
					}
					break;
				}
			}
			break;

		case WM_MOUSEMOVE:
			{
				POINT px;
				px.y = GET_Y_LPARAM(((MSG*)lp)->lParam);
				px.x = GET_X_LPARAM(((MSG*)lp)->lParam);
				if (px.x != last_pt.x || px.y != last_pt.y)
				{
					HWND wnd_hit = WindowFromPoint(px);
					if (wnd_hit == wnd_menu)
					{
						POINT pt = px;
						int hot_item = SendMessage(wnd_menu, TB_GETHOTITEM, 0, 0);
						if (ScreenToClient(wnd_menu, &pt))
						{

							t_size idx = SendMessage(wnd_menu, TB_HITTEST, 0, (long)&pt);

							if (idx >= 0 && idx < m_buttons.get_count() && (active_item-1) != idx)
							{
								destroy_menu();
								active_item = idx+1; 
								uPostMessage(get_wnd(), MSG_CREATE_MENU, active_item, 0);
							} 
						}
					}
				}
				last_pt = px;
			}
			break;

		}
	}
	return false;
}
示例#17
0
void menu_extension::make_menu(unsigned idx)
{
	if (idx == actual_active || hooked || idx < 1 || idx > m_buttons.get_count()) return;

	service_ptr_t<menu_extension> dummy = this; //menu command may delete us
	
	actual_active = idx;
	
	RECT rc;
	POINT pt;
	
	SendMessage(wnd_menu, TB_GETRECT,	idx, (LPARAM)&rc);
	
	MapWindowPoints(wnd_menu, HWND_DESKTOP, (LPPOINT)&rc, 2);  
	
	pt.x = rc.left;
	pt.y = rc.bottom;

	HMENU menu = CreatePopupMenu();

	hooked = true;
//	p_hooked_menu = this;
	message_hook_manager::register_hook(message_hook_manager::type_message_filter, this);
	//msghook = uSetWindowsHookEx(WH_MSGFILTER, menu_hook_t_proc, 0, GetCurrentThreadId());
	service_ptr_t<mainmenu_manager> p_menu = standard_api_create_t<mainmenu_manager>();

	bool b_keyb = standard_config_objects::query_show_keyboard_shortcuts_in_menus();


	if (p_menu.is_valid())
	{
		p_menu->instantiate(m_buttons[idx-1].m_guid);
		p_menu->generate_menu_win32(menu,1,-1,b_keyb ? mainmenu_manager::flag_show_shortcuts : 0);
		menu_helpers::win32_auto_mnemonics(menu);
	}

	SendMessage(wnd_menu, TB_PRESSBUTTON, idx, TRUE);
	SendMessage(wnd_menu, TB_SETHOTITEM, idx-1, 0);
	is_submenu = false;

	sub_menu_ref_count = -1; //we get a notificationwhen the inital menu is created

//	RECT rc_desktop;
//	if (GetWindowRect(GetDesktopWindow(), &rc_desktop))

//	if (pt.x < rc_desktop.left) pt.x = rc_desktop.left;
//	else if (pt.x > rc_desktop.right) pt.x = rc_desktop.right;

	p_manager = p_menu;

	TPMPARAMS tpmp;
	memset(&tpmp, 0, sizeof(TPMPARAMS));
	tpmp.cbSize = sizeof(tpmp);

	GetWindowRect(wnd_menu, &tpmp.rcExclude);

	HMONITOR mon = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);

	if (mon)
	{
		MONITORINFO mi;
		memset(&mi, 0, sizeof(MONITORINFO));
		mi.cbSize = sizeof(MONITORINFO);
		if (uGetMonitorInfo(mon, &mi))
		{
			if (pt.x < mi.rcMonitor.left) pt.x = mi.rcMonitor.left;
			tpmp.rcExclude.left = mi.rcMonitor.left;
			tpmp.rcExclude.right = mi.rcMonitor.right;
		}
	}

//	menu_info::MENU_A_BASE = 1;
//	menu_info::MENU_B_BASE = -1;

	if (GetFocus() != wnd_menu) 
		wnd_prev_focus = GetFocus();

	int cmd = TrackPopupMenuEx(menu,TPM_LEFTBUTTON|TPM_RETURNCMD,pt.x,pt.y,get_wnd(),&tpmp);
//	int cmd = TrackPopupMenuEx(menu,TPM_LEFTBUTTON|TPM_RETURNCMD,pt.x,pt.y,g_main_window,0);
	
	m_status_override.release();

	//SendMessage(wnd_menu, TB_PRESSBUTTON, idx, FALSE);

	PostMessage(wnd_menu, TB_PRESSBUTTON, idx, FALSE);
	if (GetFocus() != wnd_menu) 
	{
		PostMessage(wnd_menu, TB_SETHOTITEM, -1, 0);
	}



	DestroyMenu(menu);

	if (cmd>0 && p_menu.is_valid())
	{
//		SendMessage(wnd_menu, TB_SETHOTITEM, -1, 0);
		if (IsWindow(wnd_prev_focus))
			SetFocus(wnd_prev_focus);
		p_menu->execute_command(cmd - 1);
	}

//	if (p_menu.is_valid()) 
	{
		p_manager.release();
		p_menu.release();
	}

	//UnhookWindowsHookEx(msghook); // hook may not be freed instantly, so dont make msghook = 0
	message_hook_manager::deregister_hook(message_hook_manager::type_message_filter, this);
	hooked = false;
	//p_hooked_menu=0;

	actual_active = 0;
}
示例#18
0
	void sort() { m_data.sort_t(sortfunc); }
示例#19
0
	t_size get_count() { return m_data.get_count(); }
示例#20
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);
}
示例#21
0
void layout_window::g_get_default_presets(pfc::list_t<cfg_layout_t::preset> & p_out)
{
	{
		uie::window_ptr wnd, wnd2, wnd3;
		service_ptr_t<uie::splitter_window> splitter, splitter2, splitter3;
		if (uie::window::create_by_guid(columns_ui::panels::guid_horizontal_splitter, wnd) && uie::window::create_by_guid(columns_ui::panels::guid_vertical_splitter, wnd2))
		{
			if (wnd->service_query_t(splitter) && wnd2->service_query_t(splitter2))
			{
				uie::splitter_item_simple_t item, item2;
				item.set_panel_guid(columns_ui::panels::guid_playlist_switcher);
				item2.set_panel_guid(columns_ui::panels::guid_vertical_splitter);
				bool val = true;
				splitter2->add_panel(&item);
				stream_writer_memblock conf1;
				splitter2->get_config(&conf1, abort_callback_impl());
				item2.set_panel_config(&stream_reader_memblock_ref(conf1.m_data.get_ptr(), conf1.m_data.get_size()), conf1.m_data.get_size());

				t_size index = splitter->add_panel(&item2);
				splitter->set_config_item(index, uie::splitter_window::bool_locked, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
				val = false;
				splitter->set_config_item(index, uie::splitter_window::bool_show_caption, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
				t_uint32 sz = 175;
				splitter->set_config_item(index, uie::splitter_window::uint32_size, &stream_reader_memblock_ref(&sz, sizeof(t_uint32)), abort_callback_impl());

				item.set_panel_guid(columns_ui::panels::guid_playlist_view_v2);
				t_size index_playlist = splitter->add_panel(&item);
				splitter->set_config_item(index_playlist, uie::splitter_window::bool_show_caption, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());

				cfg_layout_t::preset preset_default;
				preset_default.m_name = "NG Playlist + Playlist Switcher";
				preset_default.m_guid = columns_ui::panels::guid_horizontal_splitter;
				stream_writer_memblock_ref conf(preset_default.m_val, true);
				splitter->get_config(&conf, abort_callback_impl());

				p_out.add_item(preset_default);
			}
		}
	}
	{
		uie::window_ptr wnd, wnd2, wnd3, wnd_filter_splitter;
		service_ptr_t<uie::splitter_window> splitter, splitter2, splitter3, splitter_filter;
		if (uie::window::create_by_guid(columns_ui::panels::guid_horizontal_splitter, wnd) && uie::window::create_by_guid(columns_ui::panels::guid_vertical_splitter, wnd2) && uie::window::create_by_guid(columns_ui::panels::guid_vertical_splitter, wnd3)
			&& uie::window::create_by_guid(columns_ui::panels::guid_horizontal_splitter, wnd_filter_splitter))
		{
			if (wnd->service_query_t(splitter) && wnd2->service_query_t(splitter2) && wnd3->service_query_t(splitter3)
				&& wnd_filter_splitter->service_query_t(splitter_filter))
			{
				uie::splitter_item_simple_t item, item2, item3, item_filter, item_filter_splitter, item_artwork;
				item.set_panel_guid(columns_ui::panels::guid_playlist_switcher);
				item2.set_panel_guid(columns_ui::panels::guid_vertical_splitter);
				item3.set_panel_guid(columns_ui::panels::guid_vertical_splitter);
				item_filter_splitter.set_panel_guid(columns_ui::panels::guid_horizontal_splitter);
				item_filter.set_panel_guid(columns_ui::panels::guid_filter);
				item_artwork.set_panel_guid(columns_ui::panels::guid_artwork_view);;
				bool val = true;
				splitter2->add_panel(&item);
				stream_writer_memblock conf1, conf2, conf3;
				splitter2->get_config(&conf1, abort_callback_impl());
				item2.set_panel_config(&stream_reader_memblock_ref(conf1.m_data.get_ptr(), conf1.m_data.get_size()), conf1.m_data.get_size());

				t_size index = splitter->add_panel(&item2);
				splitter->set_config_item(index, uie::splitter_window::bool_locked, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
				val = false;
				splitter->set_config_item(index, uie::splitter_window::bool_show_caption, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
				t_uint32 sz = 175;
				splitter->set_config_item(index, uie::splitter_window::uint32_size, &stream_reader_memblock_ref(&sz, sizeof(t_uint32)), abort_callback_impl());

				t_size index_filter = splitter_filter->add_panel(&item_filter);
				splitter_filter->set_config_item_t(index_filter, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
				index_filter = splitter_filter->add_panel(&item_filter);
				splitter_filter->set_config_item_t(index_filter, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
				index_filter = splitter_filter->add_panel(&item_filter);
				splitter_filter->set_config_item_t(index_filter, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
				{
					splitter_filter->get_config(&conf3, abort_callback_impl());
					item_filter_splitter.set_panel_config(&stream_reader_memblock_ref(conf3.m_data.get_ptr(), conf3.m_data.get_size()), conf3.m_data.get_size());
					t_size indexfs = splitter3->add_panel(&item_filter_splitter);
					splitter3->set_config_item_t(indexfs, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
					bool temp = true;
					splitter3->set_config_item_t(indexfs, uie::splitter_window::bool_locked, temp, abort_callback_dummy());
					t_uint32 size = 175;
					splitter3->set_config_item_t(indexfs, uie::splitter_window::uint32_size, size, abort_callback_dummy());
				}

				item.set_panel_guid(columns_ui::panels::guid_playlist_view_v2);
				t_size index_playlist = splitter3->add_panel(&item);
				splitter3->set_config_item(index_playlist, uie::splitter_window::bool_show_caption, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());

				splitter3->get_config(&conf2, abort_callback_impl());
				item3.set_panel_config(&stream_reader_memblock_ref(conf2.m_data.get_ptr(), conf2.m_data.get_size()), conf2.m_data.get_size());

				t_size index_splitter2 = splitter->add_panel(&item3);
				splitter->set_config_item_t(index_splitter2, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());

				cfg_layout_t::preset preset_default;
				preset_default.m_name = "NG Playlist + Playlist Switcher + Filters";
				preset_default.m_guid = columns_ui::panels::guid_horizontal_splitter;
				stream_writer_memblock_ref conf(preset_default.m_val, true);
				splitter->get_config(&conf, abort_callback_impl());

				p_out.add_item(preset_default);

				index = splitter2->add_panel(&item_artwork);
				bool b_true = true;
				splitter2->set_config_item_t(index, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
				splitter2->set_config_item_t(index, uie::splitter_window::bool_locked, b_true, abort_callback_dummy());
				splitter2->set_config_item_t(index, uie::splitter_window::uint32_size, sz, abort_callback_dummy());
				conf1.m_data.set_size(0);
				splitter2->get_config(&conf1, abort_callback_impl());
				item2.set_panel_config(&stream_reader_memblock_ref(conf1.m_data.get_ptr(), conf1.m_data.get_size()), conf1.m_data.get_size());
				splitter->replace_panel(0, &item2);
				splitter->set_config_item(0, uie::splitter_window::bool_locked, &stream_reader_memblock_ref(&b_true, sizeof(bool)), abort_callback_impl());
				splitter->set_config_item(0, uie::splitter_window::bool_show_caption, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
				splitter->set_config_item(0, uie::splitter_window::uint32_size, &stream_reader_memblock_ref(&sz, sizeof(t_uint32)), abort_callback_impl());

				preset_default.m_name = "NG Playlist + Playlist Switcher + Artwork + Filters";
				preset_default.m_val.set_size(0);
				splitter->get_config(&conf, abort_callback_impl());
				t_size index_preset = p_out.add_item(preset_default);

				splitter3->remove_panel(0);
				conf2.m_data.set_size(0);
				splitter3->get_config(&conf2, abort_callback_impl());
				item3.set_panel_config(&stream_reader_memblock_ref(conf2.m_data.get_ptr(), conf2.m_data.get_size()), conf2.m_data.get_size());

				splitter->replace_panel(index_splitter2, &item3);
				splitter->set_config_item_t(index_splitter2, uie::splitter_window::bool_show_caption, false, abort_callback_dummy());
				preset_default.m_name = "NG Playlist + Playlist Switcher + Artwork";
				splitter->get_config(&stream_writer_memblock_ref(preset_default.m_val, true), abort_callback_dummy());
				p_out.insert_item(preset_default, index_preset);
			}
		}
	}
	{
		uie::window_ptr wnd, wnd2, wnd3, wnd_filter_splitter, wnd_bottom_splitter;
		service_ptr_t<uie::splitter_window> splitter, splitter2, splitter3, splitter_filter, splitter_bottom;
		if (uie::window::create_by_guid(columns_ui::panels::guid_horizontal_splitter, wnd) && uie::window::create_by_guid(columns_ui::panels::guid_vertical_splitter, wnd2) && uie::window::create_by_guid(columns_ui::panels::guid_vertical_splitter, wnd3)
			&& uie::window::create_by_guid(columns_ui::panels::guid_horizontal_splitter, wnd_filter_splitter)
			&& uie::window::create_by_guid(columns_ui::panels::guid_horizontal_splitter, wnd_bottom_splitter))
		{
			if (wnd->service_query_t(splitter) && wnd2->service_query_t(splitter2) && wnd3->service_query_t(splitter3)
				&& wnd_filter_splitter->service_query_t(splitter_filter)
				&& wnd_bottom_splitter->service_query_t(splitter_bottom))
			{
				uie::splitter_item_simple_t item, item2, item3, item_filter, item_filter_splitter, item_artwork, item_bottom_splitter, item_item_details;
				item.set_panel_guid(columns_ui::panels::guid_playlist_switcher);
				item2.set_panel_guid(columns_ui::panels::guid_vertical_splitter);
				item3.set_panel_guid(columns_ui::panels::guid_vertical_splitter);
				item_filter_splitter.set_panel_guid(columns_ui::panels::guid_horizontal_splitter);
				item_bottom_splitter.set_panel_guid(columns_ui::panels::guid_horizontal_splitter);
				item_filter.set_panel_guid(columns_ui::panels::guid_filter);
				item_artwork.set_panel_guid(columns_ui::panels::guid_artwork_view);
				item_item_details.set_panel_guid(columns_ui::panels::guid_item_details);
				bool val = true;
				splitter2->add_panel(&item);
				stream_writer_memblock conf1, conf2, conf3, conf4;
				splitter2->get_config(&conf1, abort_callback_impl());
				item2.set_panel_config(&stream_reader_memblock_ref(conf1.m_data.get_ptr(), conf1.m_data.get_size()), conf1.m_data.get_size());

				t_size index = splitter->add_panel(&item2);
				splitter->set_config_item(index, uie::splitter_window::bool_locked, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
				val = false;
				splitter->set_config_item(index, uie::splitter_window::bool_show_caption, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
				t_uint32 sz = 175;
				splitter->set_config_item(index, uie::splitter_window::uint32_size, &stream_reader_memblock_ref(&sz, sizeof(t_uint32)), abort_callback_impl());

				t_size index_filter = splitter_filter->add_panel(&item_filter);
				splitter_filter->set_config_item_t(index_filter, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
				index_filter = splitter_filter->add_panel(&item_filter);
				splitter_filter->set_config_item_t(index_filter, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
				index_filter = splitter_filter->add_panel(&item_filter);
				splitter_filter->set_config_item_t(index_filter, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
				{
					splitter_filter->get_config(&conf3, abort_callback_impl());
					item_filter_splitter.set_panel_config(&stream_reader_memblock_ref(conf3.m_data.get_ptr(), conf3.m_data.get_size()), conf3.m_data.get_size());
				}

				item.set_panel_guid(columns_ui::panels::guid_playlist_view_v2);
				t_size index_playlist = splitter3->add_panel(&item);
				splitter3->set_config_item(index_playlist, uie::splitter_window::bool_show_caption, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());

				{
					t_size index = splitter_bottom->add_panel(&item_item_details);
					splitter_bottom->set_config_item_t(index, uie::splitter_window::bool_show_caption, bool(false), abort_callback_dummy());
					index = splitter_bottom->add_panel(&item_artwork);
					splitter_bottom->set_config_item_t(index, uie::splitter_window::bool_show_caption, bool(false), abort_callback_dummy());
					splitter_bottom->set_config_item_t(index, uie::splitter_window::uint32_size, t_size(125), abort_callback_dummy());
					splitter_bottom->set_config_item_t(index, uie::splitter_window::bool_locked, bool(true), abort_callback_dummy());

					splitter_bottom->get_config(&conf4, abort_callback_impl());
					item_bottom_splitter.set_panel_config(&stream_reader_memblock_ref(conf4.m_data.get_ptr(), conf4.m_data.get_size()), conf4.m_data.get_size());
					index = splitter3->add_panel(&item_bottom_splitter);
					splitter3->set_config_item_t(index, uie::splitter_window::bool_show_caption, bool(false), abort_callback_dummy());
					splitter3->set_config_item_t(index, uie::splitter_window::bool_locked, bool(true), abort_callback_dummy());
					splitter3->set_config_item_t(index, uie::splitter_window::uint32_size, t_size(125), abort_callback_dummy());
				}

				splitter3->get_config(&conf2, abort_callback_impl());
				item3.set_panel_config(&stream_reader_memblock_ref(conf2.m_data.get_ptr(), conf2.m_data.get_size()), conf2.m_data.get_size());

				t_size index_splitter2 = splitter->add_panel(&item3);
				splitter->set_config_item_t(index_splitter2, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());

				cfg_layout_t::preset preset_default;
				preset_default.m_name = "NG Playlist + Playlist Switcher + Item Details + Artwork";
				preset_default.m_guid = columns_ui::panels::guid_horizontal_splitter;
				stream_writer_memblock_ref conf(preset_default.m_val, true);
				splitter->get_config(&conf, abort_callback_impl());

				p_out.add_item(preset_default);

				{
					t_size indexfs = 0;
					splitter3->insert_panel(0, &item_filter_splitter);
					splitter3->set_config_item_t(indexfs, uie::splitter_window::bool_show_caption, false, abort_callback_dummy());
					splitter3->set_config_item_t(indexfs, uie::splitter_window::bool_locked, true, abort_callback_dummy());
					t_uint32 size = 175;
					splitter3->set_config_item_t(indexfs, uie::splitter_window::uint32_size, size, abort_callback_dummy());
				}


				conf2.m_data.set_size(0);
				splitter3->get_config(&conf2, abort_callback_impl());
				item3.set_panel_config(&stream_reader_memblock_ref(conf2.m_data.get_ptr(), conf2.m_data.get_size()), conf2.m_data.get_size());

				//t_size index_splitter2 = 
				splitter->replace_panel(1, &item3);
				splitter->set_config_item_t(1, uie::splitter_window::bool_show_caption, false, abort_callback_dummy());

				cfg_layout_t::preset preset_default2;
				preset_default2.m_name = "NG Playlist + Playlist Switcher + Filters + Item Details + Artwork";
				preset_default2.m_guid = columns_ui::panels::guid_horizontal_splitter;
				stream_writer_memblock_ref conft(preset_default2.m_val, true);
				splitter->get_config(&conft, abort_callback_impl());

				p_out.add_item(preset_default2);
			}
		}
	}
	{
		uie::window_ptr wnd;
		service_ptr_t<uie::splitter_window> splitter;
		if (uie::window::create_by_guid(columns_ui::panels::guid_playlist_tabs, wnd))
		{
			if (wnd->service_query_t(splitter))
			{
				uie::splitter_item_simple_t item;
				item.set_panel_guid(columns_ui::panels::guid_playlist_view_v2);
				splitter->add_panel(&item);

				cfg_layout_t::preset preset_default;
				preset_default.m_name = "NG Playlist + Playlist Tabs";
				preset_default.m_guid = columns_ui::panels::guid_playlist_tabs;
				stream_writer_memblock_ref conf(preset_default.m_val, true);
				splitter->get_config(&conf, abort_callback_impl());

				//m_active = pfc_infinite;

				p_out.add_item(preset_default);
			}
		}
	}
	{
		uie::window_ptr wnd, wnd2, wnd3, wnd_filter_splitter, wnd_bottom_splitter;
		service_ptr_t<uie::splitter_window> splitter, splitter_tabs, splitter3, splitter_filter, splitter_bottom;
		if (uie::window::create_by_guid(columns_ui::panels::guid_horizontal_splitter, wnd) && uie::window::create_by_guid(columns_ui::panels::guid_playlist_tabs, wnd2) && uie::window::create_by_guid(columns_ui::panels::guid_vertical_splitter, wnd3)
			&& uie::window::create_by_guid(columns_ui::panels::guid_horizontal_splitter, wnd_filter_splitter)
			&& uie::window::create_by_guid(columns_ui::panels::guid_horizontal_splitter, wnd_bottom_splitter))
		{
			if (wnd->service_query_t(splitter) && wnd2->service_query_t(splitter_tabs) && wnd3->service_query_t(splitter3)
				&& wnd_filter_splitter->service_query_t(splitter_filter)
				&& wnd_bottom_splitter->service_query_t(splitter_bottom))
			{
				uie::splitter_item_simple_t item_tabs, item, item3, item_filter, item_filter_splitter, item_artwork, item_bottom_splitter, item_item_details;
				item_tabs.set_panel_guid(columns_ui::panels::guid_playlist_tabs);

				item3.set_panel_guid(columns_ui::panels::guid_vertical_splitter);
				item_filter_splitter.set_panel_guid(columns_ui::panels::guid_horizontal_splitter);
				item_bottom_splitter.set_panel_guid(columns_ui::panels::guid_horizontal_splitter);
				item_filter.set_panel_guid(columns_ui::panels::guid_filter);
				item_artwork.set_panel_guid(columns_ui::panels::guid_artwork_view);
				item_item_details.set_panel_guid(columns_ui::panels::guid_item_details);
				bool val = true;

				stream_writer_memblock conf1, conf2, conf3, conf4;

				val = false;
				t_uint32 sz = 175;

				t_size index_filter = splitter_filter->add_panel(&item_filter);
				splitter_filter->set_config_item_t(index_filter, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
				index_filter = splitter_filter->add_panel(&item_filter);
				splitter_filter->set_config_item_t(index_filter, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
				index_filter = splitter_filter->add_panel(&item_filter);
				splitter_filter->set_config_item_t(index_filter, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
				{
					splitter_filter->get_config(&conf3, abort_callback_impl());
					item_filter_splitter.set_panel_config(&stream_reader_memblock_ref(conf3.m_data.get_ptr(), conf3.m_data.get_size()), conf3.m_data.get_size());
					t_size indexfs = splitter3->add_panel(&item_filter_splitter);
					splitter3->set_config_item_t(indexfs, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
					bool temp = true;
					splitter3->set_config_item_t(indexfs, uie::splitter_window::bool_locked, temp, abort_callback_dummy());
					t_uint32 size = 175;
					splitter3->set_config_item_t(indexfs, uie::splitter_window::uint32_size, size, abort_callback_dummy());
				}

				item.set_panel_guid(columns_ui::panels::guid_playlist_view_v2);
				t_size index_playlist = splitter_tabs->add_panel(&item);
				splitter_tabs->get_config(&conf1, abort_callback_impl());
				item_tabs.set_panel_config(&stream_reader_memblock_ref(conf1.m_data.get_ptr(), conf1.m_data.get_size()), conf1.m_data.get_size());
				t_size index_tabs = splitter3->add_panel(&item_tabs);
				splitter3->set_config_item_t(index_tabs, uie::splitter_window::bool_show_caption, false, abort_callback_impl());


				splitter3->get_config(&conf2, abort_callback_impl());
				item3.set_panel_config(&stream_reader_memblock_ref(conf2.m_data.get_ptr(), conf2.m_data.get_size()), conf2.m_data.get_size());

				t_size index_splitter2 = splitter->add_panel(&item3);
				splitter->set_config_item_t(index_splitter2, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());

				cfg_layout_t::preset preset_default;
				preset_default.m_name = "NG Playlist + Playlist Tabs + Filters";
				preset_default.m_guid = columns_ui::panels::guid_horizontal_splitter;
				stream_writer_memblock_ref conf(preset_default.m_val, true);
				splitter->get_config(&conf, abort_callback_impl());

				p_out.add_item(preset_default);

				{
					t_size index = splitter_bottom->add_panel(&item_item_details);
					splitter_bottom->set_config_item_t(index, uie::splitter_window::bool_show_caption, bool(false), abort_callback_dummy());
					index = splitter_bottom->add_panel(&item_artwork);
					splitter_bottom->set_config_item_t(index, uie::splitter_window::bool_show_caption, bool(false), abort_callback_dummy());
					splitter_bottom->set_config_item_t(index, uie::splitter_window::uint32_size, t_size(125), abort_callback_dummy());
					splitter_bottom->set_config_item_t(index, uie::splitter_window::bool_locked, bool(true), abort_callback_dummy());

					splitter_bottom->get_config(&conf4, abort_callback_impl());
					item_bottom_splitter.set_panel_config(&stream_reader_memblock_ref(conf4.m_data.get_ptr(), conf4.m_data.get_size()), conf4.m_data.get_size());
					index = splitter3->add_panel(&item_bottom_splitter);
					splitter3->set_config_item_t(index, uie::splitter_window::bool_show_caption, bool(false), abort_callback_dummy());
					splitter3->set_config_item_t(index, uie::splitter_window::bool_locked, bool(true), abort_callback_dummy());
					splitter3->set_config_item_t(index, uie::splitter_window::uint32_size, t_size(125), abort_callback_dummy());
				}

				conf2.m_data.set_size(0);
				splitter3->get_config(&conf2, abort_callback_impl());
				item3.set_panel_config(&stream_reader_memblock_ref(conf2.m_data.get_ptr(), conf2.m_data.get_size()), conf2.m_data.get_size());

				splitter->replace_panel(index_splitter2, &item3);
				splitter->set_config_item_t(index_splitter2, uie::splitter_window::bool_show_caption, false, abort_callback_dummy());

				preset_default.m_name = "NG Playlist + Playlist Tabs + Filters + Item Details + Artwork";
				preset_default.m_guid = columns_ui::panels::guid_horizontal_splitter;

				splitter->get_config(&stream_writer_memblock_ref(preset_default.m_val, true), abort_callback_impl());


				t_size preset_tabs_all = p_out.add_item(preset_default);


				splitter3->remove_panel(0);
				conf2.m_data.set_size(0);
				splitter3->get_config(&conf2, abort_callback_impl());
				item3.set_panel_config(&stream_reader_memblock_ref(conf2.m_data.get_ptr(), conf2.m_data.get_size()), conf2.m_data.get_size());

				splitter->replace_panel(index_splitter2, &item3);
				splitter->set_config_item_t(index_splitter2, uie::splitter_window::bool_show_caption, false, abort_callback_dummy());

				preset_default.m_name = "NG Playlist + Playlist Tabs + Item Details + Artwork";
				preset_default.m_guid = columns_ui::panels::guid_horizontal_splitter;

				splitter->get_config(&stream_writer_memblock_ref(preset_default.m_val, true), abort_callback_impl());


				p_out.insert_item(preset_default, preset_tabs_all);
			}
		}
	}
}
示例#22
0
	BOOL CALLBACK FCLDialogProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
	{
		switch(msg)
		{
		case WM_INITDIALOG:
			{
				if (m_import)
					SetWindowText(wnd, _T("Select settings to import"));
				HWND wnd_tree = GetDlgItem(wnd, IDC_TREE);
				HWND wnd_combo = m_import ? NULL : GetDlgItem(wnd, IDC_DEST);
				SetWindowLongPtr(wnd_tree, GWL_STYLE, GetWindowLongPtr(wnd_tree, GWL_STYLE)|TVS_CHECKBOXES);

				uih::SetTreeViewWindowExplorerTheme(wnd_tree);

				if (wnd_combo)
				{
					ComboBox_AddString(wnd_combo, L"Any foobar2000 installation");
					ComboBox_AddString(wnd_combo, L"This foobar2000 installation");
					ComboBox_SetCurSel(wnd_combo, 0);
				}

				SendMessage(wnd_tree, WM_SETREDRAW, FALSE, 0);
				TreeView_SetItemHeight(wnd_tree, TreeView_GetItemHeight(wnd_tree)+2);

				cui::fcl::group_list m_groups;
				if (m_import)
				{
					cui::fcl::dataset_list datasets;
					pfc::list_t<GUID> groupslist;
					t_size j, count = datasets.get_count();
					for (j=0; j<count; j++)
					{
						if (m_filter.have_item(datasets[j]->get_guid()))
						{
							GUID guid = datasets[j]->get_group();
							if (!groupslist.have_item(guid))
								groupslist.add_item(guid);

							cui::fcl::group_ptr ptr;
							while (m_groups.find_by_guid(guid, ptr))
							{
								guid = ptr->get_parent_guid();
								if (guid != pfc::guid_null)
									if (!groupslist.have_item(guid))
										groupslist.add_item(guid);
								else break;

							}
						}
					}
					t_size i = m_groups.get_count();
					for (; i; i--)
						if (!groupslist.have_item(m_groups[i-1]->get_guid()))
							m_groups.remove_by_idx(i-1);
				}
				m_groups.sort_by_name();
				cui::fcl::group_list_filtered filtered(m_groups, pfc::guid_null);
				g_populate_tree(wnd_tree, m_groups, filtered);

				SendMessage(wnd_tree, WM_SETREDRAW, TRUE, 0);
				RedrawWindow(wnd_tree,NULL,NULL,RDW_INVALIDATE|RDW_UPDATENOW);
			}
			return TRUE;
		case WM_COMMAND:
			switch (wp)
			{
			case IDOK:
				{
					HWND wnd_tree = GetDlgItem(wnd, IDC_TREE);
					t_size i, count = m_nodes.get_count();
					for (i=0; i<count; i++)
					{
						m_nodes[i].checked = 0 != TreeView_GetCheckState(wnd_tree, m_nodes[i].item);
					}
					HWND wnd_combo = m_import ? NULL : GetDlgItem(wnd, IDC_DEST);
					if (wnd_combo)
					{
						m_mode = ComboBox_GetCurSel(wnd_combo);
					}
				}
				EndDialog(wnd, 1);
				return FALSE;
			case IDCANCEL:
				EndDialog(wnd, 0);
				return FALSE;
			}
			break;
		case WM_CLOSE:
			EndDialog(wnd, 0);
			return 0;
		case WM_DESTROY:
			{
				HWND wnd_tree = GetDlgItem(wnd, IDC_TREE);
				HIMAGELIST il = TreeView_GetImageList(wnd_tree, TVSIL_STATE);
				TreeView_SetImageList(wnd_tree, NULL, TVSIL_STATE);
				ImageList_Destroy(il);
				DestroyWindow(wnd_tree);
			}
			break;
		case WM_NCDESTROY:
			break;
		}

		return FALSE;
	}