FTerm is now a data member of FVTerm

This commit is contained in:
Markus Gans 2018-10-29 00:45:45 +01:00
parent 98bff1e45b
commit 5d134793cf
22 changed files with 764 additions and 507 deletions

View File

@ -62,6 +62,7 @@ matrix:
- ./configure --prefix=/usr CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG" --with-unit-test - ./configure --prefix=/usr CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG" --with-unit-test
- make V=1 -j10 - make V=1 -j10
- make check - make check
- cat test/*.log
# #
# Coveralls # Coveralls

View File

@ -1,3 +1,6 @@
2018-10-29 Markus Gans <guru.mail@muenster.de>
* FTerm is now a data member of FVTerm
2018-10-26 Markus Gans <guru.mail@muenster.de> 2018-10-26 Markus Gans <guru.mail@muenster.de>
* Building Fix for a negative value check (gcc < 4.8) * Building Fix for a negative value check (gcc < 4.8)
* Adding the capacity() method to the FString class * Adding the capacity() method to the FString class

View File

@ -158,47 +158,47 @@ Class digramm
┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │ ┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │
: └────────────────┘ │ └─────────────┘ : └────────────────┘ │ └─────────────┘
: 1┌──────────┐ │ ┌─────────────┐ : 1┌──────────┐ │ ┌─────────────┐
┌-----------┤ FTermcap │ ┌────────┐ ├────┤ FAccelEvent │ ┌-----------┤ FTermcap │ ├────┤ FAccelEvent │
: └──────────┘ │ FEvent │◄─┤ └─────────────┘ : └──────────┘ └─────────────┘
: 1┌──────────┐ └───┬────┘ │ ┌──────────────┐ : 1┌──────────┐ │ ┌──────────────┐
┌-----------┤ FTermios │ :1 ├────┤ FResizeEvent │ ┌-----------┤ FTermios │ ├────┤ FResizeEvent │
: └──────────┘ : │ └──────────────┘ : └──────────┘ │ └──────────────┘
: 1┌───────────────┐ : │ ┌────────────┐ : 1┌───────────────┐ │ ┌────────────┐
┌-----------┤ FColorPalette │ : ├────┤ FShowEvent │ ┌-----------┤ FColorPalette │ ├────┤ FShowEvent │
: └───────────────┘ : │ └────────────┘ : └───────────────┘ │ └────────────┘
: 1┌───────────┐ : │ ┌────────────┐ : 1┌───────────┐ │ ┌────────────┐
┌-----------┤ FOptiMove │ : ├────┤ FHideEvent │ ┌-----------┤ FOptiMove │ ├────┤ FHideEvent │
: └───────────┘ : │ └────────────┘ : └───────────┘ │ └────────────┘
: 1┌───────────┐ : │ ┌─────────────┐ : 1┌───────────┐ │ ┌─────────────┐
┌-----------┤ FOptiAttr │ : ├────┤ FCloseEvent │ ┌-----------┤ FOptiAttr │ ├────┤ FCloseEvent │
: └───────────┘ : │ └─────────────┘ : └───────────┘ │ └─────────────┘
: 1┌───────────┐ : │ ┌─────────────┐ : 1┌───────────┐ │ ┌─────────────┐
┌-----------┤ FKeyboard │ : └────┤ FTimerEvent │ ┌-----------┤ FKeyboard │ ────┤ FTimerEvent │
: └───────────┘ : └─────────────┘ : └───────────┘ └─────────────┘
: 1┌───────────────┐ : : 1┌───────────────┐
┌-----------┤ FMouseControl │ : ┌──────────────┐ ┌-----------┤ FMouseControl │ ┌──────────────┐
: └───────────────┘ : ┌────┤ FApplication │ : └───────────────┘ ┌────┤ FApplication │
: *┌─────────┐ : │ └──────────────┘ : *┌─────────┐ │ └──────────────┘
: ┌--------┤ FString │ : │ ┌─────────┐ : ┌--------┤ FString │ │ ┌─────────┐
: : └─────────┘ : ├────┤ FButton │ : : └─────────┘ ├────┤ FButton │
: : *┌────────┐ : │ └─────────┘ : : *┌────────┐ │ └─────────┘
: ┌--------┤ FPoint │ : │ ┌────────┐ : ┌--------┤ FPoint │ │ ┌────────┐
: : └────────┘ : ├────┤ FLabel │ : : └────────┘ ├────┤ FLabel │
: : *┌───────┐ : │ └────────┘ : : *┌───────┐ │ └────────┘
: ┌--------┤ FRect │ : │ ┌───────────┐ : ┌--------┤ FRect │ │ ┌───────────┐
: : └───────┘ : ├────┤ FLineEdit │ : : └───────┘ ├────┤ FLineEdit │
:1 :1 : │ └───────────┘ :1 :1 │ └───────────┘
┌─┴──┴──┐ ┌────────┐ : │ ┌──────────────┐ ┌──────────────┐ ┌─┴──┴──┐ │ ┌──────────────┐ ┌──────────────┐
│ FTerm │◄───┤ FVTerm │◄──┐ :1 ├────┤ FButtonGroup │ ┌──┤ FRadioButton │ │ FTerm │ ├────┤ FButtonGroup │ ┌──┤ FRadioButton │
└───────┘ └────────┘ │ ┌────┴────┐ │ └──────────────┘ │ └──────────────┘ └───┬───┘ ┌────────┐ │ │ └──────────────┘ │ └──────────────┘
├──┤ FWidget │◄─┤ ┌───────────────┐ │ ┌───────────┐ :1 │ FEvent │◄─────┘ │ ┌───────────────┐ │ ┌───────────┐
┌─────────┐ │ └─────────┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │ ┌───┴────┐ └────┬───┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │
│ FObject │◄──┘ │ └───────────────┘ │ └───────────┘ │ FVTerm │◄──┐ :1 │ └───────────────┘ │ └───────────┘
└─────────┘ │ ┌──────────────┐ │ ┌─────────┐ └────────┘ │ ┌────┴────┐ │ ┌──────────────┐ │ ┌─────────┐
────┤ FProgressbar │ └──┤ FSwitch │ ├────┤ FWidget │◄───────┼────┤ FProgressbar │ └──┤ FSwitch │
│ └──────────────┘ └─────────┘ ┌─────────┐ │ └─────────┘ │ └──────────────┘ └─────────┘
│ ┌────────────┐ │ FObject │◄──┘ │ ┌────────────┐
├────┤ FScrollbar │ └─────────┘ ├────┤ FScrollbar │
│ └────────────┘ │ └────────────┘
│ ┌───────────┐ │ ┌───────────┐
├────┤ FTextView │ ├────┤ FTextView │
@ -207,7 +207,7 @@ Class digramm
├────┤ FListBox ├-------┤ FListBoxItem │ ├────┤ FListBox ├-------┤ FListBoxItem │
│ └──────────┘ └──────────────┘ │ └──────────┘ └──────────────┘
┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐ ┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐
│ FTermBuffer ├---------------------------├────┤ FListView ├------┤ FListViewItem │ │ FTermBuffer ├----------------------├────┤ FListView ├------┤ FListViewItem │
└─────────────┘ │ └───────────┘ └───────────────┘ └─────────────┘ │ └───────────┘ └───────────────┘
│ ┌─────────────┐ │ ┌─────────────┐
├────┤ FScrollView │ ├────┤ FScrollView │
@ -230,15 +230,15 @@ Class digramm
┌───────────┐ └──────┤ └──────────┘ ┌───────────┐ └──────┤ └──────────┘
│ FMenuList │◄──────────┤ ┌───────┐ │ FMenuList │◄──────────┤ ┌───────┐
└────┬──────┘ └───┤ FMenu │◄──┐ └────┬──────┘ └───┤ FMenu │◄──┐
1: └───────┘ │ :1 └───────┘ │
: ┌─────────────────┐ │ : ┌─────────────────┐ │
: │ FDialogListMenu ├───┘ : │ FDialogListMenu ├───┘
: └─────────────────┘ : └─────────────────┘
└--------------------------------┐ └--------------------------------┐
:* ┌────────────────┐* : :* ┌────────────────┐* :
────┴─────┐ ┌──┤ FCheckMenuItem ├---┘ ┌────┴─────┐ ┌──┤ FCheckMenuItem ├---┘
│FMenuItem │◄─┤ └────────────────┘ : │FMenuItem │◄─┤ └────────────────┘ :
──────────┘ │ ┌────────────────┐* : └──────────┘ │ ┌────────────────┐* :
└──┤ FRadioMenuItem ├---┘ └──┤ FRadioMenuItem ├---┘
└────────────────┘ └────────────────┘
</pre> </pre>

View File

@ -17,47 +17,47 @@
┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │ ┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │
: └────────────────┘ │ └─────────────┘ : └────────────────┘ │ └─────────────┘
: 1┌──────────┐ │ ┌─────────────┐ : 1┌──────────┐ │ ┌─────────────┐
┌-----------┤ FTermcap │ ┌────────┐ ├────┤ FAccelEvent │ ┌-----------┤ FTermcap │ ├────┤ FAccelEvent │
: └──────────┘ │ FEvent │◄─┤ └─────────────┘ : └──────────┘ └─────────────┘
: 1┌──────────┐ └───┬────┘ │ ┌──────────────┐ : 1┌──────────┐ │ ┌──────────────┐
┌-----------┤ FTermios │ :1 ├────┤ FResizeEvent │ ┌-----------┤ FTermios │ ├────┤ FResizeEvent │
: └──────────┘ : │ └──────────────┘ : └──────────┘ │ └──────────────┘
: 1┌───────────────┐ : │ ┌────────────┐ : 1┌───────────────┐ │ ┌────────────┐
┌-----------┤ FColorPalette │ : ├────┤ FShowEvent │ ┌-----------┤ FColorPalette │ ├────┤ FShowEvent │
: └───────────────┘ : │ └────────────┘ : └───────────────┘ │ └────────────┘
: 1┌───────────┐ : │ ┌────────────┐ : 1┌───────────┐ │ ┌────────────┐
┌-----------┤ FOptiMove │ : ├────┤ FHideEvent │ ┌-----------┤ FOptiMove │ ├────┤ FHideEvent │
: └───────────┘ : │ └────────────┘ : └───────────┘ │ └────────────┘
: 1┌───────────┐ : │ ┌─────────────┐ : 1┌───────────┐ │ ┌─────────────┐
┌-----------┤ FOptiAttr │ : ├────┤ FCloseEvent │ ┌-----------┤ FOptiAttr │ ├────┤ FCloseEvent │
: └───────────┘ : │ └─────────────┘ : └───────────┘ │ └─────────────┘
: 1┌───────────┐ : │ ┌─────────────┐ : 1┌───────────┐ │ ┌─────────────┐
┌-----------┤ FKeyboard │ : └────┤ FTimerEvent │ ┌-----------┤ FKeyboard │ ────┤ FTimerEvent │
: └───────────┘ : └─────────────┘ : └───────────┘ └─────────────┘
: 1┌───────────────┐ : : 1┌───────────────┐
┌-----------┤ FMouseControl │ : ┌──────────────┐ ┌-----------┤ FMouseControl │ ┌──────────────┐
: └───────────────┘ : ┌────┤ FApplication │ : └───────────────┘ ┌────┤ FApplication │
: *┌─────────┐ : │ └──────────────┘ : *┌─────────┐ │ └──────────────┘
: ┌--------┤ FString │ : │ ┌─────────┐ : ┌--------┤ FString │ │ ┌─────────┐
: : └─────────┘ : ├────┤ FButton │ : : └─────────┘ ├────┤ FButton │
: : *┌────────┐ : │ └─────────┘ : : *┌────────┐ │ └─────────┘
: ┌--------┤ FPoint │ : │ ┌────────┐ : ┌--------┤ FPoint │ │ ┌────────┐
: : └────────┘ : ├────┤ FLabel │ : : └────────┘ ├────┤ FLabel │
: : *┌───────┐ : │ └────────┘ : : *┌───────┐ │ └────────┘
: ┌--------┤ FRect │ : │ ┌───────────┐ : ┌--------┤ FRect │ │ ┌───────────┐
: : └───────┘ : ├────┤ FLineEdit │ : : └───────┘ ├────┤ FLineEdit │
:1 :1 : │ └───────────┘ :1 :1 │ └───────────┘
┌─┴──┴──┐ ┌────────┐ : │ ┌──────────────┐ ┌──────────────┐ ┌─┴──┴──┐ │ ┌──────────────┐ ┌──────────────┐
│ FTerm │◄───┤ FVTerm │◄──┐ :1 ├────┤ FButtonGroup │ ┌──┤ FRadioButton │ │ FTerm │ ├────┤ FButtonGroup │ ┌──┤ FRadioButton │
└───────┘ └────────┘ │ ┌────┴────┐ │ └──────────────┘ │ └──────────────┘ └───┬───┘ ┌────────┐ │ │ └──────────────┘ │ └──────────────┘
├──┤ FWidget │◄─┤ ┌───────────────┐ │ ┌───────────┐ :1 │ FEvent │◄─────┘ │ ┌───────────────┐ │ ┌───────────┐
┌─────────┐ │ └─────────┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │ ┌───┴────┐ └────┬───┘ ├────┤ FToggleButton │◄─┼──┤ FCheckBox │
│ FObject │◄──┘ │ └───────────────┘ │ └───────────┘ │ FVTerm │◄──┐ :1 │ └───────────────┘ │ └───────────┘
└─────────┘ │ ┌──────────────┐ │ ┌─────────┐ └────────┘ │ ┌────┴────┐ │ ┌──────────────┐ │ ┌─────────┐
────┤ FProgressbar │ └──┤ FSwitch │ ├────┤ FWidget │◄───────┼────┤ FProgressbar │ └──┤ FSwitch │
│ └──────────────┘ └─────────┘ ┌─────────┐ │ └─────────┘ │ └──────────────┘ └─────────┘
│ ┌────────────┐ │ FObject │◄──┘ │ ┌────────────┐
├────┤ FScrollbar │ └─────────┘ ├────┤ FScrollbar │
│ └────────────┘ │ └────────────┘
│ ┌───────────┐ │ ┌───────────┐
├────┤ FTextView │ ├────┤ FTextView │
@ -66,7 +66,7 @@
├────┤ FListBox ├-------┤ FListBoxItem │ ├────┤ FListBox ├-------┤ FListBoxItem │
│ └──────────┘ └──────────────┘ │ └──────────┘ └──────────────┘
┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐ ┌─────────────┐1 │ 1┌───────────┐1 *┌───────────────┐
│ FTermBuffer ├---------------------------├────┤ FListView ├------┤ FListViewItem │ │ FTermBuffer ├----------------------├────┤ FListView ├------┤ FListViewItem │
└─────────────┘ │ └───────────┘ └───────────────┘ └─────────────┘ │ └───────────┘ └───────────────┘
│ ┌─────────────┐ │ ┌─────────────┐
├────┤ FScrollView │ ├────┤ FScrollView │
@ -95,9 +95,9 @@
: └─────────────────┘ : └─────────────────┘
└--------------------------------┐ └--------------------------------┐
:* ┌────────────────┐* : :* ┌────────────────┐* :
────┴─────┐ ┌──┤ FCheckMenuItem ├---┘ ┌────┴─────┐ ┌──┤ FCheckMenuItem ├---┘
│FMenuItem │◄─┤ └────────────────┘ : │FMenuItem │◄─┤ └────────────────┘ :
──────────┘ │ ┌────────────────┐* : └──────────┘ │ ┌────────────────┐* :
└──┤ FRadioMenuItem ├---┘ └──┤ FRadioMenuItem ├---┘
└────────────────┘ └────────────────┘

View File

@ -111,7 +111,7 @@ void move (int xold, int yold, int xnew, int ynew)
<< std::left << std::setw(10) << to << std::left << std::setw(10) << to
<< " "; << " ";
// get the move string // get the move string
buffer = terminal->moveCursor (xold, yold, xnew, ynew); buffer = terminal->getFTerm().moveCursor (xold, yold, xnew, ynew);
len = uInt(std::strlen(buffer)); len = uInt(std::strlen(buffer));
for (uInt i = 0; i < len; i++) for (uInt i = 0; i < len; i++)
@ -164,7 +164,7 @@ int main (int argc, char* argv[])
TermApp.clearArea(); TermApp.clearArea();
// Show the determined terminal name and text resolution // 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 << " Columns: 0.." << xmax << "\r\n";
std::cout << " Lines: 0.." << ymax << "\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 // Show terminal speed and milliseconds for all cursor movement sequence
std::cout << "\r" << line; std::cout << "\r" << line;
TermApp.printMoveDurations(); TermApp.getFTerm().printMoveDurations();
// Waiting for keypress // Waiting for keypress
keyPressed(); keyPressed();

View File

@ -74,7 +74,7 @@ AttribDlg::AttribDlg (finalcut::FWidget* parent)
, back_button("< &Back", this) , back_button("< &Back", this)
{ {
setText ( "A terminal attributes test (" setText ( "A terminal attributes test ("
+ finalcut::FString(getTermType()) + finalcut::FString(getFTerm().getTermType())
+ ")"); + ")");
next_button.setGeometry(int(getWidth()) - 13, int(getHeight()) - 4, 10, 1); next_button.setGeometry(int(getWidth()) - 13, int(getHeight()) - 4, 10, 1);

View File

@ -225,20 +225,21 @@ void tcapString (const std::string& name, const char cap_str[])
#if DEBUG #if DEBUG
void debug (finalcut::FApplication& TermApp) void debug (finalcut::FApplication& TermApp)
{ {
const finalcut::FString& ab_s = TermApp.getAnswerbackString(); finalcut::FTerm& fterm = TermApp.getFTerm();
const finalcut::FString& sec_da = TermApp.getSecDAString(); const finalcut::FString& ab_s = fterm.getAnswerbackString();
const finalcut::FString& sec_da = fterm.getSecDAString();
std::cout << "\n.------------------- debug -------------------\r\n"; std::cout << "\n.------------------- debug -------------------\r\n";
#if defined(__linux__) #if defined(__linux__)
std::cout << "| Framebuffer bpp: " std::cout << "| Framebuffer bpp: "
<< TermApp.getFramebufferBpp() << "\r\n"; << fterm.getFramebufferBpp() << "\r\n";
#endif #endif
std::cout << "| after init_256colorTerminal(): " std::cout << "| after init_256colorTerminal(): "
<< TermApp.getTermType_256color() << "\r\n"; << fterm.getTermType_256color() << "\r\n";
std::cout << "| after parseAnswerbackMsg(): " std::cout << "| after parseAnswerbackMsg(): "
<< TermApp.getTermType_Answerback() << "\r\n"; << fterm.getTermType_Answerback() << "\r\n";
std::cout << "| after parseSecDA(): " std::cout << "| after parseSecDA(): "
<< TermApp.getTermType_SecDA() << "\r\n"; << fterm.getTermType_SecDA() << "\r\n";
if ( ! ab_s.isEmpty() ) if ( ! ab_s.isEmpty() )
tcapString ("| The answerback String", ab_s); tcapString ("| The answerback String", ab_s);
@ -313,8 +314,9 @@ int main (int argc, char* argv[])
finalcut::FTermcap::tcap_map* tcap = 0; finalcut::FTermcap::tcap_map* tcap = 0;
tcap = finalcut::FTermcap::getTermcapMap(); tcap = finalcut::FTermcap::getTermcapMap();
finalcut::FTerm& fterm = TermApp.getFTerm();
std::cout << "--------\r\nFTermcap\r\n--------\r\n\n"; 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); debug (TermApp);

View File

@ -836,8 +836,8 @@ void MyDialog::cb_terminfo (finalcut::FWidget*, data_ptr)
( (
"Environment" "Environment"
, finalcut::FString() , finalcut::FString()
<< " Type: " << getTermType() << "\n" << " Type: " << getFTerm().getTermType() << "\n"
<< " Name: " << getTermFileName() << "\n" << " Name: " << getFTerm().getTermFileName() << "\n"
<< " Mode: " << getEncodingString() << "\n" << " Mode: " << getEncodingString() << "\n"
<< " Size: " << x << wchar_t(finalcut::fc::Times) << " Size: " << x << wchar_t(finalcut::fc::Times)
<< y << "\n" << y << "\n"
@ -943,7 +943,7 @@ void MyDialog::cb_setTitlebar (finalcut::FWidget* widget, data_ptr)
finalcut::FLineEdit* lineedit = static_cast<finalcut::FLineEdit*>(widget); finalcut::FLineEdit* lineedit = static_cast<finalcut::FLineEdit*>(widget);
finalcut::FString title; finalcut::FString title;
*lineedit >> title; *lineedit >> title;
setTermTitle (title); getFTerm().setTermTitle (title);
setText (title); setText (title);
redraw(); redraw();
} }
@ -1048,17 +1048,17 @@ int main (int argc, char* argv[])
// Create the application object app // Create the application object app
finalcut::FApplication app(argc, argv); finalcut::FApplication app(argc, argv);
app.redefineDefaultColors(true); app.getFTerm().redefineDefaultColors(true);
app.setTermTitle (title); app.getFTerm().setTermTitle (title);
// Force vt100 encoding // Force vt100 encoding
//app.setEncoding("VT100"); //app.getFTerm().setEncoding(finalcut::fc::VT100);
// Sets the terminal size to 94×30 // Sets the terminal size to 94×30
//app.setTermSize(94,30); //app.setTermSize(94,30);
// Enable the final cut graphical font // Enable the final cut graphical font
//app.setNewFont(); //app.getFTerm().setNewFont();
// Create main dialog object d // Create main dialog object d
MyDialog d(&app); MyDialog d(&app);

View File

@ -302,7 +302,7 @@ FWidget* FApplication::processParameters (const int& argc, char* argv[])
showParameterUsage(); showParameterUsage();
} }
init_values.setDefault(); getInitValues().setDefault();
cmd_options (argc, argv); cmd_options (argc, argv);
return 0; return 0;
} }
@ -449,13 +449,13 @@ void FApplication::cmd_options (const int& argc, char* argv[])
encoding = encoding.toLower(); encoding = encoding.toLower();
if ( encoding.includes("utf8") ) if ( encoding.includes("utf8") )
init_values.encoding = fc::UTF8; getInitValues().encoding = fc::UTF8;
else if ( encoding.includes("vt100") ) else if ( encoding.includes("vt100") )
init_values.encoding = fc::VT100; getInitValues().encoding = fc::VT100;
else if ( encoding.includes("pc") ) else if ( encoding.includes("pc") )
init_values.encoding = fc::PC; getInitValues().encoding = fc::PC;
else if ( encoding.includes("ascii") ) else if ( encoding.includes("ascii") )
init_values.encoding = fc::ASCII; getInitValues().encoding = fc::ASCII;
else if ( encoding.includes("help") ) else if ( encoding.includes("help") )
showParameterUsage(); showParameterUsage();
else else
@ -464,32 +464,32 @@ void FApplication::cmd_options (const int& argc, char* argv[])
} }
if ( std::strcmp(long_options[idx].name, "no-mouse") == 0 ) 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 ) 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 ) 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 ) 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 ) 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 ) if ( std::strcmp(long_options[idx].name, "newfont") == 0 )
init_values.newfont = true; getInitValues().newfont = true;
#if defined(__FreeBSD__) || defined(__DragonFly__) #if defined(__FreeBSD__) || defined(__DragonFly__)
if ( std::strcmp(long_options[idx].name, "no-esc-for-alt-meta") == 0 ) 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 ) 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__) #elif defined(__NetBSD__) || defined(__OpenBSD__)
if ( std::strcmp(long_options[idx].name, "no-esc-for-alt-meta") == 0 ) 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 #endif
} }
} }
@ -853,7 +853,7 @@ void FApplication::closeOpenMenu()
// No widget was been clicked and the menu is no dialog menu // No widget was been clicked and the menu is no dialog menu
if ( ! (getClickedWidget() || is_window_menu) ) if ( ! (getClickedWidget() || is_window_menu) )
FWindow::switchToPrevWindow(); FWindow::switchToPrevWindow(this);
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
@ -894,7 +894,7 @@ void FApplication::unselectMenubarItems()
// No widget was been clicked // No widget was been clicked
if ( ! getClickedWidget() ) if ( ! getClickedWidget() )
FWindow::switchToPrevWindow(); FWindow::switchToPrevWindow(this);
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();

View File

@ -87,7 +87,7 @@ FDialog::~FDialog() // destructor
accelerator_list = 0; accelerator_list = 0;
if ( ! is_quit ) if ( ! is_quit )
switchToPrevWindow(); switchToPrevWindow(this);
delDialog(this); delDialog(this);

View File

@ -71,7 +71,7 @@ FMenu::~FMenu() // destructor
FApplication* fapp = static_cast<FApplication*>(getRootWidget()); FApplication* fapp = static_cast<FApplication*>(getRootWidget());
if ( ! fapp->isQuit() ) if ( ! fapp->isQuit() )
switchToPrevWindow(); // Switch to previous window switchToPrevWindow(this); // Switch to previous window
} }
@ -1664,7 +1664,7 @@ inline void FMenu::keyEscape()
getStatusBar()->clearMessage(); getStatusBar()->clearMessage();
if ( ! (super && isWindowsMenu(super)) ) if ( ! (super && isWindowsMenu(super)) )
switchToPrevWindow(); switchToPrevWindow(this);
} }
if ( getStatusBar() ) if ( getStatusBar() )

View File

@ -1042,7 +1042,7 @@ void FMenuBar::leaveMenuBar()
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->clearMessage(); getStatusBar()->clearMessage();
switchToPrevWindow(); switchToPrevWindow(this);
if ( getStatusBar() ) if ( getStatusBar() )
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();

View File

@ -115,6 +115,17 @@ bool FTerm::isNormal (charData*& ch)
return opti_attr->isNormal(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[]) void FTerm::setTermType (const char term_name[])
{ {

View File

@ -71,7 +71,7 @@ FToolTip::~FToolTip() // destructor
if ( parent_win ) if ( parent_win )
setActiveWindow (parent_win); setActiveWindow (parent_win);
else else
switchToPrevWindow(); switchToPrevWindow(this);
} }

View File

@ -25,6 +25,7 @@
#include <vector> #include <vector>
#include "final/fapplication.h" #include "final/fapplication.h"
#include "final/fterm.h"
#include "final/fvterm.h" #include "final/fvterm.h"
#include "final/fwidget.h" #include "final/fwidget.h"
#include "final/fwindow.h" #include "final/fwindow.h"
@ -48,6 +49,7 @@ uInt FVTerm::clr_eol_length;
uInt FVTerm::cursor_address_length; uInt FVTerm::cursor_address_length;
std::queue<int>* FVTerm::output_buffer = 0; std::queue<int>* FVTerm::output_buffer = 0;
FPoint* FVTerm::term_pos = 0; FPoint* FVTerm::term_pos = 0;
FTerm* FVTerm::fterm = 0;
FVTerm::term_area* FVTerm::vterm = 0; FVTerm::term_area* FVTerm::vterm = 0;
FVTerm::term_area* FVTerm::vdesktop = 0; FVTerm::term_area* FVTerm::vdesktop = 0;
FVTerm::term_area* FVTerm::active_area = 0; FVTerm::term_area* FVTerm::active_area = 0;
@ -66,15 +68,14 @@ FVTerm::charData FVTerm::i_ch;
// constructors and destructor // constructors and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FVTerm::FVTerm (bool initialize, bool disable_alt_screen) FVTerm::FVTerm (bool initialize, bool disable_alt_screen)
: FTerm(disable_alt_screen) : print_area(0)
, print_area(0)
, child_print_area(0) , child_print_area(0)
, vwin(0) , vwin(0)
{ {
terminal_update_complete = false; terminal_update_complete = false;
if ( initialize ) if ( initialize )
init(); init (disable_alt_screen);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -128,7 +129,7 @@ void FVTerm::setTermXY (int x, int y)
term_x = term_pos->getX(); term_x = term_pos->getX();
term_y = term_pos->getY(); 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 ) if ( move_str )
appendOutputBuffer(move_str); appendOutputBuffer(move_str);
@ -142,7 +143,7 @@ void FVTerm::hideCursor (bool on)
{ {
// Hides or shows the input cursor on the terminal // Hides or shows the input cursor on the terminal
char* visibility_str = cursorsVisibility (on); char* visibility_str = fterm->cursorsVisibility (on);
if ( visibility_str ) if ( visibility_str )
appendOutputBuffer(visibility_str); appendOutputBuffer(visibility_str);
@ -1577,7 +1578,7 @@ void FVTerm::scrollAreaForward (term_area* area)
if ( TCAP(fc::t_scroll_forward) ) if ( TCAP(fc::t_scroll_forward) )
{ {
setTermXY (0, vdesktop->height); setTermXY (0, vdesktop->height);
scrollTermForward(); fterm->scrollTermForward();
putArea (1, 1, vdesktop); putArea (1, 1, vdesktop);
// avoid update lines from 0 to (y_max - 1) // 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) ) if ( TCAP(fc::t_scroll_reverse) )
{ {
setTermXY (0, 0); setTermXY (0, 0);
scrollTermReverse(); fterm->scrollTermReverse();
putArea (1, 1, vdesktop); putArea (1, 1, vdesktop);
// avoid update lines from 1 to y_max // avoid update lines from 1 to y_max
@ -1950,7 +1951,7 @@ void FVTerm::flush_out()
{ {
while ( ! output_buffer->empty() ) while ( ! output_buffer->empty() )
{ {
Fputchar (output_buffer->front()); fterm->Fputchar (output_buffer->front());
output_buffer->pop(); output_buffer->pop();
} }
@ -1960,7 +1961,7 @@ void FVTerm::flush_out()
// private methods of FVTerm // private methods of FVTerm
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::init() void FVTerm::init (bool disable_alt_screen)
{ {
init_object = this; init_object = this;
vterm = 0; vterm = 0;
@ -1968,6 +1969,7 @@ void FVTerm::init()
try try
{ {
fterm = new FTerm (disable_alt_screen);
term_pos = new FPoint(-1, -1); term_pos = new FPoint(-1, -1);
output_buffer = new std::queue<int>; output_buffer = new std::queue<int>;
} }
@ -2007,13 +2009,13 @@ void FVTerm::init()
active_area = vdesktop; active_area = vdesktop;
// Initialize keyboard // Initialize keyboard
keyboard = getKeyboard(); keyboard = fterm->getKeyboard();
// Hide the input cursor // Hide the input cursor
hideCursor(); hideCursor();
// Initialize character lengths // Initialize character lengths
init_characterLengths (getFOptiMove()); init_characterLengths (fterm->getFOptiMove());
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2046,7 +2048,7 @@ void FVTerm::finish()
// Clear the terminal // Clear the terminal
setNormal(); setNormal();
if ( hasAlternateScreen() ) if ( fterm->hasAlternateScreen() )
clearTerm(); clearTerm();
flush_out(); flush_out();
@ -2060,6 +2062,9 @@ void FVTerm::finish()
if ( term_pos ) if ( term_pos )
delete 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); char*& cb = TCAP(fc::t_clr_eol);
bool ut = FTermcap::background_color_erase; bool ut = FTermcap::background_color_erase;
charData* next = &next_attribute; charData* next = &next_attribute;
bool normal = isNormal(next); bool normal = fterm->isNormal(next);
appendAttributes(next); appendAttributes(next);
if ( ! ( (cl || cd || cb) && (normal || ut) ) if ( ! ( (cl || cd || cb) && (normal || ut) )
@ -2268,7 +2273,7 @@ bool FVTerm::canClearToEOL (uInt xmin, uInt y)
if ( ce && min_char->code == ' ' ) if ( ce && min_char->code == ' ' )
{ {
uInt beginning_whitespace = 1; uInt beginning_whitespace = 1;
bool normal = isNormal(min_char); bool normal = fterm->isNormal(min_char);
bool& ut = FTermcap::background_color_erase; bool& ut = FTermcap::background_color_erase;
for (uInt x = xmin + 1; x < uInt(vt->width); x++) 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 == ' ' ) if ( cb && first_char->code == ' ' )
{ {
uInt leading_whitespace = 1; uInt leading_whitespace = 1;
bool normal = isNormal(first_char); bool normal = fterm->isNormal(first_char);
bool& ut = FTermcap::background_color_erase; bool& ut = FTermcap::background_color_erase;
for (uInt x = 1; x < uInt(vt->width); x++) 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 == ' ' ) if ( ce && last_char->code == ' ' )
{ {
uInt trailing_whitespace = 1; uInt trailing_whitespace = 1;
bool normal = isNormal(last_char); bool normal = fterm->isNormal(last_char);
bool& ut = FTermcap::background_color_erase; bool& ut = FTermcap::background_color_erase;
for (uInt x = uInt(vt->width) - 1; x > 0 ; x--) 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; return not_used;
uInt whitespace = 1; uInt whitespace = 1;
bool normal = isNormal(print_char); bool normal = fterm->isNormal(print_char);
for (uInt i = x + 1; i <= xmax; i++) for (uInt i = x + 1; i <= xmax; i++)
{ {
@ -2776,14 +2781,14 @@ inline void FVTerm::charsetChanges (charData*& next_char)
return; return;
uInt code = uInt(next_char->code); uInt code = uInt(next_char->code);
uInt ch_enc = charEncode(code); uInt ch_enc = fterm->charEncode(code);
if ( ch_enc == code ) if ( ch_enc == code )
return; return;
if ( ch_enc == 0 ) if ( ch_enc == 0 )
{ {
next_char->code = int(charEncode(code, fc::ASCII)); next_char->code = int(fterm->charEncode(code, fc::ASCII));
return; return;
} }
@ -2801,7 +2806,7 @@ inline void FVTerm::charsetChanges (charData*& next_char)
if ( isXTerminal() && ch_enc < 0x20 ) // Character 0x00..0x1f if ( isXTerminal() && ch_enc < 0x20 ) // Character 0x00..0x1f
{ {
if ( hasUTF8() ) if ( hasUTF8() )
next_char->code = int(charEncode(code, fc::ASCII)); next_char->code = int(fterm->charEncode(code, fc::ASCII));
else else
{ {
next_char->code += 0x5f; next_char->code += 0x5f;
@ -2843,7 +2848,7 @@ inline void FVTerm::appendAttributes (charData*& next_attr)
charData* term_attr = &term_attribute; charData* term_attr = &term_attribute;
// generate attribute string for the next character // 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 ) if ( attr_str )
appendOutputBuffer (attr_str); appendOutputBuffer (attr_str);

View File

@ -1976,13 +1976,7 @@ void FWidget::init()
return; return;
} }
char* cursor_off_str = disableCursor(); hideable = isCursorHideable();
if ( cursor_off_str && std::strlen(cursor_off_str) > 0 )
hideable = true;
else
hideable = false;
visible_cursor = ! hideable; visible_cursor = ! hideable;
// Determine width and height of the terminal // Determine width and height of the terminal

View File

@ -713,13 +713,14 @@ bool FWindow::zoomWindow()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWindow::switchToPrevWindow() void FWindow::switchToPrevWindow (FWidget* widget_object)
{ {
// switch to previous window // switch to previous window
// Disable terminal updates to avoid flickering // Disable terminal updates to avoid flickering
// when redrawing the focused widget // when redrawing the focused widget
updateTerminal (FVTerm::stop_refresh); if ( widget_object )
widget_object->updateTerminal (FVTerm::stop_refresh);
bool is_activated = activatePrevWindow(); bool is_activated = activatePrevWindow();
FWindow* active_window = static_cast<FWindow*>(getActiveWindow()); FWindow* active_window = static_cast<FWindow*>(getActiveWindow());
@ -769,7 +770,8 @@ void FWindow::switchToPrevWindow()
} }
// Enable terminal updates again // Enable terminal updates again
updateTerminal (FVTerm::continue_refresh); if ( widget_object )
widget_object->updateTerminal (FVTerm::continue_refresh);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -108,7 +108,7 @@ class FApplication : public FWidget
static void sendQueuedEvents (); static void sendQueuedEvents ();
static bool eventInQueue(); static bool eventInQueue();
static bool removeQueuedEvent (const FObject*); static bool removeQueuedEvent (const FObject*);
static FWidget* processParameters (const int&, char*[]); FWidget* processParameters (const int&, char*[]);
static void showParameterUsage () static void showParameterUsage ()
#if defined(__clang__) || defined(__GNUC__) #if defined(__clang__) || defined(__GNUC__)
__attribute__((noreturn)) __attribute__((noreturn))
@ -135,7 +135,7 @@ class FApplication : public FWidget
// Methods // Methods
void init (long, long); void init (long, long);
static void cmd_options (const int&, char*[]); void cmd_options (const int&, char*[]);
void findKeyboardWidget(); void findKeyboardWidget();
bool isKeyPressed(); bool isKeyPressed();
void keyPressed(); void keyPressed();

View File

@ -94,7 +94,7 @@ class FLabel : public FWidget
// Accessors // Accessors
const char* getClassName() const; const char* getClassName() const;
FTerm* getAccelWidget(); FWidget* getAccelWidget();
fc::text_alignment getAlignment(); fc::text_alignment getAlignment();
FString& getText(); FString& getText();
@ -172,7 +172,7 @@ inline const char* FLabel::getClassName() const
{ return "FLabel"; } { return "FLabel"; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FTerm* FLabel::getAccelWidget () inline FWidget* FLabel::getAccelWidget ()
{ return accel_widget; } { return accel_widget; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -156,6 +156,8 @@ class FTerm
// Typedefs // Typedefs
typedef FOptiAttr::charData charData; typedef FOptiAttr::charData charData;
struct initializationValues; // forward declaration
// Constructor // Constructor
explicit FTerm (bool = false); explicit FTerm (bool = false);
@ -169,12 +171,14 @@ class FTerm
static std::size_t getLineNumber(); static std::size_t getLineNumber();
static std::size_t getColumnNumber(); static std::size_t getColumnNumber();
static const FString getKeyName (int); static const FString getKeyName (int);
static FOptiMove* getFOptiMove();
static int getTTYFileDescriptor(); static int getTTYFileDescriptor();
static char* getTermType(); static char* getTermType();
static char* getTermFileName(); static char* getTermFileName();
static int getTabstop(); static int getTabstop();
static int getMaxColor(); static int getMaxColor();
initializationValues& getInitValues();
#if DEBUG #if DEBUG
static const FString& getAnswerbackString(); static const FString& getAnswerbackString();
@ -212,12 +216,15 @@ class FTerm
static bool isScreenTerm(); static bool isScreenTerm();
static bool isTmuxTerm(); static bool isTmuxTerm();
static bool isNewFont(); static bool isNewFont();
static bool isCursorHideable();
static bool hasChangedTermSize();
static bool hasShadowCharacter();
static bool hasHalfBlockCharacter();
static bool hasAlternateScreen();
// Mutators // Mutators
static void setTermType (const char[]); static void setTermType (const char[]);
static void setInsertCursor (bool on); static void setInsertCursor (bool on);
static void setInsertCursor();
static void unsetInsertCursor();
static void redefineDefaultColors (bool); static void redefineDefaultColors (bool);
static void setDblclickInterval (const long); static void setDblclickInterval (const long);
static bool setUTF8 (bool); static bool setUTF8 (bool);
@ -275,17 +282,6 @@ class FTerm
static int putchar_ASCII (int); static int putchar_ASCII (int);
static int putchar_UTF8 (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 void initScreenSettings();
static char* changeAttribute ( charData*& static char* changeAttribute ( charData*&
, charData*& ); , charData*& );
@ -451,6 +447,10 @@ inline int FTerm::getTabstop()
inline int FTerm::getMaxColor() inline int FTerm::getMaxColor()
{ return FTermcap::max_color; } { return FTermcap::max_color; }
//----------------------------------------------------------------------
inline FTerm::initializationValues& FTerm::getInitValues()
{ return init_values; }
#if DEBUG #if DEBUG
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FString& FTerm::getAnswerbackString() inline const FString& FTerm::getAnswerbackString()
@ -565,22 +565,6 @@ inline bool FTerm::isTmuxTerm()
inline bool FTerm::isNewFont() inline bool FTerm::isNewFont()
{ return data->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() inline bool FTerm::hasChangedTermSize()
{ return data->hasTermResized(); } { return data->hasTermResized(); }
@ -597,6 +581,14 @@ inline bool FTerm::hasHalfBlockCharacter()
inline bool FTerm::hasAlternateScreen() inline bool FTerm::hasAlternateScreen()
{ return data->hasAlternateScreen(); } { return data->hasAlternateScreen(); }
//----------------------------------------------------------------------
inline bool FTerm::setUTF8()
{ return setUTF8(true); }
//----------------------------------------------------------------------
inline bool FTerm::unsetUTF8()
{ return setUTF8(false); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FOptiMove* FTerm::getFOptiMove() inline FOptiMove* FTerm::getFOptiMove()
{ return opti_move; } { return opti_move; }

View File

@ -78,7 +78,7 @@ class FWidget;
#pragma pack(push) #pragma pack(push)
#pragma pack(1) #pragma pack(1)
class FVTerm : public FTerm class FVTerm
{ {
public: public:
// Typedefs and Enumeration // Typedefs and Enumeration
@ -134,9 +134,15 @@ class FVTerm : public FTerm
term_area* getVWin() const; term_area* getVWin() const;
FPoint getPrintCursor(); FPoint getPrintCursor();
static charData getAttribute(); 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 // Mutators
static void setTermXY (int, int); void setTermXY (int, int);
static void hideCursor (bool); static void hideCursor (bool);
static void hideCursor(); static void hideCursor();
static void showCursor(); static void showCursor();
@ -226,16 +232,40 @@ class FVTerm : public FTerm
static bool isTransparent(); static bool isTransparent();
static bool isTransShadow(); static bool isTransShadow();
static bool isInheritBackground(); 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 // Methods
virtual void clearArea (int = ' '); virtual void clearArea (int = ' ');
void createVTerm (const FRect&); void createVTerm (const FRect&);
void createVTerm (int, int); void createVTerm (int, int);
static void resizeVTerm (const FRect&); void resizeVTerm (const FRect&);
static void resizeVTerm (int, int); void resizeVTerm (int, int);
static void putVTerm(); void putVTerm();
static void updateTerminal (terminal_update); void updateTerminal (terminal_update);
static void updateTerminal(); void updateTerminal();
virtual void addPreprocessingHandler ( FVTerm* virtual void addPreprocessingHandler ( FVTerm*
, FPreprocessingHandler ); , FPreprocessingHandler );
virtual void delPreprocessingHandler (FVTerm*); virtual void delPreprocessingHandler (FVTerm*);
@ -250,6 +280,7 @@ class FVTerm : public FTerm
int print (charData&); int print (charData&);
int print (term_area*, charData&); int print (term_area*, charData&);
FVTerm& print(); FVTerm& print();
static void beep();
protected: protected:
// Enumeration // Enumeration
@ -261,11 +292,27 @@ class FVTerm : public FTerm
// Accessor // 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 // Inquiries
bool hasPrintArea() const; bool hasPrintArea() const;
bool hasChildPrintArea() const; bool hasChildPrintArea() const;
bool isVirtualWindow() const; bool isVirtualWindow() const;
static bool hasHalfBlockCharacter();
static bool hasShadowCharacter();
// Methods // Methods
void createArea ( const FRect& void createArea ( const FRect&
@ -276,18 +323,18 @@ class FVTerm : public FTerm
, int, int , int, int
, term_area*& ); , term_area*& );
static void resizeArea ( const FRect& void resizeArea ( const FRect&
, const FPoint& , const FPoint&
, term_area* ); , term_area* );
static void resizeArea ( int, int, int, int void resizeArea ( int, int, int, int
, int, int , int, int
, term_area* ); , term_area* );
static void removeArea (term_area*&); static void removeArea (term_area*&);
static void restoreVTerm (const FRect&); static void restoreVTerm (const FRect&);
static void restoreVTerm (int, int, int, int); static void restoreVTerm (int, int, int, int);
static void setTextToDefault (term_area*, int, int); void setTextToDefault (term_area*, int, int);
static bool reallocateTextArea ( term_area* static bool reallocateTextArea ( term_area*
, std::size_t , std::size_t
, std::size_t ); , std::size_t );
@ -312,9 +359,9 @@ class FVTerm : public FTerm
static bool updateVTermCharacter ( term_area* static bool updateVTermCharacter ( term_area*
, int, int, int, int ); , int, int, int, int );
static void callPreprocessingHandler (term_area*); static void callPreprocessingHandler (term_area*);
static void updateVTerm(); void updateVTerm();
static void updateVTerm (term_area*); void updateVTerm (term_area*);
static bool updateVTermCursor (term_area*); bool updateVTermCursor (term_area*);
static bool isInsideArea (int, int, term_area*); static bool isInsideArea (int, int, term_area*);
static void setAreaCursor ( const FPoint& static void setAreaCursor ( const FPoint&
@ -329,9 +376,9 @@ class FVTerm : public FTerm
static void getArea (int, int, int, int, term_area*); static void getArea (int, int, int, int, term_area*);
static void putArea (const FPoint&, term_area*); static void putArea (const FPoint&, term_area*);
static void putArea (int, int, term_area*); static void putArea (int, int, term_area*);
static void scrollAreaForward (term_area*); void scrollAreaForward (term_area*);
static void scrollAreaReverse (term_area*); void scrollAreaReverse (term_area*);
static void clearArea (term_area*, int = ' '); void clearArea (term_area*, int = ' ');
static charData generateCharacter (const FPoint&); static charData generateCharacter (const FPoint&);
static charData generateCharacter (int, int); static charData generateCharacter (int, int);
@ -348,10 +395,17 @@ class FVTerm : public FTerm
static charData getCoveredCharacter (int, int, FVTerm*); static charData getCoveredCharacter (int, int, FVTerm*);
static charData getOverlappedCharacter (const FPoint&, FVTerm*); static charData getOverlappedCharacter (const FPoint&, FVTerm*);
static charData getOverlappedCharacter (int, int, FVTerm*); static charData getOverlappedCharacter (int, int, FVTerm*);
static void processTerminalUpdate(); void processTerminalUpdate();
static void startTerminalUpdate(); static void startTerminalUpdate();
static void finishTerminalUpdate(); static void finishTerminalUpdate();
static void flush_out(); 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 // Data Members
static term_area* vterm; // virtual terminal static term_area* vterm; // virtual terminal
@ -386,7 +440,7 @@ class FVTerm : public FTerm
void setPrintArea (term_area*); void setPrintArea (term_area*);
// Methods // Methods
void init(); void init (bool);
static void init_characterLengths (FOptiMove*); static void init_characterLengths (FOptiMove*);
void finish(); void finish();
static void putAreaLine (charData*, charData*, int); static void putAreaLine (charData*, charData*, int);
@ -394,29 +448,29 @@ class FVTerm : public FTerm
, charData*, charData* ); , charData*, charData* );
static void getAreaCharacter ( int, int, term_area* static void getAreaCharacter ( int, int, term_area*
, charData*& ); , charData*& );
static bool clearTerm (int = ' '); bool clearTerm (int = ' ');
static bool clearFullArea (term_area*, charData&); bool clearFullArea (term_area*, charData&);
static void clearAreaWithShadow (term_area*, charData&); static void clearAreaWithShadow (term_area*, charData&);
static bool canClearToEOL (uInt, uInt); static bool canClearToEOL (uInt, uInt);
static bool canClearLeadingWS (uInt&, uInt); static bool canClearLeadingWS (uInt&, uInt);
static bool canClearTrailingWS (uInt&, uInt); static bool canClearTrailingWS (uInt&, uInt);
static bool skipUnchangedCharacters (uInt&, uInt, uInt); bool skipUnchangedCharacters (uInt&, uInt, uInt);
static void printRange (uInt, uInt, uInt, bool); void printRange (uInt, uInt, uInt, bool);
static exit_state eraseCharacters (uInt&, uInt, uInt, bool); exit_state eraseCharacters (uInt&, uInt, uInt, bool);
static exit_state repeatCharacter (uInt&, uInt, uInt); exit_state repeatCharacter (uInt&, uInt, uInt);
static void cursorWrap(); static void cursorWrap();
bool printWrap (term_area*); bool printWrap (term_area*);
static void updateTerminalLine (uInt); void updateTerminalLine (uInt);
static bool updateTerminalCursor(); bool updateTerminalCursor();
static bool isInsideTerminal (int, int); bool isInsideTerminal (int, int);
static void markAsPrinted (uInt, uInt); static void markAsPrinted (uInt, uInt);
static void markAsPrinted (uInt, uInt, uInt); static void markAsPrinted (uInt, uInt, uInt);
static void newFontChanges (charData*&); static void newFontChanges (charData*&);
static void charsetChanges (charData*&); static void charsetChanges (charData*&);
static void appendCharacter (charData*&); void appendCharacter (charData*&);
static void appendChar (charData*&); void appendChar (charData*&);
static void appendAttributes (charData*&); void appendAttributes (charData*&);
static int appendLowerRight (charData*&); int appendLowerRight (charData*&);
static void appendOutputBuffer (const std::string&); static void appendOutputBuffer (const std::string&);
static void appendOutputBuffer (const char[]); static void appendOutputBuffer (const char[]);
@ -426,6 +480,7 @@ class FVTerm : public FTerm
static int appendOutputBuffer (int); static int appendOutputBuffer (int);
// Data Members // Data Members
static FTerm* fterm;
static std::queue<int>* output_buffer; static std::queue<int>* output_buffer;
static charData term_attribute; static charData term_attribute;
static charData next_attribute; static charData next_attribute;
@ -547,6 +602,30 @@ inline FVTerm::term_area* FVTerm::getVWin() const
inline FVTerm::charData FVTerm::getAttribute() inline FVTerm::charData FVTerm::getAttribute()
{ return next_attribute; } { 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() inline void FVTerm::hideCursor()
{ return hideCursor(true); } { return hideCursor(true); }
@ -834,10 +913,158 @@ inline bool FVTerm::isTransShadow()
inline bool FVTerm::isInheritBackground() inline bool FVTerm::isInheritBackground()
{ return next_attribute.attr.bit.inherit_bg; } { 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() inline FVTerm& FVTerm::print()
{ return *this; } { 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 inline bool FVTerm::hasPrintArea() const
{ return print_area; } { return print_area; }
@ -850,6 +1077,26 @@ inline bool FVTerm::hasChildPrintArea() const
inline bool FVTerm::isVirtualWindow() const inline bool FVTerm::isVirtualWindow() const
{ return vwin; } { 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) inline void FVTerm::setPrintArea (term_area* area)
{ print_area = area; } { print_area = area; }

View File

@ -149,7 +149,7 @@ class FWindow : public FWidget
static bool lowerWindow (FWidget*); static bool lowerWindow (FWidget*);
bool lowerWindow (); bool lowerWindow ();
bool zoomWindow (); bool zoomWindow ();
static void switchToPrevWindow(); static void switchToPrevWindow (FWidget*);
static bool activatePrevWindow(); static bool activatePrevWindow();
virtual void setShadowSize (int, int); virtual void setShadowSize (int, int);