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>
|
||||
* FListView now has the ability to sort by columns
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ INCLUDES = -I../src/include -I/usr/include/final
|
|||
RM = rm -f
|
||||
|
||||
ifdef DEBUG
|
||||
OPTIMIZE = -O0 -fsanitize=undefined
|
||||
OPTIMIZE = -O0 -fsanitize=bool,bounds,enum,float-cast-overflow,function,null
|
||||
else
|
||||
OPTIMIZE = -O2
|
||||
endif
|
||||
|
|
|
@ -42,6 +42,7 @@ libfinal_la_SOURCES = \
|
|||
fkey_map.cpp \
|
||||
ftextview.cpp \
|
||||
fstatusbar.cpp \
|
||||
ftermcap.cpp \
|
||||
ftermcapquirks.cpp \
|
||||
ftermxterminal.cpp \
|
||||
ftermfreebsd.cpp \
|
||||
|
@ -108,7 +109,6 @@ finalcutinclude_HEADERS = \
|
|||
include/final/fscrollview.h \
|
||||
include/final/fstatusbar.h \
|
||||
include/final/fstring.h \
|
||||
include/final/ftcap_map.h \
|
||||
include/final/ftermcap.h \
|
||||
include/final/ftermcapquirks.h \
|
||||
include/final/ftermxterminal.h \
|
||||
|
|
|
@ -12,10 +12,11 @@ INCLUDE_HEADERS = \
|
|||
fapplication.h \
|
||||
fbuttongroup.h \
|
||||
fbutton.h \
|
||||
ftogglebutton.h \
|
||||
fcheckbox.h \
|
||||
fswitch.h \
|
||||
fdialog.h \
|
||||
fevent.h \
|
||||
fwindow.h \
|
||||
ffiledialog.h \
|
||||
final.h \
|
||||
flabel.h \
|
||||
|
@ -23,15 +24,12 @@ INCLUDE_HEADERS = \
|
|||
flistbox.h \
|
||||
flistview.h \
|
||||
fmenu.h \
|
||||
fmouse.h \
|
||||
fkeyboard.h \
|
||||
fdialoglistmenu.h \
|
||||
fmenubar.h \
|
||||
fradiomenuitem.h \
|
||||
fcheckmenuitem.h \
|
||||
fmessagebox.h \
|
||||
ftooltip.h \
|
||||
fobject.h \
|
||||
foptiattr.h \
|
||||
foptimove.h \
|
||||
ftermbuffer.h \
|
||||
|
@ -43,6 +41,8 @@ INCLUDE_HEADERS = \
|
|||
fscrollview.h \
|
||||
fstatusbar.h \
|
||||
fstring.h \
|
||||
fmouse.h \
|
||||
fkeyboard.h \
|
||||
ftermcap.h \
|
||||
fterm.h \
|
||||
ftermios.h \
|
||||
|
@ -54,11 +54,11 @@ INCLUDE_HEADERS = \
|
|||
ftermlinux.h \
|
||||
fvterm.h \
|
||||
ftextview.h \
|
||||
ftogglebutton.h \
|
||||
fcolorpalette.h \
|
||||
fwidgetcolors.h \
|
||||
fwidget.h \
|
||||
fwindow.h
|
||||
fevent.h \
|
||||
fobject.h \
|
||||
|
||||
# compiler parameter
|
||||
CXX = clang++
|
||||
|
@ -87,8 +87,6 @@ OBJS = \
|
|||
flistbox.o \
|
||||
flistview.o \
|
||||
fmenu.o \
|
||||
fmouse.o \
|
||||
fkeyboard.o \
|
||||
fdialoglistmenu.o \
|
||||
fmenubar.o \
|
||||
fmenuitem.o \
|
||||
|
@ -96,14 +94,17 @@ OBJS = \
|
|||
fcheckmenuitem.o \
|
||||
fmenulist.o \
|
||||
fdialog.o \
|
||||
fscrollview.o \
|
||||
fwindow.o \
|
||||
fscrollview.o \
|
||||
fmessagebox.o \
|
||||
ftooltip.o \
|
||||
ffiledialog.o \
|
||||
fkey_map.o \
|
||||
ftextview.o \
|
||||
fstatusbar.o \
|
||||
fmouse.o \
|
||||
fkeyboard.o \
|
||||
ftermcap.o \
|
||||
fterm.o \
|
||||
ftermios.o \
|
||||
ftermdetection.o \
|
||||
|
@ -113,7 +114,6 @@ OBJS = \
|
|||
ftermopenbsd.o \
|
||||
ftermlinux.o \
|
||||
fvterm.o \
|
||||
fevent.o \
|
||||
foptiattr.o \
|
||||
foptimove.o \
|
||||
ftermbuffer.o \
|
||||
|
@ -121,12 +121,14 @@ OBJS = \
|
|||
fcolorpalette.o \
|
||||
fwidgetcolors.o \
|
||||
fwidget.o \
|
||||
fevent.o \
|
||||
fobject.o
|
||||
|
||||
TERMCAP := $(shell test -n "$$(ldd {/usr,}/lib64/libncursesw.so.5 2>/dev/null | grep libtinfo)" && echo "-ltinfo" || echo "-lncurses")
|
||||
|
||||
ifdef DEBUG
|
||||
OPTIMIZE = -O0 -fsanitize=undefined
|
||||
OPTIMIZE = -O0 -fsanitize=bool,bounds,enum,float-cast-overflow,function,null
|
||||
# OPTIMIZE = -O0 -fsanitize=undefined
|
||||
else
|
||||
OPTIMIZE = -O2
|
||||
endif
|
||||
|
|
|
@ -12,10 +12,11 @@ INCLUDE_HEADERS = \
|
|||
fapplication.h \
|
||||
fbuttongroup.h \
|
||||
fbutton.h \
|
||||
ftogglebutton.h \
|
||||
fcheckbox.h \
|
||||
fswitch.h \
|
||||
fdialog.h \
|
||||
fevent.h \
|
||||
fwindow.h \
|
||||
ffiledialog.h \
|
||||
final.h \
|
||||
flabel.h \
|
||||
|
@ -23,15 +24,12 @@ INCLUDE_HEADERS = \
|
|||
flistbox.h \
|
||||
flistview.h \
|
||||
fmenu.h \
|
||||
fmouse.h \
|
||||
fkeyboard.h \
|
||||
fdialoglistmenu.h \
|
||||
fmenubar.h \
|
||||
fradiomenuitem.h \
|
||||
fcheckmenuitem.h \
|
||||
fmessagebox.h \
|
||||
ftooltip.h \
|
||||
fobject.h \
|
||||
foptiattr.h \
|
||||
foptimove.h \
|
||||
ftermbuffer.h \
|
||||
|
@ -43,6 +41,8 @@ INCLUDE_HEADERS = \
|
|||
fscrollview.h \
|
||||
fstatusbar.h \
|
||||
fstring.h \
|
||||
fmouse.h \
|
||||
fkeyboard.h \
|
||||
ftermcap.h \
|
||||
fterm.h \
|
||||
ftermios.h \
|
||||
|
@ -54,11 +54,11 @@ INCLUDE_HEADERS = \
|
|||
ftermlinux.h \
|
||||
fvterm.h \
|
||||
ftextview.h \
|
||||
ftogglebutton.h \
|
||||
fcolorpalette.h \
|
||||
fwidgetcolors.h \
|
||||
fwidget.h \
|
||||
fwindow.h
|
||||
fevent.h \
|
||||
fobject.h
|
||||
|
||||
# compiler parameter
|
||||
CXX = g++
|
||||
|
@ -87,8 +87,6 @@ OBJS = \
|
|||
flistbox.o \
|
||||
flistview.o \
|
||||
fmenu.o \
|
||||
fmouse.o \
|
||||
fkeyboard.o \
|
||||
fdialoglistmenu.o \
|
||||
fmenubar.o \
|
||||
fmenuitem.o \
|
||||
|
@ -96,14 +94,17 @@ OBJS = \
|
|||
fcheckmenuitem.o \
|
||||
fmenulist.o \
|
||||
fdialog.o \
|
||||
fscrollview.o \
|
||||
fwindow.o \
|
||||
fscrollview.o \
|
||||
fmessagebox.o \
|
||||
ftooltip.o \
|
||||
ffiledialog.o \
|
||||
fkey_map.o \
|
||||
ftextview.o \
|
||||
fstatusbar.o \
|
||||
fmouse.o \
|
||||
fkeyboard.o \
|
||||
ftermcap.o \
|
||||
fterm.o \
|
||||
ftermios.o \
|
||||
ftermdetection.o \
|
||||
|
@ -113,7 +114,6 @@ OBJS = \
|
|||
ftermopenbsd.o \
|
||||
ftermlinux.o \
|
||||
fvterm.o \
|
||||
fevent.o \
|
||||
foptiattr.o \
|
||||
foptimove.o \
|
||||
ftermbuffer.o \
|
||||
|
@ -121,6 +121,7 @@ OBJS = \
|
|||
fcolorpalette.o \
|
||||
fwidgetcolors.o \
|
||||
fwidget.o \
|
||||
fevent.o \
|
||||
fobject.o
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
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)
|
||||
{
|
||||
// Click on the lower right resize corner
|
||||
|
||||
if ( isResizeable()
|
||||
&& ( (ms.mouse_x == getWidth() && ms.mouse_y == getHeight() - 1)
|
||||
|| ( (ms.mouse_x == getWidth() - 1
|
||||
|| ms.mouse_x == getWidth()) && ms.mouse_y == getHeight()) ) )
|
||||
if ( isResizeable() && isLowerRightResizeCorner(ms) )
|
||||
{
|
||||
resize_click_pos = ms.termPos;
|
||||
FPoint lower_right_pos = getTermGeometry().getLowerRightPos();
|
||||
|
|
|
@ -79,7 +79,7 @@ FKeyboard::FKeyboard()
|
|||
, keypressed_cmd()
|
||||
, keyreleased_cmd()
|
||||
, escape_key_cmd()
|
||||
, termcap_map(0)
|
||||
, key_map(0)
|
||||
{
|
||||
// Initialize keyboard values
|
||||
time_keypressed.tv_sec = 0;
|
||||
|
@ -123,7 +123,7 @@ const FString FKeyboard::getKeyName (int keynum)
|
|||
//----------------------------------------------------------------------
|
||||
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 );
|
||||
|
||||
if ( ! termcap_map )
|
||||
if ( ! key_map )
|
||||
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++)
|
||||
{
|
||||
char* k = keymap[i].string;
|
||||
|
|
|
@ -789,42 +789,14 @@ int FListView::addColumn (const FString& label, int width)
|
|||
FObject::FObjectIterator FListView::insert ( FListViewItem* item
|
||||
, 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;
|
||||
headerItems::iterator header_iter;
|
||||
int line_width;
|
||||
int element_count;
|
||||
|
||||
if ( parent_iter == FListView::null_iter )
|
||||
return FListView::null_iter;
|
||||
|
||||
// Determine the line width
|
||||
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;
|
||||
}
|
||||
|
||||
line_width = determineLineWidth (item);
|
||||
recalculateHorizontalBar (line_width);
|
||||
|
||||
if ( parent_iter == root )
|
||||
|
@ -862,7 +834,7 @@ FObject::FObjectIterator FListView::insert ( FListViewItem* item
|
|||
// Sort list by a column (only if activated)
|
||||
sort();
|
||||
|
||||
int element_count = int(getCount());
|
||||
element_count = int(getCount());
|
||||
recalculateVerticalBar (element_count);
|
||||
return item_iter;
|
||||
}
|
||||
|
@ -1862,6 +1834,42 @@ void FListView::updateDrawing (bool draw_vbar, bool draw_hbar)
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -65,7 +65,10 @@ FOptiMove::FOptiMove (int baud)
|
|||
, screen_height(24)
|
||||
{
|
||||
assert ( baud >= 0 );
|
||||
move_buf[0] = '\0';
|
||||
|
||||
// Initialize arrays with '\0'
|
||||
std::fill_n (move_buf, sizeof(move_buf), '\0');
|
||||
|
||||
calculateCharDuration();
|
||||
|
||||
// ANSI set cursor address preset for undefined terminals
|
||||
|
|
|
@ -99,7 +99,7 @@ bool FStatusKey::setMouseFocus(bool on)
|
|||
if ( on == mouse_focus )
|
||||
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
|
||||
{
|
||||
uInt x;
|
||||
uInt insert_len = uInt(std::wcslen(s));
|
||||
|
||||
if ( len > insert_len )
|
||||
len = insert_len;
|
||||
|
||||
if ( (length + len + 1) <= bufsize )
|
||||
{
|
||||
|
|
521
src/fterm.cpp
521
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 *
|
||||
* *
|
||||
* Copyright 2015-2017 Markus Gans *
|
||||
* Copyright 2015-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 *
|
||||
|
@ -20,22 +20,41 @@
|
|||
* <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"
|
||||
|
||||
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
|
||||
// | .-------- Tcap-code
|
||||
|
@ -140,8 +159,4 @@ static FTermcap::tcap_map term_caps[] =
|
|||
* "XX", "Us" and "Ue" are unofficial and they are only used here.
|
||||
*/
|
||||
|
||||
} // namespace fc
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
#endif // FTCAPMAP_H
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace finalcut
|
|||
{
|
||||
|
||||
// static class attributes
|
||||
char FTermcapQuirks::termtype[256] = { };
|
||||
FTermcap::tcap_map* FTermcapQuirks::tcap = 0;
|
||||
FTermData* FTermcapQuirks::fterm_data = 0;
|
||||
FTermDetection* FTermcapQuirks::term_detection = 0;
|
||||
|
||||
|
||||
|
@ -38,7 +38,9 @@ FTermDetection* FTermcapQuirks::term_detection = 0;
|
|||
// constructors and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FTermcapQuirks::FTermcapQuirks()
|
||||
{ }
|
||||
{
|
||||
tcap = FTermcap::getTermcapMap();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FTermcapQuirks::~FTermcapQuirks() // destructor
|
||||
|
@ -47,16 +49,9 @@ FTermcapQuirks::~FTermcapQuirks() // destructor
|
|||
|
||||
// public methods of FTermcapQuirks
|
||||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirks::setTerminalType (const char tt[])
|
||||
void FTermcapQuirks::setTermData (FTermData* data)
|
||||
{
|
||||
std::strncpy (termtype, tt, sizeof(termtype));
|
||||
termtype[sizeof(termtype) - 1] = '\0';
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirks::setTermcapMap (FTermcap::tcap_map* tc)
|
||||
{
|
||||
tcap = tc;
|
||||
fterm_data = data;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -255,6 +250,8 @@ void FTermcapQuirks::init_termcap_xterm_quirks()
|
|||
void FTermcapQuirks::init_termcap_rxvt_quirks()
|
||||
{
|
||||
// Set enter/exit alternative charset mode for rxvt terminal
|
||||
const char* termtype = fterm_data->getTermType();
|
||||
|
||||
if ( std::strncmp(termtype, "rxvt-16color", 12) == 0 )
|
||||
{
|
||||
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 };
|
||||
FTermDetection::colorEnv FTermDetection::color_env;
|
||||
FTermDetection::secondaryDA FTermDetection::secondary_da;
|
||||
FTermData* FTermDetection::fterm_data = 0;
|
||||
char FTermDetection::termtype[256] = { };
|
||||
char FTermDetection::termfilename[256] = { };
|
||||
char FTermDetection::ttytypename[256] = { };
|
||||
bool FTermDetection::decscusr_support;
|
||||
bool FTermDetection::terminal_detection;
|
||||
|
@ -89,13 +89,9 @@ FTermDetection::~FTermDetection() // destructor
|
|||
|
||||
// public methods of FTermDetection
|
||||
//----------------------------------------------------------------------
|
||||
void FTermDetection::setTermFileName (char term_filename[])
|
||||
void FTermDetection::setTermData (FTermData* data)
|
||||
{
|
||||
if ( ! term_filename )
|
||||
return;
|
||||
|
||||
std::strncpy (termfilename, term_filename, sizeof(termfilename));
|
||||
termfilename[sizeof(termfilename) - 1] = '\0';
|
||||
fterm_data = data;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -128,6 +124,7 @@ void FTermDetection::getSystemTermType()
|
|||
{
|
||||
// Import the untrusted environment variable TERM
|
||||
const char* const& term_env = std::getenv(C_STR("TERM"));
|
||||
const char* termfilename = fterm_data->getTermFileName();
|
||||
|
||||
if ( term_env )
|
||||
{
|
||||
|
@ -164,6 +161,7 @@ bool FTermDetection::getTTYtype()
|
|||
// vt100 ttys0
|
||||
|
||||
// Get term basename
|
||||
const char* termfilename = fterm_data->getTermFileName();
|
||||
const char* term_basename = std::strrchr(termfilename, '/');
|
||||
|
||||
if ( term_basename == 0 )
|
||||
|
@ -221,6 +219,7 @@ bool FTermDetection::getTTYSFileEntry()
|
|||
// Analyse /etc/ttys and get the term name
|
||||
|
||||
// get term basename
|
||||
const char* termfilename = fterm_data->getTermFileName();
|
||||
const char* term_basename = std::strrchr(termfilename, '/');
|
||||
|
||||
if ( term_basename == 0 )
|
||||
|
|
|
@ -38,8 +38,8 @@ namespace finalcut
|
|||
console_font_op FTermLinux::screen_font;
|
||||
unimapdesc FTermLinux::screen_unicode_map;
|
||||
|
||||
bool FTermLinux::NewFont;
|
||||
bool FTermLinux::VGAFont;
|
||||
bool FTermLinux::new_font;
|
||||
bool FTermLinux::vga_font;
|
||||
bool FTermLinux::shadow_character = true;
|
||||
bool FTermLinux::half_block_character = true;
|
||||
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;
|
||||
|
||||
if ( NewFont || VGAFont )
|
||||
if ( new_font || vga_font )
|
||||
return;
|
||||
|
||||
if ( screen_unicode_map.entry_ct != 0 )
|
||||
|
@ -255,7 +255,7 @@ void FTermLinux::finish()
|
|||
//----------------------------------------------------------------------
|
||||
bool FTermLinux::loadVGAFont()
|
||||
{
|
||||
VGAFont = true;
|
||||
vga_font = true;
|
||||
|
||||
if ( FTerm::openConsole() == 0 )
|
||||
{
|
||||
|
@ -265,7 +265,7 @@ bool FTermLinux::loadVGAFont()
|
|||
int ret = setScreenFont(fc::__8x16std, 256, 8, 16);
|
||||
|
||||
if ( ret != 0 )
|
||||
VGAFont = false;
|
||||
vga_font = false;
|
||||
|
||||
// unicode character mapping
|
||||
struct unimapdesc unimap;
|
||||
|
@ -275,24 +275,24 @@ bool FTermLinux::loadVGAFont()
|
|||
setUnicodeMap(&unimap);
|
||||
}
|
||||
else
|
||||
VGAFont = false;
|
||||
vga_font = false;
|
||||
|
||||
FTerm::detectTermSize();
|
||||
FTerm::closeConsole();
|
||||
}
|
||||
else
|
||||
VGAFont = false;
|
||||
vga_font = false;
|
||||
|
||||
if ( VGAFont )
|
||||
if ( vga_font )
|
||||
shadow_character = half_block_character = true;
|
||||
|
||||
return VGAFont;
|
||||
return vga_font;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FTermLinux::loadNewFont()
|
||||
{
|
||||
NewFont = true;
|
||||
new_font = true;
|
||||
|
||||
if ( FTerm::openConsole() == 0 )
|
||||
{
|
||||
|
@ -302,7 +302,7 @@ bool FTermLinux::loadNewFont()
|
|||
int ret = setScreenFont(fc::__8x16graph, 256, 8, 16);
|
||||
|
||||
if ( ret != 0 )
|
||||
NewFont = false;
|
||||
new_font = false;
|
||||
|
||||
// unicode character mapping
|
||||
struct unimapdesc unimap;
|
||||
|
@ -312,18 +312,18 @@ bool FTermLinux::loadNewFont()
|
|||
setUnicodeMap(&unimap);
|
||||
}
|
||||
else
|
||||
NewFont = false;
|
||||
new_font = false;
|
||||
|
||||
FTerm::detectTermSize();
|
||||
FTerm::closeConsole();
|
||||
}
|
||||
else
|
||||
NewFont = false;
|
||||
new_font = false;
|
||||
|
||||
if ( VGAFont )
|
||||
if ( vga_font )
|
||||
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 )
|
||||
VGAFont = NewFont = false;
|
||||
vga_font = new_font = false;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -31,9 +31,8 @@ namespace finalcut
|
|||
bool FTermXTerminal::mouse_support;
|
||||
bool FTermXTerminal::meta_sends_esc;
|
||||
bool FTermXTerminal::xterm_default_colors;
|
||||
FTermcap::tcap_map* FTermXTerminal::tcap = 0;
|
||||
FTermDetection* FTermXTerminal::term_detection = 0;
|
||||
fc::xtermCursorStyle FTermXTerminal::cursor_style = fc::unknown_cursor_style;
|
||||
int FTermXTerminal::term_width = 80;
|
||||
int FTermXTerminal::term_height = 24;
|
||||
const FString* FTermXTerminal::xterm_font = 0;
|
||||
const FString* FTermXTerminal::xterm_title = 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_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 = \
|
||||
meta_sends_esc = \
|
||||
xterm_default_colors = false;
|
||||
|
||||
tcap = FTermcap::getTermcapMap();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -121,6 +125,16 @@ void FTermXTerminal::setTitle (const FString& title)
|
|||
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)
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -51,8 +51,7 @@ FPoint* FVTerm::term_pos = 0;
|
|||
FVTerm::term_area* FVTerm::vterm = 0;
|
||||
FVTerm::term_area* FVTerm::vdesktop = 0;
|
||||
FVTerm::term_area* FVTerm::active_area = 0;
|
||||
FVTerm::termcap_map* FVTerm::tcap = 0;
|
||||
FTermcap::tcap_map* FTermcap::tcap = 0;
|
||||
FTermcap::tcap_map* FVTerm::tcap = 0;
|
||||
FKeyboard* FVTerm::keyboard = 0;
|
||||
FVTerm::charData FVTerm::term_attribute;
|
||||
FVTerm::charData FVTerm::next_attribute;
|
||||
|
@ -2099,7 +2098,7 @@ void FVTerm::init()
|
|||
std::memcpy (&next_attribute, &term_attribute, sizeof(charData));
|
||||
|
||||
// Receive the terminal capabilities
|
||||
tcap = FTermcap().getTermcapMap();
|
||||
tcap = FTermcap::getTermcapMap();
|
||||
|
||||
// Create virtual terminal
|
||||
FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
|
||||
|
|
|
@ -361,7 +361,7 @@ bool FWidget::setEnable (bool on)
|
|||
else
|
||||
flags &= ~fc::active;
|
||||
|
||||
return enable = ( on ) ? true : false;
|
||||
return enable = on;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -414,7 +414,7 @@ bool FWidget::setFocus (bool on)
|
|||
window->setWindowFocusWidget(this);
|
||||
}
|
||||
|
||||
return focus = ( on ) ? true : false;
|
||||
return focus = on;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -174,7 +174,7 @@ bool FWindow::activateWindow (bool on)
|
|||
active_area = getVWin();
|
||||
}
|
||||
|
||||
return window_active = ( on ) ? true : false;
|
||||
return window_active = on;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -79,7 +79,7 @@ enum events
|
|||
Timer_Event // timer event occur
|
||||
};
|
||||
|
||||
// Properties of a widget
|
||||
// Properties of a widget ⚑
|
||||
enum widget_flags
|
||||
{
|
||||
shadow = 0x00000001,
|
||||
|
|
|
@ -207,6 +207,7 @@ class FDialog : public FWindow
|
|||
void moveSizeKey (FKeyEvent*);
|
||||
void raiseActivateDialog();
|
||||
void lowerActivateDialog();
|
||||
bool isLowerRightResizeCorner (mouseStates&);
|
||||
void resizeMouseDown (mouseStates&);
|
||||
void resizeMouseUpMove (mouseStates&, bool = false);
|
||||
void cancelMouseResize();
|
||||
|
|
|
@ -177,7 +177,7 @@ class FKeyboard
|
|||
FKeyboardCommand escape_key_cmd;
|
||||
|
||||
static timeval time_keypressed;
|
||||
fc::fkeymap* termcap_map;
|
||||
fc::fkeymap* key_map;
|
||||
|
||||
#if defined(__linux__)
|
||||
#undef linux
|
||||
|
|
|
@ -355,6 +355,7 @@ class FListView : public FWidget
|
|||
void drawColumnEllipsis ( headerItems::const_iterator&
|
||||
, const FString& );
|
||||
void updateDrawing (bool, bool);
|
||||
int determineLineWidth (FListViewItem* item);
|
||||
void recalculateHorizontalBar (int);
|
||||
void recalculateVerticalBar (int);
|
||||
void wheelUp (int);
|
||||
|
@ -473,7 +474,7 @@ inline void FListView::setUserDescendingCompare (Compare cmp)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListView::setTreeView (bool on)
|
||||
{ return tree_view = ( on ) ? true : false; }
|
||||
{ return tree_view = on; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListView::setTreeView()
|
||||
|
|
|
@ -139,7 +139,6 @@
|
|||
#include "final/fkey_map.h"
|
||||
#include "final/fkeyboard.h"
|
||||
#include "final/fmouse.h"
|
||||
#include "final/fobject.h"
|
||||
#include "final/foptiattr.h"
|
||||
#include "final/foptimove.h"
|
||||
#include "final/fpoint.h"
|
||||
|
@ -147,6 +146,7 @@
|
|||
#include "final/fstring.h"
|
||||
#include "final/ftermcap.h"
|
||||
#include "final/ftermcapquirks.h"
|
||||
#include "final/ftermdata.h"
|
||||
#include "final/ftermdetection.h"
|
||||
|
||||
#if defined(__linux__)
|
||||
|
@ -187,147 +187,138 @@ class FTerm
|
|||
virtual ~FTerm();
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
static FKeyboard* getKeyboard();
|
||||
static FMouseControl* getMouseControl();
|
||||
static int getLineNumber();
|
||||
static int getColumnNumber();
|
||||
static const FString getKeyName (int);
|
||||
virtual const char* getClassName() const;
|
||||
static FKeyboard* getKeyboard();
|
||||
static FMouseControl* getMouseControl();
|
||||
static int getLineNumber();
|
||||
static int getColumnNumber();
|
||||
static const FString getKeyName (int);
|
||||
|
||||
static int getTTYFileDescriptor();
|
||||
static char* getTermType();
|
||||
static char* getTermFileName();
|
||||
static int getTabstop();
|
||||
static int getMaxColor();
|
||||
static int getTTYFileDescriptor();
|
||||
static char* getTermType();
|
||||
static char* getTermFileName();
|
||||
static int getTabstop();
|
||||
static int getMaxColor();
|
||||
|
||||
#if DEBUG
|
||||
static const FString& getAnswerbackString();
|
||||
static const FString& getSecDAString();
|
||||
static const char* getTermType_256color();
|
||||
static const char* getTermType_Answerback();
|
||||
static const char* getTermType_SecDA();
|
||||
static int getFramebufferBpp();
|
||||
static const FString& getAnswerbackString();
|
||||
static const FString& getSecDAString();
|
||||
static const char* getTermType_256color();
|
||||
static const char* getTermType_Answerback();
|
||||
static const char* getTermType_SecDA();
|
||||
static int getFramebufferBpp();
|
||||
#endif // DEBUG
|
||||
|
||||
// Inquiries
|
||||
static bool isCursorHidden();
|
||||
static bool isNormal (charData*&);
|
||||
static bool isRaw();
|
||||
static bool hasPCcharset();
|
||||
static bool hasUTF8();
|
||||
static bool hasVT100();
|
||||
static bool hasASCII();
|
||||
static bool isMonochron();
|
||||
static bool isXTerminal();
|
||||
static bool isAnsiTerminal();
|
||||
static bool isRxvtTerminal();
|
||||
static bool isUrxvtTerminal();
|
||||
static bool isMltermTerminal();
|
||||
static bool isPuttyTerminal();
|
||||
static bool isKdeTerminal();
|
||||
static bool isGnomeTerminal();
|
||||
static bool isKtermTerminal();
|
||||
static bool isTeraTerm();
|
||||
static bool isSunTerminal();
|
||||
static bool isCygwinTerminal();
|
||||
static bool isMinttyTerm();
|
||||
static bool isLinuxTerm();
|
||||
static bool isFreeBSDTerm();
|
||||
static bool isNetBSDTerm();
|
||||
static bool isOpenBSDTerm();
|
||||
static bool isScreenTerm();
|
||||
static bool isTmuxTerm();
|
||||
static bool isNewFont();
|
||||
static bool isUTF8();
|
||||
static bool isNormal (charData*&);
|
||||
static bool isRaw();
|
||||
static bool hasUTF8();
|
||||
static bool hasVT100();
|
||||
static bool hasASCII();
|
||||
static bool isMonochron();
|
||||
static bool isXTerminal();
|
||||
static bool isAnsiTerminal();
|
||||
static bool isRxvtTerminal();
|
||||
static bool isUrxvtTerminal();
|
||||
static bool isMltermTerminal();
|
||||
static bool isPuttyTerminal();
|
||||
static bool isKdeTerminal();
|
||||
static bool isGnomeTerminal();
|
||||
static bool isKtermTerminal();
|
||||
static bool isTeraTerm();
|
||||
static bool isSunTerminal();
|
||||
static bool isCygwinTerminal();
|
||||
static bool isMinttyTerm();
|
||||
static bool isLinuxTerm();
|
||||
static bool isFreeBSDTerm();
|
||||
static bool isNetBSDTerm();
|
||||
static bool isOpenBSDTerm();
|
||||
static bool isScreenTerm();
|
||||
static bool isTmuxTerm();
|
||||
static bool isNewFont();
|
||||
|
||||
// Mutators
|
||||
static void setTermType (const char[]);
|
||||
static void setInsertCursor (bool on);
|
||||
static void setInsertCursor();
|
||||
static void unsetInsertCursor();
|
||||
static bool setCursorOptimisation (bool);
|
||||
static void redefineDefaultColors (bool);
|
||||
static void setDblclickInterval (const long);
|
||||
static void disableAltScreen();
|
||||
static bool setUTF8 (bool);
|
||||
static bool setUTF8();
|
||||
static bool unsetUTF8();
|
||||
static void setTermType (const char[]);
|
||||
static void setInsertCursor (bool on);
|
||||
static void setInsertCursor();
|
||||
static void unsetInsertCursor();
|
||||
static void redefineDefaultColors (bool);
|
||||
static void setDblclickInterval (const long);
|
||||
static bool setUTF8 (bool);
|
||||
static bool setUTF8();
|
||||
static bool unsetUTF8();
|
||||
|
||||
// Methods
|
||||
static bool setVGAFont();
|
||||
static bool setNewFont();
|
||||
static bool setOldFont();
|
||||
static int openConsole();
|
||||
static int closeConsole();
|
||||
static char* moveCursor (int, int, int, int);
|
||||
static char* cursorsVisibility (bool);
|
||||
static void printMoveDurations();
|
||||
static char* enableCursor();
|
||||
static char* disableCursor();
|
||||
static void detectTermSize();
|
||||
static void setTermSize (int, int);
|
||||
static void setTermTitle(const FString&);
|
||||
static void setKDECursor (fc::kdeKonsoleCursorShape);
|
||||
static void saveColorMap();
|
||||
static void resetColorMap();
|
||||
static void setPalette (short, int, int, int);
|
||||
static void setBeep (int, int);
|
||||
static void resetBeep();
|
||||
static void beep();
|
||||
static bool setVGAFont();
|
||||
static bool setNewFont();
|
||||
static bool setOldFont();
|
||||
static int openConsole();
|
||||
static int closeConsole();
|
||||
static char* moveCursor (int, int, int, int);
|
||||
static char* cursorsVisibility (bool);
|
||||
static void printMoveDurations();
|
||||
static char* enableCursor();
|
||||
static char* disableCursor();
|
||||
static void detectTermSize();
|
||||
static void setTermSize (int, int);
|
||||
static void setTermTitle(const FString&);
|
||||
static void setKDECursor (fc::kdeKonsoleCursorShape);
|
||||
static void saveColorMap();
|
||||
static void resetColorMap();
|
||||
static void setPalette (short, int, int, int);
|
||||
static void setBeep (int, int);
|
||||
static void resetBeep();
|
||||
static void beep();
|
||||
|
||||
static void setEncoding (fc::encoding);
|
||||
static fc::encoding getEncoding();
|
||||
static std::string getEncodingString();
|
||||
static bool charEncodable (uInt);
|
||||
static uInt charEncode (uInt);
|
||||
static uInt charEncode (uInt, fc::encoding);
|
||||
static void setEncoding (fc::encoding);
|
||||
static fc::encoding getEncoding();
|
||||
static std::string getEncodingString();
|
||||
static bool charEncodable (uInt);
|
||||
static uInt charEncode (uInt);
|
||||
static uInt charEncode (uInt, fc::encoding);
|
||||
|
||||
static bool scrollTermForward();
|
||||
static bool scrollTermReverse();
|
||||
static bool scrollTermForward();
|
||||
static bool scrollTermReverse();
|
||||
|
||||
// function pointer -> static function
|
||||
static int (*Fputchar)(int);
|
||||
static int (*Fputchar)(int);
|
||||
|
||||
static void putstringf (const char[], ...)
|
||||
static void putstringf (const char[], ...)
|
||||
#if defined(__clang__)
|
||||
__attribute__((__format__ (__printf__, 1, 2)))
|
||||
#elif defined(__GNUC__)
|
||||
__attribute__ ((format (printf, 1, 2)))
|
||||
#endif
|
||||
;
|
||||
static void putstring (const char[], int = 1);
|
||||
;
|
||||
static void putstring (const char[], int = 1);
|
||||
|
||||
#if defined(__sun) && defined(__SVR4)
|
||||
static int putchar_ASCII (char);
|
||||
static int putchar_ASCII (char);
|
||||
#endif
|
||||
|
||||
static int putchar_ASCII (int);
|
||||
static int putchar_UTF8 (int);
|
||||
|
||||
#if DEBUG
|
||||
static int framebuffer_bpp;
|
||||
#endif
|
||||
static int putchar_ASCII (int);
|
||||
static int putchar_UTF8 (int);
|
||||
|
||||
protected:
|
||||
// Inquiries
|
||||
static bool hasChangedTermSize();
|
||||
static bool hasShadowCharacter();
|
||||
static bool hasHalfBlockCharacter();
|
||||
static bool hasAlternateScreen();
|
||||
static bool hasChangedTermSize();
|
||||
static bool hasShadowCharacter();
|
||||
static bool hasHalfBlockCharacter();
|
||||
static bool hasAlternateScreen();
|
||||
|
||||
// Accessors
|
||||
FOptiMove* getFOptiMove();
|
||||
FOptiMove* getFOptiMove();
|
||||
|
||||
// Methods
|
||||
static void initScreenSettings();
|
||||
static char* changeAttribute ( charData*&
|
||||
, charData*& );
|
||||
static void changeTermSizeFinished();
|
||||
static void exitWithMessage (std::string)
|
||||
static void initScreenSettings();
|
||||
static char* changeAttribute ( charData*&
|
||||
, charData*& );
|
||||
static void changeTermSizeFinished();
|
||||
static void exitWithMessage (const FString&)
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
__attribute__((noreturn))
|
||||
#endif
|
||||
;
|
||||
;
|
||||
// Data Members
|
||||
static struct initializationValues
|
||||
{
|
||||
|
@ -374,107 +365,70 @@ class FTerm
|
|||
} init_values;
|
||||
|
||||
private:
|
||||
// Typedefs
|
||||
typedef FTermcap::tcap_map termcap_map;
|
||||
|
||||
// Disable copy constructor
|
||||
FTerm (const FTerm&);
|
||||
// Disable assignment operator (=)
|
||||
FTerm& operator = (const FTerm&);
|
||||
|
||||
// Methods
|
||||
static void init_global_values();
|
||||
static void oscPrefix();
|
||||
static void oscPostfix();
|
||||
static void init_alt_charset();
|
||||
static void init_pc_charset();
|
||||
static void init_cygwin_charmap();
|
||||
static void init_teraterm_charmap();
|
||||
static void init_fixed_max_color();
|
||||
static void init_keyboard();
|
||||
static void init_termcap();
|
||||
static void init_termcap_error (int);
|
||||
static void init_termcap_variables(char*&);
|
||||
static void init_termcap_booleans();
|
||||
static void init_termcap_numerics();
|
||||
static void init_termcap_strings (char*&);
|
||||
static void init_termcap_keys (char*&);
|
||||
static void init_OptiMove();
|
||||
static void init_OptiAttr();
|
||||
static void init_font();
|
||||
static void init_locale();
|
||||
static void init_encoding();
|
||||
static void init_encoding_set();
|
||||
static void init_term_encoding();
|
||||
static void init_individual_term_encoding();
|
||||
static bool init_force_vt100_encoding();
|
||||
static void init_utf8_without_alt_charset();
|
||||
static void init_tab_quirks();
|
||||
static void init_captureFontAndTitle();
|
||||
static void redefineColorPalette();
|
||||
static void restoreColorPalette();
|
||||
static void setInsertCursorStyle();
|
||||
static void setOverwriteCursorStyle();
|
||||
static void enableMouse();
|
||||
static void disableMouse();
|
||||
static void useAlternateScreenBuffer();
|
||||
static void useNormalScreenBuffer();
|
||||
void allocationValues();
|
||||
void deallocationValues();
|
||||
void init();
|
||||
void initOSspecifics();
|
||||
void finish();
|
||||
void finishOSspecifics1();
|
||||
void finish_encoding();
|
||||
static uInt cp437_to_unicode (uChar);
|
||||
static void setSignalHandler();
|
||||
static void resetSignalHandler();
|
||||
static void signal_handler (int);
|
||||
static void init_global_values (bool);
|
||||
static void init_terminal_device_path();
|
||||
static void oscPrefix();
|
||||
static void oscPostfix();
|
||||
static void init_alt_charset();
|
||||
static void init_pc_charset();
|
||||
static void init_cygwin_charmap();
|
||||
static void init_teraterm_charmap();
|
||||
static void init_fixed_max_color();
|
||||
static void init_keyboard();
|
||||
static void init_termcap();
|
||||
static void init_termcap_error (int);
|
||||
static void init_termcap_variables(char*&);
|
||||
static void init_termcap_booleans();
|
||||
static void init_termcap_numerics();
|
||||
static void init_termcap_strings (char*&);
|
||||
static void init_termcap_keys (char*&);
|
||||
static void init_OptiMove();
|
||||
static void init_OptiAttr();
|
||||
static void init_font();
|
||||
static void init_locale();
|
||||
static void init_encoding();
|
||||
static void init_encoding_set();
|
||||
static void init_term_encoding();
|
||||
static void init_individual_term_encoding();
|
||||
static void init_force_vt100_encoding();
|
||||
static void init_utf8_without_alt_charset();
|
||||
static void init_tab_quirks();
|
||||
static void init_captureFontAndTitle();
|
||||
static void redefineColorPalette();
|
||||
static void restoreColorPalette();
|
||||
static void setInsertCursorStyle();
|
||||
static void setOverwriteCursorStyle();
|
||||
static void enableMouse();
|
||||
static void disableMouse();
|
||||
static void useAlternateScreenBuffer();
|
||||
static void useNormalScreenBuffer();
|
||||
void allocationValues();
|
||||
void deallocationValues();
|
||||
void init (bool);
|
||||
void initOSspecifics();
|
||||
void finish();
|
||||
void finishOSspecifics1();
|
||||
void finish_encoding();
|
||||
static uInt cp437_to_unicode (uChar);
|
||||
static void setSignalHandler();
|
||||
static void resetSignalHandler();
|
||||
static void signal_handler (int);
|
||||
|
||||
// Data Members
|
||||
static std::map <uChar,uChar>* vt100_alt_char;
|
||||
static std::map <std::string,fc::encoding>* encoding_set;
|
||||
static FTermData* data;
|
||||
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 FOptiAttr* opti_attr;
|
||||
static FTermDetection* term_detection;
|
||||
static FTermXTerminal* xterm;
|
||||
static FKeyboard* keyboard;
|
||||
static FMouseControl* mouse;
|
||||
|
||||
#if defined(__linux__)
|
||||
#undef linux
|
||||
|
@ -488,10 +442,6 @@ class FTerm
|
|||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
static FTermOpenBSD* openbsd;
|
||||
#endif
|
||||
|
||||
static FMouseControl* mouse;
|
||||
static const FString* save_xterm_font;
|
||||
static const FString* save_xterm_title;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
@ -511,15 +461,15 @@ inline FMouseControl* FTerm::getMouseControl()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FTerm::getTTYFileDescriptor()
|
||||
{ return fd_tty; }
|
||||
{ return data->getTTYFileDescriptor(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline char* FTerm::getTermType()
|
||||
{ return termtype; }
|
||||
{ return data->getTermType(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline char* FTerm::getTermFileName()
|
||||
{ return termfilename; }
|
||||
{ return data->getTermFileName(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FTerm::getTabstop()
|
||||
|
@ -552,32 +502,16 @@ inline const char* FTerm::getTermType_SecDA()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FTerm::getFramebufferBpp()
|
||||
{ return framebuffer_bpp; }
|
||||
{ return data->getFramebufferBpp(); }
|
||||
#endif // DEBUG
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::isCursorHidden()
|
||||
{ return hidden_cursor; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::hasPCcharset()
|
||||
{ return pc_charset_console; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::hasUTF8()
|
||||
{ return utf8_console; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::hasVT100()
|
||||
{ return vt100_console; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::hasASCII()
|
||||
{ return ascii_console; }
|
||||
{ return data->hasUTF8Console(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::isMonochron()
|
||||
{ return monochron; }
|
||||
{ return data->isMonochron(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::isXTerminal()
|
||||
|
@ -657,11 +591,7 @@ inline bool FTerm::isTmuxTerm()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::isNewFont()
|
||||
{ return NewFont; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::isUTF8()
|
||||
{ return utf8_state; }
|
||||
{ return data->isNewFont(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTerm::setInsertCursor()
|
||||
|
@ -671,14 +601,6 @@ inline void FTerm::setInsertCursor()
|
|||
inline void FTerm::unsetInsertCursor()
|
||||
{ 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()
|
||||
{ return setUTF8(true); }
|
||||
|
@ -689,19 +611,19 @@ inline bool FTerm::unsetUTF8()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::hasChangedTermSize()
|
||||
{ return resize_term; }
|
||||
{ return data->hasTermResized(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::hasShadowCharacter()
|
||||
{ return shadow_character; }
|
||||
{ return data->hasShadowCharacter(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::hasHalfBlockCharacter()
|
||||
{ return half_block_character; }
|
||||
{ return data->hasHalfBlockCharacter(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::hasAlternateScreen()
|
||||
{ return use_alternate_screen; }
|
||||
{ return data->hasAlternateScreen(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FOptiMove* FTerm::getFOptiMove()
|
||||
|
@ -709,7 +631,7 @@ inline FOptiMove* FTerm::getFOptiMove()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTerm::changeTermSizeFinished()
|
||||
{ resize_term = false; }
|
||||
{ data->setTermResized(false); }
|
||||
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* 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 *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -61,12 +61,10 @@ class FTermcap
|
|||
tcap_map;
|
||||
|
||||
// Constructors
|
||||
FTermcap()
|
||||
{ }
|
||||
FTermcap();
|
||||
|
||||
// Destructor
|
||||
~FTermcap()
|
||||
{ }
|
||||
~FTermcap();
|
||||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
|
@ -76,12 +74,6 @@ class FTermcap
|
|||
return tcap;
|
||||
}
|
||||
|
||||
// Mutator
|
||||
static void setTermcapMap (tcap_map* t)
|
||||
{
|
||||
tcap = t;
|
||||
}
|
||||
|
||||
// Data Members
|
||||
static bool background_color_erase;
|
||||
static bool automatic_left_margin;
|
||||
|
@ -95,16 +87,17 @@ class FTermcap
|
|||
static int attr_without_color;
|
||||
|
||||
private:
|
||||
// Data Members
|
||||
static tcap_map* tcap;
|
||||
// Data Member
|
||||
static tcap_map tcap[];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
// FOptiMove inline functions
|
||||
// FTermcap inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTermcap::getClassName() const
|
||||
{ return "FTermcap"; }
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
|
||||
#endif // FTERMCAP_H
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "final/fc.h"
|
||||
#include "final/fterm.h"
|
||||
#include "final/ftermcap.h"
|
||||
#include "final/ftermdata.h"
|
||||
#include "final/ftermdetection.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -63,8 +64,7 @@ class FTermcapQuirks
|
|||
const char* getClassName() const;
|
||||
|
||||
// Mutator
|
||||
static void setTerminalType (const char[]);
|
||||
static void setTermcapMap (FTermcap::tcap_map*);
|
||||
static void setTermData (FTermData*);
|
||||
static void setFTermDetection (FTermDetection*);
|
||||
|
||||
// Methods
|
||||
|
@ -87,8 +87,8 @@ class FTermcapQuirks
|
|||
static void init_termcap_general_quirks();
|
||||
|
||||
// Data Members
|
||||
static char termtype[256];
|
||||
static FTermcap::tcap_map* tcap;
|
||||
static FTermData* fterm_data;
|
||||
static FTermDetection* term_detection;
|
||||
};
|
||||
#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/fconfig.h"
|
||||
#include "final/ftermdata.h"
|
||||
#include "final/ftermios.h"
|
||||
#include "final/ftypes.h"
|
||||
|
||||
|
@ -96,7 +97,6 @@ class FTermDetection
|
|||
// Accessor
|
||||
const char* getClassName() const;
|
||||
static char* getTermType();
|
||||
static char* getTermFileName();
|
||||
static int getGnomeTerminalID();
|
||||
terminalType& getTermTypeStruct();
|
||||
|
||||
|
@ -153,7 +153,7 @@ class FTermDetection
|
|||
static void setScreenTerm (bool);
|
||||
static void setTmuxTerm (bool);
|
||||
static void setTerminalDetection (bool);
|
||||
static void setTermFileName (char[]);
|
||||
static void setTermData (FTermData*);
|
||||
static void setTtyTypeFileName (char[]);
|
||||
|
||||
// Methods
|
||||
|
@ -199,7 +199,6 @@ class FTermDetection
|
|||
|
||||
// Data Members
|
||||
static char termtype[256];
|
||||
static char termfilename[256];
|
||||
static char ttytypename[256];
|
||||
static bool decscusr_support;
|
||||
static bool terminal_detection;
|
||||
|
@ -207,6 +206,7 @@ class FTermDetection
|
|||
static int gnome_terminal_id;
|
||||
static const FString* answer_back;
|
||||
static const FString* sec_da;
|
||||
static FTermData* fterm_data;
|
||||
static terminalType terminal_type;
|
||||
|
||||
static struct colorEnv
|
||||
|
@ -256,10 +256,6 @@ inline const char* FTermDetection::getClassName() const
|
|||
inline char* FTermDetection::getTermType()
|
||||
{ return termtype; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline char* FTermDetection::getTermFileName()
|
||||
{ return termfilename; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FTermDetection::getGnomeTerminalID()
|
||||
{ return gnome_terminal_id; }
|
||||
|
|
|
@ -169,8 +169,8 @@ class FTermLinux
|
|||
|
||||
// Data Members
|
||||
#if defined(__linux__)
|
||||
static bool VGAFont;
|
||||
static bool NewFont;
|
||||
static bool vga_font;
|
||||
static bool new_font;
|
||||
static bool shadow_character;
|
||||
static bool half_block_character;
|
||||
static bool has_saved_palette;
|
||||
|
@ -210,11 +210,11 @@ inline bool FTermLinux::hasHalfBlockCharacter()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTermLinux::isVGAFontUsed()
|
||||
{ return VGAFont; }
|
||||
{ return vga_font; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTermLinux::isNewFontUsed()
|
||||
{ return NewFont; }
|
||||
{ return new_font; }
|
||||
#endif // defined(__linux__)
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -60,12 +60,12 @@ class FTermXTerminal
|
|||
virtual ~FTermXTerminal();
|
||||
|
||||
// Mutators
|
||||
static void setTermcapMap (FTermcap::tcap_map*);
|
||||
static void setFTermDetection (FTermDetection*);
|
||||
static void redefineDefaultColors (bool);
|
||||
static void setCursorStyle (fc::xtermCursorStyle);
|
||||
static void setFont (const FString&);
|
||||
static void setTitle (const FString&);
|
||||
static void setTermSize (int, int);
|
||||
static void setForeground (const FString&);
|
||||
static void setBackground (const FString&);
|
||||
static void setCursorColor (const FString&);
|
||||
|
@ -110,6 +110,7 @@ class FTermXTerminal
|
|||
static void setXTermCursorStyle();
|
||||
static void setXTermFont();
|
||||
static void setXTermTitle();
|
||||
static void setXTermSize();
|
||||
static void setXTermForeground();
|
||||
static void setXTermBackground();
|
||||
static void setXTermCursorColor();
|
||||
|
@ -135,9 +136,11 @@ class FTermXTerminal
|
|||
static void disableXTermMetaSendsESC();
|
||||
|
||||
// Data Members
|
||||
static FTermcap::tcap_map* tcap;
|
||||
static FTermDetection* term_detection;
|
||||
static fc::xtermCursorStyle cursor_style;
|
||||
static bool mouse_support;
|
||||
static bool meta_sends_esc;
|
||||
static bool xterm_default_colors;
|
||||
static int term_width;
|
||||
static int term_height;
|
||||
static const FString* xterm_font;
|
||||
static const FString* xterm_title;
|
||||
static const FString* foreground_color;
|
||||
|
@ -146,9 +149,9 @@ class FTermXTerminal
|
|||
static const FString* mouse_foreground_color;
|
||||
static const FString* mouse_background_color;
|
||||
static const FString* highlight_background_color;
|
||||
static bool mouse_support;
|
||||
static bool meta_sends_esc;
|
||||
static bool xterm_default_colors;
|
||||
static FTermcap::tcap_map* tcap;
|
||||
static FTermDetection* term_detection;
|
||||
static fc::xtermCursorStyle cursor_style;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
@ -157,10 +160,6 @@ class FTermXTerminal
|
|||
inline const char* FTermXTerminal::getClassName() const
|
||||
{ return "FTermXTerminal"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTermXTerminal::setTermcapMap (FTermcap::tcap_map* tc)
|
||||
{ tcap = tc; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTermXTerminal::setFTermDetection (FTermDetection* td)
|
||||
{ term_detection = td; }
|
||||
|
|
|
@ -440,7 +440,7 @@ class FVTerm : public FTerm
|
|||
static charData s_ch; // shadow character
|
||||
static charData i_ch; // inherit background character
|
||||
static FPoint* term_pos; // terminal cursor position
|
||||
static termcap_map* tcap;
|
||||
static FTermcap::tcap_map* tcap;
|
||||
static FKeyboard* keyboard;
|
||||
static bool terminal_update_complete;
|
||||
static bool terminal_update_pending;
|
||||
|
|
|
@ -149,7 +149,7 @@ static tcap_map tcap[] =
|
|||
{ 0, "\0" }
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
} // namespace test
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -227,17 +227,18 @@ void FTermcapQuirksTest::classNameTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirksTest::generalTest()
|
||||
{
|
||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
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++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermcap::tabstop = -1;
|
||||
finalcut::FTermcap::attr_without_color = -1;
|
||||
finalcut::FTermcapQuirks quirks;
|
||||
finalcut::FTermDetection detect;
|
||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
||||
quirks.setTermData(&data);
|
||||
quirks.setFTermDetection (&detect);
|
||||
quirks.terminalFixup();
|
||||
|
||||
|
@ -286,23 +287,24 @@ void FTermcapQuirksTest::generalTest()
|
|||
, C_STR(CSI "29m") );
|
||||
CPPUNIT_ASSERT_CSTRING ( printSequence(caps[finalcut::fc::t_enter_ca_mode].string).c_str()
|
||||
, C_STR("Esc 7 Esc [ ? 4 7 h ") );
|
||||
delete[] caps;
|
||||
//delete[] caps;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirksTest::xtermTest()
|
||||
{
|
||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
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++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermcapQuirks quirks;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setXTerminal (true);
|
||||
quirks.setTerminalType ("xterm");
|
||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
||||
data.setTermType ("xterm");
|
||||
quirks.setTermData(&data);
|
||||
quirks.setFTermDetection (&detect);
|
||||
quirks.terminalFixup();
|
||||
|
||||
|
@ -316,25 +318,25 @@ void FTermcapQuirksTest::xtermTest()
|
|||
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_normal].string
|
||||
, C_STR(CSI "?12l" CSI "?25h") );
|
||||
detect.setXTerminal (false);
|
||||
delete[] caps;
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirksTest::freebsdTest()
|
||||
{
|
||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
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++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermcap::attr_without_color = -1;
|
||||
finalcut::FTermcapQuirks quirks;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setFreeBSDTerm (true);
|
||||
quirks.setTerminalType ("xterm-16color");
|
||||
quirks.setTermcapMap (reinterpret_cast<FTermcap::tcap_map*>(caps));
|
||||
data.setTermType ("xterm-16color");
|
||||
quirks.setTermData(&data);
|
||||
quirks.setFTermDetection (&detect);
|
||||
quirks.terminalFixup();
|
||||
|
||||
|
@ -355,25 +357,25 @@ void FTermcapQuirksTest::freebsdTest()
|
|||
"%?%p4%t;5%;m"
|
||||
"%?%p9%t\016%e\017%;") );
|
||||
detect.setFreeBSDTerm (false);
|
||||
delete[] caps;
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirksTest::cygwinTest()
|
||||
{
|
||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
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++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermcap::background_color_erase = false;
|
||||
finalcut::FTermcapQuirks quirks;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setCygwinTerminal (true);
|
||||
quirks.setTerminalType ("cygwin");
|
||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
||||
data.setTermType ("cygwin");
|
||||
quirks.setTermData(&data);
|
||||
quirks.setFTermDetection (&detect);
|
||||
quirks.terminalFixup();
|
||||
|
||||
|
@ -383,25 +385,25 @@ void FTermcapQuirksTest::cygwinTest()
|
|||
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_visible].string
|
||||
, C_STR(CSI "?25h") );
|
||||
detect.setCygwinTerminal (false);
|
||||
delete[] caps;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirksTest::linuxTest()
|
||||
{
|
||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
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++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermcap::max_color = 8;
|
||||
finalcut::FTermcap::attr_without_color = -1;
|
||||
finalcut::FTermcapQuirks quirks;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setLinuxTerm (true);
|
||||
quirks.setTerminalType ("linux");
|
||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
||||
data.setTermType ("linux");
|
||||
quirks.setTermData(&data);
|
||||
quirks.setFTermDetection (&detect);
|
||||
quirks.terminalFixup();
|
||||
|
||||
|
@ -457,23 +459,23 @@ void FTermcapQuirksTest::linuxTest()
|
|||
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_underline_mode].string
|
||||
, 0 );
|
||||
detect.setLinuxTerm (false);
|
||||
delete[] caps;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirksTest::rxvtTest()
|
||||
{
|
||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
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++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermcapQuirks quirks;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setRxvtTerminal (true);
|
||||
quirks.setTerminalType ("rxvt");
|
||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
||||
data.setTermType ("rxvt");
|
||||
quirks.setTermData(&data);
|
||||
quirks.setFTermDetection (&detect);
|
||||
quirks.terminalFixup();
|
||||
|
||||
|
@ -483,7 +485,7 @@ void FTermcapQuirksTest::rxvtTest()
|
|||
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_alt_charset_mode].string
|
||||
, 0 );
|
||||
// rxvt-16color
|
||||
quirks.setTerminalType ("rxvt-16color");
|
||||
data.setTermType ("rxvt-16color");
|
||||
quirks.terminalFixup();
|
||||
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_alt_charset_mode].string
|
||||
, C_STR(ESC "(0") );
|
||||
|
@ -500,24 +502,24 @@ void FTermcapQuirksTest::rxvtTest()
|
|||
|
||||
detect.setUrxvtTerminal (false);
|
||||
detect.setRxvtTerminal (false);
|
||||
delete[] caps;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirksTest::vteTest()
|
||||
{
|
||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
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++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermcap::attr_without_color = -1;
|
||||
finalcut::FTermcapQuirks quirks;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setGnomeTerminal (true);
|
||||
quirks.setTerminalType ("gnome-256color");
|
||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
||||
data.setTermType ("gnome-256color");
|
||||
quirks.setTermData(&data);
|
||||
quirks.setFTermDetection (&detect);
|
||||
quirks.terminalFixup();
|
||||
|
||||
|
@ -526,26 +528,26 @@ void FTermcapQuirksTest::vteTest()
|
|||
, C_STR(CSI "24m") );
|
||||
|
||||
detect.setGnomeTerminal (false);
|
||||
delete[] caps;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirksTest::puttyTest()
|
||||
{
|
||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
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++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermcap::background_color_erase = false;
|
||||
finalcut::FTermcap::osc_support = false;
|
||||
finalcut::FTermcap::attr_without_color = -1;
|
||||
finalcut::FTermcapQuirks quirks;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setPuttyTerminal (true);
|
||||
quirks.setTerminalType ("putty");
|
||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
||||
data.setTermType ("putty");
|
||||
quirks.setTermData(&data);
|
||||
quirks.setFTermDetection (&detect);
|
||||
quirks.terminalFixup();
|
||||
|
||||
|
@ -611,24 +613,24 @@ void FTermcapQuirksTest::puttyTest()
|
|||
, C_STR(CSI "M") );
|
||||
|
||||
detect.setPuttyTerminal (false);
|
||||
delete[] caps;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirksTest::teratermTest()
|
||||
{
|
||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
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++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermcap::eat_nl_glitch = false;
|
||||
finalcut::FTermcapQuirks quirks;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTeraTerm (true);
|
||||
quirks.setTerminalType ("teraterm");
|
||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
||||
data.setTermType ("teraterm");
|
||||
quirks.setTermData(&data);
|
||||
quirks.setFTermDetection (&detect);
|
||||
quirks.terminalFixup();
|
||||
|
||||
|
@ -643,47 +645,41 @@ void FTermcapQuirksTest::teratermTest()
|
|||
, C_STR(CSI "39;49m") );
|
||||
|
||||
detect.setTeraTerm (false);
|
||||
delete[] caps;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirksTest::sunTest()
|
||||
{
|
||||
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++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermcap::eat_nl_glitch = false;
|
||||
finalcut::FTermcapQuirks quirks;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setSunTerminal (true);
|
||||
quirks.setTerminalType ("sun-color");
|
||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
||||
data.setTermType ("sun-color");
|
||||
quirks.setTermData(&data);
|
||||
quirks.setFTermDetection (&detect);
|
||||
quirks.terminalFixup();
|
||||
|
||||
CPPUNIT_ASSERT ( finalcut::FTermcap::eat_nl_glitch == true );
|
||||
|
||||
detect.setSunTerminal (false);
|
||||
delete[] caps;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermcapQuirksTest::screenTest()
|
||||
{
|
||||
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
|
||||
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++)
|
||||
memcpy(&caps[i], &test::tcap[i], sizeof(test::tcap[0]));
|
||||
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermcapQuirks quirks;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setScreenTerm (true);
|
||||
quirks.setTerminalType ("screen-256color");
|
||||
quirks.setTermcapMap (reinterpret_cast<finalcut::FTermcap::tcap_map*>(caps));
|
||||
data.setTermType ("screen-256color");
|
||||
quirks.setTermData(&data);
|
||||
quirks.setFTermDetection (&detect);
|
||||
quirks.terminalFixup();
|
||||
|
||||
|
@ -704,7 +700,6 @@ void FTermcapQuirksTest::screenTest()
|
|||
"%p4%{255}%*%{1000}%/%2.2X" BEL ESC "\\") );
|
||||
detect.setTmuxTerm (false);
|
||||
detect.setScreenTerm (false);
|
||||
delete[] caps;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -474,9 +474,11 @@ void FTermDetectionTest::classNameTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::ansiTest()
|
||||
{
|
||||
setenv ("TERM", "ansi", 1);
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("ansi"));
|
||||
setenv ("TERM", "ansi", 1);
|
||||
data.setTermFileName(C_STR("ansi"));
|
||||
detect.setTermData(&data);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
||||
|
@ -542,8 +544,10 @@ void FTermDetectionTest::ansiTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::xtermTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("xterm"));
|
||||
data.setTermFileName(C_STR("xterm"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -602,8 +606,10 @@ void FTermDetectionTest::xtermTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::rxvtTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("rxvt-cygwin-native"));
|
||||
data.setTermFileName(C_STR("rxvt-cygwin-native"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -663,8 +669,10 @@ void FTermDetectionTest::rxvtTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::urxvtTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("rxvt-unicode-256color"));
|
||||
data.setTermFileName(C_STR("rxvt-unicode-256color"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -724,8 +732,10 @@ void FTermDetectionTest::urxvtTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::mltermTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("mlterm"));
|
||||
data.setTermFileName(C_STR("mlterm"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -792,8 +802,10 @@ void FTermDetectionTest::mltermTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::puttyTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("xterm"));
|
||||
data.setTermFileName(C_STR("xterm"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -853,8 +865,10 @@ void FTermDetectionTest::puttyTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::kdeKonsoleTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("xterm-256color"));
|
||||
data.setTermFileName(C_STR("xterm-256color"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -913,8 +927,10 @@ void FTermDetectionTest::kdeKonsoleTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::gnomeTerminalTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("xterm-256color"));
|
||||
data.setTermFileName(C_STR("xterm-256color"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -974,8 +990,10 @@ void FTermDetectionTest::gnomeTerminalTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::ktermTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("kterm"));
|
||||
data.setTermFileName(C_STR("kterm"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -1042,8 +1060,10 @@ void FTermDetectionTest::ktermTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::teraTermTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("xterm"));
|
||||
data.setTermFileName(C_STR("xterm"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -1103,8 +1123,10 @@ void FTermDetectionTest::teraTermTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::cygwinTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("cygwin"));
|
||||
data.setTermFileName(C_STR("cygwin"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -1164,8 +1186,10 @@ void FTermDetectionTest::cygwinTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::minttyTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("xterm-256color"));
|
||||
data.setTermFileName(C_STR("xterm-256color"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -1225,8 +1249,10 @@ void FTermDetectionTest::minttyTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::linuxTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("linux"));
|
||||
data.setTermFileName(C_STR("linux"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -1293,8 +1319,10 @@ void FTermDetectionTest::linuxTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::freebsdTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("xterm"));
|
||||
data.setTermFileName(C_STR("xterm"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -1364,8 +1392,10 @@ void FTermDetectionTest::freebsdTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::netbsdTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("wsvt25"));
|
||||
data.setTermFileName(C_STR("wsvt25"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -1433,8 +1463,10 @@ void FTermDetectionTest::netbsdTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::openbsdTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("vt220"));
|
||||
data.setTermFileName(C_STR("vt220"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -1502,8 +1534,10 @@ void FTermDetectionTest::openbsdTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::sunTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("sun-color"));
|
||||
data.setTermFileName(C_STR("sun-color"));
|
||||
detect.setTermData(&data);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
||||
|
@ -1569,8 +1603,10 @@ void FTermDetectionTest::sunTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::screenTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("screen"));
|
||||
data.setTermFileName(C_STR("screen"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -1636,8 +1672,10 @@ void FTermDetectionTest::screenTest()
|
|||
//----------------------------------------------------------------------
|
||||
void FTermDetectionTest::tmuxTest()
|
||||
{
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermFileName(C_STR("screen"));
|
||||
data.setTermFileName(C_STR("screen"));
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
|
||||
pid_t pid = forkProcess();
|
||||
|
@ -1739,7 +1777,9 @@ void FTermDetectionTest::ttytypeTest()
|
|||
ttytype << "vt100" << "\t" << "ttyp6" << std::endl;
|
||||
ttytype.close();
|
||||
|
||||
finalcut::FTermData data;
|
||||
finalcut::FTermDetection detect;
|
||||
detect.setTermData(&data);
|
||||
detect.setTerminalDetection(true);
|
||||
detect.setTtyTypeFileName(C_STR("new-root-dir/etc/ttytype"));
|
||||
|
||||
|
@ -1759,17 +1799,17 @@ void FTermDetectionTest::ttytypeTest()
|
|||
unsetenv("TMUX");
|
||||
|
||||
// Test /dev/tty3 with linux
|
||||
detect.setTermFileName(C_STR("/dev/tty3"));
|
||||
data.setTermFileName(C_STR("/dev/tty3"));
|
||||
detect.detect();
|
||||
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("linux") );
|
||||
|
||||
// Test /dev/ttyp0 with vt100
|
||||
detect.setTermFileName(C_STR("/dev/ttyp0"));
|
||||
data.setTermFileName(C_STR("/dev/ttyp0"));
|
||||
detect.detect();
|
||||
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
||||
|
||||
// Test non-existent /dev/tty8 with fallback to vt100
|
||||
detect.setTermFileName(C_STR("/dev/tty8"));
|
||||
data.setTermFileName(C_STR("/dev/tty8"));
|
||||
detect.detect();
|
||||
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
||||
|
||||
|
|
Loading…
Reference in New Issue