|
|
|
|
@ -35,17 +35,10 @@ Scrollpad::Scrollpad(size_t startx, |
|
|
|
|
m_beginning(0), |
|
|
|
|
m_found_value_begin(-1), |
|
|
|
|
m_found_value_end(-1), |
|
|
|
|
m_real_height(1) |
|
|
|
|
m_real_height(height) |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Scrollpad::Scrollpad(const Scrollpad &s) : Window(s) |
|
|
|
|
{ |
|
|
|
|
m_buffer << s.m_buffer; |
|
|
|
|
m_beginning = s.m_beginning; |
|
|
|
|
m_real_height = s.m_real_height; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Scrollpad::flush() |
|
|
|
|
{ |
|
|
|
|
m_real_height = 1; |
|
|
|
|
@ -124,10 +117,9 @@ void Scrollpad::removeFormatting() |
|
|
|
|
|
|
|
|
|
void Scrollpad::refresh() |
|
|
|
|
{ |
|
|
|
|
int MaxBeginning = m_real_height-m_height; |
|
|
|
|
assert(MaxBeginning >= 0); |
|
|
|
|
if (m_beginning > MaxBeginning) |
|
|
|
|
m_beginning = MaxBeginning; |
|
|
|
|
assert(m_real_height >= m_real_height); |
|
|
|
|
size_t max_beginning = m_real_height - m_height; |
|
|
|
|
m_beginning = std::min(m_beginning, max_beginning); |
|
|
|
|
prefresh(m_window, m_beginning, 0, m_start_y, m_start_x, m_start_y+m_height-1, m_start_x+m_width-1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -139,34 +131,33 @@ void Scrollpad::resize(size_t new_width, size_t new_height) |
|
|
|
|
|
|
|
|
|
void Scrollpad::scroll(Where where) |
|
|
|
|
{ |
|
|
|
|
int MaxBeginning = /*itsContent.size() < m_height ? 0 : */m_real_height-m_height; |
|
|
|
|
|
|
|
|
|
assert(m_real_height >= m_height); |
|
|
|
|
size_t max_beginning = m_real_height - m_height; |
|
|
|
|
switch (where) |
|
|
|
|
{ |
|
|
|
|
case wUp: |
|
|
|
|
{ |
|
|
|
|
if (m_beginning > 0) |
|
|
|
|
m_beginning--; |
|
|
|
|
--m_beginning; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case wDown: |
|
|
|
|
{ |
|
|
|
|
if (m_beginning < MaxBeginning) |
|
|
|
|
m_beginning++; |
|
|
|
|
if (m_beginning < max_beginning) |
|
|
|
|
++m_beginning; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case wPageUp: |
|
|
|
|
{ |
|
|
|
|
m_beginning -= m_height; |
|
|
|
|
if (m_beginning < 0) |
|
|
|
|
if (m_beginning > m_height) |
|
|
|
|
m_beginning -= m_height; |
|
|
|
|
else |
|
|
|
|
m_beginning = 0; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case wPageDown: |
|
|
|
|
{ |
|
|
|
|
m_beginning += m_height; |
|
|
|
|
if (m_beginning > MaxBeginning) |
|
|
|
|
m_beginning = MaxBeginning; |
|
|
|
|
m_beginning = std::min(m_beginning + m_height, max_beginning); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case wHome: |
|
|
|
|
@ -176,7 +167,7 @@ void Scrollpad::scroll(Where where) |
|
|
|
|
} |
|
|
|
|
case wEnd: |
|
|
|
|
{ |
|
|
|
|
m_beginning = MaxBeginning; |
|
|
|
|
m_beginning = max_beginning; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|