List* IntersectList(List* lsa, List* lsb) { if (!lsa||!lsb) { return NULL; } List* combined = InitList(); //IMPROVE algorithm later //TODO intersect lists with repeats, color highlight correct word unsigned int i,j; for (i = 0; i < lsa->size; i++) { printf("lsa: %p\n",GetListItem(lsa,i)); } for (i = 0; i < lsb->size; i++) { printf("lsb: %p\n",GetListItem(lsb,i)); } for (i = 0; i < lsa->size; i++) { for (j = 0; j < lsb->size; j++) { void* p = GetListItem(lsa, i); if (GetListItem(lsb, j) == p) { AppendToList(combined, p); } } } for (i = 0; i < combined->size; i++) { printf("combined: %p\n",GetListItem(combined,i)); } return combined; }
CGUIListItem* CGUIGridList_Impl::GetNextSelectedItem ( CGUIListItem* pItem ) { if ( pItem ) return GetListItem ( reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow ) -> getNextSelected ( ( ( CGUIListItem_Impl* )pItem )->GetListItem() ) ); else return GetListItem ( reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow ) -> getFirstSelectedItem () ); }
void CPlaylist::CurrentTrackDonePlaying() { playlist_t * pTemp = GetListItem(m_iCurrentTrack); #ifdef DEBUG // If none of the clips in the playlist are // playing then this may just be a brand new // playlist. But if a clip we didn't expect // is playing, then we need investigate whether // we're updating this flag in all the right // places!!! if (pTemp && !pTemp->bIsPlaying) { playlist_t * pDbg = m_pList; while (pDbg) { ASSERT(!pDbg->bIsPlaying); pDbg = pDbg->pNext; } } #endif if (pTemp) { pTemp->bIsPlaying = false; } }
CFX_WideString CPWL_IconList_Content::GetListString(int32_t nItemIndex) const { if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) return pItem->GetText(); return L""; }
void AddDataMethod( id_type access_type, TypeInfo *typ, List *varlist ) { /************************************************************************/ unsigned varcnt; VarInfo *info; if( inSubPgm ) { return; } assert( varlist ); assert( typ ); SRU.curr.vars.varlist = varlist; copyTypeInfo( &(SRU.curr.vars.type), typ ); SRU.curr.vars.access_id = access_type; SRU.curr.vars.typ_id = isTypeKnown( &SRU.curr.vars.type ); if( !SRU.curr.vars.typ_id ) { SRU.curr.vars.fake = TRUE; // NYI - put out a good error msg varcnt = GetListCount( SRU.curr.vars.varlist ); for( ; varcnt > 0; varcnt-- ) { info = GetListItem( SRU.curr.vars.varlist, varcnt - 1 ); Warning( UNKNOWN_DATA_TYPE, info->name, typ->name ); } } else { SRU.curr.vars.fake = FALSE; } SRU.curr_typ = SRU_VARIABLE; }
void CPWL_IconList_Content::ScrollToItem(int32_t nItemIndex) { CPDF_Rect rcClient = GetClientRect(); if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) { CPDF_Rect rcOrigin = pItem->GetWindowRect(); CPDF_Rect rcWnd = pItem->ChildToParent(rcOrigin); if (!(rcWnd.bottom > rcClient.bottom && rcWnd.top < rcClient.top)) { CPDF_Point ptScroll = GetScrollPos(); if (rcWnd.top > rcClient.top) { ptScroll.y = rcOrigin.top; } else if (rcWnd.bottom < rcClient.bottom) { ptScroll.y = rcOrigin.bottom + rcClient.Height(); } SetScrollPos(ptScroll); ResetFace(); InvalidateRect(); if (CPWL_Wnd* pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptScroll.y); } } } }
void CWebBrowserDownloadHandler::UpdateEntry(std::shared_ptr<CDownloadItem> downloadItem, bool complete) { std::lock_guard<std::mutex> lock(m_mutex); for (unsigned int i = 0; i < m_items.size(); ++i) { if (m_items[i]->GetPath() != downloadItem->GetPath()) continue; kodi::gui::ListItemPtr item = GetListItem(i); std::string info; if (complete) { item->SetLabel2(kodi::GetLocalizedString(30015)); std::time_t time = downloadItem->GetDownloadTime(); auto tm = *std::localtime(&time); std::string format = kodi::GetRegion("datelong") + " - " + kodi::GetRegion("time"); std::ostringstream oss; oss << std::put_time(&tm, format.c_str()); item->SetProperty("downloadtime", oss.str()); } else if (downloadItem->IsCanceled()) item->SetLabel2(kodi::GetLocalizedString(30096)); else if (downloadItem->IsPaused()) item->SetLabel2(StringUtils::Format(kodi::GetLocalizedString(30095).c_str(), downloadItem->GetProcessText().c_str())); else item->SetLabel2(downloadItem->GetProcessText()); break; } }
bool CMassiveGitTaskBase::ExecuteCommands(volatile BOOL& cancel) { m_bUnused = false; int maxLength = 0; int firstCombine = 0; for (int i = 0; i < GetListCount(); ++i) { if (maxLength + GetListItem(i).GetLength() > MAX_COMMANDLINE_LENGTH || i == GetListCount() - 1 || cancel) { CString add; for (int j = firstCombine; j <= i; ++j) { add += L" \""; add += GetListItem(j); add += L'"'; } CString cmd, out; cmd.Format(L"git.exe %s %s%s", (LPCTSTR)m_sParams, m_bIsPath ? L"--" : L"", (LPCTSTR)add); int exitCode = g_Git.Run(cmd, &out, CP_UTF8); if (exitCode && !m_bIgnoreErrors) { ReportError(out, exitCode); return false; } if (m_bIsPath) { for (int j = firstCombine; j <= i; ++j) ReportProgress(m_pathList[j], j); } maxLength = 0; firstCombine = i+1; if (cancel) { ReportUserCanceled(); return false; } } else maxLength += 3 + GetListItem(i).GetLength(); } return true; }
void CPWL_IconList_Content::SelectItem(int32_t nItemIndex, FX_BOOL bSelect) { if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) { pItem->SetSelect(bSelect); pItem->InvalidateRect(); } }
bool CMassiveGitTaskBase::ExecuteCommands(volatile BOOL& cancel) { m_bUnused = false; int maxLength = 0; int firstCombine = 0; for (int i = 0; i < GetListCount(); ++i) { if (maxLength + GetListItem(i).GetLength() > MAX_COMMANDLINE_LENGTH || i == GetListCount() - 1 || cancel) { CString add; for (int j = firstCombine; j <= i; ++j) add += _T(" \"") + GetListItem(j) + _T("\""); CString cmd, out; cmd.Format(_T("git.exe %s %s%s"), m_sParams, m_bIsPath ? _T("--") : _T(""), add); if (g_Git.Run(cmd, &out, CP_UTF8) && !m_bIgnoreErrors) { ReportError(out); return false; } if (m_bIsPath) { for (int j = firstCombine; j <= i; ++j) ReportProgress(m_pathList[j], j); } maxLength = 0; firstCombine = i+1; if (cancel) { ReportUserCanceled(); return false; } } else { maxLength += 3 + GetListItem(i).GetLength(); } } return true; }
CMediaClip * CPlaylist::PlayCurrentTrack() { playlist_t * pTemp = GetListItem(m_iCurrentTrack); //ASSERT(pTemp); if (pTemp) { pTemp->bPlayed = true; pTemp->bIsPlaying = true; return pTemp->pClip; } return NULL; }
int CGUIGridList_Impl::GetSelectedItemColumn ( void ) { CEGUI::ListboxItem* pItem = reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow ) -> getFirstSelectedItem (); if ( pItem ) { CGUIListItem* pListItem = GetListItem ( pItem ); if ( pListItem ) { return GetItemColumnIndex ( pListItem ); } } return -1; }
CString CExtensionListControl::GetSelectedExtension() { POSITION pos = GetFirstSelectedItemPosition(); if(pos == NULL) { return wds::strEmpty; } else { int i = GetNextSelectedItem(pos); CListItem *item = GetListItem(i); return item->GetExtension(); } }
void CUndo::TransferItem(CUndoList& ListSrc, CUndoList& ListDst) { CUndoItem* pItem = GetListItem(ListSrc); if (!pItem) return; // Pop list item int nSize = ListSrc.size(); if (nSize > 0) ListSrc.pop_back(); // Push list item ListDst.push_back(pItem); nSize = ListDst.size(); }
void CExtensionListControl::SelectExtension(LPCTSTR ext) { int i = 0; for(i = 0; i < GetItemCount(); i++) { if(GetListItem(i)->GetExtension().CompareNoCase(ext) == 0) { break; } } if(i < GetItemCount()) { SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); EnsureVisible(i, false); } }
CGUIListItem* CGUIGridList_Impl::GetItem ( int iRow, int hColumn ) { try { CEGUI::MultiColumnList* pMultiColumnList = reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow ); if ( (uint)iRow >= pMultiColumnList->getRowCount() || (uint)GetColumnIndex( hColumn ) >= pMultiColumnList->getColumnCount() ) return NULL; // Grab the item at the chosen row / column CEGUI::ListboxItem* pItem = reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow ) -> getItemAtGridReference ( CEGUI::MCLGridRef ( iRow, GetColumnIndex ( hColumn ) ) ); // If it exists, get the CGUIListItem by using the pool if ( pItem ) { return GetListItem ( pItem ); } } catch ( CEGUI::Exception ) {} return NULL; }
void CFWL_ComboList::OnDropListKeyDown(CFWL_MessageKey* pKey) { uint32_t dwKeyCode = pKey->m_dwKeyCode; switch (dwKeyCode) { case FWL_VKEY_Up: case FWL_VKEY_Down: case FWL_VKEY_Home: case FWL_VKEY_End: { CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(m_pOuter); CFWL_ListItem* hItem = GetItem(this, pOuter->GetCurrentSelection()); hItem = GetListItem(hItem, dwKeyCode); if (!hItem) break; SetSelection(hItem, hItem, true); ScrollToVisible(hItem); CFX_RectF rtInvalidate(0, 0, m_pProperties->m_rtWidget.width, m_pProperties->m_rtWidget.height); RepaintRect(rtInvalidate); break; } default: break; } }
CGUIListItemLayout *CGUIBaseContainer::GetFocusedLayout() const { CGUIListItemPtr item = GetListItem(0); if (item.get()) return item->GetFocusedLayout(); return NULL; }
bool CPlaylist::IsPlaying(int iIndex) { playlist_t * pTemp = GetListItem(iIndex); ASSERT(pTemp); return (pTemp ? pTemp->bIsPlaying : false); }
CGUIListItem* CGUIGridList_Impl::GetSelectedItem ( void ) { return GetListItem ( reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow ) -> getFirstSelectedItem () ); }
bool CPlaylist::NextTrack(bool bRandom, bool bRepeat) { UINT uCount = GetCount(); int iIndex = m_iCurrentTrack; int iOldIndex = m_iCurrentTrack; int iNumTried = 0; playlist_t * pTemp = m_pList; CMediaClip * pClip = NULL; bool bResult = false; if (0 == uCount) { return false; } // // If all the tracks have been played, reset their "played" flag // if (bRepeat) { bool bReset = true; while (NULL != pTemp) { if (false == pTemp->bPlayed) bReset = false; pTemp = pTemp->pNext; } if (bReset) { ResetPlayed(); } } // // Get the "next" track // if (bRandom) { do { do { iIndex = rand() % uCount; } while (iIndex == iOldIndex && uCount > 1); iNumTried++; if(( iNumTried < (int)uCount) || ( bRepeat )) { pTemp = GetListItem(iIndex); if (NULL != pTemp) pClip = pTemp->pClip; else pClip = NULL; } else { pClip = NULL; pTemp = NULL; } } while (pClip && (true == pTemp->bPlayed || !pClip->IsAvailable())); } else { do { iIndex++; if (iIndex >= (int)uCount) { iIndex = 0; if (false == bRepeat) { pClip = NULL; break; } } if (iIndex != iOldIndex) { pClip = GetTrack(iIndex); } else { pClip = NULL; } } while (pClip && !pClip->IsAvailable()); } SetCurrent(iIndex); Save(); if (pClip) { if (bRandom && pTemp && false == pTemp->bPlayed) bResult = true; else if (!bRandom) bResult = true; } return bResult; }
void CUndo::OnEditUndo() { if (m_pSymTextEdit && m_pSymTextEdit->IsDirty()) // if editing text, and edits have been made... CheckPointText(NULL, m_pSymTextEdit); // Unselect the current symbol // This must be done before working with the undo list below m_pDocWindow->SymbolUnselect(true/*bClearPointer*/); CUndoItem* pItem = GetListItem(m_dqUndoItemList); if (!pItem) return; CAGSym* pSym = pItem->GetUndoItem(); if (pSym || pItem->GetUndoCommand() == IDC_DOC_PAGENAV) { switch (pItem->GetUndoCommand()) { case IDC_DOC_ADDIMAGE: case IDC_DOC_ADDAPHOTO: case IDC_DOC_ADDTEXTBOX: case IDC_DOC_ADDSHAPE: case IDC_DOC_ADDCALENDAR: case IDC_DOC_PASTE: { m_pDocWindow->UndoAdd(pSym); break; } case IDC_DOC_CUT: case IDC_DOC_DELETE: { m_pDocWindow->UndoDelete(pSym); break; } case IDC_CONVERT_TO_JPG: { CAGSym* pSymCopy = (CAGSym*)pItem->GetItemValue(); m_pDocWindow->UndoAdd(pSymCopy); m_pDocWindow->UndoDelete(pSym); break; } case IDC_DOC_MIRROR: { m_pDocWindow->UndoMirrorFlip(pSym, true/*bFlipX*/, false/*bFlipy*/); break; } case IDC_DOC_FLIP: { m_pDocWindow->UndoMirrorFlip(pSym, false/*bFlipX*/, true/*bFlipy*/); break; } case IDC_DOC_ROTATECW: { m_pDocWindow->UndoRotate(pSym, false/*bCW*/); break; } case IDC_DOC_ROTATECCW: { m_pDocWindow->UndoRotate(pSym, true/*bCW*/); break; } case IDC_DOC_TRANSFORM: case IDC_DOC_POSCENTER: case IDC_DOC_POSCENTERH: case IDC_DOC_POSCENTERV: case IDC_DOC_POSLEFT: case IDC_DOC_POSRIGHT: case IDC_DOC_POSTOP: case IDC_DOC_POSTOPLEFT: case IDC_DOC_POSTOPRIGHT: case IDC_DOC_POSBOTTOM: case IDC_DOC_POSBOTTOMLEFT: case IDC_DOC_POSBOTTOMRIGHT: { CAGMatrix CurrentMatrix = pSym->GetMatrix(); m_pDocWindow->UndoTransform(pSym, pItem->GetItemMatrix()); pItem->SetItemMatrix(CurrentMatrix); break; } case IDC_DOC_FILLCOLORCHANGE: { CAGSymGraphic* pGraphicSym = (CAGSymGraphic*)pSym; COLORREF Color = pGraphicSym->GetFillColor(); m_pDocWindow->UndoColor(pSym, pItem->GetItemValue(), false/*bLineColor*/); pItem->SetItemValue(Color); break; } case IDC_DOC_FILLCOLORCHANGE2: { CAGSymGraphic* pGraphicSym = (CAGSymGraphic*)pSym; COLORREF Color = pGraphicSym->GetFillColor2(); m_pDocWindow->UndoColor(pSym, pItem->GetItemValue(), false/*bLineColor*/, true/*FillColor2*/); pItem->SetItemValue(Color); break; } case IDC_DOC_LINECOLORCHANGE: { CAGSymGraphic* pGraphicSym = (CAGSymGraphic*)pSym; COLORREF Color = pGraphicSym->GetLineColor(); m_pDocWindow->UndoColor(pSym, pItem->GetItemValue(), true/*bLineColor*/); pItem->SetItemValue(Color); break; } case IDC_DOC_LINEWIDTHCHANGE: { CAGSymGraphic* pGraphicSym = (CAGSymGraphic*)pSym; int nWidth = pGraphicSym->GetLineWidth(); m_pDocWindow->UndoLineWidth(pSym, pItem->GetItemValue(), pItem->GetItemValue2()); pItem->SetItemValue(nWidth); break; } case IDC_DOC_FILLTYPECHANGE: { CAGSymGraphic* pGraphicSym = (CAGSymGraphic*)pSym; FillType Fill = pGraphicSym->GetFillType(); m_pDocWindow->UndoFillType(pSym, pItem->GetItemValue()); pItem->SetItemValue((int)Fill); break; } case IDC_DOC_DESTRECTCHANGE: { RECT CurrentDestRect = pSym->GetDestRect(); m_pDocWindow->UndoDestRect(pSym, pItem->GetItemRect()); pItem->SetItemRect(CurrentDestRect); break; } case IDC_DOC_CROP: { CAGSymImage* pImage = (CAGSymImage*)pSym; RECT CurrentCropRect = pImage->GetCropRect(); m_pDocWindow->UndoCropRect(pSym, pItem->GetItemRect()); pItem->SetItemRect(CurrentCropRect); break; } case IDC_DOC_BACKONE: case IDC_DOC_FORWARDONE: case IDC_DOC_BRINGTOFRONT: case IDC_DOC_PUSHTOBACK: { m_pDocWindow->UndoLayer(pSym, -pItem->GetItemValue()); break; } case IDC_DOC_TEXT_EDIT_END: { m_pDocWindow->UndoTextEdit(pItem); break; } case IDC_DOC_LOCKED: { m_pDocWindow->UndoLocked(pSym); break; } case IDC_DOC_HIDDEN: { m_pDocWindow->UndoHidden(pSym); break; } case IDC_DOC_TRANSPARENT: { m_pDocWindow->UndoTransparent(pSym); break; } case IDC_DOC_PAGENAV: { int nLastPage = pItem->GetItemValue(); int nPage = pItem->GetItemValue2(); m_pDocWindow->UndoPageTurn(nLastPage); break; } } } // Select the modified symbol m_pDocWindow->SymbolSelect(pSym); TransferItem(m_dqUndoItemList, m_dqRedoItemList); }
PAE_PAGING_STRUCTURE* GetPdptrStructure(void* pdptr) { return (PAE_PAGING_STRUCTURE*)GetListItem(pdptr, &pFirstPS, sizeof(PAE_PAGING_STRUCTURE)); }
void CPWL_IconList_Content::SetListString(int32_t nItemIndex, const CFX_WideString& str) { if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) pItem->SetText(str); }
void CPWL_IconList_Content::SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex) { if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) pItem->SetIcon(nIconIndex); }
void CPWL_IconList_Content::SetListData(int32_t nItemIndex, void* pData) { if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) pItem->SetData(pData); }
void CPWL_IconList_Content::SetListIcon(int32_t nItemIndex, int32_t nIconIndex) { if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) pItem->SetIcon(nIconIndex); }
CMediaClip * CPlaylist::GetTrack(int iIndex) { playlist_t * pTemp = GetListItem(iIndex); //ASSERT(-1 == iIndex || pTemp); return (pTemp ? pTemp->pClip : NULL); }
bool CPlaylist::PrevTrack(bool bRandom, bool bRepeat) { UINT uCount = GetCount(); int iIndex = m_iCurrentTrack; int iOldIndex = m_iCurrentTrack; int iNumTried = 0; playlist_t * pTemp = m_pList; CMediaClip * pClip = NULL; bool bPlayed = false; bool bResult = false; if (0 == uCount) { return false; } while (NULL != pTemp) { if (pTemp->bPlayed) bPlayed = true; pTemp = pTemp->pNext; } // // Get the "previous" track // if (bRandom) { do { do { iIndex = rand() % uCount; } while (iIndex == iOldIndex && uCount > 1); iNumTried++; if (iNumTried < (int)uCount) { pTemp = GetListItem(iIndex); if (NULL != pTemp) pClip = pTemp->pClip; else pClip = NULL; } else { pClip = NULL; } } while (pClip && ((false == pTemp->bPlayed && bPlayed) || !pClip->IsAvailable())); } else { do { iIndex--; if (iIndex < 0) { iIndex = (int)uCount - 1; } if (iIndex != iOldIndex) { pClip = GetTrack(iIndex); } else { pClip = NULL; } } while (pClip && !pClip->IsAvailable()); } SetCurrent(iIndex); Save(); if (pClip) { bResult = true; } return bResult; }