diff --git a/.travis.yml b/.travis.yml index 3eebb1c2..f99cfd50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,6 +62,7 @@ matrix: - ./configure --prefix=/usr CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG" --with-unit-test - make V=1 -j10 - make check + - cat test/*.log # # Coveralls diff --git a/ChangeLog b/ChangeLog index f5c3eb3d..0fcca97d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2018-10-29 Markus Gans + * FTerm is now a data member of FVTerm + 2018-10-26 Markus Gans * Building Fix for a negative value check (gcc < 4.8) * Adding the capacity() method to the FString class diff --git a/README.md b/README.md index d340f9ca..35c47772 100644 --- a/README.md +++ b/README.md @@ -145,102 +145,102 @@ Class digramm 1┌──────────────┐ ┌-----------┤ FTermFreeBSD │ : └──────────────┘ - : 1┌──────────────┐ ┌───────────┐ - ┌-----------┤ FTermOpenBSD │ ┌────┤ FKeyEvent │ - : └──────────────┘ │ └───────────┘ - : 1┌────────────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermDetection │ ├────┤ FMouseEvent │ - : └────────────────┘ │ └─────────────┘ - : 1┌────────────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermcapQuirks │ ├────┤ FWheelEvent │ - : └────────────────┘ │ └─────────────┘ - : 1┌────────────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │ - : └────────────────┘ │ └─────────────┘ - : 1┌──────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermcap │ ┌────────┐ ├────┤ FAccelEvent │ - : └──────────┘ │ FEvent │◄─┤ └─────────────┘ - : 1┌──────────┐ └───┬────┘ │ ┌──────────────┐ - ┌-----------┤ FTermios │ :1 ├────┤ FResizeEvent │ - : └──────────┘ : │ └──────────────┘ - : 1┌───────────────┐ : │ ┌────────────┐ - ┌-----------┤ FColorPalette │ : ├────┤ FShowEvent │ - : └───────────────┘ : │ └────────────┘ - : 1┌───────────┐ : │ ┌────────────┐ - ┌-----------┤ FOptiMove │ : ├────┤ FHideEvent │ - : └───────────┘ : │ └────────────┘ - : 1┌───────────┐ : │ ┌─────────────┐ - ┌-----------┤ FOptiAttr │ : ├────┤ FCloseEvent │ - : └───────────┘ : │ └─────────────┘ - : 1┌───────────┐ : │ ┌─────────────┐ - ┌-----------┤ FKeyboard │ : └────┤ FTimerEvent │ - : └───────────┘ : └─────────────┘ - : 1┌───────────────┐ : - ┌-----------┤ FMouseControl │ : ┌──────────────┐ - : └───────────────┘ : ┌────┤ FApplication │ - : *┌─────────┐ : │ └──────────────┘ - : ┌--------┤ FString │ : │ ┌─────────┐ - : : └─────────┘ : ├────┤ FButton │ - : : *┌────────┐ : │ └─────────┘ - : ┌--------┤ FPoint │ : │ ┌────────┐ - : : └────────┘ : ├────┤ FLabel │ - : : *┌───────┐ : │ └────────┘ - : ┌--------┤ FRect │ : │ ┌───────────┐ - : : └───────┘ : ├────┤ FLineEdit │ - :1 :1 : │ └───────────┘ - ┌─┴──┴──┐ ┌────────┐ : │ ┌──────────────┐ ┌──────────────┐ - │ FTerm │◄───┤ FVTerm │◄──┐ :1 ├────┤ FButtonGroup │ ┌──┤ FRadioButton │ - └───────┘ └────────┘ │ ┌────┴────┐ │ └──────────────┘ │ └──────────────┘ - ├──┤ FWidget │◄─┤ ┌───────────────┐ │ ┌───────────┐ - ┌─────────┐ │ └─────────┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │ - │ FObject │◄──┘ │ └───────────────┘ │ └───────────┘ - └─────────┘ │ ┌──────────────┐ │ ┌─────────┐ - ├────┤ FProgressbar │ └──┤ FSwitch │ - │ └──────────────┘ └─────────┘ - │ ┌────────────┐ - ├────┤ FScrollbar │ - │ └────────────┘ - │ ┌───────────┐ - ├────┤ FTextView │ - │ └───────────┘ - │ ┌──────────┐1 *┌──────────────┐ - ├────┤ FListBox ├-------┤ FListBoxItem │ - │ └──────────┘ └──────────────┘ - ┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐ - │ FTermBuffer ├---------------------------├────┤ FListView ├------┤ FListViewItem │ - └─────────────┘ │ └───────────┘ └───────────────┘ - │ ┌─────────────┐ - ├────┤ FScrollView │ - │ └─────────────┘ - │ ┌────────────┐1 *┌────────────┐ - │ ┌──┤ FStatusBar ├-----┤ FStatusKey │ - │ │ └────────────┘ └────────────┘ - │ │ - │ ▼ ┌─────────────┐ - ┌───┴─┴───┐ ┌─────────┐ ┌──┤ FFileDialog │ - │ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘ - └──┬──┬───┘ └─────────┘ │ ┌─────────────┐ - ▲ ▲ └──┤ FMessageBox │ - │ │ └─────────────┘ - │ │ ┌──────────┐ - │ └──────┤ FToolTip │ - │ └──────────┘ - └───────────────┐ ┌──────────┐ - │ ┌───┤ FMenuBar │ - ┌───────────┐ └──────┤ └──────────┘ - │ FMenuList │◄──────────┤ ┌───────┐ - └────┬──────┘ └───┤ FMenu │◄──┐ - 1: └───────┘ │ - : ┌─────────────────┐ │ - : │ FDialogListMenu ├───┘ - : └─────────────────┘ - └--------------------------------┐ - :* ┌────────────────┐* : - ┌─────┴─────┐ ┌──┤ FCheckMenuItem ├---┘ - │ FMenuItem │◄─┤ └────────────────┘ : - └───────────┘ │ ┌────────────────┐* : - └──┤ FRadioMenuItem ├---┘ - └────────────────┘ + : 1┌──────────────┐ ┌───────────┐ + ┌-----------┤ FTermOpenBSD │ ┌────┤ FKeyEvent │ + : └──────────────┘ │ └───────────┘ + : 1┌────────────────┐ │ ┌─────────────┐ + ┌-----------┤ FTermDetection │ ├────┤ FMouseEvent │ + : └────────────────┘ │ └─────────────┘ + : 1┌────────────────┐ │ ┌─────────────┐ + ┌-----------┤ FTermcapQuirks │ ├────┤ FWheelEvent │ + : └────────────────┘ │ └─────────────┘ + : 1┌────────────────┐ │ ┌─────────────┐ + ┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │ + : └────────────────┘ │ └─────────────┘ + : 1┌──────────┐ │ ┌─────────────┐ + ┌-----------┤ FTermcap │ ├────┤ FAccelEvent │ + : └──────────┘ │ └─────────────┘ + : 1┌──────────┐ │ ┌──────────────┐ + ┌-----------┤ FTermios │ ├────┤ FResizeEvent │ + : └──────────┘ │ └──────────────┘ + : 1┌───────────────┐ │ ┌────────────┐ + ┌-----------┤ FColorPalette │ ├────┤ FShowEvent │ + : └───────────────┘ │ └────────────┘ + : 1┌───────────┐ │ ┌────────────┐ + ┌-----------┤ FOptiMove │ ├────┤ FHideEvent │ + : └───────────┘ │ └────────────┘ + : 1┌───────────┐ │ ┌─────────────┐ + ┌-----------┤ FOptiAttr │ ├────┤ FCloseEvent │ + : └───────────┘ │ └─────────────┘ + : 1┌───────────┐ │ ┌─────────────┐ + ┌-----------┤ FKeyboard │ ├────┤ FTimerEvent │ + : └───────────┘ │ └─────────────┘ + : 1┌───────────────┐ │ + ┌-----------┤ FMouseControl │ │ ┌──────────────┐ + : └───────────────┘ │ ┌────┤ FApplication │ + : *┌─────────┐ │ │ └──────────────┘ + : ┌--------┤ FString │ │ │ ┌─────────┐ + : : └─────────┘ │ ├────┤ FButton │ + : : *┌────────┐ │ │ └─────────┘ + : ┌--------┤ FPoint │ │ │ ┌────────┐ + : : └────────┘ │ ├────┤ FLabel │ + : : *┌───────┐ │ │ └────────┘ + : ┌--------┤ FRect │ │ │ ┌───────────┐ + : : └───────┘ │ ├────┤ FLineEdit │ + :1 :1 │ │ └───────────┘ + ┌─┴──┴──┐ │ │ ┌──────────────┐ ┌──────────────┐ + │ FTerm │ │ ├────┤ FButtonGroup │ ┌──┤ FRadioButton │ + └───┬───┘ ┌────────┐ │ │ └──────────────┘ │ └──────────────┘ + :1 │ FEvent │◄─────┘ │ ┌───────────────┐ │ ┌───────────┐ + ┌───┴────┐ └────┬───┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │ + │ FVTerm │◄──┐ :1 │ └───────────────┘ │ └───────────┘ + └────────┘ │ ┌────┴────┐ │ ┌──────────────┐ │ ┌─────────┐ + ├────┤ FWidget │◄───────┼────┤ FProgressbar │ └──┤ FSwitch │ +┌─────────┐ │ └─────────┘ │ └──────────────┘ └─────────┘ +│ FObject │◄──┘ │ ┌────────────┐ +└─────────┘ ├────┤ FScrollbar │ + │ └────────────┘ + │ ┌───────────┐ + ├────┤ FTextView │ + │ └───────────┘ + │ ┌──────────┐1 *┌──────────────┐ + ├────┤ FListBox ├-------┤ FListBoxItem │ + │ └──────────┘ └──────────────┘ + ┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐ + │ FTermBuffer ├----------------------├────┤ FListView ├------┤ FListViewItem │ + └─────────────┘ │ └───────────┘ └───────────────┘ + │ ┌─────────────┐ + ├────┤ FScrollView │ + │ └─────────────┘ + │ ┌────────────┐1 *┌────────────┐ + │ ┌──┤ FStatusBar ├-----┤ FStatusKey │ + │ │ └────────────┘ └────────────┘ + │ │ + │ ▼ ┌─────────────┐ + ┌───┴─┴───┐ ┌─────────┐ ┌──┤ FFileDialog │ + │ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘ + └──┬──┬───┘ └─────────┘ │ ┌─────────────┐ + ▲ ▲ └──┤ FMessageBox │ + │ │ └─────────────┘ + │ │ ┌──────────┐ + │ └──────┤ FToolTip │ + │ └──────────┘ + └───────────────┐ ┌──────────┐ + │ ┌───┤ FMenuBar │ + ┌───────────┐ └──────┤ └──────────┘ + │ FMenuList │◄──────────┤ ┌───────┐ + └────┬──────┘ └───┤ FMenu │◄──┐ + :1 └───────┘ │ + : ┌─────────────────┐ │ + : │ FDialogListMenu ├───┘ + : └─────────────────┘ + └--------------------------------┐ + :* ┌────────────────┐* : + ┌────┴─────┐ ┌──┤ FCheckMenuItem ├---┘ + │FMenuItem │◄─┤ └────────────────┘ : + └──────────┘ │ ┌────────────────┐* : + └──┤ FRadioMenuItem ├---┘ + └────────────────┘ License diff --git a/doc/class-diagram.txt b/doc/class-diagram.txt index ef38bfbe..200f4ace 100644 --- a/doc/class-diagram.txt +++ b/doc/class-diagram.txt @@ -4,100 +4,100 @@ 1┌──────────────┐ ┌-----------┤ FTermFreeBSD │ : └──────────────┘ - : 1┌──────────────┐ ┌───────────┐ - ┌-----------┤ FTermOpenBSD │ ┌────┤ FKeyEvent │ - : └──────────────┘ │ └───────────┘ - : 1┌────────────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermDetection │ ├────┤ FMouseEvent │ - : └────────────────┘ │ └─────────────┘ - : 1┌────────────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermcapQuirks │ ├────┤ FWheelEvent │ - : └────────────────┘ │ └─────────────┘ - : 1┌────────────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │ - : └────────────────┘ │ └─────────────┘ - : 1┌──────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermcap │ ┌────────┐ ├────┤ FAccelEvent │ - : └──────────┘ │ FEvent │◄─┤ └─────────────┘ - : 1┌──────────┐ └───┬────┘ │ ┌──────────────┐ - ┌-----------┤ FTermios │ :1 ├────┤ FResizeEvent │ - : └──────────┘ : │ └──────────────┘ - : 1┌───────────────┐ : │ ┌────────────┐ - ┌-----------┤ FColorPalette │ : ├────┤ FShowEvent │ - : └───────────────┘ : │ └────────────┘ - : 1┌───────────┐ : │ ┌────────────┐ - ┌-----------┤ FOptiMove │ : ├────┤ FHideEvent │ - : └───────────┘ : │ └────────────┘ - : 1┌───────────┐ : │ ┌─────────────┐ - ┌-----------┤ FOptiAttr │ : ├────┤ FCloseEvent │ - : └───────────┘ : │ └─────────────┘ - : 1┌───────────┐ : │ ┌─────────────┐ - ┌-----------┤ FKeyboard │ : └────┤ FTimerEvent │ - : └───────────┘ : └─────────────┘ - : 1┌───────────────┐ : - ┌-----------┤ FMouseControl │ : ┌──────────────┐ - : └───────────────┘ : ┌────┤ FApplication │ - : *┌─────────┐ : │ └──────────────┘ - : ┌--------┤ FString │ : │ ┌─────────┐ - : : └─────────┘ : ├────┤ FButton │ - : : *┌────────┐ : │ └─────────┘ - : ┌--------┤ FPoint │ : │ ┌────────┐ - : : └────────┘ : ├────┤ FLabel │ - : : *┌───────┐ : │ └────────┘ - : ┌--------┤ FRect │ : │ ┌───────────┐ - : : └───────┘ : ├────┤ FLineEdit │ - :1 :1 : │ └───────────┘ - ┌─┴──┴──┐ ┌────────┐ : │ ┌──────────────┐ ┌──────────────┐ - │ FTerm │◄───┤ FVTerm │◄──┐ :1 ├────┤ FButtonGroup │ ┌──┤ FRadioButton │ - └───────┘ └────────┘ │ ┌────┴────┐ │ └──────────────┘ │ └──────────────┘ - ├──┤ FWidget │◄─┤ ┌───────────────┐ │ ┌───────────┐ - ┌─────────┐ │ └─────────┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │ - │ FObject │◄──┘ │ └───────────────┘ │ └───────────┘ - └─────────┘ │ ┌──────────────┐ │ ┌─────────┐ - ├────┤ FProgressbar │ └──┤ FSwitch │ - │ └──────────────┘ └─────────┘ - │ ┌────────────┐ - ├────┤ FScrollbar │ - │ └────────────┘ - │ ┌───────────┐ - ├────┤ FTextView │ - │ └───────────┘ - │ ┌──────────┐1 *┌──────────────┐ - ├────┤ FListBox ├-------┤ FListBoxItem │ - │ └──────────┘ └──────────────┘ - ┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐ - │ FTermBuffer ├---------------------------├────┤ FListView ├------┤ FListViewItem │ - └─────────────┘ │ └───────────┘ └───────────────┘ - │ ┌─────────────┐ - ├────┤ FScrollView │ - │ └─────────────┘ - │ ┌────────────┐1 *┌────────────┐ - │ ┌──┤ FStatusBar ├-----┤ FStatusKey │ - │ │ └────────────┘ └────────────┘ - │ │ - │ ▼ ┌─────────────┐ - ┌───┴─┴───┐ ┌─────────┐ ┌──┤ FFileDialog │ - │ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘ - └──┬──┬───┘ └─────────┘ │ ┌─────────────┐ - ▲ ▲ └──┤ FMessageBox │ - │ │ └─────────────┘ - │ │ ┌──────────┐ - │ └──────┤ FToolTip │ - │ └──────────┘ - └───────────────┐ ┌──────────┐ - │ ┌───┤ FMenuBar │ - ┌───────────┐ └──────┤ └──────────┘ - │ FMenuList │◄──────────┤ ┌───────┐ - └────┬──────┘ └───┤ FMenu │◄──┐ - :1 └───────┘ │ - : ┌─────────────────┐ │ - : │ FDialogListMenu ├───┘ - : └─────────────────┘ - └--------------------------------┐ - :* ┌────────────────┐* : - ┌─────┴─────┐ ┌──┤ FCheckMenuItem ├---┘ - │ FMenuItem │◄─┤ └────────────────┘ : - └───────────┘ │ ┌────────────────┐* : - └──┤ FRadioMenuItem ├---┘ - └────────────────┘ + : 1┌──────────────┐ ┌───────────┐ + ┌-----------┤ FTermOpenBSD │ ┌────┤ FKeyEvent │ + : └──────────────┘ │ └───────────┘ + : 1┌────────────────┐ │ ┌─────────────┐ + ┌-----------┤ FTermDetection │ ├────┤ FMouseEvent │ + : └────────────────┘ │ └─────────────┘ + : 1┌────────────────┐ │ ┌─────────────┐ + ┌-----------┤ FTermcapQuirks │ ├────┤ FWheelEvent │ + : └────────────────┘ │ └─────────────┘ + : 1┌────────────────┐ │ ┌─────────────┐ + ┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │ + : └────────────────┘ │ └─────────────┘ + : 1┌──────────┐ │ ┌─────────────┐ + ┌-----------┤ FTermcap │ ├────┤ FAccelEvent │ + : └──────────┘ │ └─────────────┘ + : 1┌──────────┐ │ ┌──────────────┐ + ┌-----------┤ FTermios │ ├────┤ FResizeEvent │ + : └──────────┘ │ └──────────────┘ + : 1┌───────────────┐ │ ┌────────────┐ + ┌-----------┤ FColorPalette │ ├────┤ FShowEvent │ + : └───────────────┘ │ └────────────┘ + : 1┌───────────┐ │ ┌────────────┐ + ┌-----------┤ FOptiMove │ ├────┤ FHideEvent │ + : └───────────┘ │ └────────────┘ + : 1┌───────────┐ │ ┌─────────────┐ + ┌-----------┤ FOptiAttr │ ├────┤ FCloseEvent │ + : └───────────┘ │ └─────────────┘ + : 1┌───────────┐ │ ┌─────────────┐ + ┌-----------┤ FKeyboard │ ├────┤ FTimerEvent │ + : └───────────┘ │ └─────────────┘ + : 1┌───────────────┐ │ + ┌-----------┤ FMouseControl │ │ ┌──────────────┐ + : └───────────────┘ │ ┌────┤ FApplication │ + : *┌─────────┐ │ │ └──────────────┘ + : ┌--------┤ FString │ │ │ ┌─────────┐ + : : └─────────┘ │ ├────┤ FButton │ + : : *┌────────┐ │ │ └─────────┘ + : ┌--------┤ FPoint │ │ │ ┌────────┐ + : : └────────┘ │ ├────┤ FLabel │ + : : *┌───────┐ │ │ └────────┘ + : ┌--------┤ FRect │ │ │ ┌───────────┐ + : : └───────┘ │ ├────┤ FLineEdit │ + :1 :1 │ │ └───────────┘ + ┌─┴──┴──┐ │ │ ┌──────────────┐ ┌──────────────┐ + │ FTerm │ │ ├────┤ FButtonGroup │ ┌──┤ FRadioButton │ + └───┬───┘ ┌────────┐ │ │ └──────────────┘ │ └──────────────┘ + :1 │ FEvent │◄─────┘ │ ┌───────────────┐ │ ┌───────────┐ + ┌───┴────┐ └────┬───┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │ + │ FVTerm │◄──┐ :1 │ └───────────────┘ │ └───────────┘ + └────────┘ │ ┌────┴────┐ │ ┌──────────────┐ │ ┌─────────┐ + ├────┤ FWidget │◄───────┼────┤ FProgressbar │ └──┤ FSwitch │ +┌─────────┐ │ └─────────┘ │ └──────────────┘ └─────────┘ +│ FObject │◄──┘ │ ┌────────────┐ +└─────────┘ ├────┤ FScrollbar │ + │ └────────────┘ + │ ┌───────────┐ + ├────┤ FTextView │ + │ └───────────┘ + │ ┌──────────┐1 *┌──────────────┐ + ├────┤ FListBox ├-------┤ FListBoxItem │ + │ └──────────┘ └──────────────┘ + ┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐ + │ FTermBuffer ├----------------------├────┤ FListView ├------┤ FListViewItem │ + └─────────────┘ │ └───────────┘ └───────────────┘ + │ ┌─────────────┐ + ├────┤ FScrollView │ + │ └─────────────┘ + │ ┌────────────┐1 *┌────────────┐ + │ ┌──┤ FStatusBar ├-----┤ FStatusKey │ + │ │ └────────────┘ └────────────┘ + │ │ + │ ▼ ┌─────────────┐ + ┌───┴─┴───┐ ┌─────────┐ ┌──┤ FFileDialog │ + │ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘ + └──┬──┬───┘ └─────────┘ │ ┌─────────────┐ + ▲ ▲ └──┤ FMessageBox │ + │ │ └─────────────┘ + │ │ ┌──────────┐ + │ └──────┤ FToolTip │ + │ └──────────┘ + └───────────────┐ ┌──────────┐ + │ ┌───┤ FMenuBar │ + ┌───────────┐ └──────┤ └──────────┘ + │ FMenuList │◄──────────┤ ┌───────┐ + └────┬──────┘ └───┤ FMenu │◄──┐ + :1 └───────┘ │ + : ┌─────────────────┐ │ + : │ FDialogListMenu ├───┘ + : └─────────────────┘ + └--------------------------------┐ + :* ┌────────────────┐* : + ┌────┴─────┐ ┌──┤ FCheckMenuItem ├---┘ + │FMenuItem │◄─┤ └────────────────┘ : + └──────────┘ │ ┌────────────────┐* : + └──┤ FRadioMenuItem ├---┘ + └────────────────┘ diff --git a/examples/opti-move.cpp b/examples/opti-move.cpp index 208c317c..a0f72bf2 100644 --- a/examples/opti-move.cpp +++ b/examples/opti-move.cpp @@ -111,7 +111,7 @@ void move (int xold, int yold, int xnew, int ynew) << std::left << std::setw(10) << to << " "; // get the move string - buffer = terminal->moveCursor (xold, yold, xnew, ynew); + buffer = terminal->getFTerm().moveCursor (xold, yold, xnew, ynew); len = uInt(std::strlen(buffer)); for (uInt i = 0; i < len; i++) @@ -164,7 +164,7 @@ int main (int argc, char* argv[]) TermApp.clearArea(); // Show the determined terminal name and text resolution - std::cout << "Terminal: " << TermApp.getTermType() << "\r\n"; + std::cout << "Terminal: " << TermApp.getFTerm().getTermType() << "\r\n"; std::cout << " Columns: 0.." << xmax << "\r\n"; std::cout << " Lines: 0.." << ymax << "\r\n"; @@ -197,7 +197,7 @@ int main (int argc, char* argv[]) // Show terminal speed and milliseconds for all cursor movement sequence std::cout << "\r" << line; - TermApp.printMoveDurations(); + TermApp.getFTerm().printMoveDurations(); // Waiting for keypress keyPressed(); diff --git a/examples/term-attributes.cpp b/examples/term-attributes.cpp index 2cd7b4cc..30a49f52 100644 --- a/examples/term-attributes.cpp +++ b/examples/term-attributes.cpp @@ -74,7 +74,7 @@ AttribDlg::AttribDlg (finalcut::FWidget* parent) , back_button("< &Back", this) { setText ( "A terminal attributes test (" - + finalcut::FString(getTermType()) + + finalcut::FString(getFTerm().getTermType()) + ")"); next_button.setGeometry(int(getWidth()) - 13, int(getHeight()) - 4, 10, 1); diff --git a/examples/termcap.cpp b/examples/termcap.cpp index 85fb3e26..81b71ea7 100644 --- a/examples/termcap.cpp +++ b/examples/termcap.cpp @@ -225,20 +225,21 @@ void tcapString (const std::string& name, const char cap_str[]) #if DEBUG void debug (finalcut::FApplication& TermApp) { - const finalcut::FString& ab_s = TermApp.getAnswerbackString(); - const finalcut::FString& sec_da = TermApp.getSecDAString(); + finalcut::FTerm& fterm = TermApp.getFTerm(); + const finalcut::FString& ab_s = fterm.getAnswerbackString(); + const finalcut::FString& sec_da = fterm.getSecDAString(); std::cout << "\n.------------------- debug -------------------\r\n"; #if defined(__linux__) std::cout << "| Framebuffer bpp: " - << TermApp.getFramebufferBpp() << "\r\n"; + << fterm.getFramebufferBpp() << "\r\n"; #endif std::cout << "| after init_256colorTerminal(): " - << TermApp.getTermType_256color() << "\r\n"; + << fterm.getTermType_256color() << "\r\n"; std::cout << "| after parseAnswerbackMsg(): " - << TermApp.getTermType_Answerback() << "\r\n"; + << fterm.getTermType_Answerback() << "\r\n"; std::cout << "| after parseSecDA(): " - << TermApp.getTermType_SecDA() << "\r\n"; + << fterm.getTermType_SecDA() << "\r\n"; if ( ! ab_s.isEmpty() ) tcapString ("| The answerback String", ab_s); @@ -313,8 +314,9 @@ int main (int argc, char* argv[]) finalcut::FTermcap::tcap_map* tcap = 0; tcap = finalcut::FTermcap::getTermcapMap(); + finalcut::FTerm& fterm = TermApp.getFTerm(); std::cout << "--------\r\nFTermcap\r\n--------\r\n\n"; - std::cout << "Terminal: " << TermApp.getTermType() << "\r\n"; + std::cout << "Terminal: " << fterm.getTermType() << "\r\n"; debug (TermApp); diff --git a/examples/ui.cpp b/examples/ui.cpp index 1e527fc9..fad7bb6f 100644 --- a/examples/ui.cpp +++ b/examples/ui.cpp @@ -836,8 +836,8 @@ void MyDialog::cb_terminfo (finalcut::FWidget*, data_ptr) ( "Environment" , finalcut::FString() - << " Type: " << getTermType() << "\n" - << " Name: " << getTermFileName() << "\n" + << " Type: " << getFTerm().getTermType() << "\n" + << " Name: " << getFTerm().getTermFileName() << "\n" << " Mode: " << getEncodingString() << "\n" << " Size: " << x << wchar_t(finalcut::fc::Times) << y << "\n" @@ -943,7 +943,7 @@ void MyDialog::cb_setTitlebar (finalcut::FWidget* widget, data_ptr) finalcut::FLineEdit* lineedit = static_cast(widget); finalcut::FString title; *lineedit >> title; - setTermTitle (title); + getFTerm().setTermTitle (title); setText (title); redraw(); } @@ -1048,17 +1048,17 @@ int main (int argc, char* argv[]) // Create the application object app finalcut::FApplication app(argc, argv); - app.redefineDefaultColors(true); - app.setTermTitle (title); + app.getFTerm().redefineDefaultColors(true); + app.getFTerm().setTermTitle (title); // Force vt100 encoding - //app.setEncoding("VT100"); + //app.getFTerm().setEncoding(finalcut::fc::VT100); // Sets the terminal size to 94×30 //app.setTermSize(94,30); // Enable the final cut graphical font - //app.setNewFont(); + //app.getFTerm().setNewFont(); // Create main dialog object d MyDialog d(&app); diff --git a/src/fapplication.cpp b/src/fapplication.cpp index a6cd382a..e9444cef 100644 --- a/src/fapplication.cpp +++ b/src/fapplication.cpp @@ -302,7 +302,7 @@ FWidget* FApplication::processParameters (const int& argc, char* argv[]) showParameterUsage(); } - init_values.setDefault(); + getInitValues().setDefault(); cmd_options (argc, argv); return 0; } @@ -449,13 +449,13 @@ void FApplication::cmd_options (const int& argc, char* argv[]) encoding = encoding.toLower(); if ( encoding.includes("utf8") ) - init_values.encoding = fc::UTF8; + getInitValues().encoding = fc::UTF8; else if ( encoding.includes("vt100") ) - init_values.encoding = fc::VT100; + getInitValues().encoding = fc::VT100; else if ( encoding.includes("pc") ) - init_values.encoding = fc::PC; + getInitValues().encoding = fc::PC; else if ( encoding.includes("ascii") ) - init_values.encoding = fc::ASCII; + getInitValues().encoding = fc::ASCII; else if ( encoding.includes("help") ) showParameterUsage(); else @@ -464,32 +464,32 @@ void FApplication::cmd_options (const int& argc, char* argv[]) } if ( std::strcmp(long_options[idx].name, "no-mouse") == 0 ) - init_values.mouse_support = false; + getInitValues().mouse_support = false; if ( std::strcmp(long_options[idx].name, "no-optimized-cursor") == 0 ) - init_values.cursor_optimisation = false; + getInitValues().cursor_optimisation = false; if ( std::strcmp(long_options[idx].name, "no-terminal-detection") == 0 ) - init_values.terminal_detection = false; + getInitValues().terminal_detection = false; if ( std::strcmp(long_options[idx].name, "no-color-change") == 0 ) - init_values.color_change = false; + getInitValues().color_change = false; if ( std::strcmp(long_options[idx].name, "vgafont") == 0 ) - init_values.vgafont = true; + getInitValues().vgafont = true; if ( std::strcmp(long_options[idx].name, "newfont") == 0 ) - init_values.newfont = true; + getInitValues().newfont = true; #if defined(__FreeBSD__) || defined(__DragonFly__) if ( std::strcmp(long_options[idx].name, "no-esc-for-alt-meta") == 0 ) - init_values.meta_sends_escape = false; + getInitValues().meta_sends_escape = false; if ( std::strcmp(long_options[idx].name, "no-cursorstyle-change") == 0 ) - init_values.change_cursorstyle = false; + getInitValues().change_cursorstyle = false; #elif defined(__NetBSD__) || defined(__OpenBSD__) if ( std::strcmp(long_options[idx].name, "no-esc-for-alt-meta") == 0 ) - init_values.meta_sends_escape = false; + getInitValues().meta_sends_escape = false; #endif } } @@ -853,7 +853,7 @@ void FApplication::closeOpenMenu() // No widget was been clicked and the menu is no dialog menu if ( ! (getClickedWidget() || is_window_menu) ) - FWindow::switchToPrevWindow(); + FWindow::switchToPrevWindow(this); if ( getStatusBar() ) getStatusBar()->drawMessage(); @@ -894,7 +894,7 @@ void FApplication::unselectMenubarItems() // No widget was been clicked if ( ! getClickedWidget() ) - FWindow::switchToPrevWindow(); + FWindow::switchToPrevWindow(this); if ( getStatusBar() ) getStatusBar()->drawMessage(); diff --git a/src/fdialog.cpp b/src/fdialog.cpp index bad4c777..b43780b2 100644 --- a/src/fdialog.cpp +++ b/src/fdialog.cpp @@ -87,7 +87,7 @@ FDialog::~FDialog() // destructor accelerator_list = 0; if ( ! is_quit ) - switchToPrevWindow(); + switchToPrevWindow(this); delDialog(this); diff --git a/src/fmenu.cpp b/src/fmenu.cpp index 07c1b64d..cc75ae8b 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -71,7 +71,7 @@ FMenu::~FMenu() // destructor FApplication* fapp = static_cast(getRootWidget()); if ( ! fapp->isQuit() ) - switchToPrevWindow(); // Switch to previous window + switchToPrevWindow(this); // Switch to previous window } @@ -1664,7 +1664,7 @@ inline void FMenu::keyEscape() getStatusBar()->clearMessage(); if ( ! (super && isWindowsMenu(super)) ) - switchToPrevWindow(); + switchToPrevWindow(this); } if ( getStatusBar() ) diff --git a/src/fmenubar.cpp b/src/fmenubar.cpp index 0564fd31..0d904cde 100644 --- a/src/fmenubar.cpp +++ b/src/fmenubar.cpp @@ -1042,7 +1042,7 @@ void FMenuBar::leaveMenuBar() if ( getStatusBar() ) getStatusBar()->clearMessage(); - switchToPrevWindow(); + switchToPrevWindow(this); if ( getStatusBar() ) getStatusBar()->drawMessage(); diff --git a/src/fterm.cpp b/src/fterm.cpp index 9dab87cc..8d534759 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -115,6 +115,17 @@ bool FTerm::isNormal (charData*& ch) return opti_attr->isNormal(ch); } +//---------------------------------------------------------------------- +bool FTerm::isCursorHideable() +{ + char* cursor_off_str = disableCursor(); + + if ( cursor_off_str && std::strlen(cursor_off_str) > 0 ) + return true; + + return false; +} + //---------------------------------------------------------------------- void FTerm::setTermType (const char term_name[]) { diff --git a/src/ftooltip.cpp b/src/ftooltip.cpp index 7cb88ef6..47af64b2 100644 --- a/src/ftooltip.cpp +++ b/src/ftooltip.cpp @@ -71,7 +71,7 @@ FToolTip::~FToolTip() // destructor if ( parent_win ) setActiveWindow (parent_win); else - switchToPrevWindow(); + switchToPrevWindow(this); } diff --git a/src/fvterm.cpp b/src/fvterm.cpp index 387737e7..18db2cd1 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -25,6 +25,7 @@ #include #include "final/fapplication.h" +#include "final/fterm.h" #include "final/fvterm.h" #include "final/fwidget.h" #include "final/fwindow.h" @@ -48,6 +49,7 @@ uInt FVTerm::clr_eol_length; uInt FVTerm::cursor_address_length; std::queue* FVTerm::output_buffer = 0; FPoint* FVTerm::term_pos = 0; +FTerm* FVTerm::fterm = 0; FVTerm::term_area* FVTerm::vterm = 0; FVTerm::term_area* FVTerm::vdesktop = 0; FVTerm::term_area* FVTerm::active_area = 0; @@ -66,15 +68,14 @@ FVTerm::charData FVTerm::i_ch; // constructors and destructor //---------------------------------------------------------------------- FVTerm::FVTerm (bool initialize, bool disable_alt_screen) - : FTerm(disable_alt_screen) - , print_area(0) + : print_area(0) , child_print_area(0) , vwin(0) { terminal_update_complete = false; if ( initialize ) - init(); + init (disable_alt_screen); } //---------------------------------------------------------------------- @@ -128,7 +129,7 @@ void FVTerm::setTermXY (int x, int y) term_x = term_pos->getX(); term_y = term_pos->getY(); - move_str = moveCursor (term_x, term_y, x, y); + move_str = fterm->moveCursor (term_x, term_y, x, y); if ( move_str ) appendOutputBuffer(move_str); @@ -142,7 +143,7 @@ void FVTerm::hideCursor (bool on) { // Hides or shows the input cursor on the terminal - char* visibility_str = cursorsVisibility (on); + char* visibility_str = fterm->cursorsVisibility (on); if ( visibility_str ) appendOutputBuffer(visibility_str); @@ -1577,7 +1578,7 @@ void FVTerm::scrollAreaForward (term_area* area) if ( TCAP(fc::t_scroll_forward) ) { setTermXY (0, vdesktop->height); - scrollTermForward(); + fterm->scrollTermForward(); putArea (1, 1, vdesktop); // avoid update lines from 0 to (y_max - 1) @@ -1638,7 +1639,7 @@ void FVTerm::scrollAreaReverse (term_area* area) if ( TCAP(fc::t_scroll_reverse) ) { setTermXY (0, 0); - scrollTermReverse(); + fterm->scrollTermReverse(); putArea (1, 1, vdesktop); // avoid update lines from 1 to y_max @@ -1950,7 +1951,7 @@ void FVTerm::flush_out() { while ( ! output_buffer->empty() ) { - Fputchar (output_buffer->front()); + fterm->Fputchar (output_buffer->front()); output_buffer->pop(); } @@ -1960,7 +1961,7 @@ void FVTerm::flush_out() // private methods of FVTerm //---------------------------------------------------------------------- -void FVTerm::init() +void FVTerm::init (bool disable_alt_screen) { init_object = this; vterm = 0; @@ -1968,6 +1969,7 @@ void FVTerm::init() try { + fterm = new FTerm (disable_alt_screen); term_pos = new FPoint(-1, -1); output_buffer = new std::queue; } @@ -2007,13 +2009,13 @@ void FVTerm::init() active_area = vdesktop; // Initialize keyboard - keyboard = getKeyboard(); + keyboard = fterm->getKeyboard(); // Hide the input cursor hideCursor(); // Initialize character lengths - init_characterLengths (getFOptiMove()); + init_characterLengths (fterm->getFOptiMove()); } //---------------------------------------------------------------------- @@ -2046,7 +2048,7 @@ void FVTerm::finish() // Clear the terminal setNormal(); - if ( hasAlternateScreen() ) + if ( fterm->hasAlternateScreen() ) clearTerm(); flush_out(); @@ -2060,6 +2062,9 @@ void FVTerm::finish() if ( term_pos ) delete term_pos; + + if ( fterm ) + delete fterm; } //---------------------------------------------------------------------- @@ -2163,7 +2168,7 @@ bool FVTerm::clearTerm (int fillchar) char*& cb = TCAP(fc::t_clr_eol); bool ut = FTermcap::background_color_erase; charData* next = &next_attribute; - bool normal = isNormal(next); + bool normal = fterm->isNormal(next); appendAttributes(next); if ( ! ( (cl || cd || cb) && (normal || ut) ) @@ -2268,7 +2273,7 @@ bool FVTerm::canClearToEOL (uInt xmin, uInt y) if ( ce && min_char->code == ' ' ) { uInt beginning_whitespace = 1; - bool normal = isNormal(min_char); + bool normal = fterm->isNormal(min_char); bool& ut = FTermcap::background_color_erase; for (uInt x = xmin + 1; x < uInt(vt->width); x++) @@ -2303,7 +2308,7 @@ bool FVTerm::canClearLeadingWS (uInt& xmin, uInt y) if ( cb && first_char->code == ' ' ) { uInt leading_whitespace = 1; - bool normal = isNormal(first_char); + bool normal = fterm->isNormal(first_char); bool& ut = FTermcap::background_color_erase; for (uInt x = 1; x < uInt(vt->width); x++) @@ -2341,7 +2346,7 @@ bool FVTerm::canClearTrailingWS (uInt& xmax, uInt y) if ( ce && last_char->code == ' ' ) { uInt trailing_whitespace = 1; - bool normal = isNormal(last_char); + bool normal = fterm->isNormal(last_char); bool& ut = FTermcap::background_color_erase; for (uInt x = uInt(vt->width) - 1; x > 0 ; x--) @@ -2452,7 +2457,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y return not_used; uInt whitespace = 1; - bool normal = isNormal(print_char); + bool normal = fterm->isNormal(print_char); for (uInt i = x + 1; i <= xmax; i++) { @@ -2776,14 +2781,14 @@ inline void FVTerm::charsetChanges (charData*& next_char) return; uInt code = uInt(next_char->code); - uInt ch_enc = charEncode(code); + uInt ch_enc = fterm->charEncode(code); if ( ch_enc == code ) return; if ( ch_enc == 0 ) { - next_char->code = int(charEncode(code, fc::ASCII)); + next_char->code = int(fterm->charEncode(code, fc::ASCII)); return; } @@ -2801,7 +2806,7 @@ inline void FVTerm::charsetChanges (charData*& next_char) if ( isXTerminal() && ch_enc < 0x20 ) // Character 0x00..0x1f { if ( hasUTF8() ) - next_char->code = int(charEncode(code, fc::ASCII)); + next_char->code = int(fterm->charEncode(code, fc::ASCII)); else { next_char->code += 0x5f; @@ -2843,7 +2848,7 @@ inline void FVTerm::appendAttributes (charData*& next_attr) charData* term_attr = &term_attribute; // generate attribute string for the next character - attr_str = changeAttribute (term_attr, next_attr); + attr_str = fterm->changeAttribute (term_attr, next_attr); if ( attr_str ) appendOutputBuffer (attr_str); diff --git a/src/fwidget.cpp b/src/fwidget.cpp index 22a2bf64..a31e34a9 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -1976,13 +1976,7 @@ void FWidget::init() return; } - char* cursor_off_str = disableCursor(); - - if ( cursor_off_str && std::strlen(cursor_off_str) > 0 ) - hideable = true; - else - hideable = false; - + hideable = isCursorHideable(); visible_cursor = ! hideable; // Determine width and height of the terminal diff --git a/src/fwindow.cpp b/src/fwindow.cpp index 6238b6c8..2adcd7be 100644 --- a/src/fwindow.cpp +++ b/src/fwindow.cpp @@ -713,13 +713,14 @@ bool FWindow::zoomWindow() } //---------------------------------------------------------------------- -void FWindow::switchToPrevWindow() +void FWindow::switchToPrevWindow (FWidget* widget_object) { // switch to previous window // Disable terminal updates to avoid flickering // when redrawing the focused widget - updateTerminal (FVTerm::stop_refresh); + if ( widget_object ) + widget_object->updateTerminal (FVTerm::stop_refresh); bool is_activated = activatePrevWindow(); FWindow* active_window = static_cast(getActiveWindow()); @@ -769,7 +770,8 @@ void FWindow::switchToPrevWindow() } // Enable terminal updates again - updateTerminal (FVTerm::continue_refresh); + if ( widget_object ) + widget_object->updateTerminal (FVTerm::continue_refresh); } //---------------------------------------------------------------------- diff --git a/src/include/final/fapplication.h b/src/include/final/fapplication.h index fa22cbeb..c69c43fe 100644 --- a/src/include/final/fapplication.h +++ b/src/include/final/fapplication.h @@ -108,7 +108,7 @@ class FApplication : public FWidget static void sendQueuedEvents (); static bool eventInQueue(); static bool removeQueuedEvent (const FObject*); - static FWidget* processParameters (const int&, char*[]); + FWidget* processParameters (const int&, char*[]); static void showParameterUsage () #if defined(__clang__) || defined(__GNUC__) __attribute__((noreturn)) @@ -135,7 +135,7 @@ class FApplication : public FWidget // Methods void init (long, long); - static void cmd_options (const int&, char*[]); + void cmd_options (const int&, char*[]); void findKeyboardWidget(); bool isKeyPressed(); void keyPressed(); diff --git a/src/include/final/flabel.h b/src/include/final/flabel.h index b5bafeee..9a0cee23 100644 --- a/src/include/final/flabel.h +++ b/src/include/final/flabel.h @@ -94,7 +94,7 @@ class FLabel : public FWidget // Accessors const char* getClassName() const; - FTerm* getAccelWidget(); + FWidget* getAccelWidget(); fc::text_alignment getAlignment(); FString& getText(); @@ -172,7 +172,7 @@ inline const char* FLabel::getClassName() const { return "FLabel"; } //---------------------------------------------------------------------- -inline FTerm* FLabel::getAccelWidget () +inline FWidget* FLabel::getAccelWidget () { return accel_widget; } //---------------------------------------------------------------------- diff --git a/src/include/final/fterm.h b/src/include/final/fterm.h index 29dd9cb1..91f0ba2e 100644 --- a/src/include/final/fterm.h +++ b/src/include/final/fterm.h @@ -156,6 +156,8 @@ class FTerm // Typedefs typedef FOptiAttr::charData charData; + struct initializationValues; // forward declaration + // Constructor explicit FTerm (bool = false); @@ -169,12 +171,14 @@ class FTerm static std::size_t getLineNumber(); static std::size_t getColumnNumber(); static const FString getKeyName (int); + static FOptiMove* getFOptiMove(); static int getTTYFileDescriptor(); static char* getTermType(); static char* getTermFileName(); static int getTabstop(); static int getMaxColor(); + initializationValues& getInitValues(); #if DEBUG static const FString& getAnswerbackString(); @@ -212,12 +216,15 @@ class FTerm static bool isScreenTerm(); static bool isTmuxTerm(); static bool isNewFont(); + static bool isCursorHideable(); + static bool hasChangedTermSize(); + static bool hasShadowCharacter(); + static bool hasHalfBlockCharacter(); + static bool hasAlternateScreen(); // Mutators 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); @@ -237,7 +244,7 @@ class FTerm static char* disableCursor(); static void detectTermSize(); static void setTermSize (std::size_t, std::size_t); - static void setTermTitle(const FString&); + static void setTermTitle (const FString&); static void setKDECursor (fc::kdeKonsoleCursorShape); static void saveColorMap(); static void resetColorMap(); @@ -275,17 +282,6 @@ class FTerm static int putchar_ASCII (int); static int putchar_UTF8 (int); - protected: - // Inquiries - static bool hasChangedTermSize(); - static bool hasShadowCharacter(); - static bool hasHalfBlockCharacter(); - static bool hasAlternateScreen(); - - // Accessors - FOptiMove* getFOptiMove(); - - // Methods static void initScreenSettings(); static char* changeAttribute ( charData*& , charData*& ); @@ -451,6 +447,10 @@ inline int FTerm::getTabstop() inline int FTerm::getMaxColor() { return FTermcap::max_color; } +//---------------------------------------------------------------------- +inline FTerm::initializationValues& FTerm::getInitValues() +{ return init_values; } + #if DEBUG //---------------------------------------------------------------------- inline const FString& FTerm::getAnswerbackString() @@ -565,22 +565,6 @@ inline bool FTerm::isTmuxTerm() inline bool FTerm::isNewFont() { return data->isNewFont(); } -//---------------------------------------------------------------------- -inline void FTerm::setInsertCursor() -{ setInsertCursor(true); } - -//---------------------------------------------------------------------- -inline void FTerm::unsetInsertCursor() -{ setInsertCursor(false); } - -//---------------------------------------------------------------------- -inline bool FTerm::setUTF8() -{ return setUTF8(true); } - -//---------------------------------------------------------------------- -inline bool FTerm::unsetUTF8() -{ return setUTF8(false); } - //---------------------------------------------------------------------- inline bool FTerm::hasChangedTermSize() { return data->hasTermResized(); } @@ -597,6 +581,14 @@ inline bool FTerm::hasHalfBlockCharacter() inline bool FTerm::hasAlternateScreen() { return data->hasAlternateScreen(); } +//---------------------------------------------------------------------- +inline bool FTerm::setUTF8() +{ return setUTF8(true); } + +//---------------------------------------------------------------------- +inline bool FTerm::unsetUTF8() +{ return setUTF8(false); } + //---------------------------------------------------------------------- inline FOptiMove* FTerm::getFOptiMove() { return opti_move; } diff --git a/src/include/final/fvterm.h b/src/include/final/fvterm.h index 5daec515..b1a006cf 100644 --- a/src/include/final/fvterm.h +++ b/src/include/final/fvterm.h @@ -78,7 +78,7 @@ class FWidget; #pragma pack(push) #pragma pack(1) -class FVTerm : public FTerm +class FVTerm { public: // Typedefs and Enumeration @@ -128,128 +128,159 @@ class FVTerm : public FTerm FVTerm& operator << (const std::vector&); // Accessors - virtual const char* getClassName() const; - static short getTermForegroundColor(); - static short getTermBackgroundColor(); - term_area* getVWin() const; - FPoint getPrintCursor(); - static charData getAttribute(); + virtual const char* getClassName() const; + static short getTermForegroundColor(); + static short getTermBackgroundColor(); + term_area* getVWin() const; + FPoint getPrintCursor(); + static charData getAttribute(); + static int getMaxColor(); + static int getTabstop(); + static fc::encoding getEncoding(); + static std::string getEncodingString(); + static const FString getKeyName (int); + FTerm& getFTerm(); // Mutators - static void setTermXY (int, int); - static void hideCursor (bool); - static void hideCursor(); - static void showCursor(); - void setPrintCursor (const FPoint&); - void setPrintCursor (int, int); - void setColor (short, short); - static void setNormal(); + void setTermXY (int, int); + static void hideCursor (bool); + static void hideCursor(); + static void showCursor(); + void setPrintCursor (const FPoint&); + void setPrintCursor (int, int); + void setColor (short, short); + static void setNormal(); - static bool setBold (bool); - static bool setBold(); - static bool unsetBold(); + static bool setBold (bool); + static bool setBold(); + static bool unsetBold(); - static bool setDim (bool); - static bool setDim(); - static bool unsetDim(); + static bool setDim (bool); + static bool setDim(); + static bool unsetDim(); - static bool setItalic (bool); - static bool setItalic(); - static bool unsetItalic(); + static bool setItalic (bool); + static bool setItalic(); + static bool unsetItalic(); - static bool setUnderline (bool); - static bool setUnderline(); - static bool unsetUnderline(); + static bool setUnderline (bool); + static bool setUnderline(); + static bool unsetUnderline(); - static bool setBlink (bool); - static bool setBlink(); - static bool unsetBlink(); + static bool setBlink (bool); + static bool setBlink(); + static bool unsetBlink(); - static bool setReverse (bool); - static bool setReverse(); - static bool unsetReverse(); + static bool setReverse (bool); + static bool setReverse(); + static bool unsetReverse(); - static bool setStandout (bool); - static bool setStandout(); - static bool unsetStandout(); + static bool setStandout (bool); + static bool setStandout(); + static bool unsetStandout(); - static bool setInvisible (bool); - static bool setInvisible(); - static bool unsetInvisible(); + static bool setInvisible (bool); + static bool setInvisible(); + static bool unsetInvisible(); - static bool setProtected (bool); - static bool setProtected(); - static bool unsetProtected(); + static bool setProtected (bool); + static bool setProtected(); + static bool unsetProtected(); - static bool setCrossedOut (bool); - static bool setCrossedOut(); - static bool unsetCrossedOut(); + static bool setCrossedOut (bool); + static bool setCrossedOut(); + static bool unsetCrossedOut(); - static bool setDoubleUnderline (bool); - static bool setDoubleUnderline(); - static bool unsetDoubleUnderline(); + static bool setDoubleUnderline (bool); + static bool setDoubleUnderline(); + static bool unsetDoubleUnderline(); - static bool setAltCharset (bool); - static bool setAltCharset(); - static bool unsetAltCharset(); + static bool setAltCharset (bool); + static bool setAltCharset(); + static bool unsetAltCharset(); - static bool setPCcharset (bool); - static bool setPCcharset(); - static bool unsetPCcharset(); + static bool setPCcharset (bool); + static bool setPCcharset(); + static bool unsetPCcharset(); - static bool setTransparent (bool); - static bool setTransparent(); - static bool unsetTransparent(); + static bool setTransparent (bool); + static bool setTransparent(); + static bool unsetTransparent(); - static bool setTransShadow (bool); - static bool setTransShadow(); - static bool unsetTransShadow(); + static bool setTransShadow (bool); + static bool setTransShadow(); + static bool unsetTransShadow(); - static bool setInheritBackground (bool); - static bool setInheritBackground(); - static bool unsetInheritBackground(); + static bool setInheritBackground (bool); + static bool setInheritBackground(); + static bool unsetInheritBackground(); // Inquiries - static bool isBold(); - static bool isDim(); - static bool isItalic(); - static bool isUnderline(); - static bool isBlink(); - static bool isReverse(); - static bool isStandout(); - static bool isInvisible(); - static bool isProtected(); - static bool isCrossedOut(); - static bool isDoubleUnderline(); - static bool isAltCharset(); - static bool isPCcharset(); - static bool isTransparent(); - static bool isTransShadow(); - static bool isInheritBackground(); + static bool isBold(); + static bool isDim(); + static bool isItalic(); + static bool isUnderline(); + static bool isBlink(); + static bool isReverse(); + static bool isStandout(); + static bool isInvisible(); + static bool isProtected(); + static bool isCrossedOut(); + static bool isDoubleUnderline(); + static bool isAltCharset(); + static bool isPCcharset(); + static bool isTransparent(); + static bool isTransShadow(); + static bool isInheritBackground(); + 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 isCursorHideable(); + static bool hasChangedTermSize(); + static bool hasUTF8(); // Methods - virtual void clearArea (int = ' '); - void createVTerm (const FRect&); - void createVTerm (int, int); - static void resizeVTerm (const FRect&); - static void resizeVTerm (int, int); - static void putVTerm(); - static void updateTerminal (terminal_update); - static void updateTerminal(); - virtual void addPreprocessingHandler ( FVTerm* - , FPreprocessingHandler ); - virtual void delPreprocessingHandler (FVTerm*); + virtual void clearArea (int = ' '); + void createVTerm (const FRect&); + void createVTerm (int, int); + void resizeVTerm (const FRect&); + void resizeVTerm (int, int); + void putVTerm(); + void updateTerminal (terminal_update); + void updateTerminal(); + virtual void addPreprocessingHandler ( FVTerm* + , FPreprocessingHandler ); + virtual void delPreprocessingHandler (FVTerm*); - int printf (const FString, ...); - int print (const FString&); - int print (term_area*, const FString&); - int print (const std::vector&); - int print (term_area*, const std::vector&); - int print (int); - int print (term_area*, int); - int print (charData&); - int print (term_area*, charData&); - FVTerm& print(); + int printf (const FString, ...); + int print (const FString&); + int print (term_area*, const FString&); + int print (const std::vector&); + int print (term_area*, const std::vector&); + int print (int); + int print (term_area*, int); + int print (charData&); + int print (term_area*, charData&); + FVTerm& print(); + static void beep(); protected: // Enumeration @@ -260,98 +291,121 @@ class FVTerm : public FTerm }; // Accessor - virtual term_area* getPrintArea(); + virtual term_area* getPrintArea(); + std::size_t getLineNumber(); + std::size_t getColumnNumber(); + static bool charEncodable (uInt); + static FKeyboard* getKeyboard(); + static FMouseControl* getMouseControl(); + FTerm::initializationValues& getInitValues(); + + // Mutators + static void setInsertCursor (bool on); + static void setInsertCursor(); + static void unsetInsertCursor(); + static bool setUTF8 (bool); + static bool setUTF8(); + static bool unsetUTF8(); // Inquiries - bool hasPrintArea() const; - bool hasChildPrintArea() const; - bool isVirtualWindow() const; + bool hasPrintArea() const; + bool hasChildPrintArea() const; + bool isVirtualWindow() const; + static bool hasHalfBlockCharacter(); + static bool hasShadowCharacter(); // Methods - void createArea ( const FRect& - , const FPoint& - , term_area*& ); + void createArea ( const FRect& + , const FPoint& + , term_area*& ); - void createArea ( int, int, int, int - , int, int - , term_area*& ); + void createArea ( int, int, int, int + , int, int + , term_area*& ); - static void resizeArea ( const FRect& - , const FPoint& + void resizeArea ( const FRect& + , const FPoint& + , term_area* ); + + void resizeArea ( int, int, int, int + , int, int + , term_area* ); + + static void removeArea (term_area*&); + static void restoreVTerm (const FRect&); + static void restoreVTerm (int, int, int, int); + void setTextToDefault (term_area*, int, int); + static bool reallocateTextArea ( term_area* + , std::size_t + , std::size_t ); + static bool reallocateTextArea ( term_area* + , std::size_t ); + + static covered_state isCovered ( const FPoint& , term_area* ); - static void resizeArea ( int, int, int, int - , int, int + static covered_state isCovered ( int, int , term_area* ); - static void removeArea (term_area*&); - static void restoreVTerm (const FRect&); - static void restoreVTerm (int, int, int, int); - static void setTextToDefault (term_area*, int, int); - static bool reallocateTextArea ( term_area* - , std::size_t - , std::size_t ); - static bool reallocateTextArea ( term_area* - , std::size_t ); - - static covered_state isCovered ( const FPoint& - , term_area* ); - - static covered_state isCovered ( int, int - , term_area* ); - - static void updateOverlappedColor ( term_area* + static void updateOverlappedColor ( term_area* + , int, int, int, int ); + static void updateOverlappedCharacter (term_area*, int, int); + static void updateShadedCharacter ( term_area* + , int, int, int, int ); + static void updateInheritBackground ( term_area* + , int, int, int, int ); + static void updateCharacter ( term_area* + , int, int, int, int ); + static bool updateVTermCharacter ( term_area* , int, int, int, int ); - static void updateOverlappedCharacter (term_area*, int, int); - static void updateShadedCharacter ( term_area* - , int, int, int, int ); - static void updateInheritBackground ( term_area* - , int, int, int, int ); - static void updateCharacter ( term_area* - , int, int, int, int ); - static bool updateVTermCharacter ( term_area* - , int, int, int, int ); - static void callPreprocessingHandler (term_area*); - static void updateVTerm(); - static void updateVTerm (term_area*); - static bool updateVTermCursor (term_area*); - static bool isInsideArea (int, int, term_area*); + static void callPreprocessingHandler (term_area*); + void updateVTerm(); + void updateVTerm (term_area*); + bool updateVTermCursor (term_area*); + static bool isInsideArea (int, int, term_area*); - static void setAreaCursor ( const FPoint& - , bool, term_area* ); + static void setAreaCursor ( const FPoint& + , bool, term_area* ); - static void setAreaCursor ( int, int - , bool, term_area*); + static void setAreaCursor ( int, int + , bool, term_area*); - static void getArea (const FPoint&, term_area*); - static void getArea (int, int, term_area*); - static void getArea (const FRect&, term_area*); - static void getArea (int, int, int, int, term_area*); - static void putArea (const FPoint&, term_area*); - static void putArea (int, int, term_area*); - static void scrollAreaForward (term_area*); - static void scrollAreaReverse (term_area*); - static void clearArea (term_area*, int = ' '); + static void getArea (const FPoint&, term_area*); + static void getArea (int, int, term_area*); + static void getArea (const FRect&, term_area*); + static void getArea (int, int, int, int, term_area*); + static void putArea (const FPoint&, term_area*); + static void putArea (int, int, term_area*); + void scrollAreaForward (term_area*); + void scrollAreaReverse (term_area*); + void clearArea (term_area*, int = ' '); - static charData generateCharacter (const FPoint&); - static charData generateCharacter (int, int); + static charData generateCharacter (const FPoint&); + static charData generateCharacter (int, int); - static charData getCharacter ( character_type - , const FPoint& - , FVTerm* ); + static charData getCharacter ( character_type + , const FPoint& + , FVTerm* ); - static charData getCharacter ( character_type - , int - , int, FVTerm* ); + static charData getCharacter ( character_type + , int + , int, FVTerm* ); - static charData getCoveredCharacter (const FPoint&, FVTerm*); - static charData getCoveredCharacter (int, int, FVTerm*); - static charData getOverlappedCharacter (const FPoint&, FVTerm*); - static charData getOverlappedCharacter (int, int, FVTerm*); - static void processTerminalUpdate(); - static void startTerminalUpdate(); - static void finishTerminalUpdate(); - static void flush_out(); + static charData getCoveredCharacter (const FPoint&, FVTerm*); + static charData getCoveredCharacter (int, int, FVTerm*); + static charData getOverlappedCharacter (const FPoint&, FVTerm*); + static charData getOverlappedCharacter (int, int, FVTerm*); + void processTerminalUpdate(); + static void startTerminalUpdate(); + static void finishTerminalUpdate(); + static void flush_out(); + static void initScreenSettings(); + static void changeTermSizeFinished(); + static void exitWithMessage (const FString&) + #if defined(__clang__) || defined(__GNUC__) + __attribute__((noreturn)) + #endif + ; // Data Members static term_area* vterm; // virtual terminal @@ -383,49 +437,50 @@ class FVTerm : public FTerm FVTerm& operator = (const FVTerm&); // Mutators - void setPrintArea (term_area*); + void setPrintArea (term_area*); // Methods - void init(); - static void init_characterLengths (FOptiMove*); - void finish(); - static void putAreaLine (charData*, charData*, int); - static void putAreaCharacter ( int, int, FVTerm* - , charData*, charData* ); - static void getAreaCharacter ( int, int, term_area* - , charData*& ); - static bool clearTerm (int = ' '); - static bool clearFullArea (term_area*, charData&); - static void clearAreaWithShadow (term_area*, charData&); - static bool canClearToEOL (uInt, uInt); - static bool canClearLeadingWS (uInt&, uInt); - static bool canClearTrailingWS (uInt&, uInt); - static bool skipUnchangedCharacters (uInt&, uInt, uInt); - static void printRange (uInt, uInt, uInt, bool); - static exit_state eraseCharacters (uInt&, uInt, uInt, bool); - static exit_state repeatCharacter (uInt&, uInt, uInt); - static void cursorWrap(); - bool printWrap (term_area*); - static void updateTerminalLine (uInt); - static bool updateTerminalCursor(); - static bool isInsideTerminal (int, int); - static void markAsPrinted (uInt, uInt); - static void markAsPrinted (uInt, uInt, uInt); - static void newFontChanges (charData*&); - static void charsetChanges (charData*&); - static void appendCharacter (charData*&); - static void appendChar (charData*&); - static void appendAttributes (charData*&); - static int appendLowerRight (charData*&); - static void appendOutputBuffer (const std::string&); - static void appendOutputBuffer (const char[]); + void init (bool); + static void init_characterLengths (FOptiMove*); + void finish(); + static void putAreaLine (charData*, charData*, int); + static void putAreaCharacter ( int, int, FVTerm* + , charData*, charData* ); + static void getAreaCharacter ( int, int, term_area* + , charData*& ); + bool clearTerm (int = ' '); + bool clearFullArea (term_area*, charData&); + static void clearAreaWithShadow (term_area*, charData&); + static bool canClearToEOL (uInt, uInt); + static bool canClearLeadingWS (uInt&, uInt); + static bool canClearTrailingWS (uInt&, uInt); + bool skipUnchangedCharacters (uInt&, uInt, uInt); + void printRange (uInt, uInt, uInt, bool); + exit_state eraseCharacters (uInt&, uInt, uInt, bool); + exit_state repeatCharacter (uInt&, uInt, uInt); + static void cursorWrap(); + bool printWrap (term_area*); + void updateTerminalLine (uInt); + bool updateTerminalCursor(); + bool isInsideTerminal (int, int); + static void markAsPrinted (uInt, uInt); + static void markAsPrinted (uInt, uInt, uInt); + static void newFontChanges (charData*&); + static void charsetChanges (charData*&); + void appendCharacter (charData*&); + void appendChar (charData*&); + void appendAttributes (charData*&); + int appendLowerRight (charData*&); + static void appendOutputBuffer (const std::string&); + static void appendOutputBuffer (const char[]); #if defined(__sun) && defined(__SVR4) - static int appendOutputBuffer (char); + static int appendOutputBuffer (char); #endif - static int appendOutputBuffer (int); + static int appendOutputBuffer (int); // Data Members + static FTerm* fterm; static std::queue* output_buffer; static charData term_attribute; static charData next_attribute; @@ -547,6 +602,30 @@ inline FVTerm::term_area* FVTerm::getVWin() const inline FVTerm::charData FVTerm::getAttribute() { return next_attribute; } +//---------------------------------------------------------------------- +inline int FVTerm::getMaxColor() +{ return fterm->getMaxColor(); } + +//---------------------------------------------------------------------- +inline int FVTerm::getTabstop() +{ return fterm->getTabstop(); } + +//---------------------------------------------------------------------- +inline fc::encoding FVTerm::getEncoding() +{ return fterm->getEncoding(); } + +//---------------------------------------------------------------------- +inline std::string FVTerm::getEncodingString() +{ return fterm->getEncodingString(); } + +//---------------------------------------------------------------------- +inline const FString FVTerm::getKeyName (int keynum) +{ return fterm->getKeyName(keynum); } + +//---------------------------------------------------------------------- +inline FTerm& FVTerm::getFTerm() +{ return *fterm; } + //---------------------------------------------------------------------- inline void FVTerm::hideCursor() { return hideCursor(true); } @@ -834,10 +913,158 @@ inline bool FVTerm::isTransShadow() inline bool FVTerm::isInheritBackground() { return next_attribute.attr.bit.inherit_bg; } +//---------------------------------------------------------------------- +inline bool FVTerm::isMonochron() +{ return fterm->isMonochron(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isXTerminal() +{ return fterm->isXTerminal(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isAnsiTerminal() +{ return fterm->isAnsiTerminal(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isRxvtTerminal() +{ return fterm->isRxvtTerminal(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isUrxvtTerminal() +{ return fterm->isUrxvtTerminal(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isMltermTerminal() +{ return fterm->isMltermTerminal(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isPuttyTerminal() +{ return fterm->isPuttyTerminal(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isKdeTerminal() +{ return fterm->isKdeTerminal(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isGnomeTerminal() +{ return fterm->isGnomeTerminal(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isKtermTerminal() +{ return fterm->isKtermTerminal(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isTeraTerm() +{ return fterm->isTeraTerm(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isSunTerminal() +{ return fterm->isSunTerminal(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isCygwinTerminal() +{ return fterm->isCygwinTerminal(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isMinttyTerm() +{ return fterm->isMinttyTerm(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isLinuxTerm() +{ return fterm->isLinuxTerm(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isFreeBSDTerm() +{ return fterm->isFreeBSDTerm(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isNetBSDTerm() +{ return fterm->isNetBSDTerm(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isOpenBSDTerm() +{ return fterm->isOpenBSDTerm(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isScreenTerm() +{ return fterm->isScreenTerm(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isTmuxTerm() +{ return fterm->isTmuxTerm(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isNewFont() +{ return fterm->isNewFont(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::isCursorHideable() +{ return fterm->isCursorHideable(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::hasChangedTermSize() +{ return fterm->hasChangedTermSize(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::hasUTF8() +{ return fterm->hasUTF8(); } + //---------------------------------------------------------------------- inline FVTerm& FVTerm::print() { return *this; } +//---------------------------------------------------------------------- +inline void FVTerm::beep() +{ return fterm->beep(); } + +//---------------------------------------------------------------------- +inline std::size_t FVTerm::getLineNumber() +{ return fterm->getLineNumber(); } + +//---------------------------------------------------------------------- +inline std::size_t FVTerm::getColumnNumber() +{ return fterm->getColumnNumber(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::charEncodable (uInt c) +{ return fterm->charEncodable(c); } + +//---------------------------------------------------------------------- +inline FKeyboard* FVTerm::getKeyboard() +{ return fterm->getKeyboard(); } + +//---------------------------------------------------------------------- +inline FMouseControl* FVTerm::getMouseControl() +{ return fterm->getMouseControl(); } + +//---------------------------------------------------------------------- +inline FTerm::initializationValues& FVTerm::getInitValues() +{ return fterm->getInitValues(); } + +//---------------------------------------------------------------------- +inline void FVTerm::setInsertCursor (bool on) +{ return fterm->setInsertCursor(on); } + +//---------------------------------------------------------------------- +inline void FVTerm::setInsertCursor() +{ return fterm->setInsertCursor(true); } + +//---------------------------------------------------------------------- +inline void FVTerm::unsetInsertCursor() +{ return fterm->setInsertCursor(false); } + +//---------------------------------------------------------------------- +inline bool FVTerm::setUTF8 (bool on) +{ return fterm->setUTF8(on); } + +//---------------------------------------------------------------------- +inline bool FVTerm::setUTF8() +{ return fterm->setUTF8(true); } + +//---------------------------------------------------------------------- +inline bool FVTerm::unsetUTF8() +{ return fterm->setUTF8(false); } + //---------------------------------------------------------------------- inline bool FVTerm::hasPrintArea() const { return print_area; } @@ -850,6 +1077,26 @@ inline bool FVTerm::hasChildPrintArea() const inline bool FVTerm::isVirtualWindow() const { return vwin; } +//---------------------------------------------------------------------- +inline bool FVTerm::hasHalfBlockCharacter() +{ return fterm->hasHalfBlockCharacter(); } + +//---------------------------------------------------------------------- +inline bool FVTerm::hasShadowCharacter() +{ return fterm->hasShadowCharacter(); } + +//---------------------------------------------------------------------- +inline void FVTerm::initScreenSettings() +{ fterm->initScreenSettings(); } + +//---------------------------------------------------------------------- +inline void FVTerm::changeTermSizeFinished() +{ fterm->changeTermSizeFinished(); } + +//---------------------------------------------------------------------- +inline void FVTerm::exitWithMessage (const FString& message) +{ fterm->exitWithMessage(message); } + //---------------------------------------------------------------------- inline void FVTerm::setPrintArea (term_area* area) { print_area = area; } diff --git a/src/include/final/fwindow.h b/src/include/final/fwindow.h index d82a836a..5639fc51 100644 --- a/src/include/final/fwindow.h +++ b/src/include/final/fwindow.h @@ -149,7 +149,7 @@ class FWindow : public FWidget static bool lowerWindow (FWidget*); bool lowerWindow (); bool zoomWindow (); - static void switchToPrevWindow(); + static void switchToPrevWindow (FWidget*); static bool activatePrevWindow(); virtual void setShadowSize (int, int);