./cell_playlist.lua

  1. local	CELL_PLAYLIST_GET_STATIONS = 0 
  2. local CELL_PLAYLIST_GET_SONGS 	= 1 
  3.  
  4. local STATION_ID_KRUU = 1 
  5. local STATION_ID_MAX	 = 2 
  6. local STATION_ID_DEAD = 3 
  7.  
  8. local Station_data = {} 
  9. local Playlist_data = {} 
  10.  
  11. List_left = -1 
  12. List_right = -1 
  13. List_active = -1 
  14.  
  15. local List_data_stations = { 
  16. 	[1] = { 
  17. 		id = STATION_ID_KRUU, 
  18. 		type = TYPE_BUTTON, 
  19. 		label = "KRUU 107.1", 
  20. 	}, 
  21. 	[2] = { 
  22. 		id = STATION_ID_MAX, 
  23. 		type = TYPE_BUTTON, 
  24. 		label = "MAX 97.5", 
  25. 	}, 
  26. 	[3] = { 
  27. 		id = STATION_ID_DEAD, 
  28. 		type = TYPE_BUTTON, 
  29. 		label = "DEADBOMB 89.1", 
  30. 	}, 
  31. } 
  32. local List_data_tracklist = {}  
  33.  
  34. local List_data_left = {}  
  35. local List_data_right = {} 
  36. local List_data_current_station = -1 
  37.  
  38. local List_data_left_is_empty 
  39. local List_data_right_is_empty 
  40.  
  41. local LIST_FOCUS_LEFT 	= 1 
  42. local LIST_FOCUS_RIGHT 	= 2 
  43.  
  44. local LIST_RIGHT_STATE_NAV		= 1 
  45. local LIST_RIGHT_STATE_MOVING = 2 
  46.  
  47. local LIST_LEFT_STATE_STATION = 1 
  48. local LIST_LEFT_STATE_TRACKLIST = 2 
  49.  
  50. local List_right_state  
  51. local List_left_state  
  52.  
  53. local	Artist_name_text_h = -1 
  54. local Track_name_text_h = -1 
  55.  
  56.  
  57. List_data_right[1] = { 
  58. 	id = 20041, 
  59. 	type = TYPE_BUTTON, 
  60. 	label = "NO_", 
  61. 	track_id = 20041, 
  62. } 
  63.  
  64. --Empty playlist default.. 
  65. local List_data_no_playlist = { 
  66. 	[1] = { 
  67. 		id = -1, 
  68. 		type = TYPE_BUTTON, 
  69. 		label = "PLAYLIST_NO_ITEMS", 
  70. 		track_id = -1, 
  71. 	} 
  72. }		 
  73.  
  74. --Empty playlist default.. 
  75. local List_data_no_stationlist = { 
  76. 	[1] = { 
  77. 		id = -1, 
  78. 		type = TYPE_BUTTON, 
  79. 		label = "PLAYLIST_NO_STATION_ITEMS", 
  80. 		track_id = -1, 
  81. 	} 
  82. }		 
  83.  
  84. local Input_tracker_left 
  85. local Input_tracker_right  
  86. local Hint_bar 
  87.  
  88. local Hint_bar_mouse_input_tracker 
  89. local Mouse_input_tracker 
  90.  
  91. local LIST_SIZE = 400 
  92. local LIST_ITEMS = 12 
  93. local LIST_SCALE = .8 
  94. local Cell_playlist_doc_h 
  95.  
  96. ------------------------------------------------------------------------------- 
  97. -- Menu hints... 
  98. -- 
  99. local Station_menu_hints = { 
  100. 	{CTRL_MENU_BUTTON_B, "MENU_BACK"}, 
  101. 	{CTRL_MENU_BUTTON_A, "PLAYLIST_SELECT_STATION"}, 
  102. } 
  103. local Song_menu_hints = { 
  104. 	{CTRL_MENU_BUTTON_B, "MENU_BACK"}, 
  105. 	{CTRL_MENU_BUTTON_A, "PLAYLIST_ADD_TRACK"}, 
  106. } 
  107. local Song_menu_empty_hints = { 
  108. 	{CTRL_MENU_BUTTON_B, "MENU_BACK"}, 
  109. } 
  110. local Playlist_menu_hints = { 
  111. 	{CTRL_MENU_BUTTON_B, "MENU_BACK"}, 
  112. 	{CTRL_MENU_BUTTON_A, "PLAYLIST_MOVE_TRACK"}, 
  113. 	{CTRL_BUTTON_X, "PLAYLIST_REMOVE_TRACK", game_get_key_name(211)}, --"del" 
  114. } 
  115. local Playlist_menu_no_moving_hints = { 
  116. 	{CTRL_MENU_BUTTON_B, "MENU_BACK"}, 
  117. 	{CTRL_BUTTON_X, "PLAYLIST_REMOVE_TRACK", game_get_key_name(211)}, --"del" 
  118. } 
  119.  
  120. local Playlist_menu_move_hints = { 
  121. 	{CTRL_MENU_BUTTON_B, "MENU_BACK"}, 
  122. 	{CTRL_MENU_BUTTON_A, "MENU_TITLE_CONFIRM"} 
  123. } 
  124.  
  125.  
  126. function cell_playlist_init() 
  127. 	local Cell_playlist_doc_h = vint_document_find("cell_playlist") 
  128. 	List_left = Vdo_mega_list:new("plist_left", 0, Cell_playlist_doc_h, "cell_playlist.lua", "List_left") 
  129. 	List_right = Vdo_mega_list:new("plist_right", 0, Cell_playlist_doc_h, "cell_playlist.lua", "List_right") 
  130. 	 
  131. 	--set colors for mixtape list... 
  132. 	List_left:set_highlight_color(COLOR_CHEATS_PRIMARY, COLOR_CHEATS_SECONDARY)	 
  133. 	List_right:set_highlight_color(COLOR_CHEATS_PRIMARY, COLOR_CHEATS_SECONDARY)	 
  134. 	 
  135. 	--Datasubscribe and popluate lists... 
  136. 	List_data_stations = { } 
  137. 	List_data_tracklist = { } 
  138. 	vint_dataresponder_request("cell_playlist_populate", "station_populate", 0, CELL_PLAYLIST_GET_STATIONS) 
  139. 	vint_dataresponder_request("cell_playlist_populate", "plist_populate", 0, CELL_PLAYLIST_GET_SONGS) 
  140. 	 
  141. 	--Empty playlist on right... 
  142. 	List_data_right = plist_generate_right() 
  143.  
  144. 	--Copy stations into left side of list... 
  145. 	List_data_left = table_clone(List_data_stations) 
  146. 	List_left_state = LIST_LEFT_STATE_STATION 
  147. 	 
  148. 	List_left:draw_items(List_data_left, 1, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  149. 	List_right:draw_items(List_data_right, 1, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  150. 	-- subscribe to common inputs 
  151. 	Input_tracker_left = Vdo_input_tracker:new() 
  152. 	Input_tracker_left:add_input("pause", "plist_nav_do_nothing", 50) 
  153. 	Input_tracker_left:add_input("map", "plist_nav_exit", 50) 
  154. 	Input_tracker_left:add_input("select", "plist_left_nav", 50) 
  155. 	Input_tracker_left:add_input("alt_select", "plist_left_nav", 50) 
  156. 	Input_tracker_left:add_input("back", "plist_left_nav", 50)	 
  157. 	Input_tracker_left:add_input("nav_up", "plist_left_nav", 50) 
  158. 	Input_tracker_left:add_input("nav_down", "plist_left_nav", 50) 
  159. 	Input_tracker_left:add_input("nav_left", "plist_left_nav", 50) 
  160. 	Input_tracker_left:add_input("nav_right", "plist_left_nav", 50) 
  161. 	Input_tracker_left:subscribe(false) 
  162. 	 
  163. 	Input_tracker_right = Vdo_input_tracker:new() 
  164. 	Input_tracker_right:add_input("pause", "plist_nav_do_nothing", 50) 
  165. 	Input_tracker_right:add_input("map", "plist_nav_exit", 50) 
  166. 	Input_tracker_right:add_input("select", "plist_right_nav", 50) 
  167. 	if game_get_platform() == "PC" then 
  168. 		Input_tracker_right:add_input("scancode", "plist_right_nav", 50, false, 211) --'del' key 
  169. 		Input_tracker_right:add_input("gamepad_x", "plist_right_nav", 50) 
  170. 	else 
  171. 		Input_tracker_right:add_input("alt_select", "save_load_button_y", 50) 
  172. 	end 
  173. 	Input_tracker_right:add_input("back", "plist_right_nav", 50)	 
  174. 	Input_tracker_right:add_input("nav_up", "plist_right_nav", 50) 
  175. 	Input_tracker_right:add_input("nav_down", "plist_right_nav", 50) 
  176. 	Input_tracker_right:add_input("nav_left", "plist_right_nav", 50) 
  177. 	Input_tracker_right:add_input("nav_right", "plist_right_nav", 50) 
  178. 	Input_tracker_right:subscribe(false) 
  179. 	 
  180. 	List_active = LIST_FOCUS_LEFT 
  181. 	List_left:toggle_highlight(true) 
  182. 	List_right:toggle_highlight(false) 
  183. 	List_right_state = LIST_RIGHT_STATE_NAV 
  184. 	 
  185. 	--Setup Button Hints 
  186. 	Hint_bar = Vdo_hint_bar:new("playlist_hints", 0, Cell_playlist_doc_h) 
  187. 	Hint_bar:set_hints(Station_menu_hints)  
  188. 	Hint_bar:set_visible(true)	 
  189.  
  190. 	Artist_name_text_h = vint_object_find("label_1_txt") 
  191. 	Track_name_text_h = vint_object_find("label_2_txt") 
  192. 	 
  193. 	plist_set_track_artist(nil) 
  194. 	 
  195. 	--Transition the screen in... 
  196. 	cell_transition_screen(CELL_STATE_LANDSCAPE, CELL_SCREEN_PLAYLIST, CELL_SCREEN_MUSIC_SUB, cell_playlist_gained_focus) 
  197. 	 
  198. 	if game_get_platform() == "PC" then 
  199. 		Hint_bar:set_highlight(0) 
  200. 		 
  201. 		Hint_bar_mouse_input_tracker = Vdo_input_tracker:new() 
  202. 		Hint_bar:add_mouse_inputs("cell_playlist", Hint_bar_mouse_input_tracker) 
  203. 		Hint_bar_mouse_input_tracker:subscribe(true) 
  204. 		 
  205. 		Mouse_input_tracker = Vdo_input_tracker:new() 
  206. 		List_left:add_mouse_inputs("cell_playlist", Mouse_input_tracker) 
  207. 		Mouse_input_tracker:subscribe(true) 
  208. 	end 
  209. end 
  210.  
  211. function station_populate(station_name, station_id) 
  212. 	local index = #List_data_stations + 1 
  213. 	List_data_stations[index] = { label = station_name, id = station_id, type = TYPE_BUTTON	} 
  214. end 
  215.  
  216. function get_station_index_from_id(station_id)  
  217. 	for i = 1, #List_data_stations do 
  218. 		if List_data_stations[i].id == station_id then 
  219. 			return i 
  220. 		end 
  221. 	end 
  222. end 
  223.  
  224. function plist_populate(artist, track, track_id, station_id, playlist_index) 
  225. 	local index = #Playlist_data + 1 
  226. 	Playlist_data[index] = { 
  227. 		artist = artist, 
  228. 		track = track, 
  229. 		track_id = track_id, 
  230. 		station_id = station_id, 
  231. 		station_index = get_station_index_from_id(station_id), 
  232. 		playlist_index = playlist_index, 
  233. 		internal_id = index, 
  234. 	} 
  235. end 
  236.  
  237. function plist_generate_right() 
  238. 	local num_items = #Playlist_data 
  239. 	local item  
  240. 	local playlist_items = {} 
  241. 	local num_playlist_items = 0 
  242. 	--loop through items and see which ones are in the playlist... 
  243. 	for i = 1, num_items do 
  244. 		item = Playlist_data[i] 
  245. 		if item.playlist_index ~= -1 then 
  246. 			--its in the playlist... save it off... 
  247. 			num_playlist_items = #playlist_items + 1 
  248. 			playlist_items[num_playlist_items] = item 
  249. 		end 
  250. 	end 
  251.  
  252. 	--now we have a list of playlist items... 
  253. 	if num_playlist_items > 0 then 
  254. 		--we need to bubble sort them for the playlist order... 
  255. 		local temp_item_storage 
  256. 		local flag = false 
  257. 		while flag == false do 
  258. 			flag = true 
  259. 			for i = 1, num_playlist_items - 1 do 
  260. 				if playlist_items[i].playlist_index > playlist_items[i + 1].playlist_index then 
  261. 					--swap indexes if the priority is greater 
  262. 					temp_item_storage = table_clone(playlist_items[i]) 
  263. 					playlist_items[i] = table_clone(playlist_items[i + 1]) 
  264. 					playlist_items[i + 1] = temp_item_storage   
  265. 					flag = false 
  266. 					break 
  267. 				end 
  268. 			end 
  269. 		end 
  270. 		 
  271. 		--sort the data into  
  272. 		local data = {} 
  273. 		 
  274. 		for i = 1, num_playlist_items do 
  275. 			data[i] = { 
  276. 				type = TYPE_BUTTON, 
  277. 				label = playlist_items[i].artist .. " - " .. playlist_items[i].track, 
  278. 				internal_id = playlist_items[i].internal_id 
  279. 			} 
  280. 		end 
  281. 		 
  282. 		List_data_right_is_empty = false 
  283. 		return data 
  284. 	else 
  285. 		--no items pass back empty list... 
  286. 		List_data_right_is_empty = true 
  287. 		return List_data_no_playlist 
  288. 	end 
  289. 	 
  290. 	--[[ DEBUG 
  291. 	for i = 1, num_playlist_items do 
  292. 		local artist = playlist_items[i].artist 
  293. 		local playlist_index = playlist_items[i].playlist_index 
  294. 		debug_print("vint", "playlist_index: " .. var_to_string(playlist_index) .. "artist: " .. var_to_string(artist) .. " : " .. i .. "\n") 
  295. 	end 
  296. 	]] 
  297. end 
  298.  
  299. function plist_generate_station_tracks(station_id) 
  300. 	local num_items = #Playlist_data 
  301. 	local item  
  302. 	local station_items = {} 
  303. 	local num_station_items 
  304. 	--loop through items and see which ones are in the station... 
  305. 	for i = 1, num_items do 
  306. 		item = Playlist_data[i] 
  307. 		if item.station_id == station_id and item.playlist_index == -1 then 
  308. 			--its in the station... save it off... 
  309. 			num_station_items = #station_items + 1 
  310. 			station_items[num_station_items] = item 
  311. 		end 
  312. 	end 
  313.  
  314. 	if #station_items == 0 then 
  315. 		--no items... 
  316. 		return station_items 
  317. 	end 
  318. 	 
  319. 	--we need to bubble sort them for the playlist order... 
  320. 	local temp_item_storage 
  321. 	local flag = false 
  322. 	while flag == false do 
  323. 		flag = true 
  324. 		for i = 1, num_station_items - 1 do 
  325. 			if station_items[i].playlist_index > station_items[i + 1].playlist_index then 
  326. 				--swap indexes if the priority is greater 
  327. 				temp_item_storage = table_clone(station_items[i]) 
  328. 				station_items[i] = table_clone(station_items[i + 1]) 
  329. 				station_items[i + 1] = temp_item_storage   
  330. 				flag = false 
  331. 				break 
  332. 			end 
  333. 		end 
  334. 	end 
  335. 	 
  336. 	 
  337. 	--format into list data... 
  338. 	local list_data = {} 
  339. 	for i = 1, num_station_items do 
  340. 		list_data[i] = { 
  341. 			type = TYPE_BUTTON, 
  342. 			label = station_items[i].artist .. " - " .. station_items[i].track, 
  343. 			internal_id = station_items[i].internal_id 
  344. 		} 
  345. 	end 
  346. 	 
  347. 	return list_data 
  348. end 
  349.  
  350. --Adds an item to the end of a list... 
  351. function plist_song_list_add(internal_id) 
  352.  
  353. 	--make sure this list isn't empty... 
  354. 	if List_data_right_is_empty then 
  355. 		--if its empty lets actually make it empty.. 
  356. 		List_data_right = {} 
  357. 		List_data_right_is_empty = false 
  358. 	end 
  359. 	 
  360. 	--get next playlist index... 
  361. 	local playlist_index = #List_data_right + 1 
  362. 	 
  363. 	local item = Playlist_data[internal_id] 
  364. 	--Give the internal copy a new playlist index... 
  365. 	item.playlist_index = playlist_index 
  366. 	 
  367. 	List_data_right[playlist_index] = 	{ 
  368. 		type = TYPE_BUTTON, 
  369. 		label = item.artist .. " - " .. item.track, 
  370. 		internal_id = internal_id, 
  371. 	} 
  372. end 
  373.  
  374. ----------------------------------------- 
  375. -- Removes a specific item in the list... 
  376. ----------------------------------------- 
  377. function plist_song_list_remove_item(list, index) 
  378.  
  379. 	--get the number of items in list... 
  380. 	local num_items = #list 
  381. 	 
  382. 	-- remove item in list... 
  383. 	local list_item = table_clone(list[index]) 
  384. 	list[index] = nil 
  385. 	 
  386. 	--Remove this item from playlist internal data it should end up back on the left list... 
  387. 	local internal_id = list_item.internal_id 
  388. 	local item = Playlist_data[internal_id] 
  389. 		 
  390. 	if item ~= nil then 
  391. 		--Give the internal copy a new playlist index... 
  392. 		item.playlist_index = -1 
  393. 		 
  394. 		--slide everthing beyond that item in the list back one... 
  395. 		for loop_index = index, num_items do 
  396. 			--table clone next item 
  397. 			list[loop_index] = table_clone(list[loop_index+1]) 
  398. 		end 
  399. 	end 
  400. 	 
  401. 	--delete last item in list... 
  402. 	list[num_items] = nil 
  403.  
  404. 	return list_item 
  405. end 
  406.  
  407. ---------------------------------------------------------------------------------- 
  408. -- Inserts an item in the list at specific index. 
  409. -- 
  410. -- @param	list 			table to modify... 
  411. -- @param	list_item 	item to insert 
  412. -- @param	index 		index at when to insert... 
  413. ---------------------------------------------------------------------------------- 
  414. function plist_song_list_insert_item(list, list_item, index) 
  415. 	local num_items = (#list) 
  416.  
  417. 	--slide everthing forward that item in the list back one... 
  418. 	for loop_index = num_items, index, -1 do 
  419. 		--table each item into slot above... 
  420. 		local next_item = loop_index + 1 
  421. 		list[next_item] = table_clone(list[loop_index]) 
  422. 		 
  423. 		--Remove this item from playlist internal data it should end up back on the left list... 
  424. 		local internal_id = list[next_item].internal_id 
  425. 		local item = Playlist_data[internal_id] 
  426. 	 
  427. 		--Give the internal copy a new playlist index... 
  428. 		item.playlist_index = next_item 
  429. 	end 
  430. 	 
  431. 	local item = Playlist_data[list_item.internal_id] 
  432.  
  433. 	--Give the internal copy a new playlist index... 
  434. 	item.playlist_index = index 
  435. 	 
  436. 	-- items all shifted... now insert our items want.. 
  437. 	list[index] = list_item 
  438. end 
  439.  
  440. ------------------------------------------------------------------------------- 
  441. -- Play list left nav... 
  442. ------------------------------------------------------------------------------- 
  443. function plist_left_nav(event) 
  444. 	if event == "select" then 
  445. 		if List_left_state == LIST_LEFT_STATE_STATION then 
  446. 			--Navigate to song menu... need to build it... 
  447. 			--Get current station id... and generate the station tracks... 
  448. 			local station_id = List_left:get_id() 
  449. 			List_data_current_station = station_id 
  450. 			List_data_left = plist_generate_station_tracks(station_id) 
  451. 			 
  452. 			if #List_data_left == 0 then 
  453. 				List_data_left = List_data_no_stationlist 
  454. 				List_data_left_is_empty = true 
  455. 			else  
  456. 				List_data_left_is_empty = false 
  457. 			end 
  458. 			 
  459. 			--Populate items in left list... 
  460. 			List_left:draw_items(List_data_left, 1, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  461. 			 
  462. 			List_left_state = LIST_LEFT_STATE_TRACKLIST 
  463. 			 
  464. 			cell_playlist_update_mouse_inputs(true, false) 
  465. 		else 
  466. 			if List_data_left_is_empty == true then 
  467. 				-- cannot add from an empty list... 
  468. 				return 
  469. 			end 
  470. 			--Move from track list to playlist... 
  471. 			--get track info... 
  472. 			local list_item = List_left:return_selected_data() 
  473. 			local left_index = List_left:get_selection() 
  474. 			local internal_id = list_item.internal_id 
  475.  
  476. 			--TODO: Make sure we havn't removed all the items so we can select the right index... 
  477. 			plist_song_list_remove_item(List_data_left, left_index) 
  478. 			 
  479. 			--Add item to list on right... 
  480. 			plist_song_list_add(internal_id) 
  481. 			 
  482. 			List_right:draw_items(List_data_right, #List_data_right, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  483. 			List_right:toggle_highlight(false) 
  484. 			 
  485. 			if #List_data_left == 0 then 
  486. 				List_data_left = List_data_no_stationlist 
  487. 				List_data_left_is_empty = true 
  488. 			end 
  489. 			 
  490. 			List_left:draw_items(List_data_left, left_index, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  491. 		 
  492. 			cell_playlist_update_mouse_inputs(true, false) 
  493. 		end	 
  494. 	elseif event == "back" then 
  495. 		if List_left_state == LIST_LEFT_STATE_TRACKLIST then 
  496. 			List_data_left = table_clone(List_data_stations) 
  497. 			 
  498. 			local selected_index = get_station_index_from_id(List_data_current_station) 
  499. 			 
  500. 			--Populate items in left list... 
  501. 			List_left:draw_items(List_data_left, selected_index, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  502. 			List_left_state = LIST_LEFT_STATE_STATION 
  503. 			 
  504. 			List_data_current_station = -1 
  505. 			--Update hints 
  506. 			Hint_bar:set_hints(Station_menu_hints) 
  507. 			cell_playlist_update_mouse_inputs(false, true) 
  508. 		else 
  509. 			--nav out of menu 
  510. 			cell_playlist_exit() 
  511. 		end 
  512. 	elseif event == "alt_select" then 
  513. 		--do nothing... 
  514. 		return 
  515. 	elseif event == "nav_up" then 
  516. 		if #List_data_left == 1 then 
  517. 			-- don't nav if we only have one item in list... 
  518. 			return 
  519. 		end 
  520. 		List_left:move_cursor(-1) 
  521. 	elseif event == "nav_down" then 
  522. 		if #List_data_left == 1 then 
  523. 			-- don't nav if we only have one item in list... 
  524. 			return 
  525. 		end 
  526. 		List_left:move_cursor(1) 
  527. 	elseif event == "nav_left" or event == "nav_right" then 
  528. 		if List_data_right_is_empty ~= true then 
  529. 			--only nav right if our playlist is full... 
  530. 			plist_nav_swap() 
  531. 		 
  532. 			--Reset hints because we exit early... 
  533. 			plist_set_hint_and_button_states() 
  534. 		end 
  535. 		return 
  536. 	end 
  537. 	 
  538. 	if List_left_state == LIST_LEFT_STATE_TRACKLIST then 
  539. 		plist_set_track_artist(List_left:return_selected_data()) 
  540. 	else 
  541. 		plist_set_track_artist(nil) 
  542. 	end 
  543. 	 
  544. 	--Set button states after any events... 
  545. 	plist_set_hint_and_button_states() 
  546. end 
  547.  
  548. local swap_index = 1 
  549. ------------------------------------------------------------------------------- 
  550. -- Play list right nav... 
  551. ------------------------------------------------------------------------------- 
  552. function plist_right_nav(event) 
  553. 	if event == "select" then 
  554. 		--Moving track functionality only works if we have 2 or more items. 
  555. 		if #List_data_right > 1 then 
  556. 			 
  557. 			-- Turn into movable item... 
  558. 			if List_right_state == LIST_RIGHT_STATE_NAV then 
  559. 				--change to moving state... 
  560. 				List_right_state = LIST_RIGHT_STATE_MOVING 
  561. 				 
  562. 				-- Remove and reinsert the item as new/flashing 
  563. 				local current_selection = List_right:get_selection() 
  564. 				swap_index = current_selection 
  565. 				local list_item = plist_song_list_remove_item(List_data_right, current_selection) 
  566. 				list_item.is_new = true 
  567. 				plist_song_list_insert_item(List_data_right, list_item, current_selection) 
  568. 				List_right:draw_items(List_data_right, current_selection, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  569. 			 
  570. 			elseif List_right_state == LIST_RIGHT_STATE_MOVING then 
  571. 				--change to naving state... 
  572. 				List_right_state = LIST_RIGHT_STATE_NAV 
  573. 				 
  574. 				-- Remove and reinsert the swap index into the current selection's spot 
  575. 				local current_selection = List_right:get_selection() 
  576. 				local list_item = plist_song_list_remove_item(List_data_right, swap_index) 
  577. 				list_item.is_new = false 
  578. 				plist_song_list_insert_item(List_data_right, list_item, current_selection) 
  579. 				List_right:draw_items(List_data_right, current_selection, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  580. 			end 
  581. 		end 
  582. 	elseif event == "alt_select" or event == "gamepad_x" or event == "scancode" then 
  583. 		if List_right_state == LIST_RIGHT_STATE_MOVING then 
  584. 			--do nothing... 
  585. 			return 
  586. 		end 
  587. 		-- Remove Track 
  588. 		--swap items... 
  589. 		local current_selection = List_right:get_selection() 
  590. 		local list_item = plist_song_list_remove_item(List_data_right, current_selection) 
  591. 		 
  592. 		if List_data_current_station ~= -1 then 
  593. 			List_data_left = plist_generate_station_tracks(List_data_current_station) 
  594. 			 
  595. 			if #List_data_left == 0 then 
  596. 				List_data_left = List_data_no_stationlist 
  597. 				List_data_left_is_empty = true 
  598. 			else  
  599. 				List_data_left_is_empty = false 
  600. 			end 
  601. 		end 
  602. 		local left_selection = List_left:get_selection() 
  603. 		--Populate items in left list... 
  604. 		List_left:draw_items(List_data_left, left_selection, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  605. 		List_left:toggle_highlight(false)	--hide highlight after redraw. 
  606. 		 
  607. 		-- check if new playlist isn't empty. 
  608. 		if #List_data_right == 0 then 
  609. 			List_data_right = table_clone(List_data_no_playlist) 
  610. 			List_data_right_is_empty = true 
  611. 		end 
  612. 		 
  613. 		List_right:draw_items(List_data_right, current_selection, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  614. 		 
  615. 		if List_data_right_is_empty then 
  616. 			--nav back left... 
  617. 			plist_nav_swap() 
  618. 			plist_set_hint_and_button_states() 
  619. 			 
  620. 			cell_playlist_update_mouse_inputs(true, false) 
  621. 			return 
  622. 		end 
  623. 		 
  624. 	elseif event == "back" then 
  625. 		-- Go back to station select (or exit) 
  626. 		plist_left_nav("back") 
  627. 		plist_set_hint_and_button_states() 
  628. 		 
  629. 		-- Turn off the left highlight (it gets reactivated by redrawing the left list) 
  630. 		List_left:toggle_highlight(false) 
  631. 		return 
  632. 	elseif event == "nav_up" then 
  633. 		 
  634. 		if #List_data_right == 1 then 
  635. 			-- don't nav if we only have one item in list... 
  636. 			return 
  637. 		end 
  638. 		 
  639. 		if List_right_state == LIST_RIGHT_STATE_NAV then 
  640. 			List_right:move_cursor(-1) 
  641. 		elseif List_right_state == LIST_RIGHT_STATE_MOVING then 
  642. 			--swap items... 
  643. 			local current_selection = swap_index --List_right:get_selection() 
  644. 			 
  645. 			--insert into previous slot... 
  646. 			local next_slot = current_selection - 1 
  647. 			if next_slot < 1 then 
  648. 				next_slot = #List_data_right 
  649. 			end 
  650. 						 
  651. 			--get track info and remove item from list... 
  652. 			local list_item = plist_song_list_remove_item(List_data_right, current_selection) 
  653. 			 
  654. 			plist_song_list_insert_item(List_data_right, list_item, next_slot) 
  655. 			 
  656. 			List_right:draw_items(List_data_right, current_selection, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  657. 			List_right:move_cursor(-1) 
  658. 			swap_index = next_slot 
  659. 		end 
  660.  
  661. 	elseif event == "nav_down" then 
  662. 		 
  663. 		if #List_data_right == 1 then 
  664. 			-- don't nav if we only have one item in list... 
  665. 			return 
  666. 		end 
  667. 		 
  668. 		if List_right_state == LIST_RIGHT_STATE_NAV then 
  669. 			List_right:move_cursor(1) 
  670. 		elseif List_right_state == LIST_RIGHT_STATE_MOVING then 
  671. 			--swap items... 
  672. 			local current_selection = swap_index --List_right:get_selection() 
  673.  
  674. 			--insert into next slot... 
  675. 			local next_slot = current_selection + 1 
  676. 			if next_slot > #List_data_right then 
  677. 				next_slot = 1 
  678. 			end 
  679. 		 
  680. 			--get track info... 
  681. 			local list_item = plist_song_list_remove_item(List_data_right, current_selection) 
  682. 			 
  683. 			plist_song_list_insert_item(List_data_right, list_item, next_slot) 
  684. 			 
  685. 			List_right:draw_items(List_data_right, current_selection, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  686. 			List_right:move_cursor(1) 
  687. 			swap_index = next_slot 
  688. 		end 
  689. 		 
  690. 	elseif event == "nav_left" or event == "nav_right" then 
  691. 		--Swap nav... 
  692. 		plist_nav_swap() 
  693. 		 
  694. 		--Reset hints because we exit early... 
  695. 		plist_set_hint_and_button_states() 
  696. 		cell_playlist_update_mouse_inputs(false, true) 
  697. 		return 
  698. 	end 
  699. 	 
  700. 	if List_right_state == LIST_RIGHT_STATE_NAV then 
  701. 		plist_set_track_artist(List_right:return_selected_data()) 
  702. 	end 
  703. 	 
  704. 		--Set button states after any events... 
  705. 	plist_set_hint_and_button_states() 
  706. 	cell_playlist_update_mouse_inputs(true, true) 
  707. end 
  708.  
  709. ------------------------------------------------------------------------------- 
  710. -- Updates button states depending on what state we are in. 
  711. -- This has to be done because the highlight must be reset when we redraw the lists. 
  712. -- We redraw so often its easiest to do this all in one function. 
  713. -- 
  714. function plist_set_hint_and_button_states() 
  715.  
  716. 	--set titles of menus 
  717. 	local header_left_h = vint_object_find("playlist_header_left") 
  718. 	if List_left_state == LIST_LEFT_STATE_TRACKLIST then 
  719. 		--set title to tracklist 
  720. 		vint_set_property(header_left_h, "text_tag","PLAYLIST_HEADER_TRACKS") 
  721. 	else 
  722. 		--set title to station  
  723. 		vint_set_property(header_left_h, "text_tag","PLAYLIST_HEADER_STATIONS") 
  724. 	end 
  725.  
  726. 	local hint_data = {} 
  727. 	if List_active == LIST_FOCUS_LEFT then 
  728. 		if List_data_left_is_empty and List_left_state == LIST_LEFT_STATE_TRACKLIST then 
  729. 			--Hide button 
  730. 			List_left:highlight_set_button("") 
  731. 			hint_data = Song_menu_empty_hints 
  732. 		else 
  733. 			if List_left_state == LIST_LEFT_STATE_STATION then 
  734. 				--Left Station State 
  735. 				List_left:highlight_set_button(CTRL_MENU_BUTTON_A) 
  736. 				hint_data = Station_menu_hints 
  737. 			elseif List_left_state == LIST_LEFT_STATE_TRACKLIST then 
  738. 				--Left Tracklist State 
  739. 				List_left:highlight_set_button(CTRL_MENU_BUTTON_A) 
  740. 				hint_data = Song_menu_hints 
  741. 			end 
  742. 		end 
  743. 	elseif List_active == LIST_FOCUS_RIGHT then 
  744. 		if List_data_right_is_empty then 
  745. 			--Hide button 
  746. 			List_right:highlight_set_button("") 
  747. 			hint_data = Song_menu_empty_hints 
  748. 		else 
  749. 			if List_right_state == LIST_RIGHT_STATE_MOVING then 
  750. 				--Right Moving state 
  751. 				List_right:highlight_set_button("ui_cell_playlist_up_down", true) 
  752. 				hint_data = Playlist_menu_move_hints 
  753. 			elseif List_right_state == LIST_RIGHT_STATE_NAV then 
  754. 				local list_right_num_items = #List_data_right 
  755. 				if list_right_num_items > 1 then 
  756. 					--Right Nav state and option to move 
  757. 					List_right:highlight_set_button(CTRL_MENU_BUTTON_A) 
  758. 					hint_data = Playlist_menu_hints 
  759. 				else 
  760. 					-- Only one item no moving here... 
  761. 					List_right:highlight_set_button("") 
  762. 					hint_data = Playlist_menu_no_moving_hints 
  763. 				end 
  764. 			end	 
  765. 		end  
  766. 	end 
  767. 	 
  768. 	-- Override the back button label if stations are not visible 
  769. 	if List_left_state ~= LIST_LEFT_STATE_STATION then 
  770. 		hint_data[1] = {CTRL_MENU_BUTTON_B, "PLAYLIST_HEADER_STATIONS"} 
  771. 	else 
  772. 		hint_data[1] = {CTRL_MENU_BUTTON_B, "MENU_BACK"} 
  773. 	end 
  774. 	Hint_bar:set_hints(hint_data) 
  775. 	cell_playlist_update_mouse_inputs(true, true) 
  776. end 
  777.  
  778.  
  779. --Exit all the way out of the menu 
  780. function plist_nav_exit() 
  781. 	cell_playlist_exit(true) 
  782. end 
  783.  
  784. function plist_nav_swap() 
  785. 	-- Make sure the right list doesn't have a highlighted item 
  786. 	if swap_index <= #List_data_right and List_data_right_is_empty == false then 
  787. 		local list_item = plist_song_list_remove_item(List_data_right, swap_index) 
  788. 		if list_item ~= nil then 
  789. 			list_item.is_new = false 
  790. 			plist_song_list_insert_item(List_data_right, list_item, swap_index) 
  791. 			List_right:draw_items(List_data_right, swap_index, LIST_SIZE, LIST_ITEMS,	LIST_SCALE, true) 
  792. 		end 
  793. 	end 
  794.  
  795. 	--Move navigator between list 
  796. 	if List_active == LIST_FOCUS_LEFT then 
  797. 		--Switch to right side... 
  798. 		Input_tracker_left:subscribe(false) 
  799. 		Input_tracker_right:subscribe(true) 
  800. 		List_left:toggle_highlight(false) 
  801. 		List_right:toggle_highlight(true) 
  802. 		List_active = LIST_FOCUS_RIGHT 
  803. 	else 
  804. 		--Switch to left side 
  805. 		Input_tracker_left:subscribe(true) 
  806. 		Input_tracker_right:subscribe(false) 
  807. 		List_left:toggle_highlight(true) 
  808. 		List_right:toggle_highlight(false) 
  809. 		List_active = LIST_FOCUS_LEFT 
  810. 	end 
  811. 	 
  812. 	--always reset the state of right side when swapping... 
  813. 	List_right_state = LIST_RIGHT_STATE_NAV 
  814. 	 
  815. 	if List_active == LIST_FOCUS_LEFT then 
  816. 		if List_left_state ~= LIST_LEFT_STATE_TRACKLIST then 
  817. 			plist_set_track_artist(nil) 
  818. 		else 
  819. 			local list_item = List_left:return_selected_data() 
  820. 			plist_set_track_artist(list_item) 
  821. 		end 
  822. 	else 
  823. 		local list_item = List_right:return_selected_data() 
  824. 		plist_set_track_artist(list_item) 
  825. 	end 
  826. end 
  827.  
  828.  
  829. Plist_play_thread = -1 
  830. function plist_set_track_artist(track_info) 
  831. 	 
  832. 	if Plist_play_thread ~= -1 then 
  833. 		thread_kill(Plist_play_thread) 
  834. 		Plist_play_thread = -1 
  835. 	end 
  836. 	if track_info == nil or track_info.internal_id == nil then 
  837. 		vint_set_property(Artist_name_text_h, "visible", false) 
  838. 		vint_set_property(Track_name_text_h, "visible", false) 
  839. 		playlist_stop_track() 
  840. 	else 
  841. 		vint_set_property(Artist_name_text_h, "visible", true) 
  842. 		vint_set_property(Track_name_text_h, "visible", true) 
  843. 		 
  844. 		local item = Playlist_data[track_info.internal_id] 
  845. 		vint_set_property(Artist_name_text_h, "text_tag", item.artist) 
  846. 		vint_set_property(Track_name_text_h, "text_tag", item.track) 
  847. 		 
  848. 		Plist_play_thread = thread_new("plist_play_delayed_track", item.track_id) 
  849. 	end 
  850. end 
  851.  
  852. function plist_play_delayed_track(track_id) 
  853. 	delay(0.5) 
  854. 	playlist_play_track(track_id) 
  855. 	Plist_play_thread = -1 
  856. end 
  857.  
  858. function plist_song_list_clear() 
  859. 	List_data_left = {} 
  860. end 
  861.  
  862. function plist_nav_do_nothing() 
  863. 	--do nothing... 
  864. end 
  865.  
  866.  
  867. function cell_playlist_cleanup() 
  868. 	--Guarantee cleanup of controls. 
  869. 	Input_tracker_left:subscribe(false) 
  870. 	Input_tracker_right:subscribe(false) 
  871. end 
  872.  
  873.  
  874. ------------------------------------------------------------------------------- 
  875. -- Changes highlight button on right list to use arrow or standard (a) button 
  876. ------------------------------------------------------------------------------- 
  877. function cell_playlist_list_right_use_arrow(use_arrow) 
  878. 	if use_arrow then 
  879. 		--Change button on list... 
  880.  
  881. 	else 
  882. 		 
  883. 	end 
  884. end 
  885.  
  886. ------------------------------------------------------------------------------- 
  887. -- Exits the playlist menu... 
  888. -- 
  889. function cell_playlist_exit(exit_to_game) 
  890.  
  891. 	vint_dataresponder_post("cell_menu_state_dr", "Set", ID_MAIN) 
  892. 	--save playlist 
  893. 	cell_playlist_save() 
  894. 	 
  895. 	--Lock controls 
  896. 	cell_playlist_lost_focus() 
  897. 	 
  898. 	--do the right exit... 
  899. 	if exit_to_game == true then 
  900. 		cell_transition_screen(CELL_STATE_OUT, CELL_SCREEN_NONE, CELL_SCREEN_PLAYLIST, cell_playlist_exit_to_game) 
  901. 	else 
  902. 		cell_transition_screen(CELL_STATE_PORTRAIT, CELL_SCREEN_MUSIC_SUB, CELL_SCREEN_PLAYLIST, cell_playlist_exit_to_sub) 
  903. 	end 
  904. end 
  905.  
  906.  
  907. ------------------------------------------------------------------------------- 
  908. -- Final exit to cell music sub 
  909. -- 
  910. function cell_playlist_exit_to_sub() 
  911. 	pop_screen() --Playlist Editor 
  912. end 
  913.  
  914. ------------------------------------------------------------------------------- 
  915. -- Final exit to game 
  916. -- 
  917. function cell_playlist_exit_to_game() 
  918. 	pop_screen()	--Playlist Editor 
  919. 	pop_screen()	--music Sub screen 
  920. 	pop_screen()	--main 
  921. 	pop_screen()	--cell frame 
  922. end 
  923.  
  924. function cell_playlist_save() 
  925. 	local Save_list = { } 
  926. 	if List_data_right_is_empty == false then 
  927. 		--if our list isn't empty we can make the savelist... 
  928. 		for i = 1, #List_data_right do 
  929. 			Save_list[i] = Playlist_data[List_data_right[i].internal_id].track_id 
  930. 		end		 
  931. 	end 
  932. 	cell_playlist_save_list(Save_list) 
  933. end 
  934.  
  935. function debug_right_list() 
  936. 	local num_items = #List_data_right 
  937. 	local item  
  938. 	local playlist_items = {} 
  939. 	local num_playlist_items 
  940. 	--loop through items and see which ones are in the playlist... 
  941. 	for i = 1, num_items do 
  942. 		local internal_id = List_data_right[i].internal_id 
  943. 		local artist = Playlist_data[internal_id].artist 
  944. 		local playlist_index = Playlist_data[internal_id].playlist_index 
  945. 		debug_print("vint", "artist: " .. var_to_string(artist) .. " | playlist_index: " .. var_to_string(playlist_index) .. "\n") 
  946. 	end 
  947. end 
  948.  
  949. function cell_playlist_gained_focus() 
  950. 	Input_tracker_left:subscribe(true) 
  951. 	cell_playlist_update_mouse_inputs(true, true) 
  952. end 
  953.  
  954. function cell_playlist_lost_focus() 
  955. 	Input_tracker_left:subscribe(false) 
  956. 	Input_tracker_right:subscribe(false) 
  957. 	if Mouse_input_tracker ~= nil then 
  958. 		Mouse_input_tracker:subscribe(false) 
  959. 		Hint_bar_mouse_input_tracker:subscribe(false) 
  960. 	end 
  961. end 
  962.  
  963. -- Mouse input functions 
  964. -- 
  965.  
  966. function cell_playlist_mouse_right_click(event, target_handle, mouse_x, mouse_y)	 
  967. 	local new_index2 = List_right:get_button_index(target_handle) 
  968. 	if new_index2 ~= 0 then 
  969. 		plist_right_nav("alt_select") 
  970. 	end 
  971. end 
  972.  
  973. function cell_playlist_mouse_click(event, target_handle, mouse_x, mouse_y) 
  974. 	local hint_index = Hint_bar:get_hint_index(target_handle) 
  975. 	 
  976. 	-- Hint bar functionality 
  977. 	if hint_index == 1 then 
  978. 		if List_active == LIST_FOCUS_RIGHT then 
  979. 			plist_left_nav("back") 
  980. 		else 
  981. 			plist_right_nav("back") 
  982. 		end 
  983. 	elseif hint_index == 2 then 
  984. 		if List_active == LIST_FOCUS_RIGHT then 
  985. 			if #List_data_right == 1 then 
  986. 				plist_right_nav("alt_select") 
  987. 			else 
  988. 				plist_right_nav("select") 
  989. 			end 
  990. 		else 
  991. 			plist_left_nav("select") 
  992. 		end 
  993. 	elseif hint_index == 3 then 
  994. 		if List_active == LIST_FOCUS_RIGHT then 
  995. 			plist_right_nav("alt_select") 
  996. 		else 
  997. 		end 
  998. 	end 
  999.  
  1000. 	local new_index = List_left:get_button_index(target_handle) 
  1001. 	if new_index ~= 0 then 
  1002. 		-- Swap navigation if not already focused on this list 
  1003. 		if List_active == LIST_FOCUS_RIGHT then 
  1004. 			plist_nav_swap() 
  1005. 			plist_set_hint_and_button_states() 
  1006. 		end 
  1007. 		List_left:set_selection(new_index) 
  1008. 		List_left:move_cursor(0, true) 
  1009. 		plist_set_track_artist(List_left:return_selected_data()) 
  1010. 		plist_left_nav("select") 
  1011. 	end 
  1012. 	 
  1013. 	local new_index2 = List_right:get_button_index(target_handle) 
  1014. 	if new_index2 ~= 0 then 
  1015. 		-- Swap navigation if not already focused on this list 
  1016. 		if List_active == LIST_FOCUS_LEFT then 
  1017. 			plist_nav_swap() 
  1018. 			plist_set_hint_and_button_states() 
  1019. 		end 
  1020. 		List_right:set_selection(new_index2) 
  1021. 		List_right:move_cursor(0, true) 
  1022. 		plist_set_track_artist(List_right:return_selected_data()) 
  1023. 		plist_right_nav("select") 
  1024. 	end 
  1025. end 
  1026.  
  1027. function cell_playlist_mouse_move(event, target_handle) 
  1028. 	Hint_bar:set_highlight(0) 
  1029. 	 
  1030. 	local hint_index = Hint_bar:get_hint_index(target_handle) 
  1031. 	if hint_index ~= 0 then 
  1032. 		Hint_bar:set_highlight(hint_index) 
  1033. 	end 
  1034. 	 
  1035. 	local new_index = List_left:get_button_index(target_handle) 
  1036. 	if new_index ~= 0 then 
  1037. 		-- Swap navigation if not already focused on this list 
  1038. 		if List_active == LIST_FOCUS_RIGHT then 
  1039. 			plist_nav_swap() 
  1040. 			plist_set_hint_and_button_states() 
  1041. 		end 
  1042. 		List_left:set_selection(new_index) 
  1043. 		List_left:move_cursor(0, true) 
  1044. 		plist_set_track_artist(List_left:return_selected_data()) 
  1045. 	end 
  1046. 	 
  1047. 	local new_index2 = List_right:get_button_index(target_handle) 
  1048. 	if new_index2 ~= 0 then 
  1049. 		-- Swap navigation if not already focused on this list 
  1050. 		if List_active == LIST_FOCUS_LEFT then 
  1051. 			plist_nav_swap() 
  1052. 			plist_set_hint_and_button_states() 
  1053. 		end 
  1054. 		List_right:set_selection(new_index2) 
  1055. 		List_right:move_cursor(0, true) 
  1056. 		plist_set_track_artist(List_right:return_selected_data()) 
  1057. 		if List_right_state == LIST_RIGHT_STATE_MOVING then 
  1058. 			List_right:highlight_set_button("ui_cell_playlist_up_down", true) 
  1059. 		end 
  1060. 	end 
  1061. end 
  1062.  
  1063. function cell_playlist_mouse_scroll(event, target_handle, mouse_x, mouse_y, scroll_lines) 
  1064. 	if scroll_lines ~= 0 then 
  1065. 		if List_left:get_scroll_region_handle() == target_handle then 
  1066. 			List_left:scroll_list(scroll_lines * -1) 
  1067. 			cell_playlist_update_mouse_inputs(true, false) 
  1068. 		elseif List_right:get_scroll_region_handle() == target_handle then 
  1069. 			List_right:scroll_list(scroll_lines * -1) 
  1070. 			cell_playlist_update_mouse_inputs(true, false) 
  1071. 		end 
  1072. 	end 
  1073. end 
  1074.  
  1075. function cell_playlist_mouse_drag(event, target_handle, mouse_x, mouse_y) 
  1076. 	if List_left.scrollbar.tab.handle == target_handle then 
  1077. 		local new_start_index = List_left.scrollbar:drag_scrolltab(mouse_y, List_left.num_buttons - (List_left.max_buttons - 1)) 
  1078. 		List_left:scroll_list(0, new_start_index) 
  1079. 	elseif List_right.scrollbar.tab.handle == target_handle then 
  1080. 		local new_start_index = List_right.scrollbar:drag_scrolltab(mouse_y, List_right.num_buttons - (List_right.max_buttons - 1)) 
  1081. 		List_right:scroll_list(0, new_start_index) 
  1082. 	end 
  1083. end 
  1084.  
  1085. -- Updates the mouse inputs for the list and snaps the scrolltab to the closest notch based on the visible index 
  1086. -- 
  1087. function cell_playlist_mouse_drag_release(event, target_handle, mouse_x, mouse_y) 
  1088. 	if List_left.scrollbar.tab.handle == target_handle then 
  1089. 		local start_index = List_left:get_visible_indices() 
  1090. 		List_left.scrollbar:release_scrolltab(start_index, List_left.num_buttons - (List_left.max_buttons - 1)) 
  1091. 		cell_playlist_update_mouse_inputs(true, false) 
  1092. 	elseif List_right.scrollbar.tab.handle == target_handle then 
  1093. 		local start_index = List_right:get_visible_indices() 
  1094. 		List_right.scrollbar:release_scrolltab(start_index, List_right.num_buttons - (List_right.max_buttons - 1)) 
  1095. 		cell_playlist_update_mouse_inputs(true, false) 
  1096. 	end 
  1097. end 
  1098.  
  1099. function cell_playlist_update_mouse_inputs(update_list, update_hint_bar) 
  1100. 	if Mouse_input_tracker ~= nil then 
  1101. 		if update_list == true then 
  1102. 			-- Remove and add the inputs to both lists (if possible) 
  1103. 			Mouse_input_tracker:remove_all() 
  1104. 			if List_data_left_is_empty == false or List_left_state == LIST_LEFT_STATE_STATION then 
  1105. 				List_left:add_mouse_inputs("cell_playlist", Mouse_input_tracker) 
  1106. 			end 
  1107. 			if List_data_right_is_empty == false then 
  1108. 				List_right:add_mouse_inputs("cell_playlist", Mouse_input_tracker, 0, nil, nil, 0, true) 
  1109. 			end 
  1110. 			Mouse_input_tracker:subscribe(true) 
  1111. 		end 
  1112. 		if update_hint_bar == true then 
  1113. 			-- Remove and add the inputs to the hintbar 
  1114. 			Hint_bar_mouse_input_tracker:remove_all() 
  1115. 			Hint_bar:add_mouse_inputs("cell_playlist", Hint_bar_mouse_input_tracker) 
  1116. 			Hint_bar_mouse_input_tracker:subscribe(true) 
  1117. 		end 
  1118. 	end 
  1119. end