More code cleanups

This commit is contained in:
Markus Gans 2019-10-08 04:37:19 +02:00
parent 937654710b
commit b0080b00cf
60 changed files with 1689 additions and 1650 deletions

View File

@ -85,56 +85,49 @@ FINAL CUT uses a virtual terminal to print character via an update method on the
print(...)
printf(...)
│ ╔═════════════════════════[ vterm ]═════════════════════════╗
│ ║createVTerm() ║
│ ║ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ ║
│ ║ ║
│ ║ │ restoreVTerm(x,y,w,h) │ ║
│ ║ ║
│ ║ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ ║
│ ║ ║
│ ┌───────╨─────[ vwin ]─────────────┐ ║
│ │createArea(area) │ ║
│ │ │ ║
│ │ │ ║
└───┼────────► putArea(area) ────► ║
│ │ ║
│ putArea(x,y,area) ────► ║
│ │ ║
│ ◄──── getArea(x,y,area) ║
│ │ ║
│ │ ║
│ │ ║
│ resizeArea(area)│ ║
└───────╥──────────────────────────┘ ║
║ ║
║ ║
║ ║
║ │ resizeVTerm()║
╚═══▼═══════════════════════════════════════════════════════╝
│ putVTerm()
└──────────────────► updateTerminalLine(y)
updateTerminal() │
┌───────────────┐
│ output_buffer │
└───────────────┘
│ flush_out()
│ +
│ Fputchar(char)
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▌ ▐
▌ screen ▐
▌ ───────────── ▐
▌ real terminal ▐
▌ ▐
▀▀▀▀▀▀▀███▀▀▀▀▀▀▀
███
▀▀▀▀▀▀▀▀▀
│ ╔════════════════════════[ vterm ]════════════════════════╗
│ ║createVTerm() ║
│ ║ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ ║
│ ║ ║
│ ║ │ restoreVTerm(x,y,w,h) │ ║
│ ┌───────╨────[ vwin ]────────────┐ ║
│ │createArea(area) │ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ ║
│ │ │ ║
│ │ │ ║
└──┼────────► putArea(area) ────► ║
│ │ ║
│ putArea(x,y,area) ────► ║
│ │ ║
│ ◄──── getArea(x,y,area) ║
│ │ ║
│ │ ║
│ │ ║
│ resizeArea(area)│ ║
└───────╥────────────────────────┘ ║
║ ║
║ │ resizeVTerm()║
╚═══════▼═════════════════════════════════════════════════╝
│ putVTerm()
└──────────────────► updateTerminalLine(y)
updateTerminal() │
┌───────────────┐
│ output_buffer │
└───────────────┘
│ flushOutputBuffer()
│ and putchar(char)
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▌ ▐
▌ screen ▐
▌ ───────────── ▐
▌ real terminal ▐
▌ ▐
▀▀▀▀▀▀▀███▀▀▀▀▀▀▀
███
▀▀▀▀▀▀▀▀▀
</pre>

View File

@ -1,9 +1,9 @@
The virtual terminal (vterm)
----------------------------
FINAL CUT uses a virtual terminal to print character via an update
method on the screen. It provides (as an overlying layer) virtual windows
for the realization of window movements. The update methods only transfer
FINAL CUT uses a virtual terminal to print character via an update method
on the screen. It provides (as an overlying layer) virtual windows for
the realization of window movements. The update methods only transfer
differences to the virtual terminal or physical screen.
@ -11,54 +11,46 @@ differences to the virtual terminal or physical screen.
print(...)
printf(...)
│ ╔═════════════════════════[ vterm ]═════════════════════════╗
│ ║createVTerm() ║
│ ║ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ ║
│ ║ ║
│ ║ │ restoreVTerm(x,y,w,h) │ ║
│ ║ ║
│ ║ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ ║
│ ║ ║
│ ┌───────╨─────[ vwin ]─────────────┐ ║
│ │createArea(area) │ ║
│ │ │ ║
│ │ │ ║
└───┼────────► putArea(area) ────► ║
│ │ ║
│ putArea(x,y,area) ────► ║
│ │ ║
│ ◄──── getArea(x,y,area) ║
│ │ ║
│ │ ║
│ │ ║
│ resizeArea(area)│ ║
└───────╥──────────────────────────┘ ║
║ ║
║ ║
║ ║
║ │ resizeVTerm()║
╚═══▼═══════════════════════════════════════════════════════╝
│ putVTerm()
└──────────────────► updateTerminalLine(y)
updateTerminal() │
┌───────────────┐
│ output_buffer │
└───────────────┘
│ flush_out()
│ +
│ Fputchar(char)
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▌ ▐
▌ screen ▐
▌ ───────────── ▐
▌ real terminal ▐
▌ ▐
▀▀▀▀▀▀▀███▀▀▀▀▀▀▀
███
▀▀▀▀▀▀▀▀▀
│ ╔════════════════════════[ vterm ]════════════════════════╗
│ ║createVTerm() ║
│ ║ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ ║
│ ║ ║
│ ║ │ restoreVTerm(x,y,w,h) │ ║
│ ┌───────╨────[ vwin ]────────────┐ ║
│ │createArea(area) │ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ ║
│ │ │ ║
│ │ │ ║
└──┼────────► putArea(area) ────► ║
│ │ ║
│ putArea(x,y,area) ────► ║
│ │ ║
│ ◄──── getArea(x,y,area) ║
│ │ ║
│ │ ║
│ │ ║
│ resizeArea(area)│ ║
└───────╥────────────────────────┘ ║
║ ║
║ │ resizeVTerm()║
╚═══════▼═════════════════════════════════════════════════╝
│ putVTerm()
└──────────────────► updateTerminalLine(y)
updateTerminal() │
┌───────────────┐
│ output_buffer │
└───────────────┘
│ flushOutputBuffer()
│ and putchar(char)
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▌ ▐
▌ screen ▐
▌ ───────────── ▐
▌ real terminal ▐
▌ ▐
▀▀▀▀▀▀▀███▀▀▀▀▀▀▀
███
▀▀▀▀▀▀▀▀▀

View File

@ -350,7 +350,7 @@ class MouseDraw : public finalcut::FDialog
void cb_colorChanged (finalcut::FWidget*, FDataPtr);
// Data members
term_area* canvas{nullptr};
FTermArea* canvas{nullptr};
ColorChooser c_chooser{this};
Brushes brush{this};
};
@ -495,13 +495,13 @@ void MouseDraw::drawCanvas()
for (int y{0}; y < y_end; y++) // line loop
{
finalcut::charData* canvaschar{}; // canvas character
finalcut::charData* winchar{}; // window character
canvaschar = &canvas->text[y * x_end];
winchar = &printarea->text[(ay + y) * w_line_len + ax];
finalcut::FChar* canvaschar{}; // canvas character
finalcut::FChar* winchar{}; // window character
canvaschar = &canvas->data[y * x_end];
winchar = &printarea->data[(ay + y) * w_line_len + ax];
std::memcpy ( winchar
, canvaschar
, sizeof(finalcut::charData) * unsigned(x_end) );
, sizeof(finalcut::FChar) * unsigned(x_end) );
if ( int(printarea->changes[ay + y].xmin) > ax )
printarea->changes[ay + y].xmin = uInt(ax);

View File

@ -267,7 +267,7 @@ void MainWindow::onTimer (finalcut::FTimerEvent*)
line1 = line1.right(length - 1) + first_Char[0];
line2 = line2.right(length - 1) + first_Char[1];
redraw();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------

View File

@ -136,7 +136,7 @@ void ProgressDialog::onTimer (finalcut::FTimerEvent*)
{
auto p = progressBar.getPercentage();
progressBar.setPercentage(++p);
flush_out();
flushOutputBuffer();
if ( p != 100 )
return;
@ -154,7 +154,7 @@ void ProgressDialog::onTimer (finalcut::FTimerEvent*)
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Sat Dec 01 21:28:25 UTC 2018 - Markus Gans <guru.mail@muenster.de>
- Release (version 0.5.1)
-------------------------------------------------------------------
Thu Nov 28 23:36:24 UTC 2018 - Markus Gans <guru.mail@muenster.de>
- Package name adjustment
-------------------------------------------------------------------
Mon Nov 26 11:22:27 UTC 2018 - mvetter@suse.com
- Prepare to push to devel project
- Remove old tarball: finalcut-0.3.0.tar.gz
- Remove old tarball: finalcut-0.4.0.tar.gz
- Clean spec with spec-cleaner
- Add changes file
-------------------------------------------------------------------
Sun Nov 25 00:03:36 UTC 2018 - Markus Gans <guru.mail@muenster.de>
- Release (version 0.5.0)
@ -17,3 +34,4 @@ Sat Dec 19 21:01:48 UTC 2015 - Markus Gans <guru.mail@muenster.de>
-------------------------------------------------------------------
Fri Sep 18 22:35:57 UTC 2015 - Markus Gans <guru.mail@muenster.de>
- Initial Release (version 0.1.1)

View File

@ -57,6 +57,7 @@ libfinal_la_SOURCES = \
ftermdetection.cpp \
ftermios.cpp \
fterm.cpp \
fterm_functions.cpp \
fvterm.cpp \
fevent.cpp \
foptiattr.cpp \
@ -66,6 +67,7 @@ libfinal_la_SOURCES = \
fcolorpalette.cpp \
fwidgetcolors.cpp \
fwidget.cpp \
fwidget_functions.cpp \
fobject.cpp
libfinal_la_LDFLAGS = -version-info @SO_VERSION@

View File

@ -118,6 +118,7 @@ OBJS = \
fstartoptions.o \
ftermcap.o \
fterm.o \
fterm_functions.o \
ftermdebugdata.o \
ftermios.o \
ftermdetection.o \
@ -134,6 +135,7 @@ OBJS = \
fcolorpalette.o \
fwidgetcolors.o \
fwidget.o \
fwidget_functions.o \
fevent.o \
fobject.o

View File

@ -118,6 +118,7 @@ OBJS = \
ftermcap.o \
fstartoptions.o \
fterm.o \
fterm_functions.o \
ftermdebugdata.o \
ftermios.o \
ftermdetection.o \
@ -134,6 +135,7 @@ OBJS = \
fcolorpalette.o \
fwidgetcolors.o \
fwidget.o \
fwidget_functions.o \
fevent.o \
fobject.o

View File

@ -122,12 +122,12 @@ int FApplication::exec() // run
quit_now = false;
quit_code = 0;
enter_loop();
enterLoop();
return quit_code;
}
//----------------------------------------------------------------------
int FApplication::enter_loop() // event loop
int FApplication::enterLoop() // event loop
{
loop_level++;
quit_now = false;
@ -144,7 +144,7 @@ int FApplication::enter_loop() // event loop
}
//----------------------------------------------------------------------
void FApplication::exit_loop()
void FApplication::exitLoop()
{
app_exit_loop = true;
}
@ -172,10 +172,7 @@ void FApplication::quit()
bool FApplication::sendEvent ( const FObject* receiver
, const FEvent* event )
{
if ( quit_now || app_exit_loop )
return false;
if ( ! receiver )
if ( quit_now || app_exit_loop || ! receiver )
return false;
if ( receiver->isWidget() )
@ -672,7 +669,7 @@ void FApplication::processKeyboardEvent()
return;
findKeyboardWidget();
flush_out();
flushOutputBuffer();
keyboard->clearKeyBufferOnTimeout();
if ( isKeyPressed() )
@ -776,10 +773,7 @@ FWidget*& FApplication::determineClickedWidget()
{
FWidget*& clicked = FWidget::getClickedWidget();
if ( clicked )
return clicked;
if ( ! mouse )
if ( clicked || ! mouse )
return clicked;
if ( ! mouse->isLeftButtonPressed()
@ -861,7 +855,7 @@ void FApplication::closeOpenMenu()
FWidget::getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------
@ -875,13 +869,7 @@ void FApplication::unselectMenubarItems()
if ( openmenu || (mouse && mouse->isMoved()) )
return;
if ( ! menu_bar )
return;
if ( ! menu_bar->hasSelectedItem() )
return;
if ( ! mouse )
if ( ! (menu_bar && menu_bar->hasSelectedItem() && mouse) )
return;
const auto& mouse_position = mouse->getPos();
@ -902,7 +890,7 @@ void FApplication::unselectMenubarItems()
FWidget::getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
@ -911,10 +899,7 @@ void FApplication::sendMouseEvent()
{
auto clicked = FWidget::getClickedWidget();
if ( ! clicked )
return;
if ( ! mouse )
if ( ! (clicked && mouse) )
return;
const auto& mouse_position = mouse->getPos();

View File

@ -364,7 +364,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
{
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
@ -539,7 +539,7 @@ void FButtonGroup::directFocus()
{
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}

View File

@ -135,7 +135,7 @@ void FDialog::show()
if ( isModal() )
{
auto fapp = FApplication::getApplicationObject();
fapp->enter_loop();
fapp->enterLoop();
if ( this == getMainWidget() )
fapp->quit();
@ -150,7 +150,7 @@ void FDialog::hide()
if ( isModal() )
{
auto fapp = FApplication::getApplicationObject();
fapp->exit_loop();
fapp->exitLoop();
}
}
@ -925,14 +925,10 @@ void FDialog::drawBorder()
<< fc::NF_rev_border_line_right; // border right⎹
}
print() << r.getLowerLeftPos() // lower left corner border ⎣
<< fc::NF_border_corner_lower_left;
for (int x = r.getX1() + 1; x < r.getX2(); x++)
print (fc::NF_border_line_bottom); // low line _
// lower right corner border ⎦
print (fc::NF_rev_border_corner_lower_right);
print() << r.getLowerLeftPos()
<< fc::NF_border_corner_lower_left // ⎣
<< FString(r.getWidth() - 2, fc::NF_border_line_bottom) // _
<< fc::NF_rev_border_corner_lower_right; // ⎦
}
else
{
@ -1187,7 +1183,7 @@ void FDialog::leaveMenu()
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------
@ -1232,7 +1228,7 @@ void FDialog::selectFirstMenuItem()
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------

View File

@ -30,7 +30,7 @@ namespace finalcut
namespace fc
{
fkeymap Fkey[] =
FKeyMap fkey[] =
{
{ fc::Fkey_backspace , 0, "kb" }, // backspace key
{ fc::Fkey_catab , 0, "ka" }, // clear-all-tabs key
@ -205,7 +205,7 @@ fkeymap Fkey[] =
{ 0 , 0, "\0" }
};
fmetakeymap Fmetakey[] =
FMetakeyMap fmetakey[] =
{
{ fc::Fmkey_ic , "\033[2;3~" }, // M-insert
{ fc::Fmkey_ic , "\033\033[2~" }, // M-insert
@ -438,7 +438,7 @@ fmetakeymap Fmetakey[] =
{ 0 , "\0" }
};
keyname FkeyName[] =
FKeyName fkeyname[] =
{
{ fc::Fckey_a , "Ctrl+A" },
{ fc::Fckey_b , "Ctrl+B" },

View File

@ -83,9 +83,9 @@ void FKeyboard::fetchKeyCode()
//----------------------------------------------------------------------
const FString FKeyboard::getKeyName (FKey keynum)
{
for (std::size_t i{0}; fc::FkeyName[i].string[0] != 0; i++)
if ( fc::FkeyName[i].num && fc::FkeyName[i].num == keynum )
return FString(fc::FkeyName[i].string);
for (std::size_t i{0}; fc::fkeyname[i].string[0] != 0; i++)
if ( fc::fkeyname[i].num && fc::fkeyname[i].num == keynum )
return FString(fc::fkeyname[i].string);
if ( keynum > 32 && keynum < 127 )
return FString(char(keynum));
@ -94,7 +94,7 @@ const FString FKeyboard::getKeyName (FKey keynum)
}
//----------------------------------------------------------------------
void FKeyboard::setTermcapMap (fc::fkeymap* keymap)
void FKeyboard::setTermcapMap (fc::FKeyMap* keymap)
{
key_map = keymap;
}
@ -231,7 +231,7 @@ inline FKey FKeyboard::getTermcapKey()
fifo_buf[n] = '\0';
input_data_pending = bool(fifo_buf[0] != '\0');
return fc::Fkey[i].num;
return fc::fkey[i].num;
}
}
@ -245,9 +245,9 @@ inline FKey FKeyboard::getMetaKey()
assert ( FIFO_BUF_SIZE > 0 );
for (std::size_t i{0}; fc::Fmetakey[i].string[0] != 0; i++)
for (std::size_t i{0}; fc::fmetakey[i].string[0] != 0; i++)
{
char* kmeta = fc::Fmetakey[i].string; // The string is never null
char* kmeta = fc::fmetakey[i].string; // The string is never null
std::size_t len = std::strlen(kmeta);
if ( std::strncmp(kmeta, fifo_buf, len) == 0 ) // found
@ -269,7 +269,7 @@ inline FKey FKeyboard::getMetaKey()
fifo_buf[n] = '\0';
input_data_pending = bool(fifo_buf[0] != '\0');
return fc::Fmetakey[i].num;
return fc::fmetakey[i].num;
}
}

View File

@ -268,7 +268,7 @@ void FLabel::onMouseDown (FMouseEvent* ev)
{
accel_widget->getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
}
@ -295,7 +295,7 @@ void FLabel::onAccel (FAccelEvent* ev)
{
accel_widget->getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
}
@ -464,7 +464,7 @@ void FLabel::printLine (FString&& line)
else
{
to_column = width - 2;
to_char = getColumnWidthToLength(line, to_column);
to_char = getLengthFromColumnWidth(line, to_column);
}
if ( hasReverseMode() )

View File

@ -596,7 +596,7 @@ void FLineEdit::onAccel (FAccelEvent* ev)
{
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
}
@ -623,7 +623,7 @@ void FLineEdit::onFocusIn (FFocusEvent*)
{
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}

View File

@ -381,7 +381,7 @@ void FListBox::onMouseDown (FMouseEvent* ev)
vbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
@ -449,7 +449,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
vbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
// Auto-scrolling when dragging mouse outside the widget
@ -526,7 +526,7 @@ void FListBox::onTimer (FTimerEvent*)
vbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------
@ -572,7 +572,7 @@ void FListBox::onWheel (FWheelEvent* ev)
vbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------
@ -1116,7 +1116,7 @@ inline void FListBox::updateDrawing (bool draw_vbar, bool draw_hbar)
hbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------
@ -1816,7 +1816,7 @@ void FListBox::cb_VBarChange (FWidget*, FDataPtr)
vbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
@ -1869,7 +1869,7 @@ void FListBox::cb_HBarChange (FWidget*, FDataPtr)
{
drawList();
updateTerminal();
flush_out();
flushOutputBuffer();
}
if ( scrollType >= FScrollbar::scrollStepBackward )
@ -1880,7 +1880,7 @@ void FListBox::cb_HBarChange (FWidget*, FDataPtr)
hbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}

View File

@ -968,7 +968,7 @@ void FListView::onMouseDown (FMouseEvent* ev)
vbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
}
@ -1073,7 +1073,7 @@ void FListView::onMouseMove (FMouseEvent* ev)
vbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
// auto-scrolling when dragging mouse outside the widget
@ -1160,7 +1160,7 @@ void FListView::onTimer (FTimerEvent*)
vbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------
@ -1199,7 +1199,7 @@ void FListView::onWheel (FWheelEvent* ev)
vbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------
@ -1823,7 +1823,7 @@ void FListView::drawBufferedHeadline()
std::size_t offset{0};
bool left_truncated_fullwidth{false};
bool right_truncated_fullwidth{false};
std::vector<charData>::const_iterator first{}, last{};
std::vector<FChar>::const_iterator first{}, last{};
last = headerline.end();
// Search for the start position
@ -1934,7 +1934,7 @@ void FListView::updateDrawing (bool draw_vbar, bool draw_hbar)
hbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------
@ -2642,7 +2642,7 @@ void FListView::cb_VBarChange (FWidget*, FDataPtr)
vbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
@ -2694,7 +2694,7 @@ void FListView::cb_HBarChange (FWidget*, FDataPtr)
drawHeadlines();
drawList();
updateTerminal();
flush_out();
flushOutputBuffer();
}
if ( scrollType >= FScrollbar::scrollStepBackward )
@ -2705,7 +2705,7 @@ void FListView::cb_HBarChange (FWidget*, FDataPtr)
hbar->drawBar();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}

View File

@ -102,7 +102,7 @@ void FMenu::hide()
const auto& t_geometry = getTermGeometryWithShadow();
restoreVTerm (t_geometry);
updateTerminal();
flush_out();
flushOutputBuffer();
if ( ! isSubMenu() )
{
@ -204,7 +204,7 @@ void FMenu::onMouseDown (FMouseEvent* ev)
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
return;
@ -313,7 +313,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
{
closeOpenedSubMenu();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
@ -584,7 +584,7 @@ void FMenu::openSubMenu (FMenu* sub_menu, bool select)
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------
@ -696,7 +696,7 @@ void FMenu::mouseDownSubmenu (FMenuItem* m_item)
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
@ -764,7 +764,7 @@ bool FMenu::mouseUpOverList (FPoint mouse_pos)
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
return true;
@ -1038,7 +1038,7 @@ bool FMenu::selectNextItem()
redraw();
updateTerminal();
flush_out();
flushOutputBuffer();
break;
}
@ -1088,7 +1088,7 @@ bool FMenu::selectPrevItem()
redraw();
updateTerminal();
flush_out();
flushOutputBuffer();
break;
}
}
@ -1151,7 +1151,7 @@ bool FMenu::hotkeyMenu (FKeyEvent* ev)
hide();
hideSuperMenus();
updateTerminal();
flush_out();
flushOutputBuffer();
ev->accept();
item->processClicked();
}
@ -1494,7 +1494,7 @@ inline void FMenu::selectPrevMenu (FKeyEvent* ev)
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
else
keypressMenuBar(ev); // select previous menu
@ -1567,7 +1567,7 @@ inline void FMenu::closeMenu()
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------

View File

@ -971,7 +971,7 @@ void FMenuBar::leaveMenuBar()
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
mouse_down = false;
}

View File

@ -206,7 +206,7 @@ void FMenuItem::setText (const FString& txt)
void FMenuItem::addAccelerator (FKey key, FWidget* obj)
{
auto root = getRootWidget();
accelerator accel = { key, obj };
FAccelerator accel = { key, obj };
if ( root && root->getAcceleratorList() )
{
@ -270,7 +270,7 @@ void FMenuItem::openMenu()
dd_menu->raiseWindow();
dd_menu->redraw();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------

View File

@ -215,7 +215,7 @@ void FMouse::clearButtonState()
// protected methods of FMouse
//----------------------------------------------------------------------
inline FMouse::button& FMouse::getButtonState()
inline FMouse::FMouseButton& FMouse::getButtonState()
{
return b_state;
}

View File

@ -32,7 +32,7 @@ namespace finalcut
// static class attributes
bool FObject::timer_modify_lock;
FObject::TimerList* FObject::timer_list{nullptr};
FObject::FTimerList* FObject::timer_list{nullptr};
const FString* fc::emptyFString::empty_string{nullptr};
@ -58,7 +58,7 @@ FObject::FObject (FObject* parent)
{
try
{
timer_list = new TimerList;
timer_list = new FTimerList;
}
catch (const std::bad_alloc& ex)
{
@ -281,7 +281,7 @@ int FObject::addTimer (int interval)
time_interval.tv_usec = (interval % 1000) * 1000;
getCurrentTime (&currentTime);
timeval timeout = currentTime + time_interval;
timer_data t{ id, time_interval, timeout, this };
FTimerData t{ id, time_interval, timeout, this };
// insert in list sorted by timeout
auto iter = timer_list->begin();

View File

@ -450,7 +450,7 @@ void FOptiAttr::set_orig_orig_colors (char cap[])
}
//----------------------------------------------------------------------
bool FOptiAttr::isNormal (charData*& ch)
bool FOptiAttr::isNormal (FChar*& ch)
{
return hasNoAttribute(ch) && ! hasColor(ch);
}
@ -542,7 +542,7 @@ FColor FOptiAttr::vga2ansi (FColor color)
}
//----------------------------------------------------------------------
char* FOptiAttr::changeAttribute (charData*& term, charData*& next)
char* FOptiAttr::changeAttribute (FChar*& term, FChar*& next)
{
const bool next_has_color = hasColor(next);
fake_reverse = false;
@ -558,7 +558,7 @@ char* FOptiAttr::changeAttribute (charData*& term, charData*& next)
// Simulate invisible characters
if ( ! F_enter_secure_mode.cap && next->attr.bit.invisible )
next->encoded_code = ' ';
next->encoded_char = ' ';
// Look for no changes
if ( ! (switchOn() || switchOff() || hasColorChanged(term, next)) )
@ -584,7 +584,7 @@ char* FOptiAttr::changeAttribute (charData*& term, charData*& next)
// private methods of FOptiAttr
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermBold (charData*& term)
inline bool FOptiAttr::setTermBold (FChar*& term)
{
if ( ! term )
return false;
@ -598,7 +598,7 @@ inline bool FOptiAttr::setTermBold (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermBold (charData*& term)
inline bool FOptiAttr::unsetTermBold (FChar*& term)
{
// Back to normal intensity (turns off bold + dim)
@ -620,7 +620,7 @@ inline bool FOptiAttr::unsetTermBold (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermDim (charData*& term)
inline bool FOptiAttr::setTermDim (FChar*& term)
{
if ( ! term )
return false;
@ -634,7 +634,7 @@ inline bool FOptiAttr::setTermDim (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermDim (charData*& term)
inline bool FOptiAttr::unsetTermDim (FChar*& term)
{
// Back to normal intensity (turns off bold + dim)
@ -656,7 +656,7 @@ inline bool FOptiAttr::unsetTermDim (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermItalic (charData*& term)
inline bool FOptiAttr::setTermItalic (FChar*& term)
{
if ( ! term )
return false;
@ -670,7 +670,7 @@ inline bool FOptiAttr::setTermItalic (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermItalic (charData*& term)
inline bool FOptiAttr::unsetTermItalic (FChar*& term)
{
if ( ! term )
return false;
@ -687,7 +687,7 @@ inline bool FOptiAttr::unsetTermItalic (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermUnderline (charData*& term)
inline bool FOptiAttr::setTermUnderline (FChar*& term)
{
if ( ! term )
return false;
@ -701,7 +701,7 @@ inline bool FOptiAttr::setTermUnderline (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermUnderline (charData*& term)
inline bool FOptiAttr::unsetTermUnderline (FChar*& term)
{
// Turns off every underlining
@ -723,7 +723,7 @@ inline bool FOptiAttr::unsetTermUnderline (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermBlink (charData*& term)
inline bool FOptiAttr::setTermBlink (FChar*& term)
{
if ( ! term )
return false;
@ -737,7 +737,7 @@ inline bool FOptiAttr::setTermBlink (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermBlink (charData*& term)
inline bool FOptiAttr::unsetTermBlink (FChar*& term)
{
if ( ! term )
return false;
@ -754,7 +754,7 @@ inline bool FOptiAttr::unsetTermBlink (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermReverse (charData*& term)
inline bool FOptiAttr::setTermReverse (FChar*& term)
{
if ( ! term )
return false;
@ -768,7 +768,7 @@ inline bool FOptiAttr::setTermReverse (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermReverse (charData*& term)
inline bool FOptiAttr::unsetTermReverse (FChar*& term)
{
if ( ! term )
return false;
@ -785,7 +785,7 @@ inline bool FOptiAttr::unsetTermReverse (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermStandout (charData*& term)
inline bool FOptiAttr::setTermStandout (FChar*& term)
{
if ( ! term )
return false;
@ -799,7 +799,7 @@ inline bool FOptiAttr::setTermStandout (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermStandout (charData*& term)
inline bool FOptiAttr::unsetTermStandout (FChar*& term)
{
if ( ! term )
return false;
@ -816,7 +816,7 @@ inline bool FOptiAttr::unsetTermStandout (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermInvisible (charData*& term)
inline bool FOptiAttr::setTermInvisible (FChar*& term)
{
if ( ! term )
return false;
@ -830,7 +830,7 @@ inline bool FOptiAttr::setTermInvisible (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermInvisible (charData*& term)
inline bool FOptiAttr::unsetTermInvisible (FChar*& term)
{
if ( ! term )
return false;
@ -847,7 +847,7 @@ inline bool FOptiAttr::unsetTermInvisible (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermProtected (charData*& term)
inline bool FOptiAttr::setTermProtected (FChar*& term)
{
if ( ! term )
return false;
@ -861,7 +861,7 @@ inline bool FOptiAttr::setTermProtected (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermProtected (charData*& term)
inline bool FOptiAttr::unsetTermProtected (FChar*& term)
{
if ( ! term )
return false;
@ -878,7 +878,7 @@ inline bool FOptiAttr::unsetTermProtected (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermCrossedOut (charData*& term)
inline bool FOptiAttr::setTermCrossedOut (FChar*& term)
{
if ( ! term )
return false;
@ -892,7 +892,7 @@ inline bool FOptiAttr::setTermCrossedOut (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermCrossedOut (charData*& term)
inline bool FOptiAttr::unsetTermCrossedOut (FChar*& term)
{
if ( ! term )
return false;
@ -909,7 +909,7 @@ inline bool FOptiAttr::unsetTermCrossedOut (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermDoubleUnderline (charData*& term)
inline bool FOptiAttr::setTermDoubleUnderline (FChar*& term)
{
if ( ! term )
return false;
@ -923,7 +923,7 @@ inline bool FOptiAttr::setTermDoubleUnderline (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermDoubleUnderline (charData*& term)
inline bool FOptiAttr::unsetTermDoubleUnderline (FChar*& term)
{
// Turns off every underlining
@ -945,7 +945,7 @@ inline bool FOptiAttr::unsetTermDoubleUnderline (charData*& term)
}
//----------------------------------------------------------------------
bool FOptiAttr::setTermAttributes ( charData*& term
bool FOptiAttr::setTermAttributes ( FChar*& term
, bool p1, bool p2, bool p3
, bool p4, bool p5, bool p6
, bool p7, bool p8, bool p9 )
@ -985,7 +985,7 @@ bool FOptiAttr::setTermAttributes ( charData*& term
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermAttributes (charData*& term)
inline bool FOptiAttr::unsetTermAttributes (FChar*& term)
{
if ( ! term )
return false;
@ -999,7 +999,7 @@ inline bool FOptiAttr::unsetTermAttributes (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermAltCharset (charData*& term)
inline bool FOptiAttr::setTermAltCharset (FChar*& term)
{
if ( ! term )
return false;
@ -1016,7 +1016,7 @@ inline bool FOptiAttr::setTermAltCharset (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermAltCharset (charData*& term)
inline bool FOptiAttr::unsetTermAltCharset (FChar*& term)
{
if ( ! term )
return false;
@ -1033,7 +1033,7 @@ inline bool FOptiAttr::unsetTermAltCharset (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermPCcharset (charData*& term)
inline bool FOptiAttr::setTermPCcharset (FChar*& term)
{
if ( ! term )
return false;
@ -1050,7 +1050,7 @@ inline bool FOptiAttr::setTermPCcharset (charData*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermPCcharset (charData*& term)
inline bool FOptiAttr::unsetTermPCcharset (FChar*& term)
{
if ( ! term )
return false;
@ -1067,7 +1067,7 @@ inline bool FOptiAttr::unsetTermPCcharset (charData*& term)
}
//----------------------------------------------------------------------
bool FOptiAttr::setTermDefaultColor (charData*& term)
bool FOptiAttr::setTermDefaultColor (FChar*& term)
{
if ( ! term )
return false;
@ -1090,7 +1090,7 @@ bool FOptiAttr::setTermDefaultColor (charData*& term)
}
//----------------------------------------------------------------------
void FOptiAttr::setAttributesOn (charData*& term)
void FOptiAttr::setAttributesOn (FChar*& term)
{
if ( on.attr.bit.alt_charset )
setTermAltCharset(term);
@ -1133,7 +1133,7 @@ void FOptiAttr::setAttributesOn (charData*& term)
}
//----------------------------------------------------------------------
void FOptiAttr::setAttributesOff (charData*& term)
void FOptiAttr::setAttributesOff (FChar*& term)
{
if ( off.attr.bit.pc_charset )
unsetTermPCcharset(term);
@ -1176,7 +1176,7 @@ void FOptiAttr::setAttributesOff (charData*& term)
}
//----------------------------------------------------------------------
bool FOptiAttr::hasColor (charData*& attr)
bool FOptiAttr::hasColor (FChar*& attr)
{
if ( attr
&& attr->fg_color == fc::Default
@ -1187,7 +1187,7 @@ bool FOptiAttr::hasColor (charData*& attr)
}
//----------------------------------------------------------------------
bool FOptiAttr::hasAttribute (charData*& attr)
bool FOptiAttr::hasAttribute (FChar*& attr)
{
if ( attr )
{
@ -1210,13 +1210,13 @@ bool FOptiAttr::hasAttribute (charData*& attr)
}
//----------------------------------------------------------------------
bool FOptiAttr::hasNoAttribute (charData*& attr)
bool FOptiAttr::hasNoAttribute (FChar*& attr)
{
return ! hasAttribute(attr);
}
//----------------------------------------------------------------------
inline bool FOptiAttr::hasColorChanged (charData*& term, charData*& next)
inline bool FOptiAttr::hasColorChanged (FChar*& term, FChar*& next)
{
if ( term && next )
{
@ -1233,7 +1233,7 @@ inline bool FOptiAttr::hasColorChanged (charData*& term, charData*& next)
}
//----------------------------------------------------------------------
inline void FOptiAttr::resetColor (charData*& attr)
inline void FOptiAttr::resetColor (FChar*& attr)
{
if ( attr )
{
@ -1243,7 +1243,7 @@ inline void FOptiAttr::resetColor (charData*& attr)
}
//----------------------------------------------------------------------
inline void FOptiAttr::prevent_no_color_video_attributes ( charData*& attr
inline void FOptiAttr::prevent_no_color_video_attributes ( FChar*& attr
, bool next_has_color )
{
// Ignore attributes which can not combined with a color
@ -1304,8 +1304,8 @@ inline void FOptiAttr::prevent_no_color_video_attributes ( charData*& attr
}
//----------------------------------------------------------------------
inline void FOptiAttr::deactivateAttributes ( charData*& term
, charData*& next )
inline void FOptiAttr::deactivateAttributes ( FChar*& term
, FChar*& next )
{
if ( hasAttribute(term) )
{
@ -1328,8 +1328,8 @@ inline void FOptiAttr::deactivateAttributes ( charData*& term
}
//----------------------------------------------------------------------
inline void FOptiAttr::changeAttributeSGR ( charData*& term
, charData*& next )
inline void FOptiAttr::changeAttributeSGR ( FChar*& term
, FChar*& next )
{
bool pc_charset_usable{true};
@ -1378,8 +1378,8 @@ inline void FOptiAttr::changeAttributeSGR ( charData*& term
}
//----------------------------------------------------------------------
inline void FOptiAttr::changeAttributeSeparately ( charData*& term
, charData*& next )
inline void FOptiAttr::changeAttributeSeparately ( FChar*& term
, FChar*& next )
{
setAttributesOff(term);
@ -1391,7 +1391,7 @@ inline void FOptiAttr::changeAttributeSeparately ( charData*& term
}
//----------------------------------------------------------------------
void FOptiAttr::change_color (charData*& term, charData*& next)
void FOptiAttr::change_color (FChar*& term, FChar*& next)
{
if ( ! (term && next) )
return;
@ -1434,8 +1434,8 @@ void FOptiAttr::change_color (charData*& term, charData*& next)
}
//----------------------------------------------------------------------
inline void FOptiAttr::change_to_default_color ( charData*& term
, charData*& next
inline void FOptiAttr::change_to_default_color ( FChar*& term
, FChar*& next
, FColor& fg, FColor& bg )
{
if ( ansi_default_color )
@ -1474,7 +1474,7 @@ inline void FOptiAttr::change_to_default_color ( charData*& term
}
//----------------------------------------------------------------------
inline void FOptiAttr::change_current_color ( charData*& term
inline void FOptiAttr::change_current_color ( FChar*& term
, FColor fg, FColor bg )
{
char* color_str{};
@ -1522,7 +1522,7 @@ inline void FOptiAttr::change_current_color ( charData*& term
}
//----------------------------------------------------------------------
inline void FOptiAttr::resetAttribute (charData*& attr)
inline void FOptiAttr::resetAttribute (FChar*& attr)
{
if ( attr )
{
@ -1532,7 +1532,7 @@ inline void FOptiAttr::resetAttribute (charData*& attr)
}
//----------------------------------------------------------------------
inline void FOptiAttr::reset (charData*& attr)
inline void FOptiAttr::reset (FChar*& attr)
{
if ( attr )
{
@ -1593,7 +1593,7 @@ inline bool FOptiAttr::hasCharsetEquivalence()
}
//----------------------------------------------------------------------
inline void FOptiAttr::detectSwitchOn (charData*& term, charData*& next)
inline void FOptiAttr::detectSwitchOn (FChar*& term, FChar*& next)
{
if ( ! (term && next) )
return;
@ -1614,7 +1614,7 @@ inline void FOptiAttr::detectSwitchOn (charData*& term, charData*& next)
}
//----------------------------------------------------------------------
inline void FOptiAttr::detectSwitchOff (charData*& term, charData*& next)
inline void FOptiAttr::detectSwitchOff (FChar*& term, FChar*& next)
{
if ( ! (term && next) )
return;

View File

@ -133,7 +133,7 @@ void FProgressbar::draw()
if ( getFlags().shadow )
drawShadow(this);
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------
@ -179,7 +179,7 @@ void FProgressbar::drawProgressBar()
setReverse(false);
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------

View File

@ -589,7 +589,7 @@ void FScrollView::onChildFocusOut (FFocusEvent* out_ev)
// protected methods of FScrollView
//----------------------------------------------------------------------
FVTerm::term_area* FScrollView::getPrintArea()
FVTerm::FTermArea* FScrollView::getPrintArea()
{
// returns print area or viewport
@ -675,13 +675,13 @@ void FScrollView::copy2area()
for (int y{0}; y < y_end; y++) // line loop
{
charData* vc{}; // viewport character
charData* ac{}; // area character
FChar* vc{}; // viewport character
FChar* ac{}; // area character
int v_line_len = viewport->width;
int a_line_len = printarea->width + printarea->right_shadow;
vc = &viewport->text[(dy + y) * v_line_len + dx];
ac = &printarea->text[(ay + y) * a_line_len + ax];
std::memcpy (ac, vc, sizeof(charData) * unsigned(x_end));
vc = &viewport->data[(dy + y) * v_line_len + dx];
ac = &printarea->data[(ay + y) * a_line_len + ax];
std::memcpy (ac, vc, sizeof(FChar) * unsigned(x_end));
if ( int(printarea->changes[ay + y].xmin) > ax )
printarea->changes[ay + y].xmin = uInt(ax);

View File

@ -124,7 +124,7 @@ void FSwitch::draw()
drawCheckButton();
FToggleButton::draw();
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------

View File

@ -93,8 +93,6 @@ FMouseControl* FTerm::mouse {nullptr};
FTermDebugData* FTerm::debug_data {nullptr};
#endif
// function prototypes
uInt env2uint (const char*);
//----------------------------------------------------------------------
// class FTerm
@ -416,7 +414,7 @@ FTermDebugData& FTerm::getFTermDebugData()
#endif // DEBUG
//----------------------------------------------------------------------
bool FTerm::isNormal (charData*& ch)
bool FTerm::isNormal (FChar*& ch)
{
return opti_attr->isNormal(ch);
}
@ -1290,8 +1288,8 @@ void FTerm::initScreenSettings()
}
//----------------------------------------------------------------------
char* FTerm::changeAttribute ( charData*& term_attr
, charData*& next_attr )
char* FTerm::changeAttribute ( FChar*& term_attr
, FChar*& next_attr )
{
return opti_attr->changeAttribute (term_attr, next_attr);
}
@ -2268,7 +2266,7 @@ void FTerm::init (bool disable_alt_screen)
init_alt_charset();
// Pass the terminal capabilities to the keyboard object
keyboard->setTermcapMap (fc::Fkey);
keyboard->setTermcapMap (fc::fkey);
// Initializes locale information
init_locale();
@ -2539,258 +2537,4 @@ void FTerm::signal_handler (int signum)
}
}
// FTerm non-member functions
//----------------------------------------------------------------------
uInt env2uint (const char* env)
{
FString str(getenv(env));
if ( str.isEmpty() )
return 0;
try
{
return str.toUInt();
}
catch (const std::exception&)
{
return 0;
}
}
//----------------------------------------------------------------------
wchar_t cp437_to_unicode (uChar c)
{
constexpr std::size_t CP437 = 0;
constexpr std::size_t UNICODE = 1;
wchar_t ucs = c;
for (std::size_t i{0}; i <= fc::lastCP437Item; i++)
{
if ( fc::cp437_ucs[i][CP437] == c ) // found
{
ucs = fc::cp437_ucs[i][UNICODE];
break;
}
}
return ucs;
}
//----------------------------------------------------------------------
uChar unicode_to_cp437 (wchar_t ucs)
{
constexpr std::size_t CP437 = 0;
constexpr std::size_t UNICODE = 1;
uChar c{'?'};
for (std::size_t i{0}; i <= fc::lastCP437Item; i++)
{
if ( fc::cp437_ucs[i][UNICODE] == ucs ) // found
{
c = uChar(fc::cp437_ucs[i][CP437]);
break;
}
}
return c;
}
//----------------------------------------------------------------------
FString getFullWidth (const FString& str)
{
// Converts half-width to full-width characters
FString s(str);
constexpr std::size_t HALF = 0;
constexpr std::size_t FULL = 1;
for (auto&& c : s)
{
if ( c > L'\x20' && c < L'\x7f' ) // half-width ASCII
{
c += 0xfee0;
}
else
{
for (std::size_t i{0}; i <= fc::lastHalfWidthItem; i++)
{
if ( fc::halfWidth_fullWidth[i][HALF] == c ) // found
c = fc::halfWidth_fullWidth[i][FULL];
}
}
}
return s;
}
//----------------------------------------------------------------------
FString getHalfWidth (const FString& str)
{
// Converts full-width to half-width characters
FString s(str);
constexpr std::size_t HALF = 0;
constexpr std::size_t FULL = 1;
for (auto&& c : s)
{
if ( c > L'\xff00' && c < L'\xff5f' ) // full-width ASCII
{
c -= 0xfee0;
}
else
{
for (std::size_t i{0}; i <= fc::lastHalfWidthItem; i++)
{
if ( fc::halfWidth_fullWidth[i][FULL] == c ) // found
c = fc::halfWidth_fullWidth[i][HALF];
}
}
}
return s;
}
//----------------------------------------------------------------------
std::size_t getColumnWidthToLength ( const FString& str
, std::size_t col_len )
{
std::size_t column_width{0}, length{0};
for (auto&& ch : str)
{
if ( column_width < col_len )
{
column_width += getColumnWidth(ch);
length++;
}
}
return length;
}
//----------------------------------------------------------------------
FString getColumnSubString ( const FString& str
, std::size_t col_pos, std::size_t col_len )
{
FString s(str);
std::size_t col_first{1}, col_num{0}, first{1}, num{0};
if ( col_len == 0 || s.isEmpty() )
return FString(L"");
if ( col_pos == 0 )
col_pos = 1;
for (auto&& ch : s)
{
std::size_t width = getColumnWidth(ch);
if ( col_first < col_pos )
{
if ( col_first + width <= col_pos )
{
col_first += width;
first++;
}
else
{
ch = fc::SingleLeftAngleQuotationMark; //
num = col_num = 1;
col_pos = col_first;
}
}
else
{
if ( col_num + width <= col_len )
{
col_num += width;
num++;
}
else if ( col_num < col_len )
{
ch = fc::SingleRightAngleQuotationMark; //
num++;
break;
}
}
}
if ( col_first < col_pos ) // String length < col_pos
return FString(L"");
return s.mid(first, num);
}
//----------------------------------------------------------------------
std::size_t getColumnWidth (const FString& s, std::size_t pos)
{
if ( s.isEmpty() )
return 0;
std::size_t column_width{0};
auto length = s.getLength();
if ( pos > length )
pos = length;
for (std::size_t i{0}; i < pos; i++)
column_width += getColumnWidth(s[i]);
return column_width;
}
//----------------------------------------------------------------------
std::size_t getColumnWidth (const FString& s)
{
if ( s.isEmpty() )
return 0;
const wchar_t* str = s.wc_str();
size_t len = std::wcslen(str);
int column_width = wcswidth (str, len);
return ( column_width == -1 ) ? 0 : std::size_t(column_width);
}
//----------------------------------------------------------------------
std::size_t getColumnWidth (const wchar_t wchar)
{
int column_width{};
if ( wchar >= fc::NF_rev_left_arrow2 && wchar <= fc::NF_check_mark )
column_width = 1;
else
column_width = wcwidth(wchar);
return ( column_width == -1 ) ? 0 : std::size_t(column_width);
}
//----------------------------------------------------------------------
std::size_t getColumnWidth (charData& term_char)
{
std::size_t char_width = getColumnWidth(term_char.code);
if ( char_width == 2 && FTerm::getEncoding() != fc::UTF8 )
{
term_char.code = '.';
term_char.attr.bit.char_width = 1;
}
else
term_char.attr.bit.char_width = char_width & 0x03;
return char_width;
}
//----------------------------------------------------------------------
std::size_t getColumnWidth (const FTermBuffer& termbuffer)
{
std::size_t column_width{0};
for (auto&& tc : termbuffer)
column_width += tc.attr.bit.char_width;
return column_width;
}
} // namespace finalcut

285
src/fterm_functions.cpp Normal file
View File

@ -0,0 +1,285 @@
/***********************************************************************
* fterm_functions.cpp - FTerm helper functions *
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2019 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation; either version 3 of *
* the License, or (at your option) any later version. *
* *
* The Final Cut is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this program. If not, see *
* <http://www.gnu.org/licenses/>. *
***********************************************************************/
#include "final/fcharmap.h"
#include "final/fterm.h"
#include "final/ftermbuffer.h"
namespace finalcut
{
// FTerm non-member functions
//----------------------------------------------------------------------
uInt env2uint (const char* env)
{
FString str(getenv(env));
if ( str.isEmpty() )
return 0;
try
{
return str.toUInt();
}
catch (const std::exception&)
{
return 0;
}
}
//----------------------------------------------------------------------
wchar_t cp437_to_unicode (uChar c)
{
constexpr std::size_t CP437 = 0;
constexpr std::size_t UNICODE = 1;
wchar_t ucs = c;
for (std::size_t i{0}; i <= fc::lastCP437Item; i++)
{
if ( fc::cp437_ucs[i][CP437] == c ) // found
{
ucs = fc::cp437_ucs[i][UNICODE];
break;
}
}
return ucs;
}
//----------------------------------------------------------------------
uChar unicode_to_cp437 (wchar_t ucs)
{
constexpr std::size_t CP437 = 0;
constexpr std::size_t UNICODE = 1;
uChar c{'?'};
for (std::size_t i{0}; i <= fc::lastCP437Item; i++)
{
if ( fc::cp437_ucs[i][UNICODE] == ucs ) // found
{
c = uChar(fc::cp437_ucs[i][CP437]);
break;
}
}
return c;
}
//----------------------------------------------------------------------
FString getFullWidth (const FString& str)
{
// Converts half-width to full-width characters
FString s(str);
constexpr std::size_t HALF = 0;
constexpr std::size_t FULL = 1;
for (auto&& c : s)
{
if ( c > L'\x20' && c < L'\x7f' ) // half-width ASCII
{
c += 0xfee0;
}
else
{
for (std::size_t i{0}; i <= fc::lastHalfWidthItem; i++)
{
if ( fc::halfWidth_fullWidth[i][HALF] == c ) // found
c = fc::halfWidth_fullWidth[i][FULL];
}
}
}
return s;
}
//----------------------------------------------------------------------
FString getHalfWidth (const FString& str)
{
// Converts full-width to half-width characters
FString s(str);
constexpr std::size_t HALF = 0;
constexpr std::size_t FULL = 1;
for (auto&& c : s)
{
if ( c > L'\xff00' && c < L'\xff5f' ) // full-width ASCII
{
c -= 0xfee0;
}
else
{
for (std::size_t i{0}; i <= fc::lastHalfWidthItem; i++)
{
if ( fc::halfWidth_fullWidth[i][FULL] == c ) // found
c = fc::halfWidth_fullWidth[i][HALF];
}
}
}
return s;
}
//----------------------------------------------------------------------
FString getColumnSubString ( const FString& str
, std::size_t col_pos, std::size_t col_len )
{
FString s(str);
std::size_t col_first{1}, col_num{0}, first{1}, num{0};
if ( col_len == 0 || s.isEmpty() )
return FString(L"");
if ( col_pos == 0 )
col_pos = 1;
for (auto&& ch : s)
{
std::size_t width = getColumnWidth(ch);
if ( col_first < col_pos )
{
if ( col_first + width <= col_pos )
{
col_first += width;
first++;
}
else
{
ch = fc::SingleLeftAngleQuotationMark; //
num = col_num = 1;
col_pos = col_first;
}
}
else
{
if ( col_num + width <= col_len )
{
col_num += width;
num++;
}
else if ( col_num < col_len )
{
ch = fc::SingleRightAngleQuotationMark; //
num++;
break;
}
}
}
if ( col_first < col_pos ) // String length < col_pos
return FString(L"");
return s.mid(first, num);
}
//----------------------------------------------------------------------
std::size_t getLengthFromColumnWidth ( const FString& str
, std::size_t col_len )
{
std::size_t column_width{0}, length{0};
for (auto&& ch : str)
{
if ( column_width < col_len )
{
column_width += getColumnWidth(ch);
length++;
}
}
return length;
}
//----------------------------------------------------------------------
std::size_t getColumnWidth (const FString& s, std::size_t pos)
{
if ( s.isEmpty() )
return 0;
std::size_t column_width{0};
auto length = s.getLength();
if ( pos > length )
pos = length;
for (std::size_t i{0}; i < pos; i++)
column_width += getColumnWidth(s[i]);
return column_width;
}
//----------------------------------------------------------------------
std::size_t getColumnWidth (const FString& s)
{
if ( s.isEmpty() )
return 0;
const wchar_t* str = s.wc_str();
size_t len = std::wcslen(str);
int column_width = wcswidth (str, len);
return ( column_width == -1 ) ? 0 : std::size_t(column_width);
}
//----------------------------------------------------------------------
std::size_t getColumnWidth (const wchar_t wchar)
{
int column_width{};
if ( wchar >= fc::NF_rev_left_arrow2 && wchar <= fc::NF_check_mark )
column_width = 1;
else
column_width = wcwidth(wchar);
return ( column_width == -1 ) ? 0 : std::size_t(column_width);
}
//----------------------------------------------------------------------
std::size_t getColumnWidth (FChar& term_char)
{
std::size_t char_width = getColumnWidth(term_char.ch);
if ( char_width == 2 && FTerm::getEncoding() != fc::UTF8 )
{
term_char.ch = '.';
term_char.attr.bit.char_width = 1;
}
else
term_char.attr.bit.char_width = char_width & 0x03;
return char_width;
}
//----------------------------------------------------------------------
std::size_t getColumnWidth (const FTermBuffer& termbuffer)
{
std::size_t column_width{0};
for (auto&& tc : termbuffer)
column_width += tc.attr.bit.char_width;
return column_width;
}
} // namespace finalcut

View File

@ -46,8 +46,8 @@ const FString FTermBuffer::toString() const
std::wstring wide_string{};
wide_string.reserve(data.size());
for (auto&& tc : data)
wide_string.push_back(tc.code);
for (auto&& fchar : data)
wide_string.push_back(fchar.ch);
return FString(wide_string);
}
@ -60,9 +60,9 @@ int FTermBuffer::write (const FString& string)
for (auto&& c : string)
{
charData nc; // next character
FChar nc; // next character
nc = FVTerm::getAttribute();
nc.code = c;
nc.ch = c;
getColumnWidth(nc); // add column width
nc.attr.bit.no_changes = false;
nc.attr.bit.printed = false;
@ -75,8 +75,8 @@ int FTermBuffer::write (const FString& string)
//----------------------------------------------------------------------
int FTermBuffer::write (wchar_t ch)
{
charData nc = FVTerm::getAttribute(); // next character
nc.code = ch;
FChar nc = FVTerm::getAttribute(); // next character
nc.ch = ch;
getColumnWidth(nc); // add column width
nc.attr.bit.no_changes = false;
nc.attr.bit.printed = false;
@ -94,8 +94,8 @@ void FTermBuffer::write (const FColorPair& pair)
// FTermBuffer non-member operators
//----------------------------------------------------------------------
FTermBuffer::charDataVector& operator << ( FTermBuffer::charDataVector& termString
, const FTermBuffer& buf )
FTermBuffer::FCharVector& operator << ( FTermBuffer::FCharVector& termString
, const FTermBuffer& buf )
{
if ( ! buf.data.empty() )
termString.assign(buf.data.begin(), buf.data.end());

View File

@ -230,48 +230,48 @@ void FTermcap::termcapKeys (char*& buffer)
{
// Read termcap key strings
for (std::size_t i{0}; fc::Fkey[i].tname[0] != 0; i++)
for (std::size_t i{0}; fc::fkey[i].tname[0] != 0; i++)
{
fc::Fkey[i].string = tgetstr(fc::Fkey[i].tname, &buffer);
fc::fkey[i].string = tgetstr(fc::fkey[i].tname, &buffer);
// Fallback for rxvt with TERM=xterm
if ( std::strncmp(fc::Fkey[i].tname, "khx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "7~"); // Home key
if ( std::strncmp(fc::fkey[i].tname, "khx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "7~"); // Home key
if ( std::strncmp(fc::Fkey[i].tname, "@7x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "8~"); // End key
if ( std::strncmp(fc::fkey[i].tname, "@7x", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "8~"); // End key
if ( std::strncmp(fc::Fkey[i].tname, "k1x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "11~"); // F1
if ( std::strncmp(fc::fkey[i].tname, "k1x", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "11~"); // F1
if ( std::strncmp(fc::Fkey[i].tname, "k2x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "12~"); // F2
if ( std::strncmp(fc::fkey[i].tname, "k2x", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "12~"); // F2
if ( std::strncmp(fc::Fkey[i].tname, "k3x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "13~"); // F3
if ( std::strncmp(fc::fkey[i].tname, "k3x", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "13~"); // F3
if ( std::strncmp(fc::Fkey[i].tname, "k4x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "14~"); // F4
if ( std::strncmp(fc::fkey[i].tname, "k4x", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "14~"); // F4
// Fallback for TERM=ansi
if ( std::strncmp(fc::Fkey[i].tname, "@7X", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "K"); // End key
if ( std::strncmp(fc::fkey[i].tname, "@7X", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "K"); // End key
// Keypad keys
if ( std::strncmp(fc::Fkey[i].tname, "@8x", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OM"); // Enter key
if ( std::strncmp(fc::fkey[i].tname, "@8x", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OM"); // Enter key
if ( std::strncmp(fc::Fkey[i].tname, "KP1", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Oo"); // Keypad slash
if ( std::strncmp(fc::fkey[i].tname, "KP1", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "Oo"); // Keypad slash
if ( std::strncmp(fc::Fkey[i].tname, "KP2", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Oj"); // Keypad asterisk
if ( std::strncmp(fc::fkey[i].tname, "KP2", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "Oj"); // Keypad asterisk
if ( std::strncmp(fc::Fkey[i].tname, "KP3", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Om"); // Keypad minus sign
if ( std::strncmp(fc::fkey[i].tname, "KP3", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "Om"); // Keypad minus sign
if ( std::strncmp(fc::Fkey[i].tname, "KP4", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Ok"); // Keypad plus sign
if ( std::strncmp(fc::fkey[i].tname, "KP4", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "Ok"); // Keypad plus sign
}
// VT100 key codes for the arrow and function keys
@ -290,31 +290,31 @@ void FTermcap::termcapKeysVt100 (char*& buffer)
|| ( TCAP(fc::t_cursor_up)
&& (std::strcmp(TCAP(fc::t_cursor_up), CSI "A") == 0) ) )
{
for (std::size_t i{0}; fc::Fkey[i].tname[0] != 0; i++)
for (std::size_t i{0}; fc::fkey[i].tname[0] != 0; i++)
{
if ( std::strncmp(fc::Fkey[i].tname, "kux", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "A"); // Key up
if ( std::strncmp(fc::fkey[i].tname, "kux", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "A"); // Key up
if ( std::strncmp(fc::Fkey[i].tname, "kdx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "B"); // Key down
if ( std::strncmp(fc::fkey[i].tname, "kdx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "B"); // Key down
if ( std::strncmp(fc::Fkey[i].tname, "krx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "C"); // Key right
if ( std::strncmp(fc::fkey[i].tname, "krx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "C"); // Key right
if ( std::strncmp(fc::Fkey[i].tname, "klx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "D"); // Key left
if ( std::strncmp(fc::fkey[i].tname, "klx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "D"); // Key left
if ( std::strncmp(fc::Fkey[i].tname, "k1X", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OP"); // PF1
if ( std::strncmp(fc::fkey[i].tname, "k1X", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OP"); // PF1
if ( std::strncmp(fc::Fkey[i].tname, "k2X", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OQ"); // PF2
if ( std::strncmp(fc::fkey[i].tname, "k2X", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OQ"); // PF2
if ( std::strncmp(fc::Fkey[i].tname, "k3X", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OR"); // PF3
if ( std::strncmp(fc::fkey[i].tname, "k3X", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OR"); // PF3
if ( std::strncmp(fc::Fkey[i].tname, "k4X", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OS"); // PF4
if ( std::strncmp(fc::fkey[i].tname, "k4X", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OS"); // PF4
}
}
}

View File

@ -402,71 +402,71 @@ void FTermcapQuirks::sunConsole()
C_STR(CSI "%p1%dD");
// Sun Microsystems workstation console keys
for (std::size_t i{0}; fc::Fkey[i].tname[0] != 0; i++)
for (std::size_t i{0}; fc::fkey[i].tname[0] != 0; i++)
{
if ( std::strncmp(fc::Fkey[i].tname, "K2", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "218z"); // center of keypad
if ( std::strncmp(fc::fkey[i].tname, "K2", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "218z"); // center of keypad
if ( std::strncmp(fc::Fkey[i].tname, "kb", 2) == 0 )
fc::Fkey[i].string = C_STR("\b"); // backspace key
if ( std::strncmp(fc::fkey[i].tname, "kb", 2) == 0 )
fc::fkey[i].string = C_STR("\b"); // backspace key
if ( std::strncmp(fc::Fkey[i].tname, "kD", 2) == 0
&& std::strlen(fc::Fkey[i].tname) == 2 )
fc::Fkey[i].string = C_STR("\177"); // delete-character key
if ( std::strncmp(fc::fkey[i].tname, "kD", 2) == 0
&& std::strlen(fc::fkey[i].tname) == 2 )
fc::fkey[i].string = C_STR("\177"); // delete-character key
if ( std::strncmp(fc::Fkey[i].tname, "@7", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "220z"); // end key
if ( std::strncmp(fc::fkey[i].tname, "@7", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "220z"); // end key
if ( std::strncmp(fc::Fkey[i].tname, "k;", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "233z"); // F10 function key
if ( std::strncmp(fc::fkey[i].tname, "k;", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "233z"); // F10 function key
if ( std::strncmp(fc::Fkey[i].tname, "F1", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "234z"); // F11 function key
if ( std::strncmp(fc::fkey[i].tname, "F1", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "234z"); // F11 function key
if ( std::strncmp(fc::Fkey[i].tname, "F2", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "235z"); // F12 function key
if ( std::strncmp(fc::fkey[i].tname, "F2", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "235z"); // F12 function key
if ( std::strncmp(fc::Fkey[i].tname, "kh", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "214z"); // home key
if ( std::strncmp(fc::fkey[i].tname, "kh", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "214z"); // home key
if ( std::strncmp(fc::Fkey[i].tname, "kI", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "247z"); // insert-character key
if ( std::strncmp(fc::fkey[i].tname, "kI", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "247z"); // insert-character key
if ( std::strncmp(fc::Fkey[i].tname, "kN", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "222z"); // next-page key
if ( std::strncmp(fc::fkey[i].tname, "kN", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "222z"); // next-page key
if ( std::strncmp(fc::Fkey[i].tname, "%7", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "194z"); // options key
if ( std::strncmp(fc::fkey[i].tname, "%7", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "194z"); // options key
if ( std::strncmp(fc::Fkey[i].tname, "kP", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "216z"); // prev-page key
if ( std::strncmp(fc::fkey[i].tname, "kP", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "216z"); // prev-page key
if ( std::strncmp(fc::Fkey[i].tname, "&5", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "193z"); // resume key
if ( std::strncmp(fc::fkey[i].tname, "&5", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "193z"); // resume key
if ( std::strncmp(fc::Fkey[i].tname, "&8", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "195z"); // undo key
if ( std::strncmp(fc::fkey[i].tname, "&8", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "195z"); // undo key
if ( std::strncmp(fc::Fkey[i].tname, "K2", 2) == 0 )
fc::Fkey[i].string = C_STR(CSI "218z"); // center of keypad
if ( std::strncmp(fc::fkey[i].tname, "K2", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "218z"); // center of keypad
if ( std::strncmp(fc::Fkey[i].tname, "kDx", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "249z"); // keypad delete
if ( std::strncmp(fc::fkey[i].tname, "kDx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "249z"); // keypad delete
if ( std::strncmp(fc::Fkey[i].tname, "@8x", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "250z"); // enter/send key
if ( std::strncmp(fc::fkey[i].tname, "@8x", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "250z"); // enter/send key
if ( std::strncmp(fc::Fkey[i].tname, "KP1", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "212z"); // keypad slash
if ( std::strncmp(fc::fkey[i].tname, "KP1", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "212z"); // keypad slash
if ( std::strncmp(fc::Fkey[i].tname, "KP2", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "213z"); // keypad asterisk
if ( std::strncmp(fc::fkey[i].tname, "KP2", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "213z"); // keypad asterisk
if ( std::strncmp(fc::Fkey[i].tname, "KP3", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "254z"); // keypad minus sign
if ( std::strncmp(fc::fkey[i].tname, "KP3", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "254z"); // keypad minus sign
if ( std::strncmp(fc::Fkey[i].tname, "KP4", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "253z"); // keypad plus sign
if ( std::strncmp(fc::fkey[i].tname, "KP4", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "253z"); // keypad plus sign
}
}

View File

@ -45,9 +45,9 @@ namespace finalcut
{
// static class attributes
FTermDetection::terminalType FTermDetection::terminal_type{};
FTermDetection::colorEnv FTermDetection::color_env{};
FTermDetection::secondaryDA FTermDetection::secondary_da{};
FTermDetection::FTerminalType FTermDetection::terminal_type{};
FTermDetection::colorEnv FTermDetection::color_env{};
FTermDetection::secondaryDA FTermDetection::secondary_da{};
FTermData* FTermDetection::fterm_data{nullptr};
FSystem* FTermDetection::fsystem{nullptr};
char FTermDetection::termtype[256]{};

View File

@ -114,7 +114,7 @@ void FTermLinux::setUTF8 (bool enable)
}
//----------------------------------------------------------------------
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
bool FTermLinux::setPalette (FColor index, int r, int g, int b)
{
if ( ! FTerm::isLinuxTerm() )
@ -174,7 +174,7 @@ void FTermLinux::init()
getUnicodeMap();
getScreenFont();
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
// Enable 16 background colors
if ( setBlinkAsIntensity(true) == 0 )
FTermcap::max_color = 16;
@ -246,7 +246,7 @@ void FTermLinux::finish()
{
if ( FTerm::isLinuxTerm() )
{
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
setBlinkAsIntensity (false);
#endif
setLinuxCursorStyle (fc::default_cursor);
@ -383,7 +383,7 @@ bool FTermLinux::saveColorMap()
if ( ! FTerm::isLinuxTerm() )
return false;
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
return saveVGAPalette();
#else
return false;
@ -396,7 +396,7 @@ bool FTermLinux::resetColorMap()
if ( ! FTerm::isLinuxTerm() )
return false;
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
return resetVGAPalette();
#else
return false;
@ -752,7 +752,7 @@ void FTermLinux::setLinuxCursorStyle (CursorStyle style)
FTerm::putstringf (CSI "?%dc", style);
}
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
//----------------------------------------------------------------------
inline uInt16 FTermLinux::getInputStatusRegisterOne()
{
@ -956,7 +956,7 @@ bool FTermLinux::resetVGAPalette()
return true;
}
#endif // defined(__x86_64__) || defined(__i386) || defined(__arm__)
#endif // defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
//----------------------------------------------------------------------
FKey FTermLinux::shiftKeyCorrection (const FKey& key_id)

View File

@ -39,6 +39,11 @@ namespace finalcut
// class FTermOpenBSD
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FTermOpenBSD::~FTermOpenBSD() // destructor
{ }
// public methods of FTermOpenBSD
//----------------------------------------------------------------------
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)

View File

@ -614,7 +614,7 @@ void FTextView::draw()
setCursorPos (FPoint(int(getWidth()), int(getHeight())));
updateTerminal();
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------

View File

@ -235,7 +235,7 @@ void FToggleButton::onMouseDown (FMouseEvent* ev)
{
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
@ -312,7 +312,7 @@ void FToggleButton::onAccel (FAccelEvent* ev)
{
getStatusBar()->drawMessage();
updateTerminal();
flush_out();
flushOutputBuffer();
}
processClick();

File diff suppressed because it is too large Load Diff

View File

@ -772,8 +772,8 @@ FWidget* FWidget::childWidgetAt (const FPoint& pos)
&& ! widget->isWindowWidget()
&& widget->getTermGeometry().contains(pos) )
{
auto child = widget->childWidgetAt(pos);
return ( child != 0 ) ? child : widget;
auto sub_child = widget->childWidgetAt(pos);
return ( sub_child != 0 ) ? sub_child : widget;
}
}
@ -837,7 +837,7 @@ void FWidget::addCallback ( const FString& cb_signal
{
// Add a (normal) function pointer as callback
callback_data obj{ cb_signal, nullptr, cb_function, data };
FCallbackData obj{ cb_signal, nullptr, cb_function, data };
callback_objects.push_back(obj);
}
@ -849,7 +849,7 @@ void FWidget::addCallback ( const FString& cb_signal
{
// Add a member function pointer as callback
callback_data obj{ cb_signal, cb_instance, cb_function, data };
FCallbackData obj{ cb_signal, cb_instance, cb_function, data };
callback_objects.push_back(obj);
}
@ -924,7 +924,7 @@ void FWidget::addAccelerator (FKey key, FWidget* obj)
// Adding a keyboard accelerator for the given widget
auto widget = static_cast<FWidget*>(FWindow::getWindowWidget(obj));
accelerator accel = { key, obj };
FAccelerator accel = { key, obj };
if ( ! widget || widget == statusbar || widget == menubar )
widget = getRootWidget();
@ -990,7 +990,7 @@ void FWidget::redraw()
if ( redraw_root_widget == this )
{
updateTerminal();
flush_out();
flushOutputBuffer();
redraw_root_widget = nullptr;
}
}
@ -1070,7 +1070,7 @@ void FWidget::show()
{
finishTerminalUpdate();
updateTerminal();
flush_out();
flushOutputBuffer();
show_root_widget = nullptr;
}
@ -1201,7 +1201,7 @@ void FWidget::quit()
// protected methods of FWidget
//----------------------------------------------------------------------
FVTerm::term_area* FWidget::getPrintArea()
FVTerm::FTermArea* FWidget::getPrintArea()
{
// returns the print area of this object
@ -1236,7 +1236,7 @@ FVTerm::term_area* FWidget::getPrintArea()
//----------------------------------------------------------------------
void FWidget::addPreprocessingHandler ( FVTerm* instance
, FVTermPreprocessing function )
, FPreprocessingFunction function )
{
if ( ! getCurrentPrintArea() )
FWidget::getPrintArea();
@ -1390,7 +1390,7 @@ void FWidget::hideArea (const FSize& size)
print() << FPoint(1, 1 + y) << FString(size.getWidth(), L' ');
}
flush_out();
flushOutputBuffer();
}
//----------------------------------------------------------------------
@ -1400,7 +1400,7 @@ void FWidget::createWidgetAcceleratorList()
{
try
{
accelerator_list = new Accelerators();
accelerator_list = new FAcceleratorList();
}
catch (const std::bad_alloc& ex)
{
@ -1911,7 +1911,7 @@ bool FWidget::changeFocus ( FWidget* follower, FWidget* parent
redraw();
follower->redraw();
updateTerminal();
flush_out();
flushOutputBuffer();
}
}
@ -1926,8 +1926,8 @@ void FWidget::draw()
void FWidget::drawWindows()
{
// redraw windows
charData default_char{};
default_char.code = ' ';
FChar default_char{};
default_char.ch = ' ';
default_char.fg_color = fc::Black;
default_char.bg_color = fc::Black;
default_char.attr.byte[0] = 0;
@ -1940,10 +1940,10 @@ void FWidget::drawWindows()
{
if ( window->isShown() )
{
auto win = window->getVWin();
int w = win->width + win->right_shadow;
int h = win->height + win->bottom_shadow;
std::fill_n (win->text, w * h, default_char);
auto v_win = window->getVWin();
int w = v_win->width + v_win->right_shadow;
int h = v_win->height + v_win->bottom_shadow;
std::fill_n (v_win->data, w * h, default_char);
window->redraw();
}
}
@ -1997,435 +1997,4 @@ void detectTermSize()
);
}
//----------------------------------------------------------------------
FKey getHotkey (const FString& text)
{
// Returns the hotkey character from a string
// e.g. "E&xit" returns 'x'
if ( text.isEmpty() )
return 0;
std::size_t length = text.getLength();
for (std::size_t i{0}; i < length; i++)
{
try
{
if ( i + 1 < length && text[i] == '&' )
return FKey(text[++i]);
}
catch (const std::out_of_range&)
{
return 0;
}
}
return 0;
}
//----------------------------------------------------------------------
std::size_t getHotkeyPos (const FString& src, FString& dest)
{
// Find hotkey position in string
// + generate a new string without the '&'-sign
constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
std::size_t hotkeypos{NOT_SET};
std::size_t i{0};
for (auto&& ch : src)
{
if ( ch == L'&' && hotkeypos == NOT_SET && src.getLength() != i + 1 )
hotkeypos = i;
else
dest += ch;
i++;
}
return hotkeypos;
}
//----------------------------------------------------------------------
void setHotkeyViaString (FWidget* w, const FString& text)
{
// Set hotkey accelerator via string
if ( ! w )
return;
FKey hotkey = getHotkey(text);
if ( hotkey > 0xff00 && hotkey < 0xff5f ) // full-width character
hotkey -= 0xfee0;
if ( hotkey )
{
if ( std::isalpha(int(hotkey)) || std::isdigit(int(hotkey)) )
{
w->addAccelerator (FKey(std::tolower(int(hotkey))));
w->addAccelerator (FKey(std::toupper(int(hotkey))));
// Meta + hotkey
w->addAccelerator (fc::Fmkey_meta + FKey(std::tolower(int(hotkey))));
}
else
w->addAccelerator (hotkey);
}
else
w->delAccelerator();
}
//----------------------------------------------------------------------
void drawShadow (FWidget* w)
{
if ( w->isMonochron() && ! w->flags.trans_shadow )
return;
if ( (w->getEncoding() == fc::VT100 && ! w->flags.trans_shadow)
|| (w->getEncoding() == fc::ASCII && ! w->flags.trans_shadow) )
{
clearShadow(w);
return;
}
int x1 = 1;
int x2 = int(w->getWidth());
int y1 = 1;
int y2 = int(w->getHeight());
if ( w->flags.trans_shadow )
{
// transparent shadow
drawTransparentShadow (w, x1, y1, x2, y2);
}
else
{
// non-transparent shadow
drawBlockShadow (w, x1, y1, x2, y2);
}
}
//----------------------------------------------------------------------
void drawTransparentShadow (FWidget* w, int x1, int y1, int x2, int y2)
{
// transparent shadow
w->setTransparent();
w->print() << FPoint(x2 + 1, y1) << " ";
w->unsetTransparent();
w->setColor (w->wcolors.shadow_bg, w->wcolors.shadow_fg);
w->setTransShadow();
for (std::size_t y{1}; y < w->getHeight(); y++)
{
w->print() << FPoint(x2 + 1, y1 + int(y)) << " ";
}
w->unsetTransShadow();
w->setTransparent();
w->print() << FPoint(x1, y2 + 1) << " ";
w->unsetTransparent();
w->setColor (w->wcolors.shadow_bg, w->wcolors.shadow_fg);
w->setTransShadow();
for (std::size_t x{2}; x <= w->getWidth() + 1; x++)
w->print (' ');
w->unsetTransShadow();
if ( w->isMonochron() )
w->setReverse(false);
}
//----------------------------------------------------------------------
void drawBlockShadow (FWidget* w, int x1, int y1, int x2, int y2)
{
// non-transparent shadow
if ( ! w->hasShadowCharacter() )
return;
w->print() << FPoint(x2 + 1, y1);
if ( w->isWindowWidget() )
{
w->setColor (w->wcolors.shadow_fg, w->wcolors.shadow_bg);
w->setInheritBackground(); // current background color will be ignored
}
else if ( auto p = w->getParentWidget() )
w->setColor (w->wcolors.shadow_fg, p->getBackgroundColor());
w->print (fc::LowerHalfBlock); // ▄
if ( w->isWindowWidget() )
w->unsetInheritBackground();
for (std::size_t y{1}; y < w->getHeight(); y++)
{
w->print() << FPoint(x2 + 1, y1 + int(y)) << fc::FullBlock; // █
}
w->print() << FPoint(x1 + 1, y2 + 1);
if ( w->isWindowWidget() )
w->setInheritBackground();
for (std::size_t x{1}; x <= w->getWidth(); x++)
w->print (fc::UpperHalfBlock); // ▀
if ( w->isWindowWidget() )
w->unsetInheritBackground();
}
//----------------------------------------------------------------------
void clearShadow (FWidget* w)
{
if ( w->isMonochron() )
return;
int width = int(w->getWidth());
int height = int(w->getHeight());
if ( w->isWindowWidget() )
{
w->setColor (w->wcolors.shadow_fg, w->wcolors.shadow_bg);
w->setInheritBackground(); // current background color will be ignored
}
else if ( auto p = w->getParentWidget() )
w->setColor (w->wcolors.shadow_fg, p->getBackgroundColor());
if ( width <= w->woffset.getX2() )
{
for (std::size_t y{1}; y <= w->getHeight(); y++)
{
w->print() << FPoint(width + 1, int(y)) << ' '; // clear █
}
}
if ( height <= w->woffset.getY2() )
{
w->print() << FPoint(2, height + 1);
for (std::size_t i{1}; i <= w->getWidth(); i++)
w->print (' '); // clear ▀
}
if ( w->isWindowWidget() )
w->unsetInheritBackground();
}
//----------------------------------------------------------------------
void drawFlatBorder (FWidget* w)
{
if ( ! w->isNewFont() )
return;
int x1 = 1;
int x2 = int(w->getWidth() + 1);
int y1 = 0;
int y2 = int(w->getHeight() + 1);
if ( auto p = w->getParentWidget() )
w->setColor (w->wcolors.dialog_fg, p->getBackgroundColor());
else
w->setColor (w->wcolors.dialog_fg, w->wcolors.dialog_bg);
for (std::size_t y{0}; y < w->getHeight(); y++)
{
w->print() << FPoint(x1 - 1, y1 + int(y) + 1);
if ( w->double_flatline_mask.left[uLong(y)] )
// left+right line (on left side)
w->print (fc::NF_rev_border_line_right_and_left);
else
// right line (on left side)
w->print (fc::NF_rev_border_line_right);
}
w->print() << FPoint(x2, y1 + 1);
for (std::size_t y{0}; y < w->getHeight(); y++)
{
if ( w->double_flatline_mask.right[y] )
// left+right line (on right side)
w->print (fc::NF_rev_border_line_right_and_left);
else
// left line (on right side)
w->print (fc::NF_border_line_left);
w->print() << FPoint(x2, y1 + int(y) + 2);
}
w->print() << FPoint(x1, y1);
for (std::size_t x{0}; x < w->getWidth(); x++)
{
if ( w->double_flatline_mask.top[x] )
// top+bottom line (at top)
w->print (fc::NF_border_line_up_and_down);
else
// bottom line (at top)
w->print (fc::NF_border_line_bottom);
}
w->print() << FPoint(x1, y2);
for (std::size_t x{0}; x < w->getWidth(); x++)
{
if ( w->double_flatline_mask.bottom[x] )
// top+bottom line (at bottom)
w->print (fc::NF_border_line_up_and_down);
else
// top line (at bottom)
w->print (fc::NF_border_line_upper);
}
}
//----------------------------------------------------------------------
void clearFlatBorder (FWidget* w)
{
if ( ! w->isNewFont() )
return;
int x1 = 1;
int x2 = int(w->getWidth() + 1);
int y1 = 0;
int y2 = int(w->getHeight() + 1);
if ( auto p = w->getParentWidget() )
w->setColor (w->wcolors.dialog_fg, p->getBackgroundColor());
else
w->setColor (w->wcolors.dialog_fg, w->wcolors.dialog_bg);
// clear on left side
for (std::size_t y{0}; y < w->getHeight(); y++)
{
w->print() << FPoint(x1 - 1, y1 + int(y) + 1);
if ( w->double_flatline_mask.left[y] )
w->print (fc::NF_border_line_left);
else
w->print (' ');
}
// clear on right side
for (std::size_t y{0}; y < w->getHeight(); y++)
{
w->print() << FPoint(x2, y1 + int(y) + 1);
if ( w->double_flatline_mask.right[y] )
w->print (fc::NF_rev_border_line_right);
else
w->print (' ');
}
// clear at top
w->print() << FPoint(x1, y1);
for (std::size_t x{0}; x < w->getWidth(); x++)
{
if ( w->double_flatline_mask.top[x] )
w->print (fc::NF_border_line_upper);
else
w->print (' ');
}
// clear at bottom
w->print() << FPoint(x1, y2);
for (std::size_t x{0}; x < w->getWidth(); x++)
{
if ( w->double_flatline_mask.bottom[x] )
w->print (fc::NF_border_line_bottom);
else
w->print (' ');
}
}
//----------------------------------------------------------------------
inline void drawBox (FWidget* w, const FRect& r)
{
// Use box-drawing characters to draw a border
if ( ! w )
return;
w->print() << r.getUpperLeftPos() << fc::BoxDrawingsDownAndRight; // ┌
for (int x = r.getX1() + 1; x < r.getX2(); x++)
w->print (fc::BoxDrawingsHorizontal); // ─
w->print (fc::BoxDrawingsDownAndLeft); // ┐
for (int y = r.getY1() + 1; y < r.getY2(); y++)
{
w->print() << FPoint(r.getX1(), y)
<< fc::BoxDrawingsVertical // │
<< FPoint(r.getX2(), y)
<< fc::BoxDrawingsVertical; // │
}
w->print() << r.getLowerLeftPos() << fc::BoxDrawingsUpAndRight; // └
for (int x = r.getX1() + 1; x < r.getX2(); x++)
w->print (fc::BoxDrawingsHorizontal); // ─
w->print (fc::BoxDrawingsUpAndLeft); // ┘
}
//----------------------------------------------------------------------
inline void drawNewFontBox (FWidget* w, const FRect& r)
{
// Use new graphical font characters to draw a border
w->print() << r.getUpperLeftPos()
<< fc::NF_border_corner_middle_upper_left; // ┌
for (int x = r.getX1() + 1; x < r.getX2(); x++)
w->print (fc::BoxDrawingsHorizontal); // ─
w->print (fc::NF_border_corner_middle_upper_right); // ┐
for (int y = r.getY1() + 1; y < r.getY2(); y++)
{
w->print() << FPoint(r.getX1(), y)
<< fc::NF_border_line_left // border left ⎸
<< FPoint(r.getX2(), y)
<< fc::NF_rev_border_line_right; // border right⎹
}
w->print() << r.getLowerLeftPos()
<< fc::NF_border_corner_middle_lower_left; // └
for (int x = r.getX1() + 1; x < r.getX2(); x++)
w->print (fc::BoxDrawingsHorizontal); // ─
w->print (fc::NF_border_corner_middle_lower_right); // ┘
}
//----------------------------------------------------------------------
void drawBorder (FWidget* w, FRect r)
{
if ( r.x1_ref() > r.x2_ref() )
std::swap (r.x1_ref(), r.x2_ref());
if ( r.y1_ref() > r.y2_ref() )
std::swap (r.y1_ref(), r.y2_ref());
if ( r.x1_ref() < 1 )
r.x1_ref() = 1;
if ( r.y1_ref() < 1 )
r.y1_ref() = 1;
if ( r.x2_ref() > int(w->getWidth()) )
r.x2_ref() = int(w->getWidth());
if ( r.y2_ref() > int(w->getHeight()) )
r.y2_ref() = int(w->getHeight());
if ( w->isNewFont() )
drawNewFontBox (w, r);
else
drawBox (w, r);
}
} // namespace finalcut

428
src/fwidget_functions.cpp Normal file
View File

@ -0,0 +1,428 @@
/***********************************************************************
* fwidget_functions.cpp - FWidget helper functions *
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2019 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation; either version 3 of *
* the License, or (at your option) any later version. *
* *
* The Final Cut is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this program. If not, see *
* <http://www.gnu.org/licenses/>. *
***********************************************************************/
#include "final/fwidget.h"
#include "final/fwidgetcolors.h"
namespace finalcut
{
// FWidget non-member functions
//----------------------------------------------------------------------
FKey getHotkey (const FString& text)
{
// Returns the hotkey character from a string
// e.g. "E&xit" returns 'x'
if ( text.isEmpty() )
return 0;
std::size_t length = text.getLength();
for (std::size_t i{0}; i < length; i++)
{
try
{
if ( i + 1 < length && text[i] == '&' )
return FKey(text[++i]);
}
catch (const std::out_of_range&)
{
return 0;
}
}
return 0;
}
//----------------------------------------------------------------------
std::size_t getHotkeyPos (const FString& src, FString& dest)
{
// Find hotkey position in string
// + generate a new string without the '&'-sign
constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
std::size_t hotkeypos{NOT_SET};
std::size_t i{0};
for (auto&& ch : src)
{
if ( ch == L'&' && hotkeypos == NOT_SET && src.getLength() != i + 1 )
hotkeypos = i;
else
dest += ch;
i++;
}
return hotkeypos;
}
//----------------------------------------------------------------------
void setHotkeyViaString (FWidget* w, const FString& text)
{
// Set hotkey accelerator via string
if ( ! w )
return;
FKey hotkey = getHotkey(text);
if ( hotkey > 0xff00 && hotkey < 0xff5f ) // full-width character
hotkey -= 0xfee0;
if ( hotkey )
{
if ( std::isalpha(int(hotkey)) || std::isdigit(int(hotkey)) )
{
w->addAccelerator (FKey(std::tolower(int(hotkey))));
w->addAccelerator (FKey(std::toupper(int(hotkey))));
// Meta + hotkey
w->addAccelerator (fc::Fmkey_meta + FKey(std::tolower(int(hotkey))));
}
else
w->addAccelerator (hotkey);
}
else
w->delAccelerator();
}
//----------------------------------------------------------------------
void drawShadow (FWidget* w)
{
if ( w->isMonochron() && ! w->flags.trans_shadow )
return;
if ( (w->getEncoding() == fc::VT100 && ! w->flags.trans_shadow)
|| (w->getEncoding() == fc::ASCII && ! w->flags.trans_shadow) )
{
clearShadow(w);
return;
}
if ( w->flags.trans_shadow )
drawTransparentShadow (w); // transparent shadow
else
drawBlockShadow (w); // non-transparent shadow
}
//----------------------------------------------------------------------
void drawTransparentShadow (FWidget* w)
{
// transparent shadow
std::size_t width = w->getWidth();
std::size_t height = w->getHeight();
w->setTransparent();
w->print() << FPoint(int(width) + 1, 1) << " ";
w->unsetTransparent();
w->setColor (w->wcolors.shadow_bg, w->wcolors.shadow_fg);
w->setTransShadow();
for (std::size_t y{1}; y < height; y++)
{
w->print() << FPoint(int(width) + 1, int(y) + 1) << " ";
}
w->unsetTransShadow();
w->setTransparent();
w->print() << FPoint(1, int(height) + 1) << " ";
w->unsetTransparent();
w->setColor (w->wcolors.shadow_bg, w->wcolors.shadow_fg);
w->setTransShadow();
w->print() << FString(width, L' ');
w->unsetTransShadow();
if ( w->isMonochron() )
w->setReverse(false);
}
//----------------------------------------------------------------------
void drawBlockShadow (FWidget* w)
{
// non-transparent shadow
if ( ! w->hasShadowCharacter() )
return;
std::size_t width = w->getWidth();
std::size_t height = w->getHeight();
w->print() << FPoint(int(width) + 1, 1);
if ( w->isWindowWidget() )
{
w->setColor (w->wcolors.shadow_fg, w->wcolors.shadow_bg);
w->setInheritBackground(); // current background color will be ignored
}
else if ( auto p = w->getParentWidget() )
w->setColor (w->wcolors.shadow_fg, p->getBackgroundColor());
w->print (fc::LowerHalfBlock); // ▄
if ( w->isWindowWidget() )
w->unsetInheritBackground();
for (std::size_t y{1}; y < height; y++)
{
w->print() << FPoint(int(width) + 1, int(y) + 1) << fc::FullBlock; // █
}
w->print() << FPoint(2, int(height) + 1);
if ( w->isWindowWidget() )
w->setInheritBackground();
w->print() << FString(width, fc::UpperHalfBlock); // ▀
if ( w->isWindowWidget() )
w->unsetInheritBackground();
}
//----------------------------------------------------------------------
void clearShadow (FWidget* w)
{
if ( w->isMonochron() )
return;
std::size_t width = w->getWidth();
std::size_t height = w->getHeight();
if ( w->isWindowWidget() )
{
w->setColor (w->wcolors.shadow_fg, w->wcolors.shadow_bg);
w->setInheritBackground(); // current background color will be ignored
}
else if ( auto p = w->getParentWidget() )
w->setColor (w->wcolors.shadow_fg, p->getBackgroundColor());
if ( int(width) <= w->woffset.getX2() )
{
for (std::size_t y{1}; y <= height; y++)
{
w->print() << FPoint(int(width) + 1, int(y)) << ' '; // clear █
}
}
if ( int(height) <= w->woffset.getY2() )
{
w->print() << FPoint(2, int(height) + 1)
<< FString(width, L' '); // clear ▀
}
if ( w->isWindowWidget() )
w->unsetInheritBackground();
}
//----------------------------------------------------------------------
void drawFlatBorder (FWidget* w)
{
if ( ! w->isNewFont() )
return;
if ( auto p = w->getParentWidget() )
w->setColor (w->wcolors.dialog_fg, p->getBackgroundColor());
else
w->setColor (w->wcolors.dialog_fg, w->wcolors.dialog_bg);
std::size_t width = w->getWidth();
std::size_t height = w->getHeight();
for (std::size_t y{0}; y < height; y++)
{
w->print() << FPoint(0, int(y) + 1);
if ( w->double_flatline_mask.left[uLong(y)] )
// left+right line (on left side)
w->print (fc::NF_rev_border_line_right_and_left);
else
// right line (on left side)
w->print (fc::NF_rev_border_line_right);
w->print() << FPoint(int(width) + 1, int(y) + 1);
if ( w->double_flatline_mask.right[y] )
// left+right line (on right side)
w->print (fc::NF_rev_border_line_right_and_left);
else
// left line (on right side)
w->print (fc::NF_border_line_left);
}
w->print() << FPoint(1, 0);
for (std::size_t x{0}; x < width; x++)
{
if ( w->double_flatline_mask.top[x] )
// top+bottom line (at top)
w->print (fc::NF_border_line_up_and_down);
else
// bottom line (at top)
w->print (fc::NF_border_line_bottom);
}
w->print() << FPoint(1, int(height) + 1);
for (std::size_t x{0}; x < width; x++)
{
if ( w->double_flatline_mask.bottom[x] )
// top+bottom line (at bottom)
w->print (fc::NF_border_line_up_and_down);
else
// top line (at bottom)
w->print (fc::NF_border_line_upper);
}
}
//----------------------------------------------------------------------
void clearFlatBorder (FWidget* w)
{
if ( ! w->isNewFont() )
return;
if ( auto p = w->getParentWidget() )
w->setColor (w->wcolors.dialog_fg, p->getBackgroundColor());
else
w->setColor (w->wcolors.dialog_fg, w->wcolors.dialog_bg);
std::size_t width = w->getWidth();
std::size_t height = w->getHeight();
for (std::size_t y{0}; y < height; y++)
{
// clear on left side
w->print() << FPoint(0, int(y) + 1);
if ( w->double_flatline_mask.left[y] )
w->print (fc::NF_border_line_left);
else
w->print (' ');
// clear on right side
w->print() << FPoint(int(width) + 1, int(y) + 1);
if ( w->double_flatline_mask.right[y] )
w->print (fc::NF_rev_border_line_right);
else
w->print (' ');
}
// clear at top
w->print() << FPoint(1, 0);
for (std::size_t x{0}; x < width; x++)
{
if ( w->double_flatline_mask.top[x] )
w->print (fc::NF_border_line_upper);
else
w->print (' ');
}
// clear at bottom
w->print() << FPoint(1, int(height) + 1);
for (std::size_t x{0}; x < width; x++)
{
if ( w->double_flatline_mask.bottom[x] )
w->print (fc::NF_border_line_bottom);
else
w->print (' ');
}
}
//----------------------------------------------------------------------
void drawBorder (FWidget* w, FRect r)
{
if ( r.x1_ref() > r.x2_ref() )
std::swap (r.x1_ref(), r.x2_ref());
if ( r.y1_ref() > r.y2_ref() )
std::swap (r.y1_ref(), r.y2_ref());
if ( r.x1_ref() < 1 )
r.x1_ref() = 1;
if ( r.y1_ref() < 1 )
r.y1_ref() = 1;
if ( r.x2_ref() > int(w->getWidth()) )
r.x2_ref() = int(w->getWidth());
if ( r.y2_ref() > int(w->getHeight()) )
r.y2_ref() = int(w->getHeight());
if ( w->isNewFont() )
drawNewFontBox (w, r);
else
drawBox (w, r);
}
//----------------------------------------------------------------------
inline void drawBox (FWidget* w, const FRect& r)
{
// Use box-drawing characters to draw a border
if ( ! w )
return;
w->print() << r.getUpperLeftPos()
<< fc::BoxDrawingsDownAndRight // ┌
<< FString(r.getWidth() - 2, fc::BoxDrawingsHorizontal) // ─
<< fc::BoxDrawingsDownAndLeft; // ┐
for (int y = r.getY1() + 1; y < r.getY2(); y++)
{
w->print() << FPoint(r.getX1(), y)
<< fc::BoxDrawingsVertical // │
<< FPoint(r.getX2(), y)
<< fc::BoxDrawingsVertical; // │
}
w->print() << r.getLowerLeftPos()
<< fc::BoxDrawingsUpAndRight // └
<< FString(r.getWidth() - 2, fc::BoxDrawingsHorizontal) // ─
<< fc::BoxDrawingsUpAndLeft; // ┘
}
//----------------------------------------------------------------------
inline void drawNewFontBox (FWidget* w, const FRect& r)
{
// Use new graphical font characters to draw a border
w->print() << r.getUpperLeftPos()
<< fc::NF_border_corner_middle_upper_left // ┌
<< FString(r.getWidth() - 2, fc::BoxDrawingsHorizontal) // ─
<< fc::NF_border_corner_middle_upper_right; // ┐
for (int y = r.getY1() + 1; y < r.getY2(); y++)
{
w->print() << FPoint(r.getX1(), y)
<< fc::NF_border_line_left // border left ⎸
<< FPoint(r.getX2(), y)
<< fc::NF_rev_border_line_right; // border right⎹
}
w->print() << r.getLowerLeftPos()
<< fc::NF_border_corner_middle_lower_left // └
<< FString(r.getWidth() - 2, fc::BoxDrawingsHorizontal) // ─
<< fc::NF_border_corner_middle_lower_right; // ┘
}
} // namespace finalcut

View File

@ -117,8 +117,8 @@ class FApplication : public FWidget
// Methods
int exec(); // run
int enter_loop();
void exit_loop();
int enterLoop();
void exitLoop();
static void exit (int = 0);
void quit();
static bool sendEvent (const FObject*, const FEvent*);

View File

@ -33,9 +33,9 @@ namespace finalcut
namespace fc
{
extern fkeymap Fkey[];
extern fmetakeymap Fmetakey[];
extern keyname FkeyName[];
extern FKeyMap fkey[];
extern FMetakeyMap fmetakey[];
extern FKeyName fkeyname[];
} // namespace fc

View File

@ -106,7 +106,7 @@ class FKeyboard final
timeval* getKeyPressedTime();
// Mutators
void setTermcapMap (fc::fkeymap*);
void setTermcapMap (fc::FKeyMap*);
void setKeypressTimeout (const uInt64);
void enableUTF8();
void disableUTF8();
@ -170,7 +170,7 @@ class FKeyboard final
static timeval time_keypressed;
static uInt64 key_timeout;
fc::fkeymap* key_map{nullptr};
fc::FKeyMap* key_map{nullptr};
FKey key{0};
char read_buf[READ_BUF_SIZE]{'\0'};
char fifo_buf[FIFO_BUF_SIZE]{'\0'};

View File

@ -149,7 +149,7 @@ class FMouse
uChar wheel_down : 1; // 0..1
uChar mouse_moved : 1; // 0..1
uChar : 4; // padding bits
} button; // bit field
} FMouseButton; // bit field
enum states
{
@ -160,7 +160,7 @@ class FMouse
};
// Accessors
button& getButtonState();
FMouseButton& getButtonState();
FPoint& getNewPos();
uInt16 getMaxWidth();
uInt16 getMaxHeight();
@ -180,7 +180,7 @@ class FMouse
private:
// Data members
button b_state{};
FMouseButton b_state{};
bool mouse_event_occurred{false};
bool input_data_pending{false};
uInt16 max_width{80};

View File

@ -126,7 +126,7 @@ class FObject
bool delAllTimer();
protected:
struct timer_data
struct FTimerData
{
int id;
timeval interval;
@ -135,10 +135,10 @@ class FObject
};
// Typedefs
typedef std::vector<timer_data> TimerList;
typedef std::vector<FTimerData> FTimerList;
// Accessor
TimerList* getTimerList() const;
FTimerList* getTimerList() const;
// Mutator
void setWidgetProperty (bool);
@ -161,7 +161,7 @@ class FObject
bool has_parent{false};
bool widget_object{false};
static bool timer_modify_lock;
static TimerList* timer_list;
static FTimerList* timer_list;
};
@ -226,7 +226,7 @@ inline bool FObject::isTimerInUpdating() const
{ return timer_modify_lock; }
//----------------------------------------------------------------------
inline FObject::TimerList* FObject::getTimerList() const
inline FObject::FTimerList* FObject::getTimerList() const
{ return timer_list; }
//----------------------------------------------------------------------

View File

@ -126,8 +126,8 @@ class FOptiAttr final
FOptiAttr& operator = (const FOptiAttr&) = delete;
// Friend operator functions
friend bool operator == (const charData&, const charData&);
friend bool operator != (const charData&, const charData&);
friend bool operator == (const FChar&, const FChar&);
friend bool operator != (const FChar&, const FChar&);
// Accessors
const FString getClassName() const;
@ -175,12 +175,12 @@ class FOptiAttr final
void set_orig_orig_colors (char[]);
// Inquiry
static bool isNormal (charData*&);
static bool isNormal (FChar*&);
// Methods
void initialize();
static FColor vga2ansi (FColor);
char* changeAttribute (charData*&, charData*&);
char* changeAttribute (FChar*&, FChar*&);
private:
// Typedefs and Enumerations
@ -223,62 +223,62 @@ class FOptiAttr final
};
// Mutators
bool setTermBold (charData*&);
bool unsetTermBold (charData*&);
bool setTermDim (charData*&);
bool unsetTermDim (charData*&);
bool setTermItalic (charData*&);
bool unsetTermItalic (charData*&);
bool setTermUnderline (charData*&);
bool unsetTermUnderline (charData*&);
bool setTermBlink (charData*&);
bool unsetTermBlink (charData*&);
bool setTermReverse (charData*&);
bool unsetTermReverse (charData*&);
bool setTermStandout (charData*&);
bool unsetTermStandout (charData*&);
bool setTermInvisible (charData*&);
bool unsetTermInvisible (charData*&);
bool setTermProtected (charData*&);
bool unsetTermProtected (charData*&);
bool setTermCrossedOut (charData*&);
bool unsetTermCrossedOut (charData*&);
bool setTermDoubleUnderline (charData*&);
bool unsetTermDoubleUnderline (charData*&);
bool setTermAttributes ( charData*&
bool setTermBold (FChar*&);
bool unsetTermBold (FChar*&);
bool setTermDim (FChar*&);
bool unsetTermDim (FChar*&);
bool setTermItalic (FChar*&);
bool unsetTermItalic (FChar*&);
bool setTermUnderline (FChar*&);
bool unsetTermUnderline (FChar*&);
bool setTermBlink (FChar*&);
bool unsetTermBlink (FChar*&);
bool setTermReverse (FChar*&);
bool unsetTermReverse (FChar*&);
bool setTermStandout (FChar*&);
bool unsetTermStandout (FChar*&);
bool setTermInvisible (FChar*&);
bool unsetTermInvisible (FChar*&);
bool setTermProtected (FChar*&);
bool unsetTermProtected (FChar*&);
bool setTermCrossedOut (FChar*&);
bool unsetTermCrossedOut (FChar*&);
bool setTermDoubleUnderline (FChar*&);
bool unsetTermDoubleUnderline (FChar*&);
bool setTermAttributes ( FChar*&
, bool, bool, bool
, bool, bool, bool
, bool, bool, bool );
bool unsetTermAttributes (charData*&);
bool setTermAltCharset (charData*&);
bool unsetTermAltCharset (charData*&);
bool setTermPCcharset (charData*&);
bool unsetTermPCcharset (charData*&);
bool setTermDefaultColor (charData*&);
void setAttributesOn (charData*&);
void setAttributesOff (charData*&);
bool unsetTermAttributes (FChar*&);
bool setTermAltCharset (FChar*&);
bool unsetTermAltCharset (FChar*&);
bool setTermPCcharset (FChar*&);
bool unsetTermPCcharset (FChar*&);
bool setTermDefaultColor (FChar*&);
void setAttributesOn (FChar*&);
void setAttributesOff (FChar*&);
// Inquiries
static bool hasColor (charData*&);
static bool hasAttribute (charData*&);
static bool hasNoAttribute (charData*&);
static bool hasColor (FChar*&);
static bool hasAttribute (FChar*&);
static bool hasNoAttribute (FChar*&);
// Methods
bool hasColorChanged (charData*&, charData*&);
void resetColor (charData*&);
void prevent_no_color_video_attributes (charData*&, bool = false);
void deactivateAttributes (charData*&, charData*&);
void changeAttributeSGR (charData*&, charData*&);
void changeAttributeSeparately (charData*&, charData*&);
void change_color (charData*&, charData*&);
void change_to_default_color (charData*&, charData*&, FColor&, FColor&);
void change_current_color (charData*&, FColor, FColor);
void resetAttribute (charData*&);
void reset (charData*&);
bool hasColorChanged (FChar*&, FChar*&);
void resetColor (FChar*&);
void prevent_no_color_video_attributes (FChar*&, bool = false);
void deactivateAttributes (FChar*&, FChar*&);
void changeAttributeSGR (FChar*&, FChar*&);
void changeAttributeSeparately (FChar*&, FChar*&);
void change_color (FChar*&, FChar*&);
void change_to_default_color (FChar*&, FChar*&, FColor&, FColor&);
void change_current_color (FChar*&, FColor, FColor);
void resetAttribute (FChar*&);
void reset (FChar*&);
bool caused_reset_attributes (char[], uChar = all_tests);
bool hasCharsetEquivalence();
void detectSwitchOn (charData*&, charData*&);
void detectSwitchOff (charData*&, charData*&);
void detectSwitchOn (FChar*&, FChar*&);
void detectSwitchOff (FChar*&, FChar*&);
bool switchOn();
bool switchOff();
bool append_sequence (char[]);
@ -320,9 +320,9 @@ class FOptiAttr final
capability F_orig_pair{};
capability F_orig_colors{};
charData on{};
charData off{};
charData reset_byte_mask{};
FChar on{};
FChar off{};
FChar reset_byte_mask{};
int max_color{1};
int attr_without_color{0};
@ -337,10 +337,10 @@ class FOptiAttr final
// FOptiAttr inline functions
//----------------------------------------------------------------------
inline bool operator == ( const charData& lhs,
const charData& rhs )
inline bool operator == ( const FChar& lhs,
const FChar& rhs )
{
return lhs.code == rhs.code
return lhs.ch == rhs.ch
&& lhs.fg_color == rhs.fg_color
&& lhs.bg_color == rhs.bg_color
&& lhs.attr.byte[0] == rhs.attr.byte[0]
@ -350,8 +350,8 @@ inline bool operator == ( const charData& lhs,
}
//----------------------------------------------------------------------
inline bool operator != ( const charData& lhs,
const charData& rhs )
inline bool operator != ( const FChar& lhs,
const FChar& rhs )
{ return ! ( lhs == rhs ); }
//----------------------------------------------------------------------

View File

@ -146,7 +146,7 @@ class FScrollView : public FWidget
using FVTerm::clearArea;
// Accessor
term_area* getPrintArea() override;
FTermArea* getPrintArea() override;
// Methods
void adjustSize() override;
@ -182,7 +182,7 @@ class FScrollView : public FWidget
// Data members
FRect scroll_geometry{1, 1, 1, 1};
FRect viewport_geometry{};
term_area* viewport{nullptr}; // virtual scroll content
FTermArea* viewport{nullptr}; // virtual scroll content
FScrollbarPtr vbar{nullptr};
FScrollbarPtr hbar{nullptr};
keyMap key_map{};
@ -279,7 +279,7 @@ inline void FScrollView::initScrollbar ( FScrollbarPtr& bar
, Callback cb_handler )
{
finalcut::initScrollbar (bar, o, this, cb_handler);
term_area* area = getPrintArea();
FTermArea* area = getPrintArea();
bar->setPrintArea(area);
}

View File

@ -210,7 +210,7 @@ class FTerm final
#endif
// Inquiries
static bool isNormal (charData*&);
static bool isNormal (FChar*&);
static bool isRaw();
static bool hasUTF8();
static bool hasVT100();
@ -290,8 +290,8 @@ class FTerm final
static int putchar_UTF8 (int);
static void initScreenSettings();
static char* changeAttribute ( charData*&
, charData*& );
static char* changeAttribute ( FChar*&
, FChar*& );
static void changeTermSizeFinished();
static void exitWithMessage (const FString&)
#if defined(__clang__) || defined(__GNUC__)
@ -385,17 +385,19 @@ class FTerm final
// non-member function forward declarations
// implemented in fterm_functions.cpp
//----------------------------------------------------------------------
uInt env2uint (const char*);
wchar_t cp437_to_unicode (uChar);
uChar unicode_to_cp437 (wchar_t);
FString getFullWidth (const FString&);
FString getHalfWidth (const FString&);
std::size_t getColumnWidthToLength (const FString&, std::size_t);
FString getColumnSubString (const FString&, std::size_t, std::size_t);
std::size_t getLengthFromColumnWidth (const FString&, std::size_t);
std::size_t getColumnWidth (const FString&, std::size_t);
std::size_t getColumnWidth (const FString&);
std::size_t getColumnWidth (const wchar_t);
std::size_t getColumnWidth (charData&);
std::size_t getColumnWidth (FChar&);
std::size_t getColumnWidth (const FTermBuffer&);

View File

@ -54,9 +54,9 @@ class FTermBuffer
{
public:
// Typedef
typedef std::vector<charData> charDataVector;
typedef charDataVector::iterator iterator;
typedef charDataVector::const_iterator const_iterator;
typedef std::vector<FChar> FCharVector;
typedef FCharVector::iterator iterator;
typedef FCharVector::const_iterator const_iterator;
// Constructor
FTermBuffer() = default;
@ -69,19 +69,19 @@ class FTermBuffer
// Overloaded operators
template <typename typeT>
FTermBuffer& operator << (const typeT&);
FTermBuffer& operator << (const charDataVector&);
FTermBuffer& operator << (const FCharVector&);
FTermBuffer& operator << (const std::string&);
FTermBuffer& operator << (const std::wstring&);
FTermBuffer& operator << (const FColorPair&);
// Non-member operators
friend charDataVector& operator << ( charDataVector&
, const FTermBuffer& );
friend FCharVector& operator << ( FCharVector&
, const FTermBuffer& );
// Accessors
virtual const FString getClassName() const;
std::size_t getLength() const;
const charDataVector& getBuffer() const;
const FCharVector& getBuffer() const;
// Inquiry
bool isEmpty() const;
@ -91,8 +91,8 @@ class FTermBuffer
iterator end();
const_iterator begin() const;
const_iterator end() const;
charData front() const;
charData back() const;
FChar front() const;
FChar back() const;
const FString toString() const;
void clear();
template<typename... Args>
@ -103,7 +103,7 @@ class FTermBuffer
FTermBuffer& write ();
private:
charDataVector data{};
FCharVector data{};
};
@ -129,7 +129,7 @@ inline FTermBuffer& FTermBuffer::operator << (const typeT& s)
}
//----------------------------------------------------------------------
inline FTermBuffer& FTermBuffer::operator << (const charDataVector& vec)
inline FTermBuffer& FTermBuffer::operator << (const FCharVector& vec)
{
for (auto&& tc : vec)
data.push_back(tc);
@ -167,7 +167,7 @@ inline std::size_t FTermBuffer::getLength() const
{ return data.size(); }
//----------------------------------------------------------------------
inline const FTermBuffer::charDataVector& FTermBuffer::getBuffer() const
inline const FTermBuffer::FCharVector& FTermBuffer::getBuffer() const
{ return data; }
//----------------------------------------------------------------------
@ -191,11 +191,11 @@ inline FTermBuffer::const_iterator FTermBuffer::end() const
{ return data.end(); }
//----------------------------------------------------------------------
inline charData FTermBuffer::front() const
inline FChar FTermBuffer::front() const
{ return data.front(); }
//----------------------------------------------------------------------
inline charData FTermBuffer::back() const
inline FChar FTermBuffer::back() const
{ return data.back(); }
//----------------------------------------------------------------------

View File

@ -77,7 +77,7 @@ class FTermDetection final
uInt8 screen : 1;
uInt8 tmux : 1;
uInt8 : 5; // padding bits
} terminalType;
} FTerminalType;
// Constructors
FTermDetection();
@ -89,7 +89,7 @@ class FTermDetection final
const FString getClassName() const;
static char* getTermType();
static int getGnomeTerminalID();
terminalType& getTermTypeStruct();
FTerminalType& getTermTypeStruct();
#if DEBUG
static const FString& getAnswerbackString();
@ -199,7 +199,7 @@ class FTermDetection final
static const FString* sec_da;
static FTermData* fterm_data;
static FSystem* fsystem;
static terminalType terminal_type;
static FTerminalType terminal_type;
static struct colorEnv
{
@ -234,7 +234,7 @@ inline int FTermDetection::getGnomeTerminalID()
{ return gnome_terminal_id; }
//----------------------------------------------------------------------
inline FTermDetection::terminalType& FTermDetection::getTermTypeStruct()
inline FTermDetection::FTerminalType& FTermDetection::getTermTypeStruct()
{ return terminal_type; }
#if DEBUG

View File

@ -36,11 +36,18 @@
#endif
#if defined(__linux__)
#include <linux/fb.h> // Linux framebuffer console
#include <linux/fb.h> // Linux framebuffer console
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
#include <sys/io.h> // <asm/io.h> is deprecated
#endif // defined(__x86_64__) || defined(__i386) || defined(__arm__)
#if defined(__arm__) && defined(__GLIBC__) && defined(__GLIBC_PREREQ)
// ISA sysctl support on arm processors only up to glibc-2.29
#if !__GLIBC_PREREQ(2,30)
#define ARM_ISA_SYSCTL
#endif
#endif
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
#include <sys/io.h>
#endif // defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
#include <sys/kd.h>
#endif // defined(__linux__)
@ -150,7 +157,7 @@ class FTermLinux final
void setLinuxCursorStyle (fc::linuxConsoleCursorStyle);
// Methods
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
uInt16 getInputStatusRegisterOne();
uChar readAttributeController (uChar);
void writeAttributeController (uChar, uChar);
@ -162,7 +169,7 @@ class FTermLinux final
bool setVGAPalette (FColor, int, int, int);
bool saveVGAPalette();
bool resetVGAPalette();
#endif // defined(__x86_64__) || defined(__i386) || defined(__arm__)
#endif // defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
FKey shiftKeyCorrection (const FKey&);
FKey ctrlKeyCorrection (const FKey&);
FKey altKeyCorrection (const FKey&);

View File

@ -81,7 +81,7 @@ class FTermOpenBSD final
FTermOpenBSD (const FTermOpenBSD&) = delete;
// Destructor
virtual ~FTermOpenBSD() = default;
virtual ~FTermOpenBSD();
// Disable assignment operator (=)
FTermOpenBSD& operator = (const FTermOpenBSD&) = delete;

View File

@ -53,9 +53,15 @@ class FTermXTerminal final
// Constructors
FTermXTerminal();
// Disable copy constructor
FTermXTerminal (const FTermXTerminal&) = delete;
// Destructor
virtual ~FTermXTerminal();
// Disable assignment operator (=)
FTermXTerminal& operator = (const FTermXTerminal&) = delete;
// Mutators
void redefineDefaultColors (bool);
void setCursorStyle (fc::xtermCursorStyle);

View File

@ -108,8 +108,8 @@ typedef std::unordered_map<wchar_t, wchar_t> charSubstitution;
typedef struct
{
wchar_t code; // character code
wchar_t encoded_code; // encoded output character
wchar_t ch; // character code
wchar_t encoded_char; // encoded output character
FColor fg_color; // foreground color
FColor bg_color; // background color
@ -147,7 +147,7 @@ typedef struct
uInt8 byte[4];
} attr;
} charData;
} FChar;
namespace fc
{
@ -158,21 +158,21 @@ typedef struct
char* string;
char tname[4];
}
fkeymap;
FKeyMap;
typedef struct
{
FKey num;
char string[8];
}
fmetakeymap;
FMetakeyMap;
typedef struct
{
FKey num;
char string[25];
}
keyname;
FKeyName;
} // namespace fc

View File

@ -92,20 +92,20 @@ class FVTerm
uInt xmin; // X-position with the first change
uInt xmax; // X-position with the last change
uInt trans_count; // Number of transparent characters
} line_changes;
} FLineChanges;
typedef void (FVTerm::*FPreprocessingHandler)();
typedef std::function<void()> FVTermPreprocessing;
typedef std::function<void()> FPreprocessingFunction;
struct term_area; // forward declaration
struct FTermArea; // forward declaration
struct vterm_preprocessing
struct FVTermPreprocessing
{
FVTerm* instance;
FVTermPreprocessing function;
FPreprocessingFunction function;
};
typedef std::vector<vterm_preprocessing> FPreprocessing;
typedef std::vector<FVTermPreprocessing> FPreprocessing;
enum covered_state
{
@ -139,7 +139,7 @@ class FVTerm
FVTerm& operator << (fc::SpecialCharacter);
FVTerm& operator << (const std::string&);
FVTerm& operator << (const FTermBuffer&);
FVTerm& operator << (const std::vector<charData>&);
FVTerm& operator << (const std::vector<FChar>&);
FVTerm& operator << (const FPoint&);
FVTerm& operator << (const FColorPair&);
@ -147,10 +147,10 @@ class FVTerm
virtual const FString getClassName() const;
static FColor getTermForegroundColor();
static FColor getTermBackgroundColor();
term_area*& getVWin();
const term_area* getVWin() const;
FTermArea*& getVWin();
const FTermArea* getVWin() const;
FPoint getPrintCursor();
static charData getAttribute();
static FChar getAttribute();
static int getMaxColor();
static int getTabstop();
static fc::encoding getEncoding();
@ -290,20 +290,20 @@ class FVTerm
void updateTerminal (terminal_update);
void updateTerminal();
virtual void addPreprocessingHandler ( FVTerm*
, FVTermPreprocessing );
, FPreprocessingFunction );
virtual void delPreprocessingHandler (FVTerm*);
template<typename... Args>
int printf (const FString, Args&&...);
int print (const FString&);
int print (term_area*, const FString&);
int print (FTermArea*, const FString&);
int print (const FTermBuffer&);
int print (term_area*, const FTermBuffer&);
int print (const std::vector<charData>&);
int print (term_area*, const std::vector<charData>&);
int print (FTermArea*, const FTermBuffer&);
int print (const std::vector<FChar>&);
int print (FTermArea*, const std::vector<FChar>&);
int print (wchar_t);
int print (term_area*, wchar_t);
int print (charData&);
int print (term_area*, charData&);
int print (FTermArea*, wchar_t);
int print (FChar&);
int print (FTermArea*, FChar&);
virtual void print (const FPoint&);
virtual void print (const FColorPair&);
virtual FVTerm& print();
@ -312,10 +312,10 @@ class FVTerm
protected:
// Accessor
virtual term_area* getPrintArea();
term_area* getChildPrintArea() const;
term_area* getCurrentPrintArea() const;
term_area* getVirtualDesktop() const;
virtual FTermArea* getPrintArea();
FTermArea* getChildPrintArea() const;
FTermArea* getCurrentPrintArea() const;
FTermArea* getVirtualDesktop() const;
std::size_t getLineNumber();
std::size_t getColumnNumber();
static bool charEncodable (wchar_t);
@ -323,9 +323,9 @@ class FVTerm
static FMouseControl* getFMouseControl();
// Mutators
void setPrintArea (term_area*);
void setChildPrintArea (term_area*);
void setActiveArea (term_area*);
void setPrintArea (FTermArea*);
void setChildPrintArea (FTermArea*);
void setActiveArea (FTermArea*);
static void setInsertCursor (bool);
static void setInsertCursor();
static void unsetInsertCursor();
@ -341,26 +341,26 @@ class FVTerm
void createArea ( const FRect&
, const FSize&
, term_area*& );
, FTermArea*& );
void resizeArea ( const FRect&
, const FSize&
, term_area* );
static void removeArea (term_area*&);
, FTermArea* );
static void removeArea (FTermArea*&);
static void restoreVTerm (const FRect&);
bool updateVTermCursor (term_area*);
bool updateVTermCursor (FTermArea*);
static void setAreaCursor ( const FPoint&
, bool, term_area* );
static void getArea (const FPoint&, term_area*);
static void getArea (const FRect&, term_area*);
void putArea (term_area*);
static void putArea (const FPoint&, term_area*);
void scrollAreaForward (term_area*);
void scrollAreaReverse (term_area*);
void clearArea (term_area*, int = ' ');
, bool, FTermArea* );
static void getArea (const FPoint&, FTermArea*);
static void getArea (const FRect&, FTermArea*);
void putArea (FTermArea*);
static void putArea (const FPoint&, FTermArea*);
void scrollAreaForward (FTermArea*);
void scrollAreaReverse (FTermArea*);
void clearArea (FTermArea*, int = ' ');
void processTerminalUpdate();
static void startTerminalUpdate();
static void finishTerminalUpdate();
static void flush_out();
static void flushOutputBuffer();
static void initScreenSettings();
static void changeTermSizeFinished();
static void exitWithMessage (const FString&)
@ -388,101 +388,101 @@ class FVTerm
static constexpr uInt TERMINAL_OUTPUT_BUFFER_SIZE = 32768;
// Methods
void setTextToDefault (term_area*, const FSize&);
static bool reallocateTextArea ( term_area*
void setTextToDefault (FTermArea*, const FSize&);
static bool reallocateTextArea ( FTermArea*
, std::size_t
, std::size_t );
static bool reallocateTextArea ( term_area*
static bool reallocateTextArea ( FTermArea*
, std::size_t );
static covered_state isCovered (const FPoint&, term_area*);
static void updateOverlappedColor ( term_area*
static covered_state isCovered (const FPoint&, FTermArea*);
static void updateOverlappedColor ( FTermArea*
, const FPoint&
, const FPoint& );
static void updateOverlappedCharacter ( term_area*
static void updateOverlappedCharacter ( FTermArea*
, const FPoint& );
static void updateShadedCharacter ( term_area*
static void updateShadedCharacter ( FTermArea*
, const FPoint&
, const FPoint& );
static void updateInheritBackground ( term_area*
static void updateInheritBackground ( FTermArea*
, const FPoint&
, const FPoint& );
static void updateCharacter ( term_area*
static void updateCharacter ( FTermArea*
, const FPoint&
, const FPoint& );
static bool updateVTermCharacter ( term_area*
static bool updateVTermCharacter ( FTermArea*
, const FPoint&
, const FPoint& );
void updateVTerm();
static void callPreprocessingHandler (term_area*);
bool hasChildAreaChanges (term_area*);
void clearChildAreaChanges (term_area*);
static bool isInsideArea (const FPoint&, term_area*);
static charData generateCharacter (const FPoint&);
static charData getCharacter ( character_type
static void callPreprocessingHandler (FTermArea*);
bool hasChildAreaChanges (FTermArea*);
void clearChildAreaChanges (FTermArea*);
static bool isInsideArea (const FPoint&, FTermArea*);
static FChar generateCharacter (const FPoint&);
static FChar getCharacter ( character_type
, const FPoint&
, FVTerm* );
static charData getCoveredCharacter (const FPoint&, FVTerm*);
static charData getOverlappedCharacter (const FPoint&, FVTerm*);
static FChar getCoveredCharacter (const FPoint&, FVTerm*);
static FChar getOverlappedCharacter (const FPoint&, FVTerm*);
void init (bool);
static void init_characterLengths (FOptiMove*);
void finish();
static void putAreaLine (charData*, charData*, int);
static void putAreaLine (FChar*, FChar*, int);
static void putAreaCharacter ( const FPoint&, FVTerm*
, charData*, charData* );
static void getAreaCharacter ( const FPoint&, term_area*
, charData*& );
, FChar*, FChar* );
static void getAreaCharacter ( const FPoint&, FTermArea*
, FChar*& );
bool clearTerm (int = ' ');
bool clearFullArea (term_area*, charData&);
static void clearAreaWithShadow (term_area*, charData&);
bool clearFullArea (FTermArea*, FChar&);
static void clearAreaWithShadow (FTermArea*, FChar&);
static bool canClearToEOL (uInt, uInt);
static bool canClearLeadingWS (uInt&, uInt);
static bool canClearTrailingWS (uInt&, uInt);
bool skipUnchangedCharacters (uInt&, uInt, uInt);
void printRange (uInt, uInt, uInt, bool);
void replaceNonPrintableFullwidth (uInt, charData*&);
void printCharacter (uInt&, uInt, bool, charData*&);
void printFullWidthCharacter (uInt&, uInt, charData*&);
void printFullWidthPaddingCharacter (uInt&, uInt, charData*&);
void printHalfCovertFullWidthCharacter (uInt&, uInt, charData*&);
void skipPaddingCharacter (uInt&, uInt, charData*&);
void replaceNonPrintableFullwidth (uInt, FChar*&);
void printCharacter (uInt&, uInt, bool, FChar*&);
void printFullWidthCharacter (uInt&, uInt, FChar*&);
void printFullWidthPaddingCharacter (uInt&, uInt, FChar*&);
void printHalfCovertFullWidthCharacter (uInt&, uInt, FChar*&);
void skipPaddingCharacter (uInt&, uInt, FChar*&);
exit_state eraseCharacters (uInt&, uInt, uInt, bool);
exit_state repeatCharacter (uInt&, uInt, uInt);
bool isFullWidthChar (charData*&);
bool isFullWidthPaddingChar (charData*&);
bool isFullWidthChar (FChar*&);
bool isFullWidthPaddingChar (FChar*&);
static void cursorWrap();
bool printWrap (term_area*);
void printPaddingCharacter (term_area*, charData&);
bool printWrap (FTermArea*);
void printPaddingCharacter (FTermArea*, FChar&);
void updateTerminalLine (uInt);
bool updateTerminalCursor();
bool isInsideTerminal (const FPoint&);
bool isTermSizeChanged();
static void markAsPrinted (uInt, uInt);
static void markAsPrinted (uInt, uInt, uInt);
static void newFontChanges (charData*&);
static void charsetChanges (charData*&);
void appendCharacter (charData*&);
void appendChar (charData*&);
void appendAttributes (charData*&);
int appendLowerRight (charData*&);
static void characterFilter (charData*&);
static void newFontChanges (FChar*&);
static void charsetChanges (FChar*&);
void appendCharacter (FChar*&);
void appendChar (FChar*&);
void appendAttributes (FChar*&);
int appendLowerRight (FChar*&);
static void characterFilter (FChar*&);
static void appendOutputBuffer (const std::string&);
static void appendOutputBuffer (const char[]);
static int appendOutputBuffer (int);
// Data members
term_area* print_area{nullptr}; // print area for this object
term_area* child_print_area{nullptr}; // print area for children
term_area* vwin{nullptr}; // virtual window
FTermArea* print_area{nullptr}; // print area for this object
FTermArea* child_print_area{nullptr}; // print area for children
FTermArea* vwin{nullptr}; // virtual window
static FSystem* fsystem;
static FTerm* fterm;
static term_area* vterm; // virtual terminal
static term_area* vdesktop; // virtual desktop
static term_area* active_area; // active area
static FTermArea* vterm; // virtual terminal
static FTermArea* vdesktop; // virtual desktop
static FTermArea* active_area; // active area
static std::queue<int>* output_buffer;
static charData term_attribute;
static charData next_attribute;
static charData s_ch; // shadow character
static charData i_ch; // inherit background character
static FChar term_attribute;
static FChar next_attribute;
static FChar s_ch; // shadow character
static FChar i_ch; // inherit background character
static FPoint* term_pos; // terminal cursor position
static FKeyboard* keyboard;
static bool terminal_update_complete;
@ -499,21 +499,21 @@ class FVTerm
//----------------------------------------------------------------------
// struct FVTerm::term_area
// struct FVTerm::FTermArea
//----------------------------------------------------------------------
struct FVTerm::term_area // define virtual terminal character properties
struct FVTerm::FTermArea // define virtual terminal character properties
{
public:
// Constructor
term_area() = default;
FTermArea() = default;
// Disable copy constructor
term_area (const term_area&) = delete;
FTermArea (const FTermArea&) = delete;
// Destructor
~term_area() = default;
~FTermArea() = default;
// Disable assignment operator (=)
term_area& operator = (const term_area&) = delete;
FTermArea& operator = (const FTermArea&) = delete;
int offset_left{0}; // Distance from left terminal side
int offset_top{0}; // Distance from top of the terminal
@ -525,10 +525,10 @@ struct FVTerm::term_area // define virtual terminal character properties
int cursor_y{0}; // Y-position for the next write operation
int input_cursor_x{-1}; // X-position input cursor
int input_cursor_y{-1}; // Y-position input cursor
FWidget* widget{nullptr}; // Widget that owns this term_area
FWidget* widget{nullptr}; // Widget that owns this FTermArea
FPreprocessing preproc_list{};
line_changes* changes{nullptr};
charData* text{nullptr}; // Text data for the output
FLineChanges* changes{nullptr};
FChar* data{nullptr}; // FChar data of the drawing area
bool input_cursor_visible{false};
bool has_changes{false};
bool visible{false};
@ -565,7 +565,7 @@ inline FVTerm& FVTerm::operator << (const std::string& string)
//----------------------------------------------------------------------
inline FVTerm& FVTerm::operator << \
(const std::vector<charData>& termString)
(const std::vector<FChar>& termString)
{
print (termString);
return *this;
@ -598,15 +598,15 @@ inline FColor FVTerm::getTermBackgroundColor()
{ return next_attribute.bg_color; }
//----------------------------------------------------------------------
inline FVTerm::term_area*& FVTerm::getVWin()
inline FVTerm::FTermArea*& FVTerm::getVWin()
{ return vwin; }
//----------------------------------------------------------------------
inline const FVTerm::term_area* FVTerm::getVWin() const
inline const FVTerm::FTermArea* FVTerm::getVWin() const
{ return vwin; }
//----------------------------------------------------------------------
inline charData FVTerm::getAttribute()
inline FChar FVTerm::getAttribute()
{ return next_attribute; }
//----------------------------------------------------------------------
@ -1062,15 +1062,15 @@ inline void FVTerm::redefineDefaultColors (bool enable)
{ FTerm::redefineDefaultColors(enable); }
//----------------------------------------------------------------------
inline FVTerm::term_area* FVTerm::getChildPrintArea() const
inline FVTerm::FTermArea* FVTerm::getChildPrintArea() const
{ return child_print_area; }
//----------------------------------------------------------------------
inline FVTerm::term_area* FVTerm::getCurrentPrintArea() const
inline FVTerm::FTermArea* FVTerm::getCurrentPrintArea() const
{ return print_area; }
//----------------------------------------------------------------------
inline FVTerm::term_area* FVTerm::getVirtualDesktop() const
inline FVTerm::FTermArea* FVTerm::getVirtualDesktop() const
{ return vdesktop; }
//----------------------------------------------------------------------
@ -1094,15 +1094,15 @@ inline FMouseControl* FVTerm::getFMouseControl()
{ return FTerm::getFMouseControl(); }
//----------------------------------------------------------------------
inline void FVTerm::setPrintArea (term_area* area)
inline void FVTerm::setPrintArea (FTermArea* area)
{ print_area = area; }
//----------------------------------------------------------------------
inline void FVTerm::setChildPrintArea (term_area* area)
inline void FVTerm::setChildPrintArea (FTermArea* area)
{ child_print_area = area; }
//----------------------------------------------------------------------
inline void FVTerm::setActiveArea (term_area* area)
inline void FVTerm::setActiveArea (FTermArea* area)
{ active_area = area; }
//----------------------------------------------------------------------

View File

@ -139,7 +139,7 @@ class FWidget : public FVTerm, public FObject
using FVTerm::setColor;
using FVTerm::print;
struct accelerator
struct FAccelerator
{
alignas(8) FKey key;
FWidget* object;
@ -147,12 +147,12 @@ class FWidget : public FVTerm, public FObject
// Typedefs
typedef std::vector<FWidget*> FWidgetList;
typedef std::vector<accelerator> Accelerators;
typedef std::vector<FAccelerator> FAcceleratorList;
typedef void (*FCallbackPtr)(FWidget*, FDataPtr);
typedef void (FWidget::*FMemberCallback)(FWidget*, FDataPtr);
typedef std::function<void(FWidget*, FDataPtr)> FCallback;
struct widget_flags // Properties of a widget ⚑
struct FWidgetFlags // Properties of a widget ⚑
{
uInt32 shadow : 1;
uInt32 trans_shadow : 1;
@ -202,7 +202,7 @@ class FWidget : public FVTerm, public FObject
static FStatusBar* getStatusBar();
virtual FWidget* getFirstFocusableWidget (FObjectList);
virtual FWidget* getLastFocusableWidget (FObjectList);
Accelerators* getAcceleratorList() const;
FAcceleratorList* getAcceleratorList() const;
FString getStatusbarMessage() const;
FColor getForegroundColor() const; // get the primary
FColor getBackgroundColor() const; // widget colors
@ -232,7 +232,7 @@ class FWidget : public FVTerm, public FObject
const FRect& getTermGeometryWithShadow();
std::size_t getDesktopWidth();
std::size_t getDesktopHeight();
const widget_flags& getFlags() const;
const FWidgetFlags& getFlags() const;
FPoint getCursorPos();
FPoint getPrintPos();
@ -265,7 +265,7 @@ class FWidget : public FVTerm, public FObject
void setForegroundColor (FColor);
void setBackgroundColor (FColor);
void setColor();
widget_flags& setFlags();
FWidgetFlags& setFlags();
// Positioning and sizes mutators...
virtual void setX (int, bool = true);
virtual void setY (int, bool = true);
@ -345,7 +345,7 @@ class FWidget : public FVTerm, public FObject
static void quit();
protected:
struct callback_data
struct FCallbackData
{
FString cb_signal;
FWidget* cb_instance;
@ -354,16 +354,16 @@ class FWidget : public FVTerm, public FObject
};
// Typedefs
typedef std::vector<callback_data> CallbackObjects;
typedef std::vector<FCallbackData> FCallbackObjects;
// Accessor
term_area* getPrintArea() override;
FTermArea* getPrintArea() override;
const FWidgetColors& getFWidgetColors() const;
static uInt getModalDialogCounter();
static FWidgetList*& getDialogList();
static FWidgetList*& getAlwaysOnTopList();
static FWidgetList*& getWidgetCloseList();
void addPreprocessingHandler (FVTerm*, FVTermPreprocessing) override;
void addPreprocessingHandler (FVTerm*, FPreprocessingFunction) override;
void delPreprocessingHandler (FVTerm*) override;
// Inquiry
@ -466,7 +466,7 @@ class FWidget : public FVTerm, public FObject
int right{0};
} padding{};
struct widget_flags flags{};
struct FWidgetFlags flags{};
bool ignore_padding{false};
// widget size
@ -486,8 +486,8 @@ class FWidget : public FVTerm, public FObject
FColor foreground_color{fc::Default};
FColor background_color{fc::Default};
FString statusbar_message{};
Accelerators* accelerator_list{nullptr};
CallbackObjects callback_objects{};
FAcceleratorList* accelerator_list{nullptr};
FCallbackObjects callback_objects{};
static FStatusBar* statusbar;
static FMenuBar* menubar;
@ -515,8 +515,8 @@ class FWidget : public FVTerm, public FObject
// Friend functions
friend void detectTermSize();
friend void drawShadow (FWidget*);
friend void drawTransparentShadow (FWidget*, int, int, int, int);
friend void drawBlockShadow (FWidget*, int, int, int, int);
friend void drawTransparentShadow (FWidget*);
friend void drawBlockShadow (FWidget*);
friend void clearShadow (FWidget*);
friend void drawFlatBorder (FWidget*);
friend void clearFlatBorder (FWidget*);
@ -524,18 +524,21 @@ class FWidget : public FVTerm, public FObject
// non-member function forward declarations
// implemented in fwidget_functions.cpp
//----------------------------------------------------------------------
void detectTermSize();
FKey getHotkey (const FString&);
std::size_t getHotkeyPos (const FString& src, FString& dest);
void setHotkeyViaString (FWidget*, const FString&);
void drawBorder (FWidget*, FRect);
void drawShadow (FWidget*);
void drawTransparentShadow (FWidget*, int, int, int, int);
void drawBlockShadow (FWidget*, int, int, int, int);
void drawTransparentShadow (FWidget*);
void drawBlockShadow (FWidget*);
void clearShadow (FWidget*);
void drawFlatBorder (FWidget*);
void clearFlatBorder (FWidget*);
void drawBorder (FWidget*, FRect);
void drawBox (FWidget*, const FRect&);
void drawNewFontBox (FWidget*, const FRect&);
// FWidget inline functions
@ -580,7 +583,7 @@ inline FStatusBar* FWidget::getStatusBar()
{ return statusbar; }
//----------------------------------------------------------------------
inline FWidget::Accelerators* FWidget::getAcceleratorList() const
inline FWidget::FAcceleratorList* FWidget::getAcceleratorList() const
{ return accelerator_list; }
//----------------------------------------------------------------------
@ -722,7 +725,7 @@ inline std::size_t FWidget::getDesktopHeight()
{ return getLineNumber(); }
//----------------------------------------------------------------------
inline const FWidget::widget_flags& FWidget::getFlags() const
inline const FWidget::FWidgetFlags& FWidget::getFlags() const
{ return flags; }
//----------------------------------------------------------------------
@ -833,7 +836,7 @@ inline void FWidget::setBackgroundColor (FColor color)
}
//----------------------------------------------------------------------
inline FWidget::widget_flags& FWidget::setFlags()
inline FWidget::FWidgetFlags& FWidget::setFlags()
{ return flags; }
//----------------------------------------------------------------------

View File

@ -40,9 +40,9 @@ typedef struct
char* string;
char tname[4];
}
fkeymap;
FKeyMap;
fkeymap Fkey[] =
FKeyMap fkey[] =
{
{ finalcut::fc::Fkey_backspace , C_STR("\177") , "kb" }, // backspace key
{ finalcut::fc::Fkey_catab , 0 , "ka" }, // clear-all-tabs key
@ -2793,7 +2793,7 @@ void FKeyboardTest::init()
CPPUNIT_ASSERT ( key_pressed == 0 );
keyboard->enableUTF8();
keyboard->enableMouseSequences();
keyboard->setTermcapMap (reinterpret_cast<finalcut::fc::fkeymap*>(test::Fkey));
keyboard->setTermcapMap (reinterpret_cast<finalcut::fc::FKeyMap*>(test::fkey));
}
//----------------------------------------------------------------------

View File

@ -49,7 +49,7 @@ class FObject_protected : public finalcut::FObject
return finalcut::FObject::event(ev);
}
TimerList* getTimerList() const
FTimerList* getTimerList() const
{
return finalcut::FObject::getTimerList();
}

View File

@ -118,7 +118,7 @@ void FOptiAttrTest::classNameTest()
//----------------------------------------------------------------------
void FOptiAttrTest::noArgumentTest()
{
finalcut::charData* ch = new finalcut::charData();
finalcut::FChar* ch = new finalcut::FChar();
finalcut::FOptiAttr oa;
oa.initialize();
@ -130,7 +130,7 @@ void FOptiAttrTest::noArgumentTest()
CPPUNIT_ASSERT ( oa.isNormal(ch) );
// Null test
finalcut::charData* ch_null = nullptr;
finalcut::FChar* ch_null = nullptr;
CPPUNIT_ASSERT ( oa.changeAttribute(ch, ch) == 0 );
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(ch, ch_null), C_STR("") );
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(ch_null, ch), C_STR("") );
@ -204,8 +204,8 @@ void FOptiAttrTest::fakeReverseTest()
oa.set_orig_orig_colors (0);
oa.initialize();
finalcut::charData* from = new finalcut::charData();
finalcut::charData* to = new finalcut::charData();
finalcut::FChar* from = new finalcut::FChar();
finalcut::FChar* to = new finalcut::FChar();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Gray text on blue background
@ -299,8 +299,8 @@ void FOptiAttrTest::ansiTest()
oa.set_orig_orig_colors (0);
oa.initialize();
finalcut::charData* from = new finalcut::charData();
finalcut::charData* to = new finalcut::charData();
finalcut::FChar* from = new finalcut::FChar();
finalcut::FChar* to = new finalcut::FChar();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -764,8 +764,8 @@ void FOptiAttrTest::vt100Test()
oa.set_orig_orig_colors (0);
oa.initialize();
finalcut::charData* from = new finalcut::charData();
finalcut::charData* to = new finalcut::charData();
finalcut::FChar* from = new finalcut::FChar();
finalcut::FChar* to = new finalcut::FChar();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -1235,8 +1235,8 @@ void FOptiAttrTest::xtermTest()
oa.set_orig_orig_colors (0);
oa.initialize();
finalcut::charData* from = new finalcut::charData();
finalcut::charData* to = new finalcut::charData();
finalcut::FChar* from = new finalcut::FChar();
finalcut::FChar* to = new finalcut::FChar();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -1706,8 +1706,8 @@ void FOptiAttrTest::rxvtTest()
oa.set_orig_orig_colors (0);
oa.initialize();
finalcut::charData* from = new finalcut::charData();
finalcut::charData* to = new finalcut::charData();
finalcut::FChar* from = new finalcut::FChar();
finalcut::FChar* to = new finalcut::FChar();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -2178,8 +2178,8 @@ void FOptiAttrTest::linuxTest()
oa.set_orig_orig_colors (C_STR(OSC "R"));
oa.initialize();
finalcut::charData* from = new finalcut::charData();
finalcut::charData* to = new finalcut::charData();
finalcut::FChar* from = new finalcut::FChar();
finalcut::FChar* to = new finalcut::FChar();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -2661,8 +2661,8 @@ void FOptiAttrTest::puttyTest()
oa.initialize();
finalcut::charData* from = new finalcut::charData();
finalcut::charData* to = new finalcut::charData();
finalcut::FChar* from = new finalcut::FChar();
finalcut::FChar* to = new finalcut::FChar();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -3134,8 +3134,8 @@ void FOptiAttrTest::teratermTest()
oa.initialize();
finalcut::charData* from = new finalcut::charData();
finalcut::charData* to = new finalcut::charData();
finalcut::FChar* from = new finalcut::FChar();
finalcut::FChar* to = new finalcut::FChar();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -3609,8 +3609,8 @@ void FOptiAttrTest::ibmColorTest()
oa.initialize();
finalcut::charData* from = new finalcut::charData();
finalcut::charData* to = new finalcut::charData();
finalcut::FChar* from = new finalcut::FChar();
finalcut::FChar* to = new finalcut::FChar();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -4050,8 +4050,8 @@ void FOptiAttrTest::wyse50Test()
oa.setTermEnvironment(optiattr_env);
finalcut::charData* from = new finalcut::charData();
finalcut::charData* to = new finalcut::charData();
finalcut::FChar* from = new finalcut::FChar();
finalcut::FChar* to = new finalcut::FChar();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold

View File

@ -660,91 +660,91 @@ void FTermcapQuirksTest::sunTest()
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_left_cursor].string
, C_STR(CSI "%p1%dD") );
for (std::size_t i = 0; finalcut::fc::Fkey[i].tname[0] != 0; i++)
for (std::size_t i = 0; finalcut::fc::fkey[i].tname[0] != 0; i++)
{
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "K2", 2) == 0 ) // center of keypad
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "K2", 2) == 0 ) // center of keypad
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "218z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kb", 2) == 0 ) // backspace key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kb", 2) == 0 ) // backspace key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR("\b") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kD", 2) == 0
&& std::strlen(finalcut::fc::Fkey[i].tname) == 2 ) // delete-character key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kD", 2) == 0
&& std::strlen(finalcut::fc::fkey[i].tname) == 2 ) // delete-character key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR("\177") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "@7", 2) == 0 ) // end key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "@7", 2) == 0 ) // end key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "220z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "k;", 2) == 0 ) // F10 function key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "k;", 2) == 0 ) // F10 function key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "233z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "F1", 2) == 0 ) // F11 function key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "F1", 2) == 0 ) // F11 function key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "234z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "F2", 2) == 0 ) // F12 function key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "F2", 2) == 0 ) // F12 function key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "235z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kh", 2) == 0 ) // home key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kh", 2) == 0 ) // home key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "214z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kI", 2) == 0 ) // insert-character key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kI", 2) == 0 ) // insert-character key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "247z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kN", 2) == 0 ) // next-page key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kN", 2) == 0 ) // next-page key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "222z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "%7", 2) == 0 ) // options key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "%7", 2) == 0 ) // options key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "194z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kP", 2) == 0 ) // prev-page key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kP", 2) == 0 ) // prev-page key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "216z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "&5", 2) == 0 ) // resume key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "&5", 2) == 0 ) // resume key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "193z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "&8", 2) == 0 ) // undo key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "&8", 2) == 0 ) // undo key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "195z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "K2", 2) == 0 ) // center of keypad
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "K2", 2) == 0 ) // center of keypad
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "218z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kDx", 3) == 0 ) // keypad delete
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kDx", 3) == 0 ) // keypad delete
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "249z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "@8x", 3) == 0 ) // enter/send key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "@8x", 3) == 0 ) // enter/send key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "250z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "KP1", 3) == 0 ) // keypad slash
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "KP1", 3) == 0 ) // keypad slash
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "212z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "KP2", 3) == 0 ) // keypad asterisk
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "KP2", 3) == 0 ) // keypad asterisk
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "213z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "KP3", 3) == 0 ) // keypad minus sign
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "KP3", 3) == 0 ) // keypad minus sign
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "254z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "KP4", 3) == 0 ) // keypad plus sign
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
if ( std::strncmp(finalcut::fc::fkey[i].tname, "KP4", 3) == 0 ) // keypad plus sign
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "253z") );
}