Better background color for all terminals with a fixed color palette

This commit is contained in:
Markus Gans 2019-01-03 20:56:09 +01:00
parent 72fab50cbf
commit c365f07298
8 changed files with 63 additions and 55 deletions

View File

@ -3,6 +3,7 @@
* Integration of an output filter to replace missing characters * Integration of an output filter to replace missing characters
* Better Linux console support for UTF-8 encoding * Better Linux console support for UTF-8 encoding
(Default is PC charset encoding) (Default is PC charset encoding)
* Better background color for all terminals with a fixed color palette
2018-12-31 Markus Gans <guru.mail@muenster.de> 2018-12-31 Markus Gans <guru.mail@muenster.de>
* Use the override specifier * Use the override specifier

View File

@ -133,6 +133,22 @@ bool FTerm::isCursorHideable()
return false; return false;
} }
//----------------------------------------------------------------------
bool FTerm::canChangeColorPalette()
{
if ( isCygwinTerminal()
|| isKdeTerminal()
|| isTeraTerm()
|| isMltermTerminal()
|| isNetBSDTerm()
|| isOpenBSDTerm()
|| isSunTerminal()
|| isAnsiTerminal() )
return false;
return FTermcap::can_change_color_palette;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::setTermType (const char term_name[]) void FTerm::setTermType (const char term_name[])
{ {
@ -1487,22 +1503,6 @@ inline bool FTerm::hasNoFontSettingOption()
return false; return false;
} }
//----------------------------------------------------------------------
inline bool FTerm::canChangeColorPalette()
{
if ( isCygwinTerminal()
|| isKdeTerminal()
|| isTeraTerm()
|| isMltermTerminal()
|| isNetBSDTerm()
|| isOpenBSDTerm()
|| isSunTerminal()
|| isAnsiTerminal() )
return false;
return FTermcap::can_change_color_palette;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::redefineColorPalette() void FTerm::redefineColorPalette()
{ {

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2018 Markus Gans * * Copyright 2018-2019 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -67,7 +67,7 @@ void FTermcapQuirks::setFTermDetection (FTermDetection* td)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcapQuirks::terminalFixup() void FTermcapQuirks::terminalFixup()
{ {
auto td = term_detection; auto& td = term_detection;
if ( td->isCygwinTerminal() ) if ( td->isCygwinTerminal() )
{ {
@ -114,6 +114,8 @@ void FTermcapQuirks::terminalFixup()
// Fixes general quirks // Fixes general quirks
general(); general();
// ECMA-48 (ANSI X3.64) compatible terminal
ecma48();
} }
#if defined(__FreeBSD__) || defined(__DragonFly__) #if defined(__FreeBSD__) || defined(__DragonFly__)
@ -548,42 +550,46 @@ void FTermcapQuirks::general()
if ( ! TCAP(fc::t_cursor_address) ) if ( ! TCAP(fc::t_cursor_address) )
TCAP(fc::t_cursor_address) = \ TCAP(fc::t_cursor_address) = \
C_STR(CSI "%i%p1%d;%p2%dH"); C_STR(CSI "%i%p1%d;%p2%dH");
}
//----------------------------------------------------------------------
void FTermcapQuirks::ecma48()
{
// Test for standard ECMA-48 (ANSI X3.64) terminal // Test for standard ECMA-48 (ANSI X3.64) terminal
if ( TCAP(fc::t_exit_underline_mode) if ( ! TCAP(fc::t_exit_underline_mode)
&& std::strncmp(TCAP(fc::t_exit_underline_mode), CSI "24m", 5) == 0 ) || std::strncmp(TCAP(fc::t_exit_underline_mode), CSI "24m", 5) != 0 )
{ return;
// Seems to be a ECMA-48 (ANSI X3.64) compatible terminal
TCAP(fc::t_enter_dbl_underline_mode) = \
C_STR(CSI "21m"); // Exit single underline, too
TCAP(fc::t_exit_dbl_underline_mode) = \ // Seems to be a ECMA-48 (ANSI X3.64) compatible terminal
C_STR(CSI "24m"); TCAP(fc::t_enter_dbl_underline_mode) = \
C_STR(CSI "21m"); // Exit single underline, too
TCAP(fc::t_exit_bold_mode) = \ TCAP(fc::t_exit_dbl_underline_mode) = \
C_STR(CSI "22m"); // Exit dim, too C_STR(CSI "24m");
TCAP(fc::t_exit_dim_mode) = \ TCAP(fc::t_exit_bold_mode) = \
C_STR(CSI "22m"); C_STR(CSI "22m"); // Exit dim, too
TCAP(fc::t_exit_underline_mode) = \ TCAP(fc::t_exit_dim_mode) = \
C_STR(CSI "24m"); C_STR(CSI "22m");
TCAP(fc::t_exit_blink_mode) = \ TCAP(fc::t_exit_underline_mode) = \
C_STR(CSI "25m"); C_STR(CSI "24m");
TCAP(fc::t_exit_reverse_mode) = \ TCAP(fc::t_exit_blink_mode) = \
C_STR(CSI "27m"); C_STR(CSI "25m");
TCAP(fc::t_exit_secure_mode) = \ TCAP(fc::t_exit_reverse_mode) = \
C_STR(CSI "28m"); C_STR(CSI "27m");
TCAP(fc::t_enter_crossed_out_mode) = \ TCAP(fc::t_exit_secure_mode) = \
C_STR(CSI "9m"); C_STR(CSI "28m");
TCAP(fc::t_exit_crossed_out_mode) = \ TCAP(fc::t_enter_crossed_out_mode) = \
C_STR(CSI "29m"); C_STR(CSI "9m");
}
TCAP(fc::t_exit_crossed_out_mode) = \
C_STR(CSI "29m");
} }
} // namespace finalcut } // namespace finalcut

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2018 Markus Gans * * Copyright 2018-2019 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -457,7 +457,10 @@ char* FTermDetection::termtype_256color_quirks()
if ( (color_env.string5 && std::strlen(color_env.string5) > 0) if ( (color_env.string5 && std::strlen(color_env.string5) > 0)
|| (color_env.string6 && std::strlen(color_env.string6) > 0) ) || (color_env.string6 && std::strlen(color_env.string6) > 0) )
{
terminal_type.kde_konsole = true; terminal_type.kde_konsole = true;
new_termtype = C_STR("konsole-256color");
}
if ( color_env.string3 && std::strlen(color_env.string3) > 0 ) if ( color_env.string3 && std::strlen(color_env.string3) > 0 )
decscusr_support = true; decscusr_support = true;

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2015-2018 Markus Gans * * Copyright 2015-2019 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -2331,16 +2331,9 @@ void FWidget::setColorTheme()
// Sets the default color theme // Sets the default color theme
if ( getMaxColor() < 16 ) // for 8 color mode if ( getMaxColor() < 16 ) // for 8 color mode
{
wc.set8ColorTheme(); wc.set8ColorTheme();
}
else else
{
wc.set16ColorTheme(); wc.set16ColorTheme();
if ( isKdeTerminal() )
wc.term_bg = fc::SkyBlue2;
}
} }
} // namespace finalcut } // namespace finalcut

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2018 Markus Gans * * Copyright 2018-2019 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -20,6 +20,7 @@
* <http://www.gnu.org/licenses/>. * * <http://www.gnu.org/licenses/>. *
***********************************************************************/ ***********************************************************************/
#include "final/fterm.h"
#include "final/fwidgetcolors.h" #include "final/fwidgetcolors.h"
namespace finalcut namespace finalcut
@ -206,6 +207,9 @@ void FWidgetColors::set16ColorTheme()
scrollbar_button_bg = fc::LightGray; scrollbar_button_bg = fc::LightGray;
progressbar_fg = fc::DarkGray; progressbar_fg = fc::DarkGray;
progressbar_bg = fc::LightBlue; progressbar_bg = fc::LightBlue;
if ( ! FTerm::canChangeColorPalette() && FTerm::getMaxColor() > 16 )
term_bg = fc::SkyBlue2;
} }
} // namespace finalcut } // namespace finalcut

View File

@ -224,6 +224,7 @@ class FTerm
static bool hasShadowCharacter(); static bool hasShadowCharacter();
static bool hasHalfBlockCharacter(); static bool hasHalfBlockCharacter();
static bool hasAlternateScreen(); static bool hasAlternateScreen();
static bool canChangeColorPalette();
// Mutators // Mutators
static void setTermType (const char[]); static void setTermType (const char[]);
@ -364,7 +365,6 @@ class FTerm
static void init_tab_quirks(); static void init_tab_quirks();
static void init_captureFontAndTitle(); static void init_captureFontAndTitle();
static bool hasNoFontSettingOption(); static bool hasNoFontSettingOption();
static bool canChangeColorPalette();
static void redefineColorPalette(); static void redefineColorPalette();
static void restoreColorPalette(); static void restoreColorPalette();
static void setInsertCursorStyle(); static void setInsertCursorStyle();

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2018 Markus Gans * * Copyright 2018-2019 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -85,6 +85,7 @@ class FTermcapQuirks
static void sunConsole(); static void sunConsole();
static void screen(); static void screen();
static void general(); static void general();
static void ecma48();
// Data Members // Data Members
static FTermcap::tcap_map* tcap; static FTermcap::tcap_map* tcap;