LONGLONG CItem::GetProgressPosDrive() const { LONGLONG pos = GetSize(); CItem *fs = FindFreeSpaceItem(); if (fs != NULL) { pos -= fs->GetSize(); } return pos; }
void CItem::UpdateFreeSpaceItem() { ASSERT(GetType() == IT_DRIVE); if (!GetDocument()->OptionShowFreeSpace()) return; CItem *freeSpaceItem = FindFreeSpaceItem(); ASSERT(freeSpaceItem != NULL); LONGLONG total; LONGLONG free; MyGetDiskFreeSpace(GetPath(), total, free); LONGLONG before = freeSpaceItem->GetSize(); LONGLONG diff = free - before; freeSpaceItem->UpwardAddSize(diff); ASSERT(freeSpaceItem->GetSize() == free); }
void CItem::RemoveUnknownItem() { ASSERT(GetType() == IT_DRIVE); UpwardSetUndone(); int i = FindUnknownItemIndex(); ASSERT(i < GetChildrenCount()); CItem *unknown = GetChild(i); UpwardAddSize(-unknown->GetSize()); RemoveChild(i); }
void CItem::RemoveFreeSpaceItem() { ASSERT(GetType() == IT_DRIVE); UpwardSetUndone(); int i = FindFreeSpaceItemIndex(); ASSERT(i < GetChildrenCount()); CItem *freespace = GetChild(i); UpwardAddSize(-freespace->GetSize()); RemoveChild(i); }
void CItem::UpwardSetUndone() { if (GetType() == IT_DRIVE && IsDone() && GetDocument()->OptionShowUnknown()) { int i; for (i=0; i < GetChildrenCount(); i++) if (GetChild(i)->GetType() == IT_UNKNOWN) break; CItem *unknown = GetChild(i); UpwardAddSize(- unknown->GetSize()); unknown->SetSize(0); } m_done = false; if (GetParent() != NULL) GetParent()->UpwardSetUndone(); }
int CItem::CompareSibling(const CTreeListItem *tlib, int subitem) const { CItem *other = (CItem *)tlib; int r=0; switch (subitem) { case COL_NAME: if (GetType() == IT_DRIVE) { ASSERT(other->GetType() == IT_DRIVE); r = signum(GetPath().CompareNoCase(other->GetPath())); } else { r = signum(m_name.CompareNoCase(other->m_name)); } break; case COL_SUBTREEPERCENTAGE: if (MustShowReadJobs()) r = signum(m_readJobs - other->m_readJobs); else r = signum(GetFraction() - other->GetFraction()); break; case COL_PERCENTAGE: r = signum(GetFraction() - other->GetFraction()); break; case COL_SUBTREETOTAL: r = signum(GetSize() - other->GetSize()); break; case COL_ITEMS: r = signum(GetItemsCount() - other->GetItemsCount()); break; case COL_FILES: r = signum(GetFilesCount() - other->GetFilesCount()); break; case COL_SUBDIRS: r = signum(GetSubdirsCount() - other->GetSubdirsCount()); break; case COL_LASTCHANGE: { if (m_lastChange < other->m_lastChange) return -1; else if (m_lastChange == other->m_lastChange) return 0; else return 1; } break; case COL_ATTRIBUTES: r = signum(GetSortAttributes() - other->GetSortAttributes()); break; default: ASSERT(false); break; } return r; }