Merge pull request #25 from gansm/master

merge
This commit is contained in:
Markus Gans 2018-11-25 19:58:39 +01:00 committed by GitHub
commit 11871cba89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 5046 additions and 2266 deletions

View File

@ -1,10 +1,21 @@
2018-11-25 Markus Gans <guru.mail@muenster.de>
* Version 0.5.0
* Namespace fix in FTermFreeBSD and FTermOpenBSD
* Fix compiler warning on non-x86 architectures
2018-11-24 Markus Gans <guru.mail@muenster.de>
* Improved Sun Microsystems workstation console quirks
* Handling environment variables with numbers in FTerm
* Memory management fix in example program transparent
2018-11-21 Markus Gans <guru.mail@muenster.de>
* New type FKey for key inputs
* The integer type of FPoint and FRect changed from short to int
2018-11-18 Markus Gans <guru.mail@muenster.de>
* The FListViewItem class now provides checkable list view items
* Adding the checklist example to demonstrate the checkable FListViewItems
* Adding the checklist example to demonstrate the checkable
FListViewItems
* A checkable FListViewItem now shows the input cursor
2018-11-12 Markus Gans <guru.mail@muenster.de>

View File

@ -8,7 +8,7 @@ ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = finalcut.pc
pkgconfigdir = $(datadir)/pkgconfig
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = finalcut.pc
CLEANFILES = finalcut.pc

View File

@ -2,6 +2,8 @@
============================================
### Building and code analysis
*Latest release:*<br />
&#160;&#160;&#160;&#160;&#160;[![Latest Release](https://img.shields.io/github/release/gansm/finalcut.svg)](https://github.com/gansm/finalcut/releases) <br />
*Travis CI:*<br />
&#160;&#160;&#160;&#160;&#160;[![Build Status](https://travis-ci.org/gansm/finalcut.svg?branch=master)](https://travis-ci.org/gansm/finalcut) <br />
*Coverity Scan:*<br />
@ -11,6 +13,7 @@
*Class Reference:*<br />
&#160;&#160;&#160;&#160;&#160;[![documented](https://codedocs.xyz/gansm/finalcut.svg)](https://codedocs.xyz/gansm/finalcut/hierarchy.html)
### Description
The FINAL CUT is a C++ class library and widget toolkit with full mouse support for creating a [text-based user interface](https://en.wikipedia.org/wiki/Text-based_user_interface). The library supports the programmer to develop an application for the text console. It allows the simultaneous handling of multiple text windows on the screen.
The structure of the Qt framework was originally the inspiration for the C++ class design of FINAL CUT. It provides common controls like dialog boxes, push buttons, check boxes, radio buttons, input lines, list boxes, status bars and so on.

View File

@ -43,7 +43,7 @@ fi
# Build commands
case "$1" in
"--release"|"release")
if ! ./configure --prefix="$PREFIX" CXXFLAGS="-O3 -fno-rtti"
if ! ./configure --prefix="$PREFIX" CXXFLAGS="-O2" # "-O3 -fno-rtti"
then
echo "${RED}Configure failed!${NORMAL}" 1>&2
exit -1

View File

@ -4,7 +4,7 @@
# Process this file with autoconf to produce a configure script.
AC_INIT([finalcut], [0.4.0])
AC_INIT([finalcut], [0.5.0])
AC_CONFIG_HEADER([config.h])
AX_PREFIX_CONFIG_H([src/include/final/fconfig.h], [F])
AC_CONFIG_SRCDIR([src/fobject.cpp])
@ -60,7 +60,7 @@ LT_OUTPUT
### This defines the version number of the installed .so files
### Update this value for every release! (A:B:C will map to foo.so.(A-C).C.B)
### using libtool's versioning system.
AC_SUBST(SO_VERSION, ["4:0:4"])
AC_SUBST(SO_VERSION, ["5:0:5"])
AC_SUBST([LIBTOOL_DEPS])

8
debian/changelog vendored
View File

@ -1,3 +1,9 @@
finalcut (0.5.0) unstable; urgency=low
* Release (version 0.5.0)
-- Markus Gans <guru.mail@muenster.de> Sun, 25 Nov 2018 01:03:36 +0100
finalcut (0.4.0) unstable; urgency=low
* Release (version 0.4.0)
@ -8,7 +14,7 @@ finalcut (0.3.0) unstable; urgency=low
* Release (version 0.3.0)
-- Markus Gans <guru.mail@muenster.de> Sat, 27 Nov 2016 15:00:41 +0100
-- Markus Gans <guru.mail@muenster.de> Sun, 27 Nov 2016 15:00:41 +0100
finalcut (0.2.0) unstable; urgency=low

View File

@ -1,4 +1,4 @@
usr/include/final/*.h
usr/lib/*/lib*.la
usr/lib/*/lib*.a
usr/lib/*/pkgconfig
usr/lib/*/pkgconfig/*.pc

View File

@ -1 +1 @@
libfinal 0 libfinal0 (>= 0.4.0)
libfinal 0 libfinal0 (>= 0.5.0)

6795
debian/libfinal0.symbols vendored

File diff suppressed because it is too large Load Diff

View File

@ -269,7 +269,10 @@ void AttribDemo::printAltCharset()
}
else
{
if ( parent->bgcolor == 0 || parent->bgcolor == 16 )
if ( (parent->bgcolor <= 8)
|| (parent->bgcolor >= 16 && parent->bgcolor <= 231
&& (parent->bgcolor - 16) % 36 <= 17)
|| (parent->bgcolor >= 232 && parent->bgcolor <= 243) )
setColor (finalcut::fc::White, parent->bgcolor);
else
setColor (finalcut::fc::Black, parent->bgcolor);

View File

@ -184,9 +184,9 @@ class MainWindow : public finalcut::FDialog
// Data Members
finalcut::FString line1;
finalcut::FString line2;
Transparent transpwin;
Transparent shadowwin;
Transparent ibg;
Transparent* transpwin;
Transparent* shadowwin;
Transparent* ibg;
finalcut::FStatusBar status_bar;
};
#pragma pack(pop)
@ -196,25 +196,32 @@ MainWindow::MainWindow (finalcut::FWidget* parent)
: FDialog(parent)
, line1()
, line2()
, transpwin(this)
, shadowwin(this, Transparent::shadow)
, ibg(this, Transparent::inherit_background)
, transpwin(0)
, shadowwin(0)
, ibg(0)
, status_bar(this)
{
line1 = " .-. .-. .-.";
line2 = "`._.' `._.' `._.' ";
transpwin.setText("transparent");
transpwin.setGeometry (6, 3, 29, 12);
transpwin.unsetTransparentShadow();
// The memory allocation for the following three sub windows occurs
// with the operator new. The lifetime of the generated widget
// is managed by the parent object (this). The operator delete
// is not required in this scope and would result in a double free.
transpwin = new Transparent(this);
transpwin->setText("transparent");
transpwin->setGeometry (6, 3, 29, 12);
transpwin->unsetTransparentShadow();
shadowwin.setText("shadow");
shadowwin.setGeometry (46, 11, 29, 12);
shadowwin.unsetTransparentShadow();
shadowwin = new Transparent(this, Transparent::shadow);
shadowwin->setText("shadow");
shadowwin->setGeometry (46, 11, 29, 12);
shadowwin->unsetTransparentShadow();
ibg.setText("inherit background");
ibg.setGeometry (42, 3, 29, 7);
ibg.unsetTransparentShadow();
ibg = new Transparent(this, Transparent::inherit_background);
ibg->setText("inherit background");
ibg->setGeometry (42, 3, 29, 7);
ibg->unsetTransparentShadow();
// Statusbar at the bottom
status_bar.setMessage("Press Q to quit");

View File

@ -111,7 +111,12 @@ make %{?_smp_mflags} V=1
make install libdir=${RPM_BUILD_ROOT}%{_libdir}/ \
includedir=${RPM_BUILD_ROOT}%{_includedir} \
bindir=${RPM_BUILD_ROOT}%{_bindir} \
docdir=${RPM_BUILD_ROOT}/%{_docdir}/finalcut/
docdir=${RPM_BUILD_ROOT}%{_docdir}/finalcut/
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples
cp -p examples/.libs/* ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples
cp -p examples/*.cpp ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples
cp -p examples/Makefile.clang ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples
cp -p examples/Makefile.gcc ${RPM_BUILD_ROOT}%{_libdir}/finalcut/examples
rm -f ${RPM_BUILD_ROOT}%{_libdir}/libfinal.la
%post -n %{libsoname} -p /sbin/ldconfig
@ -124,8 +129,12 @@ rm -rf $RPM_BUILD_ROOT
%files devel
%defattr(-,root,root)
%dir %{_docdir}/finalcut
%dir %{_libdir}/finalcut
%dir %{_libdir}/finalcut/examples
%{_docdir}/finalcut/*
%{_libdir}/pkgconfig/*
%{_libdir}/%{libname}.so
%{_libdir}/finalcut/*
%{_includedir}/*
%files -n %{libsoname}
@ -137,10 +146,13 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/%{libname}.a
%changelog
* Sun Nov 25 2018 Markus Gans <guru.mail@muenster.de> - 0.5.0-1
- Release (version 0.5.0)
* Sat Nov 04 2017 Markus Gans <guru.mail@muenster.de> - 0.4.0-1
- Release (version 0.4.0)
* Sat Nov 27 2016 Markus Gans <guru.mail@muenster.de> - 0.3.0-1
* Sun Nov 27 2016 Markus Gans <guru.mail@muenster.de> - 0.3.0-1
- Release (version 0.3.0)
* Sat Dec 19 2015 Markus Gans <guru.mail@muenster.de> - 0.2.0-1

View File

@ -3,7 +3,7 @@
#-----------------------------------------------------------------------------
# This is where make install will install the library
VERSION = "0.4.0"
VERSION = "0.5.0"
MAJOR := $(shell echo ${VERSION} | cut -d. -f1)
LIBDIR = /usr/local/lib
INCLUDEDIR1 = include/final

View File

@ -3,7 +3,7 @@
#-----------------------------------------------------------------------------
# This is where make install will install the library
VERSION = "0.4.0"
VERSION = "0.5.0"
MAJOR := $(shell echo ${VERSION} | cut -d. -f1)
LIBDIR = /usr/local/lib
INCLUDEDIR1 = include/final

View File

@ -401,7 +401,7 @@ void FApplication::init (long key_time, long dblclick_time)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}

View File

@ -727,7 +727,7 @@ void FButton::draw()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}

View File

@ -506,7 +506,7 @@ void FButtonGroup::drawLabel()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}

View File

@ -887,7 +887,7 @@ void FDialog::init()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
@ -906,7 +906,7 @@ void FDialog::initDialogMenu()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
@ -934,7 +934,7 @@ void FDialog::initMoveSizeMenuItem (FMenu* menu)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
@ -957,7 +957,7 @@ void FDialog::initZoomMenuItem (FMenu* menu)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
@ -980,7 +980,7 @@ void FDialog::initCloseMenuItem (FMenu* menu)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
@ -1446,7 +1446,7 @@ inline void FDialog::passEventToSubMenu ( mouseStates& ms
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
}
@ -1727,7 +1727,7 @@ void FDialog::cb_move (FWidget*, data_ptr)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}

View File

@ -276,7 +276,7 @@ const FString FFileDialog::fileOpenChooser ( FWidget* parent
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return FString();
}
@ -319,7 +319,7 @@ const FString FFileDialog::fileSaveChooser ( FWidget* parent
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return FString();
}

View File

@ -36,6 +36,7 @@ fkeymap Fkey[] =
{ fc::Fkey_clear , 0, "kC" }, // clear-screen or erase key
{ fc::Fkey_ctab , 0, "kt" }, // clear-tab key
{ fc::Fkey_dc , 0, "kD" }, // delete-character key
{ fc::Fkey_dc , 0, "kDx"}, // keypad delete
{ fc::Fkey_dl , 0, "kL" }, // delete-line key
{ fc::Fkey_down , 0, "kd" }, // down-arrow key
{ fc::Fkey_down , 0, "kdx"}, // down-arrow key

View File

@ -373,7 +373,7 @@ bool FKeyboard::isKeypressTimeout()
FKey FKeyboard::UTF8decode (const char utf8[])
{
FKey ucs = 0; // Universal coded character
const int max = 4;
const std::size_t max = 4;
std::size_t len = std::strlen(utf8);
if ( len > max )

View File

@ -293,7 +293,7 @@ void FLabel::onMouseDown (FMouseEvent* ev)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
}
@ -529,7 +529,7 @@ void FLabel::drawMultiLine()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
@ -574,7 +574,7 @@ void FLabel::drawSingleLine()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}

View File

@ -844,7 +844,7 @@ void FListBox::init()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}

View File

@ -877,7 +877,7 @@ FObject::FObjectIterator FListView::insert ( const FStringList& cols
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return FListView::null_iter;
}
@ -1468,7 +1468,7 @@ void FListView::init()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}

View File

@ -953,7 +953,7 @@ void FMenu::passEventToSubMenu (FMouseEvent*& ev)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
}
}
@ -977,7 +977,7 @@ void FMenu::passEventToSuperMenu (FMouseEvent*& ev)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
}
}
@ -1002,7 +1002,7 @@ void FMenu::passEventToMenuBar (FMouseEvent*& ev)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
}
}
@ -1336,7 +1336,7 @@ inline void FMenu::drawMenuLine (FMenuItem* menuitem, int y)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}

View File

@ -566,7 +566,7 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
@ -1027,8 +1027,7 @@ void FMenuBar::passEventToMenu (FMouseEvent*& ev)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc "
<< ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
}
}
}

View File

@ -692,8 +692,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc "
<< ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
@ -742,8 +741,7 @@ void FMenuItem::passMouseEvent ( T widget, FMouseEvent* ev
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc "
<< ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}

View File

@ -202,7 +202,7 @@ int FMessageBox::info ( FWidget* parent
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return FDialog::Reject;
}
@ -231,7 +231,7 @@ int FMessageBox::info ( FWidget* parent
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return FDialog::Reject;
}
@ -259,7 +259,7 @@ int FMessageBox::error ( FWidget* parent
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return FDialog::Reject;
}
@ -374,7 +374,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
}
@ -423,10 +423,8 @@ inline void FMessageBox::initCallbacks()
//----------------------------------------------------------------------
void FMessageBox::calculateDimensions()
{
int x, y;
std::size_t w, h;
std::size_t headline_height = 0;
FWidget* parent_widget = getParentWidget();
text_split = text.split("\n");
text_num_lines = uInt(text_split.size());
text_components = &text_split[0];
@ -449,15 +447,7 @@ void FMessageBox::calculateDimensions()
if ( w < 20 )
w = 20;
if ( parent_widget )
{
x = 1 + int((parent_widget->getWidth() - w) / 2);
y = 1 + int((parent_widget->getHeight() - h) / 3);
}
else
x = y = 1;
setGeometry (x, y, w, h);
setSize (w, h);
}
//----------------------------------------------------------------------

View File

@ -59,7 +59,7 @@ FObject::FObject (FObject* parent)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
}

View File

@ -646,11 +646,13 @@ int FOptiMove::repeatedAppend ( const capability& o
if ( dst )
{
dst += dst_len;
std::size_t free = BUF_SIZE - dst_len;
while ( count-- > 0 )
{
std::strncpy (dst, o.cap, src_len + 1);
std::strncpy (dst, o.cap, free);
dst += src_len;
free -= src_len;
}
}
}

View File

@ -787,7 +787,7 @@ void FScrollView::init_scrollbar()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}

View File

@ -28,10 +28,6 @@
namespace finalcut
{
// static class constant
const char* const FString::bad_alloc_str = "not enough memory " \
"to alloc a new string";
//----------------------------------------------------------------------
// class FString
//----------------------------------------------------------------------

View File

@ -63,6 +63,9 @@ FMouseControl* FTerm::mouse = 0;
FTermDebugData* FTerm::debug_data = 0;
#endif
// function prototypes
uInt env2uint (const char*);
//----------------------------------------------------------------------
// class FTerm
@ -487,11 +490,11 @@ void FTerm::detectTermSize()
{
term_geometry.setPos (1, 1);
// Use COLUMNS or fallback to the xterm default width of 80 characters
char* Columns = std::getenv("COLUMNS");
term_geometry.setWidth(Columns ? std::size_t(std::atoi(Columns)) : 80);
uInt Columns = env2uint ("COLUMNS");
term_geometry.setWidth( ( Columns == 0) ? 80 : Columns);
// Use LINES or fallback to the xterm default height of 24 characters
char* Lines = std::getenv("LINES");
term_geometry.setHeight(Lines ? std::size_t(std::atoi(Lines)) : 24);
uInt Lines = env2uint ("LINES");
term_geometry.setHeight( ( Lines == 0 ) ? 24 : Lines);
}
else
{
@ -1696,7 +1699,7 @@ inline void FTerm::allocationValues()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}
}
@ -2072,6 +2075,26 @@ void FTerm::signal_handler (int signum)
, strsignal(signum) );
std::terminate();
}
}
// FTerm non-member functions
//----------------------------------------------------------------------
uInt env2uint (const char* env)
{
FString str(env);
if ( str.isEmpty() )
return 0;
try
{
return str.toUInt();
}
catch (const std::exception&)
{
return 0;
}
}
} // namespace finalcut

View File

@ -238,8 +238,6 @@ void FTermcap::termcapStrings (char*& buffer)
tcap[i].string = tgetstr(tcap[i].tname, &buffer);
}
//----------------------------------------------------------------------
void FTermcap::termcapKeys (char*& buffer)
{

View File

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

View File

@ -557,7 +557,7 @@ char* FTermDetection::parseAnswerbackMsg (char current_termtype[])
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return 0;
}
@ -628,7 +628,7 @@ char* FTermDetection::parseSecDA (char current_termtype[])
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return current_termtype;
}
@ -706,17 +706,20 @@ const FString FTermDetection::getSecDA()
struct timeval tv;
// Get the secondary device attributes
write(stdout_no, SECDA, std::strlen(SECDA));
std::fflush(stdout);
ssize_t ret = write(stdout_no, SECDA, std::strlen(SECDA));
if ( ret == -1 )
return sec_da_str;
std::fflush(stdout);
FD_ZERO(&ifds);
FD_SET(stdin_no, &ifds);
tv.tv_sec = 0;
tv.tv_usec = 600000; // 600 ms
// Read the answer
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) == 1 )
if ( std::scanf("\033[>%10d;%10d;%10dc", &a, &b, &c) == 3 )
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) == 1
&& std::scanf("\033[>%10d;%10d;%10dc", &a, &b, &c) == 3 )
sec_da_str.sprintf("\033[>%d;%d;%dc", a, b, c);
return sec_da_str;

View File

@ -23,6 +23,9 @@
#include "final/fcharmap.h"
#include "final/ftermfreebsd.h"
namespace finalcut
{
// static class attributes
#if defined(__FreeBSD__) || defined(__DragonFly__)
uInt FTermFreeBSD::bsd_alt_keymap = 0;
@ -31,8 +34,6 @@
bool FTermFreeBSD::meta_sends_escape = true;
#endif
namespace finalcut
{
//----------------------------------------------------------------------
// class FTermFreeBSD

View File

@ -118,17 +118,20 @@ void FTermLinux::setUTF8 (bool on)
}
//----------------------------------------------------------------------
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
bool FTermLinux::setPalette (FColor index, int r, int g, int b)
{
if ( ! FTerm::isLinuxTerm() )
return false;
#if defined(__x86_64__) || defined(__i386) || defined(__arm__)
return setVGAPalette (index, r, g, b);
#else
return false;
#endif
}
#else
bool FTermLinux::setPalette (FColor, int, int, int)
{
return false;
}
#endif
//----------------------------------------------------------------------
bool FTermLinux::isLinuxConsole()
@ -541,7 +544,7 @@ bool FTermLinux::getScreenFont()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return false;
}
@ -588,7 +591,7 @@ bool FTermLinux::getUnicodeMap()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return false;
}
@ -665,7 +668,7 @@ int FTermLinux::setScreenFont ( uChar fontdata[], uInt count
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return -1;
}

View File

@ -22,14 +22,15 @@
#include "final/ftermopenbsd.h"
namespace finalcut
{
// static class attributes
#if defined(__NetBSD__) || defined(__OpenBSD__)
kbd_t FTermOpenBSD::bsd_keyboard_encoding = 0;
bool FTermOpenBSD::meta_sends_escape = true;
#endif
namespace finalcut
{
//----------------------------------------------------------------------
// class FTermOpenBSD

View File

@ -832,7 +832,7 @@ const FString* FTermXTerminal::captureXTermFont()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return 0;
}
@ -887,7 +887,7 @@ const FString* FTermXTerminal::captureXTermTitle()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return 0;
}

View File

@ -444,7 +444,7 @@ void FTextView::onMouseDown (FMouseEvent* ev)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
}
}
}
@ -473,7 +473,7 @@ void FTextView::onMouseUp (FMouseEvent* ev)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
}
}
}
@ -509,7 +509,7 @@ void FTextView::onMouseMove (FMouseEvent* ev)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
}
}
}
@ -580,6 +580,9 @@ void FTextView::adjustSize()
if ( yoffset < 0 )
yoffset = 0;
if ( height < 3 )
return;
vbar->setMaximum (last_line - int(height) + 2 - nf_offset);
vbar->setPageSize (last_line, int(height) - 2 + nf_offset);
vbar->setX (int(width));
@ -587,6 +590,9 @@ void FTextView::adjustSize()
vbar->setValue (yoffset);
vbar->resize();
if ( width < 3 )
return;
hbar->setMaximum (max_width - int(width) + nf_offset + 2);
hbar->setPageSize (max_width, int(width) - nf_offset - 2);
hbar->setY (int(height));
@ -639,7 +645,7 @@ void FTextView::init()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}

View File

@ -498,7 +498,7 @@ void FToggleButton::drawLabel()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}

View File

@ -630,7 +630,7 @@ void FVTerm::createArea ( int offset_left, int offset_top
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
@ -757,7 +757,7 @@ inline bool FVTerm::reallocateTextArea ( term_area* area
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return false;
}
@ -776,7 +776,7 @@ inline bool FVTerm::reallocateTextArea (term_area* area, std::size_t size)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return false;
}
@ -1986,7 +1986,7 @@ void FVTerm::init (bool disable_alt_screen)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
std::abort();
}

View File

@ -1958,7 +1958,7 @@ void FWidget::init()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return;
}
@ -1991,7 +1991,7 @@ void FWidget::init()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
}
}

View File

@ -82,7 +82,7 @@ inline const FString& emptyFString::get()
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
}
}

View File

@ -183,7 +183,7 @@
/* Define to the full name and version of this package. */
#ifndef F_PACKAGE_STRING
#define F_PACKAGE_STRING "finalcut 0.4.0"
#define F_PACKAGE_STRING "finalcut 0.5.0"
#endif
/* Define to the one symbol short name of this package. */
@ -198,7 +198,7 @@
/* Define to the version of this package. */
#ifndef F_PACKAGE_VERSION
#define F_PACKAGE_VERSION "0.4.0"
#define F_PACKAGE_VERSION "0.5.0"
#endif
/* Define to 1 if you have the ANSI C header files. */
@ -230,7 +230,7 @@
/* Version number of package */
#ifndef F_VERSION
#define F_VERSION "0.4.0"
#define F_VERSION "0.5.0"
#endif
/* Define to 1 if on MINIX. */

View File

@ -264,7 +264,6 @@ class FString
static const uInt FWDBUFFER = 15;
static const uInt INPBUFFER = 200;
static const uInt CHAR_SIZE = sizeof(wchar_t); // bytes per character
static const char* const bad_alloc_str;
// Methods
void initLength (std::size_t);

View File

@ -64,6 +64,9 @@ typedef uInt32 FKey;
namespace finalcut
{
const char* const bad_alloc_str = \
"not enough memory to alloc ";
template <typename T, bool is_signed>
struct is_negative
{

View File

@ -1032,7 +1032,7 @@ inline char* createBlankArray (std::size_t size)
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
std::cerr << bad_alloc_str << ex.what() << std::endl;
return 0;
}

View File

@ -51,6 +51,7 @@ fkeymap Fkey[] =
{ finalcut::fc::Fkey_clear , 0 , "kC" }, // clear-screen or erase key
{ finalcut::fc::Fkey_ctab , C_STR(CSI "3~") , "kt" }, // clear-tab key
{ finalcut::fc::Fkey_dc , 0 , "kD" }, // delete-character key
{ finalcut::fc::Fkey_dc , 0 , "kDx" }, // delete-character key
{ finalcut::fc::Fkey_dl , 0 , "kL" }, // delete-line key
{ finalcut::fc::Fkey_down , C_STR(ESC "OB") , "kd" }, // down-arrow key
{ finalcut::fc::Fkey_down , C_STR(CSI "B") , "kdx"}, // down-arrow key
@ -412,10 +413,10 @@ void FKeyboardTest::severalKeysTest()
void FKeyboardTest::functionKeyTest()
{
// Function key F1 (numeric keypad PF1)
input("\033[2~");
input("\033OP");
processInput();
std::cout << " - Key: " << keyboard->getKeyName(key_pressed) << std::endl;
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_ic );
CPPUNIT_ASSERT ( key_pressed == finalcut::fc::Fkey_f1 );
clear();
// Function key F1

View File

@ -660,6 +660,12 @@ void FTermcapQuirksTest::teratermTest()
//----------------------------------------------------------------------
void FTermcapQuirksTest::sunTest()
{
finalcut::FTermcap::tcap_map* caps = finalcut::FTermcap::getTermcapMap();
const int last_item = int(sizeof(test::tcap) / sizeof(test::tcap[0])) - 1;
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;
@ -671,6 +677,102 @@ void FTermcapQuirksTest::sunTest()
quirks.terminalFixup();
CPPUNIT_ASSERT ( finalcut::FTermcap::eat_nl_glitch == true );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_up_cursor].string
, C_STR(CSI "%p1%dA") );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_down_cursor].string
, C_STR(CSI "%p1%dB") );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_right_cursor].string
, C_STR(CSI "%p1%dC") );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_left_cursor].string
, C_STR(CSI "%p1%dD") );
for (int i = 0; finalcut::fc::Fkey[i].tname[0] != 0; i++)
{
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "K2", 2) == 0 ) // center of keypad
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "218z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kb", 2) == 0 ) // backspace key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR("\b") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kD", 2) == 0
&& std::strlen(finalcut::fc::Fkey[i].tname) == 2 ) // delete-character key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR("\177") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "@7", 2) == 0 ) // end key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "220z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "k;", 2) == 0 ) // F10 function key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "233z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "F1", 2) == 0 ) // F11 function key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "234z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "F2", 2) == 0 ) // F12 function key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "235z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kh", 2) == 0 ) // home key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "214z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kI", 2) == 0 ) // insert-character key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "247z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kN", 2) == 0 ) // next-page key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "222z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "%7", 2) == 0 ) // options key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "194z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kP", 2) == 0 ) // prev-page key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "216z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "&5", 2) == 0 ) // resume key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "193z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "&8", 2) == 0 ) // undo key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "195z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "K2", 2) == 0 ) // center of keypad
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "218z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "kDx", 3) == 0 ) // keypad delete
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "249z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "@8x", 3) == 0 ) // enter/send key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "250z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "KP1", 3) == 0 ) // keypad slash
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "212z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "KP2", 3) == 0 ) // keypad asterisk
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "213z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "KP3", 3) == 0 ) // keypad minus sign
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "254z") );
if ( std::strncmp(finalcut::fc::Fkey[i].tname, "KP4", 3) == 0 ) // keypad plus sign
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::Fkey[i].string
, C_STR(CSI "253z") );
}
detect.setSunTerminal (false);
}

View File

@ -2297,7 +2297,7 @@ void FTermDetectionTest::terminalSimulation (console con)
{
fd_set ifds;
struct timeval tv;
int len;
ssize_t len;
FD_ZERO(&ifds);
FD_SET(fd_stdin, &ifds);
@ -2314,22 +2314,28 @@ void FTermDetectionTest::terminalSimulation (console con)
{
len = read (fd_stdin, buffer, sizeof(buffer));
if ( len > 0 )
if ( len > 0 && std::size_t(len) < sizeof(buffer) )
{
buffer[len] = '\0';
write (fd_master, buffer, len); // Send data to the master side
}
}
// Data on the master side of PTY
if ( FD_ISSET(fd_master, &ifds) )
{
len = read (fd_master, buffer, sizeof(buffer));
if ( len < 0 )
if ( len == -1 || std::size_t(len) >= sizeof(buffer) )
break;
else if ( len > 0 )
{
buffer[len] = '\0';
parseTerminalBuffer (len, con);
}
}
}
}
//----------------------------------------------------------------------
void FTermDetectionTest::parseTerminalBuffer (int length, console con)