Extract FTerm data members into the data class FTermData
This commit is contained in:
parent
27ad78e21a
commit
8407a9d2b6
|
@ -1,3 +1,6 @@
|
||||||
|
2018-10-01 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Extract FTerm data members into the data class FTermData
|
||||||
|
|
||||||
2018-09-28 Markus Gans <guru.mail@muenster.de>
|
2018-09-28 Markus Gans <guru.mail@muenster.de>
|
||||||
* FListView now has the ability to sort by columns
|
* FListView now has the ability to sort by columns
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ INCLUDES = -I../src/include -I/usr/include/final
|
||||||
RM = rm -f
|
RM = rm -f
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
OPTIMIZE = -O0 -fsanitize=undefined
|
OPTIMIZE = -O0 -fsanitize=bool,bounds,enum,float-cast-overflow,function,null
|
||||||
else
|
else
|
||||||
OPTIMIZE = -O2
|
OPTIMIZE = -O2
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -42,6 +42,7 @@ libfinal_la_SOURCES = \
|
||||||
fkey_map.cpp \
|
fkey_map.cpp \
|
||||||
ftextview.cpp \
|
ftextview.cpp \
|
||||||
fstatusbar.cpp \
|
fstatusbar.cpp \
|
||||||
|
ftermcap.cpp \
|
||||||
ftermcapquirks.cpp \
|
ftermcapquirks.cpp \
|
||||||
ftermxterminal.cpp \
|
ftermxterminal.cpp \
|
||||||
ftermfreebsd.cpp \
|
ftermfreebsd.cpp \
|
||||||
|
@ -108,7 +109,6 @@ finalcutinclude_HEADERS = \
|
||||||
include/final/fscrollview.h \
|
include/final/fscrollview.h \
|
||||||
include/final/fstatusbar.h \
|
include/final/fstatusbar.h \
|
||||||
include/final/fstring.h \
|
include/final/fstring.h \
|
||||||
include/final/ftcap_map.h \
|
|
||||||
include/final/ftermcap.h \
|
include/final/ftermcap.h \
|
||||||
include/final/ftermcapquirks.h \
|
include/final/ftermcapquirks.h \
|
||||||
include/final/ftermxterminal.h \
|
include/final/ftermxterminal.h \
|
||||||
|
|
|
@ -12,10 +12,11 @@ INCLUDE_HEADERS = \
|
||||||
fapplication.h \
|
fapplication.h \
|
||||||
fbuttongroup.h \
|
fbuttongroup.h \
|
||||||
fbutton.h \
|
fbutton.h \
|
||||||
|
ftogglebutton.h \
|
||||||
fcheckbox.h \
|
fcheckbox.h \
|
||||||
fswitch.h \
|
fswitch.h \
|
||||||
fdialog.h \
|
fdialog.h \
|
||||||
fevent.h \
|
fwindow.h \
|
||||||
ffiledialog.h \
|
ffiledialog.h \
|
||||||
final.h \
|
final.h \
|
||||||
flabel.h \
|
flabel.h \
|
||||||
|
@ -23,15 +24,12 @@ INCLUDE_HEADERS = \
|
||||||
flistbox.h \
|
flistbox.h \
|
||||||
flistview.h \
|
flistview.h \
|
||||||
fmenu.h \
|
fmenu.h \
|
||||||
fmouse.h \
|
|
||||||
fkeyboard.h \
|
|
||||||
fdialoglistmenu.h \
|
fdialoglistmenu.h \
|
||||||
fmenubar.h \
|
fmenubar.h \
|
||||||
fradiomenuitem.h \
|
fradiomenuitem.h \
|
||||||
fcheckmenuitem.h \
|
fcheckmenuitem.h \
|
||||||
fmessagebox.h \
|
fmessagebox.h \
|
||||||
ftooltip.h \
|
ftooltip.h \
|
||||||
fobject.h \
|
|
||||||
foptiattr.h \
|
foptiattr.h \
|
||||||
foptimove.h \
|
foptimove.h \
|
||||||
ftermbuffer.h \
|
ftermbuffer.h \
|
||||||
|
@ -43,6 +41,8 @@ INCLUDE_HEADERS = \
|
||||||
fscrollview.h \
|
fscrollview.h \
|
||||||
fstatusbar.h \
|
fstatusbar.h \
|
||||||
fstring.h \
|
fstring.h \
|
||||||
|
fmouse.h \
|
||||||
|
fkeyboard.h \
|
||||||
ftermcap.h \
|
ftermcap.h \
|
||||||
fterm.h \
|
fterm.h \
|
||||||
ftermios.h \
|
ftermios.h \
|
||||||
|
@ -54,11 +54,11 @@ INCLUDE_HEADERS = \
|
||||||
ftermlinux.h \
|
ftermlinux.h \
|
||||||
fvterm.h \
|
fvterm.h \
|
||||||
ftextview.h \
|
ftextview.h \
|
||||||
ftogglebutton.h \
|
|
||||||
fcolorpalette.h \
|
fcolorpalette.h \
|
||||||
fwidgetcolors.h \
|
fwidgetcolors.h \
|
||||||
fwidget.h \
|
fwidget.h \
|
||||||
fwindow.h
|
fevent.h \
|
||||||
|
fobject.h \
|
||||||
|
|
||||||
# compiler parameter
|
# compiler parameter
|
||||||
CXX = clang++
|
CXX = clang++
|
||||||
|
@ -87,8 +87,6 @@ OBJS = \
|
||||||
flistbox.o \
|
flistbox.o \
|
||||||
flistview.o \
|
flistview.o \
|
||||||
fmenu.o \
|
fmenu.o \
|
||||||
fmouse.o \
|
|
||||||
fkeyboard.o \
|
|
||||||
fdialoglistmenu.o \
|
fdialoglistmenu.o \
|
||||||
fmenubar.o \
|
fmenubar.o \
|
||||||
fmenuitem.o \
|
fmenuitem.o \
|
||||||
|
@ -96,14 +94,17 @@ OBJS = \
|
||||||
fcheckmenuitem.o \
|
fcheckmenuitem.o \
|
||||||
fmenulist.o \
|
fmenulist.o \
|
||||||
fdialog.o \
|
fdialog.o \
|
||||||
fscrollview.o \
|
|
||||||
fwindow.o \
|
fwindow.o \
|
||||||
|
fscrollview.o \
|
||||||
fmessagebox.o \
|
fmessagebox.o \
|
||||||
ftooltip.o \
|
ftooltip.o \
|
||||||
ffiledialog.o \
|
ffiledialog.o \
|
||||||
fkey_map.o \
|
fkey_map.o \
|
||||||
ftextview.o \
|
ftextview.o \
|
||||||
fstatusbar.o \
|
fstatusbar.o \
|
||||||
|
fmouse.o \
|
||||||
|
fkeyboard.o \
|
||||||
|
ftermcap.o \
|
||||||
fterm.o \
|
fterm.o \
|
||||||
ftermios.o \
|
ftermios.o \
|
||||||
ftermdetection.o \
|
ftermdetection.o \
|
||||||
|
@ -113,7 +114,6 @@ OBJS = \
|
||||||
ftermopenbsd.o \
|
ftermopenbsd.o \
|
||||||
ftermlinux.o \
|
ftermlinux.o \
|
||||||
fvterm.o \
|
fvterm.o \
|
||||||
fevent.o \
|
|
||||||
foptiattr.o \
|
foptiattr.o \
|
||||||
foptimove.o \
|
foptimove.o \
|
||||||
ftermbuffer.o \
|
ftermbuffer.o \
|
||||||
|
@ -121,12 +121,14 @@ OBJS = \
|
||||||
fcolorpalette.o \
|
fcolorpalette.o \
|
||||||
fwidgetcolors.o \
|
fwidgetcolors.o \
|
||||||
fwidget.o \
|
fwidget.o \
|
||||||
|
fevent.o \
|
||||||
fobject.o
|
fobject.o
|
||||||
|
|
||||||
TERMCAP := $(shell test -n "$$(ldd {/usr,}/lib64/libncursesw.so.5 2>/dev/null | grep libtinfo)" && echo "-ltinfo" || echo "-lncurses")
|
TERMCAP := $(shell test -n "$$(ldd {/usr,}/lib64/libncursesw.so.5 2>/dev/null | grep libtinfo)" && echo "-ltinfo" || echo "-lncurses")
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
OPTIMIZE = -O0 -fsanitize=undefined
|
OPTIMIZE = -O0 -fsanitize=bool,bounds,enum,float-cast-overflow,function,null
|
||||||
|
# OPTIMIZE = -O0 -fsanitize=undefined
|
||||||
else
|
else
|
||||||
OPTIMIZE = -O2
|
OPTIMIZE = -O2
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -12,10 +12,11 @@ INCLUDE_HEADERS = \
|
||||||
fapplication.h \
|
fapplication.h \
|
||||||
fbuttongroup.h \
|
fbuttongroup.h \
|
||||||
fbutton.h \
|
fbutton.h \
|
||||||
|
ftogglebutton.h \
|
||||||
fcheckbox.h \
|
fcheckbox.h \
|
||||||
fswitch.h \
|
fswitch.h \
|
||||||
fdialog.h \
|
fdialog.h \
|
||||||
fevent.h \
|
fwindow.h \
|
||||||
ffiledialog.h \
|
ffiledialog.h \
|
||||||
final.h \
|
final.h \
|
||||||
flabel.h \
|
flabel.h \
|
||||||
|
@ -23,15 +24,12 @@ INCLUDE_HEADERS = \
|
||||||
flistbox.h \
|
flistbox.h \
|
||||||
flistview.h \
|
flistview.h \
|
||||||
fmenu.h \
|
fmenu.h \
|
||||||
fmouse.h \
|
|
||||||
fkeyboard.h \
|
|
||||||
fdialoglistmenu.h \
|
fdialoglistmenu.h \
|
||||||
fmenubar.h \
|
fmenubar.h \
|
||||||
fradiomenuitem.h \
|
fradiomenuitem.h \
|
||||||
fcheckmenuitem.h \
|
fcheckmenuitem.h \
|
||||||
fmessagebox.h \
|
fmessagebox.h \
|
||||||
ftooltip.h \
|
ftooltip.h \
|
||||||
fobject.h \
|
|
||||||
foptiattr.h \
|
foptiattr.h \
|
||||||
foptimove.h \
|
foptimove.h \
|
||||||
ftermbuffer.h \
|
ftermbuffer.h \
|
||||||
|
@ -43,6 +41,8 @@ INCLUDE_HEADERS = \
|
||||||
fscrollview.h \
|
fscrollview.h \
|
||||||
fstatusbar.h \
|
fstatusbar.h \
|
||||||
fstring.h \
|
fstring.h \
|
||||||
|
fmouse.h \
|
||||||
|
fkeyboard.h \
|
||||||
ftermcap.h \
|
ftermcap.h \
|
||||||
fterm.h \
|
fterm.h \
|
||||||
ftermios.h \
|
ftermios.h \
|
||||||
|
@ -54,11 +54,11 @@ INCLUDE_HEADERS = \
|
||||||
ftermlinux.h \
|
ftermlinux.h \
|
||||||
fvterm.h \
|
fvterm.h \
|
||||||
ftextview.h \
|
ftextview.h \
|
||||||
ftogglebutton.h \
|
|
||||||
fcolorpalette.h \
|
fcolorpalette.h \
|
||||||
fwidgetcolors.h \
|
fwidgetcolors.h \
|
||||||
fwidget.h \
|
fwidget.h \
|
||||||
fwindow.h
|
fevent.h \
|
||||||
|
fobject.h
|
||||||
|
|
||||||
# compiler parameter
|
# compiler parameter
|
||||||
CXX = g++
|
CXX = g++
|
||||||
|
@ -87,8 +87,6 @@ OBJS = \
|
||||||
flistbox.o \
|
flistbox.o \
|
||||||
flistview.o \
|
flistview.o \
|
||||||
fmenu.o \
|
fmenu.o \
|
||||||
fmouse.o \
|
|
||||||
fkeyboard.o \
|
|
||||||
fdialoglistmenu.o \
|
fdialoglistmenu.o \
|
||||||
fmenubar.o \
|
fmenubar.o \
|
||||||
fmenuitem.o \
|
fmenuitem.o \
|
||||||
|
@ -96,14 +94,17 @@ OBJS = \
|
||||||
fcheckmenuitem.o \
|
fcheckmenuitem.o \
|
||||||
fmenulist.o \
|
fmenulist.o \
|
||||||
fdialog.o \
|
fdialog.o \
|
||||||
fscrollview.o \
|
|
||||||
fwindow.o \
|
fwindow.o \
|
||||||
|
fscrollview.o \
|
||||||
fmessagebox.o \
|
fmessagebox.o \
|
||||||
ftooltip.o \
|
ftooltip.o \
|
||||||
ffiledialog.o \
|
ffiledialog.o \
|
||||||
fkey_map.o \
|
fkey_map.o \
|
||||||
ftextview.o \
|
ftextview.o \
|
||||||
fstatusbar.o \
|
fstatusbar.o \
|
||||||
|
fmouse.o \
|
||||||
|
fkeyboard.o \
|
||||||
|
ftermcap.o \
|
||||||
fterm.o \
|
fterm.o \
|
||||||
ftermios.o \
|
ftermios.o \
|
||||||
ftermdetection.o \
|
ftermdetection.o \
|
||||||
|
@ -113,7 +114,6 @@ OBJS = \
|
||||||
ftermopenbsd.o \
|
ftermopenbsd.o \
|
||||||
ftermlinux.o \
|
ftermlinux.o \
|
||||||
fvterm.o \
|
fvterm.o \
|
||||||
fevent.o \
|
|
||||||
foptiattr.o \
|
foptiattr.o \
|
||||||
foptimove.o \
|
foptimove.o \
|
||||||
ftermbuffer.o \
|
ftermbuffer.o \
|
||||||
|
@ -121,6 +121,7 @@ OBJS = \
|
||||||
fcolorpalette.o \
|
fcolorpalette.o \
|
||||||
fwidgetcolors.o \
|
fwidgetcolors.o \
|
||||||
fwidget.o \
|
fwidget.o \
|
||||||
|
fevent.o \
|
||||||
fobject.o
|
fobject.o
|
||||||
|
|
||||||
TERMCAP := $(shell test -n "$$(ldd {/usr,}/lib64/libncursesw.so.5 2>/dev/null | grep libtinfo)" && echo "-ltinfo" || echo "-lncurses")
|
TERMCAP := $(shell test -n "$$(ldd {/usr,}/lib64/libncursesw.so.5 2>/dev/null | grep libtinfo)" && echo "-ltinfo" || echo "-lncurses")
|
||||||
|
|
|
@ -1548,15 +1548,31 @@ inline void FDialog::lowerActivateDialog()
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool FDialog::isLowerRightResizeCorner (mouseStates& ms)
|
||||||
|
{
|
||||||
|
// 3 characters in the lower right corner |
|
||||||
|
// x
|
||||||
|
// -----xx
|
||||||
|
|
||||||
|
if ( (ms.mouse_x == getWidth() && ms.mouse_y == getHeight() - 1)
|
||||||
|
|| ( ( ms.mouse_x == getWidth() - 1
|
||||||
|
|| ms.mouse_x == getWidth() ) && ms.mouse_y == getHeight() ) )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::resizeMouseDown (mouseStates& ms)
|
void FDialog::resizeMouseDown (mouseStates& ms)
|
||||||
{
|
{
|
||||||
// Click on the lower right resize corner
|
// Click on the lower right resize corner
|
||||||
|
|
||||||
if ( isResizeable()
|
if ( isResizeable() && isLowerRightResizeCorner(ms) )
|
||||||
&& ( (ms.mouse_x == getWidth() && ms.mouse_y == getHeight() - 1)
|
|
||||||
|| ( (ms.mouse_x == getWidth() - 1
|
|
||||||
|| ms.mouse_x == getWidth()) && ms.mouse_y == getHeight()) ) )
|
|
||||||
{
|
{
|
||||||
resize_click_pos = ms.termPos;
|
resize_click_pos = ms.termPos;
|
||||||
FPoint lower_right_pos = getTermGeometry().getLowerRightPos();
|
FPoint lower_right_pos = getTermGeometry().getLowerRightPos();
|
||||||
|
|
|
@ -79,7 +79,7 @@ FKeyboard::FKeyboard()
|
||||||
, keypressed_cmd()
|
, keypressed_cmd()
|
||||||
, keyreleased_cmd()
|
, keyreleased_cmd()
|
||||||
, escape_key_cmd()
|
, escape_key_cmd()
|
||||||
, termcap_map(0)
|
, key_map(0)
|
||||||
{
|
{
|
||||||
// Initialize keyboard values
|
// Initialize keyboard values
|
||||||
time_keypressed.tv_sec = 0;
|
time_keypressed.tv_sec = 0;
|
||||||
|
@ -123,7 +123,7 @@ const FString FKeyboard::getKeyName (int keynum)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FKeyboard::setTermcapMap (fc::fkeymap* keymap)
|
void FKeyboard::setTermcapMap (fc::fkeymap* keymap)
|
||||||
{
|
{
|
||||||
termcap_map = keymap;
|
key_map = keymap;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -232,10 +232,10 @@ inline int FKeyboard::getTermcapKey()
|
||||||
|
|
||||||
assert ( fifo_buf_size > 0 );
|
assert ( fifo_buf_size > 0 );
|
||||||
|
|
||||||
if ( ! termcap_map )
|
if ( ! key_map )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
fc::fkeymap* keymap = reinterpret_cast<fc::fkeymap*>(termcap_map);
|
fc::fkeymap* keymap = reinterpret_cast<fc::fkeymap*>(key_map);
|
||||||
for (int i = 0; keymap[i].tname[0] != 0; i++)
|
for (int i = 0; keymap[i].tname[0] != 0; i++)
|
||||||
{
|
{
|
||||||
char* k = keymap[i].string;
|
char* k = keymap[i].string;
|
||||||
|
|
|
@ -789,42 +789,14 @@ int FListView::addColumn (const FString& label, int width)
|
||||||
FObject::FObjectIterator FListView::insert ( FListViewItem* item
|
FObject::FObjectIterator FListView::insert ( FListViewItem* item
|
||||||
, FObjectIterator parent_iter )
|
, FObjectIterator parent_iter )
|
||||||
{
|
{
|
||||||
static const int padding_space = 1;
|
|
||||||
int line_width = padding_space; // leading space
|
|
||||||
uInt column_idx = 0;
|
|
||||||
uInt entries = uInt(item->column_list.size());
|
|
||||||
FObjectIterator item_iter;
|
FObjectIterator item_iter;
|
||||||
headerItems::iterator header_iter;
|
int line_width;
|
||||||
|
int element_count;
|
||||||
|
|
||||||
if ( parent_iter == FListView::null_iter )
|
if ( parent_iter == FListView::null_iter )
|
||||||
return FListView::null_iter;
|
return FListView::null_iter;
|
||||||
|
|
||||||
// Determine the line width
|
line_width = determineLineWidth (item);
|
||||||
header_iter = header.begin();
|
|
||||||
|
|
||||||
while ( header_iter != header.end() )
|
|
||||||
{
|
|
||||||
int width = header_iter->width;
|
|
||||||
bool fixed_width = header_iter->fixed_width;
|
|
||||||
|
|
||||||
if ( ! fixed_width )
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
|
|
||||||
if ( column_idx < entries )
|
|
||||||
len = int(item->column_list[column_idx].getLength());
|
|
||||||
else
|
|
||||||
len = 0;
|
|
||||||
|
|
||||||
if ( len > width )
|
|
||||||
header_iter->width = len;
|
|
||||||
}
|
|
||||||
|
|
||||||
line_width += header_iter->width + padding_space; // width + trailing space
|
|
||||||
column_idx++;
|
|
||||||
++header_iter;
|
|
||||||
}
|
|
||||||
|
|
||||||
recalculateHorizontalBar (line_width);
|
recalculateHorizontalBar (line_width);
|
||||||
|
|
||||||
if ( parent_iter == root )
|
if ( parent_iter == root )
|
||||||
|
@ -862,7 +834,7 @@ FObject::FObjectIterator FListView::insert ( FListViewItem* item
|
||||||
// Sort list by a column (only if activated)
|
// Sort list by a column (only if activated)
|
||||||
sort();
|
sort();
|
||||||
|
|
||||||
int element_count = int(getCount());
|
element_count = int(getCount());
|
||||||
recalculateVerticalBar (element_count);
|
recalculateVerticalBar (element_count);
|
||||||
return item_iter;
|
return item_iter;
|
||||||
}
|
}
|
||||||
|
@ -1862,6 +1834,42 @@ void FListView::updateDrawing (bool draw_vbar, bool draw_hbar)
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
int FListView::determineLineWidth (FListViewItem* item)
|
||||||
|
{
|
||||||
|
static const int padding_space = 1;
|
||||||
|
int line_width = padding_space; // leading space
|
||||||
|
uInt column_idx = 0;
|
||||||
|
uInt entries = uInt(item->column_list.size());
|
||||||
|
headerItems::iterator header_iter;
|
||||||
|
header_iter = header.begin();
|
||||||
|
|
||||||
|
while ( header_iter != header.end() )
|
||||||
|
{
|
||||||
|
int width = header_iter->width;
|
||||||
|
bool fixed_width = header_iter->fixed_width;
|
||||||
|
|
||||||
|
if ( ! fixed_width )
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if ( column_idx < entries )
|
||||||
|
len = int(item->column_list[column_idx].getLength());
|
||||||
|
else
|
||||||
|
len = 0;
|
||||||
|
|
||||||
|
if ( len > width )
|
||||||
|
header_iter->width = len;
|
||||||
|
}
|
||||||
|
|
||||||
|
line_width += header_iter->width + padding_space; // width + trailing space
|
||||||
|
column_idx++;
|
||||||
|
++header_iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
return line_width;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::recalculateHorizontalBar (int len)
|
void FListView::recalculateHorizontalBar (int len)
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,7 +65,10 @@ FOptiMove::FOptiMove (int baud)
|
||||||
, screen_height(24)
|
, screen_height(24)
|
||||||
{
|
{
|
||||||
assert ( baud >= 0 );
|
assert ( baud >= 0 );
|
||||||
move_buf[0] = '\0';
|
|
||||||
|
// Initialize arrays with '\0'
|
||||||
|
std::fill_n (move_buf, sizeof(move_buf), '\0');
|
||||||
|
|
||||||
calculateCharDuration();
|
calculateCharDuration();
|
||||||
|
|
||||||
// ANSI set cursor address preset for undefined terminals
|
// ANSI set cursor address preset for undefined terminals
|
||||||
|
|
|
@ -99,7 +99,7 @@ bool FStatusKey::setMouseFocus(bool on)
|
||||||
if ( on == mouse_focus )
|
if ( on == mouse_focus )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return mouse_focus = ( on ) ? true : false;
|
return mouse_focus = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2705,6 +2705,10 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t s[])
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uInt x;
|
uInt x;
|
||||||
|
uInt insert_len = uInt(std::wcslen(s));
|
||||||
|
|
||||||
|
if ( len > insert_len )
|
||||||
|
len = insert_len;
|
||||||
|
|
||||||
if ( (length + len + 1) <= bufsize )
|
if ( (length + len + 1) <= bufsize )
|
||||||
{
|
{
|
||||||
|
|
495
src/fterm.cpp
495
src/fterm.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +1,9 @@
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* ftcap_map.h - Internally used termcap capabilities *
|
* ftermcap.cpp - Provides access to terminal capabilities *
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2015-2017 Markus Gans *
|
* Copyright 2015-2018 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -20,22 +20,41 @@
|
||||||
* <http://www.gnu.org/licenses/>. *
|
* <http://www.gnu.org/licenses/>. *
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
#ifndef FTCAPMAP_H
|
|
||||||
#define FTCAPMAP_H
|
|
||||||
|
|
||||||
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
|
||||||
#error "Only <final/final.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "final/ftermcap.h"
|
#include "final/ftermcap.h"
|
||||||
|
|
||||||
namespace finalcut
|
namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace fc
|
// static class attributes
|
||||||
{
|
bool FTermcap::background_color_erase = false;
|
||||||
|
bool FTermcap::automatic_left_margin = false;
|
||||||
|
bool FTermcap::automatic_right_margin = false;
|
||||||
|
bool FTermcap::eat_nl_glitch = false;
|
||||||
|
bool FTermcap::ansi_default_color = false;
|
||||||
|
bool FTermcap::osc_support = false;
|
||||||
|
bool FTermcap::no_utf8_acs_chars = false;
|
||||||
|
int FTermcap::max_color = 1;
|
||||||
|
int FTermcap::tabstop = 8;
|
||||||
|
int FTermcap::attr_without_color = 0;
|
||||||
|
|
||||||
static FTermcap::tcap_map term_caps[] =
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class FTermcap
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// constructors and destructor
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FTermcap::FTermcap()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FTermcap::~FTermcap() // destructor
|
||||||
|
{ }
|
||||||
|
|
||||||
|
|
||||||
|
// private Data Member of FTermcap - termcap capabilities
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FTermcap::tcap_map FTermcap::tcap[] =
|
||||||
{
|
{
|
||||||
// .------------- term string
|
// .------------- term string
|
||||||
// | .-------- Tcap-code
|
// | .-------- Tcap-code
|
||||||
|
@ -140,8 +159,4 @@ static FTermcap::tcap_map term_caps[] =
|
||||||
* "XX", "Us" and "Ue" are unofficial and they are only used here.
|
* "XX", "Us" and "Ue" are unofficial and they are only used here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
} // namespace fc
|
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
#endif // FTCAPMAP_H
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
char FTermcapQuirks::termtype[256] = { };
|
|
||||||
FTermcap::tcap_map* FTermcapQuirks::tcap = 0;
|
FTermcap::tcap_map* FTermcapQuirks::tcap = 0;
|
||||||
|
FTermData* FTermcapQuirks::fterm_data = 0;
|
||||||
FTermDetection* FTermcapQuirks::term_detection = 0;
|
FTermDetection* FTermcapQuirks::term_detection = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,9 @@ FTermDetection* FTermcapQuirks::term_detection = 0;
|
||||||
// constructors and destructor
|
// constructors and destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FTermcapQuirks::FTermcapQuirks()
|
FTermcapQuirks::FTermcapQuirks()
|
||||||
{ }
|
{
|
||||||
|
tcap = FTermcap::getTermcapMap();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FTermcapQuirks::~FTermcapQuirks() // destructor
|
FTermcapQuirks::~FTermcapQuirks() // destructor
|
||||||
|
@ -47,16 +49,9 @@ FTermcapQuirks::~FTermcapQuirks() // destructor
|
||||||
|
|
||||||
// public methods of FTermcapQuirks
|
// public methods of FTermcapQuirks
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirks::setTerminalType (const char tt[])
|
void FTermcapQuirks::setTermData (FTermData* data)
|
||||||
{
|
{
|
||||||
std::strncpy (termtype, tt, sizeof(termtype));
|
fterm_data = data;
|
||||||
termtype[sizeof(termtype) - 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void FTermcapQuirks::setTermcapMap (FTermcap::tcap_map* tc)
|
|
||||||
{
|
|
||||||
tcap = tc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -255,6 +250,8 @@ void FTermcapQuirks::init_termcap_xterm_quirks()
|
||||||
void FTermcapQuirks::init_termcap_rxvt_quirks()
|
void FTermcapQuirks::init_termcap_rxvt_quirks()
|
||||||
{
|
{
|
||||||
// Set enter/exit alternative charset mode for rxvt terminal
|
// Set enter/exit alternative charset mode for rxvt terminal
|
||||||
|
const char* termtype = fterm_data->getTermType();
|
||||||
|
|
||||||
if ( std::strncmp(termtype, "rxvt-16color", 12) == 0 )
|
if ( std::strncmp(termtype, "rxvt-16color", 12) == 0 )
|
||||||
{
|
{
|
||||||
TCAP(fc::t_enter_alt_charset_mode) = \
|
TCAP(fc::t_enter_alt_charset_mode) = \
|
||||||
|
|
|
@ -31,8 +31,8 @@ FTermDetection::terminalType FTermDetection::terminal_type = \
|
||||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
FTermDetection::colorEnv FTermDetection::color_env;
|
FTermDetection::colorEnv FTermDetection::color_env;
|
||||||
FTermDetection::secondaryDA FTermDetection::secondary_da;
|
FTermDetection::secondaryDA FTermDetection::secondary_da;
|
||||||
|
FTermData* FTermDetection::fterm_data = 0;
|
||||||
char FTermDetection::termtype[256] = { };
|
char FTermDetection::termtype[256] = { };
|
||||||
char FTermDetection::termfilename[256] = { };
|
|
||||||
char FTermDetection::ttytypename[256] = { };
|
char FTermDetection::ttytypename[256] = { };
|
||||||
bool FTermDetection::decscusr_support;
|
bool FTermDetection::decscusr_support;
|
||||||
bool FTermDetection::terminal_detection;
|
bool FTermDetection::terminal_detection;
|
||||||
|
@ -89,13 +89,9 @@ FTermDetection::~FTermDetection() // destructor
|
||||||
|
|
||||||
// public methods of FTermDetection
|
// public methods of FTermDetection
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetection::setTermFileName (char term_filename[])
|
void FTermDetection::setTermData (FTermData* data)
|
||||||
{
|
{
|
||||||
if ( ! term_filename )
|
fterm_data = data;
|
||||||
return;
|
|
||||||
|
|
||||||
std::strncpy (termfilename, term_filename, sizeof(termfilename));
|
|
||||||
termfilename[sizeof(termfilename) - 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -128,6 +124,7 @@ void FTermDetection::getSystemTermType()
|
||||||
{
|
{
|
||||||
// Import the untrusted environment variable TERM
|
// Import the untrusted environment variable TERM
|
||||||
const char* const& term_env = std::getenv(C_STR("TERM"));
|
const char* const& term_env = std::getenv(C_STR("TERM"));
|
||||||
|
const char* termfilename = fterm_data->getTermFileName();
|
||||||
|
|
||||||
if ( term_env )
|
if ( term_env )
|
||||||
{
|
{
|
||||||
|
@ -164,6 +161,7 @@ bool FTermDetection::getTTYtype()
|
||||||
// vt100 ttys0
|
// vt100 ttys0
|
||||||
|
|
||||||
// Get term basename
|
// Get term basename
|
||||||
|
const char* termfilename = fterm_data->getTermFileName();
|
||||||
const char* term_basename = std::strrchr(termfilename, '/');
|
const char* term_basename = std::strrchr(termfilename, '/');
|
||||||
|
|
||||||
if ( term_basename == 0 )
|
if ( term_basename == 0 )
|
||||||
|
@ -221,6 +219,7 @@ bool FTermDetection::getTTYSFileEntry()
|
||||||
// Analyse /etc/ttys and get the term name
|
// Analyse /etc/ttys and get the term name
|
||||||
|
|
||||||
// get term basename
|
// get term basename
|
||||||
|
const char* termfilename = fterm_data->getTermFileName();
|
||||||
const char* term_basename = std::strrchr(termfilename, '/');
|
const char* term_basename = std::strrchr(termfilename, '/');
|
||||||
|
|
||||||
if ( term_basename == 0 )
|
if ( term_basename == 0 )
|
||||||
|
|
|
@ -38,8 +38,8 @@ namespace finalcut
|
||||||
console_font_op FTermLinux::screen_font;
|
console_font_op FTermLinux::screen_font;
|
||||||
unimapdesc FTermLinux::screen_unicode_map;
|
unimapdesc FTermLinux::screen_unicode_map;
|
||||||
|
|
||||||
bool FTermLinux::NewFont;
|
bool FTermLinux::new_font;
|
||||||
bool FTermLinux::VGAFont;
|
bool FTermLinux::vga_font;
|
||||||
bool FTermLinux::shadow_character = true;
|
bool FTermLinux::shadow_character = true;
|
||||||
bool FTermLinux::half_block_character = true;
|
bool FTermLinux::half_block_character = true;
|
||||||
bool FTermLinux::has_saved_palette = false;
|
bool FTermLinux::has_saved_palette = false;
|
||||||
|
@ -194,7 +194,7 @@ void FTermLinux::initCharMap (uInt char_map[][fc::NUM_OF_ENCODINGS])
|
||||||
{
|
{
|
||||||
uInt c1, c2, c3, c4, c5;
|
uInt c1, c2, c3, c4, c5;
|
||||||
|
|
||||||
if ( NewFont || VGAFont )
|
if ( new_font || vga_font )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( screen_unicode_map.entry_ct != 0 )
|
if ( screen_unicode_map.entry_ct != 0 )
|
||||||
|
@ -255,7 +255,7 @@ void FTermLinux::finish()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FTermLinux::loadVGAFont()
|
bool FTermLinux::loadVGAFont()
|
||||||
{
|
{
|
||||||
VGAFont = true;
|
vga_font = true;
|
||||||
|
|
||||||
if ( FTerm::openConsole() == 0 )
|
if ( FTerm::openConsole() == 0 )
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,7 @@ bool FTermLinux::loadVGAFont()
|
||||||
int ret = setScreenFont(fc::__8x16std, 256, 8, 16);
|
int ret = setScreenFont(fc::__8x16std, 256, 8, 16);
|
||||||
|
|
||||||
if ( ret != 0 )
|
if ( ret != 0 )
|
||||||
VGAFont = false;
|
vga_font = false;
|
||||||
|
|
||||||
// unicode character mapping
|
// unicode character mapping
|
||||||
struct unimapdesc unimap;
|
struct unimapdesc unimap;
|
||||||
|
@ -275,24 +275,24 @@ bool FTermLinux::loadVGAFont()
|
||||||
setUnicodeMap(&unimap);
|
setUnicodeMap(&unimap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
VGAFont = false;
|
vga_font = false;
|
||||||
|
|
||||||
FTerm::detectTermSize();
|
FTerm::detectTermSize();
|
||||||
FTerm::closeConsole();
|
FTerm::closeConsole();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
VGAFont = false;
|
vga_font = false;
|
||||||
|
|
||||||
if ( VGAFont )
|
if ( vga_font )
|
||||||
shadow_character = half_block_character = true;
|
shadow_character = half_block_character = true;
|
||||||
|
|
||||||
return VGAFont;
|
return vga_font;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FTermLinux::loadNewFont()
|
bool FTermLinux::loadNewFont()
|
||||||
{
|
{
|
||||||
NewFont = true;
|
new_font = true;
|
||||||
|
|
||||||
if ( FTerm::openConsole() == 0 )
|
if ( FTerm::openConsole() == 0 )
|
||||||
{
|
{
|
||||||
|
@ -302,7 +302,7 @@ bool FTermLinux::loadNewFont()
|
||||||
int ret = setScreenFont(fc::__8x16graph, 256, 8, 16);
|
int ret = setScreenFont(fc::__8x16graph, 256, 8, 16);
|
||||||
|
|
||||||
if ( ret != 0 )
|
if ( ret != 0 )
|
||||||
NewFont = false;
|
new_font = false;
|
||||||
|
|
||||||
// unicode character mapping
|
// unicode character mapping
|
||||||
struct unimapdesc unimap;
|
struct unimapdesc unimap;
|
||||||
|
@ -312,18 +312,18 @@ bool FTermLinux::loadNewFont()
|
||||||
setUnicodeMap(&unimap);
|
setUnicodeMap(&unimap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NewFont = false;
|
new_font = false;
|
||||||
|
|
||||||
FTerm::detectTermSize();
|
FTerm::detectTermSize();
|
||||||
FTerm::closeConsole();
|
FTerm::closeConsole();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NewFont = false;
|
new_font = false;
|
||||||
|
|
||||||
if ( VGAFont )
|
if ( vga_font )
|
||||||
shadow_character = half_block_character = true;
|
shadow_character = half_block_character = true;
|
||||||
|
|
||||||
return NewFont;
|
return new_font;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -363,7 +363,7 @@ bool FTermLinux::loadOldFont (uInt char_map[][fc::NUM_OF_ENCODINGS])
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( retval )
|
if ( retval )
|
||||||
VGAFont = NewFont = false;
|
vga_font = new_font = false;
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,8 @@ namespace finalcut
|
||||||
bool FTermXTerminal::mouse_support;
|
bool FTermXTerminal::mouse_support;
|
||||||
bool FTermXTerminal::meta_sends_esc;
|
bool FTermXTerminal::meta_sends_esc;
|
||||||
bool FTermXTerminal::xterm_default_colors;
|
bool FTermXTerminal::xterm_default_colors;
|
||||||
FTermcap::tcap_map* FTermXTerminal::tcap = 0;
|
int FTermXTerminal::term_width = 80;
|
||||||
FTermDetection* FTermXTerminal::term_detection = 0;
|
int FTermXTerminal::term_height = 24;
|
||||||
fc::xtermCursorStyle FTermXTerminal::cursor_style = fc::unknown_cursor_style;
|
|
||||||
const FString* FTermXTerminal::xterm_font = 0;
|
const FString* FTermXTerminal::xterm_font = 0;
|
||||||
const FString* FTermXTerminal::xterm_title = 0;
|
const FString* FTermXTerminal::xterm_title = 0;
|
||||||
const FString* FTermXTerminal::foreground_color = 0;
|
const FString* FTermXTerminal::foreground_color = 0;
|
||||||
|
@ -42,6 +41,9 @@ const FString* FTermXTerminal::cursor_color = 0;
|
||||||
const FString* FTermXTerminal::mouse_foreground_color = 0;
|
const FString* FTermXTerminal::mouse_foreground_color = 0;
|
||||||
const FString* FTermXTerminal::mouse_background_color = 0;
|
const FString* FTermXTerminal::mouse_background_color = 0;
|
||||||
const FString* FTermXTerminal::highlight_background_color = 0;
|
const FString* FTermXTerminal::highlight_background_color = 0;
|
||||||
|
FTermcap::tcap_map* FTermXTerminal::tcap = 0;
|
||||||
|
FTermDetection* FTermXTerminal::term_detection = 0;
|
||||||
|
fc::xtermCursorStyle FTermXTerminal::cursor_style = fc::unknown_cursor_style;
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -56,6 +58,8 @@ FTermXTerminal::FTermXTerminal()
|
||||||
mouse_support = \
|
mouse_support = \
|
||||||
meta_sends_esc = \
|
meta_sends_esc = \
|
||||||
xterm_default_colors = false;
|
xterm_default_colors = false;
|
||||||
|
|
||||||
|
tcap = FTermcap::getTermcapMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -121,6 +125,16 @@ void FTermXTerminal::setTitle (const FString& title)
|
||||||
setXTermTitle();
|
setXTermTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FTermXTerminal::setTermSize (int width, int height)
|
||||||
|
{
|
||||||
|
// Set xterm size to {term_width} x {term_height}
|
||||||
|
|
||||||
|
term_width = width;
|
||||||
|
term_height = height;
|
||||||
|
setXTermSize();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermXTerminal::setForeground (const FString& fg)
|
void FTermXTerminal::setForeground (const FString& fg)
|
||||||
{
|
{
|
||||||
|
@ -398,6 +412,16 @@ void FTermXTerminal::setXTermTitle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FTermXTerminal::setXTermSize()
|
||||||
|
{
|
||||||
|
if ( term_detection->isXTerminal() )
|
||||||
|
{
|
||||||
|
FTerm::putstringf (CSI "8;%d;%dt", term_height, term_width);
|
||||||
|
std::fflush(stdout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermXTerminal::setXTermFont()
|
void FTermXTerminal::setXTermFont()
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,8 +51,7 @@ FPoint* FVTerm::term_pos = 0;
|
||||||
FVTerm::term_area* FVTerm::vterm = 0;
|
FVTerm::term_area* FVTerm::vterm = 0;
|
||||||
FVTerm::term_area* FVTerm::vdesktop = 0;
|
FVTerm::term_area* FVTerm::vdesktop = 0;
|
||||||
FVTerm::term_area* FVTerm::active_area = 0;
|
FVTerm::term_area* FVTerm::active_area = 0;
|
||||||
FVTerm::termcap_map* FVTerm::tcap = 0;
|
FTermcap::tcap_map* FVTerm::tcap = 0;
|
||||||
FTermcap::tcap_map* FTermcap::tcap = 0;
|
|
||||||
FKeyboard* FVTerm::keyboard = 0;
|
FKeyboard* FVTerm::keyboard = 0;
|
||||||
FVTerm::charData FVTerm::term_attribute;
|
FVTerm::charData FVTerm::term_attribute;
|
||||||
FVTerm::charData FVTerm::next_attribute;
|
FVTerm::charData FVTerm::next_attribute;
|
||||||
|
@ -2099,7 +2098,7 @@ void FVTerm::init()
|
||||||
std::memcpy (&next_attribute, &term_attribute, sizeof(charData));
|
std::memcpy (&next_attribute, &term_attribute, sizeof(charData));
|
||||||
|
|
||||||
// Receive the terminal capabilities
|
// Receive the terminal capabilities
|
||||||
tcap = FTermcap().getTermcapMap();
|
tcap = FTermcap::getTermcapMap();
|
||||||
|
|
||||||
// Create virtual terminal
|
// Create virtual terminal
|
||||||
FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
|
FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
|
||||||
|
|
|
@ -361,7 +361,7 @@ bool FWidget::setEnable (bool on)
|
||||||
else
|
else
|
||||||
flags &= ~fc::active;
|
flags &= ~fc::active;
|
||||||
|
|
||||||
return enable = ( on ) ? true : false;
|
return enable = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -414,7 +414,7 @@ bool FWidget::setFocus (bool on)
|
||||||
window->setWindowFocusWidget(this);
|
window->setWindowFocusWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return focus = ( on ) ? true : false;
|
return focus = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -174,7 +174,7 @@ bool FWindow::activateWindow (bool on)
|
||||||
active_area = getVWin();
|
active_area = getVWin();
|
||||||
}
|
}
|
||||||
|
|
||||||
return window_active = ( on ) ? true : false;
|
return window_active = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -79,7 +79,7 @@ enum events
|
||||||
Timer_Event // timer event occur
|
Timer_Event // timer event occur
|
||||||
};
|
};
|
||||||
|
|
||||||
// Properties of a widget
|
// Properties of a widget ⚑
|
||||||
enum widget_flags
|
enum widget_flags
|
||||||
{
|
{
|
||||||
shadow = 0x00000001,
|
shadow = 0x00000001,
|
||||||
|
|
|
@ -207,6 +207,7 @@ class FDialog : public FWindow
|
||||||
void moveSizeKey (FKeyEvent*);
|
void moveSizeKey (FKeyEvent*);
|
||||||
void raiseActivateDialog();
|
void raiseActivateDialog();
|
||||||
void lowerActivateDialog();
|
void lowerActivateDialog();
|
||||||
|
bool isLowerRightResizeCorner (mouseStates&);
|
||||||
void resizeMouseDown (mouseStates&);
|
void resizeMouseDown (mouseStates&);
|
||||||
void resizeMouseUpMove (mouseStates&, bool = false);
|
void resizeMouseUpMove (mouseStates&, bool = false);
|
||||||
void cancelMouseResize();
|
void cancelMouseResize();
|
||||||
|
|
|
@ -177,7 +177,7 @@ class FKeyboard
|
||||||
FKeyboardCommand escape_key_cmd;
|
FKeyboardCommand escape_key_cmd;
|
||||||
|
|
||||||
static timeval time_keypressed;
|
static timeval time_keypressed;
|
||||||
fc::fkeymap* termcap_map;
|
fc::fkeymap* key_map;
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
#undef linux
|
#undef linux
|
||||||
|
|
|
@ -355,6 +355,7 @@ class FListView : public FWidget
|
||||||
void drawColumnEllipsis ( headerItems::const_iterator&
|
void drawColumnEllipsis ( headerItems::const_iterator&
|
||||||
, const FString& );
|
, const FString& );
|
||||||
void updateDrawing (bool, bool);
|
void updateDrawing (bool, bool);
|
||||||
|
int determineLineWidth (FListViewItem* item);
|
||||||
void recalculateHorizontalBar (int);
|
void recalculateHorizontalBar (int);
|
||||||
void recalculateVerticalBar (int);
|
void recalculateVerticalBar (int);
|
||||||
void wheelUp (int);
|
void wheelUp (int);
|
||||||
|
@ -473,7 +474,7 @@ inline void FListView::setUserDescendingCompare (Compare cmp)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListView::setTreeView (bool on)
|
inline bool FListView::setTreeView (bool on)
|
||||||
{ return tree_view = ( on ) ? true : false; }
|
{ return tree_view = on; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListView::setTreeView()
|
inline bool FListView::setTreeView()
|
||||||
|
|
|
@ -139,7 +139,6 @@
|
||||||
#include "final/fkey_map.h"
|
#include "final/fkey_map.h"
|
||||||
#include "final/fkeyboard.h"
|
#include "final/fkeyboard.h"
|
||||||
#include "final/fmouse.h"
|
#include "final/fmouse.h"
|
||||||
#include "final/fobject.h"
|
|
||||||
#include "final/foptiattr.h"
|
#include "final/foptiattr.h"
|
||||||
#include "final/foptimove.h"
|
#include "final/foptimove.h"
|
||||||
#include "final/fpoint.h"
|
#include "final/fpoint.h"
|
||||||
|
@ -147,6 +146,7 @@
|
||||||
#include "final/fstring.h"
|
#include "final/fstring.h"
|
||||||
#include "final/ftermcap.h"
|
#include "final/ftermcap.h"
|
||||||
#include "final/ftermcapquirks.h"
|
#include "final/ftermcapquirks.h"
|
||||||
|
#include "final/ftermdata.h"
|
||||||
#include "final/ftermdetection.h"
|
#include "final/ftermdetection.h"
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
@ -210,10 +210,8 @@ class FTerm
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
static bool isCursorHidden();
|
|
||||||
static bool isNormal (charData*&);
|
static bool isNormal (charData*&);
|
||||||
static bool isRaw();
|
static bool isRaw();
|
||||||
static bool hasPCcharset();
|
|
||||||
static bool hasUTF8();
|
static bool hasUTF8();
|
||||||
static bool hasVT100();
|
static bool hasVT100();
|
||||||
static bool hasASCII();
|
static bool hasASCII();
|
||||||
|
@ -238,17 +236,14 @@ class FTerm
|
||||||
static bool isScreenTerm();
|
static bool isScreenTerm();
|
||||||
static bool isTmuxTerm();
|
static bool isTmuxTerm();
|
||||||
static bool isNewFont();
|
static bool isNewFont();
|
||||||
static bool isUTF8();
|
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
static void setTermType (const char[]);
|
static void setTermType (const char[]);
|
||||||
static void setInsertCursor (bool on);
|
static void setInsertCursor (bool on);
|
||||||
static void setInsertCursor();
|
static void setInsertCursor();
|
||||||
static void unsetInsertCursor();
|
static void unsetInsertCursor();
|
||||||
static bool setCursorOptimisation (bool);
|
|
||||||
static void redefineDefaultColors (bool);
|
static void redefineDefaultColors (bool);
|
||||||
static void setDblclickInterval (const long);
|
static void setDblclickInterval (const long);
|
||||||
static void disableAltScreen();
|
|
||||||
static bool setUTF8 (bool);
|
static bool setUTF8 (bool);
|
||||||
static bool setUTF8();
|
static bool setUTF8();
|
||||||
static bool unsetUTF8();
|
static bool unsetUTF8();
|
||||||
|
@ -304,10 +299,6 @@ class FTerm
|
||||||
static int putchar_ASCII (int);
|
static int putchar_ASCII (int);
|
||||||
static int putchar_UTF8 (int);
|
static int putchar_UTF8 (int);
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
static int framebuffer_bpp;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Inquiries
|
// Inquiries
|
||||||
static bool hasChangedTermSize();
|
static bool hasChangedTermSize();
|
||||||
|
@ -323,7 +314,7 @@ class FTerm
|
||||||
static char* changeAttribute ( charData*&
|
static char* changeAttribute ( charData*&
|
||||||
, charData*& );
|
, charData*& );
|
||||||
static void changeTermSizeFinished();
|
static void changeTermSizeFinished();
|
||||||
static void exitWithMessage (std::string)
|
static void exitWithMessage (const FString&)
|
||||||
#if defined(__clang__) || defined(__GNUC__)
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
__attribute__((noreturn))
|
__attribute__((noreturn))
|
||||||
#endif
|
#endif
|
||||||
|
@ -374,16 +365,14 @@ class FTerm
|
||||||
} init_values;
|
} init_values;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Typedefs
|
|
||||||
typedef FTermcap::tcap_map termcap_map;
|
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FTerm (const FTerm&);
|
FTerm (const FTerm&);
|
||||||
// Disable assignment operator (=)
|
// Disable assignment operator (=)
|
||||||
FTerm& operator = (const FTerm&);
|
FTerm& operator = (const FTerm&);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
static void init_global_values();
|
static void init_global_values (bool);
|
||||||
|
static void init_terminal_device_path();
|
||||||
static void oscPrefix();
|
static void oscPrefix();
|
||||||
static void oscPostfix();
|
static void oscPostfix();
|
||||||
static void init_alt_charset();
|
static void init_alt_charset();
|
||||||
|
@ -407,7 +396,7 @@ class FTerm
|
||||||
static void init_encoding_set();
|
static void init_encoding_set();
|
||||||
static void init_term_encoding();
|
static void init_term_encoding();
|
||||||
static void init_individual_term_encoding();
|
static void init_individual_term_encoding();
|
||||||
static bool init_force_vt100_encoding();
|
static void init_force_vt100_encoding();
|
||||||
static void init_utf8_without_alt_charset();
|
static void init_utf8_without_alt_charset();
|
||||||
static void init_tab_quirks();
|
static void init_tab_quirks();
|
||||||
static void init_captureFontAndTitle();
|
static void init_captureFontAndTitle();
|
||||||
|
@ -421,7 +410,7 @@ class FTerm
|
||||||
static void useNormalScreenBuffer();
|
static void useNormalScreenBuffer();
|
||||||
void allocationValues();
|
void allocationValues();
|
||||||
void deallocationValues();
|
void deallocationValues();
|
||||||
void init();
|
void init (bool);
|
||||||
void initOSspecifics();
|
void initOSspecifics();
|
||||||
void finish();
|
void finish();
|
||||||
void finishOSspecifics1();
|
void finishOSspecifics1();
|
||||||
|
@ -432,49 +421,14 @@ class FTerm
|
||||||
static void signal_handler (int);
|
static void signal_handler (int);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static std::map <uChar,uChar>* vt100_alt_char;
|
static FTermData* data;
|
||||||
static std::map <std::string,fc::encoding>* encoding_set;
|
|
||||||
static FTermcap::tcap_map* tcap;
|
static FTermcap::tcap_map* tcap;
|
||||||
static fc::encoding term_encoding;
|
|
||||||
|
|
||||||
static bool shadow_character;
|
|
||||||
static bool half_block_character;
|
|
||||||
static bool cursor_optimisation;
|
|
||||||
static bool hidden_cursor;
|
|
||||||
static bool use_alternate_screen;
|
|
||||||
static bool pc_charset_console;
|
|
||||||
static bool utf8_state;
|
|
||||||
static bool utf8_console;
|
|
||||||
static bool utf8_linux_terminal;
|
|
||||||
static bool force_vt100;
|
|
||||||
static bool vt100_console;
|
|
||||||
static bool ascii_console;
|
|
||||||
static bool NewFont;
|
|
||||||
static bool VGAFont;
|
|
||||||
static bool monochron;
|
|
||||||
static char termtype[256];
|
|
||||||
static char termfilename[256];
|
|
||||||
static char exit_message[8192];
|
|
||||||
static char* locale_name;
|
|
||||||
static char* locale_xterm;
|
|
||||||
static FRect* term; // current terminal geometry
|
|
||||||
|
|
||||||
static int fd_tty;
|
|
||||||
static uInt baudrate;
|
|
||||||
static bool resize_term;
|
|
||||||
|
|
||||||
static fc::linuxConsoleCursorStyle \
|
|
||||||
linux_console_cursor_style;
|
|
||||||
static struct console_font_op \
|
|
||||||
screen_font;
|
|
||||||
static struct unimapdesc \
|
|
||||||
screen_unicode_map;
|
|
||||||
|
|
||||||
static FOptiMove* opti_move;
|
static FOptiMove* opti_move;
|
||||||
static FOptiAttr* opti_attr;
|
static FOptiAttr* opti_attr;
|
||||||
static FTermDetection* term_detection;
|
static FTermDetection* term_detection;
|
||||||
static FTermXTerminal* xterm;
|
static FTermXTerminal* xterm;
|
||||||
static FKeyboard* keyboard;
|
static FKeyboard* keyboard;
|
||||||
|
static FMouseControl* mouse;
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
#undef linux
|
#undef linux
|
||||||
|
@ -488,10 +442,6 @@ class FTerm
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
static FTermOpenBSD* openbsd;
|
static FTermOpenBSD* openbsd;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static FMouseControl* mouse;
|
|
||||||
static const FString* save_xterm_font;
|
|
||||||
static const FString* save_xterm_title;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -511,15 +461,15 @@ inline FMouseControl* FTerm::getMouseControl()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FTerm::getTTYFileDescriptor()
|
inline int FTerm::getTTYFileDescriptor()
|
||||||
{ return fd_tty; }
|
{ return data->getTTYFileDescriptor(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline char* FTerm::getTermType()
|
inline char* FTerm::getTermType()
|
||||||
{ return termtype; }
|
{ return data->getTermType(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline char* FTerm::getTermFileName()
|
inline char* FTerm::getTermFileName()
|
||||||
{ return termfilename; }
|
{ return data->getTermFileName(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FTerm::getTabstop()
|
inline int FTerm::getTabstop()
|
||||||
|
@ -552,32 +502,16 @@ inline const char* FTerm::getTermType_SecDA()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FTerm::getFramebufferBpp()
|
inline int FTerm::getFramebufferBpp()
|
||||||
{ return framebuffer_bpp; }
|
{ return data->getFramebufferBpp(); }
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FTerm::isCursorHidden()
|
|
||||||
{ return hidden_cursor; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FTerm::hasPCcharset()
|
|
||||||
{ return pc_charset_console; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::hasUTF8()
|
inline bool FTerm::hasUTF8()
|
||||||
{ return utf8_console; }
|
{ return data->hasUTF8Console(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FTerm::hasVT100()
|
|
||||||
{ return vt100_console; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FTerm::hasASCII()
|
|
||||||
{ return ascii_console; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::isMonochron()
|
inline bool FTerm::isMonochron()
|
||||||
{ return monochron; }
|
{ return data->isMonochron(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::isXTerminal()
|
inline bool FTerm::isXTerminal()
|
||||||
|
@ -657,11 +591,7 @@ inline bool FTerm::isTmuxTerm()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::isNewFont()
|
inline bool FTerm::isNewFont()
|
||||||
{ return NewFont; }
|
{ return data->isNewFont(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FTerm::isUTF8()
|
|
||||||
{ return utf8_state; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FTerm::setInsertCursor()
|
inline void FTerm::setInsertCursor()
|
||||||
|
@ -671,14 +601,6 @@ inline void FTerm::setInsertCursor()
|
||||||
inline void FTerm::unsetInsertCursor()
|
inline void FTerm::unsetInsertCursor()
|
||||||
{ setInsertCursor(false); }
|
{ setInsertCursor(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FTerm::setCursorOptimisation (bool on)
|
|
||||||
{ return cursor_optimisation = ( on ) ? true : false; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline void FTerm::disableAltScreen()
|
|
||||||
{ use_alternate_screen = false; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::setUTF8()
|
inline bool FTerm::setUTF8()
|
||||||
{ return setUTF8(true); }
|
{ return setUTF8(true); }
|
||||||
|
@ -689,19 +611,19 @@ inline bool FTerm::unsetUTF8()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::hasChangedTermSize()
|
inline bool FTerm::hasChangedTermSize()
|
||||||
{ return resize_term; }
|
{ return data->hasTermResized(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::hasShadowCharacter()
|
inline bool FTerm::hasShadowCharacter()
|
||||||
{ return shadow_character; }
|
{ return data->hasShadowCharacter(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::hasHalfBlockCharacter()
|
inline bool FTerm::hasHalfBlockCharacter()
|
||||||
{ return half_block_character; }
|
{ return data->hasHalfBlockCharacter(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTerm::hasAlternateScreen()
|
inline bool FTerm::hasAlternateScreen()
|
||||||
{ return use_alternate_screen; }
|
{ return data->hasAlternateScreen(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FOptiMove* FTerm::getFOptiMove()
|
inline FOptiMove* FTerm::getFOptiMove()
|
||||||
|
@ -709,7 +631,7 @@ inline FOptiMove* FTerm::getFOptiMove()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FTerm::changeTermSizeFinished()
|
inline void FTerm::changeTermSizeFinished()
|
||||||
{ resize_term = false; }
|
{ data->setTermResized(false); }
|
||||||
|
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2016-2017 Markus Gans *
|
* Copyright 2016-2018 Markus Gans *
|
||||||
* *
|
* *
|
||||||
* The Final Cut is free software; you can redistribute it and/or *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -61,12 +61,10 @@ class FTermcap
|
||||||
tcap_map;
|
tcap_map;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
FTermcap()
|
FTermcap();
|
||||||
{ }
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FTermcap()
|
~FTermcap();
|
||||||
{ }
|
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
@ -76,12 +74,6 @@ class FTermcap
|
||||||
return tcap;
|
return tcap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mutator
|
|
||||||
static void setTermcapMap (tcap_map* t)
|
|
||||||
{
|
|
||||||
tcap = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static bool background_color_erase;
|
static bool background_color_erase;
|
||||||
static bool automatic_left_margin;
|
static bool automatic_left_margin;
|
||||||
|
@ -95,16 +87,17 @@ class FTermcap
|
||||||
static int attr_without_color;
|
static int attr_without_color;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Data Members
|
// Data Member
|
||||||
static tcap_map* tcap;
|
static tcap_map tcap[];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
// FOptiMove inline functions
|
// FTermcap inline functions
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const char* FTermcap::getClassName() const
|
inline const char* FTermcap::getClassName() const
|
||||||
{ return "FTermcap"; }
|
{ return "FTermcap"; }
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
|
|
||||||
#endif // FTERMCAP_H
|
#endif // FTERMCAP_H
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
#include "final/fterm.h"
|
#include "final/fterm.h"
|
||||||
#include "final/ftermcap.h"
|
#include "final/ftermcap.h"
|
||||||
|
#include "final/ftermdata.h"
|
||||||
#include "final/ftermdetection.h"
|
#include "final/ftermdetection.h"
|
||||||
|
|
||||||
namespace finalcut
|
namespace finalcut
|
||||||
|
@ -63,8 +64,7 @@ class FTermcapQuirks
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
|
||||||
// Mutator
|
// Mutator
|
||||||
static void setTerminalType (const char[]);
|
static void setTermData (FTermData*);
|
||||||
static void setTermcapMap (FTermcap::tcap_map*);
|
|
||||||
static void setFTermDetection (FTermDetection*);
|
static void setFTermDetection (FTermDetection*);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
@ -87,8 +87,8 @@ class FTermcapQuirks
|
||||||
static void init_termcap_general_quirks();
|
static void init_termcap_general_quirks();
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static char termtype[256];
|
|
||||||
static FTermcap::tcap_map* tcap;
|
static FTermcap::tcap_map* tcap;
|
||||||
|
static FTermData* fterm_data;
|
||||||
static FTermDetection* term_detection;
|
static FTermDetection* term_detection;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
|
@ -0,0 +1,394 @@
|
||||||
|
/***********************************************************************
|
||||||
|
* ftermdata.h - Data class for FTerm *
|
||||||
|
* *
|
||||||
|
* This file is part of the Final Cut widget toolkit *
|
||||||
|
* *
|
||||||
|
* Copyright 2018 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/>. *
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
/* Standalone class
|
||||||
|
* ════════════════
|
||||||
|
*
|
||||||
|
* ▕▔▔▔▔▔▔▔▔▔▔▔▏
|
||||||
|
* ▕ FTermData ▏
|
||||||
|
* ▕▁▁▁▁▁▁▁▁▁▁▁▏
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FTERMDATA_H
|
||||||
|
#define FTERMDATA_H
|
||||||
|
|
||||||
|
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
||||||
|
#error "Only <final/final.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
#include "final/fc.h"
|
||||||
|
#include "final/frect.h"
|
||||||
|
#include "final/fstring.h"
|
||||||
|
#include "final/ftypes.h"
|
||||||
|
|
||||||
|
namespace finalcut
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class FTermData
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
|
class FTermData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Typedefs
|
||||||
|
typedef std::map<std::string,fc::encoding> encodingMap;
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
FTermData();
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
~FTermData();
|
||||||
|
|
||||||
|
// Accessors
|
||||||
|
const char* getClassName() const;
|
||||||
|
encodingMap& getEncodingList();
|
||||||
|
fc::encoding getTermEncoding() const;
|
||||||
|
FRect& getTermGeometry();
|
||||||
|
int getTTYFileDescriptor() const;
|
||||||
|
uInt getBaudrate() const;
|
||||||
|
char* getTermType();
|
||||||
|
char* getTermFileName();
|
||||||
|
const FString& getXtermFont() const;
|
||||||
|
const FString& getXtermTitle() const;
|
||||||
|
#if DEBUG
|
||||||
|
int getFramebufferBpp() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Inquiries
|
||||||
|
bool hasShadowCharacter() const;
|
||||||
|
bool hasHalfBlockCharacter() const;
|
||||||
|
bool hasCursorOptimisation() const;
|
||||||
|
bool isCursorHidden() const;
|
||||||
|
bool hasAlternateScreen() const;
|
||||||
|
bool hasASCIIConsole() const;
|
||||||
|
bool hasVT100Console() const;
|
||||||
|
bool hasUTF8Console() const;
|
||||||
|
bool isUTF8() const;
|
||||||
|
bool isNewFont() const;
|
||||||
|
bool isVGAFont() const;
|
||||||
|
bool isMonochron() const;
|
||||||
|
bool hasTermResized() const;
|
||||||
|
|
||||||
|
// Mutators
|
||||||
|
void setTermEncoding(fc::encoding);
|
||||||
|
void setTTYFileDescriptor (int);
|
||||||
|
void setBaudrate (uInt);
|
||||||
|
void supportShadowCharacter (bool);
|
||||||
|
void supportHalfBlockCharacter (bool);
|
||||||
|
void supportCursorOptimisation (bool);
|
||||||
|
void setCursorHidden (bool);
|
||||||
|
void useAlternateScreen (bool);
|
||||||
|
void setASCIIConsole (bool);
|
||||||
|
void setVT100Console (bool);
|
||||||
|
void setUTF8Console (bool);
|
||||||
|
void setUTF8 (bool);
|
||||||
|
void setNewFont (bool);
|
||||||
|
void setVGAFont (bool);
|
||||||
|
void setMonochron (bool);
|
||||||
|
void setTermResized (bool);
|
||||||
|
void setTermType (const char[]);
|
||||||
|
void setTermFileName (const char[]);
|
||||||
|
void setXtermFont (const FString&);
|
||||||
|
void setXtermTitle (const FString&);
|
||||||
|
#if DEBUG
|
||||||
|
void setFramebufferBpp (int);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Disable copy constructor
|
||||||
|
FTermData (const FTermData&);
|
||||||
|
|
||||||
|
// Disable assignment operator (=)
|
||||||
|
FTermData& operator = (const FTermData&);
|
||||||
|
|
||||||
|
// Data Members
|
||||||
|
encodingMap encoding_list;
|
||||||
|
fc::encoding term_encoding;
|
||||||
|
FRect term_geometry; // current terminal geometry
|
||||||
|
int fd_tty;
|
||||||
|
uInt baudrate;
|
||||||
|
bool shadow_character;
|
||||||
|
bool half_block_character;
|
||||||
|
bool cursor_optimisation;
|
||||||
|
bool hidden_cursor;
|
||||||
|
bool use_alternate_screen;
|
||||||
|
bool ascii_console;
|
||||||
|
bool vt100_console;
|
||||||
|
bool utf8_console;
|
||||||
|
bool utf8_state;
|
||||||
|
bool new_font;
|
||||||
|
bool vga_font;
|
||||||
|
bool monochron;
|
||||||
|
bool resize_term;
|
||||||
|
char termtype[256];
|
||||||
|
char termfilename[256];
|
||||||
|
FString xterm_font;
|
||||||
|
FString xterm_title;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
int framebuffer_bpp;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
// FTermData inline functions
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FTermData::FTermData()
|
||||||
|
: encoding_list()
|
||||||
|
, term_encoding(fc::UNKNOWN)
|
||||||
|
, term_geometry()
|
||||||
|
, fd_tty(-1) // Teletype (tty) file descriptor is still undefined
|
||||||
|
, baudrate(0)
|
||||||
|
, shadow_character(true)
|
||||||
|
, half_block_character(true)
|
||||||
|
, cursor_optimisation(true)
|
||||||
|
, hidden_cursor(false) // Global cursor hidden state
|
||||||
|
, use_alternate_screen(true)
|
||||||
|
, ascii_console(false)
|
||||||
|
, vt100_console(false)
|
||||||
|
, utf8_console(false)
|
||||||
|
, utf8_state(false)
|
||||||
|
, new_font(false)
|
||||||
|
, vga_font(false)
|
||||||
|
, monochron(false)
|
||||||
|
, resize_term(false)
|
||||||
|
, termtype()
|
||||||
|
, termfilename()
|
||||||
|
, xterm_font()
|
||||||
|
, xterm_title()
|
||||||
|
{
|
||||||
|
// Initialize arrays with '\0'
|
||||||
|
std::fill_n (termtype, sizeof(termtype), '\0');
|
||||||
|
std::fill_n (termfilename, sizeof(termfilename), '\0');
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FTermData::~FTermData()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline const char* FTermData::getClassName() const
|
||||||
|
{ return "FTermData"; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FTermData::encodingMap& FTermData::getEncodingList()
|
||||||
|
{ return encoding_list; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline fc::encoding FTermData::getTermEncoding() const
|
||||||
|
{ return term_encoding; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FRect& FTermData::getTermGeometry()
|
||||||
|
{ return term_geometry; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline int FTermData::getTTYFileDescriptor() const
|
||||||
|
{ return fd_tty; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline uInt FTermData::getBaudrate() const
|
||||||
|
{ return baudrate; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline char* FTermData::getTermType()
|
||||||
|
{ return termtype; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline char* FTermData::getTermFileName()
|
||||||
|
{ return termfilename; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline const FString& FTermData::getXtermFont() const
|
||||||
|
{ return xterm_font; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline const FString& FTermData::getXtermTitle() const
|
||||||
|
{ return xterm_title; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
#if DEBUG
|
||||||
|
inline int FTermData::getFramebufferBpp() const
|
||||||
|
{ return framebuffer_bpp; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasShadowCharacter() const
|
||||||
|
{ return shadow_character; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasHalfBlockCharacter() const
|
||||||
|
{ return half_block_character; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasCursorOptimisation() const
|
||||||
|
{ return cursor_optimisation; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::isCursorHidden() const
|
||||||
|
{ return hidden_cursor; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasAlternateScreen() const
|
||||||
|
{ return use_alternate_screen; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasASCIIConsole() const
|
||||||
|
{ return ascii_console; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasVT100Console() const
|
||||||
|
{ return vt100_console; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasUTF8Console() const
|
||||||
|
{ return utf8_console; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::isUTF8() const
|
||||||
|
{ return utf8_state; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::isNewFont() const
|
||||||
|
{ return new_font; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::isVGAFont() const
|
||||||
|
{ return vga_font; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::isMonochron() const
|
||||||
|
{ return monochron; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool FTermData::hasTermResized() const
|
||||||
|
{ return resize_term; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setTermEncoding (fc::encoding enc)
|
||||||
|
{ term_encoding = enc; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setTTYFileDescriptor (int fd)
|
||||||
|
{ fd_tty = fd; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setBaudrate (uInt baud)
|
||||||
|
{ baudrate = baud; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::supportShadowCharacter (bool available)
|
||||||
|
{ shadow_character = available; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::supportHalfBlockCharacter (bool available)
|
||||||
|
{ half_block_character = available; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::supportCursorOptimisation (bool available)
|
||||||
|
{ cursor_optimisation = available; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setCursorHidden (bool hidden_state)
|
||||||
|
{ hidden_cursor = hidden_state; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::useAlternateScreen (bool use)
|
||||||
|
{ use_alternate_screen = use; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setASCIIConsole (bool ascii)
|
||||||
|
{ ascii_console = ascii; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setVT100Console (bool vt100)
|
||||||
|
{ vt100_console = vt100; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setUTF8Console (bool utf8)
|
||||||
|
{ utf8_console = utf8; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setUTF8 (bool utf8)
|
||||||
|
{ utf8_state = utf8; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setNewFont (bool nfont)
|
||||||
|
{ new_font = nfont; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setVGAFont (bool vga)
|
||||||
|
{ vga_font = vga; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setMonochron (bool mono)
|
||||||
|
{ monochron = mono; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setTermResized (bool resize)
|
||||||
|
{ resize_term = resize; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setTermType (const char name[])
|
||||||
|
{
|
||||||
|
if ( ! name )
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::strncpy (termtype, name, sizeof(termtype));
|
||||||
|
termtype[sizeof(termtype) - 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setTermFileName (const char file_name[])
|
||||||
|
{
|
||||||
|
if ( ! file_name )
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::strncpy (termfilename, file_name, sizeof(termfilename));
|
||||||
|
termtype[sizeof(termfilename) - 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setXtermFont (const FString& font)
|
||||||
|
{ xterm_font = font; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTermData::setXtermTitle (const FString& title)
|
||||||
|
{ xterm_title = title; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
#if DEBUG
|
||||||
|
inline void FTermData::setFramebufferBpp (int bpp)
|
||||||
|
{ framebuffer_bpp = bpp; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace finalcut
|
||||||
|
|
||||||
|
#endif // FTERMDATA_H
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
#include "final/fconfig.h"
|
#include "final/fconfig.h"
|
||||||
|
#include "final/ftermdata.h"
|
||||||
#include "final/ftermios.h"
|
#include "final/ftermios.h"
|
||||||
#include "final/ftypes.h"
|
#include "final/ftypes.h"
|
||||||
|
|
||||||
|
@ -96,7 +97,6 @@ class FTermDetection
|
||||||
// Accessor
|
// Accessor
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
static char* getTermType();
|
static char* getTermType();
|
||||||
static char* getTermFileName();
|
|
||||||
static int getGnomeTerminalID();
|
static int getGnomeTerminalID();
|
||||||
terminalType& getTermTypeStruct();
|
terminalType& getTermTypeStruct();
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ class FTermDetection
|
||||||
static void setScreenTerm (bool);
|
static void setScreenTerm (bool);
|
||||||
static void setTmuxTerm (bool);
|
static void setTmuxTerm (bool);
|
||||||
static void setTerminalDetection (bool);
|
static void setTerminalDetection (bool);
|
||||||
static void setTermFileName (char[]);
|
static void setTermData (FTermData*);
|
||||||
static void setTtyTypeFileName (char[]);
|
static void setTtyTypeFileName (char[]);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
@ -199,7 +199,6 @@ class FTermDetection
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static char termtype[256];
|
static char termtype[256];
|
||||||
static char termfilename[256];
|
|
||||||
static char ttytypename[256];
|
static char ttytypename[256];
|
||||||
static bool decscusr_support;
|
static bool decscusr_support;
|
||||||
static bool terminal_detection;
|
static bool terminal_detection;
|
||||||
|
@ -207,6 +206,7 @@ class FTermDetection
|
||||||
static int gnome_terminal_id;
|
static int gnome_terminal_id;
|
||||||
static const FString* answer_back;
|
static const FString* answer_back;
|
||||||
static const FString* sec_da;
|
static const FString* sec_da;
|
||||||
|
static FTermData* fterm_data;
|
||||||
static terminalType terminal_type;
|
static terminalType terminal_type;
|
||||||
|
|
||||||
static struct colorEnv
|
static struct colorEnv
|
||||||
|
@ -256,10 +256,6 @@ inline const char* FTermDetection::getClassName() const
|
||||||
inline char* FTermDetection::getTermType()
|
inline char* FTermDetection::getTermType()
|
||||||
{ return termtype; }
|
{ return termtype; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline char* FTermDetection::getTermFileName()
|
|
||||||
{ return termfilename; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FTermDetection::getGnomeTerminalID()
|
inline int FTermDetection::getGnomeTerminalID()
|
||||||
{ return gnome_terminal_id; }
|
{ return gnome_terminal_id; }
|
||||||
|
|
|
@ -169,8 +169,8 @@ class FTermLinux
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
static bool VGAFont;
|
static bool vga_font;
|
||||||
static bool NewFont;
|
static bool new_font;
|
||||||
static bool shadow_character;
|
static bool shadow_character;
|
||||||
static bool half_block_character;
|
static bool half_block_character;
|
||||||
static bool has_saved_palette;
|
static bool has_saved_palette;
|
||||||
|
@ -210,11 +210,11 @@ inline bool FTermLinux::hasHalfBlockCharacter()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTermLinux::isVGAFontUsed()
|
inline bool FTermLinux::isVGAFontUsed()
|
||||||
{ return VGAFont; }
|
{ return vga_font; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTermLinux::isNewFontUsed()
|
inline bool FTermLinux::isNewFontUsed()
|
||||||
{ return NewFont; }
|
{ return new_font; }
|
||||||
#endif // defined(__linux__)
|
#endif // defined(__linux__)
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -60,12 +60,12 @@ class FTermXTerminal
|
||||||
virtual ~FTermXTerminal();
|
virtual ~FTermXTerminal();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
static void setTermcapMap (FTermcap::tcap_map*);
|
|
||||||
static void setFTermDetection (FTermDetection*);
|
static void setFTermDetection (FTermDetection*);
|
||||||
static void redefineDefaultColors (bool);
|
static void redefineDefaultColors (bool);
|
||||||
static void setCursorStyle (fc::xtermCursorStyle);
|
static void setCursorStyle (fc::xtermCursorStyle);
|
||||||
static void setFont (const FString&);
|
static void setFont (const FString&);
|
||||||
static void setTitle (const FString&);
|
static void setTitle (const FString&);
|
||||||
|
static void setTermSize (int, int);
|
||||||
static void setForeground (const FString&);
|
static void setForeground (const FString&);
|
||||||
static void setBackground (const FString&);
|
static void setBackground (const FString&);
|
||||||
static void setCursorColor (const FString&);
|
static void setCursorColor (const FString&);
|
||||||
|
@ -110,6 +110,7 @@ class FTermXTerminal
|
||||||
static void setXTermCursorStyle();
|
static void setXTermCursorStyle();
|
||||||
static void setXTermFont();
|
static void setXTermFont();
|
||||||
static void setXTermTitle();
|
static void setXTermTitle();
|
||||||
|
static void setXTermSize();
|
||||||
static void setXTermForeground();
|
static void setXTermForeground();
|
||||||
static void setXTermBackground();
|
static void setXTermBackground();
|
||||||
static void setXTermCursorColor();
|
static void setXTermCursorColor();
|
||||||
|
@ -135,9 +136,11 @@ class FTermXTerminal
|
||||||
static void disableXTermMetaSendsESC();
|
static void disableXTermMetaSendsESC();
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
static FTermcap::tcap_map* tcap;
|
static bool mouse_support;
|
||||||
static FTermDetection* term_detection;
|
static bool meta_sends_esc;
|
||||||
static fc::xtermCursorStyle cursor_style;
|
static bool xterm_default_colors;
|
||||||
|
static int term_width;
|
||||||
|
static int term_height;
|
||||||
static const FString* xterm_font;
|
static const FString* xterm_font;
|
||||||
static const FString* xterm_title;
|
static const FString* xterm_title;
|
||||||
static const FString* foreground_color;
|
static const FString* foreground_color;
|
||||||
|
@ -146,9 +149,9 @@ class FTermXTerminal
|
||||||
static const FString* mouse_foreground_color;
|
static const FString* mouse_foreground_color;
|
||||||
static const FString* mouse_background_color;
|
static const FString* mouse_background_color;
|
||||||
static const FString* highlight_background_color;
|
static const FString* highlight_background_color;
|
||||||
static bool mouse_support;
|
static FTermcap::tcap_map* tcap;
|
||||||
static bool meta_sends_esc;
|
static FTermDetection* term_detection;
|
||||||
static bool xterm_default_colors;
|
static fc::xtermCursorStyle cursor_style;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -157,10 +160,6 @@ class FTermXTerminal
|
||||||
inline const char* FTermXTerminal::getClassName() const
|
inline const char* FTermXTerminal::getClassName() const
|
||||||
{ return "FTermXTerminal"; }
|
{ return "FTermXTerminal"; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline void FTermXTerminal::setTermcapMap (FTermcap::tcap_map* tc)
|
|
||||||
{ tcap = tc; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FTermXTerminal::setFTermDetection (FTermDetection* td)
|
inline void FTermXTerminal::setFTermDetection (FTermDetection* td)
|
||||||
{ term_detection = td; }
|
{ term_detection = td; }
|
||||||
|
|
|
@ -440,7 +440,7 @@ class FVTerm : public FTerm
|
||||||
static charData s_ch; // shadow character
|
static charData s_ch; // shadow character
|
||||||
static charData i_ch; // inherit background character
|
static charData i_ch; // inherit background character
|
||||||
static FPoint* term_pos; // terminal cursor position
|
static FPoint* term_pos; // terminal cursor position
|
||||||
static termcap_map* tcap;
|
static FTermcap::tcap_map* tcap;
|
||||||
static FKeyboard* keyboard;
|
static FKeyboard* keyboard;
|
||||||
static bool terminal_update_complete;
|
static bool terminal_update_complete;
|
||||||
static bool terminal_update_pending;
|
static bool terminal_update_pending;
|
||||||
|
|
|
@ -227,17 +227,18 @@ void FTermcapQuirksTest::classNameTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirksTest::generalTest()
|
void FTermcapQuirksTest::generalTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
test::tcap_map* caps = new test::tcap_map[last_item];
|
|
||||||
|
|
||||||
for (int i = 0; i < last_item; i++)
|
for (int i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermcap::tabstop = -1;
|
finalcut::FTermcap::tabstop = -1;
|
||||||
finalcut::FTermcap::attr_without_color = -1;
|
finalcut::FTermcap::attr_without_color = -1;
|
||||||
finalcut::FTermcapQuirks quirks;
|
finalcut::FTermcapQuirks quirks;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
quirks.setTermData(&data);
|
||||||
quirks.setFTermDetection (&detect);
|
quirks.setFTermDetection (&detect);
|
||||||
quirks.terminalFixup();
|
quirks.terminalFixup();
|
||||||
|
|
||||||
|
@ -286,23 +287,24 @@ void FTermcapQuirksTest::generalTest()
|
||||||
, C_STR(CSI "29m") );
|
, C_STR(CSI "29m") );
|
||||||
CPPUNIT_ASSERT_CSTRING ( printSequence(caps[finalcut::fc::t_enter_ca_mode].string).c_str()
|
CPPUNIT_ASSERT_CSTRING ( printSequence(caps[finalcut::fc::t_enter_ca_mode].string).c_str()
|
||||||
, C_STR("Esc 7 Esc [ ? 4 7 h ") );
|
, C_STR("Esc 7 Esc [ ? 4 7 h ") );
|
||||||
delete[] caps;
|
//delete[] caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirksTest::xtermTest()
|
void FTermcapQuirksTest::xtermTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
test::tcap_map* caps = new test::tcap_map[last_item];
|
|
||||||
|
|
||||||
for (int i = 0; i < last_item; i++)
|
for (int i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermcapQuirks quirks;
|
finalcut::FTermcapQuirks quirks;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setXTerminal (true);
|
detect.setXTerminal (true);
|
||||||
quirks.setTerminalType ("xterm");
|
data.setTermType ("xterm");
|
||||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
quirks.setTermData(&data);
|
||||||
quirks.setFTermDetection (&detect);
|
quirks.setFTermDetection (&detect);
|
||||||
quirks.terminalFixup();
|
quirks.terminalFixup();
|
||||||
|
|
||||||
|
@ -316,25 +318,25 @@ void FTermcapQuirksTest::xtermTest()
|
||||||
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_normal].string
|
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_normal].string
|
||||||
, C_STR(CSI "?12l" CSI "?25h") );
|
, C_STR(CSI "?12l" CSI "?25h") );
|
||||||
detect.setXTerminal (false);
|
detect.setXTerminal (false);
|
||||||
delete[] caps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirksTest::freebsdTest()
|
void FTermcapQuirksTest::freebsdTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
test::tcap_map* caps = new test::tcap_map[last_item];
|
|
||||||
|
|
||||||
for (int i = 0; i < last_item; i++)
|
for (int i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermcap::attr_without_color = -1;
|
finalcut::FTermcap::attr_without_color = -1;
|
||||||
finalcut::FTermcapQuirks quirks;
|
finalcut::FTermcapQuirks quirks;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setFreeBSDTerm (true);
|
detect.setFreeBSDTerm (true);
|
||||||
quirks.setTerminalType ("xterm-16color");
|
data.setTermType ("xterm-16color");
|
||||||
quirks.setTermcapMap (reinterpret_cast<FTermcap::tcap_map*>(caps));
|
quirks.setTermData(&data);
|
||||||
quirks.setFTermDetection (&detect);
|
quirks.setFTermDetection (&detect);
|
||||||
quirks.terminalFixup();
|
quirks.terminalFixup();
|
||||||
|
|
||||||
|
@ -355,25 +357,25 @@ void FTermcapQuirksTest::freebsdTest()
|
||||||
"%?%p4%t;5%;m"
|
"%?%p4%t;5%;m"
|
||||||
"%?%p9%t\016%e\017%;") );
|
"%?%p9%t\016%e\017%;") );
|
||||||
detect.setFreeBSDTerm (false);
|
detect.setFreeBSDTerm (false);
|
||||||
delete[] caps;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirksTest::cygwinTest()
|
void FTermcapQuirksTest::cygwinTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
test::tcap_map* caps = new test::tcap_map[last_item];
|
|
||||||
|
|
||||||
for (int i = 0; i < last_item; i++)
|
for (int i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermcap::background_color_erase = false;
|
finalcut::FTermcap::background_color_erase = false;
|
||||||
finalcut::FTermcapQuirks quirks;
|
finalcut::FTermcapQuirks quirks;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setCygwinTerminal (true);
|
detect.setCygwinTerminal (true);
|
||||||
quirks.setTerminalType ("cygwin");
|
data.setTermType ("cygwin");
|
||||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
quirks.setTermData(&data);
|
||||||
quirks.setFTermDetection (&detect);
|
quirks.setFTermDetection (&detect);
|
||||||
quirks.terminalFixup();
|
quirks.terminalFixup();
|
||||||
|
|
||||||
|
@ -383,25 +385,25 @@ void FTermcapQuirksTest::cygwinTest()
|
||||||
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_visible].string
|
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_visible].string
|
||||||
, C_STR(CSI "?25h") );
|
, C_STR(CSI "?25h") );
|
||||||
detect.setCygwinTerminal (false);
|
detect.setCygwinTerminal (false);
|
||||||
delete[] caps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirksTest::linuxTest()
|
void FTermcapQuirksTest::linuxTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
test::tcap_map* caps = new test::tcap_map[last_item];
|
|
||||||
|
|
||||||
for (int i = 0; i < last_item; i++)
|
for (int i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermcap::max_color = 8;
|
finalcut::FTermcap::max_color = 8;
|
||||||
finalcut::FTermcap::attr_without_color = -1;
|
finalcut::FTermcap::attr_without_color = -1;
|
||||||
finalcut::FTermcapQuirks quirks;
|
finalcut::FTermcapQuirks quirks;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setLinuxTerm (true);
|
detect.setLinuxTerm (true);
|
||||||
quirks.setTerminalType ("linux");
|
data.setTermType ("linux");
|
||||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
quirks.setTermData(&data);
|
||||||
quirks.setFTermDetection (&detect);
|
quirks.setFTermDetection (&detect);
|
||||||
quirks.terminalFixup();
|
quirks.terminalFixup();
|
||||||
|
|
||||||
|
@ -457,23 +459,23 @@ void FTermcapQuirksTest::linuxTest()
|
||||||
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_underline_mode].string
|
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_underline_mode].string
|
||||||
, 0 );
|
, 0 );
|
||||||
detect.setLinuxTerm (false);
|
detect.setLinuxTerm (false);
|
||||||
delete[] caps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirksTest::rxvtTest()
|
void FTermcapQuirksTest::rxvtTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
test::tcap_map* caps = new test::tcap_map[last_item];
|
|
||||||
|
|
||||||
for (int i = 0; i < last_item; i++)
|
for (int i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermcapQuirks quirks;
|
finalcut::FTermcapQuirks quirks;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setRxvtTerminal (true);
|
detect.setRxvtTerminal (true);
|
||||||
quirks.setTerminalType ("rxvt");
|
data.setTermType ("rxvt");
|
||||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
quirks.setTermData(&data);
|
||||||
quirks.setFTermDetection (&detect);
|
quirks.setFTermDetection (&detect);
|
||||||
quirks.terminalFixup();
|
quirks.terminalFixup();
|
||||||
|
|
||||||
|
@ -483,7 +485,7 @@ void FTermcapQuirksTest::rxvtTest()
|
||||||
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_alt_charset_mode].string
|
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_alt_charset_mode].string
|
||||||
, 0 );
|
, 0 );
|
||||||
// rxvt-16color
|
// rxvt-16color
|
||||||
quirks.setTerminalType ("rxvt-16color");
|
data.setTermType ("rxvt-16color");
|
||||||
quirks.terminalFixup();
|
quirks.terminalFixup();
|
||||||
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_alt_charset_mode].string
|
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_alt_charset_mode].string
|
||||||
, C_STR(ESC "(0") );
|
, C_STR(ESC "(0") );
|
||||||
|
@ -500,24 +502,24 @@ void FTermcapQuirksTest::rxvtTest()
|
||||||
|
|
||||||
detect.setUrxvtTerminal (false);
|
detect.setUrxvtTerminal (false);
|
||||||
detect.setRxvtTerminal (false);
|
detect.setRxvtTerminal (false);
|
||||||
delete[] caps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirksTest::vteTest()
|
void FTermcapQuirksTest::vteTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
test::tcap_map* caps = new test::tcap_map[last_item];
|
|
||||||
|
|
||||||
for (int i = 0; i < last_item; i++)
|
for (int i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermcap::attr_without_color = -1;
|
finalcut::FTermcap::attr_without_color = -1;
|
||||||
finalcut::FTermcapQuirks quirks;
|
finalcut::FTermcapQuirks quirks;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setGnomeTerminal (true);
|
detect.setGnomeTerminal (true);
|
||||||
quirks.setTerminalType ("gnome-256color");
|
data.setTermType ("gnome-256color");
|
||||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
quirks.setTermData(&data);
|
||||||
quirks.setFTermDetection (&detect);
|
quirks.setFTermDetection (&detect);
|
||||||
quirks.terminalFixup();
|
quirks.terminalFixup();
|
||||||
|
|
||||||
|
@ -526,26 +528,26 @@ void FTermcapQuirksTest::vteTest()
|
||||||
, C_STR(CSI "24m") );
|
, C_STR(CSI "24m") );
|
||||||
|
|
||||||
detect.setGnomeTerminal (false);
|
detect.setGnomeTerminal (false);
|
||||||
delete[] caps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirksTest::puttyTest()
|
void FTermcapQuirksTest::puttyTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
test::tcap_map* caps = new test::tcap_map[last_item];
|
|
||||||
|
|
||||||
for (int i = 0; i < last_item; i++)
|
for (int i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermcap::background_color_erase = false;
|
finalcut::FTermcap::background_color_erase = false;
|
||||||
finalcut::FTermcap::osc_support = false;
|
finalcut::FTermcap::osc_support = false;
|
||||||
finalcut::FTermcap::attr_without_color = -1;
|
finalcut::FTermcap::attr_without_color = -1;
|
||||||
finalcut::FTermcapQuirks quirks;
|
finalcut::FTermcapQuirks quirks;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setPuttyTerminal (true);
|
detect.setPuttyTerminal (true);
|
||||||
quirks.setTerminalType ("putty");
|
data.setTermType ("putty");
|
||||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
quirks.setTermData(&data);
|
||||||
quirks.setFTermDetection (&detect);
|
quirks.setFTermDetection (&detect);
|
||||||
quirks.terminalFixup();
|
quirks.terminalFixup();
|
||||||
|
|
||||||
|
@ -611,24 +613,24 @@ void FTermcapQuirksTest::puttyTest()
|
||||||
, C_STR(CSI "M") );
|
, C_STR(CSI "M") );
|
||||||
|
|
||||||
detect.setPuttyTerminal (false);
|
detect.setPuttyTerminal (false);
|
||||||
delete[] caps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirksTest::teratermTest()
|
void FTermcapQuirksTest::teratermTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
test::tcap_map* caps = new test::tcap_map[last_item];
|
|
||||||
|
|
||||||
for (int i = 0; i < last_item; i++)
|
for (int i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermcap::eat_nl_glitch = false;
|
finalcut::FTermcap::eat_nl_glitch = false;
|
||||||
finalcut::FTermcapQuirks quirks;
|
finalcut::FTermcapQuirks quirks;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTeraTerm (true);
|
detect.setTeraTerm (true);
|
||||||
quirks.setTerminalType ("teraterm");
|
data.setTermType ("teraterm");
|
||||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
quirks.setTermData(&data);
|
||||||
quirks.setFTermDetection (&detect);
|
quirks.setFTermDetection (&detect);
|
||||||
quirks.terminalFixup();
|
quirks.terminalFixup();
|
||||||
|
|
||||||
|
@ -643,47 +645,41 @@ void FTermcapQuirksTest::teratermTest()
|
||||||
, C_STR(CSI "39;49m") );
|
, C_STR(CSI "39;49m") );
|
||||||
|
|
||||||
detect.setTeraTerm (false);
|
detect.setTeraTerm (false);
|
||||||
delete[] caps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirksTest::sunTest()
|
void FTermcapQuirksTest::sunTest()
|
||||||
{
|
{
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
finalcut::FTermData data;
|
||||||
test::tcap_map* caps = new test::tcap_map[last_item];
|
|
||||||
|
|
||||||
for (int i = 0; i < last_item; i++)
|
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
|
||||||
|
|
||||||
finalcut::FTermcap::eat_nl_glitch = false;
|
finalcut::FTermcap::eat_nl_glitch = false;
|
||||||
finalcut::FTermcapQuirks quirks;
|
finalcut::FTermcapQuirks quirks;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setSunTerminal (true);
|
detect.setSunTerminal (true);
|
||||||
quirks.setTerminalType ("sun-color");
|
data.setTermType ("sun-color");
|
||||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
quirks.setTermData(&data);
|
||||||
quirks.setFTermDetection (&detect);
|
quirks.setFTermDetection (&detect);
|
||||||
quirks.terminalFixup();
|
quirks.terminalFixup();
|
||||||
|
|
||||||
CPPUNIT_ASSERT ( finalcut::FTermcap::eat_nl_glitch == true );
|
CPPUNIT_ASSERT ( finalcut::FTermcap::eat_nl_glitch == true );
|
||||||
|
|
||||||
detect.setSunTerminal (false);
|
detect.setSunTerminal (false);
|
||||||
delete[] caps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcapQuirksTest::screenTest()
|
void FTermcapQuirksTest::screenTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||||
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
|
||||||
test::tcap_map* caps = new test::tcap_map[last_item];
|
|
||||||
|
|
||||||
for (int i = 0; i < last_item; i++)
|
for (int i = 0; i < last_item; i++)
|
||||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||||
|
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermcapQuirks quirks;
|
finalcut::FTermcapQuirks quirks;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setScreenTerm (true);
|
detect.setScreenTerm (true);
|
||||||
quirks.setTerminalType ("screen-256color");
|
data.setTermType ("screen-256color");
|
||||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
quirks.setTermData(&data);
|
||||||
quirks.setFTermDetection (&detect);
|
quirks.setFTermDetection (&detect);
|
||||||
quirks.terminalFixup();
|
quirks.terminalFixup();
|
||||||
|
|
||||||
|
@ -704,7 +700,6 @@ void FTermcapQuirksTest::screenTest()
|
||||||
"%p4%{255}%*%{1000}%/%2.2X" BEL ESC "\\") );
|
"%p4%{255}%*%{1000}%/%2.2X" BEL ESC "\\") );
|
||||||
detect.setTmuxTerm (false);
|
detect.setTmuxTerm (false);
|
||||||
detect.setScreenTerm (false);
|
detect.setScreenTerm (false);
|
||||||
delete[] caps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -474,9 +474,11 @@ void FTermDetectionTest::classNameTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::ansiTest()
|
void FTermDetectionTest::ansiTest()
|
||||||
{
|
{
|
||||||
setenv ("TERM", "ansi", 1);
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("ansi"));
|
setenv ("TERM", "ansi", 1);
|
||||||
|
data.setTermFileName(C_STR("ansi"));
|
||||||
|
detect.setTermData(&data);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
|
||||||
|
@ -542,8 +544,10 @@ void FTermDetectionTest::ansiTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::xtermTest()
|
void FTermDetectionTest::xtermTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("xterm"));
|
data.setTermFileName(C_STR("xterm"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -602,8 +606,10 @@ void FTermDetectionTest::xtermTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::rxvtTest()
|
void FTermDetectionTest::rxvtTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("rxvt-cygwin-native"));
|
data.setTermFileName(C_STR("rxvt-cygwin-native"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -663,8 +669,10 @@ void FTermDetectionTest::rxvtTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::urxvtTest()
|
void FTermDetectionTest::urxvtTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("rxvt-unicode-256color"));
|
data.setTermFileName(C_STR("rxvt-unicode-256color"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -724,8 +732,10 @@ void FTermDetectionTest::urxvtTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::mltermTest()
|
void FTermDetectionTest::mltermTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("mlterm"));
|
data.setTermFileName(C_STR("mlterm"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -792,8 +802,10 @@ void FTermDetectionTest::mltermTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::puttyTest()
|
void FTermDetectionTest::puttyTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("xterm"));
|
data.setTermFileName(C_STR("xterm"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -853,8 +865,10 @@ void FTermDetectionTest::puttyTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::kdeKonsoleTest()
|
void FTermDetectionTest::kdeKonsoleTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("xterm-256color"));
|
data.setTermFileName(C_STR("xterm-256color"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -913,8 +927,10 @@ void FTermDetectionTest::kdeKonsoleTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::gnomeTerminalTest()
|
void FTermDetectionTest::gnomeTerminalTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("xterm-256color"));
|
data.setTermFileName(C_STR("xterm-256color"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -974,8 +990,10 @@ void FTermDetectionTest::gnomeTerminalTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::ktermTest()
|
void FTermDetectionTest::ktermTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("kterm"));
|
data.setTermFileName(C_STR("kterm"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -1042,8 +1060,10 @@ void FTermDetectionTest::ktermTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::teraTermTest()
|
void FTermDetectionTest::teraTermTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("xterm"));
|
data.setTermFileName(C_STR("xterm"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -1103,8 +1123,10 @@ void FTermDetectionTest::teraTermTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::cygwinTest()
|
void FTermDetectionTest::cygwinTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("cygwin"));
|
data.setTermFileName(C_STR("cygwin"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -1164,8 +1186,10 @@ void FTermDetectionTest::cygwinTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::minttyTest()
|
void FTermDetectionTest::minttyTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("xterm-256color"));
|
data.setTermFileName(C_STR("xterm-256color"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -1225,8 +1249,10 @@ void FTermDetectionTest::minttyTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::linuxTest()
|
void FTermDetectionTest::linuxTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("linux"));
|
data.setTermFileName(C_STR("linux"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -1293,8 +1319,10 @@ void FTermDetectionTest::linuxTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::freebsdTest()
|
void FTermDetectionTest::freebsdTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("xterm"));
|
data.setTermFileName(C_STR("xterm"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -1364,8 +1392,10 @@ void FTermDetectionTest::freebsdTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::netbsdTest()
|
void FTermDetectionTest::netbsdTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("wsvt25"));
|
data.setTermFileName(C_STR("wsvt25"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -1433,8 +1463,10 @@ void FTermDetectionTest::netbsdTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::openbsdTest()
|
void FTermDetectionTest::openbsdTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("vt220"));
|
data.setTermFileName(C_STR("vt220"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -1502,8 +1534,10 @@ void FTermDetectionTest::openbsdTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::sunTest()
|
void FTermDetectionTest::sunTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("sun-color"));
|
data.setTermFileName(C_STR("sun-color"));
|
||||||
|
detect.setTermData(&data);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
|
||||||
|
@ -1569,8 +1603,10 @@ void FTermDetectionTest::sunTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::screenTest()
|
void FTermDetectionTest::screenTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("screen"));
|
data.setTermFileName(C_STR("screen"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -1636,8 +1672,10 @@ void FTermDetectionTest::screenTest()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermDetectionTest::tmuxTest()
|
void FTermDetectionTest::tmuxTest()
|
||||||
{
|
{
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
detect.setTermFileName(C_STR("screen"));
|
data.setTermFileName(C_STR("screen"));
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
|
|
||||||
pid_t pid = forkProcess();
|
pid_t pid = forkProcess();
|
||||||
|
@ -1739,7 +1777,9 @@ void FTermDetectionTest::ttytypeTest()
|
||||||
ttytype << "vt100" << "\t" << "ttyp6" << std::endl;
|
ttytype << "vt100" << "\t" << "ttyp6" << std::endl;
|
||||||
ttytype.close();
|
ttytype.close();
|
||||||
|
|
||||||
|
finalcut::FTermData data;
|
||||||
finalcut::FTermDetection detect;
|
finalcut::FTermDetection detect;
|
||||||
|
detect.setTermData(&data);
|
||||||
detect.setTerminalDetection(true);
|
detect.setTerminalDetection(true);
|
||||||
detect.setTtyTypeFileName(C_STR("new-root-dir/etc/ttytype"));
|
detect.setTtyTypeFileName(C_STR("new-root-dir/etc/ttytype"));
|
||||||
|
|
||||||
|
@ -1759,17 +1799,17 @@ void FTermDetectionTest::ttytypeTest()
|
||||||
unsetenv("TMUX");
|
unsetenv("TMUX");
|
||||||
|
|
||||||
// Test /dev/tty3 with linux
|
// Test /dev/tty3 with linux
|
||||||
detect.setTermFileName(C_STR("/dev/tty3"));
|
data.setTermFileName(C_STR("/dev/tty3"));
|
||||||
detect.detect();
|
detect.detect();
|
||||||
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("linux") );
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("linux") );
|
||||||
|
|
||||||
// Test /dev/ttyp0 with vt100
|
// Test /dev/ttyp0 with vt100
|
||||||
detect.setTermFileName(C_STR("/dev/ttyp0"));
|
data.setTermFileName(C_STR("/dev/ttyp0"));
|
||||||
detect.detect();
|
detect.detect();
|
||||||
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
||||||
|
|
||||||
// Test non-existent /dev/tty8 with fallback to vt100
|
// Test non-existent /dev/tty8 with fallback to vt100
|
||||||
detect.setTermFileName(C_STR("/dev/tty8"));
|
data.setTermFileName(C_STR("/dev/tty8"));
|
||||||
detect.detect();
|
detect.detect();
|
||||||
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue