Separate the virtual terminal into a own class vterm

This commit is contained in:
Markus Gans 2016-10-11 04:57:36 +02:00
parent e14cd1af83
commit b668f7011c
69 changed files with 3153 additions and 2770 deletions

View File

@ -1,3 +1,6 @@
2016-10-11 Markus Gans <guru.mail@muenster.de>
* Separate the virtual terminal into a own class vterm
2016-10-09 Markus Gans <guru.mail@muenster.de>
* Remove some duplicate code

View File

@ -38,6 +38,7 @@ libfinal_la_SOURCES = \
ftextview.cpp \
fstatusbar.cpp \
fterm.cpp \
fvterm.cpp \
fevent.cpp \
foptiattr.cpp \
foptimove.cpp \
@ -87,6 +88,7 @@ finalcutinclude_HEADERS = \
fstring.h \
ftcap_map.h \
fterm.h \
fvterm.cpp \
ftextview.h \
ftogglebutton.h \
fwidget.h \

View File

@ -38,6 +38,7 @@ INCLUDE_HEADERS = \
fstatusbar.h \
fstring.h \
fterm.h \
fvterm.h \
ftextview.h \
ftogglebutton.h \
fwidget.h \
@ -83,6 +84,7 @@ OBJS = \
ftextview.o \
fstatusbar.o \
fterm.o \
fvterm.o \
fevent.o \
foptiattr.o \
foptimove.o \

View File

@ -38,6 +38,7 @@ INCLUDE_HEADERS = \
fstatusbar.h \
fstring.h \
fterm.h \
fvterm.h \
ftextview.h \
ftogglebutton.h \
fwidget.h \
@ -83,6 +84,7 @@ OBJS = \
ftextview.o \
fstatusbar.o \
fterm.o \
fvterm.o \
fevent.o \
foptiattr.o \
foptimove.o \

View File

@ -134,8 +134,9 @@ am_libfinal_la_OBJECTS = fstring.lo fpoint.lo frect.lo fscrollbar.lo \
flabel.lo flistbox.lo fmenu.lo fdialoglistmenu.lo fmenubar.lo \
fmenuitem.lo fradiomenuitem.lo fcheckmenuitem.lo fmenulist.lo \
fdialog.lo fwindow.lo fmessagebox.lo ftooltip.lo \
ffiledialog.lo ftextview.lo fstatusbar.lo fterm.lo fevent.lo \
foptiattr.lo foptimove.lo fapp.lo fwidget.lo fobject.lo
ffiledialog.lo ftextview.lo fstatusbar.lo fterm.lo fvterm.lo \
fevent.lo foptiattr.lo foptimove.lo fapp.lo fwidget.lo \
fobject.lo
libfinal_la_OBJECTS = $(am_libfinal_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@ -402,6 +403,7 @@ libfinal_la_SOURCES = \
ftextview.cpp \
fstatusbar.cpp \
fterm.cpp \
fvterm.cpp \
fevent.cpp \
foptiattr.cpp \
foptimove.cpp \
@ -449,6 +451,7 @@ finalcutinclude_HEADERS = \
fstring.h \
ftcap_map.h \
fterm.h \
fvterm.cpp \
ftextview.h \
ftogglebutton.h \
fwidget.h \
@ -566,6 +569,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftextview.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftogglebutton.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftooltip.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fvterm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fwidget.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fwindow.Plo@am__quote@

View File

@ -36,7 +36,6 @@ FApplication::FApplication (int& _argc, char**& _argv)
: FWidget(0)
, app_argc(_argc)
, app_argv(_argv)
, skipped_terminal_update(0)
, key(0)
#ifdef F_HAVE_LIBGPM
, gpm_ev()
@ -89,9 +88,11 @@ void FApplication::init()
time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0;
x11_button_state = 0x23;
#ifdef F_HAVE_LIBGPM
gpm_ev.x = -1;
#endif
zero_point = new FPoint(0,0);
event_queue = new std::deque<eventPair>;
// init arrays with '\0'
@ -276,6 +277,7 @@ void FApplication::processKeyboardEvent()
flush_out();
#ifdef F_HAVE_LIBGPM
if ( gpm_mouse_enabled )
{
gpmMouseEvent = false;
@ -296,8 +298,11 @@ void FApplication::processKeyboardEvent()
}
else
isKeyPressed = KeyPressed();
#else // without gpm
isKeyPressed = KeyPressed();
#endif // F_HAVE_LIBGPM
if ( isKeyPressed )
@ -1605,7 +1610,7 @@ void FApplication::processMouseEvent()
sendEvent (clicked_widget, &m_down_ev);
// gnome-terminal sends no released on middle click
if ( gnome_terminal )
if ( isGnomeTerminal() )
clicked_widget = 0;
}
else if ( b_state.middle_button == Released )
@ -1714,32 +1719,6 @@ int FApplication::processTimerEvent()
return activated;
}
//----------------------------------------------------------------------
void FApplication::processTerminalUpdate()
{
const int max_skip = 8;
if ( terminal_update_pending )
{
if ( ! unprocessedInput() )
{
updateTerminal();
terminal_update_pending = false;
skipped_terminal_update = 0;
}
else if ( skipped_terminal_update > max_skip )
{
force_terminal_update = true;
updateTerminal();
force_terminal_update = false;
terminal_update_pending = false;
skipped_terminal_update = 0;
}
else
skipped_terminal_update++;
}
}
//----------------------------------------------------------------------
void FApplication::processCloseWidget()
{

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏
@ -31,8 +36,6 @@
#ifndef _FAPPLICATION_H
#define _FAPPLICATION_H
#include <linux/keyboard.h> // need for gpm keyboard modifiers
#include <sys/time.h> // need for gettimeofday
#include <getopt.h>
#include <deque>
@ -62,7 +65,6 @@ class FApplication : public FWidget
static int loop_level;
static bool process_timer_event;
static FPoint* zero_point;
int skipped_terminal_update;
int key;
char k_buf[1024];
char x11_mouse[4];
@ -70,6 +72,7 @@ class FApplication : public FWidget
char urxvt_mouse[13];
#ifdef F_HAVE_LIBGPM
Gpm_Event gpm_ev;
bool gpmMouseEvent;
enum gpmEventType
@ -78,6 +81,7 @@ class FApplication : public FWidget
keyboard_event = 1,
mouse_event = 2
};
#endif
enum btn_state
@ -138,14 +142,15 @@ class FApplication : public FWidget
bool parseUrxvtMouse();
#ifdef F_HAVE_LIBGPM
int gpmEvent (bool = true);
bool processGpmEvent();
#endif
void processMouseEvent();
void processResizeEvent();
int processTimerEvent();
void processTerminalUpdate();
void processCloseWidget();
bool processNextEvent();

View File

@ -182,7 +182,7 @@ void FButton::draw()
for (int y=1; y <= getHeight(); y++)
{
printPos (1, y);
setPrintPos (1, y);
print (' '); // clear one left █
}
@ -241,7 +241,7 @@ void FButton::draw()
for (int y=0; y < getHeight(); y++)
{
printPos (1+d, 1+y);
setPrintPos (1+d, 1+y);
print (space); // full block █
}
}
@ -256,7 +256,7 @@ void FButton::draw()
for (int y=0; y < getHeight(); y++)
{
printPos (1+d, 1+y);
setPrintPos (1+d, 1+y);
// Cygwin terminal use IBM Codepage 850
if ( isCygwinTerminal() )
@ -282,7 +282,7 @@ void FButton::draw()
if ( isMonochron() )
setReverse(true);
printPos (1+getWidth(), y);
setPrintPos (1+getWidth(), y);
print (' '); // clear right
if ( isMonochron() )
@ -301,7 +301,7 @@ void FButton::draw()
else
j=0;
printPos (1+margin+d, 1+j);
setPrintPos (1+margin+d, 1+j);
setColor (button_fg, button_bg);
for (x=0; x < i; x++)
@ -353,14 +353,14 @@ void FButton::draw()
{
for (i=0; i < j; i++)
{
printPos (2+d, 1+i);
setPrintPos (2+d, 1+i);
for (int z=1; z < getWidth(); z++)
print (space); // █
}
for (i=j+1; i < getHeight(); i++)
{
printPos (2+d, 1+i);
setPrintPos (2+d, 1+i);
for (int z=1; z < getWidth(); z++)
print (space); // █
@ -525,7 +525,7 @@ void FButton::hide()
for (int y=0; y < getHeight()+s+(f << 1); y++)
{
printPos (1-f, 1+y-f);
setPrintPos (1-f, 1+y-f);
print (blank);
}

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -252,9 +252,9 @@ void FButtonGroup::drawLabel()
length--;
if ( border )
printPos (2, 1);
setPrintPos (2, 1);
else
printPos (0, 1);
setPrintPos (0, 1);
if ( isEnabled() )
setColor(wc.label_emphasis_fg, wc.label_bg);
@ -330,7 +330,7 @@ void FButtonGroup::hide()
for (int y=0; y < getHeight(); y++)
{
printPos (1, 1+y);
setPrintPos (1, 1+y);
print (blank);
}

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -53,7 +53,7 @@ void FCheckBox::drawCheckButton()
if ( ! isVisible() )
return;
printPos (1,1);
setPrintPos (1,1);
setColor();
if ( isMonochron() )

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -163,22 +163,22 @@ void FDialog::drawBorder()
{
for (int y=y1; y < y2; y++)
{
printPos (x1, y);
setPrintPos (x1, y);
// border left ⎸
print (fc::NF_border_line_left);
printPos (x2, y);
setPrintPos (x2, y);
// border right⎹
print (fc::NF_rev_border_line_right);
}
printPos (x1, y2);
setPrintPos (x1, y2);
// lower left corner border ⎣
print (fc::NF_border_corner_lower_left);
for (int x=1; x < getWidth()-1; x++) // low line _
print (fc::NF_border_line_bottom);
printPos (x2, y2);
setPrintPos (x2, y2);
// lower right corner border ⎦
print (fc::NF_rev_border_corner_lower_right);
}
@ -195,7 +195,7 @@ void FDialog::drawTitleBar()
const int menu_btn = 3;
// draw the title button
printPos (1, 1);
setPrintPos (1, 1);
if ( dialog_menu && dialog_menu->isVisible() )
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
@ -204,7 +204,7 @@ void FDialog::drawTitleBar()
if ( isMonochron() )
{
if ( isActiveWindow() )
if ( isWindowActive() )
setReverse(false);
else
setReverse(true);
@ -244,7 +244,7 @@ void FDialog::drawTitleBar()
if ( getMaxColor() < 16 )
setBold();
if ( isActiveWindow() || (dialog_menu && dialog_menu->isVisible()) )
if ( isWindowActive() || (dialog_menu && dialog_menu->isVisible()) )
setColor (wc.titlebar_active_fg, wc.titlebar_active_bg);
else
setColor (wc.titlebar_inactive_fg, wc.titlebar_inactive_bg);
@ -352,7 +352,7 @@ void FDialog::drawTitleBar()
setReverse(false);
/* print the number of window in stack */
//printPos (getWidth()-2, 1);
//setPrintPos (getWidth()-2, 1);
//printf ("(%d)", getWindowLayer(this));
}
@ -538,7 +538,7 @@ void FDialog::drawDialogShadow()
return;
drawShadow();
printPos (1, 1+getHeight());
setPrintPos (1, 1+getHeight());
setTransparent();
print(' ');
unsetTransparent();
@ -757,7 +757,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
has_raised = raiseWindow();
if ( ! isActiveWindow() )
if ( ! isWindowActive() )
activateDialog();
if ( has_raised )
@ -815,7 +815,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
// click on titlebar: just activate
if ( mouse_x >= 4 && mouse_x <= getWidth() && mouse_y == 1 )
{
if ( ! isActiveWindow() )
if ( ! isWindowActive() )
activateDialog();
}
}
@ -827,7 +827,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
{
bool has_lowered = lowerWindow();
if ( ! isActiveWindow() )
if ( ! isWindowActive() )
activateDialog();
else if ( has_lowered )
updateTerminal();
@ -1077,7 +1077,7 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
//----------------------------------------------------------------------
void FDialog::onAccel (FAccelEvent*)
{
if ( ! (isHiddenWindow() || isActiveWindow()) )
if ( ! (isWindowHidden() || isWindowActive()) )
{
bool has_raised = raiseWindow();
activateDialog();

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -967,6 +967,87 @@ class fc
CurlyBrackets = 3, // { }
AngleBrackets = 4 // < >
};
enum termcaps
{
t_bell,
t_clear_screen,
t_cursor_home,
t_cursor_to_ll,
t_carriage_return,
t_tab,
t_back_tab,
t_insert_padding,
t_insert_character,
t_parm_ich,
t_initialize_color,
t_initialize_pair,
t_set_a_foreground,
t_set_a_background,
t_set_foreground,
t_set_background,
t_set_color_pair,
t_orig_pair,
t_orig_colors,
t_no_color_video,
t_cursor_address,
t_column_address,
t_row_address,
t_cursor_visible,
t_cursor_invisible,
t_cursor_normal,
t_cursor_up,
t_cursor_down,
t_cursor_left,
t_cursor_right,
t_parm_up_cursor,
t_parm_down_cursor,
t_parm_left_cursor,
t_parm_right_cursor,
t_save_cursor,
t_restore_cursor,
t_scroll_forward,
t_scroll_reverse,
t_enter_ca_mode,
t_exit_ca_mode,
t_enable_acs,
t_enter_bold_mode,
t_exit_bold_mode,
t_enter_dim_mode,
t_exit_dim_mode,
t_enter_italics_mode,
t_exit_italics_mode,
t_enter_underline_mode,
t_exit_underline_mode,
t_enter_blink_mode,
t_exit_blink_mode,
t_enter_reverse_mode,
t_exit_reverse_mode,
t_enter_standout_mode,
t_exit_standout_mode,
t_enter_secure_mode,
t_exit_secure_mode,
t_enter_protected_mode,
t_exit_protected_mode,
t_enter_crossed_out_mode,
t_exit_crossed_out_mode,
t_enter_dbl_underline_mode,
t_exit_dbl_underline_mode,
t_set_attributes,
t_exit_attribute_mode,
t_enter_alt_charset_mode,
t_exit_alt_charset_mode,
t_enter_pc_charset_mode,
t_exit_pc_charset_mode,
t_enter_insert_mode,
t_exit_insert_mode,
t_enter_am_mode,
t_exit_am_mode,
t_acs_chars,
t_keypad_xmit,
t_keypad_local,
t_key_mouse
};
};
#pragma pack(pop)

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -284,7 +284,7 @@ void FLabel::draw()
else
std::wcsncpy(dest, src, length);
printPos (1, 1+int(y));
setPrintPos (1, 1+int(y));
if ( hotkeypos != -1 )
{
@ -314,7 +314,7 @@ void FLabel::draw()
if ( hotkeypos != -1 )
length--;
printPos (1,1);
setPrintPos (1,1);
xoffset = getXOffset (int(length));
printLine (LabelText, length, hotkeypos, xoffset);
delete[] LabelText;
@ -363,7 +363,7 @@ void FLabel::hide()
blank = new char[size+1];
std::memset(blank, ' ', uLong(size));
blank[getWidth()] = '\0';
printPos (1,1);
setPrintPos (1,1);
print (blank);
delete[] blank;
}

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -53,7 +53,7 @@ FLineEdit::~FLineEdit() // destructor
{
setXTermCursorStyle(fc::blinking_underline);
setKDECursor(fc::UnderlineCursor);
setConsoleCursor(fc::underscore_cursor);
setConsoleCursor(fc::underscore_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:ffff/ffff/ffff");
@ -134,7 +134,7 @@ void FLineEdit::drawInputField()
isShadow = ((flags & fc::shadow) != 0 );
updateVTerm(false);
printPos (1, 1);
setPrintPos (1, 1);
if ( isMonochron() )
{
@ -310,7 +310,7 @@ void FLineEdit::hide()
for (int y=0; y < getHeight()+s; y++)
{
printPos (1, 1+y);
setPrintPos (1, 1+y);
print (blank);
}
@ -490,7 +490,7 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
{
setXTermCursorStyle(fc::blinking_underline);
setKDECursor(fc::UnderlineCursor);
setConsoleCursor(fc::underscore_cursor);
setConsoleCursor(fc::underscore_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:ffff/ffff/ffff");
@ -499,7 +499,7 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
{
setXTermCursorStyle(fc::steady_block);
setKDECursor(fc::BlockCursor);
setConsoleCursor(fc::full_block_cursor);
setConsoleCursor(fc::full_block_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:eeee/0000/0000");
@ -769,7 +769,7 @@ void FLineEdit::onHide (FHideEvent*)
{
setXTermCursorStyle(fc::blinking_underline);
setKDECursor(fc::UnderlineCursor);
setConsoleCursor(fc::underscore_cursor);
setConsoleCursor(fc::underscore_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:ffff/ffff/ffff");
}
@ -782,7 +782,7 @@ void FLineEdit::onFocusIn (FFocusEvent*)
{
setXTermCursorStyle(fc::blinking_underline);
setKDECursor(fc::UnderlineCursor);
setConsoleCursor(fc::underscore_cursor);
setConsoleCursor(fc::underscore_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:ffff/ffff/ffff");
}
@ -790,7 +790,7 @@ void FLineEdit::onFocusIn (FFocusEvent*)
{
setXTermCursorStyle(fc::steady_block);
setKDECursor(fc::BlockCursor);
setConsoleCursor(fc::full_block_cursor);
setConsoleCursor(fc::full_block_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:0000/0000/0000");
}
@ -816,7 +816,7 @@ void FLineEdit::onFocusOut (FFocusEvent*)
{
setXTermCursorStyle(fc::blinking_underline);
setKDECursor(fc::UnderlineCursor);
setConsoleCursor(fc::underscore_cursor);
setConsoleCursor(fc::underscore_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:ffff/ffff/ffff");

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -151,7 +151,7 @@ void FListBox::draw()
for (int y=2; y < getHeight(); y++)
{
printPos (getWidth(),y);
setPrintPos (getWidth(),y);
print (' '); // clear right side of the scrollbar
}
}
@ -196,7 +196,7 @@ void FListBox::drawLabel()
txt = " " + text + " ";
length = txt.getLength();
printPos (2, 1);
setPrintPos (2, 1);
if ( isEnabled() )
setColor(wc.label_emphasis_fg, wc.label_bg);
@ -246,7 +246,7 @@ void FListBox::drawList()
for (uInt y=start; y < end; y++)
{
printPos (2, 2 + int(y));
setPrintPos (2, 2 + int(y));
bool serach_mark = false;
bool lineHasBrackets = hasBrackets(int(y) + yoffset + 1);
bool isLineSelected = isSelected(int(y) + yoffset + 1);
@ -599,7 +599,7 @@ void FListBox::hide()
for (int y=0; y < getHeight(); y++)
{
printPos (1, 1 + y);
setPrintPos (1, 1 + y);
print (blank);
}
@ -1792,7 +1792,7 @@ void FListBox::clear()
for (int y=0; y < getHeight()-2; y++)
{
printPos (2, 2 + y);
setPrintPos (2, 2 + y);
print (blank);
}

View File

@ -12,6 +12,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -595,28 +595,27 @@ void FMenu::drawItems()
while ( iter != end )
{
wchar_t* src;
wchar_t* dest;
wchar_t* item_text;
FString txt;
uInt txt_length;
int hotkeypos, to_char;
int accel_key = (*iter)->accel_key;
bool has_menu = (*iter)->hasMenu();
bool is_enabled = (*iter)->isEnabled();
bool is_checked = (*iter)->isChecked();
bool is_checkable = (*iter)->checkable;
bool is_radio_btn = (*iter)->radio_button;
bool is_selected = (*iter)->isSelected();
bool is_noUnderline = (((*iter)->getFlags() & fc::no_underline) != 0);
bool is_separator = (*iter)->isSeparator();
if ( is_separator )
if ( (*iter)->isSeparator() )
{
drawSeparator(y);
}
else
{
wchar_t* src;
wchar_t* dest;
wchar_t* item_text;
FString txt;
uInt txt_length;
int hotkeypos, to_char;
int accel_key = (*iter)->accel_key;
bool has_menu = (*iter)->hasMenu();
bool is_enabled = (*iter)->isEnabled();
bool is_checked = (*iter)->isChecked();
bool is_checkable = (*iter)->checkable;
bool is_radio_btn = (*iter)->radio_button;
bool is_selected = (*iter)->isSelected();
bool is_noUnderline = (((*iter)->getFlags() & fc::no_underline) != 0);
if ( is_enabled )
{
if ( is_selected )
@ -645,7 +644,7 @@ void FMenu::drawItems()
setReverse(true);
}
printPos (2, 2 + y);
setPrintPos (2, 2 + y);
setColor();
if ( has_checkable_items )
@ -799,7 +798,7 @@ void FMenu::drawItems()
//----------------------------------------------------------------------
inline void FMenu::drawSeparator(int y)
{
printPos (1, 2 + y);
setPrintPos (1, 2 + y);
setColor (wc.menu_active_fg, wc.menu_active_bg);
if ( isMonochron() )
@ -1001,7 +1000,7 @@ void FMenu::onMouseDown (FMouseEvent* ev)
if ( mouse_down )
return;
if ( ! isActiveWindow() )
if ( ! isWindowActive() )
setActiveWindow(this);
mouse_down = true;
@ -1190,7 +1189,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
if ( ev->getButton() != fc::LeftButton )
return;
if ( ! isActiveWindow() )
if ( ! isWindowActive() )
setActiveWindow(this);
if ( mouse_down && ! item_list.empty() )

View File

@ -8,8 +8,13 @@
// ▕ FObject ▏ ▕ FTerm ▏
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
// ▲ ▲
// │ │ *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
// └─────┬─────┘ ┌ - -▕ FRadioMenuItem ▏
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏ *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
// ▲ ┌ - -▕ FRadioMenuItem ▏
// │ : ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
// ▕▔▔▔▔▔▔▔▔▔▏ :
// ▕ FWidget ▏ : *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏

View File

@ -314,7 +314,7 @@ void FMenuBar::drawItems()
return;
updateVTerm(false);
printPos (1,1);
setPrintPos (1,1);
if ( isMonochron() )
setReverse(true);
@ -424,12 +424,12 @@ void FMenuBar::drawItems()
{
if ( startpos < screenWidth )
{
printPos (screenWidth - 1, 1);
setPrintPos (screenWidth - 1, 1);
print ("..");
}
else if ( startpos-1 <= screenWidth )
{
printPos (screenWidth, 1);
setPrintPos (screenWidth, 1);
print (' ');
}
}
@ -596,7 +596,7 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
mouse_down = true;
if ( ! isActiveWindow() )
if ( ! isWindowActive() )
setActiveWindow(this);
if ( ! item_list.empty() )
@ -769,7 +769,7 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
if ( ev->getButton() != fc::LeftButton )
return;
if ( ! isActiveWindow() )
if ( ! isWindowActive() )
setActiveWindow(this);
if ( mouse_down && ! item_list.empty() )
@ -911,7 +911,7 @@ void FMenuBar::hide()
blank = new char[screenWidth+1];
std::memset(blank, ' ', uLong(screenWidth));
blank[screenWidth] = '\0';
printPos (1,1);
setPrintPos (1,1);
print (blank);
delete[] blank;
}

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -853,32 +853,32 @@ void FMenuItem::openMenu()
FMenu* dd_menu; // Drop-down menu
FMenu* open_menu;
if ( hasMenu() )
if ( ! hasMenu() )
return;
dd_menu = getMenu(); // Drop-down menu
if ( dd_menu->isVisible() )
return;
open_menu = static_cast<FMenu*>(getOpenMenu());
if ( open_menu && open_menu != dd_menu )
{
dd_menu = getMenu();
if ( dd_menu->isVisible() )
return;
open_menu = static_cast<FMenu*>(getOpenMenu());
if ( open_menu && open_menu != dd_menu )
{
open_menu->hide();
open_menu->hideSubMenus();
}
if ( dialog_index )
createDialogList (dd_menu);
setOpenMenu(dd_menu);
dd_menu->setVisible();
dd_menu->show();
dd_menu->raiseWindow(dd_menu);
dd_menu->redraw();
updateTerminal();
flush_out();
open_menu->hide();
open_menu->hideSubMenus();
}
if ( dialog_index )
createDialogList (dd_menu);
setOpenMenu(dd_menu);
dd_menu->setVisible();
dd_menu->show();
dd_menu->raiseWindow(dd_menu);
dd_menu->redraw();
updateTerminal();
flush_out();
}
//----------------------------------------------------------------------

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -245,7 +245,7 @@ void FMessageBox::draw()
if ( center_text ) // center one line
center_x = int((max_line_width - headline_length) / 2);
printPos (1 + msg_x + center_x, 4);
setPrintPos (1 + msg_x + center_x, 4);
print (headline_text);
head_offset = 2;
}
@ -259,7 +259,7 @@ void FMessageBox::draw()
if ( center_text ) // center one line
center_x = int((max_line_width - line_length) / 2);
printPos (1 + msg_x + center_x, 4 + head_offset + i);
setPrintPos (1 + msg_x + center_x, 4 + head_offset + i);
print(text_components[i]);
}

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -562,7 +562,7 @@ inline bool FOptiMove::isWideMove ( int xold, int yold
}
//----------------------------------------------------------------------
char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
{
char null_result[sizeof(move_buf)];
char* null_ptr = null_result;

View File

@ -112,8 +112,8 @@ class FOptiMove
void set_auto_left_margin (bool&);
void set_eat_newline_glitch (bool&);
char* cursor_move (int, int, int, int);
void printDurations();
char* moveCursor (int, int, int, int);
void printDurations();
};
#pragma pack(pop)

View File

@ -37,7 +37,7 @@ void FProgressbar::drawPercentage()
if ( isMonochron() )
setReverse(true);
printPos (getWidth() - 3, 0);
setPrintPos (getWidth() - 3, 0);
if ( percentage < 0 || percentage > 100 )
print ("--- %");
@ -53,7 +53,7 @@ void FProgressbar::drawBar()
{
int i = 1;
float length = float(bar_length * percentage) / 100;
printPos (1,1);
setPrintPos (1,1);
if ( isMonochron() )
{
@ -206,12 +206,12 @@ void FProgressbar::hide()
for (int y=0; y < getHeight()+s; y++)
{
printPos (1, 1 + y);
setPrintPos (1, 1 + y);
print (blank);
}
delete[] blank;
printPos (getWidth() - 4, 0);
setPrintPos (getWidth() - 4, 0);
print (" "); // hide percentage
}

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -54,7 +54,7 @@ void FRadioButton::drawRadioButton()
if ( ! isVisible() )
return;
printPos (1,1);
setPrintPos (1,1);
setColor();
if ( isMonochron() )

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -571,7 +571,7 @@ void FScrollbar::drawBar()
for (z=1; z <= slider_pos; z++)
{
printPos (1, 1 + z);
setPrintPos (1, 1 + z);
if ( isNewFont() )
print (fc::NF_border_line_left); // ⎸
@ -589,7 +589,7 @@ void FScrollbar::drawBar()
for (z=1; z <= slider_length; z++)
{
printPos (1, 1 + slider_pos + z);
setPrintPos (1, 1 + slider_pos + z);
if ( isNewFont() )
print (' ');
@ -604,7 +604,7 @@ void FScrollbar::drawBar()
for (z=slider_pos+slider_length+1; z <= bar_length; z++)
{
printPos (1, 1 + z);
setPrintPos (1, 1 + z);
if ( isNewFont() )
print (fc::NF_border_line_left); // ⎸
@ -621,9 +621,9 @@ void FScrollbar::drawBar()
z = 0;
if ( isNewFont() )
printPos (3 + z, 1);
setPrintPos (3 + z, 1);
else
printPos (2 + z, 1);
setPrintPos (2 + z, 1);
for (; z < slider_pos; z++)
{
@ -678,13 +678,13 @@ void FScrollbar::drawButtons()
if ( isNewFont() )
{
printPos (1,1);
setPrintPos (1,1);
if ( bar_orientation == fc::vertical )
{
print (fc::NF_rev_up_arrow1);
print (fc::NF_rev_up_arrow2);
printPos (1, length);
setPrintPos (1, length);
print (fc::NF_rev_down_arrow1);
print (fc::NF_rev_down_arrow2);
}
@ -692,14 +692,14 @@ void FScrollbar::drawButtons()
{
print (fc::NF_rev_left_arrow1);
print (fc::NF_rev_left_arrow2);
printPos (length-1, 1);
setPrintPos (length-1, 1);
print (fc::NF_rev_right_arrow1);
print (fc::NF_rev_right_arrow2);
}
}
else
{
printPos (1,1);
setPrintPos (1,1);
if ( isMonochron() )
setReverse(true);
@ -711,7 +711,7 @@ void FScrollbar::drawButtons()
else
print (fc::BlackUpPointingTriangle); // ▲
printPos (1, length);
setPrintPos (1, length);
if ( isCygwinTerminal() )
print ('v');
@ -721,7 +721,7 @@ void FScrollbar::drawButtons()
else // horizontal
{
print (fc::BlackLeftPointingPointer); // ◄
printPos (length, 1);
setPrintPos (length, 1);
print (fc::BlackRightPointingPointer); // ►
}

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -221,7 +221,7 @@ void FStatusBar::drawKeys()
}
updateVTerm(false);
printPos (1, 1);
setPrintPos (1, 1);
if ( isMonochron() )
setReverse(true);
@ -356,7 +356,7 @@ void FStatusBar::hide()
blank = new char[screenWidth+1];
std::memset(blank, ' ', uLong(screenWidth));
blank[screenWidth] = '\0';
printPos (1, 1);
setPrintPos (1, 1);
print (blank);
delete[] blank;
}
@ -583,7 +583,7 @@ void FStatusBar::drawMessage()
updateVTerm(false);
setColor (wc.statusbar_fg, wc.statusbar_bg);
printPos (x, 1);
setPrintPos (x, 1);
if ( isMonochron() )
setReverse(true);

View File

@ -12,6 +12,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -54,7 +54,7 @@ void FSwitch::drawCheckButton()
wchar_t on[6] = L" On ";
wchar_t off[6] = L" Off ";
printPos (1 + switch_offset_pos, 1);
setPrintPos (1 + switch_offset_pos, 1);
if ( checked )
{

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -3,20 +3,9 @@
#ifndef _FTCAPMAP_H
#define _FTCAPMAP_H
#pragma pack(push)
#pragma pack(1)
#include "ftermcap.h"
typedef struct
{
char* string;
char tname[3];
}
tcap_map;
#pragma pack(pop)
static tcap_map tcap[] =
static FTermcap::tcap_map term_caps[] =
{
// .------------- term string
// | .-------- Tcap-code
@ -115,85 +104,4 @@ static tcap_map tcap[] =
* "XX", "Us" and "Ue" are unofficial and they are only used here.
*/
enum termcaps
{
t_bell,
t_clear_screen,
t_cursor_home,
t_cursor_to_ll,
t_carriage_return,
t_tab,
t_back_tab,
t_insert_padding,
t_insert_character,
t_parm_ich,
t_initialize_color,
t_initialize_pair,
t_set_a_foreground,
t_set_a_background,
t_set_foreground,
t_set_background,
t_set_color_pair,
t_orig_pair,
t_orig_colors,
t_no_color_video,
t_cursor_address,
t_column_address,
t_row_address,
t_cursor_visible,
t_cursor_invisible,
t_cursor_normal,
t_cursor_up,
t_cursor_down,
t_cursor_left,
t_cursor_right,
t_parm_up_cursor,
t_parm_down_cursor,
t_parm_left_cursor,
t_parm_right_cursor,
t_save_cursor,
t_restore_cursor,
t_scroll_forward,
t_scroll_reverse,
t_enter_ca_mode,
t_exit_ca_mode,
t_enable_acs,
t_enter_bold_mode,
t_exit_bold_mode,
t_enter_dim_mode,
t_exit_dim_mode,
t_enter_italics_mode,
t_exit_italics_mode,
t_enter_underline_mode,
t_exit_underline_mode,
t_enter_blink_mode,
t_exit_blink_mode,
t_enter_reverse_mode,
t_exit_reverse_mode,
t_enter_standout_mode,
t_exit_standout_mode,
t_enter_secure_mode,
t_exit_secure_mode,
t_enter_protected_mode,
t_exit_protected_mode,
t_enter_crossed_out_mode,
t_exit_crossed_out_mode,
t_enter_dbl_underline_mode,
t_exit_dbl_underline_mode,
t_set_attributes,
t_exit_attribute_mode,
t_enter_alt_charset_mode,
t_exit_alt_charset_mode,
t_enter_pc_charset_mode,
t_exit_pc_charset_mode,
t_enter_insert_mode,
t_exit_insert_mode,
t_enter_am_mode,
t_exit_am_mode,
t_acs_chars,
t_keypad_xmit,
t_keypad_local,
t_key_mouse
};
#endif // _FTCAPMAP_H

File diff suppressed because it is too large Load Diff

View File

@ -21,13 +21,8 @@
// : ▕▁▁▁▁▁▁▁▁▏
// :
// : *▕▔▔▔▔▔▔▔▏
// :- - - -▕ FRect ▏
// : ▕▁▁▁▁▁▁▁▏
// :
// : *▕▔▔▔▔▔▔▔▔▔▏
// └- - - -▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏
//
// └- - - -▕ FRect ▏
// ▕▁▁▁▁▁▁▁▏
#ifndef _FTERM_H
#define _FTERM_H
@ -38,16 +33,17 @@
#include <gpm.h>
#endif
#include <linux/fb.h> // Linux framebuffer console
#include <linux/fb.h> // Linux framebuffer console
#include <linux/keyboard.h> // need for gpm keyboard modifiers
#include <sys/io.h>
#include <sys/io.h> // <asm/io.h> is deprecated, use <sys/io.h> instead
#include <sys/ioctl.h>
#include <sys/kd.h>
#include <sys/stat.h> // <asm/io.h> is deprecated, use <sys/io.h> instead
#include <sys/stat.h>
#include <fcntl.h>
#include <langinfo.h>
#include <term.h> // termcap
#include <term.h> // termcap
#include <termios.h>
#include <unistd.h>
@ -63,6 +59,7 @@
#include "fpoint.h"
#include "frect.h"
#include "fstring.h"
#include "ftermcap.h"
#ifdef F_HAVE_LIBGPM
@ -88,11 +85,6 @@
// parseKeyString return value
#define NEED_MORE_DATA -1
// Buffer size for character output on the terminal
#define TERMINAL_OUTPUT_BUFFER_SIZE 32768
// class forward declaration
class FWidget;
//----------------------------------------------------------------------
// class FTerm
@ -104,16 +96,13 @@ class FWidget;
class FTerm
{
private:
static std::queue<int>* output_buffer;
static std::map <uChar,uChar>* vt100_alt_char;
static std::map <std::string,fc::encoding>* encoding_set;
static FTermcap::tcap_map* tcap;
static bool hidden_cursor;
static bool mouse_support;
static bool raw_mode;
static bool input_data_pending;
static bool terminal_update_pending;
static bool force_terminal_update;
static bool non_blocking_stdin;
static bool gpm_mouse_enabled;
static bool pc_charset_console;
@ -140,9 +129,6 @@ class FTerm
static bool linux_terminal;
static bool screen_terminal;
static bool tmux_terminal;
static bool terminal_updates;
static bool stop_terminal_updates;
static bool vterm_updates;
static bool background_color_erase;
static bool automatic_left_margin;
static bool automatic_right_margin;
@ -155,9 +141,8 @@ class FTerm
static char* locale_xterm;
static uChar x11_button_state;
static FRect* term; // current terminal geometry
static FPoint* term_pos; // terminal cursor position
static FPoint* mouse; // mouse click position
static FPoint* cursor; // virtual print cursor
static int stdin_status_flags;
static int stdin_no;
static int stdout_no;
@ -168,8 +153,6 @@ class FTerm
static char exit_message[8192];
static struct termios term_init;
static FOptiAttr::char_data term_attribute;
static FOptiAttr::char_data next_attribute;
static fc::consoleCursorStyle console_cursor_style;
static struct console_font_op screen_font;
@ -203,19 +186,6 @@ class FTerm
uChar : 4; // padding bits
} mod_key;
enum covered_state
{
non_covered,
half_covered,
fully_covered
};
enum character_type
{
overlapped_character,
covered_character
};
protected:
static bool NewFont;
static bool VGAFont;
@ -224,34 +194,6 @@ class FTerm
static uInt attr_without_color;
static fc::encoding Encoding;
typedef struct
{
uInt xmin;
uInt xmax;
uInt trans_count;
} line_changes;
typedef struct
{
int width;
int height;
int right_shadow;
int bottom_shadow;
int input_cursor_x;
int input_cursor_y;
int input_cursor_visible;
FWidget* widget;
line_changes* changes;
FOptiAttr::char_data* text;
bool visible;
} term_area;
static term_area* vterm; // virtual terminal
static term_area* vdesktop; // virtual desktop
static term_area* last_area; // last used area
static term_area* active_area; // active area
term_area* vwin; // virtual window
private:
// Disable copy constructor
FTerm (const FTerm&);
@ -269,7 +211,7 @@ class FTerm
static int setScreenFont (uChar*, uInt, uInt, uInt, bool = false);
static int setUnicodeMap (struct unimapdesc*);
static int getUnicodeMap ();
static int setLightBackgroundColors (bool);
static int setBlinkAsIntensity (bool);
static void init_console();
static uInt getBaudRate (const struct termios*);
static void init_consoleCharMap();
@ -288,42 +230,14 @@ class FTerm
static uInt charEncode (uInt, fc::encoding);
static uInt cp437_to_unicode (uChar);
static void signal_handler (int);
// Friend classes
friend class FWidget;
friend class FVTerm;
friend class FApplication;
protected:
static bool charEncodable (uInt);
void createArea (const FRect&, const FPoint&, FTerm::term_area*&);
void createArea (int, int, int, int, FTerm::term_area*&);
static void resizeArea (const FRect&, const FPoint&, FTerm::term_area*);
static void resizeArea (int, int, int, int, FTerm::term_area*);
static void removeArea (FTerm::term_area*&);
static void restoreVTerm (const FRect&);
static void restoreVTerm (int, int, int, int);
static FTerm::covered_state isCovered (const FPoint&, FTerm::term_area*);
static FTerm::covered_state isCovered (int, int, FTerm::term_area*);
static void updateVTerm (bool);
static void updateVTerm (FTerm::term_area*);
static bool updateVTermCursor (FTerm::term_area*);
static bool isInsideArea (int, int, FTerm::term_area*);
static void setAreaCursor (const FPoint&, bool, FTerm::term_area*);
static void setAreaCursor (int, int, bool, FTerm::term_area*);
static void getArea (const FPoint&, FTerm::term_area*);
static void getArea (int, int, FTerm::term_area*);
static void getArea (const FRect&, FTerm::term_area*);
static void getArea (int, int, int, int, FTerm::term_area*);
static void putArea (const FPoint&, FTerm::term_area*);
static void putArea (int, int, FTerm::term_area*);
static void scrollAreaForward (FTerm::term_area*);
static void scrollAreaReverse (FTerm::term_area*);
static void clearArea (FTerm::term_area*);
static FOptiAttr::char_data getCharacter (int, const FPoint&, FTerm*);
static FOptiAttr::char_data getCharacter (int, int, int, FTerm*);
static FOptiAttr::char_data getCoveredCharacter (const FPoint&, FTerm*);
static FOptiAttr::char_data getCoveredCharacter (int, int, FTerm*);
static FOptiAttr::char_data getOverlappedCharacter (const FPoint&, FTerm*);
static FOptiAttr::char_data getOverlappedCharacter (int, int, FTerm*);
public:
// Constructor
@ -332,12 +246,11 @@ class FTerm
virtual ~FTerm();
virtual const char* getClassName() const;
FTerm::term_area* getVWin() const;
static bool isKeyTimeout (timeval*, register long);
static int parseKeyString (char*, int, timeval*);
bool& unprocessedInput() const;
int getLineNumber();
int getColumnNumber();
static bool& unprocessedInput();
static int getLineNumber();
static int getColumnNumber();
static FString getKeyName (int);
static void getModifierKey();
@ -367,18 +280,12 @@ class FTerm
static bool isNewFont();
static bool setOldFont();
static bool setCursorOptimisation (bool);
static void setConsoleCursor (fc::consoleCursorStyle);
static void setConsoleCursor (fc::consoleCursorStyle, bool);
static char* moveCursor (int, int, int, int);
static char* enableCursor();
static char* disableCursor();
static void getTermSize();
static void setTermSize (int, 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 (bool);
static void updateTerminal();
static bool updateTerminalCursor();
static bool isInsideTerminal (int, int);
static void setKDECursor (fc::kdeKonsoleCursorShape);
static FString getXTermFont();
static FString getXTermTitle();
@ -400,8 +307,6 @@ class FTerm
static void saveColorMap();
static void resetColorMap();
static void setPalette (short, int, int, int);
static short getTermForegroundColor();
static short getTermBackgroundColor();
static int getMaxColor();
static void xtermMouse (bool);
static void enableXTermMouse();
@ -413,16 +318,10 @@ class FTerm
static bool disableGpmMouse();
#endif // F_HAVE_LIBGPM
static void setTermXY (register int, register int);
static void setBeep (int, int);
static void resetBeep();
static void beep();
static bool hideCursor (bool);
static bool hideCursor();
static bool showCursor();
static bool isHiddenCursor();
static void setEncoding (std::string);
static std::string getEncoding();
@ -448,37 +347,6 @@ class FTerm
static FString getAnswerbackMsg();
static FString getSecDA();
static void printPosTerm (const FPoint&);
static void printPosTerm (register int, register int);
int printf (const wchar_t*, ...);
int printf (const char*, ...)
#if defined(__clang__)
__attribute__((__format__ (__printf__, 2, 3)))
#elif defined(__GNUC__)
__attribute__ ((format (printf, 2, 3)))
#endif
;
int print (const std::wstring&);
int print (FTerm::term_area*, const std::wstring&);
int print (const wchar_t*);
int print (FTerm::term_area*, const wchar_t*);
int print (const char*);
int print (FTerm::term_area*, const char*);
int print (const std::string&);
int print (FTerm::term_area*, const std::string&);
int print (FString&);
int print (FTerm::term_area*, FString&);
int print (int);
int print (FTerm::term_area*, int);
static void newFontChanges (FOptiAttr::char_data*&);
static void charsetChanges (FOptiAttr::char_data*&);
static void appendCharacter (FOptiAttr::char_data*&);
static void appendAttributes (FOptiAttr::char_data*&);
static int appendLowerRight (FOptiAttr::char_data*&);
static void appendOutputBuffer (std::string&);
static void appendOutputBuffer (const char*);
static int appendOutputBuffer (int);
static void flush_out();
static int (*Fputchar)(int); // function pointer -> static function
static void putstringf (const char*, ...)
#if defined(__clang__)
@ -500,32 +368,6 @@ class FTerm
inline const char* FTerm::getClassName() const
{ return "FTerm"; }
//----------------------------------------------------------------------
inline FTerm::term_area* FTerm::getVWin() const
{ return vwin; }
//----------------------------------------------------------------------
inline bool& FTerm::unprocessedInput() const
{ return input_data_pending; }
//----------------------------------------------------------------------
inline int FTerm::getLineNumber()
{
if ( term->getHeight() == 0 )
getTermSize();
return term->getHeight();
}
//----------------------------------------------------------------------
inline int FTerm::getColumnNumber()
{
if ( term->getWidth() == 0 )
getTermSize();
return term->getWidth();
}
//----------------------------------------------------------------------
inline char* FTerm::getTermType()
{ return termtype; }
@ -554,10 +396,6 @@ inline bool FTerm::hasASCII()
inline bool FTerm::isNewFont()
{ return NewFont; }
//----------------------------------------------------------------------
inline bool FTerm::isHiddenCursor()
{ return hidden_cursor; }
//----------------------------------------------------------------------
inline bool FTerm::isMonochron()
{ return monochron; }
@ -620,23 +458,12 @@ inline bool FTerm::isTmuxTerm()
//----------------------------------------------------------------------
inline bool FTerm::setCursorOptimisation (bool on)
{
cursor_optimisation = on;
return cursor_optimisation;
}
{ return cursor_optimisation = (on) ? true : false; }
//----------------------------------------------------------------------
inline bool FTerm::isRaw()
{ return raw_mode; }
//----------------------------------------------------------------------
inline short FTerm::getTermForegroundColor()
{ return next_attribute.fg_color; }
//----------------------------------------------------------------------
inline short FTerm::getTermBackgroundColor()
{ return next_attribute.bg_color; }
//----------------------------------------------------------------------
inline int FTerm::getMaxColor()
{ return max_color; }
@ -649,7 +476,6 @@ inline void FTerm::enableXTermMouse()
inline void FTerm::disableXTermMouse()
{ xtermMouse(false); }
#ifdef F_HAVE_LIBGPM
//----------------------------------------------------------------------
inline bool FTerm::enableGpmMouse()
@ -658,17 +484,8 @@ inline bool FTerm::enableGpmMouse()
//----------------------------------------------------------------------
inline bool FTerm::disableGpmMouse()
{ return gpmMouse(false); }
#endif // F_HAVE_LIBGPM
//----------------------------------------------------------------------
inline bool FTerm::hideCursor()
{ return hideCursor(true); }
//----------------------------------------------------------------------
inline bool FTerm::showCursor()
{ return hideCursor(false); }
//----------------------------------------------------------------------
inline bool FTerm::setNonBlockingInput()
{ return setNonBlockingInput(true); }
@ -705,13 +522,5 @@ inline bool FTerm::unsetRawMode()
inline bool FTerm::setCookedMode()
{ return setRawMode(false); }
//----------------------------------------------------------------------
inline void FTerm::printPosTerm (const FPoint& pos)
{ printPosTerm (pos.getX(), pos.getY()); }
//----------------------------------------------------------------------
inline void FTerm::printPosTerm (register int x, register int y)
{ cursor->setPoint(x,y); }
#endif // _FTERM_H

54
src/ftermcap.h Normal file
View File

@ -0,0 +1,54 @@
// File: ftermcap.h
// Provides: class FTermcap
//
// Standalone class
// ════════════════
//
// ▕▔▔▔▔▔▔▔▔▔▔▏
// ▕ FTermcap ▏
// ▕▁▁▁▁▁▁▁▁▁▁▏
#ifndef _FTERMCAP_H
#define _FTERMCAP_H
//----------------------------------------------------------------------
// class FTermcap
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
class FTermcap
{
public:
typedef struct
{
char* string;
char tname[3];
}
tcap_map;
private:
static tcap_map* tcap;
public:
FTermcap()
{ }
~FTermcap()
{ }
tcap_map* getTermcapMap()
{
return tcap;
}
void setTermcapMap (tcap_map* t)
{
tcap = t;
}
};
#pragma pack(pop)
#endif // _FTERMCAP_H

View File

@ -146,7 +146,7 @@ void FTextView::drawText()
uInt i, len;
FString line;
const wchar_t* line_str;
printPos (2, 2 - nf_offset + int(y));
setPrintPos (2, 2 - nf_offset + int(y));
line = data[y+uInt(yoffset)].mid ( uInt(1 + xoffset)
, uInt(getWidth() - nf_offset - 2) );
line_str = line.wc_str();
@ -267,7 +267,7 @@ void FTextView::hide()
for (int y=0; y < getHeight(); y++)
{
printPos (1, 1 + y);
setPrintPos (1, 1 + y);
print (blank);
}
@ -921,7 +921,7 @@ void FTextView::clear()
for (int y=0; y < getHeight() + nf_offset - 2; y++)
{
printPos (2, 2 - nf_offset + y);
setPrintPos (2, 2 - nf_offset + y);
print (blank);
}

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -219,7 +219,7 @@ void FToggleButton::drawLabel()
if ( hotkeypos != -1 )
length--;
printPos (1 + label_offset_pos, 1);
setPrintPos (1 + label_offset_pos, 1);
if ( isMonochron() )
setReverse(true);
@ -376,7 +376,7 @@ void FToggleButton::hide()
blank = new char[size+1];
std::memset(blank, ' ', uLong(size));
blank[size] = '\0';
printPos (1, 1);
setPrintPos (1, 1);
print (blank);
delete[] blank;
}

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

View File

@ -123,7 +123,7 @@ void FToolTip::draw()
for (int i=0; i < int(text_num_lines); i++)
{
printPos (3, 2 + i);
setPrintPos (3, 2 + i);
print(text_components[i]);
}

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏

2103
src/fvterm.cpp Normal file

File diff suppressed because it is too large Load Diff

252
src/fvterm.h Normal file
View File

@ -0,0 +1,252 @@
// File: fvterm.h
// Provides: class FVTerm
//
// Inheritance diagram
// ═══════════════════
//
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FObject ▏ ▕ FTerm ▏
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
// ▲ ▲
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
#ifndef _FVTERM_H
#define _FVTERM_H
#include "fterm.h"
// Buffer size for character output on the terminal
#define TERMINAL_OUTPUT_BUFFER_SIZE 32768
// class forward declaration
class FWidget;
//----------------------------------------------------------------------
// class FVTerm
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
class FVTerm : public FObject, public FTerm
{
private:
static std::queue<int>* output_buffer;
static FOptiAttr::char_data term_attribute;
static FOptiAttr::char_data next_attribute;
static FPoint* term_pos; // terminal cursor position
static FPoint* cursor; // virtual print cursor
static FTermcap::tcap_map* tcap;
static bool hidden_cursor;
static bool terminal_update_pending;
static bool force_terminal_update;
static bool terminal_updates;
static bool stop_terminal_updates;
static bool vterm_updates;
static int skipped_terminal_update;
enum covered_state
{
non_covered,
half_covered,
fully_covered
};
enum character_type
{
overlapped_character,
covered_character
};
protected:
typedef struct
{
uInt xmin;
uInt xmax;
uInt trans_count;
} line_changes;
typedef struct
{
int width;
int height;
int right_shadow;
int bottom_shadow;
int input_cursor_x;
int input_cursor_y;
int input_cursor_visible;
FWidget* widget;
line_changes* changes;
FOptiAttr::char_data* text;
bool visible;
} term_area;
static term_area* vterm; // virtual terminal
static term_area* vdesktop; // virtual desktop
static term_area* last_area; // last used area
static term_area* active_area; // active area
term_area* print_area; // print area for this object
term_area* vwin; // virtual window
protected:
void createArea (const FRect&, const FPoint&, FVTerm::term_area*&);
void createArea (int, int, int, int, FVTerm::term_area*&);
static void resizeArea (const FRect&, const FPoint&, FVTerm::term_area*);
static void resizeArea (int, int, int, int, FVTerm::term_area*);
static void removeArea (FVTerm::term_area*&);
static void restoreVTerm (const FRect&);
static void restoreVTerm (int, int, int, int);
static FVTerm::covered_state isCovered (const FPoint&, FVTerm::term_area*);
static FVTerm::covered_state isCovered (int, int, FVTerm::term_area*);
static void updateVTerm (bool);
static void updateVTerm (FVTerm::term_area*);
static bool updateVTermCursor (FVTerm::term_area*);
static bool isInsideArea (int, int, FVTerm::term_area*);
static void setAreaCursor (const FPoint&, bool, FVTerm::term_area*);
static void setAreaCursor (int, int, bool, FVTerm::term_area*);
static void getArea (const FPoint&, FVTerm::term_area*);
static void getArea (int, int, FVTerm::term_area*);
static void getArea (const FRect&, FVTerm::term_area*);
static void getArea (int, int, int, int, FVTerm::term_area*);
static void putArea (const FPoint&, FVTerm::term_area*);
static void putArea (int, int, FVTerm::term_area*);
static void scrollAreaForward (FVTerm::term_area*);
static void scrollAreaReverse (FVTerm::term_area*);
static void clearArea (FVTerm::term_area*);
static FOptiAttr::char_data getCharacter (int, const FPoint&, FVTerm*);
static FOptiAttr::char_data getCharacter (int, int, int, FVTerm*);
static FOptiAttr::char_data getCoveredCharacter (const FPoint&, FVTerm*);
static FOptiAttr::char_data getCoveredCharacter (int, int, FVTerm*);
static FOptiAttr::char_data getOverlappedCharacter (const FPoint&, FVTerm*);
static FOptiAttr::char_data getOverlappedCharacter (int, int, FVTerm*);
private:
// Disable copy constructor
FVTerm (const FVTerm&);
// Disable assignment operator (=)
FVTerm& operator = (const FVTerm&);
void init();
void finish();
term_area* getPrintArea();
void setPrintArea (term_area*);
// Friend class
friend class FWidget;
public:
// Constructor
explicit FVTerm (FVTerm* = 0);
// Destructor
~FVTerm();
virtual const char* getClassName() const;
static void setTermXY (register int, register int);
static bool hideCursor (bool);
static bool hideCursor();
static bool showCursor();
static bool isCursorHidden();
static short getTermForegroundColor();
static short getTermBackgroundColor();
FVTerm::term_area* getVWin() const;
void createVTerm (const FRect&);
void createVTerm (int, int);
static void resizeVTerm (const FRect&);
static void resizeVTerm (int, int);
static void putVTerm();
static void updateTerminal (bool);
static void updateTerminal();
static bool updateTerminalCursor();
static void processTerminalUpdate();
static bool isInsideTerminal (int, int);
void setPrintCursor (const FPoint&);
void setPrintCursor (register int, register int);
FPoint* getPrintPos() const;
int printf (const wchar_t*, ...);
int printf (const char*, ...)
#if defined(__clang__)
__attribute__((__format__ (__printf__, 2, 3)))
#elif defined(__GNUC__)
__attribute__ ((format (printf, 2, 3)))
#endif
;
int print (const std::wstring&);
int print (FVTerm::term_area*, const std::wstring&);
int print (const wchar_t*);
int print (FVTerm::term_area*, const wchar_t*);
int print (const char*);
int print (FVTerm::term_area*, const char*);
int print (const std::string&);
int print (FVTerm::term_area*, const std::string&);
int print (FString&);
int print (FVTerm::term_area*, FString&);
int print (int);
int print (FVTerm::term_area*, int);
static void newFontChanges (FOptiAttr::char_data*&);
static void charsetChanges (FOptiAttr::char_data*&);
static void appendCharacter (FOptiAttr::char_data*&);
static void appendAttributes (FOptiAttr::char_data*&);
static int appendLowerRight (FOptiAttr::char_data*&);
static void appendOutputBuffer (std::string&);
static void appendOutputBuffer (const char*);
static int appendOutputBuffer (int);
static void flush_out();
};
#pragma pack(pop)
// FVTerm inline functions
//----------------------------------------------------------------------
inline void FVTerm::setPrintArea (term_area* area)
{ print_area = area; }
//----------------------------------------------------------------------
inline const char* FVTerm::getClassName() const
{ return "FVTerm"; }
//----------------------------------------------------------------------
inline bool FVTerm::hideCursor()
{ return hideCursor(true); }
//----------------------------------------------------------------------
inline bool FVTerm::showCursor()
{ return hideCursor(false); }
//----------------------------------------------------------------------
inline bool FVTerm::isCursorHidden()
{ return hidden_cursor; }
//----------------------------------------------------------------------
inline short FVTerm::getTermForegroundColor()
{ return next_attribute.fg_color; }
//----------------------------------------------------------------------
inline short FVTerm::getTermBackgroundColor()
{ return next_attribute.bg_color; }
//----------------------------------------------------------------------
inline FVTerm::term_area* FVTerm::getVWin() const
{ return vwin; }
//----------------------------------------------------------------------
inline void FVTerm::setPrintCursor (const FPoint& pos)
{ setPrintCursor (pos.getX(), pos.getY()); }
//----------------------------------------------------------------------
inline void FVTerm::setPrintCursor (register int x, register int y)
{ cursor->setPoint(x,y); }
#endif // _FVTERM_H

View File

@ -5,7 +5,7 @@
#include "fmenubar.h"
#include "fstatusbar.h"
#include "fwidget.h"
#include "fwindow.h"
// global FWidget object
static FWidget* rootObject = 0;
@ -30,7 +30,7 @@ FWidget::widget_colors FWidget::wc;
// constructors and destructor
//----------------------------------------------------------------------
FWidget::FWidget (FWidget* parent)
: FObject(parent)
: FVTerm(parent)
, callback_objects()
, member_callback_objects()
, accelerator_list(0)
@ -56,7 +56,6 @@ FWidget::FWidget (FWidget* parent)
, wshadow(0,0)
, foreground_color(fc::Default)
, background_color(fc::Default)
, print_area(0)
, statusbar_message()
{
resize_term = false;
@ -366,33 +365,6 @@ void FWidget::setColorTheme()
}
}
//----------------------------------------------------------------------
FTerm::term_area* FWidget::getPrintArea()
{
// returns the print area of this object
if ( print_area )
return print_area;
else
{
FWidget* obj = static_cast<FWidget*>(this);
FWidget* p_obj = static_cast<FWidget*>(obj->getParent());
while ( ! obj->vwin && p_obj )
{
obj = p_obj;
p_obj = static_cast<FWidget*>(p_obj->getParent());
}
if ( obj->vwin )
{
print_area = obj->vwin;
return print_area;
}
}
return vdesktop;
}
// protected methods of FWidget
//----------------------------------------------------------------------
@ -1544,7 +1516,7 @@ bool FWidget::setFocus (bool on)
// set window focus
if ( on && window )
{
if ( ! window->isActiveWindow() )
if ( ! window->isWindowActive() )
{
bool has_raised = window->raiseWindow();
FWindow::setActiveWindow(window);
@ -1852,7 +1824,7 @@ void FWidget::getTermSize()
void FWidget::setTermSize (int w, int h)
{
// Set xterm size to w x h
if ( xterm_terminal )
if ( isXTerminal() )
{
rootObject->wsize.setRect(1, 1, w, h);
rootObject->adjust_wsize = rootObject->wsize;
@ -1945,6 +1917,23 @@ bool FWidget::setCursorPos (register int x, register int y)
return false;
}
//----------------------------------------------------------------------
void FWidget::setPrintPos (register int x, register int y)
{
setPrintCursor ( offset.getX1() + adjust_wsize.getX() - 1 + x,
offset.getY1() + adjust_wsize.getY() - 1 + y );
}
//----------------------------------------------------------------------
FPoint FWidget::getPrintPos() const
{
const FPoint* cur = FVTerm::getPrintPos();
int cx = cur->getX();
int cy = cur->getY();
return FPoint ( cx - offset.getX1() - adjust_wsize.getX() + 1
, cy - offset.getY1() - adjust_wsize.getY() + 1 );
}
//----------------------------------------------------------------------
void FWidget::drawShadow()
{
@ -1969,7 +1958,7 @@ void FWidget::drawShadow()
if ( trans_shadow )
{
// transparent shadow
printPos (x2+1, y1);
setPrintPos (x2+1, y1);
setTransparent();
print (" ");
unsetTransparent();
@ -1979,12 +1968,12 @@ void FWidget::drawShadow()
for (int i=1; i < getHeight(); i++)
{
printPos (x2+1, y1+i);
setPrintPos (x2+1, y1+i);
print (" ");
}
unsetTransShadow();
printPos (x1, y2+1);
setPrintPos (x1, y2+1);
setTransparent();
print (" ");
unsetTransparent();
@ -2004,7 +1993,7 @@ void FWidget::drawShadow()
{
// non-transparent shadow
int block;
printPos (x2+1, y1);
setPrintPos (x2+1, y1);
if ( isWindowWidget() )
{
@ -2031,11 +2020,11 @@ void FWidget::drawShadow()
for (int i=1; i < getHeight(); i++)
{
printPos (x2+1, y1+i);
setPrintPos (x2+1, y1+i);
print (block); // █
}
printPos (x1+1, y2+1);
setPrintPos (x1+1, y2+1);
if ( isWindowWidget() )
setInheritBackground();
@ -2078,14 +2067,14 @@ void FWidget::clearShadow()
{
for (int i=0; i < getHeight(); i++)
{
printPos (x2+1, y1+i);
setPrintPos (x2+1, y1+i);
print (' '); // clear █
}
}
if ( y2 <= offset.getY2() )
{
printPos (x1+1, y2+1);
setPrintPos (x1+1, y2+1);
for (int i=1; i <= getWidth(); i++)
print (' '); // clear ▀
@ -2115,7 +2104,7 @@ void FWidget::drawFlatBorder()
for (int y=0; y < getHeight(); y++)
{
printPos (x1-1, y1+y+1);
setPrintPos (x1-1, y1+y+1);
if ( double_flatline_mask.left[uLong(y)] )
print (fc::NF_rev_border_line_right_and_left); // left+right line (on left side)
@ -2123,7 +2112,7 @@ void FWidget::drawFlatBorder()
print (fc::NF_rev_border_line_right); // right line (on left side)
}
printPos (x2, y1+1);
setPrintPos (x2, y1+1);
for (int y=0; y < getHeight(); y++)
{
@ -2132,10 +2121,10 @@ void FWidget::drawFlatBorder()
else
print (fc::NF_border_line_left); // left line (on right side)
printPos (x2, y1+y+2);
setPrintPos (x2, y1+y+2);
}
printPos (x1, y1);
setPrintPos (x1, y1);
for (int x=0; x < getWidth(); x++)
{
@ -2145,7 +2134,7 @@ void FWidget::drawFlatBorder()
print (fc::NF_border_line_bottom); // bottom line (at top)
}
printPos (x1, y2);
setPrintPos (x1, y2);
for (int x=0; x < getWidth(); x++)
{
@ -2177,7 +2166,7 @@ void FWidget::clearFlatBorder()
// clear on left side
for (register int y=0; y < getHeight(); y++)
{
printPos (x1-1, y1+y+1);
setPrintPos (x1-1, y1+y+1);
if ( double_flatline_mask.left[uLong(y)] )
print (fc::NF_border_line_left);
@ -2188,7 +2177,7 @@ void FWidget::clearFlatBorder()
// clear on right side
for (register int y=0; y < getHeight(); y++)
{
printPos (x2, y1+y+1);
setPrintPos (x2, y1+y+1);
if ( double_flatline_mask.right[uLong(y)] )
print (fc::NF_rev_border_line_right);
@ -2197,7 +2186,7 @@ void FWidget::clearFlatBorder()
}
// clear at top
printPos (x1, y1);
setPrintPos (x1, y1);
for (register int x=0; x < getWidth(); x++)
{
@ -2208,7 +2197,7 @@ void FWidget::clearFlatBorder()
}
// clear at bottom
printPos (x1, y2);
setPrintPos (x1, y2);
for (register int x=0; x < getWidth(); x++)
{
@ -2357,7 +2346,7 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
if ( isNewFont() )
{
printPos (x1, y1);
setPrintPos (x1, y1);
print (fc::NF_border_corner_middle_upper_left); // ┌
for (int x=x1+1; x < x2; x++)
@ -2367,13 +2356,13 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
for (int y=y1+1; y <= y2; y++)
{
printPos (x1, y);
setPrintPos (x1, y);
print (fc::NF_border_line_left); // border left ⎸
printPos (x2, y);
setPrintPos (x2, y);
print (fc::NF_rev_border_line_right); // border right⎹
}
printPos (x1, y2);
setPrintPos (x1, y2);
print (fc::NF_border_corner_middle_lower_left); // └
for (int x=x1+1; x < x2; x++)
@ -2383,7 +2372,7 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
}
else
{
printPos (x1, y1);
setPrintPos (x1, y1);
print (fc::BoxDrawingsDownAndRight); // ┌
for (int x=x1+1; x < x2; x++)
@ -2393,13 +2382,13 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
for (int y=y1+1; y < y2; y++)
{
printPos (x1, y);
setPrintPos (x1, y);
print (fc::BoxDrawingsVertical); // │
printPos (x2, y);
setPrintPos (x2, y);
print (fc::BoxDrawingsVertical); // │
}
printPos (x1, y2);
setPrintPos (x1, y2);
print (fc::BoxDrawingsUpAndRight); // └
for (int x=x1+1; x < x2; x++)
@ -2409,9 +2398,9 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
for (int x=x1+1; x < x2; x++)
{
printPos (x, y1);
setPrintPos (x, y1);
print (fc::BoxDrawingsHorizontal); // ─
printPos (x, y2);
setPrintPos (x, y2);
print (fc::BoxDrawingsHorizontal); // ─
}
}

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏ 1 1▕▔▔▔▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏-┬- - - -▕ FStatusBar ▏
// ▕▁▁▁▁▁▁▁▁▁▏ : ▕▁▁▁▁▁▁▁▁▁▁▁▁▏
@ -66,7 +71,7 @@
#ifndef _FWIDGET_H
#define _FWIDGET_H
#include "fterm.h"
#include "fvterm.h"
// Callback macros
@ -88,7 +93,7 @@ class FMenuBar;
#pragma pack(push)
#pragma pack(1)
class FWidget : public FObject, public FTerm
class FWidget : public FVTerm
{
public:
typedef std::vector<FWidget*> widgetList;
@ -302,7 +307,6 @@ class FWidget : public FObject, public FTerm
short foreground_color;
short background_color;
term_area* print_area;
FString statusbar_message;
static FStatusBar* statusbar;
@ -310,7 +314,6 @@ class FWidget : public FObject, public FTerm
static FWidget* show_root_widget;
static FWidget* redraw_root_widget;
friend class FTerm;
friend class FApplication;
friend class FToggleButton;
@ -325,8 +328,6 @@ class FWidget : public FObject, public FTerm
void processDestroy();
virtual void draw();
static void setColorTheme();
term_area* getPrintArea();
void setPrintArea (term_area*);
protected:
virtual void adjustSize();
@ -504,8 +505,8 @@ class FWidget : public FObject, public FTerm
bool setCursorPos (register int, register int);
void unsetCursorPos();
void printPos (const FPoint&);
void printPos (register int, register int);
void setPrintPos (const FPoint&);
void setPrintPos (register int, register int);
FPoint getPrintPos() const;
static void setNormal();
@ -612,10 +613,6 @@ class FWidget : public FObject, public FTerm
inline void FWidget::processDestroy()
{ emitCallback("destroy"); }
//----------------------------------------------------------------------
inline void FWidget::setPrintArea (term_area* area)
{ print_area = area; }
//----------------------------------------------------------------------
inline const char* FWidget::getClassName() const
{ return "FWidget"; }
@ -928,24 +925,8 @@ inline void FWidget::unsetCursorPos()
{ widget_cursor_position.setPoint(-1,-1); }
//----------------------------------------------------------------------
inline void FWidget::printPos (const FPoint& pos)
{ printPos (pos.getX(), pos.getY()); }
//----------------------------------------------------------------------
inline void FWidget::printPos (register int x, register int y)
{
cursor->setPoint ( offset.getX1() + adjust_wsize.getX() - 1 + x,
offset.getY1() + adjust_wsize.getY() - 1 + y );
}
//----------------------------------------------------------------------
inline FPoint FWidget::getPrintPos() const
{
int cx = cursor->getX();
int cy = cursor->getY();
return FPoint ( cx - offset.getX1() - adjust_wsize.getX() + 1
, cy - offset.getY1() - adjust_wsize.getY() + 1 );
}
inline void FWidget::setPrintPos (const FPoint& pos)
{ setPrintPos (pos.getX(), pos.getY()); }
//----------------------------------------------------------------------
inline void FWidget::setNormal()

View File

@ -9,11 +9,12 @@
// static attributes
FWindow* FWindow::previous_widget = 0;
//----------------------------------------------------------------------
// class FWindow
//----------------------------------------------------------------------
// constructors and destructor
// constructor and destructor
//----------------------------------------------------------------------
FWindow::FWindow(FWidget* parent)
: FWidget(parent)
@ -161,7 +162,7 @@ void FWindow::drawBorder()
int y1 = 1;
int y2 = 1 + getHeight() - 1;
printPos (x1, y1);
setPrintPos (x1, y1);
print (fc::NF_border_corner_upper_left); // ⎡
for (int x=x1+1; x < x2; x++)
@ -171,22 +172,22 @@ void FWindow::drawBorder()
for (int y=y1+1; y < y2; y++)
{
printPos (x1, y);
setPrintPos (x1, y);
// border left ⎸
print (fc::NF_border_line_left);
printPos (x2, y);
setPrintPos (x2, y);
// border right⎹
print (fc::NF_rev_border_line_right);
}
printPos (x1, y2);
setPrintPos (x1, y2);
// lower left corner border ⎣
print (fc::NF_border_corner_lower_left);
for (int x=2; x < getWidth(); x++) // low line _
print (fc::NF_border_line_bottom);
printPos (x2, y2);
setPrintPos (x2, y2);
// lower right corner border ⎦
print (fc::NF_rev_border_corner_lower_right);
}
@ -283,7 +284,7 @@ FWindow* FWindow::getWindowWidgetAt (int x, int y)
{
FWindow* w = static_cast<FWindow*>(*iter);
if ( ! w->isHiddenWindow()
if ( ! w->isWindowHidden()
&& w->getTermGeometry().contains(x,y) )
return w;
}
@ -571,7 +572,7 @@ void FWindow::setActiveWindow (FWindow* window)
{
if ( *iter == window )
{
if ( ! window->isActiveWindow() )
if ( ! window->isWindowActive() )
{
window->activateWindow();
FEvent ev(fc::WindowActive_Event);
@ -582,7 +583,7 @@ void FWindow::setActiveWindow (FWindow* window)
{
FWindow* w = static_cast<FWindow*>(*iter);
if ( w->isActiveWindow() )
if ( w->isWindowActive() )
{
w->deactivateWindow();
FEvent ev(fc::WindowInactive_Event);
@ -631,7 +632,7 @@ void FWindow::switchToPrevWindow()
if ( w
&& w != active_window
&& ! (w->isHiddenWindow() || w->isActiveWindow())
&& ! (w->isWindowHidden() || w->isWindowActive())
&& w != static_cast<FWindow*>(statusBar())
&& w != static_cast<FWindow*>(menuBar()) )
{
@ -647,7 +648,7 @@ void FWindow::switchToPrevWindow()
{
FWidget* focus_widget = active_window->getWindowFocusWidget();
if ( ! active_window->isActiveWindow() )
if ( ! active_window->isWindowActive() )
setActiveWindow(active_window);
if ( focus_widget )
@ -668,10 +669,10 @@ bool FWindow::activatePrevWindow()
if ( w )
{
if ( w->isActiveWindow() )
if ( w->isWindowActive() )
return true;
if ( w && ! w->isHiddenWindow() )
if ( w && ! w->isWindowHidden() )
{
setActiveWindow(w);
return true;
@ -695,7 +696,7 @@ bool FWindow::activateWindow (bool on)
}
//----------------------------------------------------------------------
bool FWindow::isHiddenWindow() const
bool FWindow::isWindowHidden() const
{
// returns the window hidden state
term_area* area = getVWin();

View File

@ -11,6 +11,11 @@
// │ │
// └─────┬─────┘
// │
// ▕▔▔▔▔▔▔▔▔▏
// ▕ FVTerm ▏
// ▕▁▁▁▁▁▁▁▁▏
// ▲
// │
// ▕▔▔▔▔▔▔▔▔▔▏
// ▕ FWidget ▏
// ▕▁▁▁▁▁▁▁▁▁▏
@ -114,10 +119,10 @@ class FWindow : public FWidget
bool activateWindow (bool);
bool activateWindow();
bool deactivateWindow();
bool isActiveWindow() const;
bool isHiddenWindow() const;
bool setResizeable (bool);
bool setResizeable();
bool isWindowActive() const;
bool isWindowHidden() const;
virtual bool setResizeable (bool);
virtual bool setResizeable();
bool unsetResizeable();
bool isResizeable();
bool setTransparentShadow (bool);
@ -175,7 +180,7 @@ inline bool FWindow::deactivateWindow()
{ return activateWindow(false); }
//----------------------------------------------------------------------
inline bool FWindow::isActiveWindow() const
inline bool FWindow::isWindowActive() const
{ return window_active; }
//----------------------------------------------------------------------

View File

@ -327,7 +327,7 @@ void Calc::drawDispay()
if ( isMonochron() )
setReverse(false);
printPos (3,3);
setPrintPos (3,3);
print(display);
print(L' ');
setColor(wc.dialog_fg, wc.dialog_bg);
@ -338,15 +338,15 @@ void Calc::drawDispay()
if ( isNewFont() )
{
FString bottom_line(33, wchar_t(fc::NF_border_line_bottom));
printPos (3,2);
setPrintPos (3,2);
print (bottom_line);
printPos (2,3);
setPrintPos (2,3);
print (wchar_t(fc::NF_rev_border_line_right));
printPos (36,3);
setPrintPos (36,3);
print (wchar_t(fc::NF_border_line_left));
FString top_bottom_line_5(5, wchar_t(fc::NF_border_line_up_and_down));
FString top_line_2(2, wchar_t(fc::NF_border_line_upper));
printPos (3,4);
setPrintPos (3,4);
print ( top_bottom_line_5 + top_line_2
+ top_bottom_line_5 + top_line_2
+ top_bottom_line_5 + top_line_2
@ -358,7 +358,7 @@ void Calc::drawDispay()
FString separator = FString(wchar_t(fc::BoxDrawingsVerticalAndRight))
+ FString(35, wchar_t(fc::BoxDrawingsHorizontal))
+ FString(wchar_t(fc::BoxDrawingsVerticalAndLeft));
printPos (1,4);
setPrintPos (1,4);
print(separator);
}

View File

@ -66,7 +66,7 @@ void keyboard::draw()
setNormal();
setColor(fc::Default, fc::Default);
clearArea (vdesktop);
printPosTerm (1,1);
setPrintPos (1,1);
print ("---------------\n");
print ("Press Q to quit\n");
print ("---------------\n");

View File

@ -68,7 +68,7 @@ void Mandelbrot::draw()
for (y0=y_min; y0 < y_max && current_line < Lines; y0+=dY)
{
current_line++;
printPos (xoffset, yoffset + current_line);
setPrintPos (xoffset, yoffset + current_line);
for (x0=x_min; x0 < x_max; x0+=dX)
{

View File

@ -231,7 +231,7 @@ void AttribDemo::printAltCharset()
if ( ! isMonochron() )
setColor (wc.label_fg, wc.label_bg);
printPos (1,1);
setPrintPos (1,1);
print("alternate charset: ");
if ( parent->bgcolor == fc::Default )
@ -262,7 +262,7 @@ void AttribDemo::draw()
for (int y=0; y < getParentWidget()->getHeight()-7; y++)
{
printPos (1, 2+y);
setPrintPos (1, 2+y);
if ( ! isMonochron() )
setColor (wc.label_fg, wc.label_bg);
@ -366,7 +366,7 @@ void AttribDemo::draw()
if ( ! isMonochron() )
setColor(wc.label_fg, wc.label_bg);
printPos (1, 15);
setPrintPos (1, 15);
short bg = static_cast<AttribDlg*>(getParent())->bgcolor;
print (" Background color:");
@ -375,7 +375,7 @@ void AttribDemo::draw()
else
printf ( " %d", bg);
printPos (16, 17);
setPrintPos (16, 17);
print ("Change background color ->");
updateVTerm(true);
}

View File

@ -72,7 +72,7 @@ void timer::draw()
setNormal();
setColor (fc::Default, fc::Default);
clearArea (vdesktop);
printPosTerm (1,1);
setPrintPos (1,1);
print ("---------------\n");
print ("Press Q to quit\n");
print ("---------------\n");

View File

@ -85,7 +85,7 @@ void Transparent::draw()
for (int n=1; n <= getClientHeight(); n++)
{
printPos (2, 2+n);
setPrintPos (2, 2+n);
print(line);
}
@ -217,9 +217,9 @@ void MainWindow::draw()
setReverse(true);
setColor();
printPos (2,4);
setPrintPos (2,4);
print(line1);
printPos (2,5);
setPrintPos (2,5);
print(line2);
if ( isMonochron() )

View File

@ -339,7 +339,7 @@ Window::~Window()
//----------------------------------------------------------------------
void Window::activateWindow (FDialog* win)
{
if ( win && ! win->isHiddenWindow() && ! win->isActiveWindow() )
if ( win && ! win->isWindowHidden() && ! win->isWindowActive() )
{
bool has_raised = FWindow::raiseWindow(win);
win->activateDialog();
@ -443,7 +443,7 @@ void Window::cb_next (FWidget*, void*)
while ( iter != dialog_list->end() )
{
if ( static_cast<FWindow*>(*iter)->isActiveWindow() )
if ( static_cast<FWindow*>(*iter)->isWindowActive() )
{
FDialog* next;
widgetList::const_iterator next_element;
@ -484,7 +484,7 @@ void Window::cb_previous (FWidget*, void*)
--iter;
if ( (*iter)->isDialogWidget()
&& static_cast<FWindow*>(*iter)->isActiveWindow() )
&& static_cast<FWindow*>(*iter)->isWindowActive() )
{
FDialog* prev;
widgetList::const_iterator prev_element;