// show the status text based on current state void EbookController::UpdateStatus() { UpdateCurrPageNoForPage(pageShown); size_t pageCount = GetMaxPageCount(); if (fileBeingLoaded) { ScopedMem<WCHAR> s(str::Format(_TR("Loading file %s..."), fileBeingLoaded)); ctrls->status->SetText(s.Get()); ctrls->progress->SetFilled(0.f); return; } if (FormattingInProgress()) { ScopedMem<WCHAR> s(str::Format(_TR("Formatting the book... %d pages"), pageCount)); ctrls->status->SetText(s); ctrls->progress->SetFilled(0.f); return; } ScopedMem<WCHAR> s(str::Format(L"%s %d / %d", _TR("Page:"), currPageNo, pageCount)); ctrls->status->SetText(s); if (GetPagesFromBeginning()) ctrls->progress->SetFilled(PercFromInt(GetPagesFromBeginning()->Count(), currPageNo)); else ctrls->progress->SetFilled(0.f); }
// show the status text based on current state void EbookController::UpdateStatus() { int pageCount = GetMaxPageCount(); if (FormattingInProgress()) { ScopedMem<WCHAR> s(str::Format(_TR("Formatting the book... %d pages"), pageCount)); ctrls->status->SetText(s); ctrls->progress->SetFilled(0.f); return; } ScopedMem<WCHAR> s(str::Format(L"%s %d / %d", _TR("Page:"), currPageNo, pageCount)); ctrls->status->SetText(s); #if 1 ctrls->progress->SetFilled(PercFromInt(pageCount, currPageNo)); #else if (GetPages()) ctrls->progress->SetFilled(PercFromInt(pageCount, currPageNo)); else ctrls->progress->SetFilled(0.f); #endif }
float ScrollBar::GetPercAt(int x) { return PercFromInt(pos.Width, x); }