With FColorPalette you can now create your own color palette themes

This commit is contained in:
Markus Gans 2020-05-28 01:02:53 +02:00
parent a0e1115ff6
commit df672dfd73
10 changed files with 496 additions and 265 deletions

View File

@ -1,3 +1,7 @@
2020-05-28 Markus Gans <guru.mail@muenster.de>
* FColorPalette now also uses polymorphism, so you can now
easily create your own color palette theme
2020-05-26 Markus Gans <guru.mail@muenster.de>
* FWidgetColors now uses polymorphism, so you can now easily
create your own widget color theme

View File

@ -70,6 +70,7 @@ libfinal_la_SOURCES = \
foptimove.cpp \
ftermbuffer.cpp \
fapplication.cpp \
fcolorpalette.cpp \
fwidgetcolors.cpp \
fwidget.cpp \
fwidget_functions.cpp \

View File

@ -145,6 +145,7 @@ OBJS = \
foptimove.o \
ftermbuffer.o \
fapplication.o \
fcolorpalette.o \
fwidgetcolors.o \
fwidget.o \
fwidget_functions.o \

View File

@ -145,6 +145,7 @@ OBJS = \
foptimove.o \
ftermbuffer.o \
fapplication.o \
fcolorpalette.o \
fwidgetcolors.o \
fwidget.o \
fwidget_functions.o \

169
src/fcolorpalette.cpp Normal file
View File

@ -0,0 +1,169 @@
/***********************************************************************
* fcolorpalette.cpp - Define RGB color value for a palette entry *
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2020 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation; either version 3 of *
* the License, or (at your option) any later version. *
* *
* The Final Cut is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this program. If not, see *
* <http://www.gnu.org/licenses/>. *
***********************************************************************/
#include "final/fcolorpalette.h"
namespace finalcut
{
//----------------------------------------------------------------------
// class FColorPalette
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FColorPalette::FColorPalette (FSetPalette f)
: set_palette{f}
{ }
//----------------------------------------------------------------------
FColorPalette::~FColorPalette() // destructor
{ }
// protected methods of FColorPalette
//----------------------------------------------------------------------
void FColorPalette::setPalette (FColor index, int r, int g, int b)
{
set_palette (index, r, g, b);
}
//----------------------------------------------------------------------
// class default8ColorPalette
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
default8ColorPalette::default8ColorPalette (FSetPalette f)
: FColorPalette(f)
{ }
//----------------------------------------------------------------------
default8ColorPalette::~default8ColorPalette()
{ }
// public methods of default8ColorPalette
//----------------------------------------------------------------------
void default8ColorPalette::setColorPalette()
{
setPalette (fc::Black, 0x00, 0x00, 0x00);
setPalette (fc::Blue, 0x10, 0x3b, 0x9e);
setPalette (fc::Green, 0x18, 0x78, 0x18);
setPalette (fc::Cyan, 0xa0, 0xb2, 0xb2);
setPalette (fc::Red, 0xb2, 0x18, 0x18);
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
setPalette (fc::LightGray, 0xe0, 0xe0, 0xe0);
// The same colors again...
setPalette (fc::DarkGray, 0x00, 0x00, 0x00);
setPalette (fc::LightBlue, 0x10, 0x3b, 0x9e);
setPalette (fc::LightGreen, 0x18, 0x78, 0x18);
setPalette (fc::Cyan, 0xa0, 0xb2, 0xb2);
setPalette (fc::LightRed, 0xb2, 0x18, 0x18);
setPalette (fc::LightMagenta, 0xb2, 0x18, 0xb2);
setPalette (fc::Yellow, 0xe8, 0x87, 0x1f);
setPalette (fc::White, 0xe0, 0xe0, 0xe0);
}
//----------------------------------------------------------------------
void default8ColorPalette::resetColorPalette()
{
set_palette (fc::Black, 0x00, 0x00, 0x00);
set_palette (fc::Blue, 0x00, 0x00, 0xaa);
set_palette (fc::Green, 0x00, 0xaa, 0x00);
set_palette (fc::Cyan, 0x00, 0x55, 0xaa);
set_palette (fc::Red, 0xaa, 0x00, 0x00);
set_palette (fc::Magenta, 0xaa, 0x00, 0xaa);
set_palette (fc::Brown, 0xaa, 0xaa, 0x00);
set_palette (fc::LightGray, 0xaa, 0xaa, 0xaa);
set_palette (fc::DarkGray, 0x55, 0x55, 0x55);
set_palette (fc::LightBlue, 0x55, 0x55, 0xff);
set_palette (fc::LightGreen, 0x55, 0xff, 0x55);
set_palette (fc::LightCyan, 0x55, 0xff, 0xff);
set_palette (fc::LightRed, 0xff, 0x55, 0x55);
set_palette (fc::LightMagenta, 0xff, 0x55, 0xff);
set_palette (fc::Yellow, 0xff, 0xff, 0x55);
set_palette (fc::White, 0xff, 0xff, 0xff);
}
//----------------------------------------------------------------------
// class default16ColorPalette
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
default16ColorPalette::default16ColorPalette (FSetPalette f)
: FColorPalette(f)
{ }
//----------------------------------------------------------------------
default16ColorPalette::~default16ColorPalette()
{ }
// public methods of default8ColorPalette
//----------------------------------------------------------------------
void default16ColorPalette::setColorPalette()
{
setPalette (fc::Black, 0x00, 0x00, 0x00);
setPalette (fc::Blue, 0x10, 0x3b, 0x9e);
setPalette (fc::Green, 0x18, 0x78, 0x18);
setPalette (fc::Cyan, 0x55, 0x6a, 0xcf);
setPalette (fc::Red, 0xba, 0x1a, 0x1a);
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
setPalette (fc::LightGray, 0xbc, 0xbc, 0xbc);
setPalette (fc::DarkGray, 0x50, 0x50, 0x50);
setPalette (fc::LightBlue, 0x80, 0xa4, 0xec);
setPalette (fc::LightGreen, 0x5e, 0xeb, 0x5c);
setPalette (fc::LightCyan, 0x62, 0xbf, 0xf8);
setPalette (fc::LightRed, 0xee, 0x44, 0x44);
setPalette (fc::LightMagenta, 0xe9, 0xad, 0xff);
setPalette (fc::Yellow, 0xfb, 0xe8, 0x67);
setPalette (fc::White, 0xff, 0xff, 0xff);
}
//----------------------------------------------------------------------
void default16ColorPalette::resetColorPalette()
{
set_palette (fc::Black, 0x00, 0x00, 0x00);
set_palette (fc::Blue, 0x00, 0x00, 0xaa);
set_palette (fc::Green, 0x00, 0xaa, 0x00);
set_palette (fc::Cyan, 0x00, 0x55, 0xaa);
set_palette (fc::Red, 0xaa, 0x00, 0x00);
set_palette (fc::Magenta, 0xaa, 0x00, 0xaa);
set_palette (fc::Brown, 0xaa, 0xaa, 0x00);
set_palette (fc::LightGray, 0xaa, 0xaa, 0xaa);
set_palette (fc::DarkGray, 0x55, 0x55, 0x55);
set_palette (fc::LightBlue, 0x55, 0x55, 0xff);
set_palette (fc::LightGreen, 0x55, 0xff, 0x55);
set_palette (fc::LightCyan, 0x55, 0xff, 0xff);
set_palette (fc::LightRed, 0xff, 0x55, 0x55);
set_palette (fc::LightMagenta, 0xff, 0x55, 0xff);
set_palette (fc::Yellow, 0xff, 0xff, 0x55);
set_palette (fc::White, 0xff, 0xff, 0xff);
}
} // namespace finalcut

View File

@ -28,7 +28,6 @@
#include "final/fapplication.h"
#include "final/fc.h"
#include "final/fcharmap.h"
#include "final/fcolorpalette.h"
#include "final/fkey_map.h"
#include "final/fkeyboard.h"
#include "final/flog.h"
@ -181,6 +180,13 @@ int FTerm::getMaxColor()
return FTermcap::max_color;
}
//----------------------------------------------------------------------
FTerm::FColorPalettePtr& FTerm::getColorPaletteTheme()
{
static FColorPalettePtr* color_theme = new FColorPalettePtr();
return *color_theme;
}
//----------------------------------------------------------------------
FTermData* FTerm::getFTermData()
{
@ -1883,9 +1889,11 @@ void FTerm::redefineColorPalette()
saveColorMap();
if ( getMaxColor() >= 16 )
FColorPalette::set16ColorPalette (FTerm::setPalette);
setColorPaletteTheme<default16ColorPalette>(&FTerm::setPalette);
else // 8 colors
FColorPalette::set8ColorPalette (FTerm::setPalette);
setColorPaletteTheme<default8ColorPalette>(&FTerm::setPalette);
getColorPaletteTheme()->setColorPalette();
}
//----------------------------------------------------------------------
@ -1895,11 +1903,7 @@ void FTerm::restoreColorPalette()
return;
// Reset screen settings
if ( getMaxColor() >= 16 )
FColorPalette::reset16ColorPalette (FTerm::setPalette);
else // 8 colors
FColorPalette::reset8ColorPalette (FTerm::setPalette);
getColorPaletteTheme()->resetColorPalette();
getFTermXTerminal()->resetColorMap();
resetColorMap();
}
@ -2498,6 +2502,13 @@ void FTerm::finish_encoding()
#endif
}
//----------------------------------------------------------------------
void FTerm::destroyColorPaletteTheme()
{
const FColorPalettePtr* theme = &(getColorPaletteTheme());
delete theme;
}
//----------------------------------------------------------------------
void FTerm::setSignalHandler()
{

View File

@ -2001,7 +2001,7 @@ void FWidget::initColorTheme()
//----------------------------------------------------------------------
void FWidget::destroyColorTheme()
{
FWidgetColorsPtr* theme = &(getColorTheme());
const FWidgetColorsPtr* theme = &(getColorTheme());
delete theme;
}

View File

@ -46,27 +46,30 @@ namespace finalcut
// class FColorPalette
//----------------------------------------------------------------------
class FColorPalette final
class FColorPalette
{
public:
// Typedef
typedef std::function<void(FColor, int, int, int)> FSetPalette;
// Constructor
FColorPalette() = default;
FColorPalette(FSetPalette);
// Destructor
~FColorPalette();
virtual ~FColorPalette();
// Accessor
const FString getClassName() const;
virtual const FString getClassName() const;
// Methods
template<typename funcT>
static void set8ColorPalette (funcT);
template<typename funcT>
static void set16ColorPalette (funcT);
template<typename funcT>
static void reset8ColorPalette (funcT);
template<typename funcT>
static void reset16ColorPalette (funcT);
virtual void setColorPalette() = 0;
virtual void resetColorPalette() = 0;
protected:
void setPalette (FColor, int, int, int);
// Data members
FSetPalette set_palette;
};
// FColorPalette inline functions
@ -74,85 +77,85 @@ class FColorPalette final
inline const FString FColorPalette::getClassName() const
{ return "FColorPalette"; }
// constructors and destructor
//----------------------------------------------------------------------
inline FColorPalette::~FColorPalette() // destructor
{ }
// public methods of FColorPalette
//----------------------------------------------------------------------
template<typename funcT>
void FColorPalette::set8ColorPalette (funcT set_palette)
{
set_palette (fc::Black, 0x00, 0x00, 0x00);
set_palette (fc::Blue, 0x10, 0x3b, 0x9e);
set_palette (fc::Green, 0x18, 0x78, 0x18);
set_palette (fc::Cyan, 0xa0, 0xb2, 0xb2);
set_palette (fc::Red, 0xb2, 0x18, 0x18);
set_palette (fc::Magenta, 0xb2, 0x18, 0xb2);
set_palette (fc::Brown, 0xe8, 0x87, 0x1f);
set_palette (fc::LightGray, 0xe0, 0xe0, 0xe0);
// The same colors again...
set_palette (fc::DarkGray, 0x00, 0x00, 0x00);
set_palette (fc::LightBlue, 0x10, 0x3b, 0x9e);
set_palette (fc::LightGreen, 0x18, 0x78, 0x18);
set_palette (fc::Cyan, 0xa0, 0xb2, 0xb2);
set_palette (fc::LightRed, 0xb2, 0x18, 0x18);
set_palette (fc::LightMagenta, 0xb2, 0x18, 0xb2);
set_palette (fc::Yellow, 0xe8, 0x87, 0x1f);
set_palette (fc::White, 0xe0, 0xe0, 0xe0);
}
/* Inheritance diagram
*
*
*
* FColorPalette
*
*
*
*
* default8ColorPalette
*
*/
//----------------------------------------------------------------------
template<typename funcT>
void FColorPalette::set16ColorPalette (funcT set_palette)
// class default8ColorPalette
//----------------------------------------------------------------------
class default8ColorPalette final : public FColorPalette
{
set_palette (fc::Black, 0x00, 0x00, 0x00);
set_palette (fc::Blue, 0x10, 0x3b, 0x9e);
set_palette (fc::Green, 0x18, 0x78, 0x18);
set_palette (fc::Cyan, 0x55, 0x6a, 0xcf);
set_palette (fc::Red, 0xba, 0x1a, 0x1a);
set_palette (fc::Magenta, 0xb2, 0x18, 0xb2);
set_palette (fc::Brown, 0xe8, 0x87, 0x1f);
set_palette (fc::LightGray, 0xbc, 0xbc, 0xbc);
set_palette (fc::DarkGray, 0x50, 0x50, 0x50);
set_palette (fc::LightBlue, 0x80, 0xa4, 0xec);
set_palette (fc::LightGreen, 0x5e, 0xeb, 0x5c);
set_palette (fc::LightCyan, 0x62, 0xbf, 0xf8);
set_palette (fc::LightRed, 0xee, 0x44, 0x44);
set_palette (fc::LightMagenta, 0xe9, 0xad, 0xff);
set_palette (fc::Yellow, 0xfb, 0xe8, 0x67);
set_palette (fc::White, 0xff, 0xff, 0xff);
}
public:
// Constructor
default8ColorPalette (FSetPalette);
// Destructor
~default8ColorPalette();
// Accessor
virtual const FString getClassName() const;
// Methods
void setColorPalette();
void resetColorPalette();
};
// default8ColorPalette inline functions
//----------------------------------------------------------------------
inline const FString default8ColorPalette::getClassName() const
{ return "default8ColorPalette"; }
/* Inheritance diagram
*
*
*
* FColorPalette
*
*
*
*
* default16ColorPalette
*
*/
//----------------------------------------------------------------------
template<typename funcT>
void FColorPalette::reset8ColorPalette (funcT set_palette)
{
reset16ColorPalette(set_palette);
}
// class default16ColorPalette
//----------------------------------------------------------------------
template<typename funcT>
void FColorPalette::reset16ColorPalette (funcT set_palette)
class default16ColorPalette final : public FColorPalette
{
set_palette (fc::Black, 0x00, 0x00, 0x00);
set_palette (fc::Blue, 0x00, 0x00, 0xaa);
set_palette (fc::Green, 0x00, 0xaa, 0x00);
set_palette (fc::Cyan, 0x00, 0x55, 0xaa);
set_palette (fc::Red, 0xaa, 0x00, 0x00);
set_palette (fc::Magenta, 0xaa, 0x00, 0xaa);
set_palette (fc::Brown, 0xaa, 0xaa, 0x00);
set_palette (fc::LightGray, 0xaa, 0xaa, 0xaa);
set_palette (fc::DarkGray, 0x55, 0x55, 0x55);
set_palette (fc::LightBlue, 0x55, 0x55, 0xff);
set_palette (fc::LightGreen, 0x55, 0xff, 0x55);
set_palette (fc::LightCyan, 0x55, 0xff, 0xff);
set_palette (fc::LightRed, 0xff, 0x55, 0x55);
set_palette (fc::LightMagenta, 0xff, 0x55, 0xff);
set_palette (fc::Yellow, 0xff, 0xff, 0x55);
set_palette (fc::White, 0xff, 0xff, 0xff);
}
public:
// Constructor
default16ColorPalette (FSetPalette);
// Destructor
~default16ColorPalette();
// Accessor
virtual const FString getClassName() const;
// Methods
void setColorPalette();
void resetColorPalette();
};
// default16ColorPalette inline functions
//----------------------------------------------------------------------
inline const FString default16ColorPalette::getClassName() const
{ return "default16ColorPalette"; }
} // namespace finalcut

View File

@ -112,12 +112,14 @@
#include <csignal>
#include <functional>
#include <map>
#include <memory>
#include <queue>
#include <utility>
#include <string>
#include <vector>
#include "final/fc.h"
#include "final/fcolorpalette.h"
#include "final/fstring.h"
#include "final/fsystem.h"
@ -125,6 +127,7 @@ namespace finalcut
{
// class forward declaration
class FColorPalette;
class FKeyboard;
class FMouseControl;
class FOptiAttr;
@ -159,6 +162,7 @@ class FTerm final
public:
// Typedef
typedef std::function<int(int)> defaultPutChar;
typedef std::shared_ptr<FColorPalette> FColorPalettePtr;
// Constructor
explicit FTerm (bool = false);
@ -173,215 +177,219 @@ class FTerm final
FTerm& operator = (const FTerm&) = delete;
// Accessors
static const FString getClassName();
static std::size_t getLineNumber();
static std::size_t getColumnNumber();
static const FString getKeyName (FKey);
static int getTTYFileDescriptor();
static const char* getTermType();
static const char* getTermFileName();
static int getTabstop();
static int getMaxColor();
charSubstitution& getCharSubstitutionMap();
static const FString getClassName();
static std::size_t getLineNumber();
static std::size_t getColumnNumber();
static const FString getKeyName (FKey);
static int getTTYFileDescriptor();
static const char* getTermType();
static const char* getTermFileName();
static int getTabstop();
static int getMaxColor();
static FColorPalettePtr& getColorPaletteTheme();
charSubstitution& getCharSubstitutionMap();
static FTermData* getFTermData();
static FSystem* getFSystem();
static FOptiMove* getFOptiMove();
static FOptiAttr* getFOptiAttr();
static FTermDetection* getFTermDetection();
static FTermXTerminal* getFTermXTerminal();
static FKeyboard* getFKeyboard();
static FMouseControl* getFMouseControl();
static FTermData* getFTermData();
static FSystem* getFSystem();
static FOptiMove* getFOptiMove();
static FOptiAttr* getFOptiAttr();
static FTermDetection* getFTermDetection();
static FTermXTerminal* getFTermXTerminal();
static FKeyboard* getFKeyboard();
static FMouseControl* getFMouseControl();
#if defined(UNIT_TEST)
static FTermLinux* getFTermLinux();
static FTermFreeBSD* getFTermFreeBSD();
static FTermOpenBSD* getFTermOpenBSD();
static FTermLinux* getFTermLinux();
static FTermFreeBSD* getFTermFreeBSD();
static FTermOpenBSD* getFTermOpenBSD();
#elif defined(__linux__)
static FTermLinux* getFTermLinux();
static FTermLinux* getFTermLinux();
#elif defined(__FreeBSD__) || defined(__DragonFly__)
static FTermFreeBSD* getFTermFreeBSD();
static FTermFreeBSD* getFTermFreeBSD();
#elif defined(__NetBSD__) || defined(__OpenBSD__)
static FTermOpenBSD* getFTermOpenBSD();
static FTermOpenBSD* getFTermOpenBSD();
#endif
#if DEBUG
static FTermDebugData& getFTermDebugData();
static FTermDebugData& getFTermDebugData();
#endif
// Inquiries
static bool isNormal (const FChar* const&);
static bool isRaw();
static bool hasUTF8();
static bool hasVT100();
static bool hasASCII();
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 hasShadowCharacter();
static bool hasHalfBlockCharacter();
static bool hasAlternateScreen();
static bool canChangeColorPalette();
static bool isNormal (const FChar* const&);
static bool isRaw();
static bool hasUTF8();
static bool hasVT100();
static bool hasASCII();
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 hasShadowCharacter();
static bool hasHalfBlockCharacter();
static bool hasAlternateScreen();
static bool canChangeColorPalette();
// Mutators
static void setFSystem (FSystem*);
static void setTermType (const char[]);
static void setInsertCursor (bool);
static void setInsertCursor();
static void unsetInsertCursor();
static void redefineDefaultColors (bool);
static void setDblclickInterval (const uInt64);
static bool setUTF8 (bool);
static bool setUTF8();
static bool unsetUTF8();
static void setFSystem (FSystem*);
static void setTermType (const char[]);
static void setInsertCursor (bool);
static void setInsertCursor();
static void unsetInsertCursor();
static void redefineDefaultColors (bool);
static void setDblclickInterval (const uInt64);
static bool setUTF8 (bool);
static bool setUTF8();
static bool unsetUTF8();
// Methods
static bool setVGAFont();
static bool setNewFont();
static bool setOldFont();
static int openConsole();
static int closeConsole();
static const char* moveCursorString (int, int, int, int);
static const char* cursorsVisibilityString (bool);
static void detectTermSize();
static void setTermSize (const FSize&);
static void setTermTitle (const FString&);
static void setKDECursor (fc::kdeKonsoleCursorShape);
static void saveColorMap();
static void resetColorMap();
static void setPalette (FColor, int, int, int);
static void setBeep (int, int);
static void resetBeep();
static void beep();
static bool setVGAFont();
static bool setNewFont();
static bool setOldFont();
static int openConsole();
static int closeConsole();
static const char* moveCursorString (int, int, int, int);
static const char* cursorsVisibilityString (bool);
static void detectTermSize();
static void setTermSize (const FSize&);
static void setTermTitle (const FString&);
static void setKDECursor (fc::kdeKonsoleCursorShape);
static void saveColorMap();
static void resetColorMap();
static void setPalette (FColor, int, int, int);
template<typename ClassT>
static void setColorPaletteTheme (FColorPalette::FSetPalette);
static void setBeep (int, int);
static void resetBeep();
static void beep();
static void setEncoding (fc::encoding);
static fc::encoding getEncoding();
static std::string getEncodingString();
static bool charEncodable (wchar_t);
static wchar_t charEncode (wchar_t);
static wchar_t charEncode (wchar_t, fc::encoding);
static void setEncoding (fc::encoding);
static fc::encoding getEncoding();
static std::string getEncodingString();
static bool charEncodable (wchar_t);
static wchar_t charEncode (wchar_t);
static wchar_t charEncode (wchar_t, fc::encoding);
static bool scrollTermForward();
static bool scrollTermReverse();
static bool scrollTermForward();
static bool scrollTermReverse();
static defaultPutChar& putchar(); // function pointer
static defaultPutChar& putchar(); // function pointer
template<typename... Args>
static void putstringf (const char[], Args&&...);
static void putstring (const char[], int = 1);
static int putchar_ASCII (int);
static int putchar_UTF8 (int);
static void putstringf (const char[], Args&&...);
static void putstring (const char[], int = 1);
static int putchar_ASCII (int);
static int putchar_UTF8 (int);
static void initScreenSettings();
static const char* changeAttribute (FChar*&, FChar*&);
static void changeTermSizeFinished();
static void exitWithMessage (const FString&)
static void initScreenSettings();
static const char* changeAttribute (FChar*&, FChar*&);
static void changeTermSizeFinished();
static void exitWithMessage (const FString&)
#if defined(__clang__) || defined(__GNUC__)
__attribute__((noreturn))
#endif
;
;
private:
// Methods
static FStartOptions& getStartOptions();
static void init_global_values (bool);
static void init_terminal_device_path();
static void oscPrefix();
static void oscPostfix();
static void init_alt_charset();
static void init_pc_charset();
static void init_cygwin_charmap();
static void init_teraterm_charmap();
static void init_fixed_max_color();
static void init_keyboard();
static void init_termcap();
static void init_quirks();
static void init_optiMove();
static void init_optiAttr();
static void init_font();
static void init_locale();
static void init_encoding();
static void init_encoding_set();
static void init_term_encoding();
static void init_individual_term_encoding();
static void init_force_vt100_encoding();
static void init_utf8_without_alt_charset();
static void init_tab_quirks();
static void init_captureFontAndTitle();
static bool hasNoFontSettingOption();
static void redefineColorPalette();
static void restoreColorPalette();
static void setInsertCursorStyle();
static void setOverwriteCursorStyle();
static const char* enableCursorString();
static const char* disableCursorString();
static void enableMouse();
static void disableMouse();
static void enableApplicationEscKey();
static void disableApplicationEscKey();
static void enableKeypad();
static void disableKeypad();
static void enableAlternateCharset();
static void useAlternateScreenBuffer();
static void useNormalScreenBuffer();
void allocationValues();
void deallocationValues();
void init (bool);
bool init_terminal();
void initOSspecifics();
void initTermspecifics();
void initBaudRate();
void finish();
void finishOSspecifics1();
void finish_encoding();
static void setSignalHandler();
static void resetSignalHandler();
static void signal_handler (int);
static FStartOptions& getStartOptions();
static void init_global_values (bool);
static void init_terminal_device_path();
static void oscPrefix();
static void oscPostfix();
static void init_alt_charset();
static void init_pc_charset();
static void init_cygwin_charmap();
static void init_teraterm_charmap();
static void init_fixed_max_color();
static void init_keyboard();
static void init_termcap();
static void init_quirks();
static void init_optiMove();
static void init_optiAttr();
static void init_font();
static void init_locale();
static void init_encoding();
static void init_encoding_set();
static void init_term_encoding();
static void init_individual_term_encoding();
static void init_force_vt100_encoding();
static void init_utf8_without_alt_charset();
static void init_tab_quirks();
static void init_captureFontAndTitle();
static bool hasNoFontSettingOption();
static void redefineColorPalette();
static void restoreColorPalette();
static void setInsertCursorStyle();
static void setOverwriteCursorStyle();
static const char* enableCursorString();
static const char* disableCursorString();
static void enableMouse();
static void disableMouse();
static void enableApplicationEscKey();
static void disableApplicationEscKey();
static void enableKeypad();
static void disableKeypad();
static void enableAlternateCharset();
static void useAlternateScreenBuffer();
static void useNormalScreenBuffer();
void allocationValues();
void deallocationValues();
void init (bool);
bool init_terminal();
void initOSspecifics();
void initTermspecifics();
void initBaudRate();
void finish();
void finishOSspecifics1();
void finish_encoding();
void destroyColorPaletteTheme();
static void setSignalHandler();
static void resetSignalHandler();
static void signal_handler (int);
// Data members
static FTermData* data;
static FSystem* fsys;
static FOptiMove* opti_move;
static FOptiAttr* opti_attr;
static FTermDetection* term_detection;
static FTermXTerminal* xterm;
static FKeyboard* keyboard;
static FMouseControl* mouse;
static FTermData* data;
static FSystem* fsys;
static FOptiMove* opti_move;
static FOptiAttr* opti_attr;
static FTermDetection* term_detection;
static FTermXTerminal* xterm;
static FKeyboard* keyboard;
static FMouseControl* mouse;
#if defined(UNIT_TEST)
#undef linux
static FTermLinux* linux;
static FTermFreeBSD* freebsd;
static FTermOpenBSD* openbsd;
static FTermLinux* linux;
static FTermFreeBSD* freebsd;
static FTermOpenBSD* openbsd;
#elif defined(__linux__)
#undef linux
static FTermLinux* linux;
static FTermLinux* linux;
#elif defined(__FreeBSD__) || defined(__DragonFly__)
static FTermFreeBSD* freebsd;
static FTermFreeBSD* freebsd;
#elif defined(__NetBSD__) || defined(__OpenBSD__)
static FTermOpenBSD* openbsd;
static FTermOpenBSD* openbsd;
#endif
#if DEBUG
static FTermDebugData* debug_data;
static FTermDebugData* debug_data;
#endif
};
@ -430,6 +438,13 @@ inline bool FTerm::setUTF8()
inline bool FTerm::unsetUTF8()
{ return setUTF8(false); }
//----------------------------------------------------------------------
template<typename ClassT>
inline void FTerm::setColorPaletteTheme (FColorPalette::FSetPalette f)
{
getColorPaletteTheme() = std::make_shared<ClassT>(f);
}
//----------------------------------------------------------------------
template<typename... Args>
inline void FTerm::putstringf (const char format[], Args&&... args)

View File

@ -146,6 +146,19 @@ class FWidgetColors
};
/* Inheritance diagram
*
*
*
* FWidgetColors
*
*
*
*
* default8ColorTheme
*
*/
//----------------------------------------------------------------------
// class default8ColorTheme
//----------------------------------------------------------------------
@ -157,13 +170,26 @@ class default8ColorTheme final : public FWidgetColors
default8ColorTheme();
// Destructor
virtual ~default8ColorTheme() override;
~default8ColorTheme() override;
// Method
void setColorTheme() override;
};
/* Inheritance diagram
*
*
*
* FWidgetColors
*
*
*
*
* default16ColorTheme
*
*/
//----------------------------------------------------------------------
// class default16ColorTheme
//----------------------------------------------------------------------
@ -175,7 +201,7 @@ class default16ColorTheme final : public FWidgetColors
default16ColorTheme();
// Destructor
virtual ~default16ColorTheme() override;
~default16ColorTheme() override;
// Method
void setColorTheme() override;