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