Further code optimizations
This commit is contained in:
parent
d0e4b41bbc
commit
26e9f75242
|
@ -1,3 +1,6 @@
|
||||||
|
2015-09-22 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Further code optimizations
|
||||||
|
|
||||||
2015-09-22 Markus Gans <guru.mail@muenster.de>
|
2015-09-22 Markus Gans <guru.mail@muenster.de>
|
||||||
* Add the possibility to hide a virtual window
|
* Add the possibility to hide a virtual window
|
||||||
* Some code optimizations
|
* Some code optimizations
|
||||||
|
|
2
build.sh
2
build.sh
|
@ -4,7 +4,7 @@ PREFIX="/usr"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"--help"|"help")
|
"--help"|"help")
|
||||||
echo "Usage: $0 {help|debug|profile|gcov|release}"
|
echo "Usage: $0 {help|debug|fulldebug|profile|gcov|release}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
"--debug"|"debug")
|
"--debug"|"debug")
|
||||||
|
|
|
@ -137,6 +137,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||||
%{_libdir}/%{libname}.a
|
%{_libdir}/%{libname}.a
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Mon Sep 18 2015 Markus Gans <guru.mail@muenster.de> - 0.1.1-1
|
* Fri Sep 18 2015 Markus Gans <guru.mail@muenster.de> - 0.1.1-1
|
||||||
- Initial Release (version 0.1.1)
|
- Initial Release (version 0.1.1)
|
||||||
|
|
||||||
|
|
10
src/fapp.cpp
10
src/fapp.cpp
|
@ -115,10 +115,14 @@ void FApplication::cmd_options ()
|
||||||
{0, 0, 0, 0 }
|
{0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
opterr = 0;
|
opterr = 0;
|
||||||
c = getopt_long ( app_argc, app_argv, ""
|
c = getopt_long ( app_argc
|
||||||
, long_options, &idx );
|
, app_argv
|
||||||
|
, ""
|
||||||
|
, long_options
|
||||||
|
, &idx );
|
||||||
if ( c == -1 )
|
if ( c == -1 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ( c == 0 )
|
if ( c == 0 )
|
||||||
{
|
{
|
||||||
if ( strcmp(long_options[idx].name, "encoding") == 0 )
|
if ( strcmp(long_options[idx].name, "encoding") == 0 )
|
||||||
|
@ -256,7 +260,7 @@ void FApplication::processKeyboardEvent()
|
||||||
|
|
||||||
while ( (bytesread = readKey()) > 0 )
|
while ( (bytesread = readKey()) > 0 )
|
||||||
{
|
{
|
||||||
if ( bytesread+fifo_offset-1 < fifo_buf_size )
|
if ( bytesread + fifo_offset <= fifo_buf_size )
|
||||||
{
|
{
|
||||||
for (int i=0; i < bytesread; i++)
|
for (int i=0; i < bytesread; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -212,7 +212,7 @@ void FButton::draw()
|
||||||
if ( margin == 1 )
|
if ( margin == 1 )
|
||||||
{
|
{
|
||||||
setColor (foregroundColor, button_bg);
|
setColor (foregroundColor, button_bg);
|
||||||
for (int y=0; y <= height-1; y++)
|
for (int y=0; y < height; y++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin-1+d, ypos+ymin-1+y);
|
gotoxy (xpos+xmin-1+d, ypos+ymin-1+y);
|
||||||
print (space); // full block █
|
print (space); // full block █
|
||||||
|
@ -310,13 +310,13 @@ void FButton::draw()
|
||||||
for (i=0; i < j; i++)
|
for (i=0; i < j; i++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin+d, ypos+ymin-1+i);
|
gotoxy (xpos+xmin+d, ypos+ymin-1+i);
|
||||||
for (int z=1; z <= width-1; z++)
|
for (int z=1; z < width; z++)
|
||||||
print (space); // █
|
print (space); // █
|
||||||
}
|
}
|
||||||
for (i=j+1; i < height; i++)
|
for (i=j+1; i < height; i++)
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin+d, ypos+ymin-1+i);
|
gotoxy (xpos+xmin+d, ypos+ymin-1+i);
|
||||||
for (int z=1; z <= width-1; z++)
|
for (int z=1; z < width; z++)
|
||||||
print (space); // █
|
print (space); // █
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ void FDialog::drawTitleBar()
|
||||||
print (tb_text);
|
print (tb_text);
|
||||||
|
|
||||||
// fill the rest of the bar
|
// fill the rest of the bar
|
||||||
for (; x+1+int(length) <= width-2; x++)
|
for (; x+1+int(length) < width-1; x++)
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -495,8 +495,8 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
||||||
if ( ev->getButton() == LeftButton )
|
if ( ev->getButton() == LeftButton )
|
||||||
{
|
{
|
||||||
if ( ! TitleBarClickPos.isNull()
|
if ( ! TitleBarClickPos.isNull()
|
||||||
&& titlebar_x >= xpos+xmin+3
|
&& titlebar_x > xpos+xmin+2
|
||||||
&& titlebar_x <= xpos+xmin-1+width
|
&& titlebar_x < xpos+xmin+width
|
||||||
&& titlebar_y == ypos+ymin-1 )
|
&& titlebar_y == ypos+ymin-1 )
|
||||||
{
|
{
|
||||||
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
||||||
|
|
|
@ -178,7 +178,7 @@ void FLineEdit::drawInputField()
|
||||||
print (show_text);
|
print (show_text);
|
||||||
|
|
||||||
x = int(show_text.getLength());
|
x = int(show_text.getLength());
|
||||||
while ( x <= width-2 )
|
while ( x < width-1 )
|
||||||
{
|
{
|
||||||
print (' ');
|
print (' ');
|
||||||
x++;
|
x++;
|
||||||
|
@ -397,7 +397,7 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
if ( cursor_pos >= len )
|
if ( cursor_pos >= len )
|
||||||
cursor_pos=len;
|
cursor_pos=len;
|
||||||
if ( cursor_pos-offset >= width-2 && offset < len-width+2 )
|
if ( cursor_pos-offset >= width-2 && offset <= len-width+1 )
|
||||||
offset++;
|
offset++;
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
@ -410,7 +410,7 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
|
||||||
|
|
||||||
case fc::Fkey_end:
|
case fc::Fkey_end:
|
||||||
cursor_pos=len;
|
cursor_pos=len;
|
||||||
if ( cursor_pos > width-2 )
|
if ( cursor_pos >= width-1 )
|
||||||
offset=len-width+2;
|
offset=len-width+2;
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
@ -425,7 +425,7 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
|
||||||
cursor_pos=len;
|
cursor_pos=len;
|
||||||
if ( cursor_pos < 0 )
|
if ( cursor_pos < 0 )
|
||||||
cursor_pos=0;
|
cursor_pos=0;
|
||||||
if ( offset > 0 && len-offset <= width-2 )
|
if ( offset > 0 && len-offset < width-1 )
|
||||||
offset--;
|
offset--;
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
@ -496,7 +496,7 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
|
||||||
processChanged();
|
processChanged();
|
||||||
}
|
}
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
if ( cursor_pos > width-2 )
|
if ( cursor_pos >= width-1 )
|
||||||
offset++;
|
offset++;
|
||||||
ev->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
|
@ -601,7 +601,7 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
|
||||||
else if ( mouse_x >= width )
|
else if ( mouse_x >= width )
|
||||||
{
|
{
|
||||||
// drag right
|
// drag right
|
||||||
if ( ! scrollTimer && offset < len-width+2 )
|
if ( ! scrollTimer && offset <= len-width+1 )
|
||||||
{
|
{
|
||||||
scrollTimer = true;
|
scrollTimer = true;
|
||||||
addTimer(scrollRepeat);
|
addTimer(scrollRepeat);
|
||||||
|
|
106
src/flistbox.cpp
106
src/flistbox.cpp
|
@ -231,8 +231,8 @@ void FListBox::drawList()
|
||||||
&& last_current != current )
|
&& last_current != current )
|
||||||
{
|
{
|
||||||
// speed up: redraw only the changed rows
|
// speed up: redraw only the changed rows
|
||||||
uInt last_pos = uInt(current)-uInt(yoffset)-1;
|
uInt last_pos = uInt(current - yoffset) - 1;
|
||||||
uInt current_pos = uInt(last_current)-uInt(yoffset)-1;
|
uInt current_pos = uInt(last_current - yoffset) - 1;
|
||||||
start = std::min(last_pos, current_pos);
|
start = std::min(last_pos, current_pos);
|
||||||
end = std::max(last_pos, current_pos)+1;
|
end = std::max(last_pos, current_pos)+1;
|
||||||
}
|
}
|
||||||
|
@ -242,9 +242,9 @@ void FListBox::drawList()
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin, ypos+ymin+int(y));
|
gotoxy (xpos+xmin, ypos+ymin+int(y));
|
||||||
bool serach_mark = false;
|
bool serach_mark = false;
|
||||||
bool lineHasBrackets = hasBrackets(int(y)+yoffset+1);
|
bool lineHasBrackets = hasBrackets(int(y) + yoffset + 1);
|
||||||
bool isLineSelected = isSelected(int(y)+yoffset+1);
|
bool isLineSelected = isSelected(int(y) + yoffset + 1);
|
||||||
bool isCurrentLine = bool(uInt(y)+uInt(yoffset)+1 == uInt(current));
|
bool isCurrentLine = bool(uInt(y) + uInt(yoffset) + 1 == uInt(current));
|
||||||
|
|
||||||
if ( isLineSelected )
|
if ( isLineSelected )
|
||||||
{
|
{
|
||||||
|
@ -462,7 +462,7 @@ void FListBox::adjustYOffset()
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
if ( current < yoffset )
|
if ( current < yoffset )
|
||||||
current = yoffset;
|
current = yoffset;
|
||||||
if ( current > yoffset+height-2 )
|
if ( current >= yoffset + height - 1 )
|
||||||
yoffset = current - height + 2;
|
yoffset = current - height + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,24 +475,24 @@ void FListBox::adjustSize()
|
||||||
FWidget::adjustSize();
|
FWidget::adjustSize();
|
||||||
|
|
||||||
element_count = int(count());
|
element_count = int(count());
|
||||||
VBar->setMaximum(element_count-height+2);
|
VBar->setMaximum(element_count - height + 2);
|
||||||
VBar->setPageSize(element_count, height-2);
|
VBar->setPageSize(element_count, height - 2);
|
||||||
VBar->setX(width);
|
VBar->setX(width);
|
||||||
VBar->setHeight (height-2, false);
|
VBar->setHeight (height-2, false);
|
||||||
VBar->resize();
|
VBar->resize();
|
||||||
|
|
||||||
HBar->setMaximum(maxLineWidth-width+nf_offset+4);
|
HBar->setMaximum(maxLineWidth - width + nf_offset + 4);
|
||||||
HBar->setPageSize(maxLineWidth, width-nf_offset-4);
|
HBar->setPageSize(maxLineWidth, width - nf_offset - 4);
|
||||||
HBar->setY(height);
|
HBar->setY(height);
|
||||||
HBar->setWidth (width-2, false);
|
HBar->setWidth (width-2, false);
|
||||||
HBar->resize();
|
HBar->resize();
|
||||||
|
|
||||||
if ( element_count <= height-2 )
|
if ( element_count < height - 1 )
|
||||||
VBar->hide();
|
VBar->hide();
|
||||||
else
|
else
|
||||||
VBar->setVisible();
|
VBar->setVisible();
|
||||||
|
|
||||||
if ( maxLineWidth <= width-nf_offset-4 )
|
if ( maxLineWidth < width - nf_offset - 3 )
|
||||||
HBar->hide();
|
HBar->hide();
|
||||||
else
|
else
|
||||||
HBar->setVisible();
|
HBar->setVisible();
|
||||||
|
@ -560,10 +560,10 @@ void FListBox::showInsideBrackets ( int index
|
||||||
if ( len > maxLineWidth )
|
if ( len > maxLineWidth )
|
||||||
{
|
{
|
||||||
maxLineWidth = len;
|
maxLineWidth = len;
|
||||||
if ( len > width-nf_offset-4 )
|
if ( len >= width - nf_offset - 3 )
|
||||||
{
|
{
|
||||||
HBar->setMaximum(maxLineWidth-width+nf_offset+4);
|
HBar->setMaximum(maxLineWidth - width + nf_offset + 4);
|
||||||
HBar->setPageSize(maxLineWidth, width-nf_offset-4);
|
HBar->setPageSize(maxLineWidth, width - nf_offset - 4);
|
||||||
HBar->setValue (xoffset);
|
HBar->setValue (xoffset);
|
||||||
if ( ! HBar->isVisible() )
|
if ( ! HBar->isVisible() )
|
||||||
HBar->setVisible();
|
HBar->setVisible();
|
||||||
|
@ -669,7 +669,7 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
current++;
|
current++;
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
if ( current-yoffset > height - 2 )
|
if ( current - yoffset >= height - 1 )
|
||||||
yoffset++;
|
yoffset++;
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
ev->accept();
|
ev->accept();
|
||||||
|
@ -685,8 +685,8 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
|
|
||||||
case fc::Fkey_right:
|
case fc::Fkey_right:
|
||||||
xoffset++;
|
xoffset++;
|
||||||
if ( xoffset > maxLineWidth-width+nf_offset+4 )
|
if ( xoffset > maxLineWidth - width + nf_offset + 4 )
|
||||||
xoffset = maxLineWidth-width+nf_offset+4;
|
xoffset = maxLineWidth - width + nf_offset + 4;
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
|
@ -711,7 +711,7 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
current += height-3;
|
current += height-3;
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
if ( current-yoffset > height-2 )
|
if ( current - yoffset >= height - 1 )
|
||||||
{
|
{
|
||||||
yoffset += height-3;
|
yoffset += height-3;
|
||||||
if ( yoffset > element_count - height + 2 )
|
if ( yoffset > element_count - height + 2 )
|
||||||
|
@ -730,7 +730,7 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
|
|
||||||
case fc::Fkey_end:
|
case fc::Fkey_end:
|
||||||
current = element_count;
|
current = element_count;
|
||||||
if ( current > height - 2 )
|
if ( current >= height - 1 )
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - height + 2;
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
ev->accept();
|
ev->accept();
|
||||||
|
@ -747,7 +747,7 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
current++;
|
current++;
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
if ( current-yoffset > height - 2 )
|
if ( current-yoffset >= height - 1 )
|
||||||
yoffset++;
|
yoffset++;
|
||||||
ev->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
|
@ -919,8 +919,8 @@ void FListBox::onMouseDown (FMouseEvent* ev)
|
||||||
yoffset_before = yoffset;
|
yoffset_before = yoffset;
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
if ( mouse_x >= 2 && mouse_x <= width-1
|
if ( mouse_x > 1 && mouse_x < width
|
||||||
&& mouse_y >= 2 && mouse_y <= height-1 )
|
&& mouse_y > 1 && mouse_y < height )
|
||||||
{
|
{
|
||||||
current = yoffset + mouse_y - 1;
|
current = yoffset + mouse_y - 1;
|
||||||
if ( current > int(count()) )
|
if ( current > int(count()) )
|
||||||
|
@ -970,8 +970,8 @@ void FListBox::onMouseUp (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
if ( mouse_x >= 2 && mouse_x <= width-1
|
if ( mouse_x > 1 && mouse_x < width
|
||||||
&& mouse_y >= 2 && mouse_y <= height-1 )
|
&& mouse_y > 1 && mouse_y < height )
|
||||||
{
|
{
|
||||||
processChanged();
|
processChanged();
|
||||||
if ( ! isMultiSelection() )
|
if ( ! isMultiSelection() )
|
||||||
|
@ -998,8 +998,8 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= 2 && mouse_x <= width-1
|
if ( mouse_x > 1 && mouse_x < width
|
||||||
&& mouse_y >= 2 && mouse_y <= height-1 )
|
&& mouse_y > 1 && mouse_y < height )
|
||||||
{
|
{
|
||||||
current = yoffset + mouse_y - 1;
|
current = yoffset + mouse_y - 1;
|
||||||
if ( current > int(count()) )
|
if ( current > int(count()) )
|
||||||
|
@ -1110,8 +1110,8 @@ void FListBox::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= 2 && mouse_x <= width-1
|
if ( mouse_x > 1 && mouse_x < width
|
||||||
&& mouse_y >= 2 && mouse_y <= height-1 )
|
&& mouse_y > 1 && mouse_y < height )
|
||||||
{
|
{
|
||||||
if ( yoffset + mouse_y - 1 > int(count()) )
|
if ( yoffset + mouse_y - 1 > int(count()) )
|
||||||
return;
|
return;
|
||||||
|
@ -1157,7 +1157,7 @@ void FListBox::onTimer (FTimerEvent*)
|
||||||
current += scrollDistance;
|
current += scrollDistance;
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
if ( current-yoffset > height - 2 )
|
if ( current - yoffset >= height - 1 )
|
||||||
yoffset += scrollDistance;
|
yoffset += scrollDistance;
|
||||||
if ( yoffset > element_count - height + 2 )
|
if ( yoffset > element_count - height + 2 )
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - height + 2;
|
||||||
|
@ -1257,7 +1257,7 @@ void FListBox::onWheel (FWheelEvent* ev)
|
||||||
yoffset += 4;
|
yoffset += 4;
|
||||||
if ( yoffset > yoffset_end )
|
if ( yoffset > yoffset_end )
|
||||||
{
|
{
|
||||||
current += 4 - (yoffset-yoffset_end);
|
current += 4 - (yoffset - yoffset_end);
|
||||||
yoffset = yoffset_end;
|
yoffset = yoffset_end;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1336,7 +1336,7 @@ void FListBox::cb_VBarChange (FWidget*, void*)
|
||||||
current += distance;
|
current += distance;
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
if ( current-yoffset > height - 2 )
|
if ( current - yoffset >= height - 1 )
|
||||||
yoffset += distance;
|
yoffset += distance;
|
||||||
if ( yoffset > element_count - height + 2 )
|
if ( yoffset > element_count - height + 2 )
|
||||||
yoffset = element_count - height + 2;
|
yoffset = element_count - height + 2;
|
||||||
|
@ -1398,13 +1398,13 @@ void FListBox::cb_HBarChange (FWidget*, void*)
|
||||||
{
|
{
|
||||||
int distance = 1;
|
int distance = 1;
|
||||||
int xoffset_before = xoffset;
|
int xoffset_before = xoffset;
|
||||||
int xoffset_end = maxLineWidth-width+nf_offset+4;
|
int xoffset_end = maxLineWidth - width + nf_offset + 4;
|
||||||
int scrollType = HBar->getScrollType();
|
int scrollType = HBar->getScrollType();
|
||||||
|
|
||||||
switch ( scrollType )
|
switch ( scrollType )
|
||||||
{
|
{
|
||||||
case FScrollbar::scrollPageBackward:
|
case FScrollbar::scrollPageBackward:
|
||||||
distance = width-nf_offset-4;
|
distance = width - nf_offset - 4;
|
||||||
case FScrollbar::scrollStepBackward:
|
case FScrollbar::scrollStepBackward:
|
||||||
xoffset -= distance;
|
xoffset -= distance;
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
|
@ -1412,11 +1412,11 @@ void FListBox::cb_HBarChange (FWidget*, void*)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageForward:
|
case FScrollbar::scrollPageForward:
|
||||||
distance = width-nf_offset-4;
|
distance = width - nf_offset - 4;
|
||||||
case FScrollbar::scrollStepForward:
|
case FScrollbar::scrollStepForward:
|
||||||
xoffset += distance;
|
xoffset += distance;
|
||||||
if ( xoffset > maxLineWidth-width+nf_offset+4 )
|
if ( xoffset > maxLineWidth - width + nf_offset + 4 )
|
||||||
xoffset = maxLineWidth-width+nf_offset+4;
|
xoffset = maxLineWidth - width + nf_offset + 4;
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -1427,8 +1427,8 @@ void FListBox::cb_HBarChange (FWidget*, void*)
|
||||||
if ( xoffset == val )
|
if ( xoffset == val )
|
||||||
break;
|
break;
|
||||||
xoffset = val;
|
xoffset = val;
|
||||||
if ( xoffset > maxLineWidth-width+nf_offset+4 )
|
if ( xoffset > maxLineWidth - width + nf_offset + 4 )
|
||||||
xoffset = maxLineWidth-width+nf_offset+4;
|
xoffset = maxLineWidth - width + nf_offset + 4;
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -1486,10 +1486,10 @@ void FListBox::insert ( FString item
|
||||||
if ( len > maxLineWidth )
|
if ( len > maxLineWidth )
|
||||||
{
|
{
|
||||||
maxLineWidth = len;
|
maxLineWidth = len;
|
||||||
if ( len > width-nf_offset-4 )
|
if ( len >= width - nf_offset - 3 )
|
||||||
{
|
{
|
||||||
HBar->setMaximum(maxLineWidth-width+nf_offset+4);
|
HBar->setMaximum(maxLineWidth - width + nf_offset + 4);
|
||||||
HBar->setPageSize(maxLineWidth, width-nf_offset-4);
|
HBar->setPageSize(maxLineWidth, width - nf_offset - 4);
|
||||||
HBar->calculateSliderValues();
|
HBar->calculateSliderValues();
|
||||||
if ( ! HBar->isVisible() )
|
if ( ! HBar->isVisible() )
|
||||||
HBar->setVisible();
|
HBar->setVisible();
|
||||||
|
@ -1498,13 +1498,13 @@ void FListBox::insert ( FString item
|
||||||
FListBoxItem listItem (item);
|
FListBoxItem listItem (item);
|
||||||
listItem.brackets = b;
|
listItem.brackets = b;
|
||||||
listItem.selected = s;
|
listItem.selected = s;
|
||||||
data.push_back ( listItem );
|
data.push_back (listItem);
|
||||||
|
|
||||||
element_count = int(count());
|
element_count = int(count());
|
||||||
VBar->setMaximum(element_count-height+2);
|
VBar->setMaximum(element_count - height + 2);
|
||||||
VBar->setPageSize(element_count, height-2);
|
VBar->setPageSize(element_count, height - 2);
|
||||||
VBar->calculateSliderValues();
|
VBar->calculateSliderValues();
|
||||||
if ( ! VBar->isVisible() && element_count > height-2 )
|
if ( ! VBar->isVisible() && element_count >= height - 1 )
|
||||||
VBar->setVisible();
|
VBar->setVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1524,7 +1524,7 @@ void FListBox::remove (int item)
|
||||||
if ( int(count()) < item )
|
if ( int(count()) < item )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
data.erase (data.begin()+item-1);
|
data.erase (data.begin() + item - 1);
|
||||||
|
|
||||||
element_count = int(count());
|
element_count = int(count());
|
||||||
maxLineWidth = 0;
|
maxLineWidth = 0;
|
||||||
|
@ -1535,14 +1535,14 @@ void FListBox::remove (int item)
|
||||||
if ( len > maxLineWidth )
|
if ( len > maxLineWidth )
|
||||||
maxLineWidth = len;
|
maxLineWidth = len;
|
||||||
}
|
}
|
||||||
HBar->setMaximum(maxLineWidth-width+nf_offset+4);
|
HBar->setMaximum(maxLineWidth - width + nf_offset + 4);
|
||||||
HBar->setPageSize(maxLineWidth, width-nf_offset-4);
|
HBar->setPageSize(maxLineWidth, width - nf_offset - 4);
|
||||||
if ( HBar->isVisible() && maxLineWidth <= width-nf_offset-4 )
|
if ( HBar->isVisible() && maxLineWidth < width - nf_offset - 3 )
|
||||||
HBar->hide();
|
HBar->hide();
|
||||||
|
|
||||||
VBar->setMaximum(element_count-height+2);
|
VBar->setMaximum(element_count - height + 2);
|
||||||
VBar->setPageSize(element_count, height-2);
|
VBar->setPageSize(element_count, height - 2);
|
||||||
if ( VBar->isVisible() && element_count <= height-2 )
|
if ( VBar->isVisible() && element_count < height - 1 )
|
||||||
VBar->hide();
|
VBar->hide();
|
||||||
|
|
||||||
if ( current >= item && current > 1 )
|
if ( current >= item && current > 1 )
|
||||||
|
|
|
@ -293,11 +293,11 @@ void FMessageBox::adjustButtons()
|
||||||
btn_width += button[n]->getWidth() + gap;
|
btn_width += button[n]->getWidth() + gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( btn_width > width-5 )
|
if ( btn_width >= width-4 )
|
||||||
{
|
{
|
||||||
setWidth(btn_width + 5);
|
setWidth(btn_width + 5);
|
||||||
int max_width = getRootWidget()->getClientWidth();
|
int max_width = getRootWidget()->getClientWidth();
|
||||||
setX(int((max_width-width)/2));
|
setX(int((max_width-width) / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
int btn_x = int((width-btn_width) / 2);
|
int btn_x = int((width-btn_width) / 2);
|
||||||
|
|
|
@ -389,7 +389,7 @@ void FScrollbar::onTimer (FTimerEvent*)
|
||||||
if ( ( scrollType == scrollPageBackward
|
if ( ( scrollType == scrollPageBackward
|
||||||
&& SliderPos < SliderClickStopPos )
|
&& SliderPos < SliderClickStopPos )
|
||||||
|| ( scrollType == scrollPageForward
|
|| ( scrollType == scrollPageForward
|
||||||
&& SliderPos+SliderLength-1 >= SliderClickStopPos ) )
|
&& SliderPos+SliderLength > SliderClickStopPos ) )
|
||||||
{
|
{
|
||||||
delAllTimer();
|
delAllTimer();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -608,7 +608,7 @@ void FStatusBar::drawMessage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i=x; i < termWidth+1; i++)
|
for (int i=x; i <= termWidth; i++)
|
||||||
print (vstatusbar, ' ');
|
print (vstatusbar, ' ');
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
|
@ -821,10 +821,10 @@ int FTerm::parseKeyString ( char* buffer
|
||||||
key = uChar(buffer[0] & 0xff);
|
key = uChar(buffer[0] & 0xff);
|
||||||
|
|
||||||
n = len;
|
n = len;
|
||||||
for (; n < buf_size; n++)
|
for (; n < buf_size; n++) // remove the key from the buffer front
|
||||||
buffer[n-len] = buffer[n]; // remove the key
|
buffer[n-len] = buffer[n];
|
||||||
for (; n-len < len; n++)
|
for (n=n-len; n < buf_size; n++) // fill the rest with '\0' bytes
|
||||||
buffer[n-len] = '\0';
|
buffer[n] = '\0';
|
||||||
|
|
||||||
return int(key == 127 ? fc::Fkey_backspace : key);
|
return int(key == 127 ? fc::Fkey_backspace : key);
|
||||||
}
|
}
|
||||||
|
@ -1888,9 +1888,9 @@ void FTerm::updateVTerm (FTerm::term_area* area)
|
||||||
|
|
||||||
if ( ax == 0 )
|
if ( ax == 0 )
|
||||||
line_xmin = ol;
|
line_xmin = ol;
|
||||||
if ( ax + line_xmin + 1 > vterm->width )
|
if ( ax + line_xmin >= vterm->width )
|
||||||
continue;
|
continue;
|
||||||
if ( aw + rsh + ax - ol > vterm->width - 1 )
|
if ( aw + rsh + ax - ol >= vterm->width )
|
||||||
line_xmax = vterm->width + ol - ax - 1;
|
line_xmax = vterm->width + ol - ax - 1;
|
||||||
for (register int x=line_xmin; x <= line_xmax; x++)
|
for (register int x=line_xmin; x <= line_xmax; x++)
|
||||||
{
|
{
|
||||||
|
@ -2397,19 +2397,23 @@ void FTerm::resizeVTerm()
|
||||||
{
|
{
|
||||||
char_data default_char;
|
char_data default_char;
|
||||||
line_changes unchanged;
|
line_changes unchanged;
|
||||||
int vterm_size = term->getWidth() * term->getHeight();
|
int term_width, term_height, vterm_size;
|
||||||
|
|
||||||
if ( vterm->height != term->getHeight() )
|
term_width = term->getWidth();
|
||||||
|
term_height = term->getHeight();
|
||||||
|
vterm_size = term_width * term_height;
|
||||||
|
|
||||||
|
if ( vterm->height != term_height )
|
||||||
{
|
{
|
||||||
if ( vterm->changes != 0 )
|
if ( vterm->changes != 0 )
|
||||||
delete[] vterm->changes;
|
delete[] vterm->changes;
|
||||||
if ( vterm->text != 0 )
|
if ( vterm->text != 0 )
|
||||||
delete[] vterm->text;
|
delete[] vterm->text;
|
||||||
|
|
||||||
vterm->changes = new line_changes[term->getHeight()];
|
vterm->changes = new line_changes[term_height];
|
||||||
vterm->text = new char_data[vterm_size];
|
vterm->text = new char_data[vterm_size];
|
||||||
}
|
}
|
||||||
else if ( vterm->width != term->getWidth() )
|
else if ( vterm->width != term_width )
|
||||||
{
|
{
|
||||||
if ( vterm->text != 0 )
|
if ( vterm->text != 0 )
|
||||||
delete[] vterm->text;
|
delete[] vterm->text;
|
||||||
|
@ -2418,8 +2422,8 @@ void FTerm::resizeVTerm()
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vterm->width = term->getWidth();
|
vterm->width = term_width;
|
||||||
vterm->height = term->getHeight();
|
vterm->height = term_height;
|
||||||
|
|
||||||
default_char.code = ' ';
|
default_char.code = ' ';
|
||||||
default_char.fg_color = fc::LightGray;
|
default_char.fg_color = fc::LightGray;
|
||||||
|
@ -2429,9 +2433,9 @@ void FTerm::resizeVTerm()
|
||||||
default_char.underline = 0;
|
default_char.underline = 0;
|
||||||
std::fill_n (vterm->text, vterm_size, default_char);
|
std::fill_n (vterm->text, vterm_size, default_char);
|
||||||
|
|
||||||
unchanged.xmin = uInt(term->getWidth());
|
unchanged.xmin = uInt(term_width);
|
||||||
unchanged.xmax = 0;
|
unchanged.xmax = 0;
|
||||||
std::fill_n (vterm->changes, term->getHeight(), unchanged);
|
std::fill_n (vterm->changes, term_height, unchanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -2451,6 +2455,7 @@ void FTerm::updateTerminal()
|
||||||
term_area* vt;
|
term_area* vt;
|
||||||
FWidget* focus_widget;
|
FWidget* focus_widget;
|
||||||
FApplication* fapp;
|
FApplication* fapp;
|
||||||
|
int term_width, term_height;
|
||||||
|
|
||||||
if ( static_cast<FApplication*>(term_object)->isQuit() )
|
if ( static_cast<FApplication*>(term_object)->isQuit() )
|
||||||
return;
|
return;
|
||||||
|
@ -2459,6 +2464,8 @@ void FTerm::updateTerminal()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vt = vterm;
|
vt = vterm;
|
||||||
|
term_width = term->getWidth();
|
||||||
|
term_height = term->getHeight();
|
||||||
|
|
||||||
for (register uInt y=0; y < uInt(vt->height); y++)
|
for (register uInt y=0; y < uInt(vt->height); y++)
|
||||||
{
|
{
|
||||||
|
@ -2475,8 +2482,8 @@ void FTerm::updateTerminal()
|
||||||
char_data* print_char;
|
char_data* print_char;
|
||||||
print_char = &vt->text[y * uInt(vt->width) + x];
|
print_char = &vt->text[y * uInt(vt->width) + x];
|
||||||
|
|
||||||
if ( x_term_pos == term->getWidth() - 1
|
if ( x_term_pos == term_width - 1
|
||||||
&& y_term_pos == term->getHeight() - 1 )
|
&& y_term_pos == term_height - 1 )
|
||||||
appendLowerRight (print_char);
|
appendLowerRight (print_char);
|
||||||
else
|
else
|
||||||
appendCharacter (print_char);
|
appendCharacter (print_char);
|
||||||
|
@ -2487,9 +2494,9 @@ void FTerm::updateTerminal()
|
||||||
vt->changes[y].xmax = 0;
|
vt->changes[y].xmax = 0;
|
||||||
}
|
}
|
||||||
// cursor wrap
|
// cursor wrap
|
||||||
if ( x_term_pos >= term->getWidth() )
|
if ( x_term_pos >= term_width )
|
||||||
{
|
{
|
||||||
if ( y_term_pos == term->getHeight()-1 )
|
if ( y_term_pos == term_height - 1 )
|
||||||
x_term_pos--;
|
x_term_pos--;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2993,22 +3000,26 @@ bool FTerm::gpmMouse (bool on)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTerm::setTermXY (register int x, register int y)
|
void FTerm::setTermXY (register int x, register int y)
|
||||||
{
|
{
|
||||||
|
int term_width, term_height;
|
||||||
char* move_str;
|
char* move_str;
|
||||||
|
|
||||||
if ( x_term_pos == x && y_term_pos == y )
|
if ( x_term_pos == x && y_term_pos == y )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( x >= term->getWidth() )
|
term_width = term->getWidth();
|
||||||
|
term_height = term->getHeight();
|
||||||
|
|
||||||
|
if ( x >= term_width )
|
||||||
{
|
{
|
||||||
y += x / term->getWidth();
|
y += x / term_width;
|
||||||
x %= term->getWidth();
|
x %= term_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( y_term_pos > term->getHeight()-1 )
|
if ( y_term_pos >= term_height )
|
||||||
y_term_pos = term->getHeight() - 1;
|
y_term_pos = term_height - 1;
|
||||||
|
|
||||||
if ( y > term->getHeight()-1 )
|
if ( y >= term_height )
|
||||||
y = term->getHeight() - 1;
|
y = term_height - 1;
|
||||||
|
|
||||||
move_str = opti->cursor_move (x_term_pos, y_term_pos, x, y);
|
move_str = opti->cursor_move (x_term_pos, y_term_pos, x, y);
|
||||||
if ( move_str )
|
if ( move_str )
|
||||||
|
@ -3841,11 +3852,13 @@ int FTerm::appendLowerRight (char_data*& screen_char)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setTermXY (term->getWidth()-2, term->getHeight()-1);
|
int x = term->getWidth() - 2;
|
||||||
|
int y = term->getHeight() - 1;
|
||||||
|
setTermXY (x, y);
|
||||||
appendCharacter (screen_char);
|
appendCharacter (screen_char);
|
||||||
x_term_pos++;
|
x_term_pos++;
|
||||||
|
|
||||||
setTermXY (term->getWidth()-2, term->getHeight()-1);
|
setTermXY (x, y);
|
||||||
screen_char--;
|
screen_char--;
|
||||||
|
|
||||||
if ( tcap[t_parm_ich].string )
|
if ( tcap[t_parm_ich].string )
|
||||||
|
|
|
@ -73,12 +73,12 @@ void FTextView::draw()
|
||||||
setColor (foregroundColor, backgroundColor);
|
setColor (foregroundColor, backgroundColor);
|
||||||
if ( ! isNewFont() )
|
if ( ! isNewFont() )
|
||||||
drawBorder();
|
drawBorder();
|
||||||
setUpdateVTerm(true);
|
|
||||||
|
|
||||||
if ( VBar->isVisible() )
|
if ( VBar->isVisible() )
|
||||||
VBar->redraw();
|
VBar->redraw();
|
||||||
if ( HBar->isVisible() )
|
if ( HBar->isVisible() )
|
||||||
HBar->redraw();
|
HBar->redraw();
|
||||||
|
setUpdateVTerm(true);
|
||||||
|
|
||||||
drawText();
|
drawText();
|
||||||
|
|
||||||
|
@ -88,10 +88,14 @@ void FTextView::draw()
|
||||||
FString curMsg = statusBar()->getMessage();
|
FString curMsg = statusBar()->getMessage();
|
||||||
if ( curMsg != msg )
|
if ( curMsg != msg )
|
||||||
{
|
{
|
||||||
|
setUpdateVTerm(false);
|
||||||
statusBar()->setMessage(msg);
|
statusBar()->setMessage(msg);
|
||||||
statusBar()->drawMessage();
|
statusBar()->drawMessage();
|
||||||
|
setUpdateVTerm(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateTerminal();
|
||||||
|
flush_out();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -112,8 +116,8 @@ void FTextView::drawText()
|
||||||
{
|
{
|
||||||
gotoxy (xpos+xmin, ypos+ymin-nf_offset+int(y));
|
gotoxy (xpos+xmin, ypos+ymin-nf_offset+int(y));
|
||||||
uInt i;
|
uInt i;
|
||||||
FString line = data[y+uInt(yoffset)].mid ( uInt(1+xoffset)
|
FString line = data[y+uInt(yoffset)].mid ( uInt(1 + xoffset)
|
||||||
, uInt(width-nf_offset-2) );
|
, uInt(width - nf_offset - 2) );
|
||||||
const wchar_t* line_str = line.wc_str();
|
const wchar_t* line_str = line.wc_str();
|
||||||
uInt len = line.getLength();
|
uInt len = line.getLength();
|
||||||
|
|
||||||
|
@ -122,7 +126,7 @@ void FTextView::drawText()
|
||||||
print (line_str[i]);
|
print (line_str[i]);
|
||||||
else
|
else
|
||||||
print ('.');
|
print ('.');
|
||||||
for (; i < uInt(width-nf_offset-2); i++)
|
for (; i < uInt(width - nf_offset - 2); i++)
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
setUpdateVTerm(true);
|
setUpdateVTerm(true);
|
||||||
|
@ -140,24 +144,24 @@ void FTextView::adjustSize()
|
||||||
{
|
{
|
||||||
FWidget::adjustSize();
|
FWidget::adjustSize();
|
||||||
|
|
||||||
VBar->setMaximum(int(getRows())-height+2-nf_offset);
|
VBar->setMaximum (int(getRows()) - height + 2 - nf_offset);
|
||||||
VBar->setPageSize(int(getRows()), height-2+nf_offset);
|
VBar->setPageSize (int(getRows()), height - 2 + nf_offset);
|
||||||
VBar->setX(width);
|
VBar->setX (width);
|
||||||
VBar->setHeight (height-2+nf_offset, false);
|
VBar->setHeight (height - 2 + nf_offset, false);
|
||||||
VBar->resize();
|
VBar->resize();
|
||||||
|
|
||||||
HBar->setMaximum(int(maxLineWidth)-width+nf_offset+2);
|
HBar->setMaximum (int(maxLineWidth) - width + nf_offset + 2);
|
||||||
HBar->setPageSize(int(maxLineWidth), width-nf_offset-2);
|
HBar->setPageSize (int(maxLineWidth), width - nf_offset - 2);
|
||||||
HBar->setY(height);
|
HBar->setY (height);
|
||||||
HBar->setWidth (width-2, false);
|
HBar->setWidth (width - 2, false);
|
||||||
HBar->resize();
|
HBar->resize();
|
||||||
|
|
||||||
if ( int(getRows()) <= height+nf_offset-2 )
|
if ( int(getRows()) < height + nf_offset - 1 )
|
||||||
VBar->hide();
|
VBar->hide();
|
||||||
else
|
else
|
||||||
VBar->setVisible();
|
VBar->setVisible();
|
||||||
|
|
||||||
if ( int(maxLineWidth) <= width-nf_offset-2 )
|
if ( int(maxLineWidth) < width-nf_offset - 1 )
|
||||||
HBar->hide();
|
HBar->hide();
|
||||||
else
|
else
|
||||||
HBar->setVisible();
|
HBar->setVisible();
|
||||||
|
@ -207,13 +211,13 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_down:
|
case fc::Fkey_down:
|
||||||
if ( yoffset+height+nf_offset-2 < last_line )
|
if ( yoffset + height + nf_offset <= last_line + 1 )
|
||||||
yoffset++;
|
yoffset++;
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_right:
|
case fc::Fkey_right:
|
||||||
if ( xoffset+width-nf_offset-2 < int(maxLineWidth) )
|
if ( xoffset + width - nf_offset <= int(maxLineWidth) + 1 )
|
||||||
xoffset++;
|
xoffset++;
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
@ -268,6 +272,7 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
||||||
if ( HBar->isVisible() )
|
if ( HBar->isVisible() )
|
||||||
HBar->drawBar();
|
HBar->drawBar();
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
flush_out();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,13 +435,13 @@ void FTextView::cb_HBarChange (FWidget*, void*)
|
||||||
{
|
{
|
||||||
int distance = 1;
|
int distance = 1;
|
||||||
int xoffset_before = xoffset;
|
int xoffset_before = xoffset;
|
||||||
int xoffset_end = int(maxLineWidth)-width+nf_offset+4;
|
int xoffset_end = int(maxLineWidth) - width + nf_offset + 4;
|
||||||
int scrollType = HBar->getScrollType();
|
int scrollType = HBar->getScrollType();
|
||||||
|
|
||||||
switch ( scrollType )
|
switch ( scrollType )
|
||||||
{
|
{
|
||||||
case FScrollbar::scrollPageBackward:
|
case FScrollbar::scrollPageBackward:
|
||||||
distance = width-nf_offset-4;
|
distance = width - nf_offset - 4;
|
||||||
case FScrollbar::scrollStepBackward:
|
case FScrollbar::scrollStepBackward:
|
||||||
xoffset -= distance;
|
xoffset -= distance;
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
|
@ -444,11 +449,11 @@ void FTextView::cb_HBarChange (FWidget*, void*)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageForward:
|
case FScrollbar::scrollPageForward:
|
||||||
distance = width-nf_offset-4;
|
distance = width - nf_offset - 4;
|
||||||
case FScrollbar::scrollStepForward:
|
case FScrollbar::scrollStepForward:
|
||||||
xoffset += distance;
|
xoffset += distance;
|
||||||
if ( xoffset > int(maxLineWidth)-width+nf_offset+4 )
|
if ( xoffset > int(maxLineWidth) - width + nf_offset + 4 )
|
||||||
xoffset = int(maxLineWidth)-width+nf_offset+4;
|
xoffset = int(maxLineWidth) - width + nf_offset + 4;
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -459,8 +464,8 @@ void FTextView::cb_HBarChange (FWidget*, void*)
|
||||||
if ( xoffset == val )
|
if ( xoffset == val )
|
||||||
break;
|
break;
|
||||||
xoffset = val;
|
xoffset = val;
|
||||||
if ( xoffset > int(maxLineWidth)-width+nf_offset+4 )
|
if ( xoffset > int(maxLineWidth) - width + nf_offset + 4 )
|
||||||
xoffset = int(maxLineWidth)-width+nf_offset+4;
|
xoffset = int(maxLineWidth) - width + nf_offset + 4;
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -509,13 +514,13 @@ void FTextView::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
VBar->setGeometry(width, 1, 2, height-1);
|
VBar->setGeometry (width, 1, 2, height-1);
|
||||||
HBar->setGeometry(1, height, width-2, 1);
|
HBar->setGeometry (1, height, width-2, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VBar->setGeometry(width, 2, 1, height-2);
|
VBar->setGeometry (width, 2, 1, height-2);
|
||||||
HBar->setGeometry(2, height, width-2, 1);
|
HBar->setGeometry (2, height, width-2, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,22 +621,22 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
maxLineWidth = len;
|
maxLineWidth = len;
|
||||||
if ( len > uInt(width-nf_offset-2) )
|
if ( len > uInt(width-nf_offset-2) )
|
||||||
{
|
{
|
||||||
HBar->setMaximum(int(maxLineWidth)-width+nf_offset+2);
|
HBar->setMaximum (int(maxLineWidth) - width + nf_offset + 2);
|
||||||
HBar->setPageSize(int(maxLineWidth), width-nf_offset-2);
|
HBar->setPageSize (int(maxLineWidth), width - nf_offset - 2);
|
||||||
HBar->calculateSliderValues();
|
HBar->calculateSliderValues();
|
||||||
if ( ! HBar->isVisible() )
|
if ( ! HBar->isVisible() )
|
||||||
HBar->setVisible();
|
HBar->setVisible();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.insert (iter+pos, text_split.begin(), text_split.end());
|
data.insert (iter + pos, text_split.begin(), text_split.end());
|
||||||
|
|
||||||
VBar->setMaximum(int(getRows())-height+2-nf_offset);
|
VBar->setMaximum (int(getRows()) - height + 2 - nf_offset);
|
||||||
VBar->setPageSize(int(getRows()), height-2+nf_offset);
|
VBar->setPageSize (int(getRows()), height - 2 + nf_offset);
|
||||||
VBar->calculateSliderValues();
|
VBar->calculateSliderValues();
|
||||||
if ( ! VBar->isVisible() && int(getRows()) > height+nf_offset-2 )
|
if ( ! VBar->isVisible() && int(getRows()) >= height + nf_offset - 1 )
|
||||||
VBar->setVisible();
|
VBar->setVisible();
|
||||||
if ( VBar->isVisible() && int(getRows()) <= height+nf_offset-2 )
|
if ( VBar->isVisible() && int(getRows()) < height + nf_offset - 1 )
|
||||||
VBar->hide();
|
VBar->hide();
|
||||||
processChanged();
|
processChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1854,7 +1854,7 @@ void FWidget::drawShadow()
|
||||||
print (ch.code);
|
print (ch.code);
|
||||||
}
|
}
|
||||||
setColor (wc.shadow_bg, wc.shadow_fg);
|
setColor (wc.shadow_bg, wc.shadow_fg);
|
||||||
for (int i=2; i < width+2 && x1+i <= xmax; i++)
|
for (int i=2; i <= width+1 && x1+i <= xmax; i++)
|
||||||
{
|
{
|
||||||
ch = getCoveredCharacter (x1+i, y2+1, this);
|
ch = getCoveredCharacter (x1+i, y2+1, this);
|
||||||
if ( ch.code == fc::LowerHalfBlock
|
if ( ch.code == fc::LowerHalfBlock
|
||||||
|
@ -1997,7 +1997,7 @@ void FWidget::clearFlatBorder()
|
||||||
y2 = ypos+ymin-1+height;
|
y2 = ypos+ymin-1+height;
|
||||||
|
|
||||||
setColor (wc.dialog_fg, wc.dialog_bg);
|
setColor (wc.dialog_fg, wc.dialog_bg);
|
||||||
for (register int y=0; y <= height-1; y++)
|
for (register int y=0; y < height; y++)
|
||||||
{
|
{
|
||||||
gotoxy (x1-1, y1+y+1);
|
gotoxy (x1-1, y1+y+1);
|
||||||
print (' '); // clear on left side
|
print (' '); // clear on left side
|
||||||
|
@ -2108,7 +2108,7 @@ void FWidget::drawBorder()
|
||||||
for (int x=x1+1; x < x2; x++)
|
for (int x=x1+1; x < x2; x++)
|
||||||
print (fc::BoxDrawingsHorizontal); // ─
|
print (fc::BoxDrawingsHorizontal); // ─
|
||||||
print (fc::NF_border_corner_middle_upper_right); // ┐
|
print (fc::NF_border_corner_middle_upper_right); // ┐
|
||||||
for (int y=y1+1; y < y2+1; y++)
|
for (int y=y1+1; y <= y2; y++)
|
||||||
{
|
{
|
||||||
gotoxy (x1, y);
|
gotoxy (x1, y);
|
||||||
print (fc::NF_border_line_left); // border left ⎸
|
print (fc::NF_border_line_left); // border left ⎸
|
||||||
|
|
|
@ -65,7 +65,7 @@ void Mandelbrot::draw()
|
||||||
dX = (x_max - x_min) / (Cols - 1);
|
dX = (x_max - x_min) / (Cols - 1);
|
||||||
dY = (y_max - y_min) / Lines;
|
dY = (y_max - y_min) / Lines;
|
||||||
|
|
||||||
for (y0=y_min; y0 < y_max && current_line-1 < Lines; y0+=dY)
|
for (y0=y_min; y0 < y_max && current_line <= Lines; y0+=dY)
|
||||||
{
|
{
|
||||||
gotoxy (xoffset, yoffset+current_line);
|
gotoxy (xoffset, yoffset+current_line);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue