MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ScrollToLine

Method ScrollToLine

src/textfile_gui.cpp:722–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

720}
721
722void TextfileWindow::ScrollToLine(size_t line)
723{
724 Scrollbar *sb = this->GetScrollbar(WID_TF_VSCROLLBAR);
725 int newpos = 0;
726 for (auto it = std::begin(this->lines); it != std::end(this->lines) && line > 0; --line, ++it) {
727 newpos += it->num_lines;
728 }
729 sb->SetPosition(std::min(newpos, sb->GetCount() - sb->GetCapacity()));
730 this->UpdateVisibleIterators();
731 this->ReflowContent();
732 this->SetDirty();
733}
734
735bool TextfileWindow::IsTextWrapped() const
736{

Callers 3

OnHyperlinkClickMethod · 0.95
NavigateToFileMethod · 0.95
OnDropdownSelectMethod · 0.95

Calls 9

ReflowContentMethod · 0.95
GetScrollbarMethod · 0.80
SetPositionMethod · 0.80
beginFunction · 0.50
endFunction · 0.50
GetCountMethod · 0.45
GetCapacityMethod · 0.45
SetDirtyMethod · 0.45

Tested by

no test coverage detected