Print function can set the cursor position with an FPoint

This commit is contained in:
Markus Gans 2019-01-27 13:44:13 +01:00
parent c4df64c5bc
commit 96cdaa2450
34 changed files with 275 additions and 283 deletions

View File

@ -1,3 +1,8 @@
2019-01-27 Markus Gans <guru.mail@muenster.de>
* The print command can now have an FPoint object as a parameter
to set the cursor position
* Refactoring of the FProgressbar drawing methods
2019-01-24 Markus Gans <guru.mail@muenster.de> 2019-01-24 Markus Gans <guru.mail@muenster.de>
* Refactoring of some methods in FVTerm and FDialog * Refactoring of some methods in FVTerm and FDialog

View File

@ -338,9 +338,7 @@ void Calc::drawDispay()
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
setPrintPos (FPoint(3, 3)); print() << FPoint(3, 3) << display << ' ';
print(display);
print(L' ');
setColor(wc.dialog_fg, wc.dialog_bg); setColor(wc.dialog_fg, wc.dialog_bg);
if ( isMonochron() ) if ( isMonochron() )
@ -353,13 +351,10 @@ void Calc::drawDispay()
wchar_t top_line = finalcut::fc::NF_border_line_upper; wchar_t top_line = finalcut::fc::NF_border_line_upper;
wchar_t right_line = finalcut::fc::NF_rev_border_line_right; wchar_t right_line = finalcut::fc::NF_rev_border_line_right;
wchar_t left_line = finalcut::fc::NF_border_line_left; wchar_t left_line = finalcut::fc::NF_border_line_left;
setPrintPos (FPoint(3, 2)); print() << FPoint(3, 2) << finalcut::FString(33, bottom_line);
print (finalcut::FString(33, bottom_line)); print() << FPoint(2, 3) << right_line;
setPrintPos (FPoint(2, 3)); print() << FPoint(36, 3) << left_line;
print (right_line); print() << FPoint(3, 4);
setPrintPos (FPoint(36, 3));
print (left_line);
setPrintPos (FPoint(3, 4));
finalcut::FString top_bottom_line_5 (5, top_bottom_line); finalcut::FString top_bottom_line_5 (5, top_bottom_line);
finalcut::FString top_line_2 (2, top_line); finalcut::FString top_line_2 (2, top_line);
print ( top_bottom_line_5 + top_line_2 print ( top_bottom_line_5 + top_line_2
@ -376,8 +371,7 @@ void Calc::drawDispay()
finalcut::FString separator = finalcut::FString(vertical_and_right) finalcut::FString separator = finalcut::FString(vertical_and_right)
+ finalcut::FString(35, horizontal) + finalcut::FString(35, horizontal)
+ finalcut::FString(vertical_and_left); + finalcut::FString(vertical_and_left);
setPrintPos (FPoint(1, 4)); print() << FPoint(1, 4) << separator;
print(separator);
} }
} }

View File

@ -51,6 +51,7 @@ void cb_publish (finalcut::FWidget* widget, FDataPtr data)
cbox2->unsetChecked(); cbox2->unsetChecked();
cbox2->setDisable(); cbox2->setDisable();
} }
cbox2->redraw(); cbox2->redraw();
} }

View File

@ -79,8 +79,8 @@ void Keyboard::onAccel (finalcut::FAccelEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Keyboard::draw() void Keyboard::draw()
{ {
setPrintPos (finalcut::FPoint(1, 1)); print() << finalcut::FPoint(1, 1)
print() << "---------------\n" << "---------------\n"
<< "Press Q to quit\n" << "Press Q to quit\n"
<< "---------------\n"; << "---------------\n";
setAreaCursor (finalcut::FPoint(1, 4), true, vdesktop); setAreaCursor (finalcut::FPoint(1, 4), true, vdesktop);

View File

@ -92,7 +92,7 @@ void Mandelbrot::draw()
for (y0 = y_min; y0 < y_max && current_line < Lines; y0 += dY) for (y0 = y_min; y0 < y_max && current_line < Lines; y0 += dY)
{ {
current_line++; current_line++;
setPrintPos (FPoint(xoffset, yoffset + current_line)); print() << FPoint(xoffset, yoffset + current_line);
for (x0 = x_min; x0 < x_max; x0 += dX) for (x0 = x_min; x0 < x_max; x0 += dX)
{ {

View File

@ -131,7 +131,7 @@ void ColorChooser::draw()
for (FColor c = 0; c < 16; c++) for (FColor c = 0; c < 16; c++)
{ {
setPrintPos (FPoint(2 + (c / 8) * 3, 3 + c % 8)); print() << FPoint(2 + (c / 8) * 3, 3 + c % 8);
if ( c < 6 ) if ( c < 6 )
setColor (finalcut::fc::LightGray, c); setColor (finalcut::fc::LightGray, c);
@ -245,9 +245,8 @@ void Brushes::draw()
setColor(); setColor();
finalcut::FWidget::drawBorder (1, 2, 8, 4); finalcut::FWidget::drawBorder (1, 2, 8, 4);
setColor (fg_color, bg_color); setColor (fg_color, bg_color);
setPrintPos (FPoint(2, 3)); print() << FPoint(2, 3) << " "
print(" "); << finalcut::FString(3, finalcut::fc::MediumShade);
print(finalcut::FString(3, finalcut::fc::MediumShade));
if ( brush == L' ' ) if ( brush == L' ' )
pos = 0; pos = 0;
@ -255,10 +254,10 @@ void Brushes::draw()
pos = 3; pos = 3;
setColor(); setColor();
setPrintPos (FPoint(3 + pos, 2)); print() << FPoint(3 + pos, 2)
print(finalcut::fc::BlackDownPointingTriangle); << finalcut::fc::BlackDownPointingTriangle
setPrintPos (FPoint(3 + pos, 4)); << FPoint(3 + pos, 4)
print(finalcut::fc::BlackUpPointingTriangle); << finalcut::fc::BlackUpPointingTriangle;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -428,26 +427,25 @@ void MouseDraw::draw()
{ {
for (int y = 2; y < y_max; y++) for (int y = 2; y < y_max; y++)
{ {
setPrintPos (FPoint(10, y)); print() << FPoint(10, y)
print (finalcut::fc::NF_rev_border_line_right); << finalcut::fc::NF_rev_border_line_right;
} }
setPrintPos (FPoint(10, y_max)); print() << FPoint(10, y_max)
print (finalcut::fc::NF_rev_border_corner_lower_right); << finalcut::fc::NF_rev_border_corner_lower_right;
} }
else else
{ {
setPrintPos (FPoint(10, 2)); print() << FPoint(10, 2)
print (finalcut::fc::BoxDrawingsDownAndHorizontal); << finalcut::fc::BoxDrawingsDownAndHorizontal;
for (int y = 3; y < y_max; y++) for (int y = 3; y < y_max; y++)
{ {
setPrintPos (FPoint(10, y)); print() << FPoint(10, y) << finalcut::fc::BoxDrawingsVertical;
print (finalcut::fc::BoxDrawingsVertical);
} }
setPrintPos (FPoint(10, y_max)); print() << FPoint(10, y_max)
print (finalcut::fc::BoxDrawingsUpAndHorizontal); << finalcut::fc::BoxDrawingsUpAndHorizontal;
} }
drawCanvas(); drawCanvas();

View File

@ -139,7 +139,7 @@ void Scrollview::draw()
for (int y = 0; y < int(getScrollHeight()); y++) for (int y = 0; y < int(getScrollHeight()); y++)
{ {
setPrintPos (FPoint(1, 1 + y)); print() << FPoint(1, 1 + y);
for (int x = 0; x < int(getScrollWidth()); x++) for (int x = 0; x < int(getScrollWidth()); x++)
print (32 + ((x + y) % 0x5f)); print (32 + ((x + y) % 0x5f));

View File

@ -273,8 +273,7 @@ void AttribDemo::printAltCharset()
if ( ! isMonochron() ) if ( ! isMonochron() )
setColor (wc.label_fg, wc.label_bg); setColor (wc.label_fg, wc.label_bg);
setPrintPos (FPoint(1, 1)); print() << FPoint(1, 1) << "alternate charset: ";
print("alternate charset: ");
if ( parent->bgcolor == finalcut::fc::Default ) if ( parent->bgcolor == finalcut::fc::Default )
{ {
@ -440,7 +439,7 @@ void AttribDemo::draw()
for (std::size_t y = 0; y < getParentWidget()->getHeight() - 7; y++) for (std::size_t y = 0; y < getParentWidget()->getHeight() - 7; y++)
{ {
setPrintPos (FPoint(1, 2 + int(y))); print() << FPoint(1, 2 + int(y));
if ( ! isMonochron() ) if ( ! isMonochron() )
setColor (wc.label_fg, wc.label_bg); setColor (wc.label_fg, wc.label_bg);
@ -452,7 +451,7 @@ void AttribDemo::draw()
if ( ! isMonochron() ) if ( ! isMonochron() )
setColor(wc.label_fg, wc.label_bg); setColor(wc.label_fg, wc.label_bg);
setPrintPos (FPoint(1, 15)); print() << FPoint(1, 15);
FColor bg = static_cast<AttribDlg*>(getParent())->bgcolor; FColor bg = static_cast<AttribDlg*>(getParent())->bgcolor;
print (" Background color:"); print (" Background color:");
@ -461,8 +460,7 @@ void AttribDemo::draw()
else else
printf ( " %d", bg); printf ( " %d", bg);
setPrintPos (FPoint(16, 17)); print() << FPoint(16, 17) << "Change background color ->";
print ("Change background color ->");
} }

View File

@ -59,8 +59,8 @@ Timer::Timer (finalcut::FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Timer::draw() void Timer::draw()
{ {
setPrintPos (finalcut::FPoint(1, 1)); print() << finalcut::FPoint(1, 1)
print() << "---------------\n" << "---------------\n"
<< "Press Q to quit\n" << "Press Q to quit\n"
<< "---------------\n"; << "---------------\n";
setAreaCursor (finalcut::FPoint(1, 4), true, vdesktop); setAreaCursor (finalcut::FPoint(1, 4), true, vdesktop);

View File

@ -111,8 +111,7 @@ void Transparent::draw()
for (int n = 1; n <= int(getClientHeight()); n++) for (int n = 1; n <= int(getClientHeight()); n++)
{ {
setPrintPos (FPoint(2, 2 + n)); print() << FPoint(2, 2 + n) << line;
print(line);
} }
if ( type == shadow ) if ( type == shadow )
@ -242,10 +241,8 @@ void MainWindow::draw()
setReverse(true); setReverse(true);
setColor(); setColor();
setPrintPos (FPoint(2, 4)); print() << FPoint(2, 4) << line1;
print(line1); print() << FPoint(2, 5) << line2;
setPrintPos (FPoint(2, 5));
print(line2);
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);

View File

@ -253,8 +253,7 @@ void FButton::hide()
for (std::size_t y = 0; y < getHeight() + s + (f << 1); y++) for (std::size_t y = 0; y < getHeight() + s + (f << 1); y++)
{ {
setPrintPos (FPoint(1 - int(f), 1 + int(y - f))); print() << FPoint(1 - int(f), 1 + int(y - f)) << blank;
print (blank);
} }
destroyBlankArray (blank); destroyBlankArray (blank);
@ -491,8 +490,7 @@ inline std::size_t FButton::clickAnimationIndent (FWidget* parent_widget)
for (std::size_t y = 1; y <= getHeight(); y++) for (std::size_t y = 1; y <= getHeight(); y++)
{ {
setPrintPos (FPoint(1, int(y))); print() << FPoint(1, int(y)) << ' '; // clear one left █
print (' '); // clear one left █
} }
return 1; return 1;
@ -514,8 +512,7 @@ inline void FButton::clearRightMargin (FWidget* parent_widget)
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); // Light background setReverse(true); // Light background
setPrintPos (FPoint(1 + int(getWidth()), y)); print() << FPoint(1 + int(getWidth()), y) << ' '; // clear right
print (' '); // clear right
if ( flags.active && isMonochron() ) if ( flags.active && isMonochron() )
setReverse(false); // Dark background setReverse(false); // Dark background
@ -531,7 +528,7 @@ inline void FButton::drawMarginLeft()
for (std::size_t y = 0; y < getHeight(); y++) for (std::size_t y = 0; y < getHeight(); y++)
{ {
setPrintPos (FPoint(1 + int(indent), 1 + int(y))); print() << FPoint(1 + int(indent), 1 + int(y));
if ( isMonochron() && active_focus && y == vcenter_offset ) if ( isMonochron() && active_focus && y == vcenter_offset )
print (fc::BlackRightPointingPointer); // ► print (fc::BlackRightPointingPointer); // ►
@ -547,7 +544,7 @@ inline void FButton::drawMarginRight()
for (std::size_t y = 0; y < getHeight(); y++) for (std::size_t y = 0; y < getHeight(); y++)
{ {
setPrintPos (FPoint(int(getWidth() + indent), 1 + int(y))); print() << FPoint(int(getWidth() + indent), 1 + int(y));
if ( isMonochron() && active_focus && y == vcenter_offset ) if ( isMonochron() && active_focus && y == vcenter_offset )
print (fc::BlackLeftPointingPointer); // ◄ print (fc::BlackLeftPointingPointer); // ◄
@ -566,7 +563,7 @@ inline void FButton::drawTopBottomBackground()
for (std::size_t y = 0; y < vcenter_offset; y++) for (std::size_t y = 0; y < vcenter_offset; y++)
{ {
setPrintPos (FPoint(2 + int(indent), 1 + int(y))); print() << FPoint(2 + int(indent), 1 + int(y));
for (std::size_t x = 1; x < getWidth() - 1; x++) for (std::size_t x = 1; x < getWidth() - 1; x++)
print (space_char); // █ print (space_char); // █
@ -574,7 +571,7 @@ inline void FButton::drawTopBottomBackground()
for (std::size_t y = vcenter_offset + 1; y < getHeight(); y++) for (std::size_t y = vcenter_offset + 1; y < getHeight(); y++)
{ {
setPrintPos (FPoint(2 + int(indent), 1 + int(y))); print() << FPoint(2 + int(indent), 1 + int(y));
for (std::size_t x = 1; x < getWidth() - 1; x++) for (std::size_t x = 1; x < getWidth() - 1; x++)
print (space_char); // █ print (space_char); // █
@ -585,7 +582,7 @@ inline void FButton::drawTopBottomBackground()
inline void FButton::drawButtonTextLine (wchar_t button_text[]) inline void FButton::drawButtonTextLine (wchar_t button_text[])
{ {
std::size_t pos; std::size_t pos;
setPrintPos (FPoint(2 + int(indent), 1 + int(vcenter_offset))); print() << FPoint(2 + int(indent), 1 + int(vcenter_offset));
setColor (button_fg, button_bg); setColor (button_fg, button_bg);
if ( getWidth() < txtlength + 1 ) if ( getWidth() < txtlength + 1 )
@ -643,8 +640,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
if ( txtlength >= getWidth() - 1 ) if ( txtlength >= getWidth() - 1 )
{ {
// Print ellipsis // Print ellipsis
setPrintPos (FPoint(int(getWidth() + indent) - 2, 1)); print() << FPoint(int(getWidth() + indent) - 2, 1) << "..";
print (L"..");
} }
if ( active_focus && (isMonochron() || getMaxColor() < 16) ) if ( active_focus && (isMonochron() || getMaxColor() < 16) )

View File

@ -72,7 +72,7 @@ void FCheckBox::drawCheckButton()
if ( ! isVisible() ) if ( ! isVisible() )
return; return;
setPrintPos (FPoint(1, 1)); print() << FPoint(1, 1);
setColor(); setColor();
if ( isMonochron() ) if ( isMonochron() )

View File

@ -924,24 +924,20 @@ void FDialog::drawBorder()
{ {
for (int y = y1; y < y2; y++) for (int y = y1; y < y2; y++)
{ {
setPrintPos (FPoint(x1, y)); print() << FPoint(x1, y) // Border left ⎸
// Border left ⎸ << fc::NF_border_line_left;
print (fc::NF_border_line_left); print() << FPoint(x2, y) // Border right⎹
setPrintPos (FPoint(x2, y)); << fc::NF_rev_border_line_right;
// Border right⎹
print (fc::NF_rev_border_line_right);
} }
setPrintPos (FPoint(x1, y2)); print() << FPoint(x1, y2) // Lower left corner border ⎣
// Lower left corner border ⎣ << fc::NF_border_corner_lower_left;
print (fc::NF_border_corner_lower_left);
for (std::size_t x = 1; x < getWidth() - 1; x++) // low line _ for (std::size_t x = 1; x < getWidth() - 1; x++) // low line _
print (fc::NF_border_line_bottom); print (fc::NF_border_line_bottom);
setPrintPos (FPoint(x2, y2)); print() << FPoint(x2, y2) // Lower right corner border ⎦
// Lower right corner border ⎦ << fc::NF_rev_border_corner_lower_right;
print (fc::NF_rev_border_corner_lower_right);
} }
else else
{ {
@ -966,7 +962,7 @@ void FDialog::drawTitleBar()
if ( PRINT_WIN_NUMBER ) if ( PRINT_WIN_NUMBER )
{ {
// Print the number of window in stack // Print the number of window in stack
setPrintPos (FPoint(int(getWidth()) - 2, 1)); print() << FPoint(int(getWidth()) - 2, 1);
printf ("(%d)", getWindowLayer(this)); printf ("(%d)", getWindowLayer(this));
} }
#endif // DEBUG #endif // DEBUG
@ -976,7 +972,7 @@ void FDialog::drawTitleBar()
void FDialog::drawBarButton() void FDialog::drawBarButton()
{ {
// Print the title button // Print the title button
setPrintPos (FPoint(1, 1)); print() << FPoint(1, 1);
if ( dialog_menu && dialog_menu->isShown() ) if ( dialog_menu && dialog_menu->isShown() )
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg); setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);

View File

@ -480,7 +480,7 @@ void FLabel::drawMultiLine()
else else
std::wcsncpy(dest, src, length); std::wcsncpy(dest, src, length);
setPrintPos (FPoint(1, 1 + int(y))); print() << FPoint(1, 1 + int(y));
if ( hotkeypos != NOT_SET ) if ( hotkeypos != NOT_SET )
{ {
@ -522,7 +522,7 @@ void FLabel::drawSingleLine()
if ( hotkeypos != NOT_SET ) if ( hotkeypos != NOT_SET )
length--; length--;
setPrintPos (FPoint(1, 1)); print() << FPoint(1, 1);
align_offset = getAlignOffset(length); align_offset = getAlignOffset(length);
printLine (label_text, length, hotkeypos, align_offset); printLine (label_text, length, hotkeypos, align_offset);
delete[] label_text; delete[] label_text;

View File

@ -678,7 +678,7 @@ void FLineEdit::drawInputField()
std::size_t x; std::size_t x;
FString show_text; FString show_text;
bool isActiveFocus = flags.active && flags.focus; bool isActiveFocus = flags.active && flags.focus;
setPrintPos (FPoint(1, 1)); print() << FPoint(1, 1);
if ( isMonochron() ) if ( isMonochron() )
{ {

View File

@ -315,8 +315,7 @@ void FListBox::clear()
for (int y = 0; y < int(getHeight()) - 2; y++) for (int y = 0; y < int(getHeight()) - 2; y++)
{ {
setPrintPos (FPoint(2, 2 + y)); print() << FPoint(2, 2 + y) << blank;
print (blank);
} }
destroyBlankArray (blank); destroyBlankArray (blank);
@ -819,8 +818,8 @@ void FListBox::draw()
for (int y = 2; y < int(getHeight()); y++) for (int y = 2; y < int(getHeight()); y++)
{ {
setPrintPos (FPoint(int(getWidth()), y)); print() << FPoint(int(getWidth()), y)
print (' '); // clear right side of the scrollbar << ' '; // clear right side of the scrollbar
} }
} }
@ -854,7 +853,7 @@ void FListBox::drawHeadline()
FString txt = " " + text + " "; FString txt = " " + text + " ";
std::size_t length = txt.getLength(); std::size_t length = txt.getLength();
setPrintPos (FPoint(2, 1)); print() << FPoint(2, 1);
if ( isEnabled() ) if ( isEnabled() )
setColor(wc.label_emphasis_fg, wc.label_bg); setColor(wc.label_emphasis_fg, wc.label_bg);
@ -1060,7 +1059,7 @@ inline void FListBox::setLineAttributes ( int y
{ {
bool isCurrentLine = bool(y + yoffset + 1 == int(current)); bool isCurrentLine = bool(y + yoffset + 1 == int(current));
std::size_t inc_len = inc_search.getLength(); std::size_t inc_len = inc_search.getLength();
setPrintPos (FPoint(2, 2 + int(y))); print() << FPoint(2, 2 + int(y));
if ( isLineSelected ) if ( isLineSelected )
{ {

View File

@ -1469,8 +1469,8 @@ void FListView::draw()
for (int y = 2; y < int(getHeight()); y++) for (int y = 2; y < int(getHeight()); y++)
{ {
setPrintPos (FPoint(int(getWidth()), y)); print() << FPoint(int(getWidth()), y)
print (' '); // clear right side of the scrollbar << ' '; // clear right side of the scrollbar
} }
} }
@ -1543,8 +1543,7 @@ void FListView::drawHeadlines()
last = h.begin() + len; last = h.begin() + len;
} }
setPrintPos (FPoint(2, 1)); print() << FPoint(2, 1) << std::vector<charData>(first, last);
print() << std::vector<charData>(first, last);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1563,7 +1562,7 @@ void FListView::drawList()
const auto item = static_cast<FListViewItem*>(*iter); const auto item = static_cast<FListViewItem*>(*iter);
int tree_offset = ( tree_view ) ? int(item->getDepth() << 1) + 1 : 0; int tree_offset = ( tree_view ) ? int(item->getDepth() << 1) + 1 : 0;
int checkbox_offset = ( item->isCheckable() ) ? 1 : 0; int checkbox_offset = ( item->isCheckable() ) ? 1 : 0;
setPrintPos (FPoint(2, 2 + int(y))); print() << FPoint(2, 2 + int(y));
// Draw one FListViewItem // Draw one FListViewItem
drawListLine (item, flags.focus, is_current_line); drawListLine (item, flags.focus, is_current_line);
@ -1589,8 +1588,8 @@ void FListView::drawList()
// Clean empty space after last element // Clean empty space after last element
while ( y < uInt(getClientHeight()) ) while ( y < uInt(getClientHeight()) )
{ {
setPrintPos (FPoint(2, 2 + int(y))); print() << FPoint(2, 2 + int(y))
print (FString(std::size_t(getClientWidth()), ' ')); << FString(std::size_t(getClientWidth()), ' ');
y++; y++;
} }
} }
@ -1667,7 +1666,7 @@ void FListView::drawListLine ( const FListViewItem* item
std::size_t i; std::size_t i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
*this << element_str[i]; print() << element_str[i];
for (; i < getWidth() - nf_offset - 2; i++) for (; i < getWidth() - nf_offset - 2; i++)
print (' '); print (' ');

View File

@ -1251,7 +1251,7 @@ void FMenu::drawItems()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FMenu::drawSeparator (int y) inline void FMenu::drawSeparator (int y)
{ {
setPrintPos (FPoint(1, 2 + y)); print() << FPoint(1, 2 + y);
setColor (wc.menu_active_fg, wc.menu_active_bg); setColor (wc.menu_active_fg, wc.menu_active_bg);
if ( isMonochron() ) if ( isMonochron() )
@ -1498,7 +1498,7 @@ inline void FMenu::setLineAttributes (FMenuItem* menuitem, int y)
setReverse(true); setReverse(true);
} }
setPrintPos (FPoint(2, 2 + y)); print() << FPoint(2, 2 + y);
setColor(); setColor();
} }

View File

@ -66,8 +66,7 @@ void FMenuBar::hide()
setColor (fg, bg); setColor (fg, bg);
screenWidth = getDesktopWidth(); screenWidth = getDesktopWidth();
auto blank = createBlankArray (screenWidth + 1); auto blank = createBlankArray (screenWidth + 1);
setPrintPos (FPoint(1, 1)); print() << FPoint(1, 1) << blank;
print (blank);
destroyBlankArray (blank); destroyBlankArray (blank);
} }
@ -501,7 +500,7 @@ void FMenuBar::drawItems()
if ( item_list.empty() ) if ( item_list.empty() )
return; return;
setPrintPos (FPoint(1, 1)); print() << FPoint(1, 1);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
@ -664,14 +663,12 @@ inline void FMenuBar::drawEllipsis (const menuText& txtdata, std::size_t x)
if ( txtdata.startpos < screenWidth ) if ( txtdata.startpos < screenWidth )
{ {
// Print ellipsis // Print ellipsis
setPrintPos (FPoint(int(screenWidth) - 1, 1)); print() << FPoint(int(screenWidth) - 1, 1) << "..";
print ("..");
} }
else if ( txtdata.startpos - 1 <= screenWidth ) else if ( txtdata.startpos - 1 <= screenWidth )
{ {
// Hide first character from text // Hide first character from text
setPrintPos (FPoint(int(screenWidth), 1)); print() << FPoint(int(screenWidth), 1) << ' ';
print (' ');
} }
} }
} }

View File

@ -359,8 +359,7 @@ void FMessageBox::draw()
if ( center_text ) // center one line if ( center_text ) // center one line
center_x = int((max_line_width - headline_length) / 2); center_x = int((max_line_width - headline_length) / 2);
setPrintPos (FPoint(1 + msg_x + center_x, 4)); print() << FPoint(1 + msg_x + center_x, 4) << headline_text;
print (headline_text);
head_offset = 2; head_offset = 2;
} }
@ -373,8 +372,8 @@ void FMessageBox::draw()
if ( center_text ) // center one line if ( center_text ) // center one line
center_x = int((max_line_width - line_length) / 2); center_x = int((max_line_width - line_length) / 2);
setPrintPos (FPoint(1 + msg_x + center_x, 4 + head_offset + i)); print() << FPoint(1 + msg_x + center_x, 4 + head_offset + i)
print(text_components[i]); << text_components[i];
} }
if ( isMonochron() ) if ( isMonochron() )

View File

@ -58,8 +58,8 @@ void FProgressbar::setPercentage (std::size_t percentage_value)
if ( isShown() ) if ( isShown() )
{ {
drawPercentage(); drawProgressLabel();
drawBar(); drawProgressBar();
} }
updateTerminal(); updateTerminal();
@ -100,8 +100,8 @@ void FProgressbar::hide()
FWidget::hide(); FWidget::hide();
FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0); FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
hideSize (getSize() + shadow); hideSize (getSize() + shadow);
setPrintPos (FPoint(int(getWidth()) - 4, 0)); print() << FPoint(int(getWidth()) - 4, 0)
print (" "); // hide percentage << (" "); // hide percentage
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -111,8 +111,8 @@ void FProgressbar::reset()
if ( isShown() ) if ( isShown() )
{ {
drawPercentage(); drawProgressLabel();
drawBar(); drawProgressBar();
} }
updateTerminal(); updateTerminal();
@ -123,8 +123,8 @@ void FProgressbar::reset()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FProgressbar::draw() void FProgressbar::draw()
{ {
drawPercentage(); drawProgressLabel();
drawBar(); drawProgressBar();
if ( flags.shadow ) if ( flags.shadow )
drawShadow (); drawShadow ();
@ -133,7 +133,7 @@ void FProgressbar::draw()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FProgressbar::drawPercentage() void FProgressbar::drawProgressLabel()
{ {
auto parent_widget = getParentWidget(); auto parent_widget = getParentWidget();
@ -146,7 +146,7 @@ void FProgressbar::drawPercentage()
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
setPrintPos (FPoint(int(getWidth()) - 3, 0)); print() << FPoint(int(getWidth()) - 3, 0);
if ( percentage > 100 ) if ( percentage > 100 )
print ("--- %"); print ("--- %");
@ -158,62 +158,16 @@ void FProgressbar::drawPercentage()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FProgressbar::drawBar() void FProgressbar::drawProgressBar()
{ {
std::size_t i = 0; std::size_t len = 0;
double length; print() << FPoint(1, 1);
setPrintPos (FPoint(1, 1)); setColor (wc.progressbar_bg, wc.progressbar_fg);
setColor ( wc.progressbar_bg
, wc.progressbar_fg );
if ( percentage == NOT_SET ) if ( percentage > 0 && percentage <= 100 )
length = double(-0/100); len = drawProgressIndicator();
else
length = double(bar_length * percentage) / 100;
if ( isMonochron() ) drawProgressBackground(len);
setReverse(false);
for (; i < trunc(length); i++)
print (' ');
if ( isMonochron() )
setReverse(true);
if ( percentage > 0 && percentage <= 100 && trunc(length) < bar_length )
{
if ( round(length) > trunc(length) || getMaxColor() < 16 )
{
if ( isMonochron() )
{
setReverse(false);
print (' ');
setReverse(true);
}
else
print (' ');
}
else
{
setColor (wc.progressbar_fg, wc.progressbar_bg);
print (fc::LeftHalfBlock); // ▌
}
i++;
}
setColor (wc.progressbar_fg, wc.progressbar_bg);
if ( getMaxColor() < 16 )
{
for (; i < bar_length; i++)
print (fc::MediumShade); // ▒
}
else
{
for (; i < bar_length; i++)
print (' ');
}
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
@ -222,4 +176,56 @@ void FProgressbar::drawBar()
flush_out(); flush_out();
} }
//----------------------------------------------------------------------
std::size_t FProgressbar::drawProgressIndicator()
{
// Draw the progress indicator
if ( isMonochron() )
setReverse(false);
double length = double(bar_length * percentage) / 100;
auto len = std::size_t(trunc(length));
print() << FString (len, L' ');
if ( isMonochron() )
setReverse(true);
if ( len >= bar_length )
return len;
if ( round(length) > len || getMaxColor() < 16 )
{
if ( isMonochron() )
setReverse(false);
print(' ');
if ( isMonochron() )
setReverse(true);
}
else
{
setColor (wc.progressbar_fg, wc.progressbar_bg);
print (fc::LeftHalfBlock); // ▌
}
len++;
return len;
}
//----------------------------------------------------------------------
void FProgressbar::drawProgressBackground (std::size_t len)
{
// Draw the progress background
std::size_t bg_len = bar_length - len;
setColor (wc.progressbar_fg, wc.progressbar_bg);
if ( getMaxColor() < 16 )
print() << FString (bg_len, fc::MediumShade); // ▒
else
print() << FString (bg_len, L' ');
}
} // namespace finalcut } // namespace finalcut

View File

@ -73,7 +73,7 @@ void FRadioButton::drawRadioButton()
if ( ! isVisible() ) if ( ! isVisible() )
return; return;
setPrintPos (FPoint(1, 1)); print() << FPoint(1, 1);
setColor(); setColor();
if ( isMonochron() ) if ( isMonochron() )

View File

@ -240,7 +240,7 @@ void FScrollbar::drawVerticalBar()
for (z = 1; z <= slider_pos; z++) for (z = 1; z <= slider_pos; z++)
{ {
setPrintPos (FPoint(1, 1 + z)); print() << FPoint(1, 1 + z);
if ( isNewFont() ) if ( isNewFont() )
{ {
@ -263,7 +263,7 @@ void FScrollbar::drawVerticalBar()
for (z = 1; z <= int(slider_length); z++) for (z = 1; z <= int(slider_length); z++)
{ {
setPrintPos (FPoint(1, 1 + slider_pos + z)); print() << FPoint(1, 1 + slider_pos + z);
if ( isNewFont() ) if ( isNewFont() )
print (' '); print (' ');
@ -278,7 +278,7 @@ void FScrollbar::drawVerticalBar()
for (z = slider_pos + int(slider_length) + 1; z <= int(bar_length); z++) for (z = slider_pos + int(slider_length) + 1; z <= int(bar_length); z++)
{ {
setPrintPos (FPoint(1, 1 + z)); print() << FPoint(1, 1 + z);
if ( isNewFont() ) if ( isNewFont() )
{ {
@ -305,9 +305,9 @@ void FScrollbar::drawHorizontalBar()
setColor (wc.scrollbar_fg, wc.scrollbar_bg); setColor (wc.scrollbar_fg, wc.scrollbar_bg);
if ( isNewFont() ) if ( isNewFont() )
setPrintPos (FPoint(3, 1)); print() << FPoint(3, 1);
else else
setPrintPos (FPoint(2, 1)); print() << FPoint(2, 1);
for (z = 0; z < slider_pos; z++) for (z = 0; z < slider_pos; z++)
{ {
@ -590,43 +590,43 @@ void FScrollbar::drawButtons()
if ( isNewFont() ) if ( isNewFont() )
{ {
setPrintPos (FPoint(1, 1)); print() << FPoint(1, 1);
if ( bar_orientation == fc::vertical ) if ( bar_orientation == fc::vertical )
{ {
print (fc::NF_rev_up_arrow1); print() << fc::NF_rev_up_arrow1
print (fc::NF_rev_up_arrow2); << fc::NF_rev_up_arrow2
setPrintPos (FPoint(1, int(length))); << FPoint(1, int(length))
print (fc::NF_rev_down_arrow1); << fc::NF_rev_down_arrow1
print (fc::NF_rev_down_arrow2); << fc::NF_rev_down_arrow2;
} }
else // horizontal else // horizontal
{ {
print (fc::NF_rev_left_arrow1); print() << fc::NF_rev_left_arrow1
print (fc::NF_rev_left_arrow2); << fc::NF_rev_left_arrow2
setPrintPos (FPoint(int(length) - 1, 1)); << FPoint(int(length) - 1, 1)
print (fc::NF_rev_right_arrow1); << fc::NF_rev_right_arrow1
print (fc::NF_rev_right_arrow2); << fc::NF_rev_right_arrow2;
} }
} }
else else
{ {
setPrintPos (FPoint(1, 1)); print() << FPoint(1, 1);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
if ( bar_orientation == fc::vertical ) if ( bar_orientation == fc::vertical )
{ {
print (fc::BlackUpPointingTriangle); // ▲ print() << fc::BlackUpPointingTriangle // ▲
setPrintPos (FPoint(1, int(length))); << FPoint(1, int(length))
print (fc::BlackDownPointingTriangle); // ▼ << fc::BlackDownPointingTriangle; // ▼
} }
else // horizontal else // horizontal
{ {
print (fc::BlackLeftPointingPointer); // ◄ print() << fc::BlackLeftPointingPointer // ◄
setPrintPos (FPoint(int(length), 1)); << FPoint(int(length), 1)
print (fc::BlackRightPointingPointer); // ► << fc::BlackRightPointingPointer; // ►
} }
if ( isMonochron() ) if ( isMonochron() )

View File

@ -178,8 +178,7 @@ void FStatusBar::hide()
setColor (fg, bg); setColor (fg, bg);
screenWidth = getDesktopWidth(); screenWidth = getDesktopWidth();
auto blank = createBlankArray(screenWidth + 1); auto blank = createBlankArray(screenWidth + 1);
setPrintPos (FPoint(1, 1)); print() << FPoint(1, 1) << blank;
print (blank);
destroyBlankArray (blank); destroyBlankArray (blank);
} }
@ -541,7 +540,7 @@ void FStatusBar::drawKeys()
return; return;
} }
setPrintPos (FPoint(1, 1)); print() << FPoint(1, 1);
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);

View File

@ -127,7 +127,7 @@ void FSwitch::drawCheckButton()
if ( ! isVisible() ) if ( ! isVisible() )
return; return;
setPrintPos (FPoint(1 + int(switch_offset_pos), 1)); print() << FPoint(1 + int(switch_offset_pos), 1);
if ( checked ) if ( checked )
drawChecked(); drawChecked();

View File

@ -297,8 +297,7 @@ void FTextView::clear()
for (int y = 0; y < int(getTextHeight()); y++) for (int y = 0; y < int(getTextHeight()); y++)
{ {
setPrintPos (FPoint(2, 2 - nf_offset + y)); print() << FPoint(2, 2 - nf_offset + y) << blank;
print (blank);
} }
destroyBlankArray (blank); destroyBlankArray (blank);
@ -695,7 +694,7 @@ void FTextView::drawText()
{ {
std::size_t i; std::size_t i;
FString line; FString line;
setPrintPos (FPoint(2, 2 - nf_offset + int(y))); print() << FPoint(2, 2 - nf_offset + int(y));
line = data[y + std::size_t(yoffset)].mid ( std::size_t(1 + xoffset) line = data[y + std::size_t(yoffset)].mid ( std::size_t(1 + xoffset)
, getTextWidth() ); , getTextWidth() );
const auto line_str = line.wc_str(); const auto line_str = line.wc_str();

View File

@ -445,7 +445,7 @@ void FToggleButton::drawLabel()
if ( hotkeypos != NOT_SET ) if ( hotkeypos != NOT_SET )
length--; length--;
setPrintPos (FPoint(1 + int(label_offset_pos), 1)); print() << FPoint(1 + int(label_offset_pos), 1);
drawText (LabelText, hotkeypos, length); drawText (LabelText, hotkeypos, length);
delete[] LabelText; delete[] LabelText;
} }

View File

@ -87,8 +87,7 @@ void FToolTip::draw()
for (std::size_t i = 0; i < text_num_lines; i++) for (std::size_t i = 0; i < text_num_lines; i++)
{ {
setPrintPos (FPoint(3, 2 + int(i))); print() << FPoint(3, 2 + int(i)) << text_components[i];
print(text_components[i]);
} }
unsetBold(); unsetBold();

View File

@ -150,14 +150,10 @@ void FVTerm::hideCursor (bool enable)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::setPrintCursor (const FPoint& pos) void FVTerm::setPrintCursor (const FPoint& pos)
{ {
int x = pos.getX(); if ( auto win = getPrintArea() )
int y = pos.getY();
auto win = getPrintArea();
if ( win )
{ {
win->cursor_x = x - win->offset_left; win->cursor_x = pos.getX() - win->offset_left;
win->cursor_y = y - win->offset_top; win->cursor_y = pos.getY() - win->offset_top;
} }
} }
@ -315,7 +311,9 @@ int FVTerm::printf (const FString format, ...)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FVTerm::print (const FString& s) int FVTerm::print (const FString& s)
{ {
assert ( ! s.isNull() ); if ( s.isNull() )
return -1;
auto area = getPrintArea(); auto area = getPrintArea();
if ( ! area ) if ( ! area )
@ -332,9 +330,7 @@ int FVTerm::print (const FString& s)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FVTerm::print (term_area* area, const FString& s) int FVTerm::print (term_area* area, const FString& s)
{ {
assert ( ! s.isNull() ); if ( s.isNull() || ! area )
if ( ! area )
return -1; return -1;
std::vector<charData> term_string; std::vector<charData> term_string;
@ -561,6 +557,13 @@ int FVTerm::print (term_area* area, charData& term_char)
return 1; return 1;
} }
//----------------------------------------------------------------------
void FVTerm::print (const FPoint& p)
{
setPrintCursor (p);
}
// protected methods of FVTerm // protected methods of FVTerm
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FVTerm::term_area* FVTerm::getPrintArea() FVTerm::term_area* FVTerm::getPrintArea()

View File

@ -1273,14 +1273,13 @@ void FWidget::clearShadow()
{ {
for (std::size_t y = 1; y <= getHeight(); y++) for (std::size_t y = 1; y <= getHeight(); y++)
{ {
setPrintPos (FPoint(w + 1, int(y))); print() << FPoint(w + 1, int(y)) << ' '; // clear █
print (' '); // clear █
} }
} }
if ( h <= offset.getY2() ) if ( h <= offset.getY2() )
{ {
setPrintPos (FPoint(2, h + 1)); print() << FPoint(2, h + 1);
for (std::size_t i = 1; i <= getWidth(); i++) for (std::size_t i = 1; i <= getWidth(); i++)
print (' '); // clear ▀ print (' '); // clear ▀
@ -1308,7 +1307,7 @@ void FWidget::drawFlatBorder()
for (std::size_t y = 0; y < getHeight(); y++) for (std::size_t y = 0; y < getHeight(); y++)
{ {
setPrintPos (FPoint(x1 - 1, y1 + int(y) + 1)); print() << FPoint(x1 - 1, y1 + int(y) + 1);
if ( double_flatline_mask.left[uLong(y)] ) if ( double_flatline_mask.left[uLong(y)] )
// left+right line (on left side) // left+right line (on left side)
@ -1318,7 +1317,7 @@ void FWidget::drawFlatBorder()
print (fc::NF_rev_border_line_right); print (fc::NF_rev_border_line_right);
} }
setPrintPos (FPoint(x2, y1 + 1)); print() << FPoint(x2, y1 + 1);
for (std::size_t y = 0; y < getHeight(); y++) for (std::size_t y = 0; y < getHeight(); y++)
{ {
@ -1329,10 +1328,10 @@ void FWidget::drawFlatBorder()
// left line (on right side) // left line (on right side)
print (fc::NF_border_line_left); print (fc::NF_border_line_left);
setPrintPos (FPoint(x2, y1 + int(y) + 2)); print() << FPoint(x2, y1 + int(y) + 2);
} }
setPrintPos (FPoint(x1, y1)); print() << FPoint(x1, y1);
for (std::size_t x = 0; x < getWidth(); x++) for (std::size_t x = 0; x < getWidth(); x++)
{ {
@ -1344,7 +1343,7 @@ void FWidget::drawFlatBorder()
print (fc::NF_border_line_bottom); print (fc::NF_border_line_bottom);
} }
setPrintPos (FPoint(x1, y2)); print() << FPoint(x1, y2);
for (std::size_t x = 0; x < getWidth(); x++) for (std::size_t x = 0; x < getWidth(); x++)
{ {
@ -1376,7 +1375,7 @@ void FWidget::clearFlatBorder()
// clear on left side // clear on left side
for (std::size_t y = 0; y < getHeight(); y++) for (std::size_t y = 0; y < getHeight(); y++)
{ {
setPrintPos (FPoint(x1 - 1, y1 + int(y) + 1)); print() << FPoint(x1 - 1, y1 + int(y) + 1);
if ( double_flatline_mask.left[y] ) if ( double_flatline_mask.left[y] )
print (fc::NF_border_line_left); print (fc::NF_border_line_left);
@ -1387,7 +1386,7 @@ void FWidget::clearFlatBorder()
// clear on right side // clear on right side
for (std::size_t y = 0; y < getHeight(); y++) for (std::size_t y = 0; y < getHeight(); y++)
{ {
setPrintPos (FPoint(x2, y1 + int(y) + 1)); print() << FPoint(x2, y1 + int(y) + 1);
if ( double_flatline_mask.right[y] ) if ( double_flatline_mask.right[y] )
print (fc::NF_rev_border_line_right); print (fc::NF_rev_border_line_right);
@ -1396,7 +1395,7 @@ void FWidget::clearFlatBorder()
} }
// clear at top // clear at top
setPrintPos (FPoint(x1, y1)); print() << FPoint(x1, y1);
for (std::size_t x = 0; x < getWidth(); x++) for (std::size_t x = 0; x < getWidth(); x++)
{ {
@ -1407,7 +1406,7 @@ void FWidget::clearFlatBorder()
} }
// clear at bottom // clear at bottom
setPrintPos (FPoint(x1, y2)); print() << FPoint(x1, y2);
for (std::size_t x = 0; x < getWidth(); x++) for (std::size_t x = 0; x < getWidth(); x++)
{ {
@ -1646,8 +1645,7 @@ void FWidget::hideSize (const FSize& size)
for (int y = 0; y < int(size.getWidth()); y++) for (int y = 0; y < int(size.getWidth()); y++)
{ {
setPrintPos (FPoint(1, 1 + y)); print() << FPoint(1, 1 + y) << blank;
print (blank);
} }
destroyBlankArray (blank); destroyBlankArray (blank);
@ -2230,9 +2228,9 @@ void FWidget::drawChildren()
void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2) void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
{ {
// transparent shadow // transparent shadow
setPrintPos (FPoint(x2 + 1, y1));
setTransparent(); setTransparent();
print (" "); print() << FPoint(x2 + 1, y1) << " ";
unsetTransparent(); unsetTransparent();
setColor (wc.shadow_bg, wc.shadow_fg); setColor (wc.shadow_bg, wc.shadow_fg);
@ -2240,14 +2238,12 @@ void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
for (std::size_t y = 1; y < getHeight(); y++) for (std::size_t y = 1; y < getHeight(); y++)
{ {
setPrintPos (FPoint(x2 + 1, y1 + int(y))); print() << FPoint(x2 + 1, y1 + int(y)) << " ";
print (" ");
} }
unsetTransShadow(); unsetTransShadow();
setPrintPos (FPoint(x1, y2 + 1));
setTransparent(); setTransparent();
print (" "); print() << FPoint(x1, y2 + 1) << " ";
unsetTransparent(); unsetTransparent();
setColor (wc.shadow_bg, wc.shadow_fg); setColor (wc.shadow_bg, wc.shadow_fg);
@ -2266,12 +2262,12 @@ void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2) void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
{ {
// non-transparent shadow // non-transparent shadow
int block; wchar_t block;
if ( ! hasShadowCharacter() ) if ( ! hasShadowCharacter() )
return; return;
setPrintPos (FPoint(x2 + 1, y1)); print() << FPoint(x2 + 1, y1);
if ( isWindowWidget() ) if ( isWindowWidget() )
{ {
@ -2289,11 +2285,10 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
for (std::size_t y = 1; y < getHeight(); y++) for (std::size_t y = 1; y < getHeight(); y++)
{ {
setPrintPos (FPoint(x2 + 1, y1 + int(y))); print() << FPoint(x2 + 1, y1 + int(y)) << block; // █
print (block); // █
} }
setPrintPos (FPoint(x1 + 1, y2 + 1)); print() << FPoint(x1 + 1, y2 + 1);
if ( isWindowWidget() ) if ( isWindowWidget() )
setInheritBackground(); setInheritBackground();
@ -2310,8 +2305,7 @@ inline void FWidget::drawBox (int x1, int y1, int x2, int y2)
{ {
// Use box-drawing characters to draw a border // Use box-drawing characters to draw a border
setPrintPos (FPoint(x1, y1)); print() << FPoint(x1, y1) << fc::BoxDrawingsDownAndRight; // ┌
print (fc::BoxDrawingsDownAndRight); // ┌
for (int x = x1 + 1; x < x2; x++) for (int x = x1 + 1; x < x2; x++)
print (fc::BoxDrawingsHorizontal); // ─ print (fc::BoxDrawingsHorizontal); // ─
@ -2320,14 +2314,13 @@ inline void FWidget::drawBox (int x1, int y1, int x2, int y2)
for (int y = y1 + 1; y < y2; y++) for (int y = y1 + 1; y < y2; y++)
{ {
setPrintPos (FPoint(x1, y)); print() << FPoint(x1, y)
print (fc::BoxDrawingsVertical); // │ << fc::BoxDrawingsVertical // │
setPrintPos (FPoint(x2, y)); << FPoint(x2, y)
print (fc::BoxDrawingsVertical); // │ << fc::BoxDrawingsVertical; // │
} }
setPrintPos (FPoint(x1, y2)); print() << FPoint(x1, y2) << fc::BoxDrawingsUpAndRight; // └
print (fc::BoxDrawingsUpAndRight); // └
for (int x = x1 + 1; x < x2; x++) for (int x = x1 + 1; x < x2; x++)
print (fc::BoxDrawingsHorizontal); // ─ print (fc::BoxDrawingsHorizontal); // ─
@ -2336,10 +2329,10 @@ inline void FWidget::drawBox (int x1, int y1, int x2, int y2)
for (int x = x1 + 1; x < x2; x++) for (int x = x1 + 1; x < x2; x++)
{ {
setPrintPos (FPoint(x, y1)); print() << FPoint(x, y1)
print (fc::BoxDrawingsHorizontal); // ─ << fc::BoxDrawingsHorizontal // ─
setPrintPos (FPoint(x, y2)); << FPoint(x, y2)
print (fc::BoxDrawingsHorizontal); // ─ << fc::BoxDrawingsHorizontal; // ─
} }
} }
@ -2348,8 +2341,8 @@ inline void FWidget::drawNewFontBox (int x1, int y1, int x2, int y2)
{ {
// Use new graphical font characters to draw a border // Use new graphical font characters to draw a border
setPrintPos (FPoint(x1, y1)); print() << FPoint(x1, y1)
print (fc::NF_border_corner_middle_upper_left); // ┌ << fc::NF_border_corner_middle_upper_left; // ┌
for (int x = x1 + 1; x < x2; x++) for (int x = x1 + 1; x < x2; x++)
print (fc::BoxDrawingsHorizontal); // ─ print (fc::BoxDrawingsHorizontal); // ─
@ -2358,14 +2351,14 @@ inline void FWidget::drawNewFontBox (int x1, int y1, int x2, int y2)
for (int y = y1 + 1; y <= y2; y++) for (int y = y1 + 1; y <= y2; y++)
{ {
setPrintPos (FPoint(x1, y)); print() << FPoint(x1, y)
print (fc::NF_border_line_left); // border left ⎸ << fc::NF_border_line_left // border left ⎸
setPrintPos (FPoint(x2, y)); << FPoint(x2, y)
print (fc::NF_rev_border_line_right); // border right⎹ << fc::NF_rev_border_line_right; // border right⎹
} }
setPrintPos (FPoint(x1, y2)); print() << FPoint(x1, y2)
print (fc::NF_border_corner_middle_lower_left); // └ << fc::NF_border_corner_middle_lower_left; // └
for (int x = x1 + 1; x < x2; x++) for (int x = x1 + 1; x < x2; x++)
print (fc::BoxDrawingsHorizontal); // ─ print (fc::BoxDrawingsHorizontal); // ─

View File

@ -251,8 +251,7 @@ void FWindow::drawBorder()
, y1 = 1 , y1 = 1
, y2 = 1 + int(getHeight()) - 1; , y2 = 1 + int(getHeight()) - 1;
setPrintPos (FPoint(x1, y1)); print() << FPoint(x1, y1) << fc::NF_border_corner_upper_left; // ⎡
print (fc::NF_border_corner_upper_left); // ⎡
for (int x = x1 + 1; x < x2; x++) for (int x = x1 + 1; x < x2; x++)
print (fc::NF_border_line_upper); // ¯ print (fc::NF_border_line_upper); // ¯
@ -261,24 +260,20 @@ void FWindow::drawBorder()
for (int y = y1 + 1; y < y2; y++) for (int y = y1 + 1; y < y2; y++)
{ {
setPrintPos (FPoint(x1, y)); print() << FPoint(x1, y) // border left ⎸
// border left ⎸ << fc::NF_border_line_left
print (fc::NF_border_line_left); << FPoint(x2, y) // border right⎹
setPrintPos (FPoint(x2, y)); << fc::NF_rev_border_line_right;
// border right⎹
print (fc::NF_rev_border_line_right);
} }
setPrintPos (FPoint(x1, y2)); print() << FPoint(x1, y2) // lower left corner border ⎣
// lower left corner border ⎣ << fc::NF_border_corner_lower_left;
print (fc::NF_border_corner_lower_left);
for (std::size_t x = 2; x < getWidth(); x++) // low line _ for (std::size_t x = 2; x < getWidth(); x++) // low line _
print (fc::NF_border_line_bottom); print (fc::NF_border_line_bottom);
setPrintPos (FPoint(x2, y2)); print() << FPoint(x2, y2) // lower right corner border ⎦
// lower right corner border ⎦ << fc::NF_rev_border_corner_lower_right;
print (fc::NF_rev_border_corner_lower_right);
} }
else else
{ {

View File

@ -101,8 +101,10 @@ class FProgressbar : public FWidget
// Methods // Methods
virtual void draw() override; virtual void draw() override;
void drawPercentage(); void drawProgressLabel();
void drawBar(); void drawProgressBar();
std::size_t drawProgressIndicator();
void drawProgressBackground (std::size_t);
// Data Members // Data Members
std::size_t percentage{NOT_SET}; std::size_t percentage{NOT_SET};

View File

@ -132,6 +132,7 @@ class FVTerm
template <typename type> template <typename type>
FVTerm& operator << (const type&); FVTerm& operator << (const type&);
FVTerm& operator << (const std::vector<charData>&); FVTerm& operator << (const std::vector<charData>&);
FVTerm& operator << (const FPoint&);
// Accessors // Accessors
virtual const char* getClassName() const; virtual const char* getClassName() const;
@ -294,7 +295,8 @@ class FVTerm
int print (term_area*, wchar_t); int print (term_area*, wchar_t);
int print (charData&); int print (charData&);
int print (term_area*, charData&); int print (term_area*, charData&);
FVTerm& print(); virtual void print (const FPoint&);
virtual FVTerm& print();
static void beep(); static void beep();
static void redefineDefaultColors (bool); static void redefineDefaultColors (bool);
static char* moveCursor (int, int, int, int); static char* moveCursor (int, int, int, int);
@ -550,6 +552,13 @@ inline FVTerm& FVTerm::operator << \
return *this; return *this;
} }
//----------------------------------------------------------------------
inline FVTerm& FVTerm::operator << (const FPoint& pos)
{
print (pos);
return *this;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const char* FVTerm::getClassName() const inline const char* FVTerm::getClassName() const
{ return "FVTerm"; } { return "FVTerm"; }

View File

@ -129,6 +129,7 @@ class FWidget : public FVTerm, public FObject
public: public:
// Using-declaration // Using-declaration
using FVTerm::setColor; using FVTerm::setColor;
using FVTerm::print;
struct accelerator struct accelerator
{ {
@ -325,6 +326,7 @@ class FWidget : public FVTerm, public FObject
virtual bool focusLastChild(); virtual bool focusLastChild();
FPoint termToWidgetPos (const FPoint&); FPoint termToWidgetPos (const FPoint&);
void detectTermSize(); void detectTermSize();
virtual void print (const FPoint& p) override;
virtual void move (const FPoint&); virtual void move (const FPoint&);
void drawShadow(); void drawShadow();
void clearShadow(); void clearShadow();
@ -920,6 +922,12 @@ inline FPoint FWidget::termToWidgetPos (const FPoint& tPos)
, tPos.getY() + 1 - offset.getY1() - adjust_wsize.getY() ); , tPos.getY() + 1 - offset.getY1() - adjust_wsize.getY() );
} }
//----------------------------------------------------------------------
inline void FWidget::print (const FPoint& pos)
{
setPrintPos (pos);
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FWidget::drawBorder() inline void FWidget::drawBorder()
{ drawBorder (1, 1, int(getWidth()), int(getHeight())); } { drawBorder (1, 1, int(getWidth()), int(getHeight())); }