Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1576723
 поиск   регистрация   авторизация 
 
Группа :: Звук
Пакет: xmms

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: xmms-1.2.10-davinchi-queued.patch


diff -NurpP xmms-1.2.10.orig/xmms/playlistwin.c xmms-1.2.10/xmms/playlistwin.c
--- xmms-1.2.10.orig/xmms/playlistwin.c	2005-03-26 18:29:38 +0400
+++ xmms-1.2.10/xmms/playlistwin.c	2005-03-26 18:32:33 +0400
@@ -1558,6 +1558,78 @@ static void playlistwin_keypress_up_down
 
 }
 
+extern GList* queued_list;
+static void playlistwin_insert_queued(PlayList_List* pl, int insert_at, int exchange)
+{
+	int queued_length,index,to_break=0;
+	GList* node;
+
+	queued_length = g_list_length(queued_list);
+
+	if(insert_at > queued_length)
+		insert_at = queued_length;
+
+	PL_LOCK();
+	for(node = get_playlist(); node;node = node->next)
+	{
+		PlaylistEntry *entry = node->data;
+		if(entry->selected)
+		{
+			GList* temp = g_list_find(queued_list,(void*)entry);
+			if(temp)
+			{
+				/* getting index */
+				index = g_list_position(queued_list, temp);
+
+				/* i don't need to move from dest to dest */
+				if(index == insert_at)
+					break;
+
+				/* remove selected from queued_list */
+				queued_list = g_list_remove_link(queued_list, temp);
+				g_list_free_1(temp);
+
+				/* if it exchange than ...*/
+				if(exchange)
+				{
+					/* if index < insert_at than indexes are must be
+					 * decresead to one (because we delete node above) */
+
+					temp = g_list_nth(queued_list,
+							index<insert_at?insert_at-1:insert_at);
+					if(temp)
+					{
+						/* matching new index */
+						int new_index=index;
+						if(index > insert_at)
+							new_index--;
+						
+						/* new_index should be greater than 0 */
+						new_index = new_index>0?new_index:0;
+
+						queued_list = g_list_remove_link(queued_list,temp);
+						queued_list = g_list_insert(queued_list, temp->data,
+								new_index);
+						g_list_free_1(temp);
+						/* we don't need to exchange others */
+						to_break=1;
+					}
+				}
+			}
+					
+			queued_list = g_list_insert(queued_list, (void*)entry,insert_at);
+			insert_at++;
+			if(to_break)
+				break;
+		}
+	}
+	PL_UNLOCK();
+	fflush(stdout);
+
+	return;
+}
+
+
 static gboolean playlistwin_keypress(GtkWidget * w, GdkEventKey * event, gpointer data)
 {
 	guint keyval;
@@ -1580,6 +1652,27 @@ static gboolean playlistwin_keypress(Gtk
 				keyval == GDK_Up || keyval == GDK_KP_Up,
 				event->state);
 			break;
+			/* Making keys "1", "2" and other to work in pl window */
+			/* If you press ctrl+number than you get exchange between 
+			 * two positions */
+		case GDK_3:
+			if (event->state & GDK_SHIFT_MASK)
+			{
+				playlistwin_fileinfo();
+				refresh = FALSE;
+				break;
+			}
+		case GDK_1:
+		case GDK_2:
+		case GDK_4:
+		case GDK_5:
+		case GDK_6:
+		case GDK_7:
+		case GDK_8:
+		case GDK_9:
+			playlistwin_insert_queued(playlistwin_list, keyval - GDK_1,
+					event->state & GDK_CONTROL_MASK);
+			break;
 		case GDK_Page_Up:
 			playlistwin_scroll(-playlistwin_list->pl_num_visible);
 			break;
@@ -1617,11 +1710,6 @@ static gboolean playlistwin_keypress(Gtk
 				playlistwin_show_filebrowser();
 			refresh=FALSE;
 			break;
-		case GDK_3:
-			if (event->state & GDK_CONTROL_MASK)
-				playlistwin_fileinfo();
-			refresh = FALSE;
-			break;
 		default:
 			if (!gtk_accel_group_activate(playlistwin_accel, event->keyval, event->state))
 				gtk_widget_event(mainwin, (GdkEvent *) event);
diff -NurpP xmms-1.2.10.orig/xmms.1.in xmms-1.2.10/xmms.1.in
--- xmms-1.2.10.orig/xmms.1.in	2005-03-26 18:29:38 +0400
+++ xmms-1.2.10/xmms.1.in	2005-03-26 18:25:13 +0400
@@ -154,6 +154,10 @@ Insert	Add file dialog
 Shift + Insert	Add directory dialog
 .br
 Alt + Insert	Add url dialog
+.br
+<Number>	Set unqueued list number
+.br
+Shift + <Number>		Exchange between unqueued list tracks
 .in -2 
 
 Equalizer shade mode specific:
 
design & coding: Vladimir Lettiev aka crux © 2004-2005