Mercurial > audlegacy
comparison src/audacious/widgets/playlist_list.c @ 2356:4b2c7d9523e7 trunk
[svn] right-clicking on playlist entry automatically selects the entry if it was unselected before, closes #728
author | mf0102 |
---|---|
date | Wed, 17 Jan 2007 12:11:16 -0800 |
parents | 3149d4b1a9a9 |
children | f24ae4f40e29 |
comparison
equal
deleted
inserted
replaced
2355:f03beaca8e81 | 2356:4b2c7d9523e7 |
---|---|
314 static void | 314 static void |
315 playlist_list_button_press_cb(GtkWidget * widget, | 315 playlist_list_button_press_cb(GtkWidget * widget, |
316 GdkEventButton * event, | 316 GdkEventButton * event, |
317 PlayList_List * pl) | 317 PlayList_List * pl) |
318 { | 318 { |
319 gint nr, y; | 319 gint nr; |
320 Playlist *playlist = playlist_get_active(); | 320 Playlist *playlist = playlist_get_active(); |
321 | 321 |
322 if (event->button == 1 && pl->pl_fheight && | 322 nr = playlist_list_get_playlist_position(pl, event->x, event->y); |
323 widget_contains(&pl->pl_widget, event->x, event->y)) { | 323 if (nr == -1) |
324 | 324 return; |
325 y = event->y - pl->pl_widget.y; | 325 |
326 nr = (y / pl->pl_fheight) + pl->pl_first; | 326 if (event->button == 3) |
327 | 327 { |
328 if (nr >= playlist_get_length(playlist)) | 328 GList* selection = playlist_get_selected(playlist); |
329 nr = playlist_get_length(playlist) - 1; | 329 if (g_list_find(selection, GINT_TO_POINTER(nr)) == NULL) |
330 | 330 { |
331 playlist_select_all(playlist, FALSE); | |
332 playlist_select_range(playlist, nr, nr, TRUE); | |
333 } | |
334 } | |
335 else if (event->button == 1) | |
336 { | |
331 if (!(event->state & GDK_CONTROL_MASK)) | 337 if (!(event->state & GDK_CONTROL_MASK)) |
332 playlist_select_all(playlist, FALSE); | 338 playlist_select_all(playlist, FALSE); |
333 | 339 |
334 if (event->state & GDK_SHIFT_MASK && pl->pl_prev_selected != -1) { | 340 if (event->state & GDK_SHIFT_MASK && pl->pl_prev_selected != -1) { |
335 playlist_select_range(playlist, pl->pl_prev_selected, nr, TRUE); | 341 playlist_select_range(playlist, pl->pl_prev_selected, nr, TRUE); |
367 if (!playback_get_playing()) | 373 if (!playback_get_playing()) |
368 playback_initiate(); | 374 playback_initiate(); |
369 } | 375 } |
370 | 376 |
371 pl->pl_dragging = TRUE; | 377 pl->pl_dragging = TRUE; |
372 playlistwin_update_list(playlist); | 378 } |
373 } | 379 |
380 playlistwin_update_list(playlist); | |
374 } | 381 } |
375 | 382 |
376 gint | 383 gint |
377 playlist_list_get_playlist_position(PlayList_List * pl, | 384 playlist_list_get_playlist_position(PlayList_List * pl, |
378 gint x, | 385 gint x, |
389 return -1; | 396 return -1; |
390 iy = y - pl->pl_widget.y; | 397 iy = y - pl->pl_widget.y; |
391 | 398 |
392 ret = (iy / pl->pl_fheight) + pl->pl_first; | 399 ret = (iy / pl->pl_fheight) + pl->pl_first; |
393 | 400 |
394 if(ret > length-1) | 401 if (ret > length - 1) |
395 ret = -1; | 402 ret = -1; |
396 | 403 |
397 return ret; | 404 return ret; |
398 } | 405 } |
399 | 406 |