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> 2020-05-26 Markus Gans <guru.mail@muenster.de>
* FWidgetColors now uses polymorphism, so you can now easily * FWidgetColors now uses polymorphism, so you can now easily
create your own widget color theme create your own widget color theme

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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