Integration of an output filter to replace missing characters
This commit is contained in:
parent
4135215df5
commit
838ba23c46
|
@ -1,5 +1,8 @@
|
|||
2019-01-02 Markus Gans <guru.mail@muenster.de>
|
||||
2019-01-03 Markus Gans <guru.mail@muenster.de>
|
||||
* Improved PC encoding for Cygwin and Linux
|
||||
* Integration of an output filter to replace missing characters
|
||||
* Better Linux console support for UTF-8 encoding
|
||||
(Default is PC charset encoding)
|
||||
|
||||
2018-12-31 Markus Gans <guru.mail@muenster.de>
|
||||
* Use the override specifier
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2018 Markus Gans *
|
||||
* Copyright 2017-2019 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 *
|
||||
|
@ -324,7 +324,7 @@ class MouseDraw : public finalcut::FDialog
|
|||
MouseDraw& operator = (const MouseDraw&) = delete;
|
||||
|
||||
// Methods
|
||||
void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
void setGeometry (int, int, std::size_t, std::size_t, bool = true) override;
|
||||
|
||||
// Event handlers
|
||||
virtual void onAccel (finalcut::FAccelEvent*) override;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2018 Markus Gans *
|
||||
* Copyright 2017-2019 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 *
|
||||
|
@ -46,7 +46,7 @@ class Scrollview : public finalcut::FScrollView
|
|||
Scrollview& operator = (const Scrollview&) = delete;
|
||||
|
||||
// Mutator
|
||||
void setScrollSize (std::size_t, std::size_t);
|
||||
void setScrollSize (std::size_t, std::size_t) override;
|
||||
|
||||
private:
|
||||
// Method
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2018 Markus Gans *
|
||||
* Copyright 2017-2019 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 *
|
||||
|
@ -134,7 +134,7 @@ class Treeview : public finalcut::FDialog
|
|||
virtual void adjustSize() override;
|
||||
|
||||
// Event handler
|
||||
void onClose (finalcut::FCloseEvent*);
|
||||
void onClose (finalcut::FCloseEvent*) override;
|
||||
|
||||
// Data Members
|
||||
bool initialized{false};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* 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 *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -1358,7 +1358,7 @@ inline void FMenu::drawCheckMarkPrefix (FMenuItem* menuitem)
|
|||
if ( isNewFont() )
|
||||
print (fc::NF_Bullet); // NF_Bullet ●
|
||||
else
|
||||
print (fc::Bullet); // Bullet ●
|
||||
print (fc::BlackCircle); // BlackCircle ●
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1396,7 +1396,7 @@ inline void FMenu::drawMenuText (menuText& data)
|
|||
if ( ! isNewFont()
|
||||
&& ( int(data.text[z]) < fc::NF_rev_left_arrow2
|
||||
|| int(data.text[z]) > fc::NF_check_mark )
|
||||
&& ! charEncodable(uInt(data.text[z])) )
|
||||
&& ! charEncodable(wchar_t(data.text[z])) )
|
||||
{
|
||||
data.text[z] = L' ';
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -758,7 +758,7 @@ uChar FTerm::unicode_to_cp437 (wchar_t ucs)
|
|||
{
|
||||
if ( fc::cp437_to_ucs[i][UNICODE] == ucs ) // found
|
||||
{
|
||||
c = fc::cp437_to_ucs[i][CP437];
|
||||
c = uChar(fc::cp437_to_ucs[i][CP437]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -987,7 +987,7 @@ void FTerm::init_alt_charset()
|
|||
{
|
||||
// Read the used VT100 pairs
|
||||
|
||||
std::map<uChar, uChar> vt100_alt_char;
|
||||
std::unordered_map<uChar, uChar> vt100_alt_char;
|
||||
|
||||
if ( TCAP(fc::t_acs_chars) )
|
||||
{
|
||||
|
@ -1902,6 +1902,7 @@ void FTerm::init (bool disable_alt_screen)
|
|||
void FTerm::initOSspecifics()
|
||||
{
|
||||
#if defined(__linux__)
|
||||
linux->setFTermData(data);
|
||||
linux->setFTermDetection(term_detection);
|
||||
linux->init(); // Initialize Linux console
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* 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 *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -24,7 +24,7 @@
|
|||
#undef __STRICT_ANSI__ // need for fileno
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "final/ftermios.h"
|
||||
#include "final/fterm.h"
|
||||
|
@ -209,7 +209,7 @@ bool FTermios::setRawMode (bool enable)
|
|||
//----------------------------------------------------------------------
|
||||
uInt FTermios::getBaudRate()
|
||||
{
|
||||
std::map<speed_t, uInt> outspeed;
|
||||
std::unordered_map<speed_t, uInt> outspeed;
|
||||
outspeed[B0] = 0; // hang up
|
||||
outspeed[B50] = 50; // 50 baud
|
||||
outspeed[B75] = 75; // 75 baud
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace finalcut
|
|||
bool FTermLinux::half_block_character = true;
|
||||
bool FTermLinux::has_saved_palette = false;
|
||||
|
||||
FTermData* FTermLinux::fterm_data = nullptr;
|
||||
FTermDetection* FTermLinux::term_detection = nullptr;
|
||||
fc::linuxConsoleCursorStyle FTermLinux::linux_console_cursor_style;
|
||||
FTermLinux::ColorMap FTermLinux::saved_color_map;
|
||||
|
@ -200,12 +201,27 @@ void FTermLinux::initCharMap (uInt char_map[][fc::NUM_OF_ENCODINGS])
|
|||
{
|
||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++ )
|
||||
{
|
||||
wchar_t ucs = char_map[i][fc::UTF8];
|
||||
auto ucs = wchar_t(char_map[i][fc::UTF8]);
|
||||
sInt16 fontpos = getFontPos(ucs);
|
||||
|
||||
// Fix for a non-cp437 Linux console with PC charset encoding
|
||||
if ( fontpos > 255 || fontpos == NOT_FOUND )
|
||||
char_map[i][fc::PC] = char_map[i][fc::ASCII];
|
||||
|
||||
// Character substitutions for missing characters
|
||||
if ( fontpos == NOT_FOUND )
|
||||
{
|
||||
characterFallback (ucs, { L'▲', L'↑', L'^' });
|
||||
characterFallback (ucs, { L'▼', L'↓', L'v' });
|
||||
characterFallback (ucs, { L'►', L'▶', L'→', L'>' });
|
||||
characterFallback (ucs, { L'◄', L'◀', L'←', L'<' });
|
||||
characterFallback (ucs, { L'●', L'◆', L'⬤', L'*' });
|
||||
characterFallback (ucs, { L'•', L'●', L'◆', L'⬤', L'*' });
|
||||
characterFallback (ucs, { L'×', L'❌', L'x' });
|
||||
characterFallback (ucs, { L'÷', L'➗', L'/' });
|
||||
characterFallback (ucs, { L'√', L'✓', L'x' });
|
||||
characterFallback (ucs, { L'ˣ', L'ⁿ', L'ˆ', L'`' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -856,14 +872,14 @@ bool FTermLinux::resetVGAPalette()
|
|||
{
|
||||
rgb defaultColor[16] =
|
||||
{
|
||||
{0x00, 0x00, 0x00}, {0xAA, 0x00, 0x00},
|
||||
{0x00, 0xAA, 0x00}, {0xAA, 0x55, 0x00},
|
||||
{0x00, 0x00, 0xAA}, {0xAA, 0x00, 0xAA},
|
||||
{0x00, 0xAA, 0xAA}, {0xAA, 0xAA, 0xAA},
|
||||
{0x55, 0x55, 0x55}, {0xFF, 0x55, 0x55},
|
||||
{0x55, 0xFF, 0x55}, {0xFF, 0xFF, 0x55},
|
||||
{0x55, 0x55, 0xFF}, {0xFF, 0x55, 0xFF},
|
||||
{0x55, 0xFF, 0xFF}, {0xFF, 0xFF, 0xFF}
|
||||
{0x00, 0x00, 0x00}, {0xaa, 0x00, 0x00},
|
||||
{0x00, 0xaa, 0x00}, {0xaa, 0x55, 0x00},
|
||||
{0x00, 0x00, 0xaa}, {0xaa, 0x00, 0xaa},
|
||||
{0x00, 0xaa, 0xaa}, {0xaa, 0xaa, 0xaa},
|
||||
{0x55, 0x55, 0x55}, {0xff, 0x55, 0x55},
|
||||
{0x55, 0xff, 0x55}, {0xff, 0xff, 0x55},
|
||||
{0x55, 0x55, 0xff}, {0xff, 0x55, 0xff},
|
||||
{0x55, 0xff, 0xff}, {0xff, 0xff, 0xff}
|
||||
};
|
||||
|
||||
for (std::size_t index = 0; index < 16; index++)
|
||||
|
@ -1164,9 +1180,9 @@ FKey FTermLinux::shiftCtrlAltKeyCorrection (const FKey& key_id)
|
|||
//----------------------------------------------------------------------
|
||||
inline void FTermLinux::initSpecialCharacter()
|
||||
{
|
||||
uInt c1 = fc::UpperHalfBlock;
|
||||
uInt c2 = fc::LowerHalfBlock;
|
||||
uInt c3 = fc::FullBlock;
|
||||
wchar_t c1 = fc::UpperHalfBlock;
|
||||
wchar_t c2 = fc::LowerHalfBlock;
|
||||
wchar_t c3 = fc::FullBlock;
|
||||
|
||||
if ( FTerm::charEncode(c1, fc::PC) == FTerm::charEncode(c1, fc::ASCII)
|
||||
|| FTerm::charEncode(c2, fc::PC) == FTerm::charEncode(c2, fc::ASCII)
|
||||
|
@ -1175,8 +1191,8 @@ inline void FTermLinux::initSpecialCharacter()
|
|||
shadow_character = false;
|
||||
}
|
||||
|
||||
uInt c4 = fc::RightHalfBlock;
|
||||
uInt c5 = fc::LeftHalfBlock;
|
||||
wchar_t c4 = fc::RightHalfBlock;
|
||||
wchar_t c5 = fc::LeftHalfBlock;
|
||||
|
||||
if ( FTerm::charEncode(c4, fc::PC) == FTerm::charEncode(c4, fc::ASCII)
|
||||
|| FTerm::charEncode(c5, fc::PC) == FTerm::charEncode(c5, fc::ASCII) )
|
||||
|
@ -1191,12 +1207,34 @@ sInt16 FTermLinux::getFontPos (wchar_t ucs)
|
|||
for (std::size_t n = 0; n < screen_unicode_map.entry_ct; n++)
|
||||
{
|
||||
if ( screen_unicode_map.entries[n].unicode == ucs )
|
||||
return screen_unicode_map.entries[n].fontpos;
|
||||
return sInt16(screen_unicode_map.entries[n].fontpos);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermLinux::characterFallback ( wchar_t ucs
|
||||
, std::vector<wchar_t> fallback )
|
||||
{
|
||||
constexpr sInt16 NOT_FOUND = -1;
|
||||
characterSub& sub_map = fterm_data->getCharSubstitutionMap();
|
||||
|
||||
if ( fallback.size() < 2 || ucs != fallback[0] )
|
||||
return;
|
||||
|
||||
for (auto iter = fallback.begin() + 1; iter != fallback.end(); iter++)
|
||||
{
|
||||
sInt16 pos = getFontPos(*iter);
|
||||
|
||||
if ( pos != NOT_FOUND )
|
||||
{
|
||||
sub_map[ucs] = *iter;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // defined(__linux__)
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -2799,8 +2799,8 @@ inline void FVTerm::appendChar (charData*& next_char)
|
|||
{
|
||||
newFontChanges (next_char);
|
||||
charsetChanges (next_char);
|
||||
|
||||
appendAttributes (next_char);
|
||||
characterFilter (next_char);
|
||||
appendOutputBuffer (next_char->encoded_code);
|
||||
}
|
||||
|
||||
|
@ -2878,6 +2878,15 @@ int FVTerm::appendLowerRight (charData*& screen_char)
|
|||
return screen_char->code;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FVTerm::characterFilter (charData*& next_char)
|
||||
{
|
||||
FTerm::characterSub& sub_map = fterm->getCharSubstitutionMap();
|
||||
|
||||
if ( sub_map[next_char->encoded_code] )
|
||||
next_char->encoded_code = sub_map[next_char->encoded_code];
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FVTerm::appendOutputBuffer (const std::string& s)
|
||||
{
|
||||
|
|
|
@ -163,6 +163,7 @@ enum SpecialCharacter : wchar_t
|
|||
BlackVerticalRectangle = 0x25ae, // ▮ (1)
|
||||
SmallBullet = 0x00b7, // ·
|
||||
BlackDiamondSuit = 0x2666, // ◆
|
||||
BlackCircle = 0x25cf, // ●
|
||||
SymbolForNewline = 0x2424, //  (1)
|
||||
SymbolForVerticalTab = 0x240b, // ␋ (1)
|
||||
SymbolForHorizontalTab = 0x2409, // ␉ (1)
|
||||
|
|
|
@ -68,6 +68,7 @@ static uInt character[][fc::NUM_OF_ENCODINGS] =
|
|||
{0x00b0, 'f', 0xb0, 'o'}, // ° - Degree
|
||||
{0x2022, '`', 0x04, '*'}, // • - Bullet
|
||||
{0x00b7, '`', 0xfa, '.'}, // · - small Bullet
|
||||
{0x25cf, '`', 0x04, '*'}, // ● - BlackCircle
|
||||
{0x2666, '`', 0x04, '*'}, // ◆ - BlackDiamondSuit
|
||||
{0x2424, 'h', ' ', ' '}, //  - SymbolForNewline (1)
|
||||
{0x240b, 'i', ' ', ' '}, // ␋ - SymbolForVerticalTab (1)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* 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 *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -92,7 +92,7 @@ class FCheckMenuItem : public FMenuItem
|
|||
// Methods
|
||||
void init (FWidget*);
|
||||
void processToggle();
|
||||
void processClicked();
|
||||
virtual void processClicked() override;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2018 Markus Gans *
|
||||
* Copyright 2017-2019 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 *
|
||||
|
@ -215,7 +215,7 @@ class FListViewIterator
|
|||
bool operator != (const FListViewIterator&) const;
|
||||
|
||||
// Accessor
|
||||
virtual const char* getClassName() const;
|
||||
const char* getClassName() const;
|
||||
int getPosition() const;
|
||||
|
||||
// Methods
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* 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 *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -202,7 +202,7 @@ class FMouseGPM : public FMouse
|
|||
virtual ~FMouseGPM();
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
// Mutators
|
||||
void setStdinNo(int);
|
||||
|
@ -274,7 +274,7 @@ class FMouseX11 : public FMouse
|
|||
virtual ~FMouseX11() = default;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
// Inquiry
|
||||
virtual bool hasData() override;
|
||||
|
@ -337,7 +337,7 @@ class FMouseSGR : public FMouse
|
|||
virtual ~FMouseSGR() = default;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
// Inquiry
|
||||
virtual bool hasData() override;
|
||||
|
@ -400,7 +400,7 @@ class FMouseUrxvt : public FMouse
|
|||
virtual ~FMouseUrxvt() = default;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
virtual const char* getClassName() const override;
|
||||
|
||||
// Inquiry
|
||||
virtual bool hasData() override;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* 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 *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -92,7 +92,7 @@ class FRadioMenuItem : public FMenuItem
|
|||
// Methods
|
||||
void init (FWidget*);
|
||||
void processToggle();
|
||||
void processClicked();
|
||||
virtual void processClicked() override;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2017-2018 Markus Gans *
|
||||
* Copyright 2017-2019 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 *
|
||||
|
@ -147,7 +147,7 @@ class FScrollView : public FWidget
|
|||
using FVTerm::clearArea;
|
||||
|
||||
// Accessor
|
||||
term_area* getPrintArea();
|
||||
virtual term_area* getPrintArea() override;
|
||||
|
||||
// Method
|
||||
virtual void adjustSize() override;
|
||||
|
|
|
@ -156,6 +156,7 @@ class FTerm
|
|||
public:
|
||||
// Typedefs
|
||||
typedef FOptiAttr::charData charData;
|
||||
typedef FTermData::characterSub characterSub;
|
||||
|
||||
struct initializationValues; // forward declaration
|
||||
|
||||
|
@ -185,6 +186,7 @@ class FTerm
|
|||
static int getTabstop();
|
||||
static int getMaxColor();
|
||||
initializationValues& getInitValues();
|
||||
characterSub& getCharSubstitutionMap();
|
||||
|
||||
#if DEBUG
|
||||
FTermDebugData& getFTermDebugData();
|
||||
|
@ -452,6 +454,10 @@ inline int FTerm::getMaxColor()
|
|||
inline FTerm::initializationValues& FTerm::getInitValues()
|
||||
{ return init_values; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FTerm::characterSub& FTerm::getCharSubstitutionMap()
|
||||
{ return data->getCharSubstitutionMap(); }
|
||||
|
||||
#if DEBUG
|
||||
//----------------------------------------------------------------------
|
||||
inline FTermDebugData& FTerm::getFTermDebugData()
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2016-2018 Markus Gans *
|
||||
* Copyright 2016-2019 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 *
|
||||
|
@ -93,7 +93,7 @@ class FTermcap
|
|||
~FTermcap() = default;
|
||||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
const char* getClassName() const;
|
||||
|
||||
static tcap_map* getTermcapMap()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* 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 *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -35,7 +35,7 @@
|
|||
#error "Only <final/final.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
|
||||
#include "final/fc.h"
|
||||
|
@ -57,7 +57,8 @@ class FTermData
|
|||
{
|
||||
public:
|
||||
// Typedefs
|
||||
typedef std::map<std::string, fc::encoding> encodingMap;
|
||||
typedef std::unordered_map<std::string, fc::encoding> encodingMap;
|
||||
typedef std::unordered_map<wchar_t, wchar_t> characterSub;
|
||||
|
||||
// Constructors
|
||||
FTermData() = default;
|
||||
|
@ -74,6 +75,7 @@ class FTermData
|
|||
// Accessors
|
||||
const char* getClassName() const;
|
||||
encodingMap& getEncodingList();
|
||||
characterSub& getCharSubstitutionMap();
|
||||
fc::encoding getTermEncoding() const;
|
||||
FRect& getTermGeometry();
|
||||
int getTTYFileDescriptor() const;
|
||||
|
@ -129,6 +131,7 @@ class FTermData
|
|||
private:
|
||||
// Data Members
|
||||
encodingMap encoding_list{};
|
||||
characterSub char_substitution_map{};
|
||||
fc::encoding term_encoding{fc::UNKNOWN};
|
||||
FRect term_geometry{}; // current terminal geometry
|
||||
int fd_tty{-1}; // Teletype (tty) file descriptor is still undefined
|
||||
|
@ -166,6 +169,10 @@ inline const char* FTermData::getClassName() const
|
|||
inline FTermData::encodingMap& FTermData::getEncodingList()
|
||||
{ return encoding_list; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FTermData::characterSub& FTermData::getCharSubstitutionMap()
|
||||
{ return char_substitution_map; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline fc::encoding FTermData::getTermEncoding() const
|
||||
{ return term_encoding; }
|
||||
|
|
|
@ -87,6 +87,7 @@ class FTermLinux
|
|||
static int getFramebufferBpp();
|
||||
|
||||
// Mutators
|
||||
static void setFTermData (FTermData*);
|
||||
static void setFTermDetection (FTermDetection*);
|
||||
static char* setCursorStyle (fc::linuxConsoleCursorStyle, bool);
|
||||
static bool setPalette (FColor, int, int, int);
|
||||
|
@ -136,6 +137,8 @@ class FTermLinux
|
|||
rgb color[16];
|
||||
} ColorMap;
|
||||
|
||||
typedef FTermData::characterSub characterSub;
|
||||
|
||||
// Accessors
|
||||
static int getFramebuffer_bpp();
|
||||
static bool getScreenFont();
|
||||
|
@ -168,6 +171,7 @@ class FTermLinux
|
|||
static FKey shiftCtrlAltKeyCorrection (const FKey&);
|
||||
static sInt16 getFontPos (wchar_t ucs);
|
||||
static void initSpecialCharacter();
|
||||
static void characterFallback (wchar_t, std::vector<wchar_t>);
|
||||
|
||||
// Data Members
|
||||
#if defined(__linux__)
|
||||
|
@ -176,6 +180,7 @@ class FTermLinux
|
|||
static bool shadow_character;
|
||||
static bool half_block_character;
|
||||
static bool has_saved_palette;
|
||||
static FTermData* fterm_data;
|
||||
static FTermDetection* term_detection;
|
||||
static fc::linuxConsoleCursorStyle
|
||||
linux_console_cursor_style;
|
||||
|
@ -198,6 +203,10 @@ inline const char* FTermLinux::getClassName() const
|
|||
inline int FTermLinux::getFramebufferBpp()
|
||||
{ return framebuffer_bpp; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTermLinux::setFTermData (FTermData* data)
|
||||
{ fterm_data = data; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FTermLinux::setFTermDetection (FTermDetection* td)
|
||||
{ term_detection = td; }
|
||||
|
|
|
@ -315,7 +315,7 @@ class FVTerm
|
|||
virtual term_area* getPrintArea();
|
||||
std::size_t getLineNumber();
|
||||
std::size_t getColumnNumber();
|
||||
static bool charEncodable (uInt);
|
||||
static bool charEncodable (wchar_t);
|
||||
static FKeyboard* getKeyboard();
|
||||
static FMouseControl* getMouseControl();
|
||||
FTerm::initializationValues& getInitValues();
|
||||
|
@ -486,6 +486,7 @@ class FVTerm
|
|||
void appendChar (charData*&);
|
||||
void appendAttributes (charData*&);
|
||||
int appendLowerRight (charData*&);
|
||||
static void characterFilter (charData*&);
|
||||
static void appendOutputBuffer (const std::string&);
|
||||
static void appendOutputBuffer (const char[]);
|
||||
|
||||
|
@ -1071,7 +1072,7 @@ inline std::size_t FVTerm::getColumnNumber()
|
|||
{ return FTerm::getColumnNumber(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FVTerm::charEncodable (uInt c)
|
||||
inline bool FVTerm::charEncodable (wchar_t c)
|
||||
{ return FTerm::charEncodable(c); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* 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 *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -362,10 +362,10 @@ class FWidget : public FVTerm, public FObject
|
|||
typedef std::vector<member_callback_data> MemberCallbackObjects;
|
||||
|
||||
// Accessor
|
||||
term_area* getPrintArea();
|
||||
void addPreprocessingHandler ( FVTerm*
|
||||
, FPreprocessingHandler );
|
||||
void delPreprocessingHandler (FVTerm*);
|
||||
virtual term_area* getPrintArea() override;
|
||||
virtual void addPreprocessingHandler ( FVTerm*
|
||||
, FPreprocessingHandler ) override;
|
||||
virtual void delPreprocessingHandler (FVTerm*) override;
|
||||
|
||||
// Inquiry
|
||||
bool isChildPrintArea() const;
|
||||
|
@ -381,7 +381,7 @@ class FWidget : public FVTerm, public FObject
|
|||
virtual bool focusPrevChild(); // ...focus
|
||||
|
||||
// Event handlers
|
||||
virtual bool event (FEvent*);
|
||||
virtual bool event (FEvent*) override;
|
||||
virtual void onKeyPress (FKeyEvent*);
|
||||
virtual void onKeyUp (FKeyEvent*);
|
||||
virtual void onKeyDown (FKeyEvent*);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* 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 *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -153,6 +153,20 @@ void FTermDataTest::dataTest()
|
|||
data.setTermEncoding(finalcut::fc::UNKNOWN);
|
||||
CPPUNIT_ASSERT ( data.getTermEncoding() == finalcut::fc::UNKNOWN );
|
||||
|
||||
CPPUNIT_ASSERT ( data.getCharSubstitutionMap().size() == 0 );
|
||||
auto& character_map = data.getCharSubstitutionMap();
|
||||
character_map[L'€'] = 'E';
|
||||
character_map[L'µ'] = L'u';
|
||||
character_map[finalcut::fc::Bullet] = '*';
|
||||
character_map[finalcut::fc::FullBlock] = finalcut::fc::MediumShade;
|
||||
auto& char_map = data.getCharSubstitutionMap();
|
||||
CPPUNIT_ASSERT ( char_map.size() == 4 );
|
||||
CPPUNIT_ASSERT ( char_map[L'€'] == 'E' );
|
||||
CPPUNIT_ASSERT ( char_map[L'µ'] == L'u' );
|
||||
CPPUNIT_ASSERT ( char_map[finalcut::fc::Bullet] == '*' );
|
||||
CPPUNIT_ASSERT ( char_map[finalcut::fc::FullBlock]
|
||||
== finalcut::fc::MediumShade );
|
||||
|
||||
CPPUNIT_ASSERT ( data.getTermGeometry() == finalcut::FRect() );
|
||||
data.getTermGeometry().setSize(10, 10);
|
||||
data.getTermGeometry().setPos(3, 5);
|
||||
|
|
Loading…
Reference in New Issue