void OverviewPlaylistWidget::StartPlaylist() { if (GetListSize() == 0) LOG(LOG_VERBOSE, "Playlist start triggered but we don't have entries in the list"); else LOG(LOG_VERBOSE, "Playlist start triggered and we already have entries in the list"); if (AddEntryDialog()) { Play(GetListSize() - 1); if (!isVisible()) SetVisible(true); } }
void DeListIndex(List *plist, unsigned int nIndex) { if(ListIsEmpty(plist) == 1 || nIndex >= GetListSize(plist)) { return; } /*上锁*/ pthread_mutex_lock(&plist->mutex); PNode freenode = plist->front; PNode lastnode = NULL; if (0 == nIndex) { plist->front = plist->front->next; } else { unsigned i = 0; for (; i < nIndex; i++) { lastnode = freenode; freenode = freenode->next; } lastnode->next = freenode->next; } free(freenode->data); free(freenode); plist->size--; pthread_mutex_unlock(&plist->mutex); return; }
BOOL CXTPDatePickerList::Create(CRect rcList) { // create list control DWORD dwStyle = WS_POPUP | WS_EX_TOPMOST | WS_EX_WINDOWEDGE | WS_BORDER; m_pControl->ClientToScreen(rcList); if (!CreateEx(0, AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)), NULL, dwStyle, rcList, m_pControl, 0, 0)) return FALSE; CSize szCalendar = GetListSize(); m_rcListControl = rcList; m_rcListControl.left = m_rcListControl.CenterPoint().x - szCalendar.cx / 2 - 1; m_rcListControl.right = m_rcListControl.left + szCalendar.cx; m_rcListControl.top = m_rcListControl.CenterPoint().y - szCalendar.cy / 2 + 1; m_rcListControl.bottom = m_rcListControl.top + szCalendar.cy; SetWindowPos(NULL, m_rcListControl.left, m_rcListControl.top, m_rcListControl.Width(), m_rcListControl.Height(), SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW); ScrollDown(0); RedrawWindow(); return TRUE; }
// ------------------------------------------------------------------------- // // * GetObject( KUInt32 inID ) // ------------------------------------------------------------------------- // TDCLNSRef TDCLNSDecoder::GetObject( KUInt32 inID ) { if (inID >= GetListSize()) { throw DCLNS( kNSErrObjectCorrupted ); } return GetListItemObject( inID ); }
void CValueListLayers::CopyValues() { if(!pWnd) Error("Не было привязки окна CWnd!"); CMyTabCtrl *pTab=(CMyTabCtrl*)pWnd; pTab->RemoveAll(); for(int i=0;i<GetListSize();i++) { CElementList data=aValue.GetAt(i); pTab->AddValue(data.Value.GetString(),data.Present); } }
HRESULT CGamesList::OnSetListContent(FSDMessageSetListContent * pSetListContent, BOOL &bHandled ) { // Unpack the message and store into local vector m_vListContent = pSetListContent->pVec; if(m_vListContent != NULL) SetListSize((int)m_vListContent->size()); // Local variables used unsigned int nCurrentSel = 0; int nCurrentTop = 0; // If interested, save current list position for later use if(pSetListContent->bRetainSelection){ if(GetListSize() > 0 && GetCurSel() == -1) nCurrentSel = 0; else nCurrentSel = GetCurSel(); nCurrentTop = GetTopItem(); if (nCurrentTop == -1) nCurrentTop = 0; } // Clear the current list and prepare the list to use a new data vector DeleteItems(0, GetItemCount()); if(pSetListContent->pVec != NULL){ InsertItems(0, pSetListContent->pVec->size()); if( nCurrentTop > pSetListContent->pVec->size() ) nCurrentTop = pSetListContent->pVec->size(); } // Restore list position SetTopItem(nCurrentTop); SetCurSel(nCurrentSel); if(pSetListContent->pVec != NULL) GameContentManager::getInstance().RefreshCurrentContent(m_CurrentGame, nCurrentSel, pSetListContent->pVec->size()); // Return Successfully bHandled = TRUE; return S_OK; }
void *pthreadNode(void *arg) { ISmartFrame QueryNode = {{0}}; PNode pnode = g_pNodeList->front; while(1) { #if 1 int nFlag = 0; if (pnode) { if (ReturnSuccess == PackQueryNode(&QueryNode, pnode)) { nFlag = 1; } } else { pnode = g_pNodeList->front; if (pnode) { if (ReturnSuccess == PackQueryNode(&QueryNode, pnode)) { nFlag = 1; } } } if (nFlag) { Item *item = pnode->data; TRACE("QueryNode %d:%02x%02x\n", GetListSize(g_pNodeList), item->mac[0], item->mac[1]); SendFrameToSerial(&QueryNode, PACKAGE_SIZE_HEAD); pnode = pnode->next; } else { TRACE("NodeList NULL\n"); } #endif usleep(FRE_QUERY_NODE); } return NULL; }
// ------------------------------------------------------------------------- // // * GetObject( KUInt32 inID ) // ------------------------------------------------------------------------- // TDCLNSRef TDCLNSDecoder::GetNextObjectWithCookie( KUIntPtr inCookie, KUInt32* ioID /* = nil */ ) { KUInt32 theListSize = GetListSize(); KUInt32 theID = 0; if (ioID) { theID = *ioID; if ((theID > 0) && (theID >= theListSize)) { throw DCLNS( kNSErrObjectCorrupted ); } } TDCLNSRef theResult; while (theID < theListSize ) { if (*GetListItemCookie( theID ) == inCookie) { // TrouvŽ. if (ioID) { *ioID = theID; } theResult = GetListItemObject( theID ); break; } else { theID++; } } return theResult; }
static void TestList() { uint i, a; Thing S, T, U, W, X; Thing things[MAXCOUNT]; List L; a=-93; W = Word(a); CommentLine("Test List"); L = NewList(); /* insert and empty list */ DelList(L); /* delete an empty list */ /* insert into a list, delete a list make sure thing is ok */ L = NewList(); ListIns(L, W); DelList(L); assert(a == IntWord(W)); L = NewList(); for (i=0; i<MAXCOUNT; i++) { T = Word(i); things[i]=T; //printf("made: >>%s<<\n", ThingToString(T)); ListIns(L, T); } //asm("int3"); String s1, s2; for (i=0; i<MAXCOUNT; i++) { // seperate assignments are NECESSARY because if i assign // inline with strcmp(ThingToString ... ) they will never // get deleted and it will be a memory leak!! s1 = ThingToString(things[i]); s2 = ThingToString(ListGet(L, things[i])); assert(strcmp(s1, s2)==0); /* if (strcmp(s1, s2) != 0) { printf("*** no match\n"); printf("%s ",ThingToString(things[i])); printf("!= %s\n", ThingToString(ListGet(L, things[i]))); } */ DelStr(s1); // sigh, there is no real way around this. DelStr(s2); } DelList(L); fflush(stdout); /* S, T, X are unused */ L = NewList(); S = Word(-64); U = Word(64); ListIns(L, S); // memory leak but these are just tests. T = Word(-64); assert(SameThing(S, T)); assert(SameThing(S, U) == false); X = ListRm(L, T); DelList(L); /* X is unused */ L = NewList(); for (i = 0; i < MAXCOUNT; i++) { W = Word(i); ListIns(L, W); } assert(GetListSize(L) == MAXCOUNT); a = GetListSize(L); for (i = 0; i < MAXCOUNT; i++) { a -= 1; W = Word(i); assert(i == IntWord(ListRm(L, W))); assert(GetListSize(L) == a); //printf("a: %d, size: %d\n", a, GetListSize(L)); } DelList(L); L = NewList(); assert(SameThing(S, W) == false); ListIns(L, T); i = GetListSize(L); X = ListRm(L, T); assert(GetListSize(L) == (i - 1)); assert(SameThing(X, T) == true); /* check to make sure it's not in there anymore */ assert(ListRm(L, T) == NULL); for (i = 0; i < MAXCOUNT; i++) { ListIns(L, T); } assert(GetListSize(L) == MAXCOUNT); for (i = 0; i < MAXCOUNT; i++) { X = ListRm (L, T); assert(X != NULL); } assert(GetListSize(L) == 0); assert(ListRm(L, T) == NULL); DelList(L); /* these are the only ones we actually made new */ /* W is a, S is -64, T= -64 */ DelThing(S); DelThing(T); DelThing(U); DelThing(W); printf("Done TestList()\n"); }
void OverviewPlaylistWidget::contextMenuEvent(QContextMenuEvent *pContextMenuEvent) { QAction *tAction; QMenu tMenu(this); if (!mLwFiles->selectedItems().isEmpty()) { tAction = tMenu.addAction("Play selected"); QIcon tIcon0; tIcon0.addPixmap(QPixmap(":/images/22_22/Audio_Play.png"), QIcon::Normal, QIcon::Off); tAction->setIcon(tIcon0); tMenu.addSeparator(); } tAction = tMenu.addAction("Add an entry"); QIcon tIcon1; tIcon1.addPixmap(QPixmap(":/images/22_22/Plus.png"), QIcon::Normal, QIcon::Off); tAction->setIcon(tIcon1); if (!mLwFiles->selectedItems().isEmpty()) { tAction = tMenu.addAction("Rename selected"); QIcon tIcon15; tIcon15.addPixmap(QPixmap(":/images/22_22/Contact_Edit.png"), QIcon::Normal, QIcon::Off); tAction->setIcon(tIcon15); tAction = tMenu.addAction("Delete selected"); QIcon tIcon2; tIcon2.addPixmap(QPixmap(":/images/22_22/Minus.png"), QIcon::Normal, QIcon::Off); tAction->setIcon(tIcon2); } tMenu.addSeparator(); if (GetListSize() > 0) { tAction = tMenu.addAction("Reset playlist"); QIcon tIcon3; tIcon3.addPixmap(QPixmap(":/images/22_22/Reload.png"), QIcon::Normal, QIcon::Off); tAction->setIcon(tIcon3); tMenu.addSeparator(); } tAction = tMenu.addAction("Endless loop"); tAction->setCheckable(true); tAction->setChecked(mEndlessLoop); QAction* tPopupRes = tMenu.exec(pContextMenuEvent->globalPos()); if (tPopupRes != NULL) { if (tPopupRes->text().compare("Play selected") == 0) { ActionPlay(); return; } if (tPopupRes->text().compare("Add an entry") == 0) { AddEntryDialog(); return; } if (tPopupRes->text().compare("Rename selected") == 0) { RenameDialog(); return; } if (tPopupRes->text().compare("Delete selected") == 0) { DelEntryDialog(); return; } if (tPopupRes->text().compare("Reset playlist") == 0) { ResetList(); return; } if (tPopupRes->text().compare("Endless loop") == 0) { mEndlessLoop = !mEndlessLoop; LOG(LOG_VERBOSE, "Playlist has now endless loop activation %d", mEndlessLoop); return; } } }