Compile fix for some architectures
This commit is contained in:
parent
762b232fd0
commit
7499f424dc
|
@ -1,3 +1,9 @@
|
|||
2019-10-13 Markus Gans <guru.mail@muenster.de>
|
||||
* Compile fix for Cygwin and Linux on arm architectures
|
||||
* A small color palette optimization
|
||||
* Corrected east asian ambiguous character width for OpenBSD, NetBSD,
|
||||
FreeBSD and Solaris
|
||||
|
||||
2019-10-05 Markus Gans <guru.mail@muenster.de>
|
||||
* Internal redesign of the callback call
|
||||
* Mapping of key functions in an associative container to simplify
|
||||
|
|
|
@ -126,12 +126,10 @@ void CheckList::populate()
|
|||
{ "Lemons", "Low" }
|
||||
};
|
||||
|
||||
constexpr int lastItem = int(sizeof(list) / sizeof(list[0])) - 1;
|
||||
|
||||
for (int i{0}; i <= lastItem; i++)
|
||||
for (const auto& line : list)
|
||||
{
|
||||
const finalcut::FStringList line (&list[i][0], &list[i][0] + 2);
|
||||
auto iter = listView.insert (line);
|
||||
const finalcut::FStringList string_line (&line[0], &line[0] + 2);
|
||||
auto iter = listView.insert (string_line);
|
||||
auto item = static_cast<finalcut::FListViewItem*>(*iter);
|
||||
item->setCheckable(true);
|
||||
}
|
||||
|
|
|
@ -173,11 +173,9 @@ void Listview::populate()
|
|||
{ "Zurich", "Mostly Cloudy", "23°C", "44%", "1023.7 mb" }
|
||||
};
|
||||
|
||||
constexpr int lastItem = int(sizeof(weather) / sizeof(weather[0])) - 1;
|
||||
|
||||
for (int i{0}; i <= lastItem; i++)
|
||||
for (const auto& place : weather)
|
||||
{
|
||||
finalcut::FStringList line (&weather[i][0], &weather[i][0] + 5);
|
||||
finalcut::FStringList line (&place[0], &place[0] + 5);
|
||||
listView.insert (line);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,8 +44,6 @@ void string();
|
|||
|
||||
struct data
|
||||
{
|
||||
static int getNumberOfItems();
|
||||
|
||||
struct alignas(alignof(std::string)) termcap_string
|
||||
{
|
||||
const std::string name;
|
||||
|
@ -144,13 +142,6 @@ data::termcap_string data::strings[] =
|
|||
{ "t_key_mouse", fc::t_key_mouse }
|
||||
};
|
||||
|
||||
// data inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline int data::getNumberOfItems()
|
||||
{
|
||||
return int ( sizeof(strings) / sizeof(strings[0]) ) - 1;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Functions
|
||||
|
@ -290,10 +281,10 @@ void string()
|
|||
finalcut::FTermcap::tcap_map (&tcap_strings)[] \
|
||||
= finalcut::FTermcap::strings;
|
||||
|
||||
for (int n{0}; n <= data::getNumberOfItems(); n++ )
|
||||
for (const auto& entry : data::strings)
|
||||
{
|
||||
const std::string name = data::strings[n].name;
|
||||
const fc::termcaps cap = data::strings[n].cap;
|
||||
const std::string name = entry.name;
|
||||
const fc::termcaps cap = entry.cap;
|
||||
tcapString (name, tcap_strings[cap].string);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -322,7 +322,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
|||
listView.setTreeView();
|
||||
|
||||
// Populate FListView with a list of items
|
||||
static TreeItem continent[] =
|
||||
static TreeItem continent_list[] =
|
||||
{
|
||||
{ "Africa", "944,000,000", "31.2", africa },
|
||||
{ "Asia", "4,010,000,000", "90.3", asia },
|
||||
|
@ -330,17 +330,14 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
|||
{ "North America", "523,000,000", "21", north_america },
|
||||
{ "South America", "381,000,000", "21.4", south_america },
|
||||
{ "Antarctica", "1000", "0", 0 },
|
||||
{ "Australia/Oceania", "34,000,000", "4", oceania },
|
||||
{ 0, 0, 0, 0 }
|
||||
{ "Australia/Oceania", "34,000,000", "4", oceania }
|
||||
};
|
||||
|
||||
auto continent_list = continent;
|
||||
|
||||
while ( continent_list->name )
|
||||
for (const auto& continent : continent_list)
|
||||
{
|
||||
auto& country_list = continent_list->child_element;
|
||||
finalcut::FStringList continent_line ( continent_list->begin()
|
||||
, continent_list->end() );
|
||||
TreeItem* country_list = continent.child_element;
|
||||
finalcut::FStringList continent_line ( continent.begin()
|
||||
, continent.end() );
|
||||
const auto& iter = listView.insert (continent_line);
|
||||
|
||||
while ( country_list && country_list->name )
|
||||
|
@ -350,8 +347,6 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
|||
listView.insert (country_line, iter);
|
||||
country_list++;
|
||||
}
|
||||
|
||||
continent_list++;
|
||||
}
|
||||
|
||||
// Quit button
|
||||
|
|
|
@ -467,7 +467,7 @@ const std::size_t lastCP437Item = \
|
|||
std::size_t((sizeof(cp437_ucs) / sizeof(cp437_ucs[0])) - 1);
|
||||
|
||||
// Based on http://www.unicode.org/charts/PDF/UFF00.pdf
|
||||
wchar_t halfWidth_fullWidth[][2] =
|
||||
const wchar_t halfWidth_fullWidth[][2] =
|
||||
{
|
||||
// Fullwidth ASCII variants
|
||||
{0x0020, 0x3000}, // ' ' -> ' '
|
||||
|
|
|
@ -37,18 +37,18 @@ FColorPalette::~FColorPalette() // destructor
|
|||
void FColorPalette::set8ColorPalette (funcp setPalette)
|
||||
{
|
||||
setPalette (fc::Black, 0x00, 0x00, 0x00);
|
||||
setPalette (fc::Blue, 0x22, 0x22, 0xb2);
|
||||
setPalette (fc::Blue, 0x10, 0x3b, 0x9e);
|
||||
setPalette (fc::Green, 0x18, 0x78, 0x18);
|
||||
setPalette (fc::Cyan, 0x66, 0x66, 0xff);
|
||||
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, 0x22, 0x22, 0xb2);
|
||||
setPalette (fc::LightBlue, 0x10, 0x3b, 0x9e);
|
||||
setPalette (fc::LightGreen, 0x18, 0x78, 0x18);
|
||||
setPalette (fc::LightCyan, 0x66, 0x66, 0xff);
|
||||
setPalette (fc::Cyan, 0xa0, 0xb2, 0xb2);
|
||||
setPalette (fc::LightRed, 0xb2, 0x18, 0x18);
|
||||
setPalette (fc::LightMagenta, 0xb2, 0x18, 0xb2);
|
||||
setPalette (fc::Yellow, 0xe8, 0x87, 0x1f);
|
||||
|
@ -59,9 +59,9 @@ void FColorPalette::set8ColorPalette (funcp setPalette)
|
|||
void FColorPalette::set16ColorPalette (funcp setPalette)
|
||||
{
|
||||
setPalette (fc::Black, 0x00, 0x00, 0x00);
|
||||
setPalette (fc::Blue, 0x22, 0x22, 0xb2);
|
||||
setPalette (fc::Blue, 0x10, 0x3b, 0x9e);
|
||||
setPalette (fc::Green, 0x18, 0x78, 0x18);
|
||||
setPalette (fc::Cyan, 0x4a, 0x4a, 0xe4);
|
||||
setPalette (fc::Cyan, 0x55, 0x6a, 0xcf);
|
||||
setPalette (fc::Red, 0xba, 0x1a, 0x1a);
|
||||
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
|
||||
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <strings.h> // need for strcasecmp
|
||||
#endif
|
||||
|
||||
#include <pwd.h>
|
||||
#include <vector>
|
||||
|
||||
#include "final/fevent.h"
|
||||
|
@ -92,6 +91,7 @@ const FString fileChooser ( FWidget* parent
|
|||
// static class attributes
|
||||
FSystem* FFileDialog::fsystem{nullptr};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FFileDialog
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -474,8 +474,8 @@ void FLabel::printLine (FString&& line)
|
|||
{
|
||||
if ( ! std::iswprint(std::wint_t(line[z])) )
|
||||
{
|
||||
if ( ! isNewFont() && ( int(line[z]) < fc::NF_rev_left_arrow2
|
||||
|| int(line[z]) > fc::NF_check_mark ) )
|
||||
if ( ! isNewFont() && ( line[z] < fc::NF_rev_left_arrow2
|
||||
|| line[z] > fc::NF_check_mark ) )
|
||||
{
|
||||
line[z] = L' ';
|
||||
}
|
||||
|
|
|
@ -1334,8 +1334,8 @@ inline void FMenu::drawMenuText (menuText& data)
|
|||
if ( ! std::iswprint(std::wint_t(data.text[z])) )
|
||||
{
|
||||
if ( ! isNewFont()
|
||||
&& ( int(data.text[z]) < fc::NF_rev_left_arrow2
|
||||
|| int(data.text[z]) > fc::NF_check_mark )
|
||||
&& ( data.text[z] < fc::NF_rev_left_arrow2
|
||||
|| data.text[z] > fc::NF_check_mark )
|
||||
&& ! charEncodable(wchar_t(data.text[z])) )
|
||||
{
|
||||
data.text[z] = L' ';
|
||||
|
|
|
@ -599,8 +599,8 @@ inline void FMenuBar::drawMenuText (menuText& data)
|
|||
if ( ! std::iswprint(std::wint_t(data.text[z])) )
|
||||
{
|
||||
if ( ! isNewFont()
|
||||
&& ( int(data.text[z]) < fc::NF_rev_left_arrow2
|
||||
|| int(data.text[z]) > fc::NF_check_mark ) )
|
||||
&& ( data.text[z] < fc::NF_rev_left_arrow2
|
||||
|| data.text[z] > fc::NF_check_mark ) )
|
||||
{
|
||||
data.text[z] = L' ';
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
#include "final/fconfig.h" // need for getpwuid_r and realpath
|
||||
#endif
|
||||
|
||||
#include "final/fsystemimpl.h"
|
||||
|
||||
namespace finalcut
|
||||
|
@ -38,5 +42,19 @@ FSystemImpl::FSystemImpl()
|
|||
FSystemImpl::~FSystemImpl() // destructor
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FSystemImpl::getpwuid_r ( uid_t uid, struct passwd* pwd
|
||||
, char* buf, size_t buflen
|
||||
, struct passwd** result )
|
||||
{
|
||||
return ::getpwuid_r (uid, pwd, buf, buflen, result);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
char* FSystemImpl::realpath (const char* path, char* resolved_path)
|
||||
{
|
||||
return ::realpath(path, resolved_path);
|
||||
}
|
||||
|
||||
} // namespace finalcut
|
||||
|
||||
|
|
|
@ -20,6 +20,12 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
#include "final/fconfig.h" // includes _GNU_SOURCE for wcwidth()
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "final/fcharmap.h"
|
||||
#include "final/fterm.h"
|
||||
#include "final/ftermbuffer.h"
|
||||
|
@ -47,6 +53,130 @@ uInt env2uint (const char* env)
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool hasAmbiguousWidth (wchar_t wchar)
|
||||
{
|
||||
const wchar_t ambiguous_width_list[] =
|
||||
{
|
||||
0x00a1, 0x00a4, 0x00a7, 0x00a8, 0x00aa, 0x00ad, 0x00ae, 0x00b0,
|
||||
0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b6, 0x00b7, 0x00b8, 0x00b9,
|
||||
0x00ba, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00c6, 0x00d0, 0x00d7,
|
||||
0x00d8, 0x00de, 0x00df, 0x00e0, 0x00e1, 0x00e6, 0x00e8, 0x00e9,
|
||||
0x00ea, 0x00ec, 0x00ed, 0x00f0, 0x00f2, 0x00f3, 0x00f7, 0x00f8,
|
||||
0x00f9, 0x00fa, 0x00fc, 0x00fe, 0x0101, 0x0111, 0x0113, 0x011b,
|
||||
0x0126, 0x0127, 0x012b, 0x0131, 0x0132, 0x0133, 0x0138, 0x013f,
|
||||
0x0140, 0x0141, 0x0142, 0x0144, 0x0148, 0x0149, 0x014a, 0x014b,
|
||||
0x014d, 0x0152, 0x0153, 0x0166, 0x0167, 0x016b, 0x01ce, 0x01d0,
|
||||
0x01d2, 0x01d4, 0x01d6, 0x01d8, 0x01da, 0x01dc, 0x0251, 0x0261,
|
||||
0x02c4, 0x02c7, 0x02c9, 0x02ca, 0x02cb, 0x02cd, 0x02d0, 0x02d8,
|
||||
0x02d9, 0x02da, 0x02db, 0x02dd, 0x02df, 0x0300, 0x0301, 0x0302,
|
||||
0x0303, 0x0304, 0x0305, 0x0306, 0x0307, 0x0308, 0x0309, 0x030a,
|
||||
0x030b, 0x030c, 0x030d, 0x030f, 0x0310, 0x0311, 0x0312, 0x0313,
|
||||
0x0314, 0x0315, 0x0316, 0x0317, 0x0318, 0x0319, 0x031a, 0x031b,
|
||||
0x031c, 0x031d, 0x031e, 0x031f, 0x0320, 0x0321, 0x0322, 0x0323,
|
||||
0x0324, 0x0325, 0x0326, 0x0327, 0x0328, 0x0329, 0x032a, 0x032b,
|
||||
0x032c, 0x032d, 0x032e, 0x032f, 0x0330, 0x0331, 0x0332, 0x0333,
|
||||
0x0334, 0x0335, 0x0336, 0x0337, 0x0338, 0x0339, 0x033a, 0x033b,
|
||||
0x033c, 0x033d, 0x033e, 0x033f, 0x0340, 0x0341, 0x0342, 0x0343,
|
||||
0x0344, 0x0345, 0x0346, 0x0347, 0x0348, 0x0349, 0x034a, 0x034b,
|
||||
0x034c, 0x034d, 0x034e, 0x034f, 0x0350, 0x0351, 0x0352, 0x0353,
|
||||
0x0354, 0x0355, 0x0356, 0x0357, 0x0358, 0x0359, 0x035a, 0x035b,
|
||||
0x035c, 0x035d, 0x035e, 0x035f, 0x0360, 0x0361, 0x0362, 0x0363,
|
||||
0x0364, 0x0365, 0x0366, 0x0367, 0x0368, 0x0369, 0x036a, 0x036b,
|
||||
0x036c, 0x036d, 0x036e, 0x036f, 0x0391, 0x0392, 0x0393, 0x0394,
|
||||
0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c,
|
||||
0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5,
|
||||
0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4,
|
||||
0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc,
|
||||
0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5,
|
||||
0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x0401, 0x0410, 0x0411, 0x0412,
|
||||
0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a,
|
||||
0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 0x0420, 0x0421, 0x0422,
|
||||
0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a,
|
||||
0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0x0430, 0x0431, 0x0432,
|
||||
0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a,
|
||||
0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, 0x0441, 0x0442,
|
||||
0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a,
|
||||
0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 0x0451, 0x2010, 0x2013,
|
||||
0x2014, 0x2015, 0x2016, 0x2018, 0x2019, 0x201c, 0x201d, 0x2020,
|
||||
0x2021, 0x2022, 0x2024, 0x2025, 0x2026, 0x2027, 0x2030, 0x2032,
|
||||
0x2033, 0x2035, 0x203b, 0x203e, 0x2074, 0x207f, 0x2081, 0x2082,
|
||||
0x2083, 0x2084, 0x20ac, 0x2103, 0x2105, 0x2109, 0x2113, 0x2116,
|
||||
0x2121, 0x2122, 0x2126, 0x212b, 0x2153, 0x2154, 0x215b, 0x215c,
|
||||
0x215d, 0x215e, 0x2160, 0x2162, 0x2162, 0x2163, 0x2164, 0x2165,
|
||||
0x2166, 0x2167, 0x2168, 0x2169, 0x216a, 0x216b, 0x2170, 0x2171,
|
||||
0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179,
|
||||
0x2190, 0x2191, 0x2192, 0x2193, 0x2194, 0x2195, 0x2196, 0x2197,
|
||||
0x2198, 0x2199, 0x21b8, 0x21b9, 0x21d2, 0x21d4, 0x21e7, 0x2200,
|
||||
0x2202, 0x2203, 0x2207, 0x2208, 0x220b, 0x220f, 0x2211, 0x2215,
|
||||
0x221a, 0x221d, 0x221e, 0x221f, 0x2220, 0x2223, 0x2225, 0x2227,
|
||||
0x2228, 0x2229, 0x222a, 0x222b, 0x222c, 0x222e, 0x2234, 0x2235,
|
||||
0x2236, 0x2237, 0x223c, 0x223d, 0x2248, 0x224c, 0x2252, 0x2260,
|
||||
0x2261, 0x2264, 0x2265, 0x2266, 0x2267, 0x226a, 0x226b, 0x226e,
|
||||
0x226f, 0x2282, 0x2283, 0x2286, 0x2287, 0x2295, 0x2299, 0x22a5,
|
||||
0x22bf, 0x2312, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465,
|
||||
0x2466, 0x2467, 0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d,
|
||||
0x246e, 0x246f, 0x2470, 0x2471, 0x2472, 0x2473, 0x2474, 0x2475,
|
||||
0x2476, 0x2477, 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d,
|
||||
0x247e, 0x247f, 0x2480, 0x2481, 0x2482, 0x2483, 0x2484, 0x2485,
|
||||
0x2486, 0x2487, 0x2488, 0x2489, 0x248a, 0x248b, 0x248c, 0x248d,
|
||||
0x248e, 0x248f, 0x2490, 0x2491, 0x2492, 0x2493, 0x2494, 0x2495,
|
||||
0x2496, 0x2497, 0x2498, 0x2499, 0x249a, 0x249b, 0x249c, 0x249d,
|
||||
0x249e, 0x249f, 0x24a0, 0x24a1, 0x24a2, 0x24a3, 0x24a4, 0x24a5,
|
||||
0x24a6, 0x24a7, 0x24a8, 0x24a9, 0x24aa, 0x24ab, 0x24ac, 0x24ad,
|
||||
0x24ae, 0x24af, 0x24b0, 0x24b1, 0x24b2, 0x24b3, 0x24b4, 0x24b5,
|
||||
0x24b6, 0x24b7, 0x24b8, 0x24b9, 0x24ba, 0x24bb, 0x24bc, 0x24bd,
|
||||
0x24be, 0x24bf, 0x24c0, 0x24c1, 0x24c2, 0x24c3, 0x24c4, 0x24c5,
|
||||
0x24c6, 0x24c7, 0x24c8, 0x24c9, 0x24ca, 0x24cb, 0x24cc, 0x24cd,
|
||||
0x24ce, 0x24cf, 0x24d0, 0x24d1, 0x24d2, 0x24d3, 0x24d4, 0x24d5,
|
||||
0x24d6, 0x24d7, 0x24d8, 0x24d9, 0x24da, 0x24db, 0x24dc, 0x24dd,
|
||||
0x24de, 0x24df, 0x24e0, 0x24e1, 0x24e2, 0x24e3, 0x24e4, 0x24e5,
|
||||
0x24e6, 0x24e7, 0x24e8, 0x24e9, 0x24eb, 0x24ec, 0x24ed, 0x24ee,
|
||||
0x24ef, 0x24f0, 0x24f1, 0x24f2, 0x24f3, 0x24f4, 0x24f5, 0x24f6,
|
||||
0x24f7, 0x24f8, 0x24f9, 0x24fa, 0x24fb, 0x24fc, 0x24fd, 0x24fe,
|
||||
0x2500, 0x2501, 0x2502, 0x2503, 0x2504, 0x2505, 0x2506, 0x2507,
|
||||
0x2508, 0x2509, 0x250a, 0x250b, 0x250c, 0x250d, 0x250e, 0x250f,
|
||||
0x2510, 0x2511, 0x2512, 0x2513, 0x2514, 0x2515, 0x2516, 0x2517,
|
||||
0x2518, 0x2519, 0x251a, 0x251b, 0x251c, 0x251d, 0x251e, 0x251f,
|
||||
0x2520, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, 0x2527,
|
||||
0x2528, 0x2529, 0x252a, 0x252b, 0x252c, 0x252d, 0x252e, 0x252f,
|
||||
0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, 0x2537,
|
||||
0x2538, 0x2539, 0x253a, 0x253b, 0x253c, 0x253d, 0x253e, 0x253f,
|
||||
0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547,
|
||||
0x2548, 0x2549, 0x254a, 0x254b, 0x2550, 0x2551, 0x2552, 0x2553,
|
||||
0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b,
|
||||
0x255c, 0x255d, 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2563,
|
||||
0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b,
|
||||
0x256c, 0x256d, 0x256e, 0x256f, 0x2570, 0x2571, 0x2572, 0x2573,
|
||||
0x2580, 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586, 0x2587,
|
||||
0x2588, 0x2589, 0x258a, 0x258b, 0x258c, 0x258d, 0x258e, 0x258f,
|
||||
0x2590, 0x2592, 0x2593, 0x2594, 0x2595, 0x25a0, 0x25a1, 0x25a3,
|
||||
0x25a4, 0x25a5, 0x25a6, 0x25a7, 0x25a8, 0x25a9, 0x25ac, 0x25ae,
|
||||
0x25b2, 0x25b3, 0x25b6, 0x25b7, 0x25ba, 0x25bc, 0x25bd, 0x25c0,
|
||||
0x25c1, 0x25c4, 0x25c6, 0x25c7, 0x25c8, 0x25cb, 0x25ce, 0x25cf,
|
||||
0x25d0, 0x25d1, 0x25d8, 0x25d9, 0x25e2, 0x25e3, 0x25e4, 0x25e5,
|
||||
0x25ef, 0x2605, 0x2606, 0x2609, 0x260e, 0x260f, 0x2614, 0x2615,
|
||||
0x261c, 0x261e, 0x2640, 0x2642, 0x2660, 0x2661, 0x2663, 0x2664,
|
||||
0x2665, 0x2667, 0x2668, 0x2669, 0x266a, 0x266c, 0x266d, 0x266f,
|
||||
0x273d, 0x2776, 0x2777, 0x2778, 0x2779, 0x277a, 0x277b, 0x277c,
|
||||
0x277d, 0x277e, 0x277f, 0xfe00, 0xfe01, 0xfe02, 0xfe03, 0xfe04,
|
||||
0xfe05, 0xfe07, 0xfe09, 0xfe0a, 0xfe0b, 0xfe0c, 0xfe0d, 0xfe0e,
|
||||
0xfe0f, 0xfffd
|
||||
#if !defined(__CYGWIN__)
|
||||
, 0xe0100, 0xe0101, 0xe0102, 0xe0103, 0xe0104, 0xe0105, 0xe0106,
|
||||
0xe0107, 0xe0108, 0xe0109, 0xe010a, 0xe01ef
|
||||
#endif
|
||||
};
|
||||
|
||||
const auto& begin = std::begin(ambiguous_width_list);
|
||||
const auto& end = std::end(ambiguous_width_list);
|
||||
|
||||
if ( std::find(begin, end, wchar) != end ) // found
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
wchar_t cp437_to_unicode (uChar c)
|
||||
{
|
||||
|
@ -233,12 +363,14 @@ std::size_t getColumnWidth (const FString& s, std::size_t pos)
|
|||
//----------------------------------------------------------------------
|
||||
std::size_t getColumnWidth (const FString& s)
|
||||
{
|
||||
int column_width{0};
|
||||
|
||||
if ( s.isEmpty() )
|
||||
return 0;
|
||||
|
||||
const wchar_t* str = s.wc_str();
|
||||
size_t len = std::wcslen(str);
|
||||
int column_width = wcswidth (str, len);
|
||||
for (const auto& wchar : s)
|
||||
column_width += getColumnWidth(wchar);
|
||||
|
||||
return ( column_width == -1 ) ? 0 : std::size_t(column_width);
|
||||
}
|
||||
|
||||
|
@ -247,6 +379,14 @@ std::size_t getColumnWidth (const wchar_t wchar)
|
|||
{
|
||||
int column_width{};
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__) \
|
||||
|| defined(__FreeBSD__) || defined(__DragonFly__) \
|
||||
|| defined(__sun) && defined(__SVR4)
|
||||
if ( hasAmbiguousWidth(wchar) )
|
||||
column_width = 1;
|
||||
else
|
||||
#endif
|
||||
|
||||
if ( wchar >= fc::NF_rev_left_arrow2 && wchar <= fc::NF_check_mark )
|
||||
column_width = 1;
|
||||
else
|
||||
|
|
|
@ -114,7 +114,7 @@ void FTermLinux::setUTF8 (bool enable)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
|
||||
#if defined(ISA_SYSCTL_SUPPORT)
|
||||
bool FTermLinux::setPalette (FColor index, int r, int g, int b)
|
||||
{
|
||||
if ( ! FTerm::isLinuxTerm() )
|
||||
|
@ -163,7 +163,10 @@ void FTermLinux::init()
|
|||
screen_font.data = nullptr;
|
||||
fterm_data->supportShadowCharacter (true);
|
||||
fterm_data->supportHalfBlockCharacter (true);
|
||||
|
||||
#if defined(ISA_SYSCTL_SUPPORT)
|
||||
getVGAPalette();
|
||||
#endif
|
||||
|
||||
if ( FTerm::openConsole() == 0 )
|
||||
{
|
||||
|
@ -174,7 +177,7 @@ void FTermLinux::init()
|
|||
getUnicodeMap();
|
||||
getScreenFont();
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
|
||||
#if defined(ISA_SYSCTL_SUPPORT)
|
||||
// Enable 16 background colors
|
||||
if ( setBlinkAsIntensity(true) == 0 )
|
||||
FTermcap::max_color = 16;
|
||||
|
@ -246,7 +249,7 @@ void FTermLinux::finish()
|
|||
{
|
||||
if ( FTerm::isLinuxTerm() )
|
||||
{
|
||||
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
|
||||
#if defined(ISA_SYSCTL_SUPPORT)
|
||||
setBlinkAsIntensity (false);
|
||||
#endif
|
||||
setLinuxCursorStyle (fc::default_cursor);
|
||||
|
@ -383,7 +386,7 @@ bool FTermLinux::saveColorMap()
|
|||
if ( ! FTerm::isLinuxTerm() )
|
||||
return false;
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
|
||||
#if defined(ISA_SYSCTL_SUPPORT)
|
||||
return saveVGAPalette();
|
||||
#else
|
||||
return false;
|
||||
|
@ -396,7 +399,7 @@ bool FTermLinux::resetColorMap()
|
|||
if ( ! FTerm::isLinuxTerm() )
|
||||
return false;
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
|
||||
#if defined(ISA_SYSCTL_SUPPORT)
|
||||
return resetVGAPalette();
|
||||
#else
|
||||
return false;
|
||||
|
@ -752,7 +755,7 @@ void FTermLinux::setLinuxCursorStyle (CursorStyle style)
|
|||
FTerm::putstringf (CSI "?%dc", style);
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
|
||||
#if defined(ISA_SYSCTL_SUPPORT)
|
||||
//----------------------------------------------------------------------
|
||||
inline uInt16 FTermLinux::getInputStatusRegisterOne()
|
||||
{
|
||||
|
@ -956,7 +959,7 @@ bool FTermLinux::resetVGAPalette()
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif // defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
|
||||
#endif // defined(ISA_SYSCTL_SUPPORT)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FKey FTermLinux::shiftKeyCorrection (const FKey& key_id)
|
||||
|
|
|
@ -20,11 +20,6 @@
|
|||
* <http://www.gnu.org/licenses/>. *
|
||||
***********************************************************************/
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
#include "final/fconfig.h" // includes _GNU_SOURCE for wcwidth()
|
||||
#endif
|
||||
|
||||
#include <wchar.h>
|
||||
#include <memory>
|
||||
|
||||
#include "final/fapplication.h"
|
||||
|
@ -674,7 +669,9 @@ void FTextView::drawText()
|
|||
|
||||
for (auto&& ch : line) // Column loop
|
||||
{
|
||||
if ( isPrintable(ch) )
|
||||
if ( getColumnWidth(ch) == 0 )
|
||||
continue;
|
||||
else if ( isPrintable(ch) )
|
||||
print (ch);
|
||||
else
|
||||
print ('.');
|
||||
|
|
|
@ -80,10 +80,6 @@ void FToolTip::draw()
|
|||
{
|
||||
int y{0};
|
||||
setColor();
|
||||
|
||||
if ( getMaxColor() < 16 )
|
||||
setBold();
|
||||
|
||||
clearArea();
|
||||
drawBorder();
|
||||
|
||||
|
@ -92,8 +88,6 @@ void FToolTip::draw()
|
|||
print() << FPoint(3, 2 + y) << line;
|
||||
y++;
|
||||
}
|
||||
|
||||
unsetBold();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -48,7 +48,7 @@ void FWidgetColors::set8ColorTheme()
|
|||
error_box_fg = fc::Black;
|
||||
error_box_emphasis_fg = fc::Red;
|
||||
error_box_bg = fc::LightGray;
|
||||
tooltip_fg = fc::LightGray;
|
||||
tooltip_fg = fc::Black;
|
||||
tooltip_bg = fc::Cyan;
|
||||
shadow_fg = fc::Black;
|
||||
shadow_bg = fc::LightGray; // only for transparent shadow
|
||||
|
@ -75,8 +75,8 @@ void FWidgetColors::set8ColorTheme()
|
|||
inputfield_active_bg = fc::Cyan;
|
||||
inputfield_inactive_fg = fc::Black;
|
||||
inputfield_inactive_bg = fc::LightGray;
|
||||
toggle_button_active_focus_fg = fc::LightGray;
|
||||
toggle_button_active_focus_bg = fc::Red;
|
||||
toggle_button_active_focus_fg = fc::Black;
|
||||
toggle_button_active_focus_bg = fc::Cyan;
|
||||
toggle_button_active_fg = fc::Black;
|
||||
toggle_button_active_bg = fc::LightGray;
|
||||
toggle_button_inactive_fg = fc::Cyan;
|
||||
|
@ -85,6 +85,7 @@ void FWidgetColors::set8ColorTheme()
|
|||
button_active_focus_bg = fc::Red;
|
||||
button_active_fg = fc::LightGray;
|
||||
button_active_bg = fc::Blue;
|
||||
button_active_bg = fc::Blue;
|
||||
button_inactive_fg = fc::Black;
|
||||
button_inactive_bg = fc::Blue;
|
||||
button_hotkey_fg = fc::LightGray;
|
||||
|
|
|
@ -243,11 +243,9 @@ void FWindow::drawBorder()
|
|||
{
|
||||
FRect r(FPoint(1, 1), getSize());
|
||||
print() << r.getUpperLeftPos()
|
||||
<< fc::NF_border_corner_upper_left; // ⎡
|
||||
for (int x = r.getX1() + 1; x < r.getX2(); x++)
|
||||
print (fc::NF_border_line_upper); // ¯
|
||||
|
||||
print (fc::NF_rev_border_corner_upper_right); // ⎤
|
||||
<< fc::NF_border_corner_upper_left // ⎡
|
||||
<< FString(r.getWidth() - 2, fc::NF_border_line_upper) // ¯
|
||||
<< fc::NF_rev_border_corner_upper_right; // ⎤
|
||||
|
||||
for (int y = r.getY1() + 1; y < r.getY2(); y++)
|
||||
{
|
||||
|
@ -257,14 +255,10 @@ void FWindow::drawBorder()
|
|||
<< fc::NF_rev_border_line_right; // border right⎹
|
||||
}
|
||||
|
||||
print() << r.getLowerLeftPos() // lower left corner border ⎣
|
||||
<< fc::NF_border_corner_lower_left;
|
||||
|
||||
for (int x = r.getX1() + 1; x < r.getX2(); x++)
|
||||
print (fc::NF_border_line_bottom); // low line _
|
||||
|
||||
// lower right corner border ⎦
|
||||
print (fc::NF_rev_border_corner_lower_right);
|
||||
print() << r.getLowerLeftPos()
|
||||
<< fc::NF_border_corner_lower_left // ⎣
|
||||
<< FString(r.getWidth() - 2, fc::NF_border_line_bottom) // _
|
||||
<< fc::NF_rev_border_corner_lower_right; // ⎦
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -45,7 +45,7 @@ extern const std::size_t lastKeyItem;
|
|||
extern wchar_t cp437_ucs[][2];
|
||||
extern const std::size_t lastCP437Item;
|
||||
|
||||
extern wchar_t halfWidth_fullWidth[][2];
|
||||
extern const wchar_t halfWidth_fullWidth[][2];
|
||||
extern const std::size_t lastHalfWidthItem;
|
||||
|
||||
} // namespace fc
|
||||
|
|
|
@ -57,7 +57,7 @@ class FKeyboardCommand final
|
|||
public:
|
||||
// Constructors
|
||||
FKeyboardCommand () = default;
|
||||
explicit FKeyboardCommand (std::function<void()> fn)
|
||||
explicit FKeyboardCommand (const std::function<void()>& fn)
|
||||
: handler(fn)
|
||||
{ }
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ class FString
|
|||
wchar_t back() const;
|
||||
|
||||
template<typename... Args>
|
||||
FString& sprintf (const FString, Args&&...);
|
||||
FString& sprintf (const FString&, Args&&...);
|
||||
FString clear();
|
||||
|
||||
const wchar_t* wc_str() const;
|
||||
|
@ -413,7 +413,7 @@ inline wchar_t FString::back() const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
template<typename... Args>
|
||||
inline FString& FString::sprintf (const FString format, Args&&... args)
|
||||
inline FString& FString::sprintf (const FString& format, Args&&... args)
|
||||
{
|
||||
static constexpr int BUFSIZE = 4096;
|
||||
wchar_t buf[BUFSIZE]{};
|
||||
|
|
|
@ -61,10 +61,6 @@
|
|||
#undef buttons // from term.h
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
#undef __STRICT_ANSI__ // need for realpath and strdup
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -197,16 +193,10 @@ class FSystemImpl : public FSystem
|
|||
return ::geteuid();
|
||||
}
|
||||
|
||||
int getpwuid_r ( uid_t uid, struct passwd* pwd
|
||||
, char* buf, size_t buflen, struct passwd** result ) override
|
||||
{
|
||||
return ::getpwuid_r (uid, pwd, buf, buflen, result);
|
||||
}
|
||||
int getpwuid_r ( uid_t, struct passwd*, char*, size_t
|
||||
, struct passwd** ) override;
|
||||
|
||||
char* realpath (const char* path, char* resolved_path) override
|
||||
{
|
||||
return ::realpath(path, resolved_path);
|
||||
}
|
||||
char* realpath (const char*, char*) override;
|
||||
};
|
||||
|
||||
} // namespace finalcut
|
||||
|
|
|
@ -96,7 +96,7 @@ class FTermBuffer
|
|||
const FString toString() const;
|
||||
void clear();
|
||||
template<typename... Args>
|
||||
int writef (const FString, Args&&...);
|
||||
int writef (const FString&, Args&&...);
|
||||
int write (const FString&);
|
||||
int write (wchar_t);
|
||||
void write (const FColorPair&);
|
||||
|
@ -131,9 +131,7 @@ inline FTermBuffer& FTermBuffer::operator << (const typeT& s)
|
|||
//----------------------------------------------------------------------
|
||||
inline FTermBuffer& FTermBuffer::operator << (const FCharVector& vec)
|
||||
{
|
||||
for (auto&& tc : vec)
|
||||
data.push_back(tc);
|
||||
|
||||
std::copy(vec.begin(), vec.end(), std::back_inserter(data));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -207,7 +205,7 @@ inline void FTermBuffer::clear()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
template<typename... Args>
|
||||
inline int FTermBuffer::writef (const FString format, Args&&... args)
|
||||
inline int FTermBuffer::writef (const FString& format, Args&&... args)
|
||||
{
|
||||
FString str{};
|
||||
str.sprintf (format, std::forward<Args>(args)...);
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#endif
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
|
||||
#define ISA_SYSCTL_SUPPORT
|
||||
#include <sys/io.h>
|
||||
#endif // defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
|
||||
|
||||
|
@ -157,7 +158,7 @@ class FTermLinux final
|
|||
void setLinuxCursorStyle (fc::linuxConsoleCursorStyle);
|
||||
|
||||
// Methods
|
||||
#if defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
|
||||
#if defined(ISA_SYSCTL_SUPPORT)
|
||||
uInt16 getInputStatusRegisterOne();
|
||||
uChar readAttributeController (uChar);
|
||||
void writeAttributeController (uChar, uChar);
|
||||
|
@ -169,7 +170,7 @@ class FTermLinux final
|
|||
bool setVGAPalette (FColor, int, int, int);
|
||||
bool saveVGAPalette();
|
||||
bool resetVGAPalette();
|
||||
#endif // defined(__x86_64__) || defined(__i386) || defined(ARM_ISA_SYSCTL)
|
||||
#endif // defined(ISA_SYSCTL_SUPPORT)
|
||||
FKey shiftKeyCorrection (const FKey&);
|
||||
FKey ctrlKeyCorrection (const FKey&);
|
||||
FKey altKeyCorrection (const FKey&);
|
||||
|
|
|
@ -177,7 +177,7 @@ class FTextView : public FWidget
|
|||
|
||||
// FListBox inline functions
|
||||
//----------------------------------------------------------------------
|
||||
FTextView& FTextView::operator = (const FString& s)
|
||||
inline FTextView& FTextView::operator = (const FString& s)
|
||||
{
|
||||
setText(s);
|
||||
return *this;
|
||||
|
|
|
@ -293,7 +293,7 @@ class FVTerm
|
|||
, FPreprocessingFunction );
|
||||
virtual void delPreprocessingHandler (FVTerm*);
|
||||
template<typename... Args>
|
||||
int printf (const FString, Args&&...);
|
||||
int printf (const FString&, Args&&...);
|
||||
int print (const FString&);
|
||||
int print (FTermArea*, const FString&);
|
||||
int print (const FTermBuffer&);
|
||||
|
@ -1042,7 +1042,7 @@ inline bool FVTerm::hasUTF8()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
template<typename... Args>
|
||||
inline int FVTerm::printf (const FString format, Args&&... args)
|
||||
inline int FVTerm::printf (const FString& format, Args&&... args)
|
||||
{
|
||||
FString str{};
|
||||
str.sprintf (format, std::forward<Args>(args)...);
|
||||
|
|
Loading…
Reference in New Issue