Optimize terminal output buffer queue with differencing for strings, and control characters and control sequences

This commit is contained in:
Markus Gans 2021-02-20 11:29:52 +01:00
parent 28f41f5d6c
commit a55b33977c
44 changed files with 561 additions and 862 deletions

View File

@ -1,3 +1,7 @@
2021-02-20 Markus Gans <guru.mail@muenster.de>
* Optimize terminal output buffer queue with differencing
for strings, and control characters and control sequences
2021-02-09 Markus Gans <guru.mail@muenster.de> 2021-02-09 Markus Gans <guru.mail@muenster.de>
* Added support for combined unicode characters * Added support for combined unicode characters
* Added a unit test for the FTermBuffera class * Added a unit test for the FTermBuffera class

View File

@ -886,17 +886,17 @@ bool FOptiAttr::setTermAttributes ( FChar& term
{ {
if ( F_set_attributes.cap ) if ( F_set_attributes.cap )
{ {
const char* sgr = FTermcap::encodeParameter ( F_set_attributes.cap const auto sgr = FTermcap::encodeParameter ( F_set_attributes.cap
, p1 && ! fake_reverse , p1 && ! fake_reverse
, p2 , p2
, p3 && ! fake_reverse , p3 && ! fake_reverse
, p4 , p4
, p5 , p5
, p6 , p6
, p7 , p7
, p8 , p8
, p9 ); , p9 );
append_sequence (sgr); append_sequence (sgr.data());
resetColor(term); resetColor(term);
term.attr.bit.standout = p1; term.attr.bit.standout = p1;
term.attr.bit.underline = p2; term.attr.bit.underline = p2;
@ -1386,13 +1386,13 @@ inline void FOptiAttr::change_current_color ( const FChar& term
if ( term.fg_color != fg || frev ) if ( term.fg_color != fg || frev )
{ {
color_str = FTermcap::encodeParameter(AF, uInt16(ansi_fg), 0, 0, 0, 0, 0, 0, 0, 0); color_str = FTermcap::encodeParameter(AF, uInt16(ansi_fg), 0, 0, 0, 0, 0, 0, 0, 0).data();
append_sequence (color_str); append_sequence (color_str);
} }
if ( term.bg_color != bg || frev ) if ( term.bg_color != bg || frev )
{ {
color_str = FTermcap::encodeParameter(AB, uInt16(ansi_bg), 0, 0, 0, 0, 0, 0, 0, 0); color_str = FTermcap::encodeParameter(AB, uInt16(ansi_bg), 0, 0, 0, 0, 0, 0, 0, 0).data();
append_sequence (color_str); append_sequence (color_str);
} }
} }
@ -1400,13 +1400,13 @@ inline void FOptiAttr::change_current_color ( const FChar& term
{ {
if ( term.fg_color != fg || frev ) if ( term.fg_color != fg || frev )
{ {
color_str = FTermcap::encodeParameter(Sf, uInt16(fg), 0, 0, 0, 0, 0, 0, 0, 0); color_str = FTermcap::encodeParameter(Sf, uInt16(fg), 0, 0, 0, 0, 0, 0, 0, 0).data();
append_sequence (color_str); append_sequence (color_str);
} }
if ( term.bg_color != bg || frev ) if ( term.bg_color != bg || frev )
{ {
color_str = FTermcap::encodeParameter(Sb, uInt16(bg), 0, 0, 0, 0, 0, 0, 0, 0); color_str = FTermcap::encodeParameter(Sb, uInt16(bg), 0, 0, 0, 0, 0, 0, 0, 0).data();
append_sequence (color_str); append_sequence (color_str);
} }
} }
@ -1414,7 +1414,7 @@ inline void FOptiAttr::change_current_color ( const FChar& term
{ {
fg = vga2ansi(fg); fg = vga2ansi(fg);
bg = vga2ansi(bg); bg = vga2ansi(bg);
color_str = FTermcap::encodeParameter(sp, uInt16(fg), uInt16(bg), 0, 0, 0, 0, 0, 0, 0); color_str = FTermcap::encodeParameter(sp, uInt16(fg), uInt16(bg), 0, 0, 0, 0, 0, 0, 0).data();
append_sequence (color_str); append_sequence (color_str);
} }
} }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2015-2020 Markus Gans * * Copyright 2015-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -266,9 +266,9 @@ void FOptiMove::set_cursor_address (const char cap[])
{ {
if ( cap && FTermcap::isInitialized() ) if ( cap && FTermcap::isInitialized() )
{ {
const char* temp = FTermcap::encodeMotionParameter(cap, 23, 23); const auto temp = FTermcap::encodeMotionParameter(cap, 23, 23);
F_cursor_address.cap = cap; F_cursor_address.cap = cap;
F_cursor_address.duration = capDuration (temp, 1); F_cursor_address.duration = capDuration (temp.data(), 1);
F_cursor_address.length = capDurationToLength (F_cursor_address.duration); F_cursor_address.length = capDurationToLength (F_cursor_address.duration);
} }
else else
@ -284,9 +284,9 @@ void FOptiMove::set_column_address (const char cap[])
{ {
if ( cap && FTermcap::isInitialized() ) if ( cap && FTermcap::isInitialized() )
{ {
const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const auto temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0);
F_column_address.cap = cap; F_column_address.cap = cap;
F_column_address.duration = capDuration (temp, 1); F_column_address.duration = capDuration (temp.data(), 1);
F_column_address.length = capDurationToLength (F_column_address.duration); F_column_address.length = capDurationToLength (F_column_address.duration);
} }
else else
@ -302,7 +302,7 @@ void FOptiMove::set_row_address (const char cap[])
{ {
if ( cap && FTermcap::isInitialized() ) if ( cap && FTermcap::isInitialized() )
{ {
const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0).data();
F_row_address.cap = cap; F_row_address.cap = cap;
F_row_address.duration = capDuration (temp, 1); F_row_address.duration = capDuration (temp, 1);
F_row_address.length = capDurationToLength (F_row_address.duration); F_row_address.length = capDurationToLength (F_row_address.duration);
@ -320,7 +320,7 @@ void FOptiMove::set_parm_up_cursor (const char cap[])
{ {
if ( cap && FTermcap::isInitialized() ) if ( cap && FTermcap::isInitialized() )
{ {
const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0).data();
F_parm_up_cursor.cap = cap; F_parm_up_cursor.cap = cap;
F_parm_up_cursor.duration = capDuration (temp, 1); F_parm_up_cursor.duration = capDuration (temp, 1);
F_parm_up_cursor.length = capDurationToLength (F_parm_up_cursor.duration); F_parm_up_cursor.length = capDurationToLength (F_parm_up_cursor.duration);
@ -338,7 +338,7 @@ void FOptiMove::set_parm_down_cursor (const char cap[])
{ {
if ( cap && FTermcap::isInitialized() ) if ( cap && FTermcap::isInitialized() )
{ {
const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0).data();
F_parm_down_cursor.cap = cap; F_parm_down_cursor.cap = cap;
F_parm_down_cursor.duration = capDuration (temp, 1); F_parm_down_cursor.duration = capDuration (temp, 1);
F_parm_down_cursor.length = capDurationToLength (F_parm_down_cursor.duration); F_parm_down_cursor.length = capDurationToLength (F_parm_down_cursor.duration);
@ -356,7 +356,7 @@ void FOptiMove::set_parm_left_cursor (const char cap[])
{ {
if ( cap && FTermcap::isInitialized() ) if ( cap && FTermcap::isInitialized() )
{ {
const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0).data();
F_parm_left_cursor.cap = cap; F_parm_left_cursor.cap = cap;
F_parm_left_cursor.duration = capDuration (temp, 1); F_parm_left_cursor.duration = capDuration (temp, 1);
F_parm_left_cursor.length = capDurationToLength (F_parm_left_cursor.duration); F_parm_left_cursor.length = capDurationToLength (F_parm_left_cursor.duration);
@ -374,7 +374,7 @@ void FOptiMove::set_parm_right_cursor (const char cap[])
{ {
if ( cap && FTermcap::isInitialized() ) if ( cap && FTermcap::isInitialized() )
{ {
const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0).data();
F_parm_right_cursor.cap = cap; F_parm_right_cursor.cap = cap;
F_parm_right_cursor.duration = capDuration (temp, 1); F_parm_right_cursor.duration = capDuration (temp, 1);
F_parm_right_cursor.length = capDurationToLength (F_parm_right_cursor.duration); F_parm_right_cursor.length = capDurationToLength (F_parm_right_cursor.duration);
@ -392,7 +392,7 @@ void FOptiMove::set_erase_chars (const char cap[])
{ {
if ( cap && FTermcap::isInitialized() ) if ( cap && FTermcap::isInitialized() )
{ {
const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = FTermcap::encodeParameter(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0).data();
F_erase_chars.cap = cap; F_erase_chars.cap = cap;
F_erase_chars.duration = capDuration (temp, 1); F_erase_chars.duration = capDuration (temp, 1);
F_erase_chars.length = capDurationToLength (F_erase_chars.duration); F_erase_chars.length = capDurationToLength (F_erase_chars.duration);
@ -410,7 +410,7 @@ void FOptiMove::set_repeat_char (const char cap[])
{ {
if ( cap && FTermcap::isInitialized() ) if ( cap && FTermcap::isInitialized() )
{ {
const char* temp = FTermcap::encodeParameter(cap, ' ', 23, 0, 0, 0, 0, 0, 0, 0); const char* temp = FTermcap::encodeParameter(cap, ' ', 23, 0, 0, 0, 0, 0, 0, 0).data();
F_repeat_char.cap = cap; F_repeat_char.cap = cap;
F_repeat_char.duration = capDuration (temp, 1); F_repeat_char.duration = capDuration (temp, 1);
F_repeat_char.length = capDurationToLength (F_repeat_char.duration); F_repeat_char.length = capDurationToLength (F_repeat_char.duration);
@ -686,7 +686,7 @@ inline int FOptiMove::verticalMove (char move[], int from_y, int to_y) const
if ( move ) if ( move )
{ {
std::strncpy ( move std::strncpy ( move
, FTermcap::encodeParameter(F_row_address.cap, to_y, 0, 0, 0, 0, 0, 0, 0, 0) , FTermcap::encodeParameter(F_row_address.cap, to_y, 0, 0, 0, 0, 0, 0, 0, 0).data()
, BUF_SIZE ); , BUF_SIZE );
move[BUF_SIZE - 1] = '\0'; move[BUF_SIZE - 1] = '\0';
} }
@ -713,7 +713,7 @@ inline void FOptiMove::downMove ( char move[], int& vtime
if ( move ) if ( move )
{ {
std::strncpy ( move std::strncpy ( move
, FTermcap::encodeParameter(F_parm_down_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0) , FTermcap::encodeParameter(F_parm_down_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0).data()
, BUF_SIZE ); , BUF_SIZE );
move[BUF_SIZE - 1] = '\0'; move[BUF_SIZE - 1] = '\0';
} }
@ -741,7 +741,7 @@ inline void FOptiMove::upMove ( char move[], int& vtime
if ( move ) if ( move )
{ {
std::strncpy ( move std::strncpy ( move
, FTermcap::encodeParameter(F_parm_up_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0) , FTermcap::encodeParameter(F_parm_up_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0).data()
, BUF_SIZE ); , BUF_SIZE );
move[BUF_SIZE - 1] = '\0'; move[BUF_SIZE - 1] = '\0';
} }
@ -767,7 +767,7 @@ inline int FOptiMove::horizontalMove (char hmove[], int from_x, int to_x) const
{ {
// Move to fixed column position1 // Move to fixed column position1
std::strncat ( hmove std::strncat ( hmove
, FTermcap::encodeParameter(F_column_address.cap, to_x, 0, 0, 0, 0, 0, 0, 0, 0) , FTermcap::encodeParameter(F_column_address.cap, to_x, 0, 0, 0, 0, 0, 0, 0, 0).data()
, BUF_SIZE - std::strlen(hmove) - 1 ); , BUF_SIZE - std::strlen(hmove) - 1 );
hmove[BUF_SIZE - 1] = '\0'; hmove[BUF_SIZE - 1] = '\0';
htime = F_column_address.duration; htime = F_column_address.duration;
@ -790,7 +790,7 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
if ( F_parm_right_cursor.cap && F_parm_right_cursor.duration < htime ) if ( F_parm_right_cursor.cap && F_parm_right_cursor.duration < htime )
{ {
std::strncpy ( hmove std::strncpy ( hmove
, FTermcap::encodeParameter(F_parm_right_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0) , FTermcap::encodeParameter(F_parm_right_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0).data()
, BUF_SIZE - 1); , BUF_SIZE - 1);
hmove[BUF_SIZE - 1] = '\0'; hmove[BUF_SIZE - 1] = '\0';
htime = F_parm_right_cursor.duration; htime = F_parm_right_cursor.duration;
@ -845,7 +845,7 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
if ( F_parm_left_cursor.cap && F_parm_left_cursor.duration < htime ) if ( F_parm_left_cursor.cap && F_parm_left_cursor.duration < htime )
{ {
std::strncpy ( hmove std::strncpy ( hmove
, FTermcap::encodeParameter(F_parm_left_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0) , FTermcap::encodeParameter(F_parm_left_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0).data()
, BUF_SIZE - 1); , BUF_SIZE - 1);
hmove[BUF_SIZE - 1] = '\0'; hmove[BUF_SIZE - 1] = '\0';
htime = F_parm_left_cursor.duration; htime = F_parm_left_cursor.duration;
@ -906,13 +906,17 @@ inline bool FOptiMove::isMethod0Faster ( int& move_time
, int xnew, int ynew ) , int xnew, int ynew )
{ {
// Test method 0: direct cursor addressing // Test method 0: direct cursor addressing
const char* move_xy = \
if ( ! F_cursor_address.cap )
return false;
const auto move_xy = \
FTermcap::encodeMotionParameter(F_cursor_address.cap, xnew, ynew); FTermcap::encodeMotionParameter(F_cursor_address.cap, xnew, ynew);
if ( move_xy ) if ( ! move_xy.empty() )
{ {
std::strncpy ( reinterpret_cast<char*>(move_buf) std::strncpy ( reinterpret_cast<char*>(move_buf)
, move_xy, BUF_SIZE - 1 ); , move_xy.data(), BUF_SIZE - 1 );
move_buf[BUF_SIZE - 1] = '\0'; move_buf[BUF_SIZE - 1] = '\0';
move_time = F_cursor_address.duration; move_time = F_cursor_address.duration;
return true; return true;

View File

@ -151,14 +151,14 @@ int FTerm::getTTYFileDescriptor()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const char* FTerm::getTermType() std::string FTerm::getTermType()
{ {
const auto& data = FTerm::getFTermData(); const auto& data = FTerm::getFTermData();
return data->getTermType(); return data->getTermType();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const char* FTerm::getTermFileName() std::string FTerm::getTermFileName()
{ {
const auto& data = FTerm::getFTermData(); const auto& data = FTerm::getFTermData();
return data->getTermFileName(); return data->getTermFileName();
@ -504,7 +504,7 @@ bool FTerm::canChangeColorPalette()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::setTermType (const char term_name[]) void FTerm::setTermType (const std::string& term_name)
{ {
const auto& data = FTerm::getFTermData(); const auto& data = FTerm::getFTermData();
data->setTermType(term_name); data->setTermType(term_name);
@ -691,7 +691,13 @@ int FTerm::openConsole()
{ {
const auto& data = FTerm::getFTermData(); const auto& data = FTerm::getFTermData();
int fd = data->getTTYFileDescriptor(); int fd = data->getTTYFileDescriptor();
const char* termfilename = data->getTermFileName(); const auto& termfilename = data->getTermFileName();
if ( ! termfilename.empty() )
return 0;
if ( fd >= 0 ) // console is already opened
return 0;
constexpr std::array<const char*, 6> terminal_devices = constexpr std::array<const char*, 6> terminal_devices =
{{ {{
@ -703,12 +709,6 @@ int FTerm::openConsole()
"/dev/console" "/dev/console"
}}; }};
if ( fd >= 0 ) // console is already opened
return 0;
if ( ! *termfilename )
return 0;
for (auto&& entry : terminal_devices) for (auto&& entry : terminal_devices)
{ {
const auto& fsys = FTerm::getFSystem(); const auto& fsys = FTerm::getFSystem();
@ -755,7 +755,7 @@ const char* FTerm::moveCursorString (int xold, int yold, int xnew, int ynew)
return opti_move->moveCursor (xold, yold, xnew, ynew); return opti_move->moveCursor (xold, yold, xnew, ynew);
} }
else else
return FTermcap::encodeMotionParameter(TCAP(t_cursor_address), xnew, ynew); return FTermcap::encodeMotionParameter(TCAP(t_cursor_address), xnew, ynew).data();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -896,7 +896,7 @@ void FTerm::setPalette (FColor index, int r, int g, int b)
if ( Ic || Ip ) if ( Ic || Ip )
{ {
const char* color_str{}; std::string color_str{};
const int rr = (r * 1001) / 256; const int rr = (r * 1001) / 256;
const int gg = (g * 1001) / 256; const int gg = (g * 1001) / 256;
@ -907,7 +907,7 @@ void FTerm::setPalette (FColor index, int r, int g, int b)
else if ( Ip ) else if ( Ip )
color_str = FTermcap::encodeParameter(Ip, uInt16(index), 0, 0, 0, rr, gg, bb, 0, 0); color_str = FTermcap::encodeParameter(Ip, uInt16(index), 0, 0, 0, rr, gg, bb, 0, 0);
if ( color_str ) if ( ! color_str.empty() )
{ {
putstring (color_str); putstring (color_str);
state = true; state = true;
@ -1115,7 +1115,7 @@ FTerm::defaultPutChar& FTerm::putchar()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::putstring (const char str[], int affcnt) void FTerm::putstring (const std::string& str, int affcnt)
{ {
FTermcap::paddingPrint (str, affcnt, FTerm::putchar_ASCII); FTermcap::paddingPrint (str, affcnt, FTerm::putchar_ASCII);
} }
@ -1564,7 +1564,7 @@ void FTerm::init_locale()
// Init current locale // Init current locale
const auto& data = FTerm::getFTermData(); const auto& data = FTerm::getFTermData();
const char* termtype = data->getTermType(); const auto& termtype = data->getTermType();
const char* locale_name = std::setlocale (LC_ALL, ""); const char* locale_name = std::setlocale (LC_ALL, "");
std::setlocale (LC_NUMERIC, ""); std::setlocale (LC_NUMERIC, "");
@ -1584,7 +1584,7 @@ void FTerm::init_locale()
locale_name = std::setlocale (LC_ALL, "C"); locale_name = std::setlocale (LC_ALL, "C");
// Sun (color) workstation console can't show UTF-8 character // Sun (color) workstation console can't show UTF-8 character
if ( std::strncmp(termtype, "sun", 3) == 0 if ( termtype.substr(0,3) == "sun"
&& ! std::strcmp(nl_langinfo(CODESET), "UTF-8") ) && ! std::strcmp(nl_langinfo(CODESET), "UTF-8") )
locale_name = std::setlocale (LC_ALL, "C"); locale_name = std::setlocale (LC_ALL, "C");
@ -1656,7 +1656,7 @@ void FTerm::init_term_encoding()
{ {
const int stdout_no = FTermios::getStdOut(); const int stdout_no = FTermios::getStdOut();
const auto& data = FTerm::getFTermData(); const auto& data = FTerm::getFTermData();
const char* termtype = data->getTermType(); const auto& termtype = data->getTermType();
const auto& fsys = FTerm::getFSystem(); const auto& fsys = FTerm::getFSystem();
if ( fsys->isTTY(stdout_no) if ( fsys->isTTY(stdout_no)
@ -1671,7 +1671,7 @@ void FTerm::init_term_encoding()
keyboard->enableUTF8(); keyboard->enableUTF8();
} }
else if ( fsys->isTTY(stdout_no) else if ( fsys->isTTY(stdout_no)
&& (std::strlen(termtype) > 0) && (termtype.length() > 0)
&& (TCAP(t_exit_alt_charset_mode) != nullptr) ) && (TCAP(t_exit_alt_charset_mode) != nullptr) )
{ {
data->setVT100Console (true); data->setVT100Console (true);

View File

@ -179,13 +179,13 @@ void FTermBuffer::add ( FString::const_iterator& begin
// FTermBuffer non-member operators // FTermBuffer non-member operators
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermBuffer::FCharVector& operator << ( FTermBuffer::FCharVector& termString FTermBuffer::FCharVector& operator << ( FTermBuffer::FCharVector& term_string
, const FTermBuffer& buf ) , const FTermBuffer& buf )
{ {
if ( ! buf.data.empty() ) if ( ! buf.data.empty() )
termString.assign(buf.data.begin(), buf.data.end()); term_string.assign(buf.data.begin(), buf.data.end());
return termString; return term_string;
} }
} // namespace finalcut } // namespace finalcut

View File

@ -87,11 +87,7 @@ void FTermcap::termcap()
const bool color256 = term_detection->canDisplay256Colors(); const bool color256 = term_detection->canDisplay256Colors();
// Open termcap file // Open termcap file
#if defined(__sun) && defined(__SVR4) const auto& termtype = fterm_data->getTermType();
char* termtype = const_cast<char*>(fterm_data->getTermType());
#else
const char* termtype = fterm_data->getTermType();
#endif
terminals.emplace_back(termtype); // available terminal type terminals.emplace_back(termtype); // available terminal type
if ( color256 ) // 1st fallback if not found if ( color256 ) // 1st fallback if not found
@ -104,10 +100,15 @@ void FTermcap::termcap()
while ( iter != terminals.end() ) while ( iter != terminals.end() )
{ {
fterm_data->setTermType(iter->c_str()); fterm_data->setTermType(*iter);
// Open the termcap file + load entry for termtype // Open the termcap file + load entry for termtype
status = tgetent(term_buffer, termtype); #if defined(__sun) && defined(__SVR4)
status = tgetent(term_buffer, const_cast<char*>(termtype.data()));
#else
status = tgetent(term_buffer, termtype.data());
#endif
if ( status == success ) if ( status == success )
initialized = true; initialized = true;
@ -132,9 +133,9 @@ void FTermcap::termcapError (int status)
if ( status == no_entry || status == uninitialized ) if ( status == no_entry || status == uninitialized )
{ {
const auto& fterm_data = FTerm::getFTermData(); const auto& fterm_data = FTerm::getFTermData();
const char* termtype = fterm_data->getTermType(); const auto& termtype = fterm_data->getTermType();
std::clog << FLog::LogLevel::Error std::clog << FLog::LogLevel::Error
<< "Unknown terminal: \"" << termtype << "\". " << "Unknown terminal: \"" << termtype << "\". "
<< "Check the TERM environment variable. " << "Check the TERM environment variable. "
<< "Also make sure that the terminal " << "Also make sure that the terminal "
<< "is defined in the termcap/terminfo database." << "is defined in the termcap/terminfo database."

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2018-2020 Markus Gans * * Copyright 2018-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -225,10 +225,10 @@ void FTermcapQuirks::rxvt()
{ {
// Set enter/exit alternative charset mode for rxvt terminal // Set enter/exit alternative charset mode for rxvt terminal
const auto& fterm_data = FTerm::getFTermData(); const auto& fterm_data = FTerm::getFTermData();
const char* termtype = fterm_data->getTermType(); const auto& termtype = fterm_data->getTermType();
const auto& term_detection = FTerm::getFTermDetection(); const auto& term_detection = FTerm::getFTermDetection();
if ( std::strncmp(termtype, "rxvt-16color", 12) == 0 ) if ( termtype.substr(0,12) == "rxvt-16color" )
{ {
TCAP(t_enter_alt_charset_mode) = ESC "(0"; TCAP(t_enter_alt_charset_mode) = ESC "(0";
TCAP(t_exit_alt_charset_mode) = ESC "(B"; TCAP(t_exit_alt_charset_mode) = ESC "(B";

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2018-2020 Markus Gans * * Copyright 2018-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -168,7 +168,7 @@ void FTermDetection::getSystemTermType()
termtype[sizeof(termtype) - 1] = '\0'; termtype[sizeof(termtype) - 1] = '\0';
return; return;
} }
else if ( *termfilename ) // 1st fallback: use the teminal file name else if ( ! termfilename.empty() ) // 1st fallback: use the teminal file name
{ {
if ( getTTYtype() ) // Look into /etc/ttytype if ( getTTYtype() ) // Look into /etc/ttytype
return; return;
@ -198,11 +198,11 @@ bool FTermDetection::getTTYtype()
// Get term basename // Get term basename
const auto& fterm_data = FTerm::getFTermData(); const auto& fterm_data = FTerm::getFTermData();
const char* termfilename = fterm_data->getTermFileName(); const auto& termfilename = fterm_data->getTermFileName();
const char* term_basename = std::strrchr(termfilename, '/'); const char* term_basename = std::strrchr(termfilename.data(), '/');
if ( term_basename == nullptr ) if ( term_basename == nullptr )
term_basename = termfilename; term_basename = termfilename.data();
else else
term_basename++; term_basename++;
@ -254,11 +254,11 @@ bool FTermDetection::getTTYSFileEntry()
// get term basename // get term basename
const auto& fterm_data = FTerm::getFTermData(); const auto& fterm_data = FTerm::getFTermData();
const char* termfilename = fterm_data->getTermFileName(); const auto& termfilename = fterm_data->getTermFileName();
const char* term_basename = std::strrchr(termfilename, '/'); const char* term_basename = std::strrchr(termfilename.data(), '/');
if ( term_basename == nullptr ) if ( term_basename == nullptr )
term_basename = termfilename; term_basename = termfilename.data();
else else
term_basename++; term_basename++;

View File

@ -24,6 +24,7 @@
#include <unistd.h> // need for ttyname_r #include <unistd.h> // need for ttyname_r
#endif #endif
#include <numeric>
#include <queue> #include <queue>
#include <string> #include <string>
#include <vector> #include <vector>
@ -68,10 +69,7 @@ uInt FVTerm::clr_eol_length{};
uInt FVTerm::cursor_address_length{}; uInt FVTerm::cursor_address_length{};
struct timeval FVTerm::time_last_flush{}; struct timeval FVTerm::time_last_flush{};
struct timeval FVTerm::last_term_size_check{}; struct timeval FVTerm::last_term_size_check{};
std::vector<int>* FVTerm::output_buffer{nullptr};
FPoint* FVTerm::term_pos{nullptr};
const FVTerm* FVTerm::init_object{nullptr}; const FVTerm* FVTerm::init_object{nullptr};
FTerm* FVTerm::fterm{nullptr};
FVTerm::FTermArea* FVTerm::vterm{nullptr}; FVTerm::FTermArea* FVTerm::vterm{nullptr};
FVTerm::FTermArea* FVTerm::vdesktop{nullptr}; FVTerm::FTermArea* FVTerm::vdesktop{nullptr};
FVTerm::FTermArea* FVTerm::active_area{nullptr}; FVTerm::FTermArea* FVTerm::active_area{nullptr};
@ -91,6 +89,12 @@ FVTerm::FVTerm()
{ {
if ( ! init_object ) if ( ! init_object )
init(); init();
else
{
fterm = std::shared_ptr<FTerm>(init_object->fterm);
term_pos = std::shared_ptr<FPoint>(init_object->term_pos);
output_buffer = std::shared_ptr<OutputBuffer>(init_object->output_buffer);
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -150,7 +154,7 @@ void FVTerm::setTermXY (int x, int y) const
const char* move_str = FTerm::moveCursorString (term_x, term_y, x, y); const char* move_str = FTerm::moveCursorString (term_x, term_y, x, y);
if ( move_str ) if ( move_str )
appendOutputBuffer(move_str); appendOutputBuffer(FTermControl{move_str});
term_pos->setPoint(x, y); term_pos->setPoint(x, y);
} }
@ -185,7 +189,7 @@ void FVTerm::hideCursor (bool enable) const
if ( ! visibility_str ) // Exit the function if the string is empty if ( ! visibility_str ) // Exit the function if the string is empty
return; return;
appendOutputBuffer(visibility_str); appendOutputBuffer(FTermControl{visibility_str});
flush(); flush();
} }
@ -565,7 +569,7 @@ void FVTerm::print (const FColorPair& pair)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::flush() void FVTerm::flush() const
{ {
// Flush the output buffer // Flush the output buffer
@ -573,15 +577,28 @@ void FVTerm::flush()
|| ! (isFlushTimeout() || force_terminal_update) ) || ! (isFlushTimeout() || force_terminal_update) )
return; return;
static const FTerm::defaultPutChar& FTermPutchar = FTerm::putchar(); while ( ! output_buffer->empty() )
{
const auto& first = output_buffer->front();
const auto& type = std::get<0>(first);
const auto& wstring = std::get<1>(first);
if ( ! FTermPutchar ) if ( type == OutputType::String )
return; {
static const FTerm::defaultPutChar& FTermPutchar = FTerm::putchar();
for (auto&& ch : *output_buffer) if ( ! FTermPutchar )
FTermPutchar(ch); return;
for (auto&& ch : wstring)
FTermPutchar(int(ch));
}
else if ( type == OutputType::Control )
FTerm::putstring (std::string(wstring.begin(), wstring.end()));
output_buffer->pop();
}
output_buffer->clear();
std::fflush(stdout); std::fflush(stdout);
const auto& mouse = FTerm::getFMouseControl(); const auto& mouse = FTerm::getFMouseControl();
mouse->drawPointer(); mouse->drawPointer();
@ -1809,9 +1826,9 @@ void FVTerm::init()
try try
{ {
fterm = new FTerm(); fterm = std::make_shared<FTerm>();
term_pos = new FPoint(-1, -1); term_pos = std::make_shared<FPoint>(-1, -1);
output_buffer = new std::vector<int>; output_buffer = std::make_shared<OutputBuffer>();
} }
catch (const std::bad_alloc&) catch (const std::bad_alloc&)
{ {
@ -1823,9 +1840,6 @@ void FVTerm::init()
// The final setting is made later in FTerm::init_locale(). // The final setting is made later in FTerm::init_locale().
std::setlocale (LC_ALL, ""); std::setlocale (LC_ALL, "");
// Reserve memory on the terminal output buffer
output_buffer->reserve(TERMINAL_OUTPUT_BUFFER_SIZE + 256);
// term_attribute stores the current state of the terminal // term_attribute stores the current state of the terminal
term_attribute.ch = {{ L'\0' }}; term_attribute.ch = {{ L'\0' }};
term_attribute.fg_color = FColor::Default; term_attribute.fg_color = FColor::Default;
@ -1921,19 +1935,10 @@ void FVTerm::finish()
forceTerminalUpdate(); forceTerminalUpdate();
if ( output_buffer )
delete output_buffer;
// remove virtual terminal + virtual desktop area // remove virtual terminal + virtual desktop area
removeArea (vdesktop); removeArea (vdesktop);
removeArea (vterm); removeArea (vterm);
if ( term_pos )
delete term_pos;
if ( fterm )
delete fterm;
init_object = nullptr; init_object = nullptr;
} }
@ -2046,13 +2051,13 @@ bool FVTerm::clearTerm (wchar_t fillchar) const
if ( cl ) // Clear screen if ( cl ) // Clear screen
{ {
appendOutputBuffer (cl); appendOutputBuffer (FTermControl{cl});
term_pos->setPoint(0, 0); term_pos->setPoint(0, 0);
} }
else if ( cd ) // Clear to end of screen else if ( cd ) // Clear to end of screen
{ {
setTermXY (0, 0); setTermXY (0, 0);
appendOutputBuffer (cd); appendOutputBuffer (FTermControl{cd});
term_pos->setPoint(-1, -1); term_pos->setPoint(-1, -1);
} }
else if ( cb ) // Clear to end of line else if ( cb ) // Clear to end of line
@ -2062,7 +2067,7 @@ bool FVTerm::clearTerm (wchar_t fillchar) const
for (auto i{0}; i < int(FTerm::getLineNumber()); i++) for (auto i{0}; i < int(FTerm::getLineNumber()); i++)
{ {
setTermXY (0, i); setTermXY (0, i);
appendOutputBuffer (cb); appendOutputBuffer (FTermControl{cb});
} }
setTermXY (0, 0); setTermXY (0, 0);
@ -2382,7 +2387,7 @@ void FVTerm::printFullWidthCharacter ( uInt& x, uInt y
{ {
// Print ellipses for the 1st full-width character column // Print ellipses for the 1st full-width character column
appendAttributes (print_char); appendAttributes (print_char);
appendOutputBuffer (int(UniChar::HorizontalEllipsis)); appendOutputBuffer (FTermChar{wchar_t(UniChar::HorizontalEllipsis)});
term_pos->x_ref()++; term_pos->x_ref()++;
markAsPrinted (x, y); markAsPrinted (x, y);
@ -2391,7 +2396,7 @@ void FVTerm::printFullWidthCharacter ( uInt& x, uInt y
// Print ellipses for the 2nd full-width character column // Print ellipses for the 2nd full-width character column
x++; x++;
appendAttributes (next_char); appendAttributes (next_char);
appendOutputBuffer (int(UniChar::HorizontalEllipsis)); appendOutputBuffer (FTermChar{wchar_t(UniChar::HorizontalEllipsis)});
term_pos->x_ref()++; term_pos->x_ref()++;
markAsPrinted (x, y); markAsPrinted (x, y);
} }
@ -2417,9 +2422,9 @@ void FVTerm::printFullWidthPaddingCharacter ( uInt& x, uInt y
const auto& LE = TCAP(t_parm_left_cursor); const auto& LE = TCAP(t_parm_left_cursor);
if ( le ) if ( le )
appendOutputBuffer (le); appendOutputBuffer (FTermControl{le});
else if ( LE ) else if ( LE )
appendOutputBuffer (FTermcap::encodeParameter(LE, 1, 0, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (FTermControl{FTermcap::encodeParameter(LE, 1, 0, 0, 0, 0, 0, 0, 0, 0)});
else else
{ {
skipPaddingCharacter (x, y, prev_char); skipPaddingCharacter (x, y, prev_char);
@ -2437,7 +2442,7 @@ void FVTerm::printFullWidthPaddingCharacter ( uInt& x, uInt y
{ {
// Print ellipses for the 1st full-width character column // Print ellipses for the 1st full-width character column
appendAttributes (print_char); appendAttributes (print_char);
appendOutputBuffer (int(UniChar::HorizontalEllipsis)); appendOutputBuffer (FTermChar{wchar_t(UniChar::HorizontalEllipsis)});
term_pos->x_ref()++; term_pos->x_ref()++;
markAsPrinted (x, y); markAsPrinted (x, y);
} }
@ -2457,9 +2462,9 @@ void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y
const auto& LE = TCAP(t_parm_left_cursor); const auto& LE = TCAP(t_parm_left_cursor);
if ( le ) if ( le )
appendOutputBuffer (le); appendOutputBuffer (FTermControl{le});
else if ( LE ) else if ( LE )
appendOutputBuffer (FTermcap::encodeParameter(LE, 1, 0, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (FTermControl{FTermcap::encodeParameter(LE, 1, 0, 0, 0, 0, 0, 0, 0, 0)});
if ( le || LE ) if ( le || LE )
{ {
@ -2467,7 +2472,7 @@ void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y
x--; x--;
term_pos->x_ref()--; term_pos->x_ref()--;
appendAttributes (prev_char); appendAttributes (prev_char);
appendOutputBuffer (int(UniChar::HorizontalEllipsis)); appendOutputBuffer (FTermChar{wchar_t(UniChar::HorizontalEllipsis)});
term_pos->x_ref()++; term_pos->x_ref()++;
markAsPrinted (x, y); markAsPrinted (x, y);
x++; x++;
@ -2531,7 +2536,7 @@ FVTerm::PrintState FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
&& (ut || normal) ) && (ut || normal) )
{ {
appendAttributes (print_char); appendAttributes (print_char);
appendOutputBuffer (FTermcap::encodeParameter(ec, whitespace, 0, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (FTermControl{FTermcap::encodeParameter(ec, whitespace, 0, 0, 0, 0, 0, 0, 0, 0)});
if ( x + whitespace - 1 < xmax || draw_trailing_ws ) if ( x + whitespace - 1 < xmax || draw_trailing_ws )
setTermXY (int(x + whitespace), int(y)); setTermXY (int(x + whitespace), int(y));
@ -2596,7 +2601,7 @@ FVTerm::PrintState FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y) const
newFontChanges (print_char); newFontChanges (print_char);
charsetChanges (print_char); charsetChanges (print_char);
appendAttributes (print_char); appendAttributes (print_char);
appendOutputBuffer (FTermcap::encodeParameter(rp, print_char.ch[0], repetitions, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (FTermControl{FTermcap::encodeParameter(rp, print_char.ch[0], repetitions, 0, 0, 0, 0, 0, 0, 0)});
term_pos->x_ref() += int(repetitions); term_pos->x_ref() += int(repetitions);
x = x + repetitions - 1; x = x + repetitions - 1;
} }
@ -2630,7 +2635,7 @@ inline bool FVTerm::isFullWidthPaddingChar (const FChar& ch) const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::cursorWrap() void FVTerm::cursorWrap() const
{ {
// Wrap the cursor // Wrap the cursor
const auto& vt = vterm; const auto& vt = vterm;
@ -2790,7 +2795,7 @@ bool FVTerm::updateTerminalLine (uInt y) const
{ {
auto& min_char = vt->data[y * uInt(vt->width) + xmin]; auto& min_char = vt->data[y * uInt(vt->width) + xmin];
appendAttributes (min_char); appendAttributes (min_char);
appendOutputBuffer (ce); appendOutputBuffer (FTermControl{ce});
markAsPrinted (xmin, uInt(vt->width - 1), y); markAsPrinted (xmin, uInt(vt->width - 1), y);
} }
else else
@ -2800,7 +2805,7 @@ bool FVTerm::updateTerminalLine (uInt y) const
const auto& cb = TCAP(t_clr_bol); const auto& cb = TCAP(t_clr_bol);
auto& first_char = vt->data[y * uInt(vt->width)]; auto& first_char = vt->data[y * uInt(vt->width)];
appendAttributes (first_char); appendAttributes (first_char);
appendOutputBuffer (cb); appendOutputBuffer (FTermControl{cb});
markAsPrinted (0, xmin, y); markAsPrinted (0, xmin, y);
} }
@ -2810,7 +2815,7 @@ bool FVTerm::updateTerminalLine (uInt y) const
{ {
auto& last_char = vt->data[(y + 1) * uInt(vt->width) - 1]; auto& last_char = vt->data[(y + 1) * uInt(vt->width) - 1];
appendAttributes (last_char); appendAttributes (last_char);
appendOutputBuffer (ce); appendOutputBuffer (FTermControl{ce});
markAsPrinted (xmax + 1, uInt(vt->width - 1), y); markAsPrinted (xmax + 1, uInt(vt->width - 1), y);
} }
} }
@ -3006,7 +3011,7 @@ inline void FVTerm::appendChar (FChar& next_char) const
for (auto&& ch : next_char.encoded_char) for (auto&& ch : next_char.encoded_char)
{ {
if ( ch != L'\0') if ( ch != L'\0')
appendOutputBuffer(ch); appendOutputBuffer (FTermChar{ch});
if ( ! combined_char_support ) if ( ! combined_char_support )
return; return;
@ -3020,7 +3025,7 @@ inline void FVTerm::appendAttributes (FChar& next_attr) const
const auto& attr_str = FTerm::changeAttribute (term_attribute, next_attr); const auto& attr_str = FTerm::changeAttribute (term_attribute, next_attr);
if ( attr_str ) if ( attr_str )
appendOutputBuffer (attr_str); appendOutputBuffer (FTermControl{attr_str});
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -3035,9 +3040,9 @@ void FVTerm::appendLowerRight (FChar& last_char) const
} }
else if ( SA && RA ) else if ( SA && RA )
{ {
appendOutputBuffer (RA); appendOutputBuffer (FTermControl{RA});
appendChar (last_char); appendChar (last_char);
appendOutputBuffer (SA); appendOutputBuffer (FTermControl{SA});
} }
else else
{ {
@ -3058,32 +3063,32 @@ void FVTerm::appendLowerRight (FChar& last_char) const
if ( IC ) if ( IC )
{ {
appendOutputBuffer (FTermcap::encodeParameter(IC, 1, 0, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (FTermControl{FTermcap::encodeParameter(IC, 1, 0, 0, 0, 0, 0, 0, 0, 0)});
appendChar (second_last); appendChar (second_last);
} }
else if ( im && ei ) else if ( im && ei )
{ {
appendOutputBuffer (im); appendOutputBuffer (FTermControl{im});
appendChar (second_last); appendChar (second_last);
if ( ip ) if ( ip )
appendOutputBuffer (ip); appendOutputBuffer (FTermControl{ip});
appendOutputBuffer (ei); appendOutputBuffer (FTermControl{ei});
} }
else if ( ic ) else if ( ic )
{ {
appendOutputBuffer (ic); appendOutputBuffer (FTermControl{ic});
appendChar (second_last); appendChar (second_last);
if ( ip ) if ( ip )
appendOutputBuffer (ip); appendOutputBuffer (FTermControl{ip});
} }
} }
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::characterFilter (FChar& next_char) inline void FVTerm::characterFilter (FChar& next_char) const
{ {
charSubstitution& sub_map = fterm->getCharSubstitutionMap(); charSubstitution& sub_map = fterm->getCharSubstitutionMap();
@ -3092,22 +3097,50 @@ inline void FVTerm::characterFilter (FChar& next_char)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::appendOutputBuffer (const std::string& str) inline bool FVTerm::isOutputBufferLimitReached() const
{ {
for (auto&& ch : str) return output_buffer->size() >= TERMINAL_OUTPUT_BUFFER_LIMIT;
FVTerm::appendOutputBuffer(int(ch));
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FVTerm::appendOutputBuffer (int ch) inline void FVTerm::appendOutputBuffer (const FTermControl& ctrl) const
{ {
// append method for unicode character const auto& wstring = std::wstring{ctrl.string.begin(), ctrl.string.end()};
output_buffer->push_back(ch); output_buffer->emplace(std::make_tuple(OutputType::Control, wstring));
if ( output_buffer->size() >= TERMINAL_OUTPUT_BUFFER_SIZE ) if ( isOutputBufferLimitReached() )
flush(); flush();
}
return ch; //----------------------------------------------------------------------
inline void FVTerm::appendOutputBuffer (const FTermChar& c) const
{
if ( c.ch != L'\0' )
appendOutputBuffer(FTermString{std::wstring(1, c.ch)});
}
//----------------------------------------------------------------------
void FVTerm::appendOutputBuffer (const FTermString& str) const
{
if ( ! output_buffer->empty()
&& std::get<0>(output_buffer->back()) == OutputType::String )
{
// Append string data to the back element
auto& string_buf = std::get<1>(output_buffer->back());
std::transform ( str.string.begin()
, str.string.end()
, std::back_inserter(string_buf)
, [] (wchar_t ch)
{
return ch;
}
);
}
else
output_buffer->emplace(std::make_tuple(OutputType::String, str.string));
if ( isOutputBufferLimitReached() )
flush();
} }
} // namespace finalcut } // namespace finalcut

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2012-2020 Markus Gans * * Copyright 2012-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -89,27 +89,20 @@ class FButton : public FWidget
void setInactiveForegroundColor (FColor); void setInactiveForegroundColor (FColor);
void setInactiveBackgroundColor (FColor); void setInactiveBackgroundColor (FColor);
void resetColors() override; void resetColors() override;
bool setNoUnderline(bool); bool setNoUnderline (bool = true);
bool setNoUnderline();
bool unsetNoUnderline(); bool unsetNoUnderline();
bool setEnable(bool) override; bool setEnable (bool = true) override;
bool setEnable() override;
bool unsetEnable() override; bool unsetEnable() override;
bool setDisable() override; bool setDisable() override;
bool setFocus(bool) override; bool setFocus (bool = true) override;
bool setFocus() override;
bool unsetFocus() override; bool unsetFocus() override;
bool setFlat(bool); bool setFlat (bool = true);
bool setFlat();
bool unsetFlat(); bool unsetFlat();
bool setShadow(bool); bool setShadow (bool = true);
bool setShadow();
bool unsetShadow(); bool unsetShadow();
bool setDown(bool); bool setDown (bool = true);
bool setDown();
bool setUp(); bool setUp();
bool setClickAnimation(bool); bool setClickAnimation (bool = true);
bool setClickAnimation();
bool unsetClickAnimation(); bool unsetClickAnimation();
void setText (const FString&); void setText (const FString&);
@ -181,18 +174,10 @@ inline FString FButton::getClassName() const
inline FString FButton::getText() const inline FString FButton::getText() const
{ return text; } { return text; }
//----------------------------------------------------------------------
inline bool FButton::setNoUnderline()
{ return setNoUnderline(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FButton::unsetNoUnderline() inline bool FButton::unsetNoUnderline()
{ return setNoUnderline(false); } { return setNoUnderline(false); }
//----------------------------------------------------------------------
inline bool FButton::setEnable()
{ return setEnable(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FButton::unsetEnable() inline bool FButton::unsetEnable()
{ return setEnable(false); } { return setEnable(false); }
@ -201,34 +186,18 @@ inline bool FButton::unsetEnable()
inline bool FButton::setDisable() inline bool FButton::setDisable()
{ return setEnable(false); } { return setEnable(false); }
//----------------------------------------------------------------------
inline bool FButton::setFocus()
{ return setFocus(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FButton::unsetFocus() inline bool FButton::unsetFocus()
{ return setFocus(false); } { return setFocus(false); }
//----------------------------------------------------------------------
inline bool FButton::setFlat()
{ return setFlat(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FButton::unsetFlat() inline bool FButton::unsetFlat()
{ return setFlat(false); } { return setFlat(false); }
//----------------------------------------------------------------------
inline bool FButton::setShadow()
{ return setShadow(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FButton::unsetShadow() inline bool FButton::unsetShadow()
{ return setShadow(false); } { return setShadow(false); }
//----------------------------------------------------------------------
inline bool FButton::setDown()
{ return setDown(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FButton::setUp() inline bool FButton::setUp()
{ return setDown(false); } { return setDown(false); }
@ -237,10 +206,6 @@ inline bool FButton::setUp()
inline bool FButton::setClickAnimation(bool enable) inline bool FButton::setClickAnimation(bool enable)
{ return (click_animation = enable); } { return (click_animation = enable); }
//----------------------------------------------------------------------
inline bool FButton::setClickAnimation()
{ return setClickAnimation(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FButton::unsetClickAnimation() inline bool FButton::unsetClickAnimation()
{ return setClickAnimation(false); } { return setClickAnimation(false); }

View File

@ -4,7 +4,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2014-2020 Markus Gans * * Copyright 2014-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -86,8 +86,7 @@ class FButtonGroup : public FScrollView
FString& getText(); FString& getText();
// Mutator // Mutator
bool setEnable(bool) override; bool setEnable (bool = true) override;
bool setEnable() override;
bool unsetEnable() override; bool unsetEnable() override;
bool setDisable() override; bool setDisable() override;
void setText (const FString&); void setText (const FString&);
@ -146,10 +145,6 @@ class FButtonGroup : public FScrollView
inline FString FButtonGroup::getClassName() const inline FString FButtonGroup::getClassName() const
{ return "FButtonGroup"; } { return "FButtonGroup"; }
//----------------------------------------------------------------------
inline bool FButtonGroup::setEnable()
{ return setEnable(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FButtonGroup::unsetEnable() inline bool FButtonGroup::unsetEnable()
{ return setEnable(false); } { return setEnable(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2019-2020 Markus Gans * * Copyright 2019-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -162,18 +162,14 @@ class FComboBox : public FWidget
void setSize (const FSize&, bool = true) override; void setSize (const FSize&, bool = true) override;
void setGeometry ( const FPoint&, const FSize& void setGeometry ( const FPoint&, const FSize&
, bool = true ) override; , bool = true ) override;
bool setEnable (bool) override; bool setEnable (bool = true) override;
bool setEnable() override;
bool unsetEnable() override; bool unsetEnable() override;
bool setDisable() override; bool setDisable() override;
bool setFocus (bool) override; bool setFocus (bool = true) override;
bool setFocus() override;
bool unsetFocus() override; bool unsetFocus() override;
bool setShadow (bool); bool setShadow (bool = true);
bool setShadow();
bool unsetShadow(); bool unsetShadow();
bool setEditable (bool); bool setEditable (bool = true);
bool setEditable();
bool unsetEditable(); bool unsetEditable();
void setCurrentItem (std::size_t); void setCurrentItem (std::size_t);
void setMaxVisibleItems (std::size_t); void setMaxVisibleItems (std::size_t);
@ -265,10 +261,6 @@ inline clean_fdata_t<DT>& FComboBox::getItemData()
inline FLineEdit::LabelOrientation FComboBox::getLabelOrientation() const inline FLineEdit::LabelOrientation FComboBox::getLabelOrientation() const
{ return input_field.getLabelOrientation(); } { return input_field.getLabelOrientation(); }
//----------------------------------------------------------------------
inline bool FComboBox::setEnable()
{ return setEnable(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FComboBox::unsetEnable() inline bool FComboBox::unsetEnable()
{ return setEnable(false); } { return setEnable(false); }
@ -277,26 +269,14 @@ inline bool FComboBox::unsetEnable()
inline bool FComboBox::setDisable() inline bool FComboBox::setDisable()
{ return setEnable(false); } { return setEnable(false); }
//----------------------------------------------------------------------
inline bool FComboBox::setFocus()
{ return setFocus(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FComboBox::unsetFocus() inline bool FComboBox::unsetFocus()
{ return setFocus(false); } { return setFocus(false); }
//----------------------------------------------------------------------
inline bool FComboBox::setShadow()
{ return setShadow(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FComboBox::unsetShadow() inline bool FComboBox::unsetShadow()
{ return setShadow(false); } { return setShadow(false); }
//----------------------------------------------------------------------
inline bool FComboBox::setEditable()
{ return setEditable(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FComboBox::unsetEditable() inline bool FComboBox::unsetEditable()
{ return setEditable(false); } { return setEditable(false); }

View File

@ -97,18 +97,14 @@ class FDialog : public FWindow
virtual FString getText() const; virtual FString getText() const;
// Mutators // Mutators
bool setDialogWidget (bool); bool setDialogWidget (bool = true);
bool setDialogWidget();
bool unsetDialogWidget(); bool unsetDialogWidget();
bool setModal (bool); bool setModal (bool = true);
bool setModal();
bool unsetModal(); bool unsetModal();
bool setResizeable (bool) override; bool setResizeable (bool = true) override;
bool setScrollable (bool); bool setScrollable (bool = true);
bool setScrollable();
bool unsetScrollable(); bool unsetScrollable();
bool setBorder (bool); bool setBorder (bool = true);
bool setBorder();
bool unsetBorder(); bool unsetBorder();
void resetColors() override; void resetColors() override;
virtual void setText (const FString&); virtual void setText (const FString&);
@ -252,34 +248,18 @@ inline FString FDialog::getClassName() const
inline FString FDialog::getText() const inline FString FDialog::getText() const
{ return tb_text; } { return tb_text; }
//----------------------------------------------------------------------
inline bool FDialog::setDialogWidget()
{ return setDialogWidget(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FDialog::unsetDialogWidget() inline bool FDialog::unsetDialogWidget()
{ return setDialogWidget(false); } { return setDialogWidget(false); }
//----------------------------------------------------------------------
inline bool FDialog::setModal()
{ return setModal(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FDialog::unsetModal() inline bool FDialog::unsetModal()
{ return setModal(false); } { return setModal(false); }
//----------------------------------------------------------------------
inline bool FDialog::setScrollable()
{ return setScrollable(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FDialog::unsetScrollable() inline bool FDialog::unsetScrollable()
{ return setScrollable(false); } { return setScrollable(false); }
//----------------------------------------------------------------------
inline bool FDialog::setBorder()
{ return setBorder(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FDialog::unsetBorder() inline bool FDialog::unsetBorder()
{ return setBorder(false); } { return setBorder(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2014-2020 Markus Gans * * Copyright 2014-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -121,8 +121,7 @@ class FFileDialog : public FDialog
// Mutators // Mutators
void setPath (const FString&); void setPath (const FString&);
void setFilter (const FString&); void setFilter (const FString&);
bool setShowHiddenFiles(bool); bool setShowHiddenFiles (bool = true);
bool setShowHiddenFiles();
bool unsetShowHiddenFiles(); bool unsetShowHiddenFiles();
// Event handler // Event handler
@ -249,10 +248,6 @@ inline FString FFileDialog::getPath() const
inline FString FFileDialog::getFilter() const inline FString FFileDialog::getFilter() const
{ return filter_pattern; } { return filter_pattern; }
//----------------------------------------------------------------------
inline bool FFileDialog::setShowHiddenFiles()
{ return setShowHiddenFiles(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FFileDialog::unsetShowHiddenFiles() inline bool FFileDialog::unsetShowHiddenFiles()
{ return setShowHiddenFiles(false); } { return setShowHiddenFiles(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2018-2020 Markus Gans * * Copyright 2018-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -118,9 +118,8 @@ class FKeyboard final
void setTermcapMap(); void setTermcapMap();
static void setKeypressTimeout (const uInt64); static void setKeypressTimeout (const uInt64);
static void setReadBlockingTime (const uInt64); static void setReadBlockingTime (const uInt64);
static void setNonBlockingInputSupport (bool); static void setNonBlockingInputSupport (bool = true);
bool setNonBlockingInput (bool); bool setNonBlockingInput (bool = true);
bool setNonBlockingInput();
bool unsetNonBlockingInput(); bool unsetNonBlockingInput();
void enableUTF8(); void enableUTF8();
void disableUTF8(); void disableUTF8();
@ -250,10 +249,6 @@ inline void FKeyboard::setReadBlockingTime (const uInt64 blocking_time)
inline void FKeyboard::setNonBlockingInputSupport (bool enable) inline void FKeyboard::setNonBlockingInputSupport (bool enable)
{ non_blocking_input_support = enable; } { non_blocking_input_support = enable; }
//----------------------------------------------------------------------
inline bool FKeyboard::setNonBlockingInput()
{ return setNonBlockingInput(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FKeyboard::unsetNonBlockingInput() inline bool FKeyboard::unsetNonBlockingInput()
{ return setNonBlockingInput(false); } { return setNonBlockingInput(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2014-2020 Markus Gans * * Copyright 2014-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -95,14 +95,12 @@ class FLabel : public FWidget
// Mutators // Mutators
void setAccelWidget (FWidget* = nullptr); void setAccelWidget (FWidget* = nullptr);
void setAlignment (Align); void setAlignment (Align);
bool setEmphasis (bool); bool setEmphasis (bool = true);
bool setEmphasis();
bool unsetEmphasis(); bool unsetEmphasis();
void resetColors() override; void resetColors() override;
bool setReverseMode (bool); bool setReverseMode (bool = true);
bool setReverseMode();
bool unsetReverseMode(); bool unsetReverseMode();
bool setEnable (bool) override; bool setEnable (bool = true) override;
void setNumber (uLong); void setNumber (uLong);
void setNumber (long); void setNumber (long);
void setNumber (float, int = FLT_DIG); void setNumber (float, int = FLT_DIG);
@ -184,10 +182,6 @@ inline FString& FLabel::getText()
inline bool FLabel::setEmphasis (bool enable) inline bool FLabel::setEmphasis (bool enable)
{ return (emphasis = enable); } { return (emphasis = enable); }
//----------------------------------------------------------------------
inline bool FLabel::setEmphasis()
{ return setEmphasis(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FLabel::unsetEmphasis() inline bool FLabel::unsetEmphasis()
{ return setEmphasis(false); } { return setEmphasis(false); }
@ -196,10 +190,6 @@ inline bool FLabel::unsetEmphasis()
inline bool FLabel::setReverseMode (bool enable) inline bool FLabel::setReverseMode (bool enable)
{ return (reverse_mode = enable); } { return (reverse_mode = enable); }
//----------------------------------------------------------------------
inline bool FLabel::setReverseMode()
{ return setReverseMode(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FLabel::unsetReverseMode() inline bool FLabel::unsetReverseMode()
{ return setReverseMode(false); } { return setReverseMode(false); }

View File

@ -125,18 +125,14 @@ class FLineEdit : public FWidget
void setSize (const FSize&, bool = true) override; void setSize (const FSize&, bool = true) override;
void setGeometry ( const FPoint&, const FSize& void setGeometry ( const FPoint&, const FSize&
, bool = true ) override; , bool = true ) override;
bool setEnable (bool) override; bool setEnable (bool = true) override;
bool setEnable() override;
bool unsetEnable() override; bool unsetEnable() override;
bool setDisable() override; bool setDisable() override;
bool setFocus (bool) override; bool setFocus (bool = true) override;
bool setFocus() override;
bool unsetFocus() override; bool unsetFocus() override;
bool setShadow (bool); bool setShadow (bool = true);
bool setShadow();
bool unsetShadow(); bool unsetShadow();
bool setReadOnly (bool); bool setReadOnly (bool = true);
bool setReadOnly();
bool unsetReadOnly(); bool unsetReadOnly();
// Inquiry // Inquiry
@ -273,10 +269,6 @@ inline void FLineEdit::setInputType (const InputType type)
inline void FLineEdit::setLabelAssociatedWidget (FWidget* w) inline void FLineEdit::setLabelAssociatedWidget (FWidget* w)
{ label_associated_widget = w; } { label_associated_widget = w; }
//----------------------------------------------------------------------
inline bool FLineEdit::setEnable()
{ return setEnable(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FLineEdit::unsetEnable() inline bool FLineEdit::unsetEnable()
{ return setEnable(false); } { return setEnable(false); }
@ -285,26 +277,14 @@ inline bool FLineEdit::unsetEnable()
inline bool FLineEdit::setDisable() inline bool FLineEdit::setDisable()
{ return setEnable(false); } { return setEnable(false); }
//----------------------------------------------------------------------
inline bool FLineEdit::setFocus()
{ return setFocus(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FLineEdit::unsetFocus() inline bool FLineEdit::unsetFocus()
{ return setFocus(false); } { return setFocus(false); }
//----------------------------------------------------------------------
inline bool FLineEdit::setShadow()
{ return setShadow(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FLineEdit::unsetShadow() inline bool FLineEdit::unsetShadow()
{ return setShadow(false); } { return setShadow(false); }
//----------------------------------------------------------------------
inline bool FLineEdit::setReadOnly()
{ return setReadOnly(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FLineEdit::unsetReadOnly() inline bool FLineEdit::unsetReadOnly()
{ return setReadOnly(true); } { return setReadOnly(true); }

View File

@ -214,8 +214,7 @@ class FListBox : public FWidget
void setSize (const FSize&, bool = true) override; void setSize (const FSize&, bool = true) override;
void setGeometry ( const FPoint&, const FSize& void setGeometry ( const FPoint&, const FSize&
, bool = true ) override; , bool = true ) override;
void setMultiSelection (bool); void setMultiSelection (bool = true);
void setMultiSelection ();
void unsetMultiSelection (); void unsetMultiSelection ();
bool setDisable() override; bool setDisable() override;
void setText (const FString&); void setText (const FString&);
@ -501,10 +500,6 @@ inline void FListBox::showNoBrackets (FListBoxItems::iterator iter) const
inline void FListBox::setMultiSelection (bool enable) inline void FListBox::setMultiSelection (bool enable)
{ multi_select = enable; } { multi_select = enable; }
//----------------------------------------------------------------------
inline void FListBox::setMultiSelection()
{ setMultiSelection(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FListBox::unsetMultiSelection() inline void FListBox::unsetMultiSelection()
{ setMultiSelection(false); } { setMultiSelection(false); }

View File

@ -101,8 +101,8 @@ class FListViewItem : public FObject
void setText (int, const FString&); void setText (int, const FString&);
template <typename DT> template <typename DT>
void setData (DT&&); void setData (DT&&);
void setCheckable (bool); void setCheckable (bool = true);
void setChecked (bool); void setChecked (bool = true);
// Inquiry // Inquiry
bool isChecked() const; bool isChecked() const;
@ -335,9 +335,8 @@ class FListView : public FWidget
void setUserAscendingCompare (Compare); void setUserAscendingCompare (Compare);
template <typename Compare> template <typename Compare>
void setUserDescendingCompare (Compare); void setUserDescendingCompare (Compare);
void hideSortIndicator (bool); void hideSortIndicator (bool = true);
bool setTreeView (bool); bool setTreeView (bool = true);
bool setTreeView();
bool unsetTreeView(); bool unsetTreeView();
// Methods // Methods
@ -585,10 +584,6 @@ inline void FListView::hideSortIndicator (bool hide)
inline bool FListView::setTreeView (bool enable) inline bool FListView::setTreeView (bool enable)
{ return (tree_view = enable); } { return (tree_view = enable); }
//----------------------------------------------------------------------
inline bool FListView::setTreeView()
{ return setTreeView(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FListView::unsetTreeView() inline bool FListView::unsetTreeView()
{ return setTreeView(false); } { return setTreeView(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2015-2020 Markus Gans * * Copyright 2015-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -96,14 +96,12 @@ class FMenu : public FWindow, public FMenuList
FMenuItem* getItem(); FMenuItem* getItem();
// Mutators // Mutators
bool setEnable (bool) override; bool setEnable (bool = true) override;
bool setEnable() override;
bool unsetEnable() override; bool unsetEnable() override;
bool setDisable() override; bool setDisable() override;
void setSelected(); void setSelected();
void unsetSelected(); void unsetSelected();
bool setMenuWidget (bool); bool setMenuWidget (bool = true);
bool setMenuWidget();
bool unsetMenuWidget(); bool unsetMenuWidget();
void setStatusbarMessage (const FString&) override; void setStatusbarMessage (const FString&) override;
void setMenu (FMenu*); void setMenu (FMenu*);
@ -262,10 +260,6 @@ inline FMenuItem* FMenu::getItem()
inline bool FMenu::setEnable (bool enable) inline bool FMenu::setEnable (bool enable)
{ return menuitem.setEnable(enable); } { return menuitem.setEnable(enable); }
//----------------------------------------------------------------------
inline bool FMenu::setEnable()
{ return menuitem.setEnable(); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FMenu::unsetEnable() inline bool FMenu::unsetEnable()
{ return menuitem.unsetEnable(); } { return menuitem.unsetEnable(); }
@ -282,10 +276,6 @@ inline void FMenu::setSelected()
inline void FMenu::unsetSelected() inline void FMenu::unsetSelected()
{ menuitem.unsetSelected(); } { menuitem.unsetSelected(); }
//----------------------------------------------------------------------
inline bool FMenu::setMenuWidget()
{ return setMenuWidget(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FMenu::unsetMenuWidget() inline bool FMenu::unsetMenuWidget()
{ return setMenuWidget(false); } { return setMenuWidget(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2015-2020 Markus Gans * * Copyright 2015-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -96,9 +96,8 @@ class FMenuItem : public FWidget
FString getText() const; FString getText() const;
// Mutators // Mutators
bool setEnable (bool) override; bool setEnable (bool = true) override;
bool setFocus (bool) override; bool setFocus (bool = true) override;
bool setFocus() override;
bool unsetFocus() override; bool unsetFocus() override;
void setSelected(); void setSelected();
void unsetSelected(); void unsetSelected();
@ -219,10 +218,6 @@ inline std::size_t FMenuItem::getTextWidth() const
inline FString FMenuItem::getText() const inline FString FMenuItem::getText() const
{ return text; } { return text; }
//----------------------------------------------------------------------
inline bool FMenuItem::setFocus()
{ return setFocus(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FMenuItem::unsetFocus() inline bool FMenuItem::unsetFocus()
{ return setFocus(false); } { return setFocus(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2014-2020 Markus Gans * * Copyright 2014-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -117,8 +117,7 @@ class FMessageBox : public FDialog
// Mutator // Mutator
void setTitlebarText (const FString&); void setTitlebarText (const FString&);
void setHeadline (const FString&); void setHeadline (const FString&);
bool setCenterText(bool); bool setCenterText (bool = true);
bool setCenterText();
bool unsetCenterText(); bool unsetCenterText();
void setText (const FString&) override; void setText (const FString&) override;
@ -206,10 +205,6 @@ inline void FMessageBox::setTitlebarText (const FString& txt)
inline bool FMessageBox::setCenterText(bool enable) inline bool FMessageBox::setCenterText(bool enable)
{ return (center_text = enable); } { return (center_text = enable); }
//----------------------------------------------------------------------
inline bool FMessageBox::setCenterText()
{ return setCenterText(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FMessageBox::unsetCenterText() inline bool FMessageBox::unsetCenterText()
{ return setCenterText(false); } { return setCenterText(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2018-2020 Markus Gans * * Copyright 2018-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -213,7 +213,7 @@ class FMouse : public FMouseData
// Mutator // Mutator
void setNewPos (int, int); void setNewPos (int, int);
void setPending (bool); void setPending (bool = true);
void setEvent(); void setEvent();
void setMousePressedTime (const timeval*); void setMousePressedTime (const timeval*);
void resetMousePressedTime(); void resetMousePressedTime();
@ -264,13 +264,13 @@ class FMouseGPM final : public FMouse
// Methods // Methods
void setRawData (FKeyboard::keybuffer&) override; void setRawData (FKeyboard::keybuffer&) override;
void processEvent (struct timeval*) override; void processEvent (struct timeval*) override;
bool gpmMouse (bool); bool gpmMouse (bool = true);
bool enableGpmMouse(); bool enableGpmMouse();
bool disableGpmMouse(); bool disableGpmMouse();
bool hasSignificantEvents() const; bool hasSignificantEvents() const;
void interpretKeyDown(); void interpretKeyDown();
void interpretKeyUp(); void interpretKeyUp();
bool getGpmKeyPressed(bool); bool getGpmKeyPressed (bool = true);
void drawPointer() const; void drawPointer() const;
private: private:
@ -545,7 +545,7 @@ class FMouseControl
, FKeyboard::keybuffer& ); , FKeyboard::keybuffer& );
virtual void processEvent (struct timeval* time); virtual void processEvent (struct timeval* time);
void processQueuedInput(); void processQueuedInput();
bool getGpmKeyPressed (bool); bool getGpmKeyPressed (bool = true);
void drawPointer(); void drawPointer();
private: private:
@ -557,7 +557,7 @@ class FMouseControl
// Accessor // Accessor
FMouse::MouseType getMouseWithData(); FMouse::MouseType getMouseWithData();
FMouse::MouseType getMouseWithEvent(); FMouse::MouseType getMouseWithEvent();
void xtermMouse (bool) const; void xtermMouse (bool = true) const;
void enableXTermMouse() const; void enableXTermMouse() const;
void disableXTermMouse() const; void disableXTermMouse() const;

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2015-2020 Markus Gans * * Copyright 2015-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -158,7 +158,7 @@ class FObject
FTimerList* getTimerList() const; FTimerList* getTimerList() const;
// Mutator // Mutator
void setWidgetProperty (bool); void setWidgetProperty (bool = true);
// Method // Method
uInt processTimerEvent(); uInt processTimerEvent();

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2015-2020 Markus Gans * * Copyright 2015-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -138,8 +138,8 @@ class FOptiMove final
void set_repeat_char (const char[]); void set_repeat_char (const char[]);
void set_clr_bol (const char[]); void set_clr_bol (const char[]);
void set_clr_eol (const char[]); void set_clr_eol (const char[]);
void set_auto_left_margin (bool); void set_auto_left_margin (bool = true);
void set_eat_newline_glitch (bool); void set_eat_newline_glitch (bool = true);
// Methods // Methods
void check_boundaries (int&, int&, int&, int&) const; void check_boundaries (int&, int&, int&, int&) const;

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2014-2020 Markus Gans * * Copyright 2014-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -77,8 +77,7 @@ class FProgressbar : public FWidget
void setSize (const FSize&, bool = true) override; void setSize (const FSize&, bool = true) override;
void setGeometry ( const FPoint&, const FSize& void setGeometry ( const FPoint&, const FSize&
, bool = true ) override; , bool = true ) override;
bool setShadow (bool); bool setShadow (bool = true);
bool setShadow();
bool unsetShadow(); bool unsetShadow();
// Inquiries // Inquiries
@ -115,10 +114,6 @@ inline FString FProgressbar::getClassName() const
inline std::size_t FProgressbar::getPercentage() const inline std::size_t FProgressbar::getPercentage() const
{ return percentage; } { return percentage; }
//----------------------------------------------------------------------
inline bool FProgressbar::setShadow()
{ return setShadow(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FProgressbar::unsetShadow() inline bool FProgressbar::unsetShadow()
{ return setShadow(false); } { return setShadow(false); }

View File

@ -105,12 +105,10 @@ class FScrollView : public FWidget
, bool = true ) override; , bool = true ) override;
bool setCursorPos (const FPoint&) override; bool setCursorPos (const FPoint&) override;
void setPrintPos (const FPoint&) override; void setPrintPos (const FPoint&) override;
bool setViewportPrint (bool); bool setViewportPrint (bool = true);
bool setViewportPrint();
bool unsetViewportPrint(); bool unsetViewportPrint();
void resetColors() override; void resetColors() override;
bool setBorder (bool); bool setBorder (bool = true);
bool setBorder();
bool unsetBorder(); bool unsetBorder();
void setHorizontalScrollBarMode (ScrollBarMode); void setHorizontalScrollBarMode (ScrollBarMode);
void setVerticalScrollBarMode (ScrollBarMode); void setVerticalScrollBarMode (ScrollBarMode);
@ -230,18 +228,10 @@ inline int FScrollView::getScrollX() const
inline int FScrollView::getScrollY() const inline int FScrollView::getScrollY() const
{ return viewport_geometry.getY(); } { return viewport_geometry.getY(); }
//----------------------------------------------------------------------
inline bool FScrollView::setViewportPrint()
{ return setViewportPrint(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FScrollView::unsetViewportPrint() inline bool FScrollView::unsetViewportPrint()
{ return setViewportPrint(false); } { return setViewportPrint(false); }
//----------------------------------------------------------------------
inline bool FScrollView::setBorder()
{ return setBorder(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FScrollView::unsetBorder() inline bool FScrollView::unsetBorder()
{ return setBorder(false); } { return setBorder(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2019-2020 Markus Gans * * Copyright 2019-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -91,15 +91,12 @@ class FSpinBox : public FWidget
void setSize (const FSize&, bool = true) override; void setSize (const FSize&, bool = true) override;
void setGeometry ( const FPoint&, const FSize& void setGeometry ( const FPoint&, const FSize&
, bool = true ) override; , bool = true ) override;
bool setEnable (bool) override; bool setEnable (bool = true) override;
bool setEnable() override;
bool unsetEnable() override; bool unsetEnable() override;
bool setDisable() override; bool setDisable() override;
bool setFocus (bool) override; bool setFocus (bool = true) override;
bool setFocus() override;
bool unsetFocus() override; bool unsetFocus() override;
bool setShadow (bool); bool setShadow (bool = true);
bool setShadow();
bool unsetShadow(); bool unsetShadow();
void setValue (sInt64); void setValue (sInt64);
void setMinValue (sInt64); void setMinValue (sInt64);
@ -181,10 +178,6 @@ inline FString FSpinBox::getSuffix() const
inline FLineEdit::LabelOrientation FSpinBox::getLabelOrientation() const inline FLineEdit::LabelOrientation FSpinBox::getLabelOrientation() const
{ return input_field.getLabelOrientation(); } { return input_field.getLabelOrientation(); }
//----------------------------------------------------------------------
inline bool FSpinBox::setEnable()
{ return setEnable(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FSpinBox::unsetEnable() inline bool FSpinBox::unsetEnable()
{ return setEnable(false); } { return setEnable(false); }
@ -193,18 +186,10 @@ inline bool FSpinBox::unsetEnable()
inline bool FSpinBox::setDisable() inline bool FSpinBox::setDisable()
{ return setEnable(false); } { return setEnable(false); }
//----------------------------------------------------------------------
inline bool FSpinBox::setFocus()
{ return setFocus(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FSpinBox::unsetFocus() inline bool FSpinBox::unsetFocus()
{ return setFocus(false); } { return setFocus(false); }
//----------------------------------------------------------------------
inline bool FSpinBox::setShadow()
{ return setShadow(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FSpinBox::unsetShadow() inline bool FSpinBox::unsetShadow()
{ return setShadow(false); } { return setShadow(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2014-2020 Markus Gans * * Copyright 2014-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -96,8 +96,7 @@ class FStatusKey : public FWidget
void setText (const FString&); void setText (const FString&);
void setActive(); void setActive();
void unsetActive(); void unsetActive();
bool setMouseFocus(bool); bool setMouseFocus (bool = true);
bool setMouseFocus();
bool unsetMouseFocus(); bool unsetMouseFocus();
// Inquiry // Inquiry
@ -151,10 +150,6 @@ inline void FStatusKey::setText (const FString& txt)
inline void FStatusKey::unsetActive() inline void FStatusKey::unsetActive()
{ active = false; } { active = false; }
//----------------------------------------------------------------------
inline bool FStatusKey::setMouseFocus()
{ return setMouseFocus(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FStatusKey::unsetMouseFocus() inline bool FStatusKey::unsetMouseFocus()
{ return setMouseFocus(false); } { return setMouseFocus(false); }

View File

@ -184,8 +184,8 @@ class FTerm final
static FString getKeyName (FKey); static FString getKeyName (FKey);
charSubstitution& getCharSubstitutionMap(); charSubstitution& getCharSubstitutionMap();
static int getTTYFileDescriptor(); static int getTTYFileDescriptor();
static const char* getTermType(); static std::string getTermType();
static const char* getTermFileName(); static std::string getTermFileName();
static int getTabstop(); static int getTabstop();
static int getMaxColor(); static int getMaxColor();
static auto getColorPaletteTheme() -> std::shared_ptr<FColorPalette>&; static auto getColorPaletteTheme() -> std::shared_ptr<FColorPalette>&;
@ -252,15 +252,13 @@ class FTerm final
// Mutators // Mutators
static void setFSystem (std::unique_ptr<FSystem>&); static void setFSystem (std::unique_ptr<FSystem>&);
static void setTermType (const char[]); static void setTermType (const std::string&);
static void setInsertCursor (bool); static void setInsertCursor (bool = true);
static void setInsertCursor();
static void unsetInsertCursor(); static void unsetInsertCursor();
static void redefineDefaultColors (bool); static void redefineDefaultColors (bool = true);
static void setDblclickInterval (const uInt64); static void setDblclickInterval (const uInt64);
static void useAlternateScreen (bool); static void useAlternateScreen (bool = true);
static bool setUTF8 (bool); static bool setUTF8 (bool = true);
static bool setUTF8();
static bool unsetUTF8(); static bool unsetUTF8();
// Methods // Methods
@ -270,7 +268,7 @@ class FTerm final
static int openConsole(); static int openConsole();
static int closeConsole(); static int closeConsole();
static const char* moveCursorString (int, int, int, int); static const char* moveCursorString (int, int, int, int);
static const char* cursorsVisibilityString (bool); static const char* cursorsVisibilityString (bool = true);
static void detectTermSize(); static void detectTermSize();
static void setTermSize (const FSize&); static void setTermSize (const FSize&);
static void setTermTitle (const FString&); static void setTermTitle (const FString&);
@ -296,8 +294,8 @@ class FTerm final
static defaultPutChar& putchar(); // function pointer static defaultPutChar& putchar(); // function pointer
template <typename... Args> template <typename... Args>
static void putstringf (const char[], Args&&...); static void putstringf (const std::string&, Args&&...);
static void putstring (const char[], int = 1); static void putstring (const std::string&, int = 1);
static int putchar_ASCII (int); static int putchar_ASCII (int);
static int putchar_UTF8 (int); static int putchar_UTF8 (int);
@ -409,18 +407,10 @@ inline void FTerm::setFSystem (std::unique_ptr<FSystem>& fsystem)
getFSystem().swap(fsystem); getFSystem().swap(fsystem);
} }
//----------------------------------------------------------------------
inline void FTerm::setInsertCursor()
{ return setInsertCursor(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTerm::unsetInsertCursor() inline void FTerm::unsetInsertCursor()
{ return setInsertCursor(false); } { return setInsertCursor(false); }
//----------------------------------------------------------------------
inline bool FTerm::setUTF8()
{ return setUTF8(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FTerm::unsetUTF8() inline bool FTerm::unsetUTF8()
{ return setUTF8(false); } { return setUTF8(false); }
@ -435,18 +425,17 @@ inline void FTerm::setColorPaletteTheme (const FSetPalette& f)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
template <typename... Args> template <typename... Args>
inline void FTerm::putstringf (const char format[], Args&&... args) inline void FTerm::putstringf (const std::string& format, Args&&... args)
{ {
const int size = std::snprintf (nullptr, 0, format, args...) + 1; const int size = std::snprintf (nullptr, 0, format.data(), args...) + 1;
if ( size == -1 ) if ( size == -1 )
return; return;
const auto count = std::size_t(size); const auto count = std::size_t(size);
std::vector<char> buf(count); std::vector<char> buf(count);
std::snprintf (&buf[0], count, format, std::forward<Args>(args)...); std::snprintf (&buf[0], count, format.data(), std::forward<Args>(args)...);
const auto& fsys = FTerm::getFSystem(); putstring (std::string(&buf[0]), 1);
fsys->tputs (&buf[0], 1, FTerm::putchar_ASCII);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2016-2020 Markus Gans * * Copyright 2016-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -60,8 +60,6 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "final/ftermcap.h"
// FTermcap string macro // FTermcap string macro
#define TCAP(...) FTermcap::strings[int(Termcap::__VA_ARGS__)].string #define TCAP(...) FTermcap::strings[int(Termcap::__VA_ARGS__)].string
@ -93,19 +91,13 @@ class FTermcap final
// Accessors // Accessors
FString getClassName() const; FString getClassName() const;
template <typename CharT> static bool getFlag (const std::string&);
static bool getFlag (const CharT&); static int getNumber (const std::string&);
template <typename CharT> static char* getString (const std::string&);
static int getNumber (const CharT&); static std::string encodeMotionParameter (const std::string&, int, int);
template <typename CharT> template <typename... Args>
static char* getString (const CharT&); static std::string encodeParameter (const std::string&, Args&&...);
template <typename CharT> static int paddingPrint (const std::string&, int, fn_putc);
static char* encodeMotionParameter (const CharT&, int, int);
template <typename CharT
, typename... Args>
static char* encodeParameter (const CharT&, Args&&...);
template <typename CharT>
static int paddingPrint (const CharT&, int, fn_putc);
// Inquiry // Inquiry
static bool isInitialized(); static bool isInitialized();
@ -154,46 +146,42 @@ inline FString FTermcap::getClassName() const
{ return "FTermcap"; } { return "FTermcap"; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
template <typename CharT> inline bool FTermcap::getFlag (const std::string& cap)
bool FTermcap::getFlag (const CharT& cap)
{ {
return ::tgetflag(C_STR(cap)); return ::tgetflag(C_STR(cap.data()));
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
template <typename CharT> inline int FTermcap::getNumber (const std::string& cap)
int FTermcap::getNumber (const CharT& cap)
{ {
return ::tgetnum(C_STR(cap)); return ::tgetnum(C_STR(cap.data()));
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
template <typename CharT> inline char* FTermcap::getString (const std::string& cap)
char* FTermcap::getString (const CharT& cap)
{ {
return ::tgetstr(C_STR(cap), reinterpret_cast<char**>(&string_buf)); return ::tgetstr(C_STR(cap.data()), reinterpret_cast<char**>(&string_buf));
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
template <typename CharT> inline std::string FTermcap::encodeMotionParameter (const std::string& cap, int col, int row)
char* FTermcap::encodeMotionParameter (const CharT& cap, int col, int row)
{ {
return ::tgoto(C_STR(cap), col, row); auto str = ::tgoto(C_STR(cap.data()), col, row);
return ( str ) ? str : std::string();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
template <typename CharT template <typename... Args>
, typename... Args> inline std::string FTermcap::encodeParameter (const std::string& cap, Args&&... args)
inline char* FTermcap::encodeParameter (const CharT& cap, Args&&... args)
{ {
return ::tparm (C_STR(cap), std::forward<Args>(args)...); auto str = ::tparm (C_STR(cap.data()), std::forward<Args>(args)...);
return ( str ) ? str : std::string();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
template <typename CharT> inline int FTermcap::paddingPrint (const std::string& str, int affcnt, fn_putc putc)
int FTermcap::paddingPrint (const CharT& str, int affcnt, fn_putc putc)
{ {
return _tputs (C_STR(str), affcnt, putc); return _tputs (C_STR(str.data()), affcnt, putc);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2018-2020 Markus Gans * * Copyright 2018-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -69,97 +69,97 @@ class FTermData final
FTermData& operator = (const FTermData&) = delete; FTermData& operator = (const FTermData&) = delete;
// Accessors // Accessors
FString getClassName() const; FString getClassName() const;
EncodingMap& getEncodingList(); EncodingMap& getEncodingList();
charSubstitution& getCharSubstitutionMap(); charSubstitution& getCharSubstitutionMap();
Encoding getTermEncoding() const; Encoding getTermEncoding() const;
FRect& getTermGeometry(); FRect& getTermGeometry();
int getTTYFileDescriptor() const; int getTTYFileDescriptor() const;
uInt getBaudrate() const; uInt getBaudrate() const;
const char* getTermType() const; const std::string& getTermType() const;
const char* getTermFileName() const; const std::string& getTermFileName() const;
const FString& getXtermFont() const; const FString& getXtermFont() const;
const FString& getXtermTitle() const; const FString& getXtermTitle() const;
const FString& getExitMessage() const; const FString& getExitMessage() const;
#if DEBUG #if DEBUG
int getFramebufferBpp() const; int getFramebufferBpp() const;
#endif #endif
// Inquiries // Inquiries
bool hasShadowCharacter() const; bool hasShadowCharacter() const;
bool hasHalfBlockCharacter() const; bool hasHalfBlockCharacter() const;
bool hasCursorOptimisation() const; bool hasCursorOptimisation() const;
bool isCursorHidden() const; bool isCursorHidden() const;
bool hasAlternateScreen() const; bool hasAlternateScreen() const;
bool isInAlternateScreen() const; bool isInAlternateScreen() const;
bool hasASCIIConsole() const; bool hasASCIIConsole() const;
bool hasVT100Console() const; bool hasVT100Console() const;
bool hasUTF8Console() const; bool hasUTF8Console() const;
bool isUTF8() const; bool isUTF8() const;
bool isNewFont() const; bool isNewFont() const;
bool isVGAFont() const; bool isVGAFont() const;
bool isMonochron() const; bool isMonochron() const;
bool hasTermResized() const; bool hasTermResized() const;
// Mutators // Mutators
void setTermEncoding (Encoding); void setTermEncoding (Encoding);
void setTTYFileDescriptor (int); void setTTYFileDescriptor (int);
void setBaudrate (uInt); void setBaudrate (uInt);
void supportShadowCharacter (bool); void supportShadowCharacter (bool = true);
void supportHalfBlockCharacter (bool); void supportHalfBlockCharacter (bool = true);
void supportCursorOptimisation (bool); void supportCursorOptimisation (bool = true);
void setCursorHidden (bool); void setCursorHidden (bool = true);
void useAlternateScreen (bool); void useAlternateScreen (bool = true);
void setAlternateScreenInUse (bool); void setAlternateScreenInUse (bool = true);
void setASCIIConsole (bool); void setASCIIConsole (bool = true);
void setVT100Console (bool); void setVT100Console (bool = true);
void setUTF8Console (bool); void setUTF8Console (bool = true);
void setUTF8 (bool); void setUTF8 (bool = true);
void setNewFont (bool); void setNewFont (bool = true);
void setVGAFont (bool); void setVGAFont (bool = true);
void setMonochron (bool); void setMonochron (bool = true);
void setTermResized (bool); void setTermResized (bool = true);
void setTermType (const char[]); void setTermType (const std::string&);
void setTermFileName (const char[]); void setTermFileName (const std::string&);
void setXtermFont (const FString&); void setXtermFont (const FString&);
void setXtermTitle (const FString&); void setXtermTitle (const FString&);
void setExitMessage (const FString&); void setExitMessage (const FString&);
#if DEBUG #if DEBUG
void setFramebufferBpp (int); void setFramebufferBpp (int);
#endif #endif
private: private:
// Data members // Data members
EncodingMap encoding_list{}; EncodingMap encoding_list{};
charSubstitution char_substitution_map{}; charSubstitution char_substitution_map{};
FRect term_geometry{}; // current terminal geometry FRect term_geometry{}; // current terminal geometry
FString xterm_font{}; FString xterm_font{};
FString xterm_title{}; FString xterm_title{};
FString exit_message{}; FString exit_message{};
Encoding term_encoding{Encoding::Unknown}; Encoding term_encoding{Encoding::Unknown};
int fd_tty{-1}; // Teletype (tty) file descriptor int fd_tty{-1}; // Teletype (tty) file descriptor
// is still undefined // is still undefined
#if DEBUG #if DEBUG
int framebuffer_bpp{-1}; int framebuffer_bpp{-1};
#endif #endif
uInt baudrate{0}; uInt baudrate{0};
char termtype[256]{'\0'}; std::string termtype{};
char termfilename[256]{'\0'}; std::string termfilename{};
bool shadow_character{true}; bool shadow_character{true};
bool half_block_character{true}; bool half_block_character{true};
bool cursor_optimisation{true}; bool cursor_optimisation{true};
bool hidden_cursor{false}; // Global cursor hidden state bool hidden_cursor{false}; // Global cursor hidden state
bool use_alternate_screen{true}; bool use_alternate_screen{true};
bool alternate_screen{false}; bool alternate_screen{false};
bool ascii_console{false}; bool ascii_console{false};
bool vt100_console{false}; bool vt100_console{false};
bool utf8_console{false}; bool utf8_console{false};
bool utf8_state{false}; bool utf8_state{false};
bool new_font{false}; bool new_font{false};
bool vga_font{false}; bool vga_font{false};
bool monochron{false}; bool monochron{false};
bool resize_term{false}; bool resize_term{false};
}; };
// FTermData inline functions // FTermData inline functions
@ -192,11 +192,11 @@ inline uInt FTermData::getBaudrate() const
{ return baudrate; } { return baudrate; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const char* FTermData::getTermType() const inline const std::string& FTermData::getTermType() const
{ return termtype; } { return termtype; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const char* FTermData::getTermFileName() const inline const std::string& FTermData::getTermFileName() const
{ return termfilename; } { return termfilename; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -342,23 +342,17 @@ inline void FTermData::setTermResized (bool resize)
{ resize_term = resize; } { resize_term = resize; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTermData::setTermType (const char name[]) inline void FTermData::setTermType (const std::string& name)
{ {
if ( ! name ) if ( ! name.empty() )
return; termtype = name;
std::strncpy (termtype, name, sizeof(termtype) - 1);
termtype[sizeof(termtype) - 1] = '\0';
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTermData::setTermFileName (const char file_name[]) inline void FTermData::setTermFileName (const std::string& file_name)
{ {
if ( ! file_name ) if ( ! file_name.empty() )
return; termfilename = file_name;
std::strncpy (termfilename, file_name, sizeof(termfilename) - 1);
termfilename[sizeof(termfilename) - 1] = '\0';
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2018-2020 Markus Gans * * Copyright 2018-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -130,27 +130,27 @@ class FTermDetection final
static bool hasSetCursorStyleSupport(); static bool hasSetCursorStyleSupport();
// Mutators // Mutators
static void setAnsiTerminal (bool); static void setAnsiTerminal (bool = true);
static void setXTerminal (bool); static void setXTerminal (bool = true);
static void setRxvtTerminal (bool); static void setRxvtTerminal (bool = true);
static void setUrxvtTerminal (bool); static void setUrxvtTerminal (bool = true);
static void setKdeTerminal (bool); static void setKdeTerminal (bool = true);
static void setGnomeTerminal (bool); static void setGnomeTerminal (bool = true);
static void setPuttyTerminal (bool); static void setPuttyTerminal (bool = true);
static void setWindowsTerminal (bool); static void setWindowsTerminal (bool = true);
static void setTeraTerm (bool); static void setTeraTerm (bool = true);
static void setCygwinTerminal (bool); static void setCygwinTerminal (bool = true);
static void setMinttyTerm (bool); static void setMinttyTerm (bool = true);
static void setLinuxTerm (bool); static void setLinuxTerm (bool = true);
static void setFreeBSDTerm (bool); static void setFreeBSDTerm (bool = true);
static void setNetBSDTerm (bool); static void setNetBSDTerm (bool = true);
static void setOpenBSDTerm (bool); static void setOpenBSDTerm (bool = true);
static void setSunTerminal (bool); static void setSunTerminal (bool = true);
static void setScreenTerm (bool); static void setScreenTerm (bool = true);
static void setTmuxTerm (bool); static void setTmuxTerm (bool = true);
static void setKtermTerminal (bool); static void setKtermTerminal (bool = true);
static void setMltermTerminal (bool); static void setMltermTerminal (bool = true);
static void setTerminalDetection (bool); static void setTerminalDetection (bool = true);
static void setTtyTypeFileName (const char[]); static void setTtyTypeFileName (const char[]);
// Methods // Methods

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2018-2020 Markus Gans * * Copyright 2018-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -76,8 +76,7 @@ class FTermios final
static void unsetHardwareEcho(); static void unsetHardwareEcho();
static void setCaptureSendCharacters(); static void setCaptureSendCharacters();
static void unsetCaptureSendCharacters(); static void unsetCaptureSendCharacters();
static bool setRawMode (bool); static bool setRawMode (bool = true);
static bool setRawMode();
static bool unsetRawMode(); static bool unsetRawMode();
static bool setCookedMode(); static bool setCookedMode();
static uInt getBaudRate(); static uInt getBaudRate();
@ -113,10 +112,6 @@ inline int FTermios::getStdErr()
inline bool FTermios::isRaw() inline bool FTermios::isRaw()
{ return raw_mode; } { return raw_mode; }
//----------------------------------------------------------------------
inline bool FTermios::setRawMode()
{ return setRawMode(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FTermios::unsetRawMode() inline bool FTermios::unsetRawMode()
{ return setRawMode(false); } { return setRawMode(false); }

View File

@ -99,7 +99,7 @@ class FTermLinux final
// Mutators // Mutators
bool setCursorStyle (CursorStyle); bool setCursorStyle (CursorStyle);
bool setPalette (FColor, int, int, int); bool setPalette (FColor, int, int, int);
void setUTF8 (bool) const; void setUTF8 (bool = true) const;
// Inquiries // Inquiries
static bool isLinuxConsole(); static bool isLinuxConsole();
@ -202,7 +202,7 @@ class FTermLinux final
void writeAttributeController (uChar, uChar) const; void writeAttributeController (uChar, uChar) const;
uChar getAttributeMode() const; uChar getAttributeMode() const;
void setAttributeMode (uChar) const; void setAttributeMode (uChar) const;
int setBlinkAsIntensity (bool) const; int setBlinkAsIntensity (bool = true) const;
bool has9BitCharacters() const; bool has9BitCharacters() const;
void getVGAPalette(); void getVGAPalette();
void setVGADefaultPalette(); void setVGADefaultPalette();

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2018-2020 Markus Gans * * Copyright 2018-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -61,7 +61,7 @@ class FTermXTerminal final
FTermXTerminal& operator = (const FTermXTerminal&) = delete; FTermXTerminal& operator = (const FTermXTerminal&) = delete;
// Mutators // Mutators
void redefineDefaultColors (bool); void redefineDefaultColors (bool = true);
void setCursorStyle (XTermCursorStyle); void setCursorStyle (XTermCursorStyle);
void setFont (const FString&); void setFont (const FString&);
void setTitle (const FString&); void setTitle (const FString&);
@ -72,10 +72,9 @@ class FTermXTerminal final
void setMouseForeground (const FString&); void setMouseForeground (const FString&);
void setMouseBackground (const FString&); void setMouseBackground (const FString&);
void setHighlightBackground (const FString&); void setHighlightBackground (const FString&);
static void setMouseSupport (bool); static void setMouseSupport (bool = true);
static void setMouseSupport();
static void unsetMouseSupport(); static void unsetMouseSupport();
void metaSendsESC (bool); void metaSendsESC (bool = true);
// Accessors // Accessors
FString getClassName() const; FString getClassName() const;
@ -212,10 +211,6 @@ inline bool FTermXTerminal::hasFont() const
inline bool FTermXTerminal::hasTitle() const inline bool FTermXTerminal::hasTitle() const
{ return bool(xterm_title.getLength() > 0); } { return bool(xterm_title.getLength() > 0); }
//----------------------------------------------------------------------
inline void FTermXTerminal::setMouseSupport()
{ setMouseSupport (true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTermXTerminal::unsetMouseSupport() inline void FTermXTerminal::unsetMouseSupport()
{ setMouseSupport (false); } { setMouseSupport (false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2014-2020 Markus Gans * * Copyright 2014-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -87,18 +87,14 @@ class FToggleButton : public FWidget
void setGeometry ( const FPoint&, const FSize& void setGeometry ( const FPoint&, const FSize&
, bool = true ) override; , bool = true ) override;
void resetColors() override; void resetColors() override;
bool setNoUnderline (bool); bool setNoUnderline (bool = true);
bool setNoUnderline();
bool unsetNoUnderline(); bool unsetNoUnderline();
bool setEnable (bool) override; bool setEnable (bool = true) override;
bool setEnable() override;
bool unsetEnable() override; bool unsetEnable() override;
bool setDisable() override; bool setDisable() override;
bool setFocus (bool) override; bool setFocus (bool = true) override;
bool setFocus() override;
bool unsetFocus() override; bool unsetFocus() override;
bool setChecked (bool); bool setChecked (bool = true);
bool setChecked();
bool unsetChecked(); bool unsetChecked();
virtual void setText (const FString&); virtual void setText (const FString&);
@ -172,18 +168,9 @@ inline FString FToggleButton::getClassName() const
inline FString& FToggleButton::getText() inline FString& FToggleButton::getText()
{ return text; } { return text; }
//----------------------------------------------------------------------
inline bool FToggleButton::setNoUnderline()
{ return setNoUnderline(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FToggleButton::unsetNoUnderline() inline bool FToggleButton::unsetNoUnderline()
{ return setNoUnderline(false); } { return setNoUnderline(false); }
//----------------------------------------------------------------------
inline bool FToggleButton::setEnable()
{ return setEnable(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FToggleButton::unsetEnable() inline bool FToggleButton::unsetEnable()
{ return setEnable(false); } { return setEnable(false); }
@ -192,18 +179,10 @@ inline bool FToggleButton::unsetEnable()
inline bool FToggleButton::setDisable() inline bool FToggleButton::setDisable()
{ return setEnable(false); } { return setEnable(false); }
//----------------------------------------------------------------------
inline bool FToggleButton::setFocus()
{ return setFocus(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FToggleButton::unsetFocus() inline bool FToggleButton::unsetFocus()
{ return setFocus(false); } { return setFocus(false); }
//----------------------------------------------------------------------
inline bool FToggleButton::setChecked()
{ return setChecked(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FToggleButton::unsetChecked() inline bool FToggleButton::unsetChecked()
{ return setChecked(false); } { return setChecked(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2016-2020 Markus Gans * * Copyright 2016-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -86,8 +86,7 @@ class FToolTip : public FWindow
// Mutators // Mutators
void setText (const FString&); void setText (const FString&);
void resetColors() override; void resetColors() override;
bool setBorder (bool); bool setBorder (bool = true);
bool setBorder();
bool unsetBorder(); bool unsetBorder();
// Inquiries // Inquiries
@ -123,10 +122,6 @@ inline FString FToolTip::getClassName() const
inline FString FToolTip::getText() const inline FString FToolTip::getText() const
{ return text; } { return text; }
//----------------------------------------------------------------------
inline bool FToolTip::setBorder()
{ return setBorder(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FToolTip::unsetBorder() inline bool FToolTip::unsetBorder()
{ return setBorder(false); } { return setBorder(false); }

View File

@ -51,7 +51,9 @@
#include <sys/time.h> // need for timeval (cygwin) #include <sys/time.h> // need for timeval (cygwin)
#include <memory> #include <memory>
#include <queue>
#include <string> #include <string>
#include <tuple>
#include <utility> #include <utility>
#include <vector> #include <vector>
@ -152,81 +154,45 @@ class FVTerm
// Mutators // Mutators
void setTermXY (int, int) const; void setTermXY (int, int) const;
void setTerminalUpdates (TerminalUpdate) const; void setTerminalUpdates (TerminalUpdate) const;
void hideCursor (bool) const; void hideCursor (bool = true) const;
void hideCursor() const;
void showCursor() const; void showCursor() const;
void setPrintCursor (const FPoint&); void setPrintCursor (const FPoint&);
FColor rgb2ColorIndex (uInt8, uInt8, uInt8) const; FColor rgb2ColorIndex (uInt8, uInt8, uInt8) const;
static void setColor (FColor, FColor); static void setColor (FColor, FColor);
static void setNormal(); static void setNormal();
static bool setBold (bool = true);
static bool setBold (bool);
static bool setBold();
static bool unsetBold(); static bool unsetBold();
static bool setDim (bool = true);
static bool setDim (bool);
static bool setDim();
static bool unsetDim(); static bool unsetDim();
static bool setItalic (bool = true);
static bool setItalic (bool);
static bool setItalic();
static bool unsetItalic(); static bool unsetItalic();
static bool setUnderline (bool = true);
static bool setUnderline (bool);
static bool setUnderline();
static bool unsetUnderline(); static bool unsetUnderline();
static bool setBlink (bool = true);
static bool setBlink (bool);
static bool setBlink();
static bool unsetBlink(); static bool unsetBlink();
static bool setReverse (bool = true);
static bool setReverse (bool);
static bool setReverse();
static bool unsetReverse(); static bool unsetReverse();
static bool setStandout (bool = true);
static bool setStandout (bool);
static bool setStandout();
static bool unsetStandout(); static bool unsetStandout();
static bool setInvisible (bool = true);
static bool setInvisible (bool);
static bool setInvisible();
static bool unsetInvisible(); static bool unsetInvisible();
static bool setProtected (bool = true);
static bool setProtected (bool);
static bool setProtected();
static bool unsetProtected(); static bool unsetProtected();
static bool setCrossedOut (bool = true);
static bool setCrossedOut (bool);
static bool setCrossedOut();
static bool unsetCrossedOut(); static bool unsetCrossedOut();
static bool setDoubleUnderline (bool = true);
static bool setDoubleUnderline (bool);
static bool setDoubleUnderline();
static bool unsetDoubleUnderline(); static bool unsetDoubleUnderline();
static bool setAltCharset (bool = true);
static bool setAltCharset (bool);
static bool setAltCharset();
static bool unsetAltCharset(); static bool unsetAltCharset();
static bool setPCcharset (bool = true);
static bool setPCcharset (bool);
static bool setPCcharset();
static bool unsetPCcharset(); static bool unsetPCcharset();
static bool setTransparent (bool = true);
static bool setTransparent (bool);
static bool setTransparent();
static bool unsetTransparent(); static bool unsetTransparent();
static bool setColorOverlay (bool = true);
static bool setColorOverlay (bool);
static bool setColorOverlay();
static bool unsetColorOverlay(); static bool unsetColorOverlay();
static bool setInheritBackground (bool = true);
static bool setInheritBackground (bool);
static bool setInheritBackground();
static bool unsetInheritBackground(); static bool unsetInheritBackground();
static void setNonBlockingRead (bool = true);
static void setNonBlockingRead (bool);
static void setNonBlockingRead();
static void unsetNonBlockingRead(); static void unsetNonBlockingRead();
// Inquiries // Inquiries
@ -273,7 +239,7 @@ class FVTerm
virtual void print (const FStyle&); virtual void print (const FStyle&);
virtual void print (const FColorPair&); virtual void print (const FColorPair&);
virtual FVTerm& print(); virtual FVTerm& print();
static void flush(); void flush() const;
protected: protected:
// Accessor // Accessor
@ -322,6 +288,21 @@ class FVTerm
virtual void initTerminal(); virtual void initTerminal();
private: private:
struct FTermControl
{
std::string string;
};
struct FTermChar
{
wchar_t ch;
};
struct FTermString
{
std::wstring string;
};
// Enumerations // Enumerations
enum class CharacterType enum class CharacterType
{ {
@ -337,9 +318,19 @@ class FVTerm
LineCompletelyPrinted LineCompletelyPrinted
}; };
enum class OutputType : uInt8 // Output data type of the terminal
{
String,
Control
};
// Using-declaration
using OutputData = std::tuple<OutputType, std::wstring>;
using OutputBuffer = std::queue<OutputData>;
// Constants // Constants
// Buffer size for character output on the terminal // Buffer limit for character output on the terminal
static constexpr std::size_t TERMINAL_OUTPUT_BUFFER_SIZE = 131072; static constexpr std::size_t TERMINAL_OUTPUT_BUFFER_LIMIT = 1024;
// Methods // Methods
void resetTextAreaToDefault ( const FTermArea* void resetTextAreaToDefault ( const FTermArea*
@ -396,7 +387,7 @@ class FVTerm
PrintState repeatCharacter (uInt&, uInt, uInt) const; PrintState repeatCharacter (uInt&, uInt, uInt) const;
bool isFullWidthChar (const FChar&) const; bool isFullWidthChar (const FChar&) const;
bool isFullWidthPaddingChar (const FChar&) const; bool isFullWidthPaddingChar (const FChar&) const;
static void cursorWrap(); void cursorWrap() const;
bool printWrap (FTermArea*) const; bool printWrap (FTermArea*) const;
void printCharacterOnCoordinate ( FTermArea* void printCharacterOnCoordinate ( FTermArea*
, const int& , const int&
@ -418,39 +409,41 @@ class FVTerm
void appendChar (FChar&) const; void appendChar (FChar&) const;
void appendAttributes (FChar&) const; void appendAttributes (FChar&) const;
void appendLowerRight (FChar&) const; void appendLowerRight (FChar&) const;
static void characterFilter (FChar&); void characterFilter (FChar&) const;
static void appendOutputBuffer (const std::string&); bool isOutputBufferLimitReached() const;
static int appendOutputBuffer (int); void appendOutputBuffer (const FTermControl&) const;
void appendOutputBuffer (const FTermChar&) const;
void appendOutputBuffer (const FTermString&) const;
// Data members // Data members
FTermArea* print_area{nullptr}; // print area for this object FTermArea* print_area{nullptr}; // print area for this object
FTermArea* child_print_area{nullptr}; // print area for children FTermArea* child_print_area{nullptr}; // print area for children
FTermArea* vwin{nullptr}; // virtual window FTermArea* vwin{nullptr}; // virtual window
static const FVTerm* init_object; // Global FVTerm object std::shared_ptr<FTerm> fterm{};
static FTerm* fterm; std::shared_ptr<FPoint> term_pos{}; // terminal cursor position
static FTermArea* vterm; // virtual terminal std::shared_ptr<OutputBuffer> output_buffer{};
static FTermArea* vdesktop; // virtual desktop static const FVTerm* init_object; // Global FVTerm object
static FTermArea* active_area; // active area static FTermArea* vterm; // virtual terminal
static std::vector<int>* output_buffer; static FTermArea* vdesktop; // virtual desktop
static FChar term_attribute; static FTermArea* active_area; // active area
static FChar next_attribute; static FChar term_attribute;
static FChar s_ch; // shadow character static FChar next_attribute;
static FChar i_ch; // inherit background character static FChar s_ch; // shadow character
static FPoint* term_pos; // terminal cursor position static FChar i_ch; // inherit background character
static timeval time_last_flush; static timeval time_last_flush;
static timeval last_term_size_check; static timeval last_term_size_check;
static bool draw_completed; static bool draw_completed;
static bool combined_char_support; static bool combined_char_support;
static bool no_terminal_updates; static bool no_terminal_updates;
static bool force_terminal_update; static bool force_terminal_update;
static uInt64 flush_wait; static uInt64 flush_wait;
static uInt64 term_size_check_timeout; static uInt64 term_size_check_timeout;
static uInt erase_char_length; static uInt erase_char_length;
static uInt repeat_char_length; static uInt repeat_char_length;
static uInt clr_bol_length; static uInt clr_bol_length;
static uInt clr_eol_length; static uInt clr_eol_length;
static uInt cursor_address_length; static uInt cursor_address_length;
static bool cursor_hideable; static bool cursor_hideable;
}; };
@ -608,10 +601,6 @@ inline FChar FVTerm::getAttribute()
inline FTerm& FVTerm::getFTerm() const inline FTerm& FVTerm::getFTerm() const
{ return *fterm; } { return *fterm; }
//----------------------------------------------------------------------
inline void FVTerm::hideCursor() const
{ return hideCursor(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::showCursor() const inline void FVTerm::showCursor() const
{ return hideCursor(false); } { return hideCursor(false); }
@ -639,10 +628,6 @@ inline void FVTerm::setNormal()
inline bool FVTerm::setBold (bool enable) inline bool FVTerm::setBold (bool enable)
{ return (next_attribute.attr.bit.bold = enable); } { return (next_attribute.attr.bit.bold = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setBold()
{ return setBold(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetBold() inline bool FVTerm::unsetBold()
{ return setBold(false); } { return setBold(false); }
@ -651,10 +636,6 @@ inline bool FVTerm::unsetBold()
inline bool FVTerm::setDim (bool enable) inline bool FVTerm::setDim (bool enable)
{ return (next_attribute.attr.bit.dim = enable); } { return (next_attribute.attr.bit.dim = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setDim()
{ return setDim(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetDim() inline bool FVTerm::unsetDim()
{ return setDim(false); } { return setDim(false); }
@ -663,10 +644,6 @@ inline bool FVTerm::unsetDim()
inline bool FVTerm::setItalic (bool enable) inline bool FVTerm::setItalic (bool enable)
{ return (next_attribute.attr.bit.italic = enable); } { return (next_attribute.attr.bit.italic = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setItalic()
{ return setItalic(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetItalic() inline bool FVTerm::unsetItalic()
{ return setItalic(false); } { return setItalic(false); }
@ -675,10 +652,6 @@ inline bool FVTerm::unsetItalic()
inline bool FVTerm::setUnderline (bool enable) inline bool FVTerm::setUnderline (bool enable)
{ return (next_attribute.attr.bit.underline = enable); } { return (next_attribute.attr.bit.underline = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setUnderline()
{ return setUnderline(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetUnderline() inline bool FVTerm::unsetUnderline()
{ return setUnderline(false); } { return setUnderline(false); }
@ -687,10 +660,6 @@ inline bool FVTerm::unsetUnderline()
inline bool FVTerm::setBlink (bool enable) inline bool FVTerm::setBlink (bool enable)
{ return (next_attribute.attr.bit.blink = enable); } { return (next_attribute.attr.bit.blink = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setBlink()
{ return setBlink(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetBlink() inline bool FVTerm::unsetBlink()
{ return setBlink(false); } { return setBlink(false); }
@ -699,10 +668,6 @@ inline bool FVTerm::unsetBlink()
inline bool FVTerm::setReverse (bool enable) inline bool FVTerm::setReverse (bool enable)
{ return (next_attribute.attr.bit.reverse = enable); } { return (next_attribute.attr.bit.reverse = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setReverse()
{ return setReverse(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetReverse() inline bool FVTerm::unsetReverse()
{ return setReverse(false); } { return setReverse(false); }
@ -711,10 +676,6 @@ inline bool FVTerm::unsetReverse()
inline bool FVTerm::setStandout (bool enable) inline bool FVTerm::setStandout (bool enable)
{ return (next_attribute.attr.bit.standout = enable); } { return (next_attribute.attr.bit.standout = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setStandout()
{ return setStandout(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetStandout() inline bool FVTerm::unsetStandout()
{ return setStandout(false); } { return setStandout(false); }
@ -723,10 +684,6 @@ inline bool FVTerm::unsetStandout()
inline bool FVTerm::setInvisible (bool enable) inline bool FVTerm::setInvisible (bool enable)
{ return (next_attribute.attr.bit.invisible = enable); } { return (next_attribute.attr.bit.invisible = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setInvisible()
{ return setInvisible(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetInvisible() inline bool FVTerm::unsetInvisible()
{ return setInvisible(false); } { return setInvisible(false); }
@ -735,10 +692,6 @@ inline bool FVTerm::unsetInvisible()
inline bool FVTerm::setProtected (bool enable) inline bool FVTerm::setProtected (bool enable)
{ return (next_attribute.attr.bit.protect = enable); } { return (next_attribute.attr.bit.protect = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setProtected()
{ return setProtected(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetProtected() inline bool FVTerm::unsetProtected()
{ return setProtected(false); } { return setProtected(false); }
@ -747,10 +700,6 @@ inline bool FVTerm::unsetProtected()
inline bool FVTerm::setCrossedOut (bool enable) inline bool FVTerm::setCrossedOut (bool enable)
{ return (next_attribute.attr.bit.crossed_out = enable); } { return (next_attribute.attr.bit.crossed_out = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setCrossedOut()
{ return setCrossedOut(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetCrossedOut() inline bool FVTerm::unsetCrossedOut()
{ return setCrossedOut(false); } { return setCrossedOut(false); }
@ -759,10 +708,6 @@ inline bool FVTerm::unsetCrossedOut()
inline bool FVTerm::setDoubleUnderline (bool enable) inline bool FVTerm::setDoubleUnderline (bool enable)
{ return (next_attribute.attr.bit.dbl_underline = enable); } { return (next_attribute.attr.bit.dbl_underline = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setDoubleUnderline()
{ return setDoubleUnderline(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetDoubleUnderline() inline bool FVTerm::unsetDoubleUnderline()
{ return setDoubleUnderline(false); } { return setDoubleUnderline(false); }
@ -771,10 +716,6 @@ inline bool FVTerm::unsetDoubleUnderline()
inline bool FVTerm::setAltCharset (bool enable) inline bool FVTerm::setAltCharset (bool enable)
{ return (next_attribute.attr.bit.alt_charset = enable); } { return (next_attribute.attr.bit.alt_charset = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setAltCharset()
{ return setAltCharset(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetAltCharset() inline bool FVTerm::unsetAltCharset()
{ return setAltCharset(false); } { return setAltCharset(false); }
@ -783,10 +724,6 @@ inline bool FVTerm::unsetAltCharset()
inline bool FVTerm::setPCcharset (bool enable) inline bool FVTerm::setPCcharset (bool enable)
{ return (next_attribute.attr.bit.pc_charset = enable); } { return (next_attribute.attr.bit.pc_charset = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setPCcharset()
{ return setPCcharset(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetPCcharset() inline bool FVTerm::unsetPCcharset()
{ return setPCcharset(false); } { return setPCcharset(false); }
@ -795,10 +732,6 @@ inline bool FVTerm::unsetPCcharset()
inline bool FVTerm::setTransparent (bool enable) inline bool FVTerm::setTransparent (bool enable)
{ return (next_attribute.attr.bit.transparent = enable); } { return (next_attribute.attr.bit.transparent = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setTransparent()
{ return setTransparent(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetTransparent() inline bool FVTerm::unsetTransparent()
{ return setTransparent(false); } { return setTransparent(false); }
@ -807,10 +740,6 @@ inline bool FVTerm::unsetTransparent()
inline bool FVTerm::setColorOverlay (bool enable) inline bool FVTerm::setColorOverlay (bool enable)
{ return (next_attribute.attr.bit.color_overlay = enable); } { return (next_attribute.attr.bit.color_overlay = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setColorOverlay()
{ return setColorOverlay(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetColorOverlay() inline bool FVTerm::unsetColorOverlay()
{ return setColorOverlay(false); } { return setColorOverlay(false); }
@ -819,18 +748,10 @@ inline bool FVTerm::unsetColorOverlay()
inline bool FVTerm::setInheritBackground (bool enable) inline bool FVTerm::setInheritBackground (bool enable)
{ return (next_attribute.attr.bit.inherit_background = enable); } { return (next_attribute.attr.bit.inherit_background = enable); }
//----------------------------------------------------------------------
inline bool FVTerm::setInheritBackground()
{ return setInheritBackground(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::unsetInheritBackground() inline bool FVTerm::unsetInheritBackground()
{ return setInheritBackground(false); } { return setInheritBackground(false); }
//----------------------------------------------------------------------
inline void FVTerm::setNonBlockingRead()
{ setNonBlockingRead(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::unsetNonBlockingRead() inline void FVTerm::unsetNonBlockingRead()
{ setNonBlockingRead(false); } { setNonBlockingRead(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2015-2020 Markus Gans * * Copyright 2015-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -235,24 +235,19 @@ class FWidget : public FVTerm, public FObject
static void setColorTheme(); static void setColorTheme();
FAcceleratorList& setAcceleratorList(); FAcceleratorList& setAcceleratorList();
virtual void setStatusbarMessage (const FString&); virtual void setStatusbarMessage (const FString&);
bool setVisible (bool); bool setVisible (bool = true);
bool setVisible();
bool unsetVisible(); bool unsetVisible();
virtual bool setEnable (bool); virtual bool setEnable (bool = true);
virtual bool setEnable();
virtual bool unsetEnable(); virtual bool unsetEnable();
virtual bool setDisable(); virtual bool setDisable();
virtual bool setVisibleCursor (bool); // input cursor visibility virtual bool setVisibleCursor (bool = true); // input cursor visibility
virtual bool setVisibleCursor(); // for the widget virtual bool unsetVisibleCursor(); // for the widget
virtual bool unsetVisibleCursor(); virtual bool setFocus (bool = true);
virtual bool setFocus (bool);
virtual bool setFocus();
virtual bool unsetFocus(); virtual bool unsetFocus();
void setFocusable(); void setFocusable (bool = true);
void unsetFocusable(); void unsetFocusable();
bool ignorePadding (bool); // ignore padding from bool ignorePadding (bool = true); // ignore padding from
bool ignorePadding(); // the parent widget bool acceptPadding(); // the parent widget
bool acceptPadding();
virtual void setForegroundColor (FColor); virtual void setForegroundColor (FColor);
virtual void setBackgroundColor (FColor); virtual void setBackgroundColor (FColor);
virtual void resetColors(); virtual void resetColors();
@ -434,7 +429,7 @@ class FWidget : public FVTerm, public FObject
void KeyPressEvent (FKeyEvent*); void KeyPressEvent (FKeyEvent*);
void KeyDownEvent (FKeyEvent*); void KeyDownEvent (FKeyEvent*);
void emitWheelCallback (const FWheelEvent*) const; void emitWheelCallback (const FWheelEvent*) const;
void setWindowFocus (bool); void setWindowFocus (bool = true);
bool changeFocus (FWidget*, FWidget*, FocusTypes); bool changeFocus (FWidget*, FWidget*, FocusTypes);
void processDestroy() const; void processDestroy() const;
virtual void draw(); virtual void draw();
@ -443,7 +438,7 @@ class FWidget : public FVTerm, public FObject
static bool isDefaultTheme(); static bool isDefaultTheme();
static void initColorTheme(); static void initColorTheme();
void removeQueuedEvent() const; void removeQueuedEvent() const;
void setStatusbarText (bool) const; void setStatusbarText (bool = true) const;
// Data members // Data members
struct FWidgetFlags flags{}; struct FWidgetFlags flags{};
@ -775,18 +770,10 @@ inline void FWidget::setMoveSizeWidget (FWidget* obj)
inline void FWidget::setStatusbarMessage (const FString& msg) inline void FWidget::setStatusbarMessage (const FString& msg)
{ statusbar_message = msg; } { statusbar_message = msg; }
//----------------------------------------------------------------------
inline bool FWidget::setVisible()
{ return setVisible(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWidget::unsetVisible() inline bool FWidget::unsetVisible()
{ return setVisible(false); } { return setVisible(false); }
//----------------------------------------------------------------------
inline bool FWidget::setEnable()
{ return setEnable(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWidget::unsetEnable() inline bool FWidget::unsetEnable()
{ return setEnable(false); } { return setEnable(false); }
@ -799,25 +786,17 @@ inline bool FWidget::setDisable()
inline bool FWidget::setVisibleCursor (bool enable) inline bool FWidget::setVisibleCursor (bool enable)
{ return (flags.visible_cursor = enable); } { return (flags.visible_cursor = enable); }
//----------------------------------------------------------------------
inline bool FWidget::setVisibleCursor()
{ return setVisibleCursor(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWidget::unsetVisibleCursor() inline bool FWidget::unsetVisibleCursor()
{ return setVisibleCursor(false); } { return setVisibleCursor(false); }
//----------------------------------------------------------------------
inline bool FWidget::setFocus()
{ return setFocus(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWidget::unsetFocus() inline bool FWidget::unsetFocus()
{ return setFocus(false); } { return setFocus(false); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FWidget::setFocusable() inline void FWidget::setFocusable (bool enable)
{ flags.focusable = true; } { flags.focusable = enable; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FWidget::unsetFocusable() inline void FWidget::unsetFocusable()
@ -827,10 +806,6 @@ inline void FWidget::unsetFocusable()
inline bool FWidget::ignorePadding (bool enable) inline bool FWidget::ignorePadding (bool enable)
{ return (ignore_padding = enable); } { return (ignore_padding = enable); }
//----------------------------------------------------------------------
inline bool FWidget::ignorePadding()
{ return (ignore_padding = true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWidget::acceptPadding() inline bool FWidget::acceptPadding()
{ return (ignore_padding = false); } { return (ignore_padding = false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2015-2020 Markus Gans * * Copyright 2015-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -89,26 +89,20 @@ class FWindow : public FWidget
FWidget* getWindowFocusWidget() const; FWidget* getWindowFocusWidget() const;
// Mutators // Mutators
bool setWindowWidget (bool); bool setWindowWidget (bool = true);
bool setWindowWidget();
bool unsetWindowWidget(); bool unsetWindowWidget();
static void setActiveWindow (FWindow*); static void setActiveWindow (FWindow*);
void setWindowFocusWidget (FWidget*); void setWindowFocusWidget (FWidget*);
bool activateWindow (bool); bool activateWindow (bool = true);
bool activateWindow();
void unsetActiveWindow() const; void unsetActiveWindow() const;
bool deactivateWindow(); bool deactivateWindow();
virtual bool setResizeable (bool); virtual bool setResizeable (bool = true);
virtual bool setResizeable();
bool unsetResizeable(); bool unsetResizeable();
bool setTransparentShadow (bool); bool setTransparentShadow (bool = true);
bool setTransparentShadow();
bool unsetTransparentShadow(); bool unsetTransparentShadow();
bool setShadow (bool); bool setShadow (bool = true);
bool setShadow();
bool unsetShadow(); bool unsetShadow();
bool setAlwaysOnTop (bool); bool setAlwaysOnTop (bool = true);
bool setAlwaysOnTop();
bool unsetAlwaysOnTop(); bool unsetAlwaysOnTop();
// Inquiries // Inquiries
@ -184,50 +178,26 @@ void closeDropDown (const FWidget*, const FPoint&);
inline FString FWindow::getClassName() const inline FString FWindow::getClassName() const
{ return "FWindow"; } { return "FWindow"; }
//----------------------------------------------------------------------
inline bool FWindow::setWindowWidget()
{ return setWindowWidget(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWindow::unsetWindowWidget() inline bool FWindow::unsetWindowWidget()
{ return setWindowWidget(false); } { return setWindowWidget(false); }
//----------------------------------------------------------------------
inline bool FWindow::activateWindow()
{ return activateWindow(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWindow::deactivateWindow() inline bool FWindow::deactivateWindow()
{ return activateWindow(false); } { return activateWindow(false); }
//----------------------------------------------------------------------
inline bool FWindow::setResizeable()
{ return setResizeable(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWindow::unsetResizeable() inline bool FWindow::unsetResizeable()
{ return setResizeable(false); } { return setResizeable(false); }
//----------------------------------------------------------------------
inline bool FWindow::setTransparentShadow()
{ return setTransparentShadow(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWindow::unsetTransparentShadow() inline bool FWindow::unsetTransparentShadow()
{ return setTransparentShadow(false); } { return setTransparentShadow(false); }
//----------------------------------------------------------------------
inline bool FWindow::setShadow()
{ return setShadow(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWindow::unsetShadow() inline bool FWindow::unsetShadow()
{ return setShadow(false); } { return setShadow(false); }
//----------------------------------------------------------------------
inline bool FWindow::setAlwaysOnTop()
{ return setAlwaysOnTop(true); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWindow::unsetAlwaysOnTop() inline bool FWindow::unsetAlwaysOnTop()
{ return setAlwaysOnTop(false); } { return setAlwaysOnTop(false); }

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2018-2020 Markus Gans * * Copyright 2018-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -142,7 +142,7 @@ void FOptiMoveTest::noArgumentTest()
om.set_parm_right_cursor (0); om.set_parm_right_cursor (0);
om.set_parm_left_cursor (0); om.set_parm_left_cursor (0);
CPPUNIT_ASSERT (om.moveCursor (1, 1, 5, 5) == 0); CPPUNIT_ASSERT (om.moveCursor (1, 1, 5, 5) == nullptr);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -446,6 +446,47 @@ void FTermBufferTest::streamTest()
CPPUNIT_ASSERT ( term_buf.getBuffer()[i].attr.byte[2] != 0 ); CPPUNIT_ASSERT ( term_buf.getBuffer()[i].attr.byte[2] != 0 );
CPPUNIT_ASSERT ( term_buf.getBuffer()[i].attr.byte[3] == 0 ); CPPUNIT_ASSERT ( term_buf.getBuffer()[i].attr.byte[3] == 0 );
} }
// Stream into FCharVector
fchar_vec.clear();
CPPUNIT_ASSERT ( fchar_vec.empty() );
CPPUNIT_ASSERT ( fchar_vec.size() == 0 );
CPPUNIT_ASSERT ( fchar_vec.begin() == fchar_vec.end() );
fchar_vec << term_buf;
CPPUNIT_ASSERT ( ! fchar_vec.empty() );
CPPUNIT_ASSERT ( fchar_vec.size() == 6 );
CPPUNIT_ASSERT ( fchar_vec.begin() + 6 == fchar_vec.end() );
CPPUNIT_ASSERT ( fchar_vec[0].ch[0] == L'a' );
CPPUNIT_ASSERT ( fchar_vec[1].ch[0] == L'1' );
CPPUNIT_ASSERT ( fchar_vec[2].ch[0] == L'\U0000e1f9' );
CPPUNIT_ASSERT ( fchar_vec[3].ch[0] == L'🚧' );
CPPUNIT_ASSERT ( fchar_vec[4].ch[0] == L'🚀' );
CPPUNIT_ASSERT ( fchar_vec[5].ch[0] == L'🚴' );
CPPUNIT_ASSERT ( fchar_vec[0].fg_color == finalcut::FColor::Default );
CPPUNIT_ASSERT ( fchar_vec[0].bg_color == finalcut::FColor::Default );
CPPUNIT_ASSERT ( fchar_vec[1].fg_color == finalcut::FColor::Yellow );
CPPUNIT_ASSERT ( fchar_vec[1].bg_color == finalcut::FColor::Blue );
CPPUNIT_ASSERT ( fchar_vec[2].fg_color == finalcut::FColor::Cyan );
CPPUNIT_ASSERT ( fchar_vec[2].bg_color == finalcut::FColor::White );
CPPUNIT_ASSERT ( fchar_vec[3].fg_color == finalcut::FColor::White );
CPPUNIT_ASSERT ( fchar_vec[3].bg_color == finalcut::FColor::Cyan );
CPPUNIT_ASSERT ( fchar_vec[4].fg_color == finalcut::FColor::Cyan );
CPPUNIT_ASSERT ( fchar_vec[4].bg_color == finalcut::FColor::White );
CPPUNIT_ASSERT ( fchar_vec[5].fg_color == finalcut::FColor::Black );
CPPUNIT_ASSERT ( fchar_vec[5].bg_color == finalcut::FColor::White );
CPPUNIT_ASSERT ( fchar_vec[0].attr.byte[0] == 0 );
CPPUNIT_ASSERT ( fchar_vec[0].attr.byte[1] == 0 );
CPPUNIT_ASSERT ( fchar_vec[1].attr.byte[0] == 0 );
CPPUNIT_ASSERT ( fchar_vec[1].attr.byte[1] == 0 );
CPPUNIT_ASSERT ( fchar_vec[2].attr.byte[0] != 0 );
CPPUNIT_ASSERT ( fchar_vec[2].attr.byte[1] == 0 );
CPPUNIT_ASSERT ( fchar_vec[3].attr.byte[0] == 0 );
CPPUNIT_ASSERT ( fchar_vec[3].attr.byte[1] == 0 );
CPPUNIT_ASSERT ( fchar_vec[4].attr.byte[0] != 0 );
CPPUNIT_ASSERT ( fchar_vec[4].attr.byte[1] == 0 );
CPPUNIT_ASSERT ( fchar_vec[5].attr.byte[0] == 0 );
CPPUNIT_ASSERT ( fchar_vec[5].attr.byte[1] != 0 );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the FINAL CUT widget toolkit * * This file is part of the FINAL CUT widget toolkit *
* * * *
* Copyright 2018-2020 Markus Gans * * Copyright 2018-2021 Markus Gans *
* * * *
* FINAL CUT is free software; you can redistribute it and/or modify * * FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as * * it under the terms of the GNU Lesser General Public License as *
@ -93,8 +93,8 @@ void FTermDataTest::defaultDataTest()
CPPUNIT_ASSERT ( data.getTermGeometry() == finalcut::FRect() ); CPPUNIT_ASSERT ( data.getTermGeometry() == finalcut::FRect() );
CPPUNIT_ASSERT ( data.getTTYFileDescriptor() == -1 ); CPPUNIT_ASSERT ( data.getTTYFileDescriptor() == -1 );
CPPUNIT_ASSERT ( data.getBaudrate() == 0 ); CPPUNIT_ASSERT ( data.getBaudrate() == 0 );
CPPUNIT_ASSERT_CSTRING ( data.getTermType(), "" ); CPPUNIT_ASSERT_CSTRING ( data.getTermType().data(), "" );
CPPUNIT_ASSERT_CSTRING ( data.getTermFileName(), "" ); CPPUNIT_ASSERT_CSTRING ( data.getTermFileName().data(), "" );
CPPUNIT_ASSERT ( data.getXtermFont() == finalcut::FString() ); CPPUNIT_ASSERT ( data.getXtermFont() == finalcut::FString() );
CPPUNIT_ASSERT ( data.getXtermTitle() == finalcut::FString() ); CPPUNIT_ASSERT ( data.getXtermTitle() == finalcut::FString() );
CPPUNIT_ASSERT ( data.getExitMessage() == finalcut::FString() ); CPPUNIT_ASSERT ( data.getExitMessage() == finalcut::FString() );
@ -178,13 +178,13 @@ void FTermDataTest::dataTest()
CPPUNIT_ASSERT ( data.getBaudrate() != 9600 ); CPPUNIT_ASSERT ( data.getBaudrate() != 9600 );
CPPUNIT_ASSERT ( data.getBaudrate() == 38400 ); CPPUNIT_ASSERT ( data.getBaudrate() == 38400 );
CPPUNIT_ASSERT_CSTRING ( data.getTermType(), "" ); CPPUNIT_ASSERT ( data.getTermType() == "" );
data.setTermType("linux"); data.setTermType("linux");
CPPUNIT_ASSERT_CSTRING ( data.getTermType(), "linux" ); CPPUNIT_ASSERT ( data.getTermType() == "linux" );
CPPUNIT_ASSERT_CSTRING ( data.getTermFileName(), "" ); CPPUNIT_ASSERT ( data.getTermFileName() == "" );
data.setTermFileName("/dev/pts/2"); data.setTermFileName("/dev/pts/2");
CPPUNIT_ASSERT_CSTRING ( data.getTermFileName(), "/dev/pts/2" ); CPPUNIT_ASSERT ( data.getTermFileName() == "/dev/pts/2" );
CPPUNIT_ASSERT ( data.getXtermFont() == finalcut::FString() ); CPPUNIT_ASSERT ( data.getXtermFont() == finalcut::FString() );
data.setXtermFont("terminus-20"); data.setXtermFont("terminus-20");