incorrect parameter can now return an error message
This commit is contained in:
parent
2904ed31b9
commit
44cb96e732
|
@ -37,4 +37,3 @@ test/mandelbrot
|
|||
test/keyboard
|
||||
test/timer
|
||||
test/ui
|
||||
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
2016-08-25 Markus Gans <guru.mail@muenster.de>
|
||||
2016-08-28 Markus Gans <guru.mail@muenster.de>
|
||||
* Remove obsolete code from FDialog
|
||||
* An incorrect parameter can now return an error message
|
||||
on program exit
|
||||
* Termcap S2 and S3 fallback only for the vte/gnome-terminal
|
||||
and the linux terminal
|
||||
|
||||
2016-08-27 Markus Gans <guru.mail@muenster.de>
|
||||
* A new inherit background option for characters
|
||||
* Use inherit background for the simple shadows
|
||||
* Updating the transparent example program
|
||||
|
|
30
src/fapp.cpp
30
src/fapp.cpp
|
@ -104,6 +104,15 @@ void FApplication::init()
|
|||
cmd_options();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FApplication::setExitMessage (std::string message)
|
||||
{
|
||||
quit_now = true;
|
||||
snprintf ( FTerm::exit_message
|
||||
, sizeof(FTerm::exit_message)
|
||||
, message.c_str() );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FApplication::cmd_options ()
|
||||
{
|
||||
|
@ -141,16 +150,29 @@ void FApplication::cmd_options ()
|
|||
{
|
||||
setEncoding(encoding.c_str());
|
||||
}
|
||||
else
|
||||
setExitMessage ( "Unknown encoding "
|
||||
+ std::string(encoding.c_str()) );
|
||||
}
|
||||
|
||||
if ( strcmp(long_options[idx].name, "no-optimize-cursor") == 0 )
|
||||
setCursorOptimisation (false);
|
||||
|
||||
if ( strcmp(long_options[idx].name, "vgafont") == 0 )
|
||||
setVGAFont();
|
||||
{
|
||||
bool ret = setVGAFont();
|
||||
|
||||
if ( ! ret )
|
||||
setExitMessage ("VGAfont is not supported by this terminal");
|
||||
}
|
||||
|
||||
if ( strcmp(long_options[idx].name, "newfont") == 0 )
|
||||
setNewFont();
|
||||
{
|
||||
bool ret = setNewFont();
|
||||
|
||||
if ( ! ret )
|
||||
setExitMessage ("Newfont is not supported by this terminal");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1753,6 +1775,10 @@ void FApplication::setMainWidget (FWidget* widget)
|
|||
int FApplication::exec() // run
|
||||
{
|
||||
FWidget* widget;
|
||||
|
||||
if ( quit_now )
|
||||
return EXIT_FAILURE;
|
||||
|
||||
quit_now = false;
|
||||
quit_code = 0;
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ class FApplication : public FWidget
|
|||
FApplication& operator = (const FApplication&); // and operator '='
|
||||
|
||||
void init();
|
||||
void setExitMessage (std::string);
|
||||
void cmd_options();
|
||||
bool KeyPressed();
|
||||
ssize_t readKey();
|
||||
|
|
|
@ -780,21 +780,6 @@ void FDialog::onWindowRaised (FEvent*)
|
|||
|
||||
if ( window_list->empty() )
|
||||
return;
|
||||
|
||||
// redraw shadow of the other windows
|
||||
iter = window_list->begin();
|
||||
end = window_list->end();
|
||||
|
||||
while ( iter != end )
|
||||
{
|
||||
if ( *iter != this && ! maximized
|
||||
&& ((*iter)->getFlags() & fc::shadow) != 0 )
|
||||
{
|
||||
static_cast<FDialog*>(*iter)->drawDialogShadow();
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -814,10 +799,6 @@ void FDialog::onWindowLowered (FEvent*)
|
|||
while ( iter != end )
|
||||
{
|
||||
putArea ((*iter)->getGlobalPos(), (*iter)->getVWin());
|
||||
|
||||
if ( ! maximized && ((*iter)->getFlags() & fc::shadow) != 0 )
|
||||
static_cast<FDialog*>(*iter)->drawDialogShadow();
|
||||
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
@ -936,9 +917,6 @@ void FDialog::move (int x, int y)
|
|||
restoreVTerm (old_x, old_y, width+rsw, height+bsh);
|
||||
}
|
||||
|
||||
// if ( ! maximized && (flags & fc::shadow) != 0 )
|
||||
// drawDialogShadow();
|
||||
|
||||
// handle overlaid windows
|
||||
if ( window_list && ! window_list->empty() )
|
||||
{
|
||||
|
@ -950,13 +928,8 @@ void FDialog::move (int x, int y)
|
|||
while ( iter != end )
|
||||
{
|
||||
if ( overlaid )
|
||||
{
|
||||
putArea ((*iter)->getGlobalPos(), (*iter)->getVWin());
|
||||
|
||||
if ( ! maximized && ((*iter)->getFlags() & fc::shadow) != 0 )
|
||||
static_cast<FDialog*>(*iter)->drawDialogShadow();
|
||||
}
|
||||
|
||||
if ( vwin == (*iter)->getVWin() )
|
||||
overlaid = true;
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ FPoint* FTerm::mouse = 0;
|
|||
FPoint* FTerm::cursor = 0;
|
||||
FRect* FTerm::term = 0;
|
||||
|
||||
char FTerm::exit_message[8192] = "";
|
||||
fc::encoding FTerm::Encoding;
|
||||
const FString* FTerm::xterm_font = 0;
|
||||
const FString* FTerm::xterm_title = 0;
|
||||
|
@ -161,6 +162,11 @@ FTerm::~FTerm() // destructor
|
|||
delete term;
|
||||
delete opti_attr;
|
||||
delete opti_move;
|
||||
|
||||
if ( exit_message[0] )
|
||||
{
|
||||
fprintf (stderr, "Warning: %s\n", exit_message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1155,7 +1161,9 @@ void FTerm::init_pc_charset()
|
|||
if ( rxvt_terminal || urxvt_terminal )
|
||||
return;
|
||||
|
||||
// fallback if "S2" is not found
|
||||
if ( gnome_terminal || linux_terminal )
|
||||
{
|
||||
// fallback if tcap "S2" is not found
|
||||
if ( ! tcap[t_enter_pc_charset_mode].string )
|
||||
{
|
||||
if ( utf8_console )
|
||||
|
@ -1175,7 +1183,7 @@ void FTerm::init_pc_charset()
|
|||
reinit = true;
|
||||
}
|
||||
|
||||
// fallback if "S3" is not found
|
||||
// fallback if tcap "S3" is not found
|
||||
if ( ! tcap[t_exit_pc_charset_mode].string )
|
||||
{
|
||||
if ( utf8_console )
|
||||
|
@ -1194,6 +1202,7 @@ void FTerm::init_pc_charset()
|
|||
opti_attr->set_exit_pc_charset_mode (tcap[t_exit_pc_charset_mode].string);
|
||||
reinit = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( reinit )
|
||||
opti_attr->init();
|
||||
|
@ -1731,6 +1740,9 @@ void FTerm::init()
|
|||
force_terminal_update = \
|
||||
non_blocking_stdin = false;
|
||||
|
||||
// init arrays with '\0'
|
||||
std::fill_n (exit_message, sizeof(exit_message), '\0');
|
||||
|
||||
stdin_no = fileno(stdin);
|
||||
stdout_no = fileno(stdout);
|
||||
stdin_status_flags = fcntl(stdin_no, F_GETFL);
|
||||
|
@ -3017,6 +3029,14 @@ bool FTerm::setVGAFont()
|
|||
if ( VGAFont )
|
||||
return VGAFont;
|
||||
|
||||
if ( gnome_terminal
|
||||
|| kde_konsole
|
||||
|| putty_terminal
|
||||
|| tera_terminal
|
||||
|| cygwin_terminal
|
||||
|| mintty_terminal )
|
||||
return false;
|
||||
|
||||
VGAFont = true;
|
||||
|
||||
if ( xterm || screen_terminal || osc_support )
|
||||
|
@ -3079,6 +3099,14 @@ bool FTerm::setNewFont()
|
|||
if ( NewFont )
|
||||
return true;
|
||||
|
||||
if ( gnome_terminal
|
||||
|| kde_konsole
|
||||
|| putty_terminal
|
||||
|| tera_terminal
|
||||
|| cygwin_terminal
|
||||
|| mintty_terminal )
|
||||
return false;
|
||||
|
||||
if ( xterm || screen_terminal || urxvt_terminal || osc_support )
|
||||
{
|
||||
NewFont = true;
|
||||
|
@ -4644,7 +4672,7 @@ int FTerm::print (FTerm::term_area* area, register int c)
|
|||
inline void FTerm::newFontChanges (FOptiAttr::char_data*& next_char)
|
||||
{
|
||||
// NewFont special cases
|
||||
if ( isNewFont() )
|
||||
if ( NewFont )
|
||||
{
|
||||
switch ( next_char->code )
|
||||
{
|
||||
|
|
|
@ -162,6 +162,7 @@ class FTerm
|
|||
static int x_term_pos;
|
||||
static int y_term_pos;
|
||||
static bool resize_term;
|
||||
static char exit_message[8192];
|
||||
|
||||
static struct termios term_init;
|
||||
static FOptiAttr::char_data term_attribute;
|
||||
|
|
|
@ -179,6 +179,7 @@ void MainWindow::draw()
|
|||
{
|
||||
FDialog::draw();
|
||||
updateVTerm(false);
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue