/***************************************************************************** * PlaylistView::SortReverse *****************************************************************************/ void PlaylistView::SortReverse() { #if 0 if ( int32 count = CountSelectedItems() ) { int32 last = count - 1; // remember currently playing item BListItem* playingItem = _PlayingItem(); for ( int32 first = 0; first < count / 2; first++, last-- ) { int32 index1 = CurrentSelection( first); int32 index2 = CurrentSelection( last); if ( SwapItems( index1, index2 ) ) { // index2 > index1, so the list won't get messed up // if we remove the items in that order // TODO: Error checking + handling! void* item2 = fVlcWrapper->PlaylistRemoveItem( index2 ); void* item1 = fVlcWrapper->PlaylistRemoveItem( index1 ); fVlcWrapper->PlaylistAddItem( item2, index1 ); fVlcWrapper->PlaylistAddItem( item1, index2 ); } } // restore currently playing item _SetPlayingIndex( playingItem ); } #endif }
virtual bool InitiateDrag(BPoint point, int32 itemIndex, bool wasSelected) { printf("InitiateDrag(BPoint(%.1f, %.1f), itemIndex: %ld, wasSelected: %d)\n", point.x, point.y, itemIndex, wasSelected); SwapItems(itemIndex, itemIndex + 1); return true; }
bool CPlaylist::ShiftTrackDown(UINT uIndex) { UINT uPos = 0; playlist_t * pCurr = m_pList; while (uPos < uIndex && NULL != pCurr) { uPos++; pCurr = pCurr->pNext; } if (NULL == pCurr || NULL == pCurr->pNext || uPos < uIndex) { return false; } SwapItems(pCurr); if ((UINT)m_iCurrentTrack - 1 == uIndex) m_iCurrentTrack--; else if ((UINT)m_iCurrentTrack == uIndex) m_iCurrentTrack++; return true; }
void wxEditableListBox::OnDownItem(wxCommandEvent& WXUNUSED(event)) { SwapItems(m_selection + 1, m_selection); m_listCtrl->SetItemState(m_selection + 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); }
void LeftList::MouseDown(BPoint point) { char temp1[150]; char temp2[150]; char temp3[150]; char temp4[150]; char temp5[150]; BMessage* msg = Window()->CurrentMessage(); uint32 clicks = msg->FindInt32("clicks"); uint32 button = msg->FindInt32("buttons"); if ((button == fLastButton) && (clicks > 1)) fClickCount++; else fClickCount = 1; fLastButton = button; if ((button == B_SECONDARY_MOUSE_BUTTON)) { int32 itemn = IndexOf(point); if (itemn >= 0) { BMenuItem* selected; BPoint p = point; ConvertToScreen(&p); Select(itemn); selected = fTrackPopUpMenu->Go(p); if (selected) { int32 selection = CurrentSelection(); if (!strcmp(selected->Label(), "Move Up")) { LeftListItem* item = (LeftListItem*)ItemAt(selection - 1); LeftListItem* item2 = (LeftListItem*)ItemAt(selection); if ((selection - 1 > 0) && (item->fIsAudio) && (item2->fIsAudio)) SwapItems(selection, selection - 1); } else if (!strcmp(selected->Label(), "Move Down")) { LeftListItem* item = (LeftListItem*)ItemAt(selection); if ((selection + 1 <= CountItems()) && (item->fIconBitmap == fAudioBitmap)) SwapItems(selection, selection + 1); } else if (!strcmp(selected->Label(), "Play")) { LeftListItem* item = (LeftListItem*)ItemAt(selection); if (item->fIconBitmap == fAudioBitmap) be_roster->Launch(&item->fRef); } else if (!strcmp(selected->Label(), "Remove")) { int32 result; BAlert* MyAlert = new BAlert("BurnItNow", "Are you sure you want to delete this selection", "Yes", "No", NULL, B_WIDTH_AS_USUAL, B_INFO_ALERT); MyAlert->SetFeel(B_MODAL_ALL_WINDOW_FEEL); result = MyAlert->Go(); if (result == 0) { LeftListItem* item = (LeftListItem*)RemoveItem(itemn); if (!item->fIsAudio) { VRCD = false; ISOFILE = false; jpWindow* win = dynamic_cast<jpWindow*>(Window()); if (win != NULL) { win->fMakeDirButton->SetEnabled(false); win->fParentDirButton->SetEnabled(false); win->fNewVRCDButton->SetEnabled(true); win->fAddISOButton->SetEnabled(true); } } if (item != NULL) delete item; } } } return; } } if ((button == B_PRIMARY_MOUSE_BUTTON) && (fClickCount == 2)) { int32 selection = CurrentSelection(); if (selection >= 0) { LeftListItem* item = (LeftListItem*)ItemAt(selection); if (item->fIsAudio) { sprintf(temp1, "%s", item->fAudioInfo.pretty_name); sprintf(temp2, "%d Channels", (int)item->fAudioInfo.channels); sprintf(temp3, "%.1f kHz", ((float)item->fAudioInfo.frame_rate / (float)1000)); sprintf(temp4, "%d bits", (int)item->fAudioInfo.bps * 8); sprintf(temp5, "Info on AudioFile"); jpWindow* win = dynamic_cast<jpWindow*>(Window()); if (win != NULL) win->fRightList->UpdateInfo(temp5, temp1, temp2, temp3, temp4); } if (item->fIconBitmap == fVRCDBitmap) { jpWindow* win = dynamic_cast<jpWindow*>(Window()); if (win != NULL) win->fRightList->UpdateDir(); } if (item->fIconBitmap == fISOBitmap) { sprintf(temp1, "Info on ISOFile"); sprintf(temp2, "%s", item->fName); sprintf(temp3, "X Mb"); jpWindow* win = dynamic_cast<jpWindow*>(Window()); if (win != NULL) win->fRightList->UpdateInfo(temp1, temp2, temp3, NULL, NULL); } } fClickCount = 0; } else { BListView::MouseDown(point); } }