More use of direct initializations
This commit is contained in:
parent
43de8d6150
commit
37ed970319
|
@ -1,3 +1,6 @@
|
||||||
|
2019-08-25 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* More use of direct initializations
|
||||||
|
|
||||||
2019-08-18 Markus Gans <guru.mail@muenster.de>
|
2019-08-18 Markus Gans <guru.mail@muenster.de>
|
||||||
* Solved problem detecting terminal size on quick changes
|
* Solved problem detecting terminal size on quick changes
|
||||||
* Update VTerm information only in case of changes
|
* Update VTerm information only in case of changes
|
||||||
|
|
|
@ -136,7 +136,7 @@ void SegmentView::hexEncoding()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void SegmentView::get7Segment (const wchar_t c)
|
void SegmentView::get7Segment (const wchar_t c)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i{0}; i < 3; i++)
|
||||||
line[i].clear();
|
line[i].clear();
|
||||||
|
|
||||||
switch ( c )
|
switch ( c )
|
||||||
|
@ -207,7 +207,7 @@ void SegmentView::draw()
|
||||||
FColorPair color(fc::LightRed, fc::Black);
|
FColorPair color(fc::LightRed, fc::Black);
|
||||||
get7Segment(ch);
|
get7Segment(ch);
|
||||||
|
|
||||||
for (std::size_t i = 0; i < 3; i++)
|
for (std::size_t i{0}; i < 3; i++)
|
||||||
tbuffer[i] << color << line[i] << " ";
|
tbuffer[i] << color << line[i] << " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ using finalcut::FPoint;
|
||||||
using finalcut::FSize;
|
using finalcut::FSize;
|
||||||
using finalcut::FColorPair;
|
using finalcut::FColorPair;
|
||||||
|
|
||||||
constexpr lDouble PI = 3.141592653589793238L;
|
constexpr lDouble PI{3.141592653589793238L};
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -255,7 +255,7 @@ Calc::Calc (FWidget* parent)
|
||||||
setText ("Calculator");
|
setText ("Calculator");
|
||||||
setGeometry (FPoint(19, 6), FSize(37, 18));
|
setGeometry (FPoint(19, 6), FSize(37, 18));
|
||||||
|
|
||||||
for (std::size_t key = 0; key < Calc::NUM_OF_BUTTONS; key++)
|
for (std::size_t key{0}; key < Calc::NUM_OF_BUTTONS; key++)
|
||||||
{
|
{
|
||||||
auto btn = std::make_shared<Button>(this);
|
auto btn = std::make_shared<Button>(this);
|
||||||
button_no[key] = key;
|
button_no[key] = key;
|
||||||
|
@ -264,11 +264,9 @@ Calc::Calc (FWidget* parent)
|
||||||
btn->setGeometry(FPoint(30, 15), FSize(5, 3));
|
btn->setGeometry(FPoint(30, 15), FSize(5, 3));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int x, y;
|
std::size_t n = ( key <= Three ) ? 0 : 1;
|
||||||
std::size_t n;
|
int x = int(key + n) % 5 * 7 + 2;
|
||||||
( key <= Three ) ? n = 0 : n = 1;
|
int y = int(key + n) / 5 * 2 + 3;
|
||||||
x = int(key + n) % 5 * 7 + 2;
|
|
||||||
y = int(key + n) / 5 * 2 + 3;
|
|
||||||
btn->setGeometry(FPoint(x, y), FSize(5, 1));
|
btn->setGeometry(FPoint(x, y), FSize(5, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +309,7 @@ Calc::~Calc()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Calc::drawDispay()
|
void Calc::drawDispay()
|
||||||
{
|
{
|
||||||
finalcut::FString display = input;
|
finalcut::FString display(input);
|
||||||
|
|
||||||
if ( display.isNull() || display.isEmpty() )
|
if ( display.isNull() || display.isEmpty() )
|
||||||
display = L'0';
|
display = L'0';
|
||||||
|
@ -346,11 +344,11 @@ void Calc::drawDispay()
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
wchar_t bottom_line = fc::NF_border_line_bottom;
|
wchar_t bottom_line {fc::NF_border_line_bottom};
|
||||||
wchar_t top_bottom_line = fc::NF_border_line_up_and_down;
|
wchar_t top_bottom_line {fc::NF_border_line_up_and_down};
|
||||||
wchar_t top_line = fc::NF_border_line_upper;
|
wchar_t top_line {fc::NF_border_line_upper};
|
||||||
wchar_t right_line = fc::NF_rev_border_line_right;
|
wchar_t right_line {fc::NF_rev_border_line_right};
|
||||||
wchar_t left_line = fc::NF_border_line_left;
|
wchar_t left_line {fc::NF_border_line_left};
|
||||||
print() << FPoint(3, 2) << finalcut::FString(33, bottom_line);
|
print() << FPoint(3, 2) << finalcut::FString(33, bottom_line);
|
||||||
print() << FPoint(2, 3) << right_line;
|
print() << FPoint(2, 3) << right_line;
|
||||||
print() << FPoint(36, 3) << left_line;
|
print() << FPoint(36, 3) << left_line;
|
||||||
|
@ -365,12 +363,12 @@ void Calc::drawDispay()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wchar_t vertical_and_right = fc::BoxDrawingsVerticalAndRight;
|
wchar_t vertical_and_right {fc::BoxDrawingsVerticalAndRight};
|
||||||
wchar_t horizontal = fc::BoxDrawingsHorizontal;
|
wchar_t horizontal {fc::BoxDrawingsHorizontal};
|
||||||
wchar_t vertical_and_left = fc::BoxDrawingsVerticalAndLeft;
|
wchar_t vertical_and_left {fc::BoxDrawingsVerticalAndLeft};
|
||||||
finalcut::FString separator = finalcut::FString(vertical_and_right)
|
finalcut::FString separator ( finalcut::FString(vertical_and_right)
|
||||||
+ finalcut::FString(35, horizontal)
|
+ finalcut::FString(35, horizontal)
|
||||||
+ finalcut::FString(vertical_and_left);
|
+ finalcut::FString(vertical_and_left) );
|
||||||
print() << FPoint(1, 4) << separator;
|
print() << FPoint(1, 4) << separator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,7 +607,7 @@ void Calc::pi (lDouble& x)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Calc::open_bracket (lDouble&)
|
void Calc::open_bracket (lDouble&)
|
||||||
{
|
{
|
||||||
stack_data d = { a, infix_operator };
|
stack_data d{ a, infix_operator };
|
||||||
bracket_stack.push(d);
|
bracket_stack.push(d);
|
||||||
clearInfixOperator();
|
clearInfixOperator();
|
||||||
input = "";
|
input = "";
|
||||||
|
@ -906,7 +904,7 @@ lDouble& Calc::getValue()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Calc::setDisplay (lDouble d)
|
void Calc::setDisplay (lDouble d)
|
||||||
{
|
{
|
||||||
char buffer[33];
|
char buffer[33]{};
|
||||||
snprintf (buffer, sizeof(buffer), "%32.11Lg", d);
|
snprintf (buffer, sizeof(buffer), "%32.11Lg", d);
|
||||||
input = buffer;
|
input = buffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ void CheckList::populate()
|
||||||
|
|
||||||
constexpr int lastItem = int(sizeof(list) / sizeof(list[0])) - 1;
|
constexpr int lastItem = int(sizeof(list) / sizeof(list[0])) - 1;
|
||||||
|
|
||||||
for (int i = 0; i <= lastItem; i++)
|
for (int i{0}; i <= lastItem; i++)
|
||||||
{
|
{
|
||||||
const finalcut::FStringList line (&list[i][0], &list[i][0] + 2);
|
const finalcut::FStringList line (&list[i][0], &list[i][0] + 2);
|
||||||
auto iter = listView.insert (line);
|
auto iter = listView.insert (line);
|
||||||
|
|
|
@ -97,7 +97,7 @@ void preset (std::vector<FRadioButtonPtr>& os)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
finalcut::FString label_text = "no OS";
|
finalcut::FString label_text("no OS");
|
||||||
|
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app(argc, argv);
|
||||||
|
@ -106,8 +106,8 @@ int main (int argc, char* argv[])
|
||||||
finalcut::FDialog dgl(&app);
|
finalcut::FDialog dgl(&app);
|
||||||
dgl.setModal();
|
dgl.setModal();
|
||||||
dgl.setText ("UNIX select");
|
dgl.setText ("UNIX select");
|
||||||
std::size_t w = 20;
|
std::size_t w{20};
|
||||||
std::size_t h = 13;
|
std::size_t h{13};
|
||||||
int x = int(app.getDesktopWidth() - w) / 2;
|
int x = int(app.getDesktopWidth() - w) / 2;
|
||||||
int y = int(app.getDesktopHeight() - h) / 2;
|
int y = int(app.getDesktopHeight() - h) / 2;
|
||||||
dgl.setGeometry (FPoint(x, y), FSize(w, h));
|
dgl.setGeometry (FPoint(x, y), FSize(w, h));
|
||||||
|
@ -123,7 +123,7 @@ int main (int argc, char* argv[])
|
||||||
// Set the radio button geometry
|
// Set the radio button geometry
|
||||||
// => checkButtonGroup.setScrollSize(...) is not required
|
// => checkButtonGroup.setScrollSize(...) is not required
|
||||||
// because a FButtonGroup is self-adjusting
|
// because a FButtonGroup is self-adjusting
|
||||||
for (uInt i = 0; i < os.size(); i++)
|
for (uInt i{0}; i < os.size(); i++)
|
||||||
os[i]->setGeometry(FPoint(1, int(1 + i)), FSize(12, 1));
|
os[i]->setGeometry(FPoint(1, int(1 + i)), FSize(12, 1));
|
||||||
|
|
||||||
preset(os);
|
preset(os);
|
||||||
|
@ -148,7 +148,7 @@ int main (int argc, char* argv[])
|
||||||
dgl.show();
|
dgl.show();
|
||||||
|
|
||||||
// Get the checked radio button text
|
// Get the checked radio button text
|
||||||
for (int n = 1; n <= int(checkButtonGroup.getCount()); n++)
|
for (int n{1}; n <= int(checkButtonGroup.getCount()); n++)
|
||||||
{
|
{
|
||||||
if ( checkButtonGroup.isChecked(n) )
|
if ( checkButtonGroup.isChecked(n) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@ Keyboard::Keyboard (finalcut::FWidget* parent)
|
||||||
void Keyboard::onKeyPress (finalcut::FKeyEvent* ev)
|
void Keyboard::onKeyPress (finalcut::FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
FKey key_id = ev->key();
|
FKey key_id = ev->key();
|
||||||
bool is_last_line = false;
|
bool is_last_line{false};
|
||||||
|
|
||||||
if ( getPrintPos().getY() == int(getDesktopHeight()) )
|
if ( getPrintPos().getY() == int(getDesktopHeight()) )
|
||||||
is_last_line = true;
|
is_last_line = true;
|
||||||
|
|
|
@ -119,12 +119,12 @@ Listbox::Listbox (FWidget* parent)
|
||||||
list1.setGeometry(FPoint(2, 1), FSize(18, 10));
|
list1.setGeometry(FPoint(2, 1), FSize(18, 10));
|
||||||
list1.setText ("FListBoxItem");
|
list1.setText ("FListBoxItem");
|
||||||
|
|
||||||
for (int i = 1; i < 30; i++)
|
for (int i{1}; i < 30; i++)
|
||||||
list1.insert (L"----- " + (FString() << i) + L" -----");
|
list1.insert (L"----- " + (FString() << i) + L" -----");
|
||||||
|
|
||||||
// listbox 2
|
// listbox 2
|
||||||
//----------
|
//----------
|
||||||
for (double i = 1; i<=15; i++)
|
for (double i{1.0}; i <= 15.0; i++)
|
||||||
double_list.push_back(2 * i + (i / 100));
|
double_list.push_back(2 * i + (i / 100));
|
||||||
|
|
||||||
list2.setGeometry(FPoint(21, 1), FSize(10, 10));
|
list2.setGeometry(FPoint(21, 1), FSize(10, 10));
|
||||||
|
|
|
@ -179,7 +179,7 @@ void Listview::populate()
|
||||||
|
|
||||||
constexpr int lastItem = int(sizeof(weather) / sizeof(weather[0])) - 1;
|
constexpr int lastItem = int(sizeof(weather) / sizeof(weather[0])) - 1;
|
||||||
|
|
||||||
for (int i = 0; i <= lastItem; i++)
|
for (int i{0}; i <= lastItem; i++)
|
||||||
{
|
{
|
||||||
finalcut::FStringList line (&weather[i][0], &weather[i][0] + 5);
|
finalcut::FStringList line (&weather[i][0], &weather[i][0] + 5);
|
||||||
listView.insert (line);
|
listView.insert (line);
|
||||||
|
|
|
@ -68,42 +68,37 @@ Mandelbrot::~Mandelbrot()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Mandelbrot::draw()
|
void Mandelbrot::draw()
|
||||||
{
|
{
|
||||||
int iter, max_iter;
|
|
||||||
int Cols, Lines, xoffset, yoffset, current_line;
|
|
||||||
double x, y, xtemp, x0, y0, dX, dY;
|
|
||||||
double x_min, x_max, y_min, y_max;
|
|
||||||
|
|
||||||
finalcut::FDialog::draw();
|
finalcut::FDialog::draw();
|
||||||
|
|
||||||
x_min = -2.20;
|
double x_min{-2.20};
|
||||||
x_max = 1.00;
|
double x_max{+1.00};
|
||||||
y_min = -1.05;
|
double y_min{-1.05};
|
||||||
y_max = 1.05;
|
double y_max{+1.05};
|
||||||
max_iter = 99;
|
int max_iter{99};
|
||||||
|
|
||||||
xoffset = 2;
|
int xoffset{2};
|
||||||
yoffset = 2;
|
int yoffset{2};
|
||||||
current_line = 0;
|
int current_line{0};
|
||||||
Cols = int(getClientWidth());
|
int Cols = int(getClientWidth());
|
||||||
Lines = int(getClientHeight());
|
int Lines = int(getClientHeight());
|
||||||
|
|
||||||
dX = (x_max - x_min) / (Cols - 1);
|
double dX = (x_max - x_min) / (Cols - 1);
|
||||||
dY = (y_max - y_min) / Lines;
|
double dY = (y_max - y_min) / Lines;
|
||||||
|
|
||||||
for (y0 = y_min; y0 < y_max && current_line < Lines; y0 += dY)
|
for (double y0 = y_min; y0 < y_max && current_line < Lines; y0 += dY)
|
||||||
{
|
{
|
||||||
current_line++;
|
current_line++;
|
||||||
print() << FPoint(xoffset, yoffset + current_line);
|
print() << FPoint(xoffset, yoffset + current_line);
|
||||||
|
|
||||||
for (x0 = x_min; x0 < x_max; x0 += dX)
|
for (double x0 = x_min; x0 < x_max; x0 += dX)
|
||||||
{
|
{
|
||||||
x = 0.0;
|
double x{0.0};
|
||||||
y = 0.0;
|
double y{0.0};
|
||||||
iter = 0;
|
int iter{0};
|
||||||
|
|
||||||
while ( x * x + y * y < 4 && iter < max_iter )
|
while ( x * x + y * y < 4 && iter < max_iter )
|
||||||
{
|
{
|
||||||
xtemp = x * x - y * y + x0;
|
double xtemp = x * x - y * y + x0;
|
||||||
y = 2 * x * y + y0;
|
y = 2 * x * y + y0;
|
||||||
x = xtemp;
|
x = xtemp;
|
||||||
iter++;
|
iter++;
|
||||||
|
|
|
@ -264,7 +264,7 @@ void Menu::configureBorderMenuItems()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Menu::defaultCallback (finalcut::FMenuList* mb)
|
void Menu::defaultCallback (finalcut::FMenuList* mb)
|
||||||
{
|
{
|
||||||
for (uInt i = 1; i <= mb->getCount(); i++)
|
for (uInt i{1}; i <= mb->getCount(); i++)
|
||||||
{
|
{
|
||||||
auto item = mb->getItem(int(i));
|
auto item = mb->getItem(int(i));
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ void ColorChooser::onMouseDown (finalcut::FMouseEvent* ev)
|
||||||
if ( ev->getButton() == fc::MiddleButton )
|
if ( ev->getButton() == fc::MiddleButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int c = 0; c < 16; c++)
|
for (int c{0}; c < 16; c++)
|
||||||
{
|
{
|
||||||
int xmin = 2 + (c / 8) * 3;
|
int xmin = 2 + (c / 8) * 3;
|
||||||
int xmax = 4 + (c / 8) * 3;
|
int xmax = 4 + (c / 8) * 3;
|
||||||
|
@ -133,7 +133,7 @@ void ColorChooser::draw()
|
||||||
setColor();
|
setColor();
|
||||||
drawBorder();
|
drawBorder();
|
||||||
|
|
||||||
for (FColor c = 0; c < 16; c++)
|
for (FColor c{0}; c < 16; c++)
|
||||||
{
|
{
|
||||||
print() << FPoint(2 + (c / 8) * 3, 3 + c % 8);
|
print() << FPoint(2 + (c / 8) * 3, 3 + c % 8);
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ Brushes::~Brushes()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Brushes::draw()
|
void Brushes::draw()
|
||||||
{
|
{
|
||||||
int pos;
|
int pos{};
|
||||||
setColor();
|
setColor();
|
||||||
drawBorder();
|
drawBorder();
|
||||||
print() << FPoint(2, 3)
|
print() << FPoint(2, 3)
|
||||||
|
@ -439,7 +439,7 @@ void MouseDraw::draw()
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
for (int y = 2; y < y_max; y++)
|
for (int y{2}; y < y_max; y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(10, y)
|
print() << FPoint(10, y)
|
||||||
<< fc::NF_rev_border_line_right;
|
<< fc::NF_rev_border_line_right;
|
||||||
|
@ -453,7 +453,7 @@ void MouseDraw::draw()
|
||||||
print() << FPoint(10, 2)
|
print() << FPoint(10, 2)
|
||||||
<< fc::BoxDrawingsDownAndHorizontal;
|
<< fc::BoxDrawingsDownAndHorizontal;
|
||||||
|
|
||||||
for (int y = 3; y < y_max; y++)
|
for (int y{3}; y < y_max; y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(10, y) << fc::BoxDrawingsVertical;
|
print() << FPoint(10, y) << fc::BoxDrawingsVertical;
|
||||||
}
|
}
|
||||||
|
@ -503,10 +503,10 @@ void MouseDraw::drawCanvas()
|
||||||
, x_end = canvas->width
|
, x_end = canvas->width
|
||||||
, w_line_len = print_area->width + print_area->right_shadow;
|
, w_line_len = print_area->width + print_area->right_shadow;
|
||||||
|
|
||||||
for (int y = 0; y < y_end; y++) // line loop
|
for (int y{0}; y < y_end; y++) // line loop
|
||||||
{
|
{
|
||||||
finalcut::charData* canvaschar; // canvas character
|
finalcut::charData* canvaschar{}; // canvas character
|
||||||
finalcut::charData* winchar; // window character
|
finalcut::charData* winchar{}; // window character
|
||||||
canvaschar = &canvas->text[y * x_end];
|
canvaschar = &canvas->text[y * x_end];
|
||||||
winchar = &print_area->text[(ay + y) * w_line_len + ax];
|
winchar = &print_area->text[(ay + y) * w_line_len + ax];
|
||||||
std::memcpy ( winchar
|
std::memcpy ( winchar
|
||||||
|
@ -526,7 +526,7 @@ void MouseDraw::drawCanvas()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MouseDraw::adjustSize()
|
void MouseDraw::adjustSize()
|
||||||
{
|
{
|
||||||
std::size_t w = 60, h = 18;
|
std::size_t w{60}, h{18};
|
||||||
int x = 1 + int((getParentWidget()->getWidth() - w) / 2);
|
int x = 1 + int((getParentWidget()->getWidth() - w) / 2);
|
||||||
int y = 1 + int((getParentWidget()->getHeight() - h) / 2);
|
int y = 1 + int((getParentWidget()->getHeight() - h) / 2);
|
||||||
setGeometry (FPoint(x, y), FSize(w, h), false);
|
setGeometry (FPoint(x, y), FSize(w, h), false);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
static finalcut::FVTerm* terminal;
|
static finalcut::FVTerm* terminal;
|
||||||
|
|
||||||
// Global FApplication object
|
// Global FApplication object
|
||||||
static finalcut::FApplication* app = nullptr;
|
static finalcut::FApplication* app{nullptr};
|
||||||
|
|
||||||
// function prototype
|
// function prototype
|
||||||
bool keyPressed();
|
bool keyPressed();
|
||||||
|
@ -44,12 +44,13 @@ void move (int, int, int, int);
|
||||||
bool keyPressed()
|
bool keyPressed()
|
||||||
{
|
{
|
||||||
// Waiting for keypress
|
// Waiting for keypress
|
||||||
struct termios save, t;
|
|
||||||
bool ret;
|
struct termios save{};
|
||||||
|
bool ret{false};
|
||||||
std::cout << "\nPress any key to continue...";
|
std::cout << "\nPress any key to continue...";
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
tcgetattr (STDIN_FILENO, &save);
|
tcgetattr (STDIN_FILENO, &save);
|
||||||
t = save;
|
struct termios t = save;
|
||||||
t.c_lflag &= uInt(~(ICANON | ECHO));
|
t.c_lflag &= uInt(~(ICANON | ECHO));
|
||||||
tcsetattr (STDIN_FILENO, TCSANOW, &t);
|
tcsetattr (STDIN_FILENO, TCSANOW, &t);
|
||||||
|
|
||||||
|
@ -89,10 +90,8 @@ void term_boundaries (int& x, int& y)
|
||||||
void move (int xold, int yold, int xnew, int ynew)
|
void move (int xold, int yold, int xnew, int ynew)
|
||||||
{
|
{
|
||||||
// prints the cursor move escape sequence
|
// prints the cursor move escape sequence
|
||||||
std::string sequence;
|
std::string sequence{};
|
||||||
char* buffer;
|
char from[26]{}, to[26]{}, byte[20]{};
|
||||||
char from[26], to[26], byte[20];
|
|
||||||
uInt len;
|
|
||||||
const std::string ctrl_character[] =
|
const std::string ctrl_character[] =
|
||||||
{
|
{
|
||||||
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
|
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
|
||||||
|
@ -111,8 +110,8 @@ void move (int xold, int yold, int xnew, int ynew)
|
||||||
<< std::left << std::setw(10) << to
|
<< std::left << std::setw(10) << to
|
||||||
<< " ";
|
<< " ";
|
||||||
// get the move string
|
// get the move string
|
||||||
buffer = finalcut::FTerm::moveCursorString (xold, yold, xnew, ynew);
|
char* buffer = finalcut::FTerm::moveCursorString (xold, yold, xnew, ynew);
|
||||||
len = uInt(std::strlen(buffer));
|
uInt len = uInt(std::strlen(buffer));
|
||||||
|
|
||||||
for (uInt i = 0; i < len; i++)
|
for (uInt i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
|
@ -142,8 +141,6 @@ void move (int xold, int yold, int xnew, int ynew)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int xmax, ymax;
|
|
||||||
|
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication TermApp(argc, argv);
|
finalcut::FApplication TermApp(argc, argv);
|
||||||
|
|
||||||
|
@ -152,8 +149,8 @@ int main (int argc, char* argv[])
|
||||||
app = &TermApp;
|
app = &TermApp;
|
||||||
|
|
||||||
// Get screen dimension
|
// Get screen dimension
|
||||||
xmax = int(TermApp.getDesktopWidth() - 1);
|
int xmax = int(TermApp.getDesktopWidth() - 1);
|
||||||
ymax = int(TermApp.getDesktopHeight() - 1);
|
int ymax = int(TermApp.getDesktopHeight() - 1);
|
||||||
finalcut::FString line(std::size_t(xmax) + 1, '-');
|
finalcut::FString line(std::size_t(xmax) + 1, '-');
|
||||||
|
|
||||||
// Place the cursor in the upper left corner
|
// Place the cursor in the upper left corner
|
||||||
|
|
|
@ -138,11 +138,11 @@ void Scrollview::draw()
|
||||||
setColor (wc.label_inactive_fg, wc.dialog_bg);
|
setColor (wc.label_inactive_fg, wc.dialog_bg);
|
||||||
clearArea();
|
clearArea();
|
||||||
|
|
||||||
for (int y = 0; y < int(getScrollHeight()); y++)
|
for (int y{0}; y < int(getScrollHeight()); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(1, 1 + y);
|
print() << FPoint(1, 1 + y);
|
||||||
|
|
||||||
for (int x = 0; x < int(getScrollWidth()); x++)
|
for (int x{0}; x < int(getScrollWidth()); x++)
|
||||||
print (32 + ((x + y) % 0x5f));
|
print (32 + ((x + y) % 0x5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 2012-2018 Markus Gans *
|
* Copyright 2012-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 *
|
||||||
|
@ -101,7 +101,7 @@ void inputStreamExample()
|
||||||
void outputStreamExample()
|
void outputStreamExample()
|
||||||
{
|
{
|
||||||
// Test: output stream (operator <<)
|
// Test: output stream (operator <<)
|
||||||
const finalcut::FString& out = L"A test string for 0 \x20ac";
|
const finalcut::FString out{L"A test string for 0 \x20ac"};
|
||||||
std::cout << " outstream << " << out << std::endl;
|
std::cout << " outstream << " << out << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ void streamingFromFStringExample()
|
||||||
std::wcout << "stream out: " << stream_wstring << std::endl;
|
std::wcout << "stream out: " << stream_wstring << std::endl;
|
||||||
|
|
||||||
// ...to wide character
|
// ...to wide character
|
||||||
wchar_t stream_wchar_t = L'\0';
|
wchar_t stream_wchar_t{L'\0'};
|
||||||
finalcut::FString("w") >> stream_wchar_t;
|
finalcut::FString("w") >> stream_wchar_t;
|
||||||
std::wcout << "stream out: " << stream_wchar_t << std::endl;
|
std::wcout << "stream out: " << stream_wchar_t << std::endl;
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ void streamToFloat()
|
||||||
void CStringOutputExample()
|
void CStringOutputExample()
|
||||||
{
|
{
|
||||||
// Test: c-string output
|
// Test: c-string output
|
||||||
const finalcut::FString& out = L"A test string for 0 \x20ac";
|
const finalcut::FString out{L"A test string for 0 \x20ac"};
|
||||||
printf (" c_str: \"%s\"\n", out.c_str());
|
printf (" c_str: \"%s\"\n", out.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ void copyIntoFString()
|
||||||
void utf8StringOutputExample()
|
void utf8StringOutputExample()
|
||||||
{
|
{
|
||||||
// Test: utf-8 string
|
// Test: utf-8 string
|
||||||
const finalcut::FString& len = "длина́";
|
const finalcut::FString len{"длина́"};
|
||||||
std::cout << " length: \"" << len << "\" has "
|
std::cout << " length: \"" << len << "\" has "
|
||||||
<< len.getLength() << " characters" << std::endl;
|
<< len.getLength() << " characters" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -335,11 +335,11 @@ void utf8StringOutputExample()
|
||||||
void letterCaseExample()
|
void letterCaseExample()
|
||||||
{
|
{
|
||||||
// Test: convert uppercase letter to lowercase
|
// Test: convert uppercase letter to lowercase
|
||||||
const finalcut::FString& lower = finalcut::FString(L"InPut").toLower();
|
const finalcut::FString lower{finalcut::FString(L"InPut").toLower()};
|
||||||
std::wcout << L" toLower: " << lower << std::endl;
|
std::wcout << L" toLower: " << lower << std::endl;
|
||||||
|
|
||||||
// Test: convert lowercase letter to uppercase
|
// Test: convert lowercase letter to uppercase
|
||||||
const finalcut::FString& upper = finalcut::FString("inPut").toUpper();
|
const finalcut::FString upper{finalcut::FString("inPut").toUpper()};
|
||||||
std::cout << " toUpper: " << upper << std::endl;
|
std::cout << " toUpper: " << upper << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,7 +414,7 @@ void stringConcatenationExample()
|
||||||
void stringCompareExample()
|
void stringCompareExample()
|
||||||
{
|
{
|
||||||
// Test: compare operators ==, <=, <, >=, >, !=
|
// Test: compare operators ==, <=, <, >=, >, !=
|
||||||
const finalcut::FString& cmp = "compare";
|
const finalcut::FString cmp{"compare"};
|
||||||
|
|
||||||
if ( cmp == finalcut::FString("compare") )
|
if ( cmp == finalcut::FString("compare") )
|
||||||
std::cout << " cmp: == Ok" << std::endl;
|
std::cout << " cmp: == Ok" << std::endl;
|
||||||
|
@ -451,10 +451,10 @@ void stringCompareExample()
|
||||||
void stringSplittingExample()
|
void stringSplittingExample()
|
||||||
{
|
{
|
||||||
// Test: split a string with a delimiter and returns a vector (array)
|
// Test: split a string with a delimiter and returns a vector (array)
|
||||||
finalcut::FString split_str = "a,b,c,d";
|
finalcut::FString split_str{"a,b,c,d"};
|
||||||
std::cout << " split: \""
|
std::cout << " split: \""
|
||||||
<< split_str << "\" into substrings ->";
|
<< split_str << "\" into substrings ->";
|
||||||
finalcut::FStringList parts = split_str.split(",");
|
finalcut::FStringList parts{ split_str.split(",") };
|
||||||
finalcut::FStringList::iterator it, end;
|
finalcut::FStringList::iterator it, end;
|
||||||
end = parts.end();
|
end = parts.end();
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ void stringSplittingExample()
|
||||||
void fromatStringExample()
|
void fromatStringExample()
|
||||||
{
|
{
|
||||||
// Test: format a string with sprintf
|
// Test: format a string with sprintf
|
||||||
finalcut::FString formatStr = "";
|
finalcut::FString formatStr{""};
|
||||||
std::cout << " formatted: "
|
std::cout << " formatted: "
|
||||||
<< formatStr.sprintf("sqrt(%d) = %d", 16, 4)
|
<< formatStr.sprintf("sqrt(%d) = %d", 16, 4)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
@ -533,7 +533,7 @@ void convertToNumberExample()
|
||||||
void convertNumberToStringExample()
|
void convertNumberToStringExample()
|
||||||
{
|
{
|
||||||
// Test: convert integer and double value to a string
|
// Test: convert integer and double value to a string
|
||||||
finalcut::FString num1, num2, num3;
|
finalcut::FString num1{}, num2{}, num3{};
|
||||||
num1.setNumber(137u);
|
num1.setNumber(137u);
|
||||||
num2.setNumber(-512);
|
num2.setNumber(-512);
|
||||||
num3.setNumber(3.141592653589793238L, 12);
|
num3.setNumber(3.141592653589793238L, 12);
|
||||||
|
@ -550,7 +550,7 @@ void formatedNumberExample()
|
||||||
{
|
{
|
||||||
// Test: convert and format a integer number with thousand separator
|
// Test: convert and format a integer number with thousand separator
|
||||||
std::setlocale (LC_NUMERIC, "");
|
std::setlocale (LC_NUMERIC, "");
|
||||||
finalcut::FString fnum1, fnum2;
|
finalcut::FString fnum1{}, fnum2{};
|
||||||
#if defined(__LP64__) || defined(_LP64)
|
#if defined(__LP64__) || defined(_LP64)
|
||||||
// 64-bit architecture
|
// 64-bit architecture
|
||||||
fnum1.setFormatedNumber(0xffffffffffffffffu, '\'');
|
fnum1.setFormatedNumber(0xffffffffffffffffu, '\'');
|
||||||
|
@ -570,7 +570,7 @@ void formatedNumberExample()
|
||||||
void trimExample()
|
void trimExample()
|
||||||
{
|
{
|
||||||
// Test: remove whitespace from the end of a string
|
// Test: remove whitespace from the end of a string
|
||||||
const finalcut::FString& trim_str = " A string \t";
|
const finalcut::FString& trim_str{" A string \t"};
|
||||||
std::wcout << " rtrim: \""
|
std::wcout << " rtrim: \""
|
||||||
<< trim_str.rtrim() << "\"" << std::endl;
|
<< trim_str.rtrim() << "\"" << std::endl;
|
||||||
|
|
||||||
|
@ -587,8 +587,8 @@ void trimExample()
|
||||||
void substringExample()
|
void substringExample()
|
||||||
{
|
{
|
||||||
// Test: 11 characters from the left of the string
|
// Test: 11 characters from the left of the string
|
||||||
const finalcut::FString& alphabet = "a b c d e f g h i j k l m "
|
const finalcut::FString alphabet{ "a b c d e f g h i j k l m "
|
||||||
"n o p q r s t u v w x y z";
|
"n o p q r s t u v w x y z" };
|
||||||
std::cout << " left: \""
|
std::cout << " left: \""
|
||||||
<< alphabet.left(11) << "\"" << std::endl;
|
<< alphabet.left(11) << "\"" << std::endl;
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ void substringExample()
|
||||||
void insertExample()
|
void insertExample()
|
||||||
{
|
{
|
||||||
// Test: insert a string at index position 7
|
// Test: insert a string at index position 7
|
||||||
finalcut::FString insert_str = "I am a string";
|
finalcut::FString insert_str{"I am a string"};
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -622,7 +622,7 @@ void insertExample()
|
||||||
void indexExample()
|
void indexExample()
|
||||||
{
|
{
|
||||||
// Test: get character access at a specified index position
|
// Test: get character access at a specified index position
|
||||||
finalcut::FString index(5); // string with five characters
|
finalcut::FString index{5}; // string with five characters
|
||||||
index = "index";
|
index = "index";
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -642,7 +642,7 @@ void indexExample()
|
||||||
void iteratorExample()
|
void iteratorExample()
|
||||||
{
|
{
|
||||||
// Test: character access with std::iterator
|
// Test: character access with std::iterator
|
||||||
const finalcut::FString& stringIterator = "iterator";
|
const finalcut::FString stringIterator{"iterator"};
|
||||||
finalcut::FString::iterator iter;
|
finalcut::FString::iterator iter;
|
||||||
iter = stringIterator.begin();
|
iter = stringIterator.begin();
|
||||||
std::cout << " " << stringIterator << ": ";
|
std::cout << " " << stringIterator << ": ";
|
||||||
|
@ -662,7 +662,7 @@ void iteratorExample()
|
||||||
void overwriteExample()
|
void overwriteExample()
|
||||||
{
|
{
|
||||||
// Test: overwrite string at position 10 with "for t"
|
// Test: overwrite string at position 10 with "for t"
|
||||||
finalcut::FString overwrite_std = "Overwrite the rest";
|
finalcut::FString overwrite_std{"Overwrite the rest"};
|
||||||
std::cout << "overwrite: "
|
std::cout << "overwrite: "
|
||||||
<< overwrite_std.overwrite("for t", 10) << std::endl;
|
<< overwrite_std.overwrite("for t", 10) << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -671,7 +671,7 @@ void overwriteExample()
|
||||||
void removeExample()
|
void removeExample()
|
||||||
{
|
{
|
||||||
// Test: remove 2 characters at position 7
|
// Test: remove 2 characters at position 7
|
||||||
finalcut::FString remove_std = "A fast remove";
|
finalcut::FString remove_std{"A fast remove"};
|
||||||
std::cout << " remove: "
|
std::cout << " remove: "
|
||||||
<< remove_std.remove(7, 2) << std::endl;
|
<< remove_std.remove(7, 2) << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -680,7 +680,7 @@ void removeExample()
|
||||||
void substringIncludeExample()
|
void substringIncludeExample()
|
||||||
{
|
{
|
||||||
// Test: includes a substring (positive test)
|
// Test: includes a substring (positive test)
|
||||||
finalcut::FString include_std = "string";
|
finalcut::FString include_std{"string"};
|
||||||
|
|
||||||
if ( include_std.includes("ring") )
|
if ( include_std.includes("ring") )
|
||||||
std::cout << " includes: \""
|
std::cout << " includes: \""
|
||||||
|
@ -706,7 +706,7 @@ void substringIncludeExample()
|
||||||
void replaceExample()
|
void replaceExample()
|
||||||
{
|
{
|
||||||
// Test: find and replace a substring
|
// Test: find and replace a substring
|
||||||
finalcut::FString source_str = "computer and software";
|
finalcut::FString source_str{"computer and software"};
|
||||||
const finalcut::FString& replace_str = \
|
const finalcut::FString& replace_str = \
|
||||||
source_str.replace("computer", "hard-");
|
source_str.replace("computer", "hard-");
|
||||||
std::cout << " replace: "
|
std::cout << " replace: "
|
||||||
|
@ -717,7 +717,7 @@ void replaceExample()
|
||||||
void tabToSpaceExample()
|
void tabToSpaceExample()
|
||||||
{
|
{
|
||||||
// Test: convert tabs to spaces
|
// Test: convert tabs to spaces
|
||||||
const finalcut::FString& tab_str = "1234\t5678";
|
const finalcut::FString tab_str{"1234\t5678"};
|
||||||
std::cout << " tab: "
|
std::cout << " tab: "
|
||||||
<< tab_str.expandTabs() << std::endl;
|
<< tab_str.expandTabs() << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -726,7 +726,7 @@ void tabToSpaceExample()
|
||||||
void backspaceControlCharacterExample()
|
void backspaceControlCharacterExample()
|
||||||
{
|
{
|
||||||
// Test: backspaces remove characters in the string
|
// Test: backspaces remove characters in the string
|
||||||
const finalcut::FString& bs_str = "t\b\bTesT\bt";
|
const finalcut::FString bs_str{"t\b\bTesT\bt"};
|
||||||
std::cout << "backspace: "
|
std::cout << "backspace: "
|
||||||
<< bs_str.removeBackspaces() << std::endl;
|
<< bs_str.removeBackspaces() << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -735,7 +735,7 @@ void backspaceControlCharacterExample()
|
||||||
void deleteControlCharacterExample()
|
void deleteControlCharacterExample()
|
||||||
{
|
{
|
||||||
// Test: delete characters remove characters in the string
|
// Test: delete characters remove characters in the string
|
||||||
const finalcut::FString& del_str = "apple \177\177\177pietree";
|
const finalcut::FString del_str{"apple \177\177\177pietree"};
|
||||||
std::cout << " delete: "
|
std::cout << " delete: "
|
||||||
<< del_str.removeDel() << std::endl;
|
<< del_str.removeDel() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,7 +261,7 @@ void AttribDemo::printColorLine()
|
||||||
{
|
{
|
||||||
auto parent = static_cast<AttribDlg*>(getParent());
|
auto parent = static_cast<AttribDlg*>(getParent());
|
||||||
|
|
||||||
for (FColor color = 0; color < colors; color++)
|
for (FColor color{0}; color < colors; color++)
|
||||||
{
|
{
|
||||||
print() << FColorPair(color, parent->bgcolor) << " # ";
|
print() << FColorPair(color, parent->bgcolor) << " # ";
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ void AttribDemo::draw()
|
||||||
[&] { printProtected(); },
|
[&] { printProtected(); },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (std::size_t y = 0; y < getParentWidget()->getHeight() - 7; y++)
|
for (std::size_t y{0}; y < getParentWidget()->getHeight() - 7; y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(1, 2 + int(y));
|
print() << FPoint(1, 2 + int(y));
|
||||||
|
|
||||||
|
|
|
@ -181,8 +181,7 @@ void tcapNumeric (const std::string& name, int cap_num)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void tcapString (const std::string& name, const char cap_str[])
|
void tcapString (const std::string& name, const char cap_str[])
|
||||||
{
|
{
|
||||||
uInt len;
|
std::string sequence{};
|
||||||
std::string sequence;
|
|
||||||
std::cout << name << ": ";
|
std::cout << name << ": ";
|
||||||
|
|
||||||
if ( cap_str == 0 )
|
if ( cap_str == 0 )
|
||||||
|
@ -191,9 +190,9 @@ void tcapString (const std::string& name, const char cap_str[])
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = uInt(std::strlen(cap_str));
|
uInt len = uInt(std::strlen(cap_str));
|
||||||
|
|
||||||
for (uInt i = 0; i < len; i++)
|
for (uInt i{0}; i < len; i++)
|
||||||
{
|
{
|
||||||
uChar c = uChar(cap_str[i]);
|
uChar c = uChar(cap_str[i]);
|
||||||
|
|
||||||
|
@ -298,7 +297,7 @@ void string()
|
||||||
finalcut::FTermcap::tcap_map (&tcap_strings)[] \
|
finalcut::FTermcap::tcap_map (&tcap_strings)[] \
|
||||||
= finalcut::FTermcap::strings;
|
= finalcut::FTermcap::strings;
|
||||||
|
|
||||||
for (int n = 0; n <= data::getNumberOfItems(); n++ )
|
for (int n{0}; n <= data::getNumberOfItems(); n++ )
|
||||||
{
|
{
|
||||||
const std::string name = data::strings[n].name;
|
const std::string name = data::strings[n].name;
|
||||||
const fc::termcaps cap = data::strings[n].cap;
|
const fc::termcaps cap = data::strings[n].cap;
|
||||||
|
@ -311,7 +310,7 @@ void string()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
bool disable_alt_screen = true;
|
bool disable_alt_screen{true};
|
||||||
finalcut::FApplication TermApp (argc, argv, disable_alt_screen);
|
finalcut::FApplication TermApp (argc, argv, disable_alt_screen);
|
||||||
|
|
||||||
// Pointer to the global virtual terminal object
|
// Pointer to the global virtual terminal object
|
||||||
|
|
|
@ -71,7 +71,7 @@ void Timer::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Timer::onTimer (finalcut::FTimerEvent* ev)
|
void Timer::onTimer (finalcut::FTimerEvent* ev)
|
||||||
{
|
{
|
||||||
bool is_last_line = false;
|
bool is_last_line{false};
|
||||||
int timer_id = ev->getTimerId();
|
int timer_id = ev->getTimerId();
|
||||||
|
|
||||||
if ( getPrintPos().getY() == int(getDesktopHeight()) )
|
if ( getPrintPos().getY() == int(getDesktopHeight()) )
|
||||||
|
|
|
@ -110,7 +110,7 @@ void Transparent::draw()
|
||||||
|
|
||||||
finalcut::FString line(getClientWidth(), '.');
|
finalcut::FString line(getClientWidth(), '.');
|
||||||
|
|
||||||
for (int n = 1; n <= int(getClientHeight()); n++)
|
for (int n{1}; n <= int(getClientHeight()); n++)
|
||||||
{
|
{
|
||||||
print() << FPoint(2, 2 + n) << line;
|
print() << FPoint(2, 2 + n) << line;
|
||||||
}
|
}
|
||||||
|
|
|
@ -572,7 +572,7 @@ void MyDialog::initWidgets()
|
||||||
myList.setMultiSelection();
|
myList.setMultiSelection();
|
||||||
myList.reserve(100);
|
myList.reserve(100);
|
||||||
|
|
||||||
for (int z = 1; z < 100; z++)
|
for (int z{1}; z < 100; z++)
|
||||||
myList.insert (finalcut::FString() << z << L" placeholder");
|
myList.insert (finalcut::FString() << z << L" placeholder");
|
||||||
|
|
||||||
// Text labels
|
// Text labels
|
||||||
|
@ -930,7 +930,7 @@ void MyDialog::cb_updateNumber (finalcut::FWidget* widget, FDataPtr data)
|
||||||
const auto& count = list.getCount();
|
const auto& count = list.getCount();
|
||||||
int select_num = 0;
|
int select_num = 0;
|
||||||
|
|
||||||
for (std::size_t n = 1; n <= count; n++)
|
for (std::size_t n{1}; n <= count; n++)
|
||||||
if ( list.isSelected(n) )
|
if ( list.isSelected(n) )
|
||||||
select_num++;
|
select_num++;
|
||||||
|
|
||||||
|
@ -1006,10 +1006,10 @@ void MyDialog::cb_setInput (finalcut::FWidget* widget, FDataPtr data)
|
||||||
|
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
const finalcut::FString ver = F_VERSION; // Library version
|
const finalcut::FString ver{F_VERSION}; // Library version
|
||||||
const finalcut::FString title = "The FINAL CUT "
|
const finalcut::FString title { "The FINAL CUT "
|
||||||
+ ver
|
+ ver
|
||||||
+ " (C) 2019 by Markus Gans";
|
+ " (C) 2019 by Markus Gans" };
|
||||||
|
|
||||||
// Create the application object app
|
// Create the application object app
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app(argc, argv);
|
||||||
|
|
|
@ -127,11 +127,10 @@ Watch::~Watch()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Watch::printTime()
|
void Watch::printTime()
|
||||||
{
|
{
|
||||||
finalcut::FString str;
|
finalcut::FString str{};
|
||||||
std::tm now;
|
std::tm now{};
|
||||||
std::time_t t;
|
|
||||||
|
|
||||||
t = std::time(0); // get current time
|
std::time_t t = std::time(0); // get current time
|
||||||
localtime_r(&t, &now);
|
localtime_r(&t, &now);
|
||||||
|
|
||||||
if ( sec )
|
if ( sec )
|
||||||
|
|
|
@ -98,8 +98,8 @@ SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
||||||
top_right_label.setEmphasis();
|
top_right_label.setEmphasis();
|
||||||
top_right_label.setGeometry (FPoint(int(getClientWidth()) - 5, 1), FSize(6, 1));
|
top_right_label.setGeometry (FPoint(int(getClientWidth()) - 5, 1), FSize(6, 1));
|
||||||
|
|
||||||
finalcut::FString bottom_label_text = "resize\n"
|
finalcut::FString bottom_label_text ( "resize\n"
|
||||||
"corner\n";
|
"corner\n" );
|
||||||
bottom_label_text += arrow_down;
|
bottom_label_text += arrow_down;
|
||||||
bottom_label = bottom_label_text;
|
bottom_label = bottom_label_text;
|
||||||
bottom_label.setAlignment (fc::alignRight);
|
bottom_label.setAlignment (fc::alignRight);
|
||||||
|
@ -263,7 +263,7 @@ Window::Window (finalcut::FWidget* parent)
|
||||||
Statusbar.setMessage("Status bar message");
|
Statusbar.setMessage("Status bar message");
|
||||||
|
|
||||||
// Generate data vector for the windows
|
// Generate data vector for the windows
|
||||||
for (int n = 1; n <= 6; n++)
|
for (int n{1}; n <= 6; n++)
|
||||||
{
|
{
|
||||||
auto win_dat = new win_data;
|
auto win_dat = new win_data;
|
||||||
win_dat->title.sprintf("Window %1d", n);
|
win_dat->title.sprintf("Window %1d", n);
|
||||||
|
|
|
@ -38,26 +38,26 @@ namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
// Global application object
|
// Global application object
|
||||||
static FApplication* app_object = nullptr;
|
static FApplication* app_object{nullptr};
|
||||||
|
|
||||||
// Flag to exit the local event loop
|
// Flag to exit the local event loop
|
||||||
static bool app_exit_loop = false;
|
static bool app_exit_loop{false};
|
||||||
|
|
||||||
// Static attributes
|
// Static attributes
|
||||||
FWidget* FWidget::main_widget = nullptr; // main application widget
|
FWidget* FWidget::main_widget {nullptr}; // main application widget
|
||||||
FWidget* FWidget::active_window = nullptr; // the active window
|
FWidget* FWidget::active_window {nullptr}; // the active window
|
||||||
FWidget* FWidget::focus_widget = nullptr; // has keyboard input focus
|
FWidget* FWidget::focus_widget {nullptr}; // has keyboard input focus
|
||||||
FWidget* FWidget::clicked_widget = nullptr; // is focused by click
|
FWidget* FWidget::clicked_widget {nullptr}; // is focused by click
|
||||||
FWidget* FWidget::open_menu = nullptr; // currently open menu
|
FWidget* FWidget::open_menu {nullptr}; // currently open menu
|
||||||
FWidget* FWidget::move_size_widget = nullptr; // move/size by keyboard
|
FWidget* FWidget::move_size_widget {nullptr}; // move/size by keyboard
|
||||||
FWidget* FApplication::keyboard_widget = nullptr; // has the keyboard focus
|
FWidget* FApplication::keyboard_widget {nullptr}; // has the keyboard focus
|
||||||
FKeyboard* FApplication::keyboard = nullptr; // keyboard access
|
FKeyboard* FApplication::keyboard {nullptr}; // keyboard access
|
||||||
FMouseControl* FApplication::mouse = nullptr; // mouse control
|
FMouseControl* FApplication::mouse {nullptr}; // mouse control
|
||||||
int FApplication::loop_level = 0; // event loop level
|
int FApplication::loop_level {0}; // event loop level
|
||||||
int FApplication::quit_code = 0;
|
int FApplication::quit_code {0};
|
||||||
bool FApplication::quit_now = false;
|
bool FApplication::quit_now {false};
|
||||||
|
|
||||||
FApplication::eventQueue* FApplication::event_queue = nullptr;
|
FApplication::eventQueue* FApplication::event_queue{nullptr};
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -81,7 +81,7 @@ FApplication::FApplication ( const int& _argc
|
||||||
|
|
||||||
if ( ! (_argc && _argv) )
|
if ( ! (_argc && _argv) )
|
||||||
{
|
{
|
||||||
static char* empty = C_STR("");
|
static char* empty{C_STR("")};
|
||||||
app_argc = 0;
|
app_argc = 0;
|
||||||
app_argv = static_cast<char**>(&empty);
|
app_argv = static_cast<char**>(&empty);
|
||||||
}
|
}
|
||||||
|
@ -128,11 +128,10 @@ int FApplication::exec() // run
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FApplication::enter_loop() // event loop
|
int FApplication::enter_loop() // event loop
|
||||||
{
|
{
|
||||||
bool old_app_exit_loop;
|
|
||||||
loop_level++;
|
loop_level++;
|
||||||
quit_now = false;
|
quit_now = false;
|
||||||
|
|
||||||
old_app_exit_loop = app_exit_loop;
|
bool old_app_exit_loop = app_exit_loop;
|
||||||
app_exit_loop = false;
|
app_exit_loop = false;
|
||||||
|
|
||||||
while ( ! (quit_now || app_exit_loop) )
|
while ( ! (quit_now || app_exit_loop) )
|
||||||
|
@ -265,15 +264,13 @@ bool FApplication::eventInQueue()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FApplication::removeQueuedEvent (const FObject* receiver)
|
bool FApplication::removeQueuedEvent (const FObject* receiver)
|
||||||
{
|
{
|
||||||
bool retval;
|
|
||||||
|
|
||||||
if ( ! eventInQueue() )
|
if ( ! eventInQueue() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( ! receiver )
|
if ( ! receiver )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
retval = false;
|
bool retval{false};
|
||||||
auto iter = event_queue->begin();
|
auto iter = event_queue->begin();
|
||||||
|
|
||||||
while ( iter != event_queue->end() )
|
while ( iter != event_queue->end() )
|
||||||
|
@ -410,8 +407,6 @@ void FApplication::cmd_options (const int& argc, char* argv[])
|
||||||
|
|
||||||
while ( true )
|
while ( true )
|
||||||
{
|
{
|
||||||
int c, idx = 0;
|
|
||||||
|
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
{C_STR("encoding"), required_argument, 0, 0 },
|
{C_STR("encoding"), required_argument, 0, 0 },
|
||||||
|
@ -433,7 +428,8 @@ void FApplication::cmd_options (const int& argc, char* argv[])
|
||||||
};
|
};
|
||||||
|
|
||||||
opterr = 0;
|
opterr = 0;
|
||||||
c = getopt_long (argc, argv, "", long_options, &idx);
|
int idx{0};
|
||||||
|
int c = getopt_long (argc, argv, "", long_options, &idx);
|
||||||
|
|
||||||
if ( c == -1 )
|
if ( c == -1 )
|
||||||
break;
|
break;
|
||||||
|
@ -497,7 +493,7 @@ inline void FApplication::findKeyboardWidget()
|
||||||
{
|
{
|
||||||
// Find the widget that has the keyboard focus
|
// Find the widget that has the keyboard focus
|
||||||
|
|
||||||
FWidget* widget = nullptr;
|
FWidget* widget{nullptr};
|
||||||
auto focus = getFocusWidget();
|
auto focus = getFocusWidget();
|
||||||
auto move_size = getMoveSizeWidget();
|
auto move_size = getMoveSizeWidget();
|
||||||
|
|
||||||
|
@ -710,7 +706,7 @@ bool FApplication::processDialogSwitchAccelerator()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FApplication::processAccelerator (const FWidget*& widget)
|
bool FApplication::processAccelerator (const FWidget*& widget)
|
||||||
{
|
{
|
||||||
bool accpt = false;
|
bool accpt{false};
|
||||||
|
|
||||||
if ( widget
|
if ( widget
|
||||||
&& widget->accelerator_list
|
&& widget->accelerator_list
|
||||||
|
@ -752,7 +748,7 @@ bool FApplication::processAccelerator (const FWidget*& widget)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FApplication::getMouseEvent()
|
bool FApplication::getMouseEvent()
|
||||||
{
|
{
|
||||||
bool mouse_event_occurred = false;
|
bool mouse_event_occurred{false};
|
||||||
|
|
||||||
if ( mouse && mouse->hasData() )
|
if ( mouse && mouse->hasData() )
|
||||||
{
|
{
|
||||||
|
@ -834,7 +830,7 @@ void FApplication::closeOpenMenu()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_window_menu;
|
bool is_window_menu{false};
|
||||||
auto super = menu->getSuperMenu();
|
auto super = menu->getSuperMenu();
|
||||||
|
|
||||||
if ( super && menu->isWindowsMenu(super) )
|
if ( super && menu->isWindowsMenu(super) )
|
||||||
|
@ -912,7 +908,7 @@ void FApplication::sendMouseEvent()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto& mouse_position = mouse->getPos();
|
const auto& mouse_position = mouse->getPos();
|
||||||
int key_state = 0;
|
int key_state{0};
|
||||||
|
|
||||||
if ( mouse->isShiftKeyPressed() )
|
if ( mouse->isShiftKeyPressed() )
|
||||||
key_state |= fc::ShiftButton;
|
key_state |= fc::ShiftButton;
|
||||||
|
@ -1179,7 +1175,7 @@ void FApplication::processCloseWidget()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FApplication::processNextEvent()
|
bool FApplication::processNextEvent()
|
||||||
{
|
{
|
||||||
uInt num_events = 0;
|
uInt num_events{0};
|
||||||
|
|
||||||
processKeyboardEvent();
|
processKeyboardEvent();
|
||||||
processMouseEvent();
|
processMouseEvent();
|
||||||
|
|
|
@ -217,9 +217,9 @@ bool FButton::setDown (bool enable)
|
||||||
void FButton::setText (const FString& txt)
|
void FButton::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
if ( txt.isNull() )
|
if ( txt.isNull() )
|
||||||
text = "";
|
text.setString("");
|
||||||
else
|
else
|
||||||
text = txt;
|
text.setString(txt);
|
||||||
|
|
||||||
detectHotkey();
|
detectHotkey();
|
||||||
}
|
}
|
||||||
|
@ -227,8 +227,7 @@ void FButton::setText (const FString& txt)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButton::hide()
|
void FButton::hide()
|
||||||
{
|
{
|
||||||
std::size_t s, f, size;
|
FColor fg{}, bg{};
|
||||||
FColor fg, bg;
|
|
||||||
auto parent_widget = getParentWidget();
|
auto parent_widget = getParentWidget();
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
|
|
||||||
|
@ -244,16 +243,16 @@ void FButton::hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
s = hasShadow() ? 1 : 0;
|
std::size_t s = hasShadow() ? 1 : 0;
|
||||||
f = isFlat() ? 1 : 0;
|
std::size_t f = isFlat() ? 1 : 0;
|
||||||
size = getWidth() + s + (f << 1);
|
std::size_t size = getWidth() + s + (f << 1);
|
||||||
|
|
||||||
if ( size == 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char* blank = createBlankArray(size + 1);
|
char* blank = createBlankArray(size + 1);
|
||||||
|
|
||||||
for (std::size_t y = 0; y < getHeight() + s + (f << 1); y++)
|
for (std::size_t y{0}; y < getHeight() + s + (f << 1); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(1 - int(f), 1 + int(y - f)) << blank;
|
print() << FPoint(1 - int(f), 1 + int(y - f)) << blank;
|
||||||
}
|
}
|
||||||
|
@ -309,7 +308,7 @@ void FButton::onMouseDown (FMouseEvent* ev)
|
||||||
getStatusBar()->drawMessage();
|
getStatusBar()->drawMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
FPoint tPos = ev->getTermPos();
|
FPoint tPos(ev->getTermPos());
|
||||||
|
|
||||||
if ( getTermGeometry().contains(tPos) )
|
if ( getTermGeometry().contains(tPos) )
|
||||||
setDown();
|
setDown();
|
||||||
|
@ -336,7 +335,7 @@ void FButton::onMouseMove (FMouseEvent* ev)
|
||||||
if ( ev->getButton() != fc::LeftButton )
|
if ( ev->getButton() != fc::LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FPoint tPos = ev->getTermPos();
|
FPoint tPos(ev->getTermPos());
|
||||||
|
|
||||||
if ( click_animation )
|
if ( click_animation )
|
||||||
{
|
{
|
||||||
|
@ -465,7 +464,7 @@ inline std::size_t FButton::clickAnimationIndent (FWidget* parent_widget)
|
||||||
setColor ( parent_widget->getForegroundColor()
|
setColor ( parent_widget->getForegroundColor()
|
||||||
, parent_widget->getBackgroundColor() );
|
, parent_widget->getBackgroundColor() );
|
||||||
|
|
||||||
for (std::size_t y = 1; y <= getHeight(); y++)
|
for (std::size_t y{1}; y <= getHeight(); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(1, int(y)) << ' '; // clear one left █
|
print() << FPoint(1, int(y)) << ' '; // clear one left █
|
||||||
}
|
}
|
||||||
|
@ -484,7 +483,7 @@ inline void FButton::clearRightMargin (FWidget* parent_widget)
|
||||||
setColor ( parent_widget->getForegroundColor()
|
setColor ( parent_widget->getForegroundColor()
|
||||||
, parent_widget->getBackgroundColor() );
|
, parent_widget->getBackgroundColor() );
|
||||||
|
|
||||||
for (int y = 1; y <= int(getHeight()); y++)
|
for (int y{1}; y <= int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true); // Light background
|
setReverse(true); // Light background
|
||||||
|
@ -503,7 +502,7 @@ inline void FButton::drawMarginLeft()
|
||||||
|
|
||||||
setColor (getForegroundColor(), button_bg);
|
setColor (getForegroundColor(), button_bg);
|
||||||
|
|
||||||
for (std::size_t y = 0; y < getHeight(); y++)
|
for (std::size_t y{0}; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(1 + int(indent), 1 + int(y));
|
print() << FPoint(1 + int(indent), 1 + int(y));
|
||||||
|
|
||||||
|
@ -519,7 +518,7 @@ inline void FButton::drawMarginRight()
|
||||||
{
|
{
|
||||||
// Print right margin
|
// Print right margin
|
||||||
|
|
||||||
for (std::size_t y = 0; y < getHeight(); y++)
|
for (std::size_t y{0}; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(int(getWidth() + indent), 1 + int(y));
|
print() << FPoint(int(getWidth() + indent), 1 + int(y));
|
||||||
|
|
||||||
|
@ -538,19 +537,19 @@ inline void FButton::drawTopBottomBackground()
|
||||||
if ( getHeight() < 2 )
|
if ( getHeight() < 2 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (std::size_t y = 0; y < vcenter_offset; y++)
|
for (std::size_t y{0}; y < vcenter_offset; y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(2 + int(indent), 1 + int(y));
|
print() << FPoint(2 + int(indent), 1 + int(y));
|
||||||
|
|
||||||
for (std::size_t x = 1; x < getWidth() - 1; x++)
|
for (std::size_t x{1}; x < getWidth() - 1; x++)
|
||||||
print (space_char); // █
|
print (space_char); // █
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::size_t y = vcenter_offset + 1; y < getHeight(); y++)
|
for (std::size_t y{vcenter_offset + 1}; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(2 + int(indent), 1 + int(y));
|
print() << FPoint(2 + int(indent), 1 + int(y));
|
||||||
|
|
||||||
for (std::size_t x = 1; x < getWidth() - 1; x++)
|
for (std::size_t x{1}; x < getWidth() - 1; x++)
|
||||||
print (space_char); // █
|
print (space_char); // █
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -558,7 +557,7 @@ inline void FButton::drawTopBottomBackground()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
{
|
{
|
||||||
std::size_t pos;
|
std::size_t pos{};
|
||||||
print() << FPoint(2 + int(indent), 1 + int(vcenter_offset))
|
print() << FPoint(2 + int(indent), 1 + int(vcenter_offset))
|
||||||
<< FColorPair (button_fg, button_bg);
|
<< FColorPair (button_fg, button_bg);
|
||||||
|
|
||||||
|
@ -584,7 +583,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
if ( active_focus && (isMonochron() || getMaxColor() < 16) )
|
if ( active_focus && (isMonochron() || getMaxColor() < 16) )
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
for ( std::size_t z = 0
|
for ( std::size_t z{0}
|
||||||
; pos < center_offset + txtlength && z < getWidth() - 2
|
; pos < center_offset + txtlength && z < getWidth() - 2
|
||||||
; z++, pos++)
|
; z++, pos++)
|
||||||
{
|
{
|
||||||
|
@ -630,7 +629,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButton::draw()
|
void FButton::draw()
|
||||||
{
|
{
|
||||||
wchar_t* button_text;
|
wchar_t* button_text{};
|
||||||
auto parent_widget = getParentWidget();
|
auto parent_widget = getParentWidget();
|
||||||
txtlength = text.getLength();
|
txtlength = text.getLength();
|
||||||
space_char = int(' ');
|
space_char = int(' ');
|
||||||
|
|
|
@ -116,7 +116,7 @@ bool FButtonGroup::setEnable (bool enable)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButtonGroup::setText (const FString& txt)
|
void FButtonGroup::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
text = txt;
|
text.setString(txt);
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
|
@ -183,8 +183,7 @@ bool FButtonGroup::hasCheckedButton() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButtonGroup::hide()
|
void FButtonGroup::hide()
|
||||||
{
|
{
|
||||||
std::size_t size;
|
FColor fg{}, bg{};
|
||||||
FColor fg, bg;
|
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
auto parent_widget = getParentWidget();
|
auto parent_widget = getParentWidget();
|
||||||
|
|
||||||
|
@ -213,14 +212,14 @@ void FButtonGroup::hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
size = getWidth();
|
std::size_t size = getWidth();
|
||||||
|
|
||||||
if ( size == 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char* blank = createBlankArray(size + 1);
|
char* blank = createBlankArray(size + 1);
|
||||||
|
|
||||||
for (int y = 0; y < int(getHeight()); y++)
|
for (int y{0}; y < int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
FWidget::setPrintPos (FPoint(1, 1 + y));
|
FWidget::setPrintPos (FPoint(1, 1 + y));
|
||||||
print (blank);
|
print (blank);
|
||||||
|
@ -298,7 +297,7 @@ void FButtonGroup::checkScrollSize (const FRect& r)
|
||||||
|
|
||||||
if ( ! scrollgeometry.contains(r) )
|
if ( ! scrollgeometry.contains(r) )
|
||||||
{
|
{
|
||||||
FRect r_combined = scrollgeometry.combined(r);
|
FRect r_combined (scrollgeometry.combined(r));
|
||||||
setScrollSize (r_combined.getSize());
|
setScrollSize (r_combined.getSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,12 +423,11 @@ void FButtonGroup::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButtonGroup::drawLabel()
|
void FButtonGroup::drawLabel()
|
||||||
{
|
{
|
||||||
wchar_t* LabelText;
|
|
||||||
|
|
||||||
if ( text.isNull() || text.isEmpty() )
|
if ( text.isNull() || text.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FString txt = " " + text + " ";
|
wchar_t* LabelText{};
|
||||||
|
FString txt{" " + text + " "};
|
||||||
std::size_t length = txt.getLength();
|
std::size_t length = txt.getLength();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -494,7 +492,7 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
|
||||||
else
|
else
|
||||||
setColor(wc.label_inactive_fg, wc.label_inactive_bg);
|
setColor(wc.label_inactive_fg, wc.label_inactive_bg);
|
||||||
|
|
||||||
for (std::size_t z = 0; z < length; z++)
|
for (std::size_t z{0}; z < length; z++)
|
||||||
{
|
{
|
||||||
if ( (z == hotkeypos) && flags.active )
|
if ( (z == hotkeypos) && flags.active )
|
||||||
{
|
{
|
||||||
|
@ -523,7 +521,7 @@ void FButtonGroup::directFocus()
|
||||||
{
|
{
|
||||||
if ( ! hasFocusedButton() )
|
if ( ! hasFocusedButton() )
|
||||||
{
|
{
|
||||||
bool found_checked = false;
|
bool found_checked{false};
|
||||||
|
|
||||||
if ( hasCheckedButton() && ! buttonlist.empty() )
|
if ( hasCheckedButton() && ! buttonlist.empty() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,7 +62,7 @@ void FCheckMenuItem::init (FWidget* parent)
|
||||||
|
|
||||||
if ( isMenu(parent) ) // Parent is menu
|
if ( isMenu(parent) ) // Parent is menu
|
||||||
{
|
{
|
||||||
auto menu_ptr = static_cast<FMenu*>(parent);
|
auto menu_ptr{static_cast<FMenu*>(parent)};
|
||||||
menu_ptr->has_checkable_items = true;
|
menu_ptr->has_checkable_items = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ int FDialog::exec()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::setPos (const FPoint& pos, bool)
|
void FDialog::setPos (const FPoint& pos, bool)
|
||||||
{
|
{
|
||||||
FRect old_geometry, restore;
|
|
||||||
setPos_error = false;
|
setPos_error = false;
|
||||||
|
|
||||||
// Avoid to move widget completely outside the terminal
|
// Avoid to move widget completely outside the terminal
|
||||||
|
@ -185,7 +185,7 @@ void FDialog::setPos (const FPoint& pos, bool)
|
||||||
const auto& shadow = getShadow();
|
const auto& shadow = getShadow();
|
||||||
std::size_t width = getWidth() + shadow.getWidth(); // width + right shadow
|
std::size_t width = getWidth() + shadow.getWidth(); // width + right shadow
|
||||||
std::size_t height = getHeight() + shadow.getHeight(); // height + bottom shadow
|
std::size_t height = getHeight() + shadow.getHeight(); // height + bottom shadow
|
||||||
old_geometry = getTermGeometryWithShadow();
|
FRect old_geometry (getTermGeometryWithShadow());
|
||||||
|
|
||||||
// move to the new position
|
// move to the new position
|
||||||
FWindow::setPos(pos, false);
|
FWindow::setPos(pos, false);
|
||||||
|
@ -194,6 +194,10 @@ void FDialog::setPos (const FPoint& pos, bool)
|
||||||
// restoring the non-covered terminal areas
|
// restoring the non-covered terminal areas
|
||||||
if ( getTermGeometry().overlap(old_geometry) )
|
if ( getTermGeometry().overlap(old_geometry) )
|
||||||
{
|
{
|
||||||
|
FRect restore{};
|
||||||
|
std::size_t d_width = std::size_t(std::abs(dx));
|
||||||
|
std::size_t d_height = std::size_t(std::abs(dy));
|
||||||
|
|
||||||
// dx > 0 : move left
|
// dx > 0 : move left
|
||||||
// dx = 0 : move vertical
|
// dx = 0 : move vertical
|
||||||
// dx < 0 : move right
|
// dx < 0 : move right
|
||||||
|
@ -201,9 +205,6 @@ void FDialog::setPos (const FPoint& pos, bool)
|
||||||
// dy = 0 : move horizontal
|
// dy = 0 : move horizontal
|
||||||
// dy < 0 : move down
|
// dy < 0 : move down
|
||||||
|
|
||||||
std::size_t d_width = std::size_t(std::abs(dx));
|
|
||||||
std::size_t d_height = std::size_t(std::abs(dy));
|
|
||||||
|
|
||||||
if ( dx > 0 )
|
if ( dx > 0 )
|
||||||
{
|
{
|
||||||
if ( dy > 0 )
|
if ( dy > 0 )
|
||||||
|
@ -295,7 +296,7 @@ void FDialog::setSize (const FSize& size, bool adjust)
|
||||||
|
|
||||||
// get adjust width and height
|
// get adjust width and height
|
||||||
std::size_t w = getWidth() + shadow.getWidth();
|
std::size_t w = getWidth() + shadow.getWidth();
|
||||||
std::size_t h = getHeight()+ shadow.getHeight();
|
std::size_t h = getHeight() + shadow.getHeight();
|
||||||
|
|
||||||
// dw > 0 : scale down width
|
// dw > 0 : scale down width
|
||||||
// dw = 0 : scale only height
|
// dw = 0 : scale only height
|
||||||
|
@ -518,7 +519,7 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
||||||
&& titlebar_x < getTermX() + int(getWidth())
|
&& titlebar_x < getTermX() + int(getWidth())
|
||||||
&& titlebar_y == int(getTermY()) )
|
&& titlebar_y == int(getTermY()) )
|
||||||
{
|
{
|
||||||
FPoint deltaPos = ms.termPos - titlebar_click_pos;
|
FPoint deltaPos(ms.termPos - titlebar_click_pos);
|
||||||
move (deltaPos);
|
move (deltaPos);
|
||||||
titlebar_click_pos = ms.termPos;
|
titlebar_click_pos = ms.termPos;
|
||||||
}
|
}
|
||||||
|
@ -562,7 +563,7 @@ void FDialog::onMouseMove (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( ! titlebar_click_pos.isOrigin() )
|
if ( ! titlebar_click_pos.isOrigin() )
|
||||||
{
|
{
|
||||||
FPoint deltaPos = ms.termPos - titlebar_click_pos;
|
FPoint deltaPos(ms.termPos - titlebar_click_pos);
|
||||||
move (deltaPos);
|
move (deltaPos);
|
||||||
titlebar_click_pos = ms.termPos;
|
titlebar_click_pos = ms.termPos;
|
||||||
}
|
}
|
||||||
|
@ -586,15 +587,14 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
getZoomButtonWidth(),
|
getZoomButtonWidth(),
|
||||||
false // mouse_over_menu
|
false // mouse_over_menu
|
||||||
};
|
};
|
||||||
int x, y;
|
|
||||||
|
|
||||||
if ( ev->getButton() != fc::LeftButton )
|
if ( ev->getButton() != fc::LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
x = getTermX();
|
int x = getTermX();
|
||||||
y = getTermY();
|
int y = getTermY();
|
||||||
FRect title_button(x, y, 3, 1);
|
FRect title_button(x, y, 3, 1);
|
||||||
FPoint tPos = ms.termPos;
|
FPoint tPos(ms.termPos);
|
||||||
|
|
||||||
if ( title_button.contains(tPos) )
|
if ( title_button.contains(tPos) )
|
||||||
{
|
{
|
||||||
|
@ -825,9 +825,9 @@ void FDialog::initDialogMenu()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FPoint p = getPos();
|
FPoint p(getPos());
|
||||||
p.y_ref()++;
|
p.y_ref()++;
|
||||||
dialog_menu->setPos (p);
|
dialog_menu->setPos(p);
|
||||||
dgl_menuitem = dialog_menu->getItem();
|
dgl_menuitem = dialog_menu->getItem();
|
||||||
dgl_menuitem->ignorePadding();
|
dgl_menuitem->ignorePadding();
|
||||||
dgl_menuitem->unsetFocusable();
|
dgl_menuitem->unsetFocusable();
|
||||||
|
@ -1093,8 +1093,8 @@ inline void FDialog::drawZoomedButton()
|
||||||
void FDialog::drawTextBar()
|
void FDialog::drawTextBar()
|
||||||
{
|
{
|
||||||
// Fill with spaces (left of the title)
|
// Fill with spaces (left of the title)
|
||||||
std::size_t center_offset = 0;
|
std::size_t center_offset{0};
|
||||||
std::size_t x = 1;
|
std::size_t x{1};
|
||||||
|
|
||||||
if ( getMaxColor() < 16 )
|
if ( getMaxColor() < 16 )
|
||||||
setBold();
|
setBold();
|
||||||
|
@ -1143,7 +1143,7 @@ void FDialog::restoreOverlaidWindows()
|
||||||
if ( ! window_list || window_list->empty() )
|
if ( ! window_list || window_list->empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool overlaid = false;
|
bool overlaid{false};
|
||||||
|
|
||||||
for (auto&& win : *window_list)
|
for (auto&& win : *window_list)
|
||||||
{
|
{
|
||||||
|
@ -1166,7 +1166,7 @@ void FDialog::setCursorToFocusWidget()
|
||||||
&& focus->isShown()
|
&& focus->isShown()
|
||||||
&& focus->hasVisibleCursor() )
|
&& focus->hasVisibleCursor() )
|
||||||
{
|
{
|
||||||
FPoint cursor_pos = focus->getCursorPos();
|
FPoint cursor_pos(focus->getCursorPos());
|
||||||
focus->setCursorPos(cursor_pos);
|
focus->setCursorPos(cursor_pos);
|
||||||
updateVTermCursor(vwin);
|
updateVTermCursor(vwin);
|
||||||
}
|
}
|
||||||
|
@ -1207,7 +1207,7 @@ void FDialog::openMenu()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setOpenMenu(dialog_menu);
|
setOpenMenu(dialog_menu);
|
||||||
FPoint pos = getPos();
|
FPoint pos(getPos());
|
||||||
pos.y_ref()++;
|
pos.y_ref()++;
|
||||||
dialog_menu->setPos (pos);
|
dialog_menu->setPos (pos);
|
||||||
dialog_menu->setVisible();
|
dialog_menu->setVisible();
|
||||||
|
@ -1483,11 +1483,11 @@ void FDialog::resizeMouseDown (const mouseStates& ms)
|
||||||
if ( isResizeable() && isLowerRightResizeCorner(ms) )
|
if ( isResizeable() && isLowerRightResizeCorner(ms) )
|
||||||
{
|
{
|
||||||
resize_click_pos = ms.termPos;
|
resize_click_pos = ms.termPos;
|
||||||
FPoint lower_right_pos = getTermGeometry().getLowerRightPos();
|
FPoint lower_right_pos(getTermGeometry().getLowerRightPos());
|
||||||
|
|
||||||
if ( ms.termPos != lower_right_pos )
|
if ( ms.termPos != lower_right_pos )
|
||||||
{
|
{
|
||||||
FPoint deltaPos = ms.termPos - lower_right_pos;
|
FPoint deltaPos(ms.termPos - lower_right_pos);
|
||||||
int w = lower_right_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
int w = lower_right_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
||||||
int h = lower_right_pos.getY() + deltaPos.getY() - getTermY() + 1;
|
int h = lower_right_pos.getY() + deltaPos.getY() - getTermY() + 1;
|
||||||
const FSize& size = FSize(std::size_t(w), std::size_t(h));
|
const FSize& size = FSize(std::size_t(w), std::size_t(h));
|
||||||
|
@ -1510,8 +1510,8 @@ void FDialog::resizeMouseUpMove (const mouseStates& ms, bool mouse_up)
|
||||||
resize_click_pos = ms.termPos;
|
resize_click_pos = ms.termPos;
|
||||||
int x2 = resize_click_pos.getX()
|
int x2 = resize_click_pos.getX()
|
||||||
, y2 = resize_click_pos.getY()
|
, y2 = resize_click_pos.getY()
|
||||||
, x2_offset = 0
|
, x2_offset{0}
|
||||||
, y2_offset = 0;
|
, y2_offset{0};
|
||||||
|
|
||||||
if ( r )
|
if ( r )
|
||||||
{
|
{
|
||||||
|
@ -1521,8 +1521,8 @@ void FDialog::resizeMouseUpMove (const mouseStates& ms, bool mouse_up)
|
||||||
|
|
||||||
if ( ms.termPos != getTermGeometry().getLowerRightPos() )
|
if ( ms.termPos != getTermGeometry().getLowerRightPos() )
|
||||||
{
|
{
|
||||||
int w, h;
|
int w{}, h{};
|
||||||
FPoint deltaPos = ms.termPos - resize_click_pos;
|
FPoint deltaPos(ms.termPos - resize_click_pos);
|
||||||
|
|
||||||
if ( x2 - x2_offset <= int(getMaxWidth()) )
|
if ( x2 - x2_offset <= int(getMaxWidth()) )
|
||||||
w = resize_click_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
w = resize_click_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
||||||
|
|
|
@ -61,20 +61,20 @@ const FString fileChooser ( FWidget* parent
|
||||||
, const FString& filter
|
, const FString& filter
|
||||||
, FFileDialog::DialogType type )
|
, FFileDialog::DialogType type )
|
||||||
{
|
{
|
||||||
FString ret;
|
FString ret{};
|
||||||
FString path = dirname;
|
FString path(dirname);
|
||||||
FString file_filter = filter;
|
FString file_filter(filter);
|
||||||
|
|
||||||
if ( path.isNull() || path.isEmpty() )
|
if ( path.isNull() || path.isEmpty() )
|
||||||
{
|
{
|
||||||
path = FFileDialog::getHomeDir();
|
path.setString(FFileDialog::getHomeDir());
|
||||||
|
|
||||||
if ( path.isNull() || path.isEmpty() )
|
if ( path.isNull() || path.isEmpty() )
|
||||||
path = FString("/");
|
path.setString("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( file_filter.isNull() || file_filter.isEmpty() )
|
if ( file_filter.isNull() || file_filter.isEmpty() )
|
||||||
file_filter = FString("*");
|
file_filter.setString("*");
|
||||||
|
|
||||||
FFileDialog fileopen ( path
|
FFileDialog fileopen ( path
|
||||||
, file_filter
|
, file_filter
|
||||||
|
@ -90,7 +90,7 @@ const FString fileChooser ( FWidget* parent
|
||||||
}
|
}
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
FSystem* FFileDialog::fsystem = nullptr;
|
FSystem* FFileDialog::fsystem{nullptr};
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FFileDialog
|
// class FFileDialog
|
||||||
|
@ -179,9 +179,9 @@ const FString FFileDialog::getSelectedFile() const
|
||||||
void FFileDialog::setPath (const FString& dir)
|
void FFileDialog::setPath (const FString& dir)
|
||||||
{
|
{
|
||||||
const char* const dirname = dir.c_str();
|
const char* const dirname = dir.c_str();
|
||||||
char resolved_path[MAXPATHLEN];
|
char resolved_path[MAXPATHLEN]{};
|
||||||
FString r_dir;
|
FString r_dir{};
|
||||||
struct stat sb;
|
struct stat sb{};
|
||||||
|
|
||||||
if ( stat(dirname, &sb) != 0 )
|
if ( stat(dirname, &sb) != 0 )
|
||||||
{
|
{
|
||||||
|
@ -205,9 +205,9 @@ void FFileDialog::setPath (const FString& dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fsystem->realpath(dir.c_str(), resolved_path) != 0 )
|
if ( fsystem->realpath(dir.c_str(), resolved_path) != 0 )
|
||||||
r_dir = resolved_path;
|
r_dir.setString(resolved_path);
|
||||||
else
|
else
|
||||||
r_dir = dir;
|
r_dir.setString(dir);
|
||||||
|
|
||||||
if ( r_dir[r_dir.getLength() - 1] != '/' )
|
if ( r_dir[r_dir.getLength() - 1] != '/' )
|
||||||
directory = r_dir + "/";
|
directory = r_dir + "/";
|
||||||
|
@ -280,10 +280,7 @@ const FString FFileDialog::fileSaveChooser ( FWidget* parent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::adjustSize()
|
void FFileDialog::adjustSize()
|
||||||
{
|
{
|
||||||
int X, Y;
|
std::size_t max_width{}, max_height{};
|
||||||
std::size_t max_width;
|
|
||||||
std::size_t max_height;
|
|
||||||
std::size_t h;
|
|
||||||
auto root_widget = getRootWidget();
|
auto root_widget = getRootWidget();
|
||||||
|
|
||||||
if ( root_widget )
|
if ( root_widget )
|
||||||
|
@ -298,7 +295,7 @@ void FFileDialog::adjustSize()
|
||||||
max_height = 24;
|
max_height = 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
h = max_height - 6;
|
std::size_t h = max_height - 6;
|
||||||
|
|
||||||
if ( h < 15 ) // minimum
|
if ( h < 15 ) // minimum
|
||||||
h = 15;
|
h = 15;
|
||||||
|
@ -307,8 +304,8 @@ void FFileDialog::adjustSize()
|
||||||
h = 30;
|
h = 30;
|
||||||
|
|
||||||
setHeight (h, false);
|
setHeight (h, false);
|
||||||
X = 1 + int((max_width - getWidth()) / 2);
|
int X = 1 + int((max_width - getWidth()) / 2);
|
||||||
Y = 1 + int((max_height - getHeight()) / 3);
|
int Y = 1 + int((max_height - getHeight()) / 3);
|
||||||
setPos(FPoint(X, Y), false);
|
setPos(FPoint(X, Y), false);
|
||||||
filebrowser.setHeight (h - 8, false);
|
filebrowser.setHeight (h - 8, false);
|
||||||
hidden_check.setY (int(h) - 4, false);
|
hidden_check.setY (int(h) - 4, false);
|
||||||
|
@ -422,7 +419,7 @@ void FFileDialog::initCallbacks()
|
||||||
inline bool FFileDialog::pattern_match ( const char* const pattern
|
inline bool FFileDialog::pattern_match ( const char* const pattern
|
||||||
, char fname[] )
|
, char fname[] )
|
||||||
{
|
{
|
||||||
char search[128] = { };
|
char search[128]{};
|
||||||
|
|
||||||
if ( show_hidden && fname[0] == '.' && fname[1] != '\0' ) // hidden files
|
if ( show_hidden && fname[0] == '.' && fname[1] != '\0' ) // hidden files
|
||||||
{
|
{
|
||||||
|
@ -475,14 +472,14 @@ long FFileDialog::numOfDirs()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::sortDir()
|
void FFileDialog::sortDir()
|
||||||
{
|
{
|
||||||
long start, dir_num;
|
long start{};
|
||||||
|
|
||||||
if ( std::strcmp((*dir_entries.begin()).name, "..") == 0 )
|
if ( std::strcmp((*dir_entries.begin()).name, "..") == 0 )
|
||||||
start = 1;
|
start = 1;
|
||||||
else
|
else
|
||||||
start = 0;
|
start = 0;
|
||||||
|
|
||||||
dir_num = numOfDirs();
|
long dir_num = numOfDirs();
|
||||||
// directories first
|
// directories first
|
||||||
std::sort ( dir_entries.begin() + start
|
std::sort ( dir_entries.begin() + start
|
||||||
, dir_entries.end()
|
, dir_entries.end()
|
||||||
|
@ -565,7 +562,7 @@ int FFileDialog::readDir()
|
||||||
void FFileDialog::getEntry (const char* const dir, struct dirent* d_entry)
|
void FFileDialog::getEntry (const char* const dir, struct dirent* d_entry)
|
||||||
{
|
{
|
||||||
const char* const filter = filter_pattern.c_str();
|
const char* const filter = filter_pattern.c_str();
|
||||||
dir_entry entry;
|
dir_entry entry{};
|
||||||
|
|
||||||
entry.name = strdup(d_entry->d_name);
|
entry.name = strdup(d_entry->d_name);
|
||||||
|
|
||||||
|
@ -578,7 +575,7 @@ void FFileDialog::getEntry (const char* const dir, struct dirent* d_entry)
|
||||||
entry.symbolic_link = (d_entry->d_type & DT_LNK ) == DT_LNK;
|
entry.symbolic_link = (d_entry->d_type & DT_LNK ) == DT_LNK;
|
||||||
entry.socket = (d_entry->d_type & DT_SOCK) == DT_SOCK;
|
entry.socket = (d_entry->d_type & DT_SOCK) == DT_SOCK;
|
||||||
#else
|
#else
|
||||||
struct stat s;
|
struct stat s{};
|
||||||
stat (entry.name, &s);
|
stat (entry.name, &s);
|
||||||
entry.fifo = S_ISFIFO (s.st_mode);
|
entry.fifo = S_ISFIFO (s.st_mode);
|
||||||
entry.character_device = S_ISCHR (s.st_mode);
|
entry.character_device = S_ISCHR (s.st_mode);
|
||||||
|
@ -605,9 +602,9 @@ void FFileDialog::followSymLink (const char* const dir, dir_entry& entry)
|
||||||
if ( ! entry.symbolic_link )
|
if ( ! entry.symbolic_link )
|
||||||
return; // No symbolic link
|
return; // No symbolic link
|
||||||
|
|
||||||
char resolved_path[MAXPATHLEN] = { };
|
char resolved_path[MAXPATHLEN]{};
|
||||||
char symLink[MAXPATHLEN] = { };
|
char symLink[MAXPATHLEN]{};
|
||||||
struct stat sb;
|
struct stat sb{};
|
||||||
|
|
||||||
if ( ! fsystem )
|
if ( ! fsystem )
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
|
@ -654,7 +651,7 @@ void FFileDialog::selectDirectoryEntry (const char* const name)
|
||||||
if ( dir_entries.empty() )
|
if ( dir_entries.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::size_t i = 1;
|
std::size_t i{1};
|
||||||
|
|
||||||
for (auto&& entry : dir_entries)
|
for (auto&& entry : dir_entries)
|
||||||
{
|
{
|
||||||
|
@ -672,8 +669,8 @@ void FFileDialog::selectDirectoryEntry (const char* const name)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FFileDialog::changeDir (const FString& dirname)
|
int FFileDialog::changeDir (const FString& dirname)
|
||||||
{
|
{
|
||||||
FString lastdir = directory;
|
FString lastdir(directory);
|
||||||
FString newdir = dirname;
|
FString newdir(dirname);
|
||||||
|
|
||||||
if ( ! fsystem )
|
if ( ! fsystem )
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
|
@ -710,7 +707,7 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FString firstname = dir_entries[0].name;
|
FString firstname(dir_entries[0].name);
|
||||||
|
|
||||||
if ( dir_entries[0].directory )
|
if ( dir_entries[0].directory )
|
||||||
filename.setText(firstname + '/');
|
filename.setText(firstname + '/');
|
||||||
|
@ -742,9 +739,9 @@ void FFileDialog::printPath (const FString& txt)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString FFileDialog::getHomeDir()
|
const FString FFileDialog::getHomeDir()
|
||||||
{
|
{
|
||||||
struct passwd pwd;
|
struct passwd pwd{};
|
||||||
struct passwd* pwd_ptr;
|
struct passwd* pwd_ptr{};
|
||||||
char buf[1024];
|
char buf[1024]{};
|
||||||
|
|
||||||
if ( ! fsystem )
|
if ( ! fsystem )
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
|
@ -781,7 +778,7 @@ void FFileDialog::cb_processActivate (FWidget*, FDataPtr)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found{false};
|
||||||
const auto& input = filename.getText().trim();
|
const auto& input = filename.getText().trim();
|
||||||
|
|
||||||
if ( ! dir_entries.empty() )
|
if ( ! dir_entries.empty() )
|
||||||
|
@ -817,9 +814,9 @@ void FFileDialog::cb_processRowChanged (FWidget*, FDataPtr)
|
||||||
const auto& name = FString(dir_entries[n - 1].name);
|
const auto& name = FString(dir_entries[n - 1].name);
|
||||||
|
|
||||||
if ( dir_entries[n - 1].directory )
|
if ( dir_entries[n - 1].directory )
|
||||||
filename.setText( name + '/' );
|
filename.setText(name + '/');
|
||||||
else
|
else
|
||||||
filename.setText( name );
|
filename.setText(name);
|
||||||
|
|
||||||
filename.redraw();
|
filename.redraw();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,11 +42,11 @@ namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
uInt64 FKeyboard::key_timeout = 100000; // 100 ms (default timeout for keypress)
|
uInt64 FKeyboard::key_timeout{100000}; // 100 ms (default timeout for keypress)
|
||||||
struct timeval FKeyboard::time_keypressed{};
|
struct timeval FKeyboard::time_keypressed{};
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
FTermLinux* FKeyboard::linux = nullptr;
|
FTermLinux* FKeyboard::linux{nullptr};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -102,7 +102,7 @@ void FKeyboard::fetchKeyCode()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString FKeyboard::getKeyName (FKey keynum)
|
const FString FKeyboard::getKeyName (FKey keynum)
|
||||||
{
|
{
|
||||||
for (std::size_t i = 0; fc::FkeyName[i].string[0] != 0; i++)
|
for (std::size_t i{0}; fc::FkeyName[i].string[0] != 0; i++)
|
||||||
if ( fc::FkeyName[i].num && fc::FkeyName[i].num == keynum )
|
if ( fc::FkeyName[i].num && fc::FkeyName[i].num == keynum )
|
||||||
return FString(fc::FkeyName[i].string);
|
return FString(fc::FkeyName[i].string);
|
||||||
|
|
||||||
|
@ -135,16 +135,15 @@ bool& FKeyboard::unprocessedInput()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FKeyboard::isKeyPressed()
|
bool FKeyboard::isKeyPressed()
|
||||||
{
|
{
|
||||||
int result;
|
fd_set ifds{};
|
||||||
fd_set ifds;
|
struct timeval tv{};
|
||||||
struct timeval tv;
|
|
||||||
int stdin_no = FTermios::getStdIn();
|
int stdin_no = FTermios::getStdIn();
|
||||||
|
|
||||||
FD_ZERO(&ifds);
|
FD_ZERO(&ifds);
|
||||||
FD_SET(stdin_no, &ifds);
|
FD_SET(stdin_no, &ifds);
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = 100000; // 100 ms
|
tv.tv_usec = 100000; // 100 ms
|
||||||
result = select (stdin_no + 1, &ifds, 0, 0, &tv);
|
int result = select (stdin_no + 1, &ifds, 0, 0, &tv);
|
||||||
|
|
||||||
if ( result > 0 && FD_ISSET(stdin_no, &ifds) )
|
if ( result > 0 && FD_ISSET(stdin_no, &ifds) )
|
||||||
FD_CLR (stdin_no, &ifds);
|
FD_CLR (stdin_no, &ifds);
|
||||||
|
@ -235,14 +234,14 @@ inline FKey FKeyboard::getTermcapKey()
|
||||||
if ( ! key_map )
|
if ( ! key_map )
|
||||||
return NOT_SET;
|
return NOT_SET;
|
||||||
|
|
||||||
for (std::size_t i = 0; key_map[i].tname[0] != 0; i++)
|
for (std::size_t i{0}; key_map[i].tname[0] != 0; i++)
|
||||||
{
|
{
|
||||||
char* k = key_map[i].string;
|
char* k = key_map[i].string;
|
||||||
std::size_t len = ( k ) ? std::strlen(k) : 0;
|
std::size_t len = ( k ) ? std::strlen(k) : 0;
|
||||||
|
|
||||||
if ( k && std::strncmp(k, fifo_buf, len) == 0 ) // found
|
if ( k && std::strncmp(k, fifo_buf, len) == 0 ) // found
|
||||||
{
|
{
|
||||||
std::size_t n;
|
std::size_t n{};
|
||||||
|
|
||||||
for (n = len; n < FIFO_BUF_SIZE; n++) // Remove founded entry
|
for (n = len; n < FIFO_BUF_SIZE; n++) // Remove founded entry
|
||||||
fifo_buf[n - len] = fifo_buf[n];
|
fifo_buf[n - len] = fifo_buf[n];
|
||||||
|
@ -265,14 +264,14 @@ inline FKey FKeyboard::getMetaKey()
|
||||||
|
|
||||||
assert ( FIFO_BUF_SIZE > 0 );
|
assert ( FIFO_BUF_SIZE > 0 );
|
||||||
|
|
||||||
for (std::size_t i = 0; fc::Fmetakey[i].string[0] != 0; i++)
|
for (std::size_t i{0}; fc::Fmetakey[i].string[0] != 0; i++)
|
||||||
{
|
{
|
||||||
char* kmeta = fc::Fmetakey[i].string; // The string is never null
|
char* kmeta = fc::Fmetakey[i].string; // The string is never null
|
||||||
std::size_t len = std::strlen(kmeta);
|
std::size_t len = std::strlen(kmeta);
|
||||||
|
|
||||||
if ( std::strncmp(kmeta, fifo_buf, len) == 0 ) // found
|
if ( std::strncmp(kmeta, fifo_buf, len) == 0 ) // found
|
||||||
{
|
{
|
||||||
std::size_t n;
|
std::size_t n{};
|
||||||
|
|
||||||
if ( len == 2 && ( fifo_buf[1] == 'O'
|
if ( len == 2 && ( fifo_buf[1] == 'O'
|
||||||
|| fifo_buf[1] == '['
|
|| fifo_buf[1] == '['
|
||||||
|
@ -301,15 +300,15 @@ inline FKey FKeyboard::getSingleKey()
|
||||||
{
|
{
|
||||||
// Looking for single key code in the buffer
|
// Looking for single key code in the buffer
|
||||||
|
|
||||||
|
std::size_t n{};
|
||||||
|
std::size_t len{1};
|
||||||
uChar firstchar = uChar(fifo_buf[0]);
|
uChar firstchar = uChar(fifo_buf[0]);
|
||||||
std::size_t n;
|
FKey keycode{};
|
||||||
std::size_t len = 1;
|
|
||||||
FKey keycode;
|
|
||||||
|
|
||||||
// Look for a utf-8 character
|
// Look for a utf-8 character
|
||||||
if ( utf8_input && (firstchar & 0xc0) == 0xc0 )
|
if ( utf8_input && (firstchar & 0xc0) == 0xc0 )
|
||||||
{
|
{
|
||||||
char utf8char[5] = { }; // Init array with '\0'
|
char utf8char[5]{}; // Init array with '\0'
|
||||||
|
|
||||||
if ( (firstchar & 0xe0) == 0xc0 )
|
if ( (firstchar & 0xe0) == 0xc0 )
|
||||||
len = 2;
|
len = 2;
|
||||||
|
@ -318,7 +317,7 @@ inline FKey FKeyboard::getSingleKey()
|
||||||
else if ( (firstchar & 0xf8) == 0xf0 )
|
else if ( (firstchar & 0xf8) == 0xf0 )
|
||||||
len = 4;
|
len = 4;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < len ; i++)
|
for (std::size_t i{0}; i < len ; i++)
|
||||||
utf8char[i] = char(fifo_buf[i] & 0xff);
|
utf8char[i] = char(fifo_buf[i] & 0xff);
|
||||||
|
|
||||||
keycode = UTF8decode(utf8char);
|
keycode = UTF8decode(utf8char);
|
||||||
|
@ -373,14 +372,14 @@ bool FKeyboard::isKeypressTimeout()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FKey FKeyboard::UTF8decode (const char utf8[])
|
FKey FKeyboard::UTF8decode (const char utf8[])
|
||||||
{
|
{
|
||||||
FKey ucs = 0; // Universal coded character
|
FKey ucs{0}; // Universal coded character
|
||||||
constexpr std::size_t max = 4;
|
constexpr std::size_t max = 4;
|
||||||
std::size_t len = std::strlen(utf8);
|
std::size_t len = std::strlen(utf8);
|
||||||
|
|
||||||
if ( len > max )
|
if ( len > max )
|
||||||
len = max;
|
len = max;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < len; ++i)
|
for (std::size_t i{0}; i < len; ++i)
|
||||||
{
|
{
|
||||||
uChar ch = uChar(utf8[i]);
|
uChar ch = uChar(utf8[i]);
|
||||||
|
|
||||||
|
@ -422,9 +421,8 @@ FKey FKeyboard::UTF8decode (const char utf8[])
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline ssize_t FKeyboard::readKey()
|
inline ssize_t FKeyboard::readKey()
|
||||||
{
|
{
|
||||||
ssize_t bytes;
|
|
||||||
setNonBlockingInput();
|
setNonBlockingInput();
|
||||||
bytes = read(FTermios::getStdIn(), &read_buf, READ_BUF_SIZE - 1);
|
ssize_t bytes = read(FTermios::getStdIn(), &read_buf, READ_BUF_SIZE - 1);
|
||||||
unsetNonBlockingInput();
|
unsetNonBlockingInput();
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
@ -432,14 +430,14 @@ inline ssize_t FKeyboard::readKey()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FKeyboard::parseKeyBuffer()
|
void FKeyboard::parseKeyBuffer()
|
||||||
{
|
{
|
||||||
ssize_t bytesread;
|
ssize_t bytesread{};
|
||||||
FObject::getCurrentTime (&time_keypressed);
|
FObject::getCurrentTime (&time_keypressed);
|
||||||
|
|
||||||
while ( (bytesread = readKey()) > 0 )
|
while ( (bytesread = readKey()) > 0 )
|
||||||
{
|
{
|
||||||
if ( bytesread + fifo_offset <= int(FIFO_BUF_SIZE) )
|
if ( bytesread + fifo_offset <= int(FIFO_BUF_SIZE) )
|
||||||
{
|
{
|
||||||
for (std::size_t i = 0; i < std::size_t(bytesread); i++)
|
for (std::size_t i{0}; i < std::size_t(bytesread); i++)
|
||||||
{
|
{
|
||||||
fifo_buf[fifo_offset] = read_buf[i];
|
fifo_buf[fifo_offset] = read_buf[i];
|
||||||
fifo_offset++;
|
fifo_offset++;
|
||||||
|
|
|
@ -217,7 +217,7 @@ bool FLabel::setEnable (bool enable)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLabel::setText (const FString& txt)
|
void FLabel::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
text = txt;
|
text.setString(txt);
|
||||||
multiline_text = text.split("\r\n");
|
multiline_text = text.split("\r\n");
|
||||||
|
|
||||||
if ( int(multiline_text.size()) > 1 )
|
if ( int(multiline_text.size()) > 1 )
|
||||||
|
@ -428,15 +428,15 @@ void FLabel::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLabel::drawMultiLine()
|
void FLabel::drawMultiLine()
|
||||||
{
|
{
|
||||||
std::size_t y = 0;
|
std::size_t y{0};
|
||||||
std::size_t text_lines = multiline_text.size();
|
std::size_t text_lines = multiline_text.size();
|
||||||
bool hotkey_printed = false;
|
bool hotkey_printed{false};
|
||||||
|
|
||||||
while ( y < text_lines && y < std::size_t(getHeight()) )
|
while ( y < text_lines && y < std::size_t(getHeight()) )
|
||||||
{
|
{
|
||||||
wchar_t* label_text;
|
wchar_t* label_text;
|
||||||
std::size_t hotkeypos = NOT_SET;
|
std::size_t hotkeypos{NOT_SET};
|
||||||
std::size_t align_offset;
|
std::size_t align_offset{};
|
||||||
std::size_t length = multiline_text[y].getLength();
|
std::size_t length = multiline_text[y].getLength();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -480,8 +480,7 @@ void FLabel::drawMultiLine()
|
||||||
void FLabel::drawSingleLine()
|
void FLabel::drawSingleLine()
|
||||||
{
|
{
|
||||||
wchar_t* label_text;
|
wchar_t* label_text;
|
||||||
std::size_t hotkeypos = NOT_SET;
|
std::size_t hotkeypos{NOT_SET};
|
||||||
std::size_t align_offset;
|
|
||||||
std::size_t length = text.getLength();
|
std::size_t length = text.getLength();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -500,7 +499,7 @@ void FLabel::drawSingleLine()
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint(1, 1);
|
||||||
align_offset = getAlignOffset(length);
|
std::size_t align_offset = getAlignOffset(length);
|
||||||
printLine (label_text, length, hotkeypos, align_offset);
|
printLine (label_text, length, hotkeypos, align_offset);
|
||||||
delete[] label_text;
|
delete[] label_text;
|
||||||
}
|
}
|
||||||
|
@ -511,7 +510,7 @@ void FLabel::printLine ( wchar_t line[]
|
||||||
, std::size_t hotkeypos
|
, std::size_t hotkeypos
|
||||||
, std::size_t align_offset )
|
, std::size_t align_offset )
|
||||||
{
|
{
|
||||||
std::size_t to_char;
|
std::size_t to_char{};
|
||||||
std::size_t width = std::size_t(getWidth());
|
std::size_t width = std::size_t(getWidth());
|
||||||
|
|
||||||
if ( align_offset > 0 )
|
if ( align_offset > 0 )
|
||||||
|
@ -525,7 +524,7 @@ void FLabel::printLine ( wchar_t line[]
|
||||||
if ( hasReverseMode() )
|
if ( hasReverseMode() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
for (std::size_t z = 0; z < to_char; z++)
|
for (std::size_t z{0}; z < to_char; z++)
|
||||||
{
|
{
|
||||||
if ( ! std::iswprint(wint_t(line[z])) )
|
if ( ! std::iswprint(wint_t(line[z])) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -254,12 +254,12 @@ void FLineEdit::setText (const FString& txt)
|
||||||
if ( txt )
|
if ( txt )
|
||||||
{
|
{
|
||||||
if ( txt.getLength() > max_length )
|
if ( txt.getLength() > max_length )
|
||||||
text = txt.left(max_length);
|
text.setString(txt.left(max_length));
|
||||||
else
|
else
|
||||||
text = txt;
|
text.setString(txt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
text = "";
|
text.setString("");
|
||||||
|
|
||||||
keyEnd();
|
keyEnd();
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ void FLineEdit::setMaxLength (std::size_t max)
|
||||||
max_length = max;
|
max_length = max;
|
||||||
|
|
||||||
if ( text.getLength() > max_length )
|
if ( text.getLength() > max_length )
|
||||||
text = text.left(max_length);
|
text.setString(text.left(max_length));
|
||||||
|
|
||||||
keyEnd();
|
keyEnd();
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ void FLineEdit::setCursorPosition (std::size_t pos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::setLabelText (const FString& ltxt)
|
void FLineEdit::setLabelText (const FString& ltxt)
|
||||||
{
|
{
|
||||||
label_text = ltxt;
|
label_text.setString(ltxt);
|
||||||
label->setText(label_text);
|
label->setText(label_text);
|
||||||
adjustLabel();
|
adjustLabel();
|
||||||
}
|
}
|
||||||
|
@ -400,8 +400,6 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::onMouseDown (FMouseEvent* ev)
|
void FLineEdit::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int mouse_x, mouse_y;
|
|
||||||
|
|
||||||
if ( ev->getButton() != fc::LeftButton )
|
if ( ev->getButton() != fc::LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -419,8 +417,8 @@ void FLineEdit::onMouseDown (FMouseEvent* ev)
|
||||||
getStatusBar()->drawMessage();
|
getStatusBar()->drawMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= 2 && mouse_x <= int(getWidth()) && mouse_y == 1 )
|
if ( mouse_x >= 2 && mouse_x <= int(getWidth()) && mouse_y == 1 )
|
||||||
{
|
{
|
||||||
|
@ -449,15 +447,12 @@ void FLineEdit::onMouseUp (FMouseEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::onMouseMove (FMouseEvent* ev)
|
void FLineEdit::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
std::size_t len;
|
|
||||||
int mouse_x, mouse_y;
|
|
||||||
|
|
||||||
if ( ev->getButton() != fc::LeftButton )
|
if ( ev->getButton() != fc::LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
len = text.getLength();
|
std::size_t len = text.getLength();
|
||||||
mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= 2 && mouse_x <= int(getWidth()) && mouse_y == 1 )
|
if ( mouse_x >= 2 && mouse_x <= int(getWidth()) && mouse_y == 1 )
|
||||||
{
|
{
|
||||||
|
@ -717,8 +712,6 @@ void FLineEdit::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::drawInputField()
|
void FLineEdit::drawInputField()
|
||||||
{
|
{
|
||||||
std::size_t x;
|
|
||||||
FString show_text;
|
|
||||||
bool isActiveFocus = flags.active && flags.focus;
|
bool isActiveFocus = flags.active && flags.focus;
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint(1, 1);
|
||||||
|
|
||||||
|
@ -741,12 +734,12 @@ void FLineEdit::drawInputField()
|
||||||
if ( isActiveFocus && getMaxColor() < 16 )
|
if ( isActiveFocus && getMaxColor() < 16 )
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
show_text = text.mid(1 + text_offset, getWidth() - 2);
|
FString show_text(text.mid(1 + text_offset, getWidth() - 2));
|
||||||
|
|
||||||
if ( show_text )
|
if ( show_text )
|
||||||
print (show_text);
|
print (show_text);
|
||||||
|
|
||||||
x = show_text.getLength();
|
std::size_t x = show_text.getLength();
|
||||||
|
|
||||||
while ( x < getWidth() - 1 )
|
while ( x < getWidth() - 1 )
|
||||||
{
|
{
|
||||||
|
@ -888,7 +881,7 @@ inline bool FLineEdit::keyInput (FKey key)
|
||||||
text.overwrite(c, cursor_pos);
|
text.overwrite(c, cursor_pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
text = c;
|
text.setString(c);
|
||||||
|
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
|
|
||||||
|
|
|
@ -104,12 +104,10 @@ FListBox::~FListBox() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::setCurrentItem (std::size_t index)
|
void FListBox::setCurrentItem (std::size_t index)
|
||||||
{
|
{
|
||||||
std::size_t element_count;
|
|
||||||
|
|
||||||
if ( index == current )
|
if ( index == current )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
element_count = getCount();
|
std::size_t element_count = getCount();
|
||||||
|
|
||||||
if ( index > element_count )
|
if ( index > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
@ -211,7 +209,7 @@ bool FListBox::setFocus (bool enable)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::setText (const FString& txt)
|
void FListBox::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
text = txt;
|
text.setString(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -237,13 +235,11 @@ void FListBox::insert (FListBoxItem listItem)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::remove (std::size_t item)
|
void FListBox::remove (std::size_t item)
|
||||||
{
|
{
|
||||||
std::size_t element_count;
|
|
||||||
|
|
||||||
if ( item > getCount() )
|
if ( item > getCount() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
itemlist.erase (itemlist.begin() + int(item) - 1);
|
itemlist.erase (itemlist.begin() + int(item) - 1);
|
||||||
element_count = getCount();
|
std::size_t element_count = getCount();
|
||||||
max_line_width = 0;
|
max_line_width = 0;
|
||||||
|
|
||||||
for (auto&& listbox_item : itemlist)
|
for (auto&& listbox_item : itemlist)
|
||||||
|
@ -318,7 +314,7 @@ void FListBox::clear()
|
||||||
std::memset (blank, ' ', size);
|
std::memset (blank, ' ', size);
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y = 0; y < int(getHeight()) - 2; y++)
|
for (int y{0}; y < int(getHeight()) - 2; y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(2, 2 + y) << blank;
|
print() << FPoint(2, 2 + y) << blank;
|
||||||
}
|
}
|
||||||
|
@ -428,10 +424,6 @@ void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::onMouseDown (FMouseEvent* ev)
|
void FListBox::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int yoffset_before
|
|
||||||
, mouse_x
|
|
||||||
, mouse_y;
|
|
||||||
|
|
||||||
if ( ev->getButton() != fc::LeftButton
|
if ( ev->getButton() != fc::LeftButton
|
||||||
&& ev->getButton() != fc::RightButton )
|
&& ev->getButton() != fc::RightButton )
|
||||||
{
|
{
|
||||||
|
@ -443,9 +435,9 @@ void FListBox::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
getWidgetFocus();
|
getWidgetFocus();
|
||||||
|
|
||||||
yoffset_before = yoffset;
|
int yoffset_before = yoffset;
|
||||||
mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||||
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||||
|
@ -553,13 +545,11 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::onMouseDoubleClick (FMouseEvent* ev)
|
void FListBox::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int mouse_x, mouse_y;
|
|
||||||
|
|
||||||
if ( ev->getButton() != fc::LeftButton )
|
if ( ev->getButton() != fc::LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||||
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||||
|
@ -624,11 +614,9 @@ void FListBox::onTimer (FTimerEvent*)
|
||||||
void FListBox::onWheel (FWheelEvent* ev)
|
void FListBox::onWheel (FWheelEvent* ev)
|
||||||
{
|
{
|
||||||
std::size_t current_before = current;
|
std::size_t current_before = current;
|
||||||
int wheel
|
int yoffset_before = yoffset;
|
||||||
, yoffset_before = yoffset
|
int pagesize{4};
|
||||||
, pagesize = 4;
|
int wheel = ev->getWheel();
|
||||||
|
|
||||||
wheel = ev->getWheel();
|
|
||||||
|
|
||||||
if ( drag_scroll != fc::noScroll )
|
if ( drag_scroll != fc::noScroll )
|
||||||
stopDragScroll();
|
stopDragScroll();
|
||||||
|
@ -821,7 +809,7 @@ void FListBox::draw()
|
||||||
{
|
{
|
||||||
setColor();
|
setColor();
|
||||||
|
|
||||||
for (int y = 2; y < int(getHeight()); y++)
|
for (int y{2}; y < int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(int(getWidth()), y)
|
print() << FPoint(int(getWidth()), y)
|
||||||
<< ' '; // clear right side of the scrollbar
|
<< ' '; // clear right side of the scrollbar
|
||||||
|
@ -883,7 +871,7 @@ void FListBox::drawHeadline()
|
||||||
if ( text.isNull() || text.isEmpty() )
|
if ( text.isNull() || text.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FString txt = " " + text + " ";
|
FString txt(" " + text + " ");
|
||||||
std::size_t length = txt.getLength();
|
std::size_t length = txt.getLength();
|
||||||
print() << FPoint(2, 1);
|
print() << FPoint(2, 1);
|
||||||
|
|
||||||
|
@ -908,7 +896,7 @@ void FListBox::drawList()
|
||||||
if ( itemlist.empty() || getHeight() <= 2 || getWidth() <= 4 )
|
if ( itemlist.empty() || getHeight() <= 2 || getWidth() <= 4 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::size_t start = 0;
|
std::size_t start{};
|
||||||
std::size_t num = uInt(getHeight() - 2);
|
std::size_t num = uInt(getHeight() - 2);
|
||||||
|
|
||||||
if ( num > getCount() )
|
if ( num > getCount() )
|
||||||
|
@ -929,7 +917,7 @@ void FListBox::drawList()
|
||||||
|
|
||||||
for (std::size_t y = start; y < num && iter != itemlist.end() ; y++)
|
for (std::size_t y = start; y < num && iter != itemlist.end() ; y++)
|
||||||
{
|
{
|
||||||
bool serach_mark = false;
|
bool serach_mark{false};
|
||||||
bool lineHasBrackets = hasBrackets(iter);
|
bool lineHasBrackets = hasBrackets(iter);
|
||||||
|
|
||||||
// Import data via lazy conversion
|
// Import data via lazy conversion
|
||||||
|
@ -962,14 +950,12 @@ inline void FListBox::drawListLine ( int y
|
||||||
, listBoxItems::iterator iter
|
, listBoxItems::iterator iter
|
||||||
, bool serach_mark )
|
, bool serach_mark )
|
||||||
{
|
{
|
||||||
std::size_t i, len;
|
|
||||||
std::size_t inc_len = inc_search.getLength();
|
std::size_t inc_len = inc_search.getLength();
|
||||||
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||||
FString element;
|
FString element (getString(iter).mid ( std::size_t(1 + xoffset)
|
||||||
element = getString(iter).mid ( std::size_t(1 + xoffset)
|
, getWidth() - nf_offset - 4 ));
|
||||||
, getWidth() - nf_offset - 4 );
|
|
||||||
const wchar_t* const& element_str = element.wc_str();
|
const wchar_t* const& element_str = element.wc_str();
|
||||||
len = element.getLength();
|
std::size_t len = element.getLength();
|
||||||
|
|
||||||
if ( isMonochron() && isCurrentLine && flags.focus )
|
if ( isMonochron() && isCurrentLine && flags.focus )
|
||||||
print (fc::BlackRightPointingPointer); // ►
|
print (fc::BlackRightPointingPointer); // ►
|
||||||
|
@ -980,6 +966,8 @@ inline void FListBox::drawListLine ( int y
|
||||||
setColor ( wc.current_inc_search_element_fg
|
setColor ( wc.current_inc_search_element_fg
|
||||||
, wc.current_element_focus_bg );
|
, wc.current_element_focus_bg );
|
||||||
|
|
||||||
|
std::size_t i{};
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
if ( serach_mark && i == inc_len && flags.focus )
|
if ( serach_mark && i == inc_len && flags.focus )
|
||||||
|
@ -1018,12 +1006,9 @@ inline void FListBox::drawListBracketsLine ( int y
|
||||||
, listBoxItems::iterator iter
|
, listBoxItems::iterator iter
|
||||||
, bool serach_mark )
|
, bool serach_mark )
|
||||||
{
|
{
|
||||||
FString element;
|
FString element{};
|
||||||
std::size_t len
|
std::size_t inc_len = inc_search.getLength()
|
||||||
, full_length
|
, b{0};
|
||||||
, inc_len = inc_search.getLength()
|
|
||||||
, i = 0
|
|
||||||
, b = 0;
|
|
||||||
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||||
|
|
||||||
if ( isMonochron() && isCurrentLine && flags.focus )
|
if ( isMonochron() && isCurrentLine && flags.focus )
|
||||||
|
@ -1044,7 +1029,9 @@ inline void FListBox::drawListBracketsLine ( int y
|
||||||
, getWidth() - nf_offset - 4 );
|
, getWidth() - nf_offset - 4 );
|
||||||
|
|
||||||
const wchar_t* const& element_str = element.wc_str();
|
const wchar_t* const& element_str = element.wc_str();
|
||||||
len = element.getLength();
|
std::size_t full_length = getString(iter).getLength()
|
||||||
|
, len = element.getLength()
|
||||||
|
, i{0};
|
||||||
|
|
||||||
for (; i < len; i++)
|
for (; i < len; i++)
|
||||||
{
|
{
|
||||||
|
@ -1059,8 +1046,6 @@ inline void FListBox::drawListBracketsLine ( int y
|
||||||
print (element_str[i]);
|
print (element_str[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
full_length = getString(iter).getLength();
|
|
||||||
|
|
||||||
if ( b + i < getWidth() - nf_offset - 4
|
if ( b + i < getWidth() - nf_offset - 4
|
||||||
&& std::size_t(xoffset) <= full_length + 1 )
|
&& std::size_t(xoffset) <= full_length + 1 )
|
||||||
{
|
{
|
||||||
|
@ -1280,7 +1265,7 @@ void FListBox::multiSelection (std::size_t pos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::multiSelectionUpTo (std::size_t pos)
|
void FListBox::multiSelectionUpTo (std::size_t pos)
|
||||||
{
|
{
|
||||||
std::size_t from, to;
|
std::size_t from{}, to{};
|
||||||
|
|
||||||
if ( ! isMultiSelection() )
|
if ( ! isMultiSelection() )
|
||||||
return;
|
return;
|
||||||
|
@ -1654,7 +1639,7 @@ inline bool FListBox::keySpace()
|
||||||
if ( inc_len > 0 )
|
if ( inc_len > 0 )
|
||||||
{
|
{
|
||||||
inc_search += L' ';
|
inc_search += L' ';
|
||||||
bool inc_found = false;
|
bool inc_found{false};
|
||||||
auto iter = itemlist.begin();
|
auto iter = itemlist.begin();
|
||||||
|
|
||||||
while ( iter != itemlist.end() )
|
while ( iter != itemlist.end() )
|
||||||
|
@ -1764,7 +1749,7 @@ inline bool FListBox::keyIncSearchInput (FKey key)
|
||||||
inc_search += wchar_t(key);
|
inc_search += wchar_t(key);
|
||||||
|
|
||||||
std::size_t inc_len = inc_search.getLength();
|
std::size_t inc_len = inc_search.getLength();
|
||||||
bool inc_found = false;
|
bool inc_found{false};
|
||||||
auto iter = itemlist.begin();
|
auto iter = itemlist.begin();
|
||||||
|
|
||||||
while ( iter != itemlist.end() )
|
while ( iter != itemlist.end() )
|
||||||
|
@ -1831,8 +1816,8 @@ void FListBox::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
FScrollbar::sType scrollType;
|
FScrollbar::sType scrollType;
|
||||||
std::size_t current_before = current;
|
std::size_t current_before = current;
|
||||||
int distance = 1
|
int distance{1}
|
||||||
, pagesize = 4
|
, pagesize{4}
|
||||||
, yoffset_before = yoffset;
|
, yoffset_before = yoffset;
|
||||||
scrollType = vbar->getScrollType();
|
scrollType = vbar->getScrollType();
|
||||||
|
|
||||||
|
@ -1898,8 +1883,8 @@ void FListBox::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
static constexpr int padding_space = 2; // 1 leading space + 1 trailing space
|
static constexpr int padding_space = 2; // 1 leading space + 1 trailing space
|
||||||
FScrollbar::sType scrollType;
|
FScrollbar::sType scrollType;
|
||||||
int distance = 1
|
int distance{1}
|
||||||
, pagesize = 4
|
, pagesize{4}
|
||||||
, xoffset_before = xoffset;
|
, xoffset_before = xoffset;
|
||||||
scrollType = hbar->getScrollType();
|
scrollType = hbar->getScrollType();
|
||||||
|
|
||||||
|
|
|
@ -57,9 +57,6 @@ uInt64 firstNumberFromString (const FString& str)
|
||||||
{
|
{
|
||||||
auto last = str.end();
|
auto last = str.end();
|
||||||
auto iter = str.begin();
|
auto iter = str.begin();
|
||||||
std::size_t pos;
|
|
||||||
std::size_t length;
|
|
||||||
uInt64 number;
|
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -92,8 +89,9 @@ uInt64 firstNumberFromString (const FString& str)
|
||||||
if ( last_pos == last )
|
if ( last_pos == last )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pos = std::size_t(std::distance(str.begin(), first_pos)) + 1;
|
uInt64 number;
|
||||||
length = std::size_t(std::distance(first_pos, last_pos));
|
std::size_t pos = std::size_t(std::distance(str.begin(), first_pos)) + 1;
|
||||||
|
std::size_t length = std::size_t(std::distance(first_pos, last_pos));
|
||||||
const auto& num_str = str.mid(pos, length);
|
const auto& num_str = str.mid(pos, length);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -597,7 +595,7 @@ FListView::~FListView() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
std::size_t FListView::getCount()
|
std::size_t FListView::getCount()
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n{0};
|
||||||
auto iter = itemlist.begin();
|
auto iter = itemlist.begin();
|
||||||
|
|
||||||
while ( iter != itemlist.end() )
|
while ( iter != itemlist.end() )
|
||||||
|
@ -640,7 +638,7 @@ FString FListView::getColumnText (int column) const
|
||||||
fc::sorting_type FListView::getColumnSortType (int column) const
|
fc::sorting_type FListView::getColumnSortType (int column) const
|
||||||
{
|
{
|
||||||
fc::sorting_type type;
|
fc::sorting_type type;
|
||||||
std::size_t col = uInt(column);
|
std::size_t col = std::size_t(column);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -683,7 +681,7 @@ void FListView::setColumnAlignment (int column, fc::text_alignment align)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Convert column position to address offset (index)
|
// Convert column position to address offset (index)
|
||||||
std::size_t index = uInt(column - 1);
|
std::size_t index = std::size_t(column - 1);
|
||||||
header[index].alignment = align;
|
header[index].alignment = align;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,7 +694,7 @@ void FListView::setColumnText (int column, const FString& label)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Convert column position to address offset (index)
|
// Convert column position to address offset (index)
|
||||||
std::size_t index = uInt(column - 1);
|
std::size_t index = std::size_t(column - 1);
|
||||||
|
|
||||||
if ( ! header[index].fixed_width )
|
if ( ! header[index].fixed_width )
|
||||||
{
|
{
|
||||||
|
@ -717,7 +715,7 @@ void FListView::setColumnSortType (int column, fc::sorting_type type)
|
||||||
if ( column < 1 || header.empty() || column > int(header.size()) )
|
if ( column < 1 || header.empty() || column > int(header.size()) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::size_t size = uInt(column + 1);
|
std::size_t size = std::size_t(column + 1);
|
||||||
|
|
||||||
if ( sort_type.empty() || sort_type.size() < size )
|
if ( sort_type.empty() || sort_type.size() < size )
|
||||||
sort_type.resize(size);
|
sort_type.resize(size);
|
||||||
|
@ -1068,7 +1066,7 @@ void FListView::onMouseUp (FMouseEvent* ev)
|
||||||
if ( itemlist.empty() )
|
if ( itemlist.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int indent = 0;
|
int indent{0};
|
||||||
auto item = getCurrentItem();
|
auto item = getCurrentItem();
|
||||||
|
|
||||||
if ( tree_view )
|
if ( tree_view )
|
||||||
|
@ -1161,13 +1159,11 @@ void FListView::onMouseMove (FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::onMouseDoubleClick (FMouseEvent* ev)
|
void FListView::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int mouse_x, mouse_y;
|
|
||||||
|
|
||||||
if ( ev->getButton() != fc::LeftButton )
|
if ( ev->getButton() != fc::LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||||
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||||
|
@ -1243,7 +1239,7 @@ void FListView::onWheel (FWheelEvent* ev)
|
||||||
{
|
{
|
||||||
int position_before = current_iter.getPosition()
|
int position_before = current_iter.getPosition()
|
||||||
, first_line_position_before = first_visible_line.getPosition()
|
, first_line_position_before = first_visible_line.getPosition()
|
||||||
, pagesize = 4;
|
, pagesize{4};
|
||||||
|
|
||||||
if ( drag_scroll != fc::noScroll )
|
if ( drag_scroll != fc::noScroll )
|
||||||
stopDragScroll();
|
stopDragScroll();
|
||||||
|
@ -1481,7 +1477,7 @@ void FListView::draw()
|
||||||
{
|
{
|
||||||
setColor();
|
setColor();
|
||||||
|
|
||||||
for (int y = 2; y < int(getHeight()); y++)
|
for (int y{2}; y < int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(int(getWidth()), y)
|
print() << FPoint(int(getWidth()), y)
|
||||||
<< ' '; // clear right side of the scrollbar
|
<< ' '; // clear right side of the scrollbar
|
||||||
|
@ -1592,7 +1588,7 @@ void FListView::drawList()
|
||||||
if ( itemlist.empty() || getHeight() <= 2 || getWidth() <= 4 )
|
if ( itemlist.empty() || getHeight() <= 2 || getWidth() <= 4 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uInt y = 0;
|
uInt y{0};
|
||||||
uInt page_height = uInt(getHeight() - 2);
|
uInt page_height = uInt(getHeight() - 2);
|
||||||
auto iter = first_visible_line;
|
auto iter = first_visible_line;
|
||||||
|
|
||||||
|
@ -1644,12 +1640,12 @@ void FListView::drawListLine ( const FListViewItem* item
|
||||||
|
|
||||||
// Print the entry
|
// Print the entry
|
||||||
std::size_t indent = item->getDepth() << 1; // indent = 2 * depth
|
std::size_t indent = item->getDepth() << 1; // indent = 2 * depth
|
||||||
FString line = getLinePrefix (item, indent);
|
FString line(getLinePrefix (item, indent));
|
||||||
|
|
||||||
// Print columns
|
// Print columns
|
||||||
if ( ! item->column_list.empty() )
|
if ( ! item->column_list.empty() )
|
||||||
{
|
{
|
||||||
for (std::size_t col = 0; col < item->column_list.size(); )
|
for (std::size_t col{0}; col < item->column_list.size(); )
|
||||||
{
|
{
|
||||||
static constexpr std::size_t ellipsis_length = 2;
|
static constexpr std::size_t ellipsis_length = 2;
|
||||||
const auto& text = item->column_list[col];
|
const auto& text = item->column_list[col];
|
||||||
|
@ -1751,7 +1747,7 @@ inline void FListView::setLineAttributes ( bool is_current
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FString FListView::getCheckBox (const FListViewItem* item)
|
inline FString FListView::getCheckBox (const FListViewItem* item)
|
||||||
{
|
{
|
||||||
FString checkbox;
|
FString checkbox{};
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
|
@ -1760,7 +1756,7 @@ inline FString FListView::getCheckBox (const FListViewItem* item)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
checkbox = L"[ ] ";
|
checkbox.setString("[ ] ");
|
||||||
|
|
||||||
if ( item->isChecked() )
|
if ( item->isChecked() )
|
||||||
checkbox[1] = fc::Times; // Times ×
|
checkbox[1] = fc::Times; // Times ×
|
||||||
|
@ -1773,7 +1769,7 @@ inline FString FListView::getCheckBox (const FListViewItem* item)
|
||||||
inline FString FListView::getLinePrefix ( const FListViewItem* item
|
inline FString FListView::getLinePrefix ( const FListViewItem* item
|
||||||
, std::size_t indent )
|
, std::size_t indent )
|
||||||
{
|
{
|
||||||
FString line;
|
FString line{};
|
||||||
|
|
||||||
if ( tree_view )
|
if ( tree_view )
|
||||||
{
|
{
|
||||||
|
@ -1797,7 +1793,7 @@ inline FString FListView::getLinePrefix ( const FListViewItem* item
|
||||||
line += L" ";
|
line += L" ";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
line = L" ";
|
line.setString(" ");
|
||||||
|
|
||||||
if ( item->isCheckable() )
|
if ( item->isCheckable() )
|
||||||
line += getCheckBox(item);
|
line += getCheckBox(item);
|
||||||
|
@ -1841,7 +1837,7 @@ void FListView::drawHeadlineLabel (const headerItems::const_iterator& iter)
|
||||||
// Print lable text
|
// Print lable text
|
||||||
static constexpr std::size_t leading_space = 1;
|
static constexpr std::size_t leading_space = 1;
|
||||||
const auto& text = iter->name;
|
const auto& text = iter->name;
|
||||||
FString txt = " " + text;
|
FString txt(" " + text);
|
||||||
std::size_t width = std::size_t(iter->width);
|
std::size_t width = std::size_t(iter->width);
|
||||||
std::size_t txt_length = txt.getLength();
|
std::size_t txt_length = txt.getLength();
|
||||||
std::size_t column_width = leading_space + width;
|
std::size_t column_width = leading_space + width;
|
||||||
|
@ -1924,7 +1920,7 @@ std::size_t FListView::determineLineWidth (FListViewItem* item)
|
||||||
{
|
{
|
||||||
static constexpr std::size_t padding_space = 1;
|
static constexpr std::size_t padding_space = 1;
|
||||||
std::size_t line_width = padding_space; // leading space
|
std::size_t line_width = padding_space; // leading space
|
||||||
uInt column_idx = 0;
|
uInt column_idx{0};
|
||||||
uInt entries = uInt(item->column_list.size());
|
uInt entries = uInt(item->column_list.size());
|
||||||
headerItems::iterator header_iter = header.begin();
|
headerItems::iterator header_iter = header.begin();
|
||||||
|
|
||||||
|
@ -2029,7 +2025,7 @@ void FListView::recalculateVerticalBar (std::size_t element_count)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::mouseHeaderClicked()
|
void FListView::mouseHeaderClicked()
|
||||||
{
|
{
|
||||||
int column = 1;
|
int column{1};
|
||||||
int checkbox_offset = ( hasCheckableItems() ) ? 4 : 0;
|
int checkbox_offset = ( hasCheckableItems() ) ? 4 : 0;
|
||||||
int header_start = 2 + checkbox_offset;
|
int header_start = 2 + checkbox_offset;
|
||||||
int header_pos = clicked_header_pos.getX() + xoffset;
|
int header_pos = clicked_header_pos.getX() + xoffset;
|
||||||
|
@ -2573,8 +2569,8 @@ void FListView::scrollBy (int dx, int dy)
|
||||||
void FListView::cb_VBarChange (FWidget*, FDataPtr)
|
void FListView::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
FScrollbar::sType scrollType = vbar->getScrollType();
|
FScrollbar::sType scrollType = vbar->getScrollType();
|
||||||
int distance = 1
|
int distance{1}
|
||||||
, pagesize = 4
|
, pagesize{4}
|
||||||
, first_line_position_before = first_visible_line.getPosition();
|
, first_line_position_before = first_visible_line.getPosition();
|
||||||
|
|
||||||
switch ( scrollType )
|
switch ( scrollType )
|
||||||
|
@ -2632,8 +2628,8 @@ void FListView::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
void FListView::cb_HBarChange (FWidget*, FDataPtr)
|
void FListView::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
FScrollbar::sType scrollType = hbar->getScrollType();
|
FScrollbar::sType scrollType = hbar->getScrollType();
|
||||||
int distance = 1
|
int distance{1}
|
||||||
, pagesize = 4
|
, pagesize{4}
|
||||||
, xoffset_before = xoffset;
|
, xoffset_before = xoffset;
|
||||||
|
|
||||||
switch ( scrollType )
|
switch ( scrollType )
|
||||||
|
|
|
@ -469,7 +469,6 @@ void FMenu::init(FWidget* parent)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::calculateDimensions()
|
void FMenu::calculateDimensions()
|
||||||
{
|
{
|
||||||
int item_X, item_Y, adjust_X;
|
|
||||||
auto iter = item_list.begin();
|
auto iter = item_list.begin();
|
||||||
auto last = item_list.end();
|
auto last = item_list.end();
|
||||||
max_item_width = 10; // minimum width
|
max_item_width = 10; // minimum width
|
||||||
|
@ -500,7 +499,7 @@ void FMenu::calculateDimensions()
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
adjust_X = adjustX(getX());
|
int adjust_X = adjustX(getX());
|
||||||
|
|
||||||
// set widget geometry
|
// set widget geometry
|
||||||
setGeometry ( FPoint(adjust_X, getY())
|
setGeometry ( FPoint(adjust_X, getY())
|
||||||
|
@ -508,8 +507,8 @@ void FMenu::calculateDimensions()
|
||||||
|
|
||||||
// set geometry of all items
|
// set geometry of all items
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
item_X = 1;
|
int item_X = 1;
|
||||||
item_Y = 1;
|
int item_Y = 1;
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -538,12 +537,10 @@ void FMenu::adjustItems()
|
||||||
{
|
{
|
||||||
if ( (*iter)->hasMenu() )
|
if ( (*iter)->hasMenu() )
|
||||||
{
|
{
|
||||||
int menu_X, menu_Y;
|
|
||||||
auto menu = (*iter)->getMenu();
|
auto menu = (*iter)->getMenu();
|
||||||
|
int menu_X = getTermX() + int(max_item_width) + 1;
|
||||||
menu_X = getTermX() + int(max_item_width) + 1;
|
|
||||||
menu_X = menu->adjustX(menu_X);
|
menu_X = menu->adjustX(menu_X);
|
||||||
menu_Y = (*iter)->getTermY() - 2;
|
int menu_Y = (*iter)->getTermY() - 2;
|
||||||
|
|
||||||
// set sub-menu position
|
// set sub-menu position
|
||||||
menu->setPos (FPoint(menu_X, menu_Y));
|
menu->setPos (FPoint(menu_X, menu_Y));
|
||||||
|
@ -661,7 +658,7 @@ void FMenu::hideSuperMenus()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
||||||
{
|
{
|
||||||
bool focus_changed = false;
|
bool focus_changed{false};
|
||||||
auto iter = item_list.begin();
|
auto iter = item_list.begin();
|
||||||
auto last = item_list.end();
|
auto last = item_list.end();
|
||||||
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
||||||
|
@ -1038,7 +1035,7 @@ bool FMenu::selectNextItem()
|
||||||
{
|
{
|
||||||
if ( (*iter)->isSelected() )
|
if ( (*iter)->isSelected() )
|
||||||
{
|
{
|
||||||
FMenuItem* next;
|
FMenuItem* next{};
|
||||||
auto next_element = iter;
|
auto next_element = iter;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -1144,7 +1141,7 @@ bool FMenu::hotkeyMenu (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
if ( (*iter)->hasHotkey() )
|
if ( (*iter)->hasHotkey() )
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found{false};
|
||||||
uChar hotkey = (*iter)->getHotkey();
|
uChar hotkey = (*iter)->getHotkey();
|
||||||
FKey key = ev->key();
|
FKey key = ev->key();
|
||||||
|
|
||||||
|
@ -1261,8 +1258,8 @@ inline void FMenu::drawSeparator (int y)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::drawMenuLine (FMenuItem* menuitem, int y)
|
inline void FMenu::drawMenuLine (FMenuItem* menuitem, int y)
|
||||||
{
|
{
|
||||||
FString txt = menuitem->getText();
|
FString txt(menuitem->getText());
|
||||||
menuText txtdata;
|
menuText txtdata{};
|
||||||
std::size_t txt_length = txt.getLength();
|
std::size_t txt_length = txt.getLength();
|
||||||
std::size_t to_char = txt_length;
|
std::size_t to_char = txt_length;
|
||||||
FKey accel_key = menuitem->accel_key;
|
FKey accel_key = menuitem->accel_key;
|
||||||
|
@ -1369,7 +1366,7 @@ inline void FMenu::drawMenuText (menuText& data)
|
||||||
{
|
{
|
||||||
// Print menu text
|
// Print menu text
|
||||||
|
|
||||||
for (std::size_t z = 0; z < data.length; z++)
|
for (std::size_t z{0}; z < data.length; z++)
|
||||||
{
|
{
|
||||||
if ( ! std::iswprint(wint_t(data.text[z])) )
|
if ( ! std::iswprint(wint_t(data.text[z])) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -487,7 +487,7 @@ void FMenuBar::drawItems()
|
||||||
screenWidth = getDesktopWidth();
|
screenWidth = getDesktopWidth();
|
||||||
auto iter = item_list.begin();
|
auto iter = item_list.begin();
|
||||||
auto last = item_list.end();
|
auto last = item_list.end();
|
||||||
std::size_t x = 1;
|
std::size_t x{1};
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
|
@ -506,16 +506,14 @@ void FMenuBar::drawItems()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
|
inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
|
||||||
{
|
{
|
||||||
FString txt = menuitem->getText();
|
menuText txtdata{};
|
||||||
menuText txtdata;
|
|
||||||
std::size_t txt_length = txt.getLength();
|
|
||||||
std::size_t to_char;
|
|
||||||
std::size_t hotkeypos;
|
|
||||||
bool is_enabled = menuitem->isEnabled();
|
|
||||||
bool is_selected = menuitem->isSelected();
|
|
||||||
|
|
||||||
txtdata.startpos = x + 1;
|
txtdata.startpos = x + 1;
|
||||||
txtdata.no_underline = menuitem->getFlags().no_underline;
|
txtdata.no_underline = menuitem->getFlags().no_underline;
|
||||||
|
FString txt(menuitem->getText());
|
||||||
|
std::size_t to_char{};
|
||||||
|
std::size_t txt_length = txt.getLength();
|
||||||
|
bool is_enabled = menuitem->isEnabled();
|
||||||
|
bool is_selected = menuitem->isSelected();
|
||||||
|
|
||||||
// Set screen attributes
|
// Set screen attributes
|
||||||
setLineAttributes (menuitem);
|
setLineAttributes (menuitem);
|
||||||
|
@ -536,7 +534,9 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
|
||||||
else
|
else
|
||||||
to_char = txt_length - screenWidth - x - 1;
|
to_char = txt_length - screenWidth - x - 1;
|
||||||
|
|
||||||
hotkeypos = finalcut::getHotkeyPos (txt.wc_str(), txtdata.text, txt_length);
|
std::size_t hotkeypos = finalcut::getHotkeyPos ( txt.wc_str()
|
||||||
|
, txtdata.text
|
||||||
|
, txt_length );
|
||||||
|
|
||||||
if ( hotkeypos != NOT_SET )
|
if ( hotkeypos != NOT_SET )
|
||||||
{
|
{
|
||||||
|
@ -600,7 +600,7 @@ inline void FMenuBar::drawMenuText (menuText& data)
|
||||||
{
|
{
|
||||||
// Print menu text
|
// Print menu text
|
||||||
|
|
||||||
for (std::size_t z = 0; z < data.length; z++)
|
for (std::size_t z{0}; z < data.length; z++)
|
||||||
{
|
{
|
||||||
if ( data.startpos > screenWidth - z )
|
if ( data.startpos > screenWidth - z )
|
||||||
break;
|
break;
|
||||||
|
@ -893,7 +893,7 @@ void FMenuBar::mouseMoveOverList (const FMouseEvent* ev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
focus_changed = false;
|
focus_changed = false;
|
||||||
bool mouse_over_menubar = false;
|
bool mouse_over_menubar{false};
|
||||||
auto iter = item_list.begin();
|
auto iter = item_list.begin();
|
||||||
auto last = item_list.end();
|
auto last = item_list.end();
|
||||||
int mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
|
|
|
@ -188,7 +188,7 @@ void FMenuItem::unsetSelected()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuItem::setText (const FString& txt)
|
void FMenuItem::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
text = txt;
|
text.setString(txt);
|
||||||
text_length = text.getLength();
|
text_length = text.getLength();
|
||||||
hotkey = hotKey();
|
hotkey = hotKey();
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ bool FMenuItem::isMenu (FWidget* w) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FMenuList* FMenuItem::getFMenuList (FWidget& widget)
|
FMenuList* FMenuItem::getFMenuList (FWidget& widget)
|
||||||
{
|
{
|
||||||
FMenuList* menu_list;
|
FMenuList* menu_list{};
|
||||||
|
|
||||||
if ( isMenu(&widget) )
|
if ( isMenu(&widget) )
|
||||||
{
|
{
|
||||||
|
@ -569,14 +569,12 @@ void FMenuItem::init (FWidget* parent)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uChar FMenuItem::hotKey()
|
uChar FMenuItem::hotKey()
|
||||||
{
|
{
|
||||||
std::size_t length;
|
|
||||||
|
|
||||||
if ( text.isEmpty() )
|
if ( text.isEmpty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
length = text.getLength();
|
std::size_t length = text.getLength();
|
||||||
|
|
||||||
for (std::size_t i = 0; i < length; i++)
|
for (std::size_t i{0}; i < length; i++)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -632,7 +630,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
|
||||||
|
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
FMenuItem* win_item;
|
FMenuItem* win_item{};
|
||||||
uInt32 n = uInt32(std::distance(first, iter));
|
uInt32 n = uInt32(std::distance(first, iter));
|
||||||
// get the dialog title
|
// get the dialog title
|
||||||
const auto& name = win->getText();
|
const auto& name = win->getText();
|
||||||
|
|
|
@ -105,7 +105,7 @@ FMessageBox& FMessageBox::operator = (const FMessageBox& mbox)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (uInt n = 0; n < num_buttons; n++)
|
for (uInt n{0}; n < num_buttons; n++)
|
||||||
delete button[n];
|
delete button[n];
|
||||||
|
|
||||||
if ( mbox.getParentWidget() )
|
if ( mbox.getParentWidget() )
|
||||||
|
@ -133,10 +133,10 @@ FMessageBox& FMessageBox::operator = (const FMessageBox& mbox)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMessageBox::setHeadline (const FString& headline)
|
void FMessageBox::setHeadline (const FString& headline)
|
||||||
{
|
{
|
||||||
headline_text = headline;
|
headline_text.setString(headline);
|
||||||
setHeight(getHeight() + 2, true);
|
setHeight(getHeight() + 2, true);
|
||||||
|
|
||||||
for (uInt n = 0; n < num_buttons; n++)
|
for (uInt n{0}; n < num_buttons; n++)
|
||||||
button[n]->setY (int(getHeight()) - 4, false);
|
button[n]->setY (int(getHeight()) - 4, false);
|
||||||
|
|
||||||
std::size_t len = headline_text.getLength();
|
std::size_t len = headline_text.getLength();
|
||||||
|
@ -148,7 +148,7 @@ void FMessageBox::setHeadline (const FString& headline)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMessageBox::setText (const FString& txt)
|
void FMessageBox::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
text = txt;
|
text.setString(txt);
|
||||||
calculateDimensions();
|
calculateDimensions();
|
||||||
button[0]->setY (int(getHeight()) - 4, false);
|
button[0]->setY (int(getHeight()) - 4, false);
|
||||||
|
|
||||||
|
@ -166,8 +166,8 @@ void FMessageBox::setText (const FString& txt)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMessageBox::adjustSize()
|
void FMessageBox::adjustSize()
|
||||||
{
|
{
|
||||||
std::size_t max_width;
|
std::size_t max_width{};
|
||||||
std::size_t max_height;
|
std::size_t max_height{};
|
||||||
auto root_widget = getRootWidget();
|
auto root_widget = getRootWidget();
|
||||||
|
|
||||||
if ( root_widget )
|
if ( root_widget )
|
||||||
|
@ -268,7 +268,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMessageBox::deallocation()
|
inline void FMessageBox::deallocation()
|
||||||
{
|
{
|
||||||
for (uInt n = 0; n < num_buttons; n++)
|
for (uInt n{0}; n < num_buttons; n++)
|
||||||
delete button[n];
|
delete button[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ inline void FMessageBox::initCallbacks()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMessageBox::calculateDimensions()
|
void FMessageBox::calculateDimensions()
|
||||||
{
|
{
|
||||||
FSize size;
|
FSize size{};
|
||||||
std::size_t headline_height{0};
|
std::size_t headline_height{0};
|
||||||
text_split = text.split("\n");
|
text_split = text.split("\n");
|
||||||
max_line_width = 0;
|
max_line_width = 0;
|
||||||
|
@ -321,7 +321,7 @@ void FMessageBox::calculateDimensions()
|
||||||
if ( ! headline_text.isNull() )
|
if ( ! headline_text.isNull() )
|
||||||
headline_height = 2;
|
headline_height = 2;
|
||||||
|
|
||||||
for (uInt i = 0; i < text_num_lines; i++)
|
for (uInt i{0}; i < text_num_lines; i++)
|
||||||
{
|
{
|
||||||
text_components = &text_split[0];
|
text_components = &text_split[0];
|
||||||
std::size_t len = text_components[i].getLength();
|
std::size_t len = text_components[i].getLength();
|
||||||
|
@ -366,7 +366,7 @@ void FMessageBox::draw()
|
||||||
|
|
||||||
setColor();
|
setColor();
|
||||||
|
|
||||||
for (int i = 0; i < int(text_num_lines); i++)
|
for (int i{0}; i < int(text_num_lines); i++)
|
||||||
{
|
{
|
||||||
std::size_t line_length = text_components[i].getLength();
|
std::size_t line_length = text_components[i].getLength();
|
||||||
|
|
||||||
|
@ -384,9 +384,9 @@ void FMessageBox::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMessageBox::resizeButtons()
|
void FMessageBox::resizeButtons()
|
||||||
{
|
{
|
||||||
std::size_t len[3], max_size;
|
std::size_t len[3]{}, max_size{};
|
||||||
|
|
||||||
for (std::size_t n = 0; n < num_buttons; n++)
|
for (std::size_t n{0}; n < num_buttons; n++)
|
||||||
{
|
{
|
||||||
len[n] = button[n]->getText().getLength();
|
len[n] = button[n]->getText().getLength();
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ void FMessageBox::resizeButtons()
|
||||||
if ( max_size < 7 )
|
if ( max_size < 7 )
|
||||||
max_size = 7;
|
max_size = 7;
|
||||||
|
|
||||||
for (std::size_t n = 0; n < num_buttons; n++)
|
for (std::size_t n{0}; n < num_buttons; n++)
|
||||||
button[n]->setWidth(max_size + 3, false);
|
button[n]->setWidth(max_size + 3, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,9 +416,9 @@ void FMessageBox::resizeButtons()
|
||||||
void FMessageBox::adjustButtons()
|
void FMessageBox::adjustButtons()
|
||||||
{
|
{
|
||||||
static constexpr std::size_t gap = 4;
|
static constexpr std::size_t gap = 4;
|
||||||
std::size_t btn_width = 0;
|
std::size_t btn_width{0};
|
||||||
|
|
||||||
for (std::size_t n = 0; n < num_buttons; n++)
|
for (std::size_t n{0}; n < num_buttons; n++)
|
||||||
{
|
{
|
||||||
if ( n == num_buttons - 1 )
|
if ( n == num_buttons - 1 )
|
||||||
btn_width += button[n]->getWidth();
|
btn_width += button[n]->getWidth();
|
||||||
|
@ -437,7 +437,7 @@ void FMessageBox::adjustButtons()
|
||||||
|
|
||||||
int btn_x = int((getWidth() - btn_width) / 2);
|
int btn_x = int((getWidth() - btn_width) / 2);
|
||||||
|
|
||||||
for (std::size_t n = 0; n < num_buttons; n++)
|
for (std::size_t n{0}; n < num_buttons; n++)
|
||||||
{
|
{
|
||||||
if ( n == 0 )
|
if ( n == 0 )
|
||||||
button[n]->setX(btn_x);
|
button[n]->setX(btn_x);
|
||||||
|
|
|
@ -449,17 +449,16 @@ void FMouseGPM::drawGpmPointer()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FMouseGPM::gpmEvent (bool clear)
|
int FMouseGPM::gpmEvent (bool clear)
|
||||||
{
|
{
|
||||||
int result;
|
|
||||||
int max = ( gpm_fd > stdin_no ) ? gpm_fd : stdin_no;
|
int max = ( gpm_fd > stdin_no ) ? gpm_fd : stdin_no;
|
||||||
fd_set ifds;
|
fd_set ifds{};
|
||||||
struct timeval tv;
|
struct timeval tv{};
|
||||||
|
|
||||||
FD_ZERO(&ifds);
|
FD_ZERO(&ifds);
|
||||||
FD_SET(stdin_no, &ifds);
|
FD_SET(stdin_no, &ifds);
|
||||||
FD_SET(gpm_fd, &ifds);
|
FD_SET(gpm_fd, &ifds);
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = 100000; // 100 ms
|
tv.tv_usec = 100000; // 100 ms
|
||||||
result = select (max + 1, &ifds, 0, 0, &tv);
|
int result = select (max + 1, &ifds, 0, 0, &tv);
|
||||||
|
|
||||||
if ( result > 0 && FD_ISSET(stdin_no, &ifds) )
|
if ( result > 0 && FD_ISSET(stdin_no, &ifds) )
|
||||||
{
|
{
|
||||||
|
@ -503,8 +502,8 @@ void FMouseX11::setRawData (FKeyboard::keybuffer& fifo_buf)
|
||||||
// Import the X11 xterm mouse protocol (SGR-Mode) raw mouse data
|
// Import the X11 xterm mouse protocol (SGR-Mode) raw mouse data
|
||||||
|
|
||||||
static constexpr std::size_t len = 6;
|
static constexpr std::size_t len = 6;
|
||||||
std::size_t fifo_buf_size = sizeof(fifo_buf);
|
std::size_t fifo_buf_size{sizeof(fifo_buf)};
|
||||||
std::size_t n;
|
std::size_t n{};
|
||||||
x11_mouse[0] = fifo_buf[3];
|
x11_mouse[0] = fifo_buf[3];
|
||||||
x11_mouse[1] = fifo_buf[4];
|
x11_mouse[1] = fifo_buf[4];
|
||||||
x11_mouse[2] = fifo_buf[5];
|
x11_mouse[2] = fifo_buf[5];
|
||||||
|
@ -529,12 +528,9 @@ void FMouseX11::processEvent (struct timeval* time)
|
||||||
// Parse and interpret the X11 xterm mouse string
|
// Parse and interpret the X11 xterm mouse string
|
||||||
|
|
||||||
const auto& mouse_position = getPos();
|
const auto& mouse_position = getPos();
|
||||||
uChar x, y;
|
uChar x = uChar(x11_mouse[1] - 0x20);
|
||||||
int btn;
|
uChar y = uChar(x11_mouse[2] - 0x20);
|
||||||
|
int btn = x11_mouse[0];
|
||||||
x = uChar(x11_mouse[1] - 0x20);
|
|
||||||
y = uChar(x11_mouse[2] - 0x20);
|
|
||||||
btn = x11_mouse[0];
|
|
||||||
new_mouse_position.setPoint (x, y);
|
new_mouse_position.setPoint (x, y);
|
||||||
// Fill bit field with 0
|
// Fill bit field with 0
|
||||||
std::memset(&b_state, 0x00, sizeof(b_state));
|
std::memset(&b_state, 0x00, sizeof(b_state));
|
||||||
|
@ -691,7 +687,7 @@ void FMouseSGR::setRawData (FKeyboard::keybuffer& fifo_buf)
|
||||||
|
|
||||||
std::size_t fifo_buf_size = sizeof(fifo_buf);
|
std::size_t fifo_buf_size = sizeof(fifo_buf);
|
||||||
std::size_t len = std::strlen(fifo_buf);
|
std::size_t len = std::strlen(fifo_buf);
|
||||||
std::size_t n = 3;
|
std::size_t n{3};
|
||||||
|
|
||||||
while ( n < len && n <= MOUSE_BUF_SIZE + 1 )
|
while ( n < len && n <= MOUSE_BUF_SIZE + 1 )
|
||||||
{
|
{
|
||||||
|
@ -719,16 +715,12 @@ void FMouseSGR::setRawData (FKeyboard::keybuffer& fifo_buf)
|
||||||
void FMouseSGR::processEvent (struct timeval* time)
|
void FMouseSGR::processEvent (struct timeval* time)
|
||||||
{
|
{
|
||||||
const auto& mouse_position = getPos();
|
const auto& mouse_position = getPos();
|
||||||
char* p;
|
uInt16 x{0};
|
||||||
int btn;
|
uInt16 y{0};
|
||||||
uInt16 x, y;
|
int btn{0};
|
||||||
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
btn = 0;
|
|
||||||
|
|
||||||
// parse the SGR mouse string
|
// parse the SGR mouse string
|
||||||
p = sgr_mouse;
|
char* p = sgr_mouse;
|
||||||
|
|
||||||
while ( *p && *p != ';' )
|
while ( *p && *p != ';' )
|
||||||
{
|
{
|
||||||
|
@ -930,7 +922,7 @@ void FMouseUrxvt::setRawData (FKeyboard::keybuffer& fifo_buf)
|
||||||
|
|
||||||
std::size_t fifo_buf_size = sizeof(fifo_buf);
|
std::size_t fifo_buf_size = sizeof(fifo_buf);
|
||||||
std::size_t len = std::strlen(fifo_buf);
|
std::size_t len = std::strlen(fifo_buf);
|
||||||
std::size_t n = 2;
|
std::size_t n{2};
|
||||||
|
|
||||||
while ( n < len && n <= MOUSE_BUF_SIZE )
|
while ( n < len && n <= MOUSE_BUF_SIZE )
|
||||||
{
|
{
|
||||||
|
@ -960,20 +952,14 @@ void FMouseUrxvt::processEvent (struct timeval* time)
|
||||||
// Parse and interpret the X11 xterm mouse string (Urxvt-Mode)
|
// Parse and interpret the X11 xterm mouse string (Urxvt-Mode)
|
||||||
|
|
||||||
const auto& mouse_position = getPos();
|
const auto& mouse_position = getPos();
|
||||||
char* p;
|
uInt16 x{0};
|
||||||
bool x_neg;
|
uInt16 y{0};
|
||||||
bool y_neg;
|
int btn{0};
|
||||||
int btn;
|
|
||||||
uInt16 x, y;
|
|
||||||
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
btn = 0;
|
|
||||||
|
|
||||||
// Parse the Urxvt mouse string
|
// Parse the Urxvt mouse string
|
||||||
p = urxvt_mouse;
|
char* p = urxvt_mouse;
|
||||||
x_neg = false;
|
bool x_neg{false};
|
||||||
y_neg = false;
|
bool y_neg{false};
|
||||||
|
|
||||||
while ( *p && *p != ';' )
|
while ( *p && *p != ';' )
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,8 +32,8 @@ namespace finalcut
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
bool FObject::timer_modify_lock;
|
bool FObject::timer_modify_lock;
|
||||||
FObject::TimerList* FObject::timer_list = nullptr;
|
FObject::TimerList* FObject::timer_list{nullptr};
|
||||||
const FString* fc::emptyFString::empty_string = nullptr;
|
const FString* fc::emptyFString::empty_string{nullptr};
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -120,7 +120,7 @@ bool FObject::isChild (const FObject* obj) const
|
||||||
{
|
{
|
||||||
// Find out if obj is a child object of mine
|
// Find out if obj is a child object of mine
|
||||||
|
|
||||||
FObject* p_obj = nullptr;
|
FObject* p_obj{nullptr};
|
||||||
|
|
||||||
while ( obj && (p_obj = obj->getParent()) )
|
while ( obj && (p_obj = obj->getParent()) )
|
||||||
{
|
{
|
||||||
|
@ -228,9 +228,8 @@ bool FObject::isTimeout (timeval* time, uInt64 timeout)
|
||||||
{
|
{
|
||||||
// Checks whether the specified time span (timeout in µs) has elapse
|
// Checks whether the specified time span (timeout in µs) has elapse
|
||||||
|
|
||||||
uInt64 diff_usec;
|
struct timeval now{};
|
||||||
struct timeval now;
|
struct timeval diff{};
|
||||||
struct timeval diff;
|
|
||||||
|
|
||||||
FObject::getCurrentTime(&now);
|
FObject::getCurrentTime(&now);
|
||||||
diff.tv_sec = now.tv_sec - time->tv_sec;
|
diff.tv_sec = now.tv_sec - time->tv_sec;
|
||||||
|
@ -242,7 +241,7 @@ bool FObject::isTimeout (timeval* time, uInt64 timeout)
|
||||||
diff.tv_usec += 1000000;
|
diff.tv_usec += 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
diff_usec = uInt64((diff.tv_sec * 1000000) + diff.tv_usec);
|
uInt64 diff_usec = uInt64((diff.tv_sec * 1000000) + diff.tv_usec);
|
||||||
return ( diff_usec > timeout );
|
return ( diff_usec > timeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,9 +251,9 @@ int FObject::addTimer (int interval)
|
||||||
// Create a timer and returns the timer identifier number
|
// Create a timer and returns the timer identifier number
|
||||||
// (interval in ms)
|
// (interval in ms)
|
||||||
|
|
||||||
timeval time_interval;
|
timeval time_interval{};
|
||||||
timeval currentTime;
|
timeval currentTime{};
|
||||||
int id = 1;
|
int id{1};
|
||||||
timer_modify_lock = true;
|
timer_modify_lock = true;
|
||||||
|
|
||||||
// find an unused timer id
|
// find an unused timer id
|
||||||
|
@ -282,7 +281,7 @@ int FObject::addTimer (int interval)
|
||||||
time_interval.tv_usec = (interval % 1000) * 1000;
|
time_interval.tv_usec = (interval % 1000) * 1000;
|
||||||
getCurrentTime (¤tTime);
|
getCurrentTime (¤tTime);
|
||||||
timeval timeout = currentTime + time_interval;
|
timeval timeout = currentTime + time_interval;
|
||||||
timer_data t = { id, time_interval, timeout, this };
|
timer_data t{ id, time_interval, timeout, this };
|
||||||
|
|
||||||
// insert in list sorted by timeout
|
// insert in list sorted by timeout
|
||||||
auto iter = timer_list->begin();
|
auto iter = timer_list->begin();
|
||||||
|
@ -380,8 +379,8 @@ void FObject::onUserEvent (FUserEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uInt FObject::processTimerEvent()
|
uInt FObject::processTimerEvent()
|
||||||
{
|
{
|
||||||
timeval currentTime;
|
timeval currentTime{};
|
||||||
uInt activated = 0;
|
uInt activated{0};
|
||||||
|
|
||||||
getCurrentTime (¤tTime);
|
getCurrentTime (¤tTime);
|
||||||
|
|
||||||
|
|
|
@ -1253,7 +1253,7 @@ inline void FOptiAttr::prevent_no_color_video_attributes ( charData*& attr
|
||||||
|| attr_without_color <= 0 )
|
|| attr_without_color <= 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int bit = 1; bit < no_mode; bit <<= 1)
|
for (int bit{1}; bit < no_mode; bit <<= 1)
|
||||||
{
|
{
|
||||||
switch ( bit & attr_without_color )
|
switch ( bit & attr_without_color )
|
||||||
{
|
{
|
||||||
|
@ -1331,7 +1331,7 @@ inline void FOptiAttr::deactivateAttributes ( charData*& term
|
||||||
inline void FOptiAttr::changeAttributeSGR ( charData*& term
|
inline void FOptiAttr::changeAttributeSGR ( charData*& term
|
||||||
, charData*& next )
|
, charData*& next )
|
||||||
{
|
{
|
||||||
bool pc_charset_usable = true;
|
bool pc_charset_usable{true};
|
||||||
|
|
||||||
if ( ! (term && next) )
|
if ( ! (term && next) )
|
||||||
return;
|
return;
|
||||||
|
@ -1393,8 +1393,6 @@ inline void FOptiAttr::changeAttributeSeparately ( charData*& term
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FOptiAttr::change_color (charData*& term, charData*& next)
|
void FOptiAttr::change_color (charData*& term, charData*& next)
|
||||||
{
|
{
|
||||||
FColor fg, bg;
|
|
||||||
|
|
||||||
if ( ! (term && next) )
|
if ( ! (term && next) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1411,8 +1409,8 @@ void FOptiAttr::change_color (charData*& term, charData*& next)
|
||||||
if ( next->bg_color != fc::Default )
|
if ( next->bg_color != fc::Default )
|
||||||
next->bg_color %= max_color;
|
next->bg_color %= max_color;
|
||||||
|
|
||||||
fg = next->fg_color;
|
FColor fg = next->fg_color;
|
||||||
bg = next->bg_color;
|
FColor bg = next->bg_color;
|
||||||
|
|
||||||
if ( fg == fc::Default || bg == fc::Default )
|
if ( fg == fc::Default || bg == fc::Default )
|
||||||
change_to_default_color (term, next, fg, bg);
|
change_to_default_color (term, next, fg, bg);
|
||||||
|
@ -1449,7 +1447,7 @@ inline void FOptiAttr::change_to_default_color ( charData*& term
|
||||||
}
|
}
|
||||||
else if ( fg == fc::Default && term->fg_color != fc::Default )
|
else if ( fg == fc::Default && term->fg_color != fc::Default )
|
||||||
{
|
{
|
||||||
char sgr_39[] = CSI "39m";
|
char sgr_39[]{ CSI "39m" };
|
||||||
append_sequence (sgr_39);
|
append_sequence (sgr_39);
|
||||||
term->fg_color = fc::Default;
|
term->fg_color = fc::Default;
|
||||||
}
|
}
|
||||||
|
@ -1479,7 +1477,7 @@ inline void FOptiAttr::change_to_default_color ( charData*& term
|
||||||
inline void FOptiAttr::change_current_color ( charData*& term
|
inline void FOptiAttr::change_current_color ( charData*& term
|
||||||
, FColor fg, FColor bg )
|
, FColor fg, FColor bg )
|
||||||
{
|
{
|
||||||
char* color_str;
|
char* color_str{};
|
||||||
auto& AF = F_set_a_foreground.cap;
|
auto& AF = F_set_a_foreground.cap;
|
||||||
auto& AB = F_set_a_background.cap;
|
auto& AB = F_set_a_background.cap;
|
||||||
auto& Sf = F_set_foreground.cap;
|
auto& Sf = F_set_foreground.cap;
|
||||||
|
|
|
@ -485,8 +485,8 @@ void FOptiMove::check_boundaries ( int& xold, int& yold
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
|
char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
|
||||||
{
|
{
|
||||||
int method = 0;
|
int method{0};
|
||||||
int move_time = LONG_DURATION;
|
int move_time{LONG_DURATION};
|
||||||
|
|
||||||
check_boundaries (xold, yold, xnew, ynew);
|
check_boundaries (xold, yold, xnew, ynew);
|
||||||
|
|
||||||
|
@ -558,10 +558,9 @@ int FOptiMove::capDuration (char cap[], int affcnt)
|
||||||
if ( ! cap )
|
if ( ! cap )
|
||||||
return LONG_DURATION;
|
return LONG_DURATION;
|
||||||
|
|
||||||
const char* p;
|
float ms{0};
|
||||||
float ms = 0;
|
|
||||||
|
|
||||||
for (p = cap; *p; p++)
|
for (const char* p = cap; *p; p++)
|
||||||
{
|
{
|
||||||
// check for delay with padding character
|
// check for delay with padding character
|
||||||
if ( p[0] == '$' && p[1] == '<' && std::strchr(p, '>') )
|
if ( p[0] == '$' && p[1] == '<' && std::strchr(p, '>') )
|
||||||
|
@ -601,13 +600,9 @@ int FOptiMove::repeatedAppend ( const capability& o
|
||||||
, volatile int count
|
, volatile int count
|
||||||
, char* dst )
|
, char* dst )
|
||||||
{
|
{
|
||||||
std::size_t src_len;
|
std::size_t src_len = std::strlen(o.cap);
|
||||||
std::size_t dst_len;
|
std::size_t dst_len = ( dst != 0 ) ? std::strlen(dst) : 0;
|
||||||
int total;
|
int total{0};
|
||||||
|
|
||||||
src_len = std::strlen(o.cap);
|
|
||||||
dst_len = ( dst != 0 ) ? std::strlen(dst) : 0;
|
|
||||||
total = 0;
|
|
||||||
|
|
||||||
if ( (dst_len + uInt(count) * src_len) < BUF_SIZE - 1 )
|
if ( (dst_len + uInt(count) * src_len) < BUF_SIZE - 1 )
|
||||||
{
|
{
|
||||||
|
@ -637,8 +632,8 @@ int FOptiMove::relativeMove ( char move[]
|
||||||
, int from_x, int from_y
|
, int from_x, int from_y
|
||||||
, int to_x, int to_y )
|
, int to_x, int to_y )
|
||||||
{
|
{
|
||||||
int vtime = 0;
|
int vtime{0};
|
||||||
int htime = 0;
|
int htime{0};
|
||||||
|
|
||||||
if ( move )
|
if ( move )
|
||||||
move[0] = '\0';
|
move[0] = '\0';
|
||||||
|
@ -653,7 +648,7 @@ int FOptiMove::relativeMove ( char move[]
|
||||||
|
|
||||||
if ( to_x != from_x ) // horizontal move
|
if ( to_x != from_x ) // horizontal move
|
||||||
{
|
{
|
||||||
char hmove[BUF_SIZE] = { };
|
char hmove[BUF_SIZE]{};
|
||||||
htime = horizontalMove (hmove, from_x, to_x);
|
htime = horizontalMove (hmove, from_x, to_x);
|
||||||
|
|
||||||
if ( htime >= LONG_DURATION )
|
if ( htime >= LONG_DURATION )
|
||||||
|
@ -676,7 +671,7 @@ int FOptiMove::relativeMove ( char move[]
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FOptiMove::verticalMove (char move[], int from_y, int to_y)
|
inline int FOptiMove::verticalMove (char move[], int from_y, int to_y)
|
||||||
{
|
{
|
||||||
int vtime = LONG_DURATION;
|
int vtime{LONG_DURATION};
|
||||||
|
|
||||||
if ( F_row_address.cap )
|
if ( F_row_address.cap )
|
||||||
{
|
{
|
||||||
|
@ -758,7 +753,7 @@ inline void FOptiMove::upMove ( char move[], int& vtime
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FOptiMove::horizontalMove (char hmove[], int from_x, int to_x)
|
inline int FOptiMove::horizontalMove (char hmove[], int from_x, int to_x)
|
||||||
{
|
{
|
||||||
int htime = LONG_DURATION;
|
int htime{LONG_DURATION};
|
||||||
|
|
||||||
if ( F_column_address.cap )
|
if ( F_column_address.cap )
|
||||||
{
|
{
|
||||||
|
@ -795,8 +790,8 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
|
||||||
|
|
||||||
if ( F_cursor_right.cap )
|
if ( F_cursor_right.cap )
|
||||||
{
|
{
|
||||||
char str[BUF_SIZE] = { };
|
char str[BUF_SIZE]{};
|
||||||
int htime_r = 0;
|
int htime_r{0};
|
||||||
str[0] = '\0';
|
str[0] = '\0';
|
||||||
|
|
||||||
// try to use tab
|
// try to use tab
|
||||||
|
@ -850,8 +845,8 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
|
||||||
|
|
||||||
if ( F_cursor_left.cap )
|
if ( F_cursor_left.cap )
|
||||||
{
|
{
|
||||||
char str[BUF_SIZE] = { };
|
char str[BUF_SIZE]{};
|
||||||
int htime_l = 0;
|
int htime_l{0};
|
||||||
str[0] = '\0';
|
str[0] = '\0';
|
||||||
|
|
||||||
// try to use backward tab
|
// try to use backward tab
|
||||||
|
|
|
@ -164,7 +164,7 @@ void FProgressbar::drawProgressLabel()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FProgressbar::drawProgressBar()
|
void FProgressbar::drawProgressBar()
|
||||||
{
|
{
|
||||||
std::size_t len = 0;
|
std::size_t len{0};
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint(1, 1);
|
||||||
|
|
||||||
if ( percentage > 0 && percentage <= 100 )
|
if ( percentage > 0 && percentage <= 100 )
|
||||||
|
|
|
@ -290,7 +290,7 @@ bool FRect::overlap (const FRect &r) const
|
||||||
FRect FRect::intersect (const FRect& r) const
|
FRect FRect::intersect (const FRect& r) const
|
||||||
{
|
{
|
||||||
// intersection: this ∩ r
|
// intersection: this ∩ r
|
||||||
FRect new_rect;
|
FRect new_rect{};
|
||||||
new_rect.X1 = std::max(X1, r.X1);
|
new_rect.X1 = std::max(X1, r.X1);
|
||||||
new_rect.Y1 = std::max(Y1, r.Y1);
|
new_rect.Y1 = std::max(Y1, r.Y1);
|
||||||
new_rect.X2 = std::min(X2, r.X2);
|
new_rect.X2 = std::min(X2, r.X2);
|
||||||
|
@ -302,7 +302,7 @@ FRect FRect::intersect (const FRect& r) const
|
||||||
FRect FRect::combined (const FRect& r) const
|
FRect FRect::combined (const FRect& r) const
|
||||||
{
|
{
|
||||||
// Union: this ∪ r
|
// Union: this ∪ r
|
||||||
FRect new_rect;
|
FRect new_rect{};
|
||||||
new_rect.X1 = std::min(X1, r.X1);
|
new_rect.X1 = std::min(X1, r.X1);
|
||||||
new_rect.Y1 = std::min(Y1, r.Y1);
|
new_rect.Y1 = std::min(Y1, r.Y1);
|
||||||
new_rect.X2 = std::max(X2, r.X2);
|
new_rect.X2 = std::max(X2, r.X2);
|
||||||
|
|
|
@ -129,7 +129,7 @@ void FScrollbar::setPageSize (int document_size, int page_size)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::setOrientation (fc::orientation o)
|
void FScrollbar::setOrientation (fc::orientation o)
|
||||||
{
|
{
|
||||||
std::size_t nf = 0;
|
std::size_t nf{0};
|
||||||
length = ( getHeight() > getWidth() ) ? getHeight() : getWidth();
|
length = ( getHeight() > getWidth() ) ? getHeight() : getWidth();
|
||||||
|
|
||||||
if ( o == fc::vertical && bar_orientation == fc::horizontal )
|
if ( o == fc::vertical && bar_orientation == fc::horizontal )
|
||||||
|
@ -158,7 +158,7 @@ void FScrollbar::setGeometry ( const FPoint& pos, const FSize& size
|
||||||
|
|
||||||
FWidget::setGeometry (pos, size, adjust);
|
FWidget::setGeometry (pos, size, adjust);
|
||||||
|
|
||||||
std::size_t nf = 0;
|
std::size_t nf{0};
|
||||||
std::size_t w = size.getWidth();
|
std::size_t w = size.getWidth();
|
||||||
std::size_t h = size.getHeight();
|
std::size_t h = size.getHeight();
|
||||||
length = ( h > w ) ? h : w;
|
length = ( h > w ) ? h : w;
|
||||||
|
@ -257,8 +257,6 @@ void FScrollbar::drawBar()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::onMouseDown (FMouseEvent* ev)
|
void FScrollbar::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int mouse_x, mouse_y;
|
|
||||||
|
|
||||||
if ( ev->getButton() != fc::LeftButton
|
if ( ev->getButton() != fc::LeftButton
|
||||||
&& ev->getButton() != fc::MiddleButton )
|
&& ev->getButton() != fc::MiddleButton )
|
||||||
return;
|
return;
|
||||||
|
@ -266,8 +264,8 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
|
||||||
if ( min == max )
|
if ( min == max )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( ev->getButton() == fc::MiddleButton )
|
if ( ev->getButton() == fc::MiddleButton )
|
||||||
{
|
{
|
||||||
|
@ -330,14 +328,12 @@ void FScrollbar::onMouseUp (FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::onMouseMove (FMouseEvent* ev)
|
void FScrollbar::onMouseMove (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int mouse_x, mouse_y, new_scroll_type;
|
|
||||||
|
|
||||||
if ( ev->getButton() != fc::LeftButton
|
if ( ev->getButton() != fc::LeftButton
|
||||||
&& ev->getButton() != fc::MiddleButton )
|
&& ev->getButton() != fc::MiddleButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( ev->getButton() == fc::MiddleButton )
|
if ( ev->getButton() == fc::MiddleButton )
|
||||||
{
|
{
|
||||||
|
@ -346,7 +342,7 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process left button
|
// Process left button
|
||||||
new_scroll_type = getClickedScrollType(mouse_x, mouse_y);
|
int new_scroll_type = getClickedScrollType(mouse_x, mouse_y);
|
||||||
|
|
||||||
if ( scroll_type == FScrollbar::scrollJump )
|
if ( scroll_type == FScrollbar::scrollJump )
|
||||||
{
|
{
|
||||||
|
@ -476,10 +472,9 @@ void FScrollbar::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::drawVerticalBar()
|
void FScrollbar::drawVerticalBar()
|
||||||
{
|
{
|
||||||
int z;
|
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||||
|
|
||||||
for (z = 1; z <= slider_pos; z++)
|
for (int z{1}; z <= slider_pos; z++)
|
||||||
{
|
{
|
||||||
print() << FPoint(1, 1 + z);
|
print() << FPoint(1, 1 + z);
|
||||||
drawVerticalBackgroundLine();
|
drawVerticalBackgroundLine();
|
||||||
|
@ -490,7 +485,7 @@ void FScrollbar::drawVerticalBar()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
for (z = 1; z <= int(slider_length); z++) // Draw slider
|
for (int z{1}; z <= int(slider_length); z++) // Draw slider
|
||||||
{
|
{
|
||||||
print() << FPoint(1, 1 + slider_pos + z);
|
print() << FPoint(1, 1 + slider_pos + z);
|
||||||
|
|
||||||
|
@ -505,7 +500,7 @@ void FScrollbar::drawVerticalBar()
|
||||||
|
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||||
|
|
||||||
for (z = slider_pos + int(slider_length) + 1; z <= int(bar_length); z++)
|
for (int z = slider_pos + int(slider_length) + 1; z <= int(bar_length); z++)
|
||||||
{
|
{
|
||||||
print() << FPoint(1, 1 + z);
|
print() << FPoint(1, 1 + z);
|
||||||
drawVerticalBackgroundLine();
|
drawVerticalBackgroundLine();
|
||||||
|
@ -535,7 +530,6 @@ inline void FScrollbar::drawVerticalBackgroundLine()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::drawHorizontalBar()
|
void FScrollbar::drawHorizontalBar()
|
||||||
{
|
{
|
||||||
int z;
|
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
|
@ -543,7 +537,7 @@ void FScrollbar::drawHorizontalBar()
|
||||||
else
|
else
|
||||||
print() << FPoint(2, 1);
|
print() << FPoint(2, 1);
|
||||||
|
|
||||||
for (z = 0; z < slider_pos; z++)
|
for (int z{0}; z < slider_pos; z++)
|
||||||
drawHorizontalBackgroundColumn();
|
drawHorizontalBackgroundColumn();
|
||||||
|
|
||||||
setColor (wc.scrollbar_bg, wc.scrollbar_fg);
|
setColor (wc.scrollbar_bg, wc.scrollbar_fg);
|
||||||
|
@ -551,14 +545,14 @@ void FScrollbar::drawHorizontalBar()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
for (z = 0; z < int(slider_length); z++) // Draw slider
|
for (int z{0}; z < int(slider_length); z++) // Draw slider
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||||
z = slider_pos + int(slider_length) + 1;
|
int z = slider_pos + int(slider_length) + 1;
|
||||||
|
|
||||||
for (; z <= int(bar_length); z++)
|
for (; z <= int(bar_length); z++)
|
||||||
drawHorizontalBackgroundColumn();
|
drawHorizontalBackgroundColumn();
|
||||||
|
@ -745,7 +739,7 @@ int FScrollbar::getSliderClickPos (int mouse_x, int mouse_y)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::jumpToClickPos (int x, int y)
|
void FScrollbar::jumpToClickPos (int x, int y)
|
||||||
{
|
{
|
||||||
int new_val;
|
int new_val{};
|
||||||
|
|
||||||
if ( bar_orientation == fc::vertical )
|
if ( bar_orientation == fc::vertical )
|
||||||
{
|
{
|
||||||
|
|
|
@ -114,7 +114,6 @@ void FScrollView::setScrollHeight (std::size_t height)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollView::setScrollSize (const FSize& size)
|
void FScrollView::setScrollSize (const FSize& size)
|
||||||
{
|
{
|
||||||
int xoffset_end, yoffset_end;
|
|
||||||
std::size_t width = size.getWidth();
|
std::size_t width = size.getWidth();
|
||||||
std::size_t height = size.getHeight();
|
std::size_t height = size.getHeight();
|
||||||
|
|
||||||
|
@ -139,8 +138,8 @@ void FScrollView::setScrollSize (const FSize& size)
|
||||||
child_print_area = viewport;
|
child_print_area = viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
xoffset_end = int(getScrollWidth() - getViewportWidth());
|
int xoffset_end = int(getScrollWidth() - getViewportWidth());
|
||||||
yoffset_end = int(getScrollHeight() - getViewportHeight());
|
int yoffset_end = int(getScrollHeight() - getViewportHeight());
|
||||||
setTopPadding (1 - getScrollY());
|
setTopPadding (1 - getScrollY());
|
||||||
setLeftPadding (1 - getScrollX());
|
setLeftPadding (1 - getScrollX());
|
||||||
setBottomPadding (1 - (yoffset_end - getScrollY()));
|
setBottomPadding (1 - (yoffset_end - getScrollY()));
|
||||||
|
@ -350,8 +349,8 @@ void FScrollView::scrollTo (int x, int y)
|
||||||
int yoffset_end = int(getScrollHeight() - getViewportHeight());
|
int yoffset_end = int(getScrollHeight() - getViewportHeight());
|
||||||
std::size_t save_width = viewport_geometry.getWidth();
|
std::size_t save_width = viewport_geometry.getWidth();
|
||||||
std::size_t save_height = viewport_geometry.getHeight();
|
std::size_t save_height = viewport_geometry.getHeight();
|
||||||
bool changeX = false;
|
bool changeX{false};
|
||||||
bool changeY = false;
|
bool changeY{false};
|
||||||
x--;
|
x--;
|
||||||
y--;
|
y--;
|
||||||
|
|
||||||
|
@ -516,7 +515,7 @@ void FScrollView::onKeyPress (FKeyEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollView::onWheel (FWheelEvent* ev)
|
void FScrollView::onWheel (FWheelEvent* ev)
|
||||||
{
|
{
|
||||||
int distance = 4;
|
int distance{4};
|
||||||
|
|
||||||
switch ( ev->getWheel() )
|
switch ( ev->getWheel() )
|
||||||
{
|
{
|
||||||
|
@ -576,8 +575,8 @@ void FScrollView::onChildFocusIn (FFocusEvent*)
|
||||||
|
|
||||||
if ( ! vp_geometry.contains(widget_geometry) )
|
if ( ! vp_geometry.contains(widget_geometry) )
|
||||||
{
|
{
|
||||||
int x
|
int x{}
|
||||||
, y
|
, y{}
|
||||||
, vx = vp_geometry.getX()
|
, vx = vp_geometry.getX()
|
||||||
, vy = vp_geometry.getY()
|
, vy = vp_geometry.getY()
|
||||||
, wx = widget_geometry.getX()
|
, wx = widget_geometry.getX()
|
||||||
|
@ -712,10 +711,10 @@ void FScrollView::copy2area()
|
||||||
if ( print_area->height <= ay + y_end )
|
if ( print_area->height <= ay + y_end )
|
||||||
y_end = print_area->height - ay;
|
y_end = print_area->height - ay;
|
||||||
|
|
||||||
for (int y = 0; y < y_end; y++) // line loop
|
for (int y{0}; y < y_end; y++) // line loop
|
||||||
{
|
{
|
||||||
charData* vc; // viewport character
|
charData* vc{}; // viewport character
|
||||||
charData* ac; // area character
|
charData* ac{}; // area character
|
||||||
int v_line_len = viewport->width;
|
int v_line_len = viewport->width;
|
||||||
int a_line_len = print_area->width + print_area->right_shadow;
|
int a_line_len = print_area->width + print_area->right_shadow;
|
||||||
vc = &viewport->text[(dy + y) * v_line_len + dx];
|
vc = &viewport->text[(dy + y) * v_line_len + dx];
|
||||||
|
@ -896,7 +895,7 @@ void FScrollView::setViewportCursor()
|
||||||
|
|
||||||
FPoint cursor_pos ( viewport->input_cursor_x - 1
|
FPoint cursor_pos ( viewport->input_cursor_x - 1
|
||||||
, viewport->input_cursor_y - 1 );
|
, viewport->input_cursor_y - 1 );
|
||||||
FPoint window_cursor_pos = getViewportCursorPos();
|
FPoint window_cursor_pos(getViewportCursorPos());
|
||||||
print_area->input_cursor_x = window_cursor_pos.getX();
|
print_area->input_cursor_x = window_cursor_pos.getX();
|
||||||
print_area->input_cursor_y = window_cursor_pos.getY();
|
print_area->input_cursor_y = window_cursor_pos.getY();
|
||||||
|
|
||||||
|
@ -911,8 +910,8 @@ void FScrollView::setViewportCursor()
|
||||||
void FScrollView::cb_VBarChange (FWidget*, FDataPtr)
|
void FScrollView::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
FScrollbar::sType scrollType = vbar->getScrollType();
|
FScrollbar::sType scrollType = vbar->getScrollType();
|
||||||
int distance = 1;
|
int distance{1};
|
||||||
int wheel_distance = 4;
|
int wheel_distance{4};
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward
|
||||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
&& scrollType <= FScrollbar::scrollWheelDown )
|
||||||
|
@ -963,8 +962,8 @@ void FScrollView::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
void FScrollView::cb_HBarChange (FWidget*, FDataPtr)
|
void FScrollView::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
FScrollbar::sType scrollType = hbar->getScrollType();
|
FScrollbar::sType scrollType = hbar->getScrollType();
|
||||||
int distance = 1;
|
int distance{1};
|
||||||
int wheel_distance = 4;
|
int wheel_distance{4};
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward
|
||||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
&& scrollType <= FScrollbar::scrollWheelDown )
|
||||||
|
|
|
@ -155,7 +155,7 @@ FStatusBar::~FStatusBar() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::setMessage (const FString& mgs)
|
void FStatusBar::setMessage (const FString& mgs)
|
||||||
{
|
{
|
||||||
text = mgs;
|
text.setString(mgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -187,10 +187,6 @@ void FStatusBar::hide()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::drawMessage()
|
void FStatusBar::drawMessage()
|
||||||
{
|
{
|
||||||
std::size_t termWidth;
|
|
||||||
int space_offset;
|
|
||||||
bool isLastActiveFocus, hasKeys;
|
|
||||||
|
|
||||||
if ( ! (isVisible() ) )
|
if ( ! (isVisible() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -198,9 +194,10 @@ void FStatusBar::drawMessage()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
x = x_msg;
|
x = x_msg;
|
||||||
termWidth = getDesktopWidth();
|
int space_offset{1};
|
||||||
space_offset = 1;
|
bool hasKeys = bool(! key_list.empty());
|
||||||
hasKeys = bool(! key_list.empty());
|
bool isLastActiveFocus{false};
|
||||||
|
std::size_t termWidth = getDesktopWidth();
|
||||||
|
|
||||||
if ( hasKeys )
|
if ( hasKeys )
|
||||||
{
|
{
|
||||||
|
@ -352,7 +349,7 @@ void FStatusBar::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( ! key_list.empty() )
|
if ( ! key_list.empty() )
|
||||||
{
|
{
|
||||||
int X = 1;
|
int X{1};
|
||||||
auto iter = key_list.begin();
|
auto iter = key_list.begin();
|
||||||
auto last = key_list.end();
|
auto last = key_list.end();
|
||||||
|
|
||||||
|
@ -395,7 +392,7 @@ void FStatusBar::onMouseUp (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( ! key_list.empty() )
|
if ( ! key_list.empty() )
|
||||||
{
|
{
|
||||||
int X = 1;
|
int X{1};
|
||||||
auto iter = key_list.begin();
|
auto iter = key_list.begin();
|
||||||
auto last = key_list.end();
|
auto last = key_list.end();
|
||||||
|
|
||||||
|
@ -439,8 +436,8 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( mouse_down && ! key_list.empty() )
|
if ( mouse_down && ! key_list.empty() )
|
||||||
{
|
{
|
||||||
bool focus_changed = false;
|
bool focus_changed{false};
|
||||||
int X = 1;
|
int X{1};
|
||||||
auto iter = key_list.begin();
|
auto iter = key_list.begin();
|
||||||
auto last = key_list.end();
|
auto last = key_list.end();
|
||||||
|
|
||||||
|
@ -584,9 +581,7 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
||||||
{
|
{
|
||||||
// Draw not active key
|
// Draw not active key
|
||||||
|
|
||||||
std::size_t txt_length;
|
|
||||||
auto item = *iter;
|
auto item = *iter;
|
||||||
|
|
||||||
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
|
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
|
||||||
x++;
|
x++;
|
||||||
print (' ');
|
print (' ');
|
||||||
|
@ -595,7 +590,7 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
||||||
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
||||||
x++;
|
x++;
|
||||||
print ('-');
|
print ('-');
|
||||||
txt_length = item->getText().getLength();
|
std::size_t txt_length = item->getText().getLength();
|
||||||
x += int(txt_length);
|
x += int(txt_length);
|
||||||
|
|
||||||
if ( x - 1 <= int(screenWidth) )
|
if ( x - 1 <= int(screenWidth) )
|
||||||
|
@ -603,8 +598,8 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
print ( item->getText()
|
std::size_t len = txt_length + screenWidth - std::size_t(x) - 1;
|
||||||
.left(txt_length + screenWidth - std::size_t(x) - 1) );
|
print (item->getText().left(len));
|
||||||
print ("..");
|
print ("..");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,7 +639,6 @@ void FStatusBar::drawActiveKey (keyList::const_iterator iter)
|
||||||
{
|
{
|
||||||
// Draw active key
|
// Draw active key
|
||||||
|
|
||||||
std::size_t txt_length;
|
|
||||||
auto item = *iter;
|
auto item = *iter;
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -659,7 +653,7 @@ void FStatusBar::drawActiveKey (keyList::const_iterator iter)
|
||||||
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
|
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
|
||||||
x++;
|
x++;
|
||||||
print ('-');
|
print ('-');
|
||||||
txt_length = item->getText().getLength();
|
std::size_t txt_length = item->getText().getLength();
|
||||||
x += int(txt_length);
|
x += int(txt_length);
|
||||||
|
|
||||||
if ( x <= int(screenWidth) )
|
if ( x <= int(screenWidth) )
|
||||||
|
|
248
src/fstring.cpp
248
src/fstring.cpp
|
@ -52,12 +52,9 @@ FString::FString (std::size_t len)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (std::size_t len, wchar_t c)
|
FString::FString (std::size_t len, wchar_t c)
|
||||||
{
|
{
|
||||||
wchar_t* ps;
|
|
||||||
wchar_t* pe;
|
|
||||||
|
|
||||||
initLength(len);
|
initLength(len);
|
||||||
ps = string;
|
const wchar_t* ps = string;
|
||||||
pe = string + len;
|
wchar_t* pe = string + len;
|
||||||
|
|
||||||
while ( pe != ps )
|
while ( pe != ps )
|
||||||
*--pe = c;
|
*--pe = c;
|
||||||
|
@ -194,9 +191,8 @@ const FString FString::operator + (const FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString FString::operator + (const wchar_t c)
|
const FString FString::operator + (const wchar_t c)
|
||||||
{
|
{
|
||||||
wchar_t s[2];
|
wchar_t s[2]{};
|
||||||
s[0] = c;
|
s[0] = c;
|
||||||
s[1] = L'\0';
|
|
||||||
FString tmp(string);
|
FString tmp(string);
|
||||||
tmp._insert (length, 1, s);
|
tmp._insert (length, 1, s);
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -205,9 +201,8 @@ const FString FString::operator + (const wchar_t c)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString FString::operator + (const char c)
|
const FString FString::operator + (const char c)
|
||||||
{
|
{
|
||||||
wchar_t s[2];
|
wchar_t s[2]{};
|
||||||
s[0] = wchar_t(c & 0xff);
|
s[0] = wchar_t(c & 0xff);
|
||||||
s[1] = L'\0';
|
|
||||||
FString tmp(string);
|
FString tmp(string);
|
||||||
tmp._insert (length, 1, s);
|
tmp._insert (length, 1, s);
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -247,7 +242,7 @@ FString& FString::operator << (const char c)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator << (const sInt16 num)
|
FString& FString::operator << (const sInt16 num)
|
||||||
{
|
{
|
||||||
FString numstr = FString().setNumber(num);
|
FString numstr(FString().setNumber(num));
|
||||||
_insert (length, numstr.length, numstr.string);
|
_insert (length, numstr.length, numstr.string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -255,7 +250,7 @@ FString& FString::operator << (const sInt16 num)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator << (const uInt16 num)
|
FString& FString::operator << (const uInt16 num)
|
||||||
{
|
{
|
||||||
FString numstr = FString().setNumber(num);
|
FString numstr(FString().setNumber(num));
|
||||||
_insert (length, numstr.length, numstr.string);
|
_insert (length, numstr.length, numstr.string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -263,7 +258,7 @@ FString& FString::operator << (const uInt16 num)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator << (const int num)
|
FString& FString::operator << (const int num)
|
||||||
{
|
{
|
||||||
FString numstr = FString().setNumber(num);
|
FString numstr(FString().setNumber(num));
|
||||||
_insert (length, numstr.length, numstr.string);
|
_insert (length, numstr.length, numstr.string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +266,7 @@ FString& FString::operator << (const int num)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator << (const uInt num)
|
FString& FString::operator << (const uInt num)
|
||||||
{
|
{
|
||||||
FString numstr = FString().setNumber(num);
|
FString numstr(FString().setNumber(num));
|
||||||
_insert (length, numstr.length, numstr.string);
|
_insert (length, numstr.length, numstr.string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -279,7 +274,7 @@ FString& FString::operator << (const uInt num)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator << (const long num)
|
FString& FString::operator << (const long num)
|
||||||
{
|
{
|
||||||
FString numstr = FString().setNumber(num);
|
FString numstr(FString().setNumber(num));
|
||||||
_insert (length, numstr.length, numstr.string);
|
_insert (length, numstr.length, numstr.string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -287,7 +282,7 @@ FString& FString::operator << (const long num)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator << (const uLong num)
|
FString& FString::operator << (const uLong num)
|
||||||
{
|
{
|
||||||
FString numstr = FString().setNumber(num);
|
FString numstr(FString().setNumber(num));
|
||||||
_insert (length, numstr.length, numstr.string);
|
_insert (length, numstr.length, numstr.string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +290,7 @@ FString& FString::operator << (const uLong num)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator << (const float num)
|
FString& FString::operator << (const float num)
|
||||||
{
|
{
|
||||||
FString numstr = FString().setNumber(num);
|
FString numstr(FString().setNumber(num));
|
||||||
_insert (length, numstr.length, numstr.string);
|
_insert (length, numstr.length, numstr.string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -303,7 +298,7 @@ FString& FString::operator << (const float num)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator << (const double num)
|
FString& FString::operator << (const double num)
|
||||||
{
|
{
|
||||||
FString numstr = FString().setNumber(num);
|
FString numstr(FString().setNumber(num));
|
||||||
_insert (length, numstr.length, numstr.string);
|
_insert (length, numstr.length, numstr.string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -311,7 +306,7 @@ FString& FString::operator << (const double num)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator << (const lDouble num)
|
FString& FString::operator << (const lDouble num)
|
||||||
{
|
{
|
||||||
FString numstr = FString().setNumber(num);
|
FString numstr(FString().setNumber(num));
|
||||||
_insert (length, numstr.length, numstr.string);
|
_insert (length, numstr.length, numstr.string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -419,14 +414,11 @@ const FString& FString::operator () ()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
std::size_t FString::getUTF8length() const
|
std::size_t FString::getUTF8length() const
|
||||||
{
|
{
|
||||||
std::size_t len;
|
|
||||||
const char* s;
|
|
||||||
|
|
||||||
if ( ! string )
|
if ( ! string )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
len = 0;
|
std::size_t len = 0;
|
||||||
s = c_str();
|
const char* s = c_str();
|
||||||
|
|
||||||
while ( *s )
|
while ( *s )
|
||||||
len += std::size_t((*s++ & 0xc0) != 0x80);
|
len += std::size_t((*s++ & 0xc0) != 0x80);
|
||||||
|
@ -438,8 +430,8 @@ std::size_t FString::getUTF8length() const
|
||||||
FString& FString::sprintf (const FString format, ...)
|
FString& FString::sprintf (const FString format, ...)
|
||||||
{
|
{
|
||||||
static constexpr int BUFSIZE = 4096;
|
static constexpr int BUFSIZE = 4096;
|
||||||
wchar_t buffer[BUFSIZE];
|
wchar_t buffer[BUFSIZE]{};
|
||||||
va_list args;
|
va_list args{};
|
||||||
|
|
||||||
if ( ! format )
|
if ( ! format )
|
||||||
{
|
{
|
||||||
|
@ -518,9 +510,8 @@ const std::string FString::toString() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::toLower() const
|
FString FString::toLower() const
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
|
||||||
FString s(string);
|
FString s(string);
|
||||||
p = s.string;
|
wchar_t* p = s.string;
|
||||||
|
|
||||||
if ( p )
|
if ( p )
|
||||||
{
|
{
|
||||||
|
@ -537,9 +528,8 @@ FString FString::toLower() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::toUpper() const
|
FString FString::toUpper() const
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
|
||||||
FString s(string);
|
FString s(string);
|
||||||
p = s.string;
|
wchar_t* p = s.string;
|
||||||
|
|
||||||
if ( p )
|
if ( p )
|
||||||
{
|
{
|
||||||
|
@ -556,8 +546,7 @@ FString FString::toUpper() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
sInt16 FString::toShort() const
|
sInt16 FString::toShort() const
|
||||||
{
|
{
|
||||||
long num;
|
long num = toLong();
|
||||||
num = toLong();
|
|
||||||
|
|
||||||
if ( num > SHRT_MAX )
|
if ( num > SHRT_MAX )
|
||||||
throw std::overflow_error ("overflow");
|
throw std::overflow_error ("overflow");
|
||||||
|
@ -571,8 +560,7 @@ sInt16 FString::toShort() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uInt16 FString::toUShort() const
|
uInt16 FString::toUShort() const
|
||||||
{
|
{
|
||||||
uLong num;
|
uLong num = uLong(toULong());
|
||||||
num = uLong(toULong());
|
|
||||||
|
|
||||||
if ( num > USHRT_MAX )
|
if ( num > USHRT_MAX )
|
||||||
throw std::overflow_error ("overflow");
|
throw std::overflow_error ("overflow");
|
||||||
|
@ -583,8 +571,7 @@ uInt16 FString::toUShort() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FString::toInt() const
|
int FString::toInt() const
|
||||||
{
|
{
|
||||||
long num;
|
long num = toLong();
|
||||||
num = toLong();
|
|
||||||
|
|
||||||
if ( num > INT_MAX )
|
if ( num > INT_MAX )
|
||||||
throw std::overflow_error ("overflow");
|
throw std::overflow_error ("overflow");
|
||||||
|
@ -598,8 +585,7 @@ int FString::toInt() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uInt FString::toUInt() const
|
uInt FString::toUInt() const
|
||||||
{
|
{
|
||||||
uLong num;
|
uLong num = uLong(toULong());
|
||||||
num = uLong(toULong());
|
|
||||||
|
|
||||||
if ( num > UINT_MAX )
|
if ( num > UINT_MAX )
|
||||||
throw std::overflow_error ("overflow");
|
throw std::overflow_error ("overflow");
|
||||||
|
@ -610,19 +596,12 @@ uInt FString::toUInt() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
long FString::toLong() const
|
long FString::toLong() const
|
||||||
{
|
{
|
||||||
bool neg;
|
bool neg{false};
|
||||||
long num;
|
long num{0};
|
||||||
long tenth_limit;
|
long tenth_limit{LONG_MAX / 10};
|
||||||
long tenth_limit_digit;
|
long tenth_limit_digit{LONG_MAX % 10};
|
||||||
wchar_t* p;
|
FString s(trim());
|
||||||
FString s;
|
const wchar_t* p = s.string;
|
||||||
|
|
||||||
neg = false;
|
|
||||||
num = 0;
|
|
||||||
tenth_limit = LONG_MAX / 10;
|
|
||||||
tenth_limit_digit = LONG_MAX % 10;
|
|
||||||
s = trim();
|
|
||||||
p = s.string;
|
|
||||||
|
|
||||||
if ( ! p )
|
if ( ! p )
|
||||||
throw std::invalid_argument ("null value");
|
throw std::invalid_argument ("null value");
|
||||||
|
@ -671,17 +650,11 @@ long FString::toLong() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uLong FString::toULong() const
|
uLong FString::toULong() const
|
||||||
{
|
{
|
||||||
uLong num;
|
uLong num{0};
|
||||||
uLong tenth_limit;
|
uLong tenth_limit{ULONG_MAX / 10};
|
||||||
uLong tenth_limit_digit;
|
uLong tenth_limit_digit{ULONG_MAX % 10};
|
||||||
wchar_t* p;
|
FString s(trim());
|
||||||
FString s;
|
const wchar_t* p = s.string;
|
||||||
|
|
||||||
num = 0;
|
|
||||||
tenth_limit = ULONG_MAX / 10;
|
|
||||||
tenth_limit_digit = ULONG_MAX % 10;
|
|
||||||
s = trim();
|
|
||||||
p = s.string;
|
|
||||||
|
|
||||||
if ( ! p )
|
if ( ! p )
|
||||||
throw std::invalid_argument ("null value");
|
throw std::invalid_argument ("null value");
|
||||||
|
@ -721,8 +694,7 @@ uLong FString::toULong() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
float FString::toFloat() const
|
float FString::toFloat() const
|
||||||
{
|
{
|
||||||
double num;
|
double num = toDouble();
|
||||||
num = toDouble();
|
|
||||||
|
|
||||||
if ( num > double(FLT_MAX) || num < double(-FLT_MAX) )
|
if ( num > double(FLT_MAX) || num < double(-FLT_MAX) )
|
||||||
throw std::overflow_error ("overflow");
|
throw std::overflow_error ("overflow");
|
||||||
|
@ -736,16 +708,14 @@ float FString::toFloat() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
double FString::toDouble() const
|
double FString::toDouble() const
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
|
||||||
double ret;
|
|
||||||
|
|
||||||
if ( ! string )
|
if ( ! string )
|
||||||
throw std::invalid_argument ("null value");
|
throw std::invalid_argument ("null value");
|
||||||
|
|
||||||
if ( ! *string )
|
if ( ! *string )
|
||||||
throw std::invalid_argument ("empty value");
|
throw std::invalid_argument ("empty value");
|
||||||
|
|
||||||
ret = std::wcstod(string, &p);
|
wchar_t* p{};
|
||||||
|
double ret = std::wcstod(string, &p);
|
||||||
|
|
||||||
if ( p != 0 && *p != '\0' )
|
if ( p != 0 && *p != '\0' )
|
||||||
throw std::invalid_argument ("no valid floating point value");
|
throw std::invalid_argument ("no valid floating point value");
|
||||||
|
@ -765,14 +735,13 @@ double FString::toDouble() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::ltrim() const
|
FString FString::ltrim() const
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
|
||||||
FString s(string);
|
FString s(string);
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
if ( ! (string && *string) )
|
if ( ! (string && *string) )
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
p = s.string;
|
const wchar_t* p = s.string;
|
||||||
|
|
||||||
while ( std::iswspace(wint_t(*p)) )
|
while ( std::iswspace(wint_t(*p)) )
|
||||||
p++;
|
p++;
|
||||||
|
@ -783,16 +752,14 @@ FString FString::ltrim() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::rtrim() const
|
FString FString::rtrim() const
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
|
||||||
wchar_t* last;
|
|
||||||
FString s(string);
|
FString s(string);
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
if ( ! (string && *string) )
|
if ( ! (string && *string) )
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
p = s.string;
|
wchar_t* p = s.string;
|
||||||
last = p + length;
|
wchar_t* last = p + length;
|
||||||
|
|
||||||
while ( std::iswspace(wint_t(*--last)) && last > p )
|
while ( std::iswspace(wint_t(*--last)) && last > p )
|
||||||
s.length--;
|
s.length--;
|
||||||
|
@ -819,7 +786,6 @@ FString FString::trim() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::left (std::size_t len) const
|
FString FString::left (std::size_t len) const
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
|
||||||
FString s(string);
|
FString s(string);
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
|
@ -829,7 +795,7 @@ FString FString::left (std::size_t len) const
|
||||||
if ( len > length )
|
if ( len > length )
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
p = s.string;
|
wchar_t* p = s.string;
|
||||||
s.length = len;
|
s.length = len;
|
||||||
*(p + len) = '\0';
|
*(p + len) = '\0';
|
||||||
return s;
|
return s;
|
||||||
|
@ -838,7 +804,6 @@ FString FString::left (std::size_t len) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::right (std::size_t len) const
|
FString FString::right (std::size_t len) const
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
|
||||||
FString s(string);
|
FString s(string);
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
|
@ -848,7 +813,7 @@ FString FString::right (std::size_t len) const
|
||||||
if ( len > length )
|
if ( len > length )
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
p = s.string;
|
const wchar_t* p = s.string;
|
||||||
p += (length - len);
|
p += (length - len);
|
||||||
return FString(p);
|
return FString(p);
|
||||||
}
|
}
|
||||||
|
@ -856,8 +821,6 @@ FString FString::right (std::size_t len) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::mid (std::size_t pos, std::size_t len) const
|
FString FString::mid (std::size_t pos, std::size_t len) const
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
|
||||||
wchar_t* first;
|
|
||||||
FString s(string);
|
FString s(string);
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
|
@ -873,8 +836,8 @@ FString FString::mid (std::size_t pos, std::size_t len) const
|
||||||
if ( pos > length || pos + len - 1 > length || len == 0 )
|
if ( pos > length || pos + len - 1 > length || len == 0 )
|
||||||
return FString(L"");
|
return FString(L"");
|
||||||
|
|
||||||
p = s.string;
|
wchar_t* p = s.string;
|
||||||
first = p + pos - 1;
|
wchar_t* first = p + pos - 1;
|
||||||
*(first + len) = '\0';
|
*(first + len) = '\0';
|
||||||
return FString(first);
|
return FString(first);
|
||||||
}
|
}
|
||||||
|
@ -882,17 +845,15 @@ FString FString::mid (std::size_t pos, std::size_t len) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FStringList FString::split (const FString& delimiter)
|
FStringList FString::split (const FString& delimiter)
|
||||||
{
|
{
|
||||||
wchar_t* rest;
|
|
||||||
wchar_t* token;
|
|
||||||
FString s(string);
|
FString s(string);
|
||||||
FStringList string_list;
|
FStringList string_list{};
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
if ( ! (string && *string) )
|
if ( ! (string && *string) )
|
||||||
return string_list;
|
return string_list;
|
||||||
|
|
||||||
rest = nullptr;
|
wchar_t* rest{nullptr};
|
||||||
token = extractToken(&rest, s.string, delimiter.wc_str());
|
const wchar_t* token = extractToken(&rest, s.string, delimiter.wc_str());
|
||||||
|
|
||||||
while ( token )
|
while ( token )
|
||||||
{
|
{
|
||||||
|
@ -913,11 +874,9 @@ FString& FString::setString (const FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::setNumber (sInt64 num)
|
FString& FString::setNumber (sInt64 num)
|
||||||
{
|
{
|
||||||
wchar_t* s;
|
bool neg{false};
|
||||||
bool neg;
|
|
||||||
wchar_t buf[30];
|
wchar_t buf[30];
|
||||||
|
wchar_t* s = &buf[29];
|
||||||
s = &buf[29];
|
|
||||||
|
|
||||||
if ( num < 0 )
|
if ( num < 0 )
|
||||||
{
|
{
|
||||||
|
@ -948,10 +907,8 @@ FString& FString::setNumber (sInt64 num)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::setNumber (uInt64 num)
|
FString& FString::setNumber (uInt64 num)
|
||||||
{
|
{
|
||||||
wchar_t* s;
|
|
||||||
wchar_t buf[30];
|
wchar_t buf[30];
|
||||||
|
wchar_t* s = &buf[29];
|
||||||
s = &buf[29];
|
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -968,10 +925,8 @@ FString& FString::setNumber (uInt64 num)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::setNumber (lDouble f_num, int precision)
|
FString& FString::setNumber (lDouble f_num, int precision)
|
||||||
{
|
{
|
||||||
wchar_t* s;
|
|
||||||
wchar_t format[20]; // = "%.<precision>Lg"
|
wchar_t format[20]; // = "%.<precision>Lg"
|
||||||
|
wchar_t* s = &format[0];
|
||||||
s = &format[0];
|
|
||||||
*s++ = L'%';
|
*s++ = L'%';
|
||||||
*s++ = L'.';
|
*s++ = L'.';
|
||||||
|
|
||||||
|
@ -1001,13 +956,10 @@ FString& FString::setNumber (lDouble f_num, int precision)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::setFormatedNumber (sInt64 num, char separator)
|
FString& FString::setFormatedNumber (sInt64 num, char separator)
|
||||||
{
|
{
|
||||||
int n;
|
bool neg{false};
|
||||||
wchar_t* s;
|
int n{0};
|
||||||
bool neg;
|
|
||||||
wchar_t buf[30];
|
wchar_t buf[30];
|
||||||
|
wchar_t* s = &buf[29];
|
||||||
n = 0;
|
|
||||||
s = &buf[29];
|
|
||||||
|
|
||||||
if ( separator == 0 )
|
if ( separator == 0 )
|
||||||
separator = ' ';
|
separator = ' ';
|
||||||
|
@ -1044,12 +996,9 @@ FString& FString::setFormatedNumber (sInt64 num, char separator)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::setFormatedNumber (uInt64 num, char separator)
|
FString& FString::setFormatedNumber (uInt64 num, char separator)
|
||||||
{
|
{
|
||||||
int n;
|
int n{0};
|
||||||
wchar_t* s;
|
|
||||||
wchar_t buf[30];
|
wchar_t buf[30];
|
||||||
|
wchar_t* s = &buf[29];
|
||||||
n = 0;
|
|
||||||
s = &buf[29];
|
|
||||||
*s = L'\0';
|
*s = L'\0';
|
||||||
|
|
||||||
if ( separator == 0 )
|
if ( separator == 0 )
|
||||||
|
@ -1177,8 +1126,6 @@ const FString& FString::insert (const FString& s, std::size_t pos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::replace (const FString& from, const FString& to)
|
FString FString::replace (const FString& from, const FString& to)
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
|
||||||
std::size_t from_length, to_length, pos;
|
|
||||||
FString s(string);
|
FString s(string);
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
|
@ -1191,10 +1138,10 @@ FString FString::replace (const FString& from, const FString& to)
|
||||||
if ( from.isEmpty() )
|
if ( from.isEmpty() )
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
p = s.string;
|
const wchar_t* p = s.string;
|
||||||
from_length = from.getLength();
|
std::size_t from_length = from.getLength();
|
||||||
to_length = to.getLength();
|
std::size_t to_length = to.getLength();
|
||||||
pos = 0;
|
std::size_t pos{0};
|
||||||
|
|
||||||
while ( *p )
|
while ( *p )
|
||||||
{
|
{
|
||||||
|
@ -1218,10 +1165,8 @@ FString FString::replace (const FString& from, const FString& to)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::replaceControlCodes() const
|
FString FString::replaceControlCodes() const
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
|
||||||
FString s(string);
|
FString s(string);
|
||||||
|
wchar_t* p = s.string;
|
||||||
p = s.string;
|
|
||||||
|
|
||||||
if ( p )
|
if ( p )
|
||||||
{
|
{
|
||||||
|
@ -1252,18 +1197,16 @@ FString FString::replaceControlCodes() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::expandTabs (int tabstop) const
|
FString FString::expandTabs (int tabstop) const
|
||||||
{
|
{
|
||||||
uLong last;
|
|
||||||
FStringList tab_split;
|
|
||||||
FString instr(string);
|
FString instr(string);
|
||||||
FString outstr;
|
FString outstr{};
|
||||||
|
|
||||||
if ( tabstop <= 0 )
|
if ( tabstop <= 0 )
|
||||||
return instr;
|
return instr;
|
||||||
|
|
||||||
tab_split = instr.split("\t");
|
FStringList tab_split = instr.split("\t");
|
||||||
last = tab_split.size();
|
uLong last = tab_split.size();
|
||||||
|
|
||||||
for (std::size_t i = 0; i < last; i++)
|
for (std::size_t i{0}; i < last; i++)
|
||||||
{
|
{
|
||||||
std::size_t len = tab_split[i].getLength();
|
std::size_t len = tab_split[i].getLength();
|
||||||
std::size_t tab_len = std::size_t(tabstop);
|
std::size_t tab_len = std::size_t(tabstop);
|
||||||
|
@ -1280,14 +1223,13 @@ FString FString::expandTabs (int tabstop) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::removeDel() const
|
FString FString::removeDel() const
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
|
||||||
FString s(string);
|
FString s(string);
|
||||||
p = s.string;
|
const wchar_t* p = s.string;
|
||||||
|
|
||||||
if ( p )
|
if ( p )
|
||||||
{
|
{
|
||||||
uInt i = 0;
|
uInt i{0};
|
||||||
uInt d = 0;
|
uInt d{0};
|
||||||
|
|
||||||
while ( *p )
|
while ( *p )
|
||||||
{
|
{
|
||||||
|
@ -1319,9 +1261,8 @@ FString FString::removeDel() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::removeBackspaces() const
|
FString FString::removeBackspaces() const
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
|
||||||
FString s(string);
|
FString s(string);
|
||||||
p = s.string;
|
const wchar_t* p = s.string;
|
||||||
|
|
||||||
if ( p )
|
if ( p )
|
||||||
{
|
{
|
||||||
|
@ -1502,7 +1443,7 @@ inline void FString::_insert ( std::size_t pos
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::size_t x;
|
std::size_t x{};
|
||||||
|
|
||||||
if ( length + len <= capacity() )
|
if ( length + len <= capacity() )
|
||||||
{
|
{
|
||||||
|
@ -1517,9 +1458,9 @@ inline void FString::_insert ( std::size_t pos
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wchar_t* sptr;
|
|
||||||
// output string > bufsize
|
// output string > bufsize
|
||||||
bufsize = FWDBUFFER + length + len + 1;
|
bufsize = FWDBUFFER + length + len + 1;
|
||||||
|
wchar_t* sptr{};
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1531,7 +1472,7 @@ inline void FString::_insert ( std::size_t pos
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t y = 0;
|
std::size_t y{0};
|
||||||
|
|
||||||
for (x = 0; x < pos; x++) // left side
|
for (x = 0; x < pos; x++) // left side
|
||||||
sptr[y++] = string[x];
|
sptr[y++] = string[x];
|
||||||
|
@ -1562,8 +1503,8 @@ inline void FString::_remove (std::size_t pos, std::size_t len)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wchar_t* sptr;
|
|
||||||
bufsize = length + 1 - len + FWDBUFFER;
|
bufsize = length + 1 - len + FWDBUFFER;
|
||||||
|
wchar_t* sptr{};
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1575,7 +1516,7 @@ inline void FString::_remove (std::size_t pos, std::size_t len)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t x, y = 0;
|
std::size_t x{}, y{};
|
||||||
|
|
||||||
for (x = 0; x < pos; x++) // left side
|
for (x = 0; x < pos; x++) // left side
|
||||||
sptr[y++] = string[x];
|
sptr[y++] = string[x];
|
||||||
|
@ -1592,11 +1533,6 @@ inline void FString::_remove (std::size_t pos, std::size_t len)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline char* FString::wc_to_c_str (const wchar_t s[]) const
|
inline char* FString::wc_to_c_str (const wchar_t s[]) const
|
||||||
{
|
{
|
||||||
int mblength
|
|
||||||
, size
|
|
||||||
, dest_size;
|
|
||||||
const wchar_t* src;
|
|
||||||
|
|
||||||
if ( ! s ) // handle NULL string
|
if ( ! s ) // handle NULL string
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1619,9 +1555,9 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const
|
||||||
if ( c_string )
|
if ( c_string )
|
||||||
delete[](c_string);
|
delete[](c_string);
|
||||||
|
|
||||||
size = int(std::wcslen(s)) + 1;
|
int size = int(std::wcslen(s)) + 1;
|
||||||
dest_size = size * int(CHAR_SIZE);
|
int dest_size = size * int(CHAR_SIZE);
|
||||||
src = s;
|
const wchar_t* src = s;
|
||||||
std::mbstate_t state;
|
std::mbstate_t state;
|
||||||
std::memset (&state, '\0', sizeof(mbstate_t));
|
std::memset (&state, '\0', sizeof(mbstate_t));
|
||||||
|
|
||||||
|
@ -1638,7 +1574,8 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mblength = int(std::wcsrtombs (c_string, &src, std::size_t(dest_size), &state));
|
int mblength = \
|
||||||
|
int(std::wcsrtombs (c_string, &src, std::size_t(dest_size), &state));
|
||||||
|
|
||||||
if ( mblength == -1 && errno != EILSEQ )
|
if ( mblength == -1 && errno != EILSEQ )
|
||||||
{
|
{
|
||||||
|
@ -1653,12 +1590,6 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline wchar_t* FString::c_to_wc_str (const char s[]) const
|
inline wchar_t* FString::c_to_wc_str (const char s[]) const
|
||||||
{
|
{
|
||||||
int wclength
|
|
||||||
, size
|
|
||||||
, dest_size;
|
|
||||||
const char* src;
|
|
||||||
wchar_t* dest;
|
|
||||||
|
|
||||||
if ( ! s ) // handle NULL string
|
if ( ! s ) // handle NULL string
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1676,9 +1607,10 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size = int(std::strlen(s)) + 1;
|
int size = int(std::strlen(s)) + 1;
|
||||||
dest_size = size * int(CHAR_SIZE);
|
int dest_size = size * int(CHAR_SIZE);
|
||||||
src = s;
|
const char* src = s;
|
||||||
|
wchar_t* dest{};
|
||||||
std::mbstate_t state;
|
std::mbstate_t state;
|
||||||
std::memset (&state, '\0', sizeof(mbstate_t));
|
std::memset (&state, '\0', sizeof(mbstate_t));
|
||||||
|
|
||||||
|
@ -1694,7 +1626,8 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wclength = int(std::mbsrtowcs (dest, &src, std::size_t(dest_size), &state));
|
int wclength = \
|
||||||
|
int(std::mbsrtowcs (dest, &src, std::size_t(dest_size), &state));
|
||||||
|
|
||||||
if ( wclength == -1 )
|
if ( wclength == -1 )
|
||||||
{
|
{
|
||||||
|
@ -1724,8 +1657,7 @@ inline wchar_t* FString::extractToken ( wchar_t* rest[]
|
||||||
, const wchar_t s[]
|
, const wchar_t s[]
|
||||||
, const wchar_t delim[] )
|
, const wchar_t delim[] )
|
||||||
{
|
{
|
||||||
wchar_t* token;
|
wchar_t* token = ( s ) ? const_cast<wchar_t*>(s) : *rest;
|
||||||
token = ( s ) ? const_cast<wchar_t*>(s) : *rest;
|
|
||||||
|
|
||||||
if ( ! token )
|
if ( ! token )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1841,11 +1773,9 @@ std::ostream& operator << (std::ostream& outstr, const FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
std::istream& operator >> (std::istream& instr, FString& s)
|
std::istream& operator >> (std::istream& instr, FString& s)
|
||||||
{
|
{
|
||||||
const wchar_t* wc_str;
|
char buf[FString::INPBUFFER + 1]{};
|
||||||
char buf[FString::INPBUFFER + 1];
|
|
||||||
|
|
||||||
instr.getline (buf, FString::INPBUFFER);
|
instr.getline (buf, FString::INPBUFFER);
|
||||||
wc_str = s.c_to_wc_str(buf);
|
const wchar_t* wc_str = s.c_to_wc_str(buf);
|
||||||
|
|
||||||
if ( wc_str )
|
if ( wc_str )
|
||||||
{
|
{
|
||||||
|
@ -1868,7 +1798,7 @@ std::wostream& operator << (std::wostream& outstr, const FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
std::wistream& operator >> (std::wistream& instr, FString& s)
|
std::wistream& operator >> (std::wistream& instr, FString& s)
|
||||||
{
|
{
|
||||||
wchar_t buf[FString::INPBUFFER + 1];
|
wchar_t buf[FString::INPBUFFER + 1]{};
|
||||||
instr.getline (buf, FString::INPBUFFER);
|
instr.getline (buf, FString::INPBUFFER);
|
||||||
s._assign (buf);
|
s._assign (buf);
|
||||||
return instr;
|
return instr;
|
||||||
|
|
|
@ -141,8 +141,8 @@ void FSwitch::drawCheckButton()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FSwitch::drawChecked()
|
inline void FSwitch::drawChecked()
|
||||||
{
|
{
|
||||||
wchar_t on[6] = L" On ";
|
wchar_t on[6]{L" On "};
|
||||||
wchar_t off[6] = L" Off ";
|
wchar_t off[6]{L" Off "};
|
||||||
|
|
||||||
if ( hasFocus() && ! button_pressed )
|
if ( hasFocus() && ! button_pressed )
|
||||||
{
|
{
|
||||||
|
@ -190,8 +190,8 @@ inline void FSwitch::drawChecked()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FSwitch::drawUnchecked()
|
inline void FSwitch::drawUnchecked()
|
||||||
{
|
{
|
||||||
wchar_t on[6] = L" On ";
|
wchar_t on[6]{L" On "};
|
||||||
wchar_t off[6] = L" Off ";
|
wchar_t off[6]{L" Off "};
|
||||||
|
|
||||||
setColor (wc.button_inactive_fg, wc.button_inactive_bg);
|
setColor (wc.button_inactive_fg, wc.button_inactive_bg);
|
||||||
|
|
||||||
|
|
|
@ -61,39 +61,39 @@ namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
// global FTerm object
|
// global FTerm object
|
||||||
static FTerm* init_term_object = nullptr;
|
static FTerm* init_term_object{nullptr};
|
||||||
|
|
||||||
// global init state
|
// global init state
|
||||||
static bool term_initialized = false;
|
static bool term_initialized{false};
|
||||||
|
|
||||||
// function pointer
|
// function pointer
|
||||||
int (*FTerm::Fputchar)(int);
|
int (*FTerm::Fputchar)(int);
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
FTerm::initializationValues FTerm::init_values;
|
FTerm::initializationValues FTerm::init_values{};
|
||||||
FTermData* FTerm::data = nullptr;
|
FTermData* FTerm::data {nullptr};
|
||||||
FSystem* FTerm::fsys = nullptr;
|
FSystem* FTerm::fsys {nullptr};
|
||||||
FOptiMove* FTerm::opti_move = nullptr;
|
FOptiMove* FTerm::opti_move {nullptr};
|
||||||
FOptiAttr* FTerm::opti_attr = nullptr;
|
FOptiAttr* FTerm::opti_attr {nullptr};
|
||||||
FTermDetection* FTerm::term_detection = nullptr;
|
FTermDetection* FTerm::term_detection{nullptr};
|
||||||
FTermXTerminal* FTerm::xterm = nullptr;
|
FTermXTerminal* FTerm::xterm {nullptr};
|
||||||
FKeyboard* FTerm::keyboard = nullptr;
|
FKeyboard* FTerm::keyboard {nullptr};
|
||||||
FMouseControl* FTerm::mouse = nullptr;
|
FMouseControl* FTerm::mouse {nullptr};
|
||||||
|
|
||||||
#if defined(UNIT_TEST)
|
#if defined(UNIT_TEST)
|
||||||
FTermLinux* FTerm::linux = nullptr;
|
FTermLinux* FTerm::linux {nullptr};
|
||||||
FTermFreeBSD* FTerm::freebsd = nullptr;
|
FTermFreeBSD* FTerm::freebsd {nullptr};
|
||||||
FTermOpenBSD* FTerm::openbsd = nullptr;
|
FTermOpenBSD* FTerm::openbsd {nullptr};
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
FTermLinux* FTerm::linux = nullptr;
|
FTermLinux* FTerm::linux {nullptr};
|
||||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
FTermFreeBSD* FTerm::freebsd = nullptr;
|
FTermFreeBSD* FTerm::freebsd {nullptr};
|
||||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
FTermOpenBSD* FTerm::openbsd = nullptr;
|
FTermOpenBSD* FTerm::openbsd {nullptr};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
FTermDebugData* FTerm::debug_data = nullptr;
|
FTermDebugData* FTerm::debug_data {nullptr};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// function prototypes
|
// function prototypes
|
||||||
|
@ -743,12 +743,11 @@ bool FTerm::setNewFont()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FTerm::setOldFont()
|
bool FTerm::setOldFont()
|
||||||
{
|
{
|
||||||
bool retval = false;
|
bool retval{false};
|
||||||
|
|
||||||
if ( ! (data->isNewFont() || data->isVGAFont()) )
|
if ( ! (data->isNewFont() || data->isVGAFont()) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
retval = false;
|
|
||||||
data->setNewFont(false);
|
data->setNewFont(false);
|
||||||
data->setVGAFont(false);
|
data->setVGAFont(false);
|
||||||
|
|
||||||
|
@ -812,7 +811,7 @@ int FTerm::openConsole()
|
||||||
if ( ! *termfilename || ! fsys )
|
if ( ! *termfilename || ! fsys )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (std::size_t i = 0; terminal_devices[i] != 0; i++)
|
for (std::size_t i{0}; terminal_devices[i] != 0; i++)
|
||||||
{
|
{
|
||||||
fd = fsys->open(terminal_devices[i], O_RDWR, 0);
|
fd = fsys->open(terminal_devices[i], O_RDWR, 0);
|
||||||
data->setTTYFileDescriptor(fd);
|
data->setTTYFileDescriptor(fd);
|
||||||
|
@ -831,7 +830,7 @@ int FTerm::closeConsole()
|
||||||
data = FTerm::getFTermData();
|
data = FTerm::getFTermData();
|
||||||
|
|
||||||
int fd = data->getTTYFileDescriptor();
|
int fd = data->getTTYFileDescriptor();
|
||||||
int ret = -1;
|
int ret{-1};
|
||||||
|
|
||||||
if ( fd < 0 ) // console is already closed
|
if ( fd < 0 ) // console is already closed
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -863,7 +862,7 @@ char* FTerm::cursorsVisibilityString (bool enable)
|
||||||
{
|
{
|
||||||
// Hides or shows the input cursor on the terminal
|
// Hides or shows the input cursor on the terminal
|
||||||
|
|
||||||
char* visibility_str = nullptr;
|
char* visibility_str{nullptr};
|
||||||
|
|
||||||
if ( data->isCursorHidden() == enable )
|
if ( data->isCursorHidden() == enable )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -894,9 +893,9 @@ void FTerm::detectTermSize()
|
||||||
if ( ! data )
|
if ( ! data )
|
||||||
data = FTerm::getFTermData();
|
data = FTerm::getFTermData();
|
||||||
|
|
||||||
struct winsize win_size;
|
struct winsize win_size{};
|
||||||
auto& term_geometry = data->getTermGeometry();
|
auto& term_geometry = data->getTermGeometry();
|
||||||
int ret;
|
int ret{};
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -1110,7 +1109,7 @@ void FTerm::setEncoding (fc::encoding enc)
|
||||||
{
|
{
|
||||||
if ( enc == fc::VT100 || enc == fc::PC )
|
if ( enc == fc::VT100 || enc == fc::PC )
|
||||||
{
|
{
|
||||||
char* empty = nullptr;
|
char* empty{nullptr};
|
||||||
opti_move->set_tabular (empty);
|
opti_move->set_tabular (empty);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1156,7 +1155,7 @@ wchar_t FTerm::charEncode (wchar_t c, fc::encoding enc)
|
||||||
{
|
{
|
||||||
wchar_t ch_enc = c;
|
wchar_t ch_enc = c;
|
||||||
|
|
||||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++)
|
for (std::size_t i{0}; i <= fc::lastCharItem; i++)
|
||||||
{
|
{
|
||||||
if ( fc::character[i][fc::UTF8] == uInt(c) )
|
if ( fc::character[i][fc::UTF8] == uInt(c) )
|
||||||
{
|
{
|
||||||
|
@ -1178,7 +1177,7 @@ wchar_t FTerm::cp437_to_unicode (uChar c)
|
||||||
constexpr std::size_t UNICODE = 1;
|
constexpr std::size_t UNICODE = 1;
|
||||||
wchar_t ucs = wchar_t(c);
|
wchar_t ucs = wchar_t(c);
|
||||||
|
|
||||||
for (std::size_t i = 0; i <= fc::lastCP437Item; i++)
|
for (std::size_t i{0}; i <= fc::lastCP437Item; i++)
|
||||||
{
|
{
|
||||||
if ( fc::cp437_to_ucs[i][CP437] == c ) // found
|
if ( fc::cp437_to_ucs[i][CP437] == c ) // found
|
||||||
{
|
{
|
||||||
|
@ -1197,7 +1196,7 @@ uChar FTerm::unicode_to_cp437 (wchar_t ucs)
|
||||||
constexpr std::size_t UNICODE = 1;
|
constexpr std::size_t UNICODE = 1;
|
||||||
uChar c = '?';
|
uChar c = '?';
|
||||||
|
|
||||||
for (std::size_t i = 0; i <= fc::lastCP437Item; i++)
|
for (std::size_t i{0}; i <= fc::lastCP437Item; i++)
|
||||||
{
|
{
|
||||||
if ( fc::cp437_to_ucs[i][UNICODE] == ucs ) // found
|
if ( fc::cp437_to_ucs[i][UNICODE] == ucs ) // found
|
||||||
{
|
{
|
||||||
|
@ -1239,11 +1238,10 @@ bool FTerm::scrollTermReverse()
|
||||||
void FTerm::putstringf (const char format[], ...)
|
void FTerm::putstringf (const char format[], ...)
|
||||||
{
|
{
|
||||||
assert ( format != 0 );
|
assert ( format != 0 );
|
||||||
char buf[512];
|
char buf[512]{};
|
||||||
char* str;
|
va_list args{};
|
||||||
va_list args;
|
|
||||||
|
|
||||||
str = buf;
|
char* str = buf;
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
vsnprintf (str, sizeof(buf), format, args);
|
vsnprintf (str, sizeof(buf), format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
@ -1379,7 +1377,7 @@ void FTerm::init_global_values (bool disable_alt_screen)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTerm::init_terminal_device_path()
|
void FTerm::init_terminal_device_path()
|
||||||
{
|
{
|
||||||
char termfilename[256] = { };
|
char termfilename[256]{};
|
||||||
int stdout_no = FTermios::getStdOut();
|
int stdout_no = FTermios::getStdOut();
|
||||||
|
|
||||||
if ( ttyname_r(stdout_no, termfilename, sizeof(termfilename)) )
|
if ( ttyname_r(stdout_no, termfilename, sizeof(termfilename)) )
|
||||||
|
@ -1422,7 +1420,7 @@ void FTerm::init_alt_charset()
|
||||||
|
|
||||||
if ( TCAP(fc::t_acs_chars) )
|
if ( TCAP(fc::t_acs_chars) )
|
||||||
{
|
{
|
||||||
for (std::size_t n = 0; TCAP(fc::t_acs_chars)[n]; n += 2)
|
for (std::size_t n{0}; TCAP(fc::t_acs_chars)[n]; n += 2)
|
||||||
{
|
{
|
||||||
// insert the VT100 key/value pairs into a map
|
// insert the VT100 key/value pairs into a map
|
||||||
uChar p1 = uChar(TCAP(fc::t_acs_chars)[n]);
|
uChar p1 = uChar(TCAP(fc::t_acs_chars)[n]);
|
||||||
|
@ -1438,7 +1436,7 @@ void FTerm::init_alt_charset()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update array 'character' with discovered VT100 pairs
|
// Update array 'character' with discovered VT100 pairs
|
||||||
for (std::size_t n = 0; n <= fc::lastKeyItem; n++ )
|
for (std::size_t n{0}; n <= fc::lastKeyItem; n++ )
|
||||||
{
|
{
|
||||||
uChar keyChar = uChar(fc::vt100_key_to_utf8[n][vt100_key]);
|
uChar keyChar = uChar(fc::vt100_key_to_utf8[n][vt100_key]);
|
||||||
uChar altChar = uChar(vt100_alt_char[keyChar]);
|
uChar altChar = uChar(vt100_alt_char[keyChar]);
|
||||||
|
@ -1463,7 +1461,7 @@ void FTerm::init_alt_charset()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTerm::init_pc_charset()
|
void FTerm::init_pc_charset()
|
||||||
{
|
{
|
||||||
bool reinit = false;
|
bool reinit{false};
|
||||||
|
|
||||||
// rxvt does not support pc charset
|
// rxvt does not support pc charset
|
||||||
if ( isRxvtTerminal() || isUrxvtTerminal() )
|
if ( isRxvtTerminal() || isUrxvtTerminal() )
|
||||||
|
@ -1527,7 +1525,7 @@ void FTerm::init_cygwin_charmap()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// PC encoding changes
|
// PC encoding changes
|
||||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++ )
|
for (std::size_t i{0}; i <= fc::lastCharItem; i++ )
|
||||||
{
|
{
|
||||||
if ( fc::character[i][fc::UTF8] == fc::BlackUpPointingTriangle ) // ▲
|
if ( fc::character[i][fc::UTF8] == fc::BlackUpPointingTriangle ) // ▲
|
||||||
fc::character[i][fc::PC] = 0x18;
|
fc::character[i][fc::PC] = 0x18;
|
||||||
|
@ -1581,7 +1579,7 @@ void FTerm::init_teraterm_charmap()
|
||||||
if ( ! isTeraTerm() )
|
if ( ! isTeraTerm() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++ )
|
for (std::size_t i{0}; i <= fc::lastCharItem; i++ )
|
||||||
if ( fc::character[i][fc::PC] < 0x20 )
|
if ( fc::character[i][fc::PC] < 0x20 )
|
||||||
fc::character[i][fc::PC] = fc::character[i][fc::ASCII];
|
fc::character[i][fc::PC] = fc::character[i][fc::ASCII];
|
||||||
}
|
}
|
||||||
|
@ -1709,14 +1707,12 @@ void FTerm::init_locale()
|
||||||
{
|
{
|
||||||
// Init current locale
|
// Init current locale
|
||||||
|
|
||||||
char* locale_name;
|
|
||||||
char* locale_xterm;
|
|
||||||
const char* termtype = data->getTermType();
|
const char* termtype = data->getTermType();
|
||||||
locale_name = std::setlocale (LC_ALL, "");
|
const char* locale_name = std::setlocale (LC_ALL, "");
|
||||||
std::setlocale (LC_NUMERIC, "");
|
std::setlocale (LC_NUMERIC, "");
|
||||||
|
|
||||||
// Get XTERM_LOCALE
|
// Get XTERM_LOCALE
|
||||||
locale_xterm = std::getenv("XTERM_LOCALE");
|
const char* locale_xterm = std::getenv("XTERM_LOCALE");
|
||||||
|
|
||||||
// set LC_ALL to XTERM_LOCALE
|
// set LC_ALL to XTERM_LOCALE
|
||||||
if ( locale_xterm )
|
if ( locale_xterm )
|
||||||
|
@ -1761,7 +1757,7 @@ void FTerm::init_encoding()
|
||||||
{
|
{
|
||||||
// detect encoding and set the Fputchar function pointer
|
// detect encoding and set the Fputchar function pointer
|
||||||
|
|
||||||
bool force_vt100 = false; // VT100 line drawing (G1 character set)
|
bool force_vt100{false}; // VT100 line drawing (G1 character set)
|
||||||
init_encoding_set();
|
init_encoding_set();
|
||||||
|
|
||||||
if ( isRxvtTerminal() && ! isUrxvtTerminal() )
|
if ( isRxvtTerminal() && ! isUrxvtTerminal() )
|
||||||
|
@ -1885,7 +1881,7 @@ void FTerm::init_tab_quirks()
|
||||||
|
|
||||||
if ( enc == fc::VT100 || enc == fc::PC )
|
if ( enc == fc::VT100 || enc == fc::PC )
|
||||||
{
|
{
|
||||||
char* empty = nullptr;
|
char* empty{nullptr};
|
||||||
opti_move->set_tabular (empty);
|
opti_move->set_tabular (empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1991,7 +1987,7 @@ char* FTerm::enableCursorString()
|
||||||
// Returns the cursor enable string
|
// Returns the cursor enable string
|
||||||
|
|
||||||
static constexpr std::size_t SIZE = 32;
|
static constexpr std::size_t SIZE = 32;
|
||||||
static char enable_str[SIZE] = { };
|
static char enable_str[SIZE]{};
|
||||||
const auto& vs = TCAP(fc::t_cursor_visible);
|
const auto& vs = TCAP(fc::t_cursor_visible);
|
||||||
const auto& ve = TCAP(fc::t_cursor_normal);
|
const auto& ve = TCAP(fc::t_cursor_normal);
|
||||||
|
|
||||||
|
@ -2043,8 +2039,8 @@ void FTerm::enableMouse()
|
||||||
if ( ! init_values.mouse_support )
|
if ( ! init_values.mouse_support )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool gpm_mouse = false;
|
bool gpm_mouse{false};
|
||||||
bool xterm_mouse = false;
|
bool xterm_mouse{false};
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
if ( isLinuxTerm() && openConsole() == 0 )
|
if ( isLinuxTerm() && openConsole() == 0 )
|
||||||
|
|
|
@ -44,8 +44,8 @@ FTermBuffer::~FTermBuffer() // destructor
|
||||||
int FTermBuffer::writef (const FString format, ...)
|
int FTermBuffer::writef (const FString format, ...)
|
||||||
{
|
{
|
||||||
static constexpr int BUFSIZE = 4096;
|
static constexpr int BUFSIZE = 4096;
|
||||||
wchar_t buffer[BUFSIZE];
|
wchar_t buffer[BUFSIZE]{};
|
||||||
va_list args;
|
va_list args{};
|
||||||
|
|
||||||
if ( format.isEmpty() )
|
if ( format.isEmpty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -62,7 +62,7 @@ int FTermBuffer::writef (const FString format, ...)
|
||||||
int FTermBuffer::write (const FString& s)
|
int FTermBuffer::write (const FString& s)
|
||||||
{
|
{
|
||||||
assert ( ! s.isNull() );
|
assert ( ! s.isNull() );
|
||||||
int len = 0;
|
int len{0};
|
||||||
const wchar_t* p = s.wc_str();
|
const wchar_t* p = s.wc_str();
|
||||||
|
|
||||||
if ( p )
|
if ( p )
|
||||||
|
@ -88,8 +88,7 @@ int FTermBuffer::write (const FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FTermBuffer::write (wchar_t c)
|
int FTermBuffer::write (wchar_t c)
|
||||||
{
|
{
|
||||||
charData nc; // next character
|
charData nc = FVTerm::getAttribute(); // next character
|
||||||
nc = FVTerm::getAttribute();
|
|
||||||
nc.code = c;
|
nc.code = c;
|
||||||
nc.attr.bit.no_changes = false;
|
nc.attr.bit.no_changes = false;
|
||||||
nc.attr.bit.printed = false;
|
nc.attr.bit.printed = false;
|
||||||
|
|
|
@ -36,19 +36,19 @@ namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
bool FTermcap::background_color_erase = false;
|
bool FTermcap::background_color_erase {false};
|
||||||
bool FTermcap::can_change_color_palette = false;
|
bool FTermcap::can_change_color_palette{false};
|
||||||
bool FTermcap::automatic_left_margin = false;
|
bool FTermcap::automatic_left_margin {false};
|
||||||
bool FTermcap::automatic_right_margin = false;
|
bool FTermcap::automatic_right_margin {false};
|
||||||
bool FTermcap::eat_nl_glitch = false;
|
bool FTermcap::eat_nl_glitch {false};
|
||||||
bool FTermcap::ansi_default_color = false;
|
bool FTermcap::ansi_default_color {false};
|
||||||
bool FTermcap::osc_support = false;
|
bool FTermcap::osc_support {false};
|
||||||
bool FTermcap::no_utf8_acs_chars = false;
|
bool FTermcap::no_utf8_acs_chars {false};
|
||||||
int FTermcap::max_color = 1;
|
int FTermcap::max_color {1};
|
||||||
int FTermcap::tabstop = 8;
|
int FTermcap::tabstop {8};
|
||||||
int FTermcap::attr_without_color = 0;
|
int FTermcap::attr_without_color {0};
|
||||||
FTermData* FTermcap::fterm_data = nullptr;
|
FTermData* FTermcap::fterm_data {nullptr};
|
||||||
FTermDetection* FTermcap::term_detection = nullptr;
|
FTermDetection* FTermcap::term_detection {nullptr};
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -77,11 +77,11 @@ void FTermcap::init()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermcap::termcap()
|
void FTermcap::termcap()
|
||||||
{
|
{
|
||||||
std::vector<std::string> terminals;
|
std::vector<std::string> terminals{};
|
||||||
static constexpr int success = 1;
|
static constexpr int success = 1;
|
||||||
static constexpr int uninitialized = -2;
|
static constexpr int uninitialized = -2;
|
||||||
static char term_buffer[2048];
|
static char term_buffer[2048]{};
|
||||||
static char string_buf[2048];
|
static char string_buf[2048]{};
|
||||||
char* buffer = string_buf;
|
char* buffer = string_buf;
|
||||||
int status = uninitialized;
|
int status = uninitialized;
|
||||||
bool color256 = term_detection->canDisplay256Colors();
|
bool color256 = term_detection->canDisplay256Colors();
|
||||||
|
@ -221,7 +221,7 @@ void FTermcap::termcapStrings (char*& buffer)
|
||||||
// Get termcap strings
|
// Get termcap strings
|
||||||
|
|
||||||
// Read termcap output strings
|
// Read termcap output strings
|
||||||
for (std::size_t i = 0; strings[i].tname[0] != 0; i++)
|
for (std::size_t i{0}; strings[i].tname[0] != 0; i++)
|
||||||
strings[i].string = tgetstr(strings[i].tname, &buffer);
|
strings[i].string = tgetstr(strings[i].tname, &buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ void FTermcap::termcapKeys (char*& buffer)
|
||||||
{
|
{
|
||||||
// Read termcap key strings
|
// Read termcap key strings
|
||||||
|
|
||||||
for (std::size_t i = 0; fc::Fkey[i].tname[0] != 0; i++)
|
for (std::size_t i{0}; fc::Fkey[i].tname[0] != 0; i++)
|
||||||
{
|
{
|
||||||
fc::Fkey[i].string = tgetstr(fc::Fkey[i].tname, &buffer);
|
fc::Fkey[i].string = tgetstr(fc::Fkey[i].tname, &buffer);
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ void FTermcap::termcapKeysVt100 (char*& buffer)
|
||||||
|| ( TCAP(fc::t_cursor_up)
|
|| ( TCAP(fc::t_cursor_up)
|
||||||
&& (std::strcmp(TCAP(fc::t_cursor_up), CSI "A") == 0) ) )
|
&& (std::strcmp(TCAP(fc::t_cursor_up), CSI "A") == 0) ) )
|
||||||
{
|
{
|
||||||
for (std::size_t i = 0; fc::Fkey[i].tname[0] != 0; i++)
|
for (std::size_t i{0}; fc::Fkey[i].tname[0] != 0; i++)
|
||||||
{
|
{
|
||||||
if ( std::strncmp(fc::Fkey[i].tname, "kux", 3) == 0 )
|
if ( std::strncmp(fc::Fkey[i].tname, "kux", 3) == 0 )
|
||||||
fc::Fkey[i].string = C_STR(CSI "A"); // Key up
|
fc::Fkey[i].string = C_STR(CSI "A"); // Key up
|
||||||
|
|
|
@ -34,8 +34,8 @@ namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
FTermData* FTermcapQuirks::fterm_data = nullptr;
|
FTermData* FTermcapQuirks::fterm_data {nullptr};
|
||||||
FTermDetection* FTermcapQuirks::term_detection = nullptr;
|
FTermDetection* FTermcapQuirks::term_detection {nullptr};
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -402,7 +402,7 @@ void FTermcapQuirks::sunConsole()
|
||||||
C_STR(CSI "%p1%dD");
|
C_STR(CSI "%p1%dD");
|
||||||
|
|
||||||
// Sun Microsystems workstation console keys
|
// Sun Microsystems workstation console keys
|
||||||
for (std::size_t i = 0; fc::Fkey[i].tname[0] != 0; i++)
|
for (std::size_t i{0}; fc::Fkey[i].tname[0] != 0; i++)
|
||||||
{
|
{
|
||||||
if ( std::strncmp(fc::Fkey[i].tname, "K2", 2) == 0 )
|
if ( std::strncmp(fc::Fkey[i].tname, "K2", 2) == 0 )
|
||||||
fc::Fkey[i].string = C_STR(CSI "218z"); // center of keypad
|
fc::Fkey[i].string = C_STR(CSI "218z"); // center of keypad
|
||||||
|
|
|
@ -31,8 +31,8 @@ namespace finalcut
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// static class attributes
|
// static class attributes
|
||||||
FTermData* FTermDebugData::data = nullptr;
|
FTermData* FTermDebugData::data {nullptr};
|
||||||
FTermDetection* FTermDebugData::term_detection = nullptr;
|
FTermDetection* FTermDebugData::term_detection {nullptr};
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FClassName
|
// class FClassName
|
||||||
|
|
|
@ -46,25 +46,24 @@ namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
FTermDetection::terminalType FTermDetection::terminal_type = \
|
FTermDetection::terminalType FTermDetection::terminal_type{};
|
||||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
FTermDetection::colorEnv FTermDetection::color_env{};
|
||||||
FTermDetection::colorEnv FTermDetection::color_env;
|
FTermDetection::secondaryDA FTermDetection::secondary_da{};
|
||||||
FTermDetection::secondaryDA FTermDetection::secondary_da;
|
FTermData* FTermDetection::fterm_data{nullptr};
|
||||||
FTermData* FTermDetection::fterm_data = nullptr;
|
FSystem* FTermDetection::fsystem{nullptr};
|
||||||
FSystem* FTermDetection::fsystem = nullptr;
|
char FTermDetection::termtype[256]{};
|
||||||
char FTermDetection::termtype[256] = { };
|
char FTermDetection::ttytypename[256]{};
|
||||||
char FTermDetection::ttytypename[256] = { };
|
bool FTermDetection::decscusr_support{};
|
||||||
bool FTermDetection::decscusr_support;
|
bool FTermDetection::terminal_detection{};
|
||||||
bool FTermDetection::terminal_detection;
|
bool FTermDetection::color256{};
|
||||||
bool FTermDetection::color256;
|
const FString* FTermDetection::answer_back{nullptr};
|
||||||
const FString* FTermDetection::answer_back = nullptr;
|
const FString* FTermDetection::sec_da{nullptr};
|
||||||
const FString* FTermDetection::sec_da = nullptr;
|
int FTermDetection::gnome_terminal_id{};
|
||||||
int FTermDetection::gnome_terminal_id;
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
char FTermDetection::termtype_256color[256] = { };
|
char FTermDetection::termtype_256color[256]{};
|
||||||
char FTermDetection::termtype_Answerback[256] = { };
|
char FTermDetection::termtype_Answerback[256]{};
|
||||||
char FTermDetection::termtype_SecDA[256] = { };
|
char FTermDetection::termtype_SecDA[256]{};
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,10 +86,6 @@ FTermDetection::FTermDetection()
|
||||||
// a.b.c = a * 100 + b * 100 + c
|
// a.b.c = a * 100 + b * 100 + c
|
||||||
gnome_terminal_id = 0;
|
gnome_terminal_id = 0;
|
||||||
|
|
||||||
// Initialize the structs
|
|
||||||
color_env.setDefault();
|
|
||||||
secondary_da.setDefault();
|
|
||||||
|
|
||||||
// Set default ttytype file
|
// Set default ttytype file
|
||||||
std::strncpy (ttytypename, C_STR("/etc/ttytype"), sizeof(ttytypename));
|
std::strncpy (ttytypename, C_STR("/etc/ttytype"), sizeof(ttytypename));
|
||||||
ttytypename[sizeof(ttytypename) - 1] = '\0';
|
ttytypename[sizeof(ttytypename) - 1] = '\0';
|
||||||
|
@ -208,20 +203,17 @@ bool FTermDetection::getTTYtype()
|
||||||
else
|
else
|
||||||
term_basename++;
|
term_basename++;
|
||||||
|
|
||||||
std::FILE *fp;
|
std::FILE* fp{};
|
||||||
|
char str[BUFSIZ]{};
|
||||||
|
|
||||||
if ( fsystem && (fp = fsystem->fopen(ttytypename, "r")) != 0 )
|
if ( fsystem && (fp = fsystem->fopen(ttytypename, "r")) != 0 )
|
||||||
{
|
{
|
||||||
char* p;
|
|
||||||
char str[BUFSIZ];
|
|
||||||
|
|
||||||
// Read and parse the file
|
// Read and parse the file
|
||||||
while ( fgets(str, sizeof(str) - 1, fp) != 0 )
|
while ( fgets(str, sizeof(str) - 1, fp) != 0 )
|
||||||
{
|
{
|
||||||
char* name;
|
const char* type{nullptr}; // nullptr == not found
|
||||||
char* type;
|
const char* name{nullptr};
|
||||||
type = name = nullptr; // nullptr == not found
|
char* p = str;
|
||||||
p = str;
|
|
||||||
|
|
||||||
while ( *p )
|
while ( *p )
|
||||||
{
|
{
|
||||||
|
@ -271,7 +263,7 @@ bool FTermDetection::getTTYSFileEntry()
|
||||||
|
|
||||||
if ( ttys_entryt )
|
if ( ttys_entryt )
|
||||||
{
|
{
|
||||||
char* type = ttys_entryt->ty_type;
|
const char* type = ttys_entryt->ty_type;
|
||||||
|
|
||||||
if ( type != 0 )
|
if ( type != 0 )
|
||||||
{
|
{
|
||||||
|
@ -328,7 +320,7 @@ void FTermDetection::termtypeAnalysis()
|
||||||
if ( std::strncmp(termtype, "screen", 6) == 0 )
|
if ( std::strncmp(termtype, "screen", 6) == 0 )
|
||||||
{
|
{
|
||||||
terminal_type.screen = true;
|
terminal_type.screen = true;
|
||||||
char* tmux = std::getenv("TMUX");
|
const char* tmux = std::getenv("TMUX");
|
||||||
|
|
||||||
if ( tmux && std::strlen(tmux) != 0 )
|
if ( tmux && std::strlen(tmux) != 0 )
|
||||||
terminal_type.tmux = true;
|
terminal_type.tmux = true;
|
||||||
|
@ -349,7 +341,7 @@ void FTermDetection::detectTerminal()
|
||||||
{
|
{
|
||||||
// Terminal detection
|
// Terminal detection
|
||||||
|
|
||||||
char* new_termtype = nullptr;
|
char* new_termtype{nullptr};
|
||||||
|
|
||||||
if ( terminal_detection )
|
if ( terminal_detection )
|
||||||
{
|
{
|
||||||
|
@ -397,7 +389,7 @@ void FTermDetection::detectTerminal()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
char* FTermDetection::init_256colorTerminal()
|
char* FTermDetection::init_256colorTerminal()
|
||||||
{
|
{
|
||||||
char* new_termtype = nullptr;
|
char* new_termtype{nullptr};
|
||||||
|
|
||||||
if ( get256colorEnvString() )
|
if ( get256colorEnvString() )
|
||||||
color256 = true;
|
color256 = true;
|
||||||
|
@ -460,7 +452,7 @@ bool FTermDetection::get256colorEnvString()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
char* FTermDetection::termtype_256color_quirks()
|
char* FTermDetection::termtype_256color_quirks()
|
||||||
{
|
{
|
||||||
char* new_termtype = nullptr;
|
char* new_termtype{nullptr};
|
||||||
|
|
||||||
if ( ! color256 )
|
if ( ! color256 )
|
||||||
return new_termtype;
|
return new_termtype;
|
||||||
|
@ -549,13 +541,12 @@ char* FTermDetection::determineMaxColor (char current_termtype[])
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString FTermDetection::getXTermColorName (int color)
|
const FString FTermDetection::getXTermColorName (int color)
|
||||||
{
|
{
|
||||||
FString color_str("");
|
FString color_str{""};
|
||||||
|
fd_set ifds{};
|
||||||
fd_set ifds;
|
struct timeval tv{};
|
||||||
struct timeval tv;
|
|
||||||
int stdin_no = FTermios::getStdIn();
|
int stdin_no = FTermios::getStdIn();
|
||||||
|
|
||||||
char temp[512] = { };
|
char temp[512]{};
|
||||||
std::fprintf (stdout, OSC "4;%d;?" BEL, color); // get color
|
std::fprintf (stdout, OSC "4;%d;?" BEL, color); // get color
|
||||||
std::fflush(stdout);
|
std::fflush(stdout);
|
||||||
|
|
||||||
|
@ -632,11 +623,10 @@ char* FTermDetection::parseAnswerbackMsg (char current_termtype[])
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString FTermDetection::getAnswerbackMsg()
|
const FString FTermDetection::getAnswerbackMsg()
|
||||||
{
|
{
|
||||||
FString answerback = "";
|
FString answerback{""};
|
||||||
|
fd_set ifds{};
|
||||||
fd_set ifds;
|
struct timeval tv{};
|
||||||
struct timeval tv;
|
char temp[10]{};
|
||||||
char temp[10] = { };
|
|
||||||
int stdin_no = FTermios::getStdIn();
|
int stdin_no = FTermios::getStdIn();
|
||||||
|
|
||||||
std::putchar (ENQ[0]); // Send enquiry character
|
std::putchar (ENQ[0]); // Send enquiry character
|
||||||
|
@ -677,7 +667,7 @@ char* FTermDetection::parseSecDA (char current_termtype[])
|
||||||
return current_termtype;
|
return current_termtype;
|
||||||
|
|
||||||
// remove the first 3 bytes ("\033[>")
|
// remove the first 3 bytes ("\033[>")
|
||||||
FString temp = sec_da->right(sec_da->getLength() - 3);
|
FString temp(sec_da->right(sec_da->getLength() - 3));
|
||||||
// remove the last byte ("c")
|
// remove the last byte ("c")
|
||||||
temp.remove(temp.getLength() - 1, 1);
|
temp.remove(temp.getLength() - 1, 1);
|
||||||
// split into components
|
// split into components
|
||||||
|
@ -736,15 +726,15 @@ int FTermDetection::str2int (const FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString FTermDetection::getSecDA()
|
const FString FTermDetection::getSecDA()
|
||||||
{
|
{
|
||||||
FString sec_da_str = "";
|
FString sec_da_str{""};
|
||||||
|
|
||||||
int a = 0
|
int a{0}
|
||||||
, b = 0
|
, b{0}
|
||||||
, c = 0
|
, c{0}
|
||||||
, stdin_no = FTermios::getStdIn()
|
, stdin_no{FTermios::getStdIn()}
|
||||||
, stdout_no = FTermios::getStdOut();
|
, stdout_no{FTermios::getStdOut()};
|
||||||
fd_set ifds;
|
fd_set ifds{};
|
||||||
struct timeval tv;
|
struct timeval tv{};
|
||||||
|
|
||||||
// Get the secondary device attributes
|
// Get the secondary device attributes
|
||||||
ssize_t ret = write(stdout_no, SECDA, std::strlen(SECDA));
|
ssize_t ret = write(stdout_no, SECDA, std::strlen(SECDA));
|
||||||
|
@ -904,9 +894,8 @@ inline char* FTermDetection::secDA_Analysis_32 (char[])
|
||||||
{
|
{
|
||||||
// Terminal ID 32 - Tera Term
|
// Terminal ID 32 - Tera Term
|
||||||
|
|
||||||
char* new_termtype;
|
|
||||||
terminal_type.tera_term = true;
|
terminal_type.tera_term = true;
|
||||||
new_termtype = C_STR("teraterm");
|
char* new_termtype = C_STR("teraterm");
|
||||||
return new_termtype;
|
return new_termtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,9 +914,8 @@ inline char* FTermDetection::secDA_Analysis_67 (char[])
|
||||||
{
|
{
|
||||||
// Terminal ID 67 - cygwin
|
// Terminal ID 67 - cygwin
|
||||||
|
|
||||||
char* new_termtype;
|
|
||||||
terminal_type.cygwin = true;
|
terminal_type.cygwin = true;
|
||||||
new_termtype = C_STR("cygwin");
|
char* new_termtype = C_STR("cygwin");
|
||||||
std::fflush(stdout);
|
std::fflush(stdout);
|
||||||
return new_termtype;
|
return new_termtype;
|
||||||
}
|
}
|
||||||
|
@ -937,10 +925,9 @@ inline char* FTermDetection::secDA_Analysis_77 (char[])
|
||||||
{
|
{
|
||||||
// Terminal ID 77 - mintty
|
// Terminal ID 77 - mintty
|
||||||
|
|
||||||
char* new_termtype;
|
|
||||||
terminal_type.mintty = true;
|
terminal_type.mintty = true;
|
||||||
decscusr_support = true;
|
decscusr_support = true;
|
||||||
new_termtype = C_STR("xterm-256color");
|
char* new_termtype = C_STR("xterm-256color");
|
||||||
std::fflush(stdout);
|
std::fflush(stdout);
|
||||||
return new_termtype;
|
return new_termtype;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,12 +32,12 @@ namespace finalcut
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
|
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST)
|
||||||
uInt FTermFreeBSD::bsd_alt_keymap = 0;
|
uInt FTermFreeBSD::bsd_alt_keymap{0};
|
||||||
FTermFreeBSD::CursorStyle FTermFreeBSD::cursor_style = fc::normal_cursor;
|
FTermFreeBSD::CursorStyle FTermFreeBSD::cursor_style{fc::normal_cursor};
|
||||||
bool FTermFreeBSD::change_cursorstyle = true;
|
bool FTermFreeBSD::change_cursorstyle{true};
|
||||||
bool FTermFreeBSD::meta_sends_escape = true;
|
bool FTermFreeBSD::meta_sends_escape{true};
|
||||||
FSystem* FTermFreeBSD::fsystem = nullptr;
|
FSystem* FTermFreeBSD::fsystem{nullptr};
|
||||||
FTermData* FTermFreeBSD::fterm_data = nullptr;
|
FTermData* FTermFreeBSD::fterm_data{nullptr};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ void FTermFreeBSD::initCharMap()
|
||||||
if ( ! isFreeBSDConsole() )
|
if ( ! isFreeBSDConsole() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++)
|
for (std::size_t i{0}; i <= fc::lastCharItem; i++)
|
||||||
if ( fc::character[i][fc::PC] < 0x1c )
|
if ( fc::character[i][fc::PC] < 0x1c )
|
||||||
fc::character[i][fc::PC] = fc::character[i][fc::ASCII];
|
fc::character[i][fc::PC] = fc::character[i][fc::ASCII];
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ bool FTermFreeBSD::saveFreeBSDAltKey()
|
||||||
// Saving the current mapping for the alt key
|
// Saving the current mapping for the alt key
|
||||||
|
|
||||||
static constexpr int left_alt = 0x38;
|
static constexpr int left_alt = 0x38;
|
||||||
int ret = -1;
|
int ret{-1};
|
||||||
keymap_t keymap{};
|
keymap_t keymap{};
|
||||||
|
|
||||||
if ( fsystem )
|
if ( fsystem )
|
||||||
|
@ -203,7 +203,7 @@ bool FTermFreeBSD::setFreeBSDAltKey (uInt key)
|
||||||
// Remapping the alt key
|
// Remapping the alt key
|
||||||
|
|
||||||
static constexpr int left_alt = 0x38;
|
static constexpr int left_alt = 0x38;
|
||||||
int ret = -1;
|
int ret{-1};
|
||||||
keymap_t keymap{};
|
keymap_t keymap{};
|
||||||
|
|
||||||
if ( fsystem )
|
if ( fsystem )
|
||||||
|
|
|
@ -71,7 +71,7 @@ void FTermios::init()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
termios FTermios::getTTY()
|
termios FTermios::getTTY()
|
||||||
{
|
{
|
||||||
struct termios t;
|
struct termios t{};
|
||||||
tcgetattr (stdin_no, &t);
|
tcgetattr (stdin_no, &t);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ void FTermios::restoreTTYsettings()
|
||||||
void FTermios::setHardwareEcho()
|
void FTermios::setHardwareEcho()
|
||||||
{
|
{
|
||||||
// Info under: man 3 termios
|
// Info under: man 3 termios
|
||||||
struct termios t;
|
struct termios t{};
|
||||||
tcgetattr (stdin_no, &t);
|
tcgetattr (stdin_no, &t);
|
||||||
|
|
||||||
// local mode
|
// local mode
|
||||||
|
@ -120,7 +120,7 @@ void FTermios::setHardwareEcho()
|
||||||
void FTermios::unsetHardwareEcho()
|
void FTermios::unsetHardwareEcho()
|
||||||
{
|
{
|
||||||
// Info under: man 3 termios
|
// Info under: man 3 termios
|
||||||
struct termios t;
|
struct termios t{};
|
||||||
tcgetattr (stdin_no, &t);
|
tcgetattr (stdin_no, &t);
|
||||||
|
|
||||||
// local mode
|
// local mode
|
||||||
|
@ -139,7 +139,7 @@ void FTermios::unsetHardwareEcho()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermios::setCaptureSendCharacters()
|
void FTermios::setCaptureSendCharacters()
|
||||||
{
|
{
|
||||||
struct termios t;
|
struct termios t{};
|
||||||
tcgetattr (stdin_no, &t);
|
tcgetattr (stdin_no, &t);
|
||||||
t.c_lflag &= uInt(~(ICANON | ECHO));
|
t.c_lflag &= uInt(~(ICANON | ECHO));
|
||||||
t.c_cc[VTIME] = 1; // Timeout in deciseconds
|
t.c_cc[VTIME] = 1; // Timeout in deciseconds
|
||||||
|
@ -150,7 +150,7 @@ void FTermios::setCaptureSendCharacters()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTermios::unsetCaptureSendCharacters()
|
void FTermios::unsetCaptureSendCharacters()
|
||||||
{
|
{
|
||||||
struct termios t;
|
struct termios t{};
|
||||||
tcgetattr (stdin_no, &t);
|
tcgetattr (stdin_no, &t);
|
||||||
t.c_lflag |= uInt(ICANON | ECHO);
|
t.c_lflag |= uInt(ICANON | ECHO);
|
||||||
t.c_cc[VTIME] = 0; // Timeout in deciseconds
|
t.c_cc[VTIME] = 0; // Timeout in deciseconds
|
||||||
|
@ -166,7 +166,7 @@ bool FTermios::setRawMode (bool enable)
|
||||||
return raw_mode;
|
return raw_mode;
|
||||||
|
|
||||||
// Info under: man 3 termios
|
// Info under: man 3 termios
|
||||||
struct termios t;
|
struct termios t{};
|
||||||
tcgetattr (stdin_no, &t);
|
tcgetattr (stdin_no, &t);
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
|
|
|
@ -43,21 +43,21 @@ namespace finalcut
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
FTermLinux::modifier_key FTermLinux::mod_key;
|
FTermLinux::modifier_key FTermLinux::mod_key{};
|
||||||
console_font_op FTermLinux::screen_font;
|
console_font_op FTermLinux::screen_font{};
|
||||||
unimapdesc FTermLinux::screen_unicode_map;
|
unimapdesc FTermLinux::screen_unicode_map{};
|
||||||
|
|
||||||
bool FTermLinux::new_font;
|
bool FTermLinux::new_font{false};
|
||||||
bool FTermLinux::vga_font;
|
bool FTermLinux::vga_font{false};
|
||||||
bool FTermLinux::has_saved_palette = false;
|
bool FTermLinux::has_saved_palette{false};
|
||||||
|
|
||||||
FTermData* FTermLinux::fterm_data = nullptr;
|
FTermData* FTermLinux::fterm_data{nullptr};
|
||||||
FSystem* FTermLinux::fsystem = nullptr;
|
FSystem* FTermLinux::fsystem{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{};
|
||||||
FTermLinux::ColorMap FTermLinux::cmap{};
|
FTermLinux::ColorMap FTermLinux::cmap{};
|
||||||
int FTermLinux::framebuffer_bpp = -1;
|
int FTermLinux::framebuffer_bpp{-1};
|
||||||
#endif // defined(__linux__)
|
#endif // defined(__linux__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ char* FTermLinux::getCursorStyleString()
|
||||||
{
|
{
|
||||||
// Gets the current cursor style string of the Linux console
|
// Gets the current cursor style string of the Linux console
|
||||||
|
|
||||||
static char buf[16] = { };
|
static char buf[16]{};
|
||||||
std::fill (std::begin(buf), std::end(buf), '\0');
|
std::fill (std::begin(buf), std::end(buf), '\0');
|
||||||
std::sprintf (buf, CSI "?%dc", getCursorStyle());
|
std::sprintf (buf, CSI "?%dc", getCursorStyle());
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -157,7 +157,7 @@ bool FTermLinux::isLinuxConsole()
|
||||||
if ( ! fsystem )
|
if ( ! fsystem )
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
|
|
||||||
char arg = 0;
|
char arg{0};
|
||||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||||
|
|
||||||
// Get keyboard type an compare
|
// Get keyboard type an compare
|
||||||
|
@ -232,7 +232,7 @@ void FTermLinux::initCharMap()
|
||||||
|
|
||||||
if ( screen_unicode_map.entry_ct > 0 && screen_unicode_map.entries )
|
if ( screen_unicode_map.entry_ct > 0 && screen_unicode_map.entries )
|
||||||
{
|
{
|
||||||
for (std::size_t i = 0; i <= fc::lastCharItem; i++ )
|
for (std::size_t i{0}; i <= fc::lastCharItem; i++ )
|
||||||
{
|
{
|
||||||
auto ucs = wchar_t(fc::character[i][fc::UTF8]);
|
auto ucs = wchar_t(fc::character[i][fc::UTF8]);
|
||||||
sInt16 fontpos = getFontPos(ucs);
|
sInt16 fontpos = getFontPos(ucs);
|
||||||
|
@ -507,10 +507,10 @@ FKey FTermLinux::modifierKeyCorrection (const FKey& key_id)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FTermLinux::getFramebuffer_bpp()
|
int FTermLinux::getFramebuffer_bpp()
|
||||||
{
|
{
|
||||||
int fd = -1;
|
int fd{-1};
|
||||||
const char* fb = C_STR("/dev/fb/0");
|
const char* fb = C_STR("/dev/fb/0");
|
||||||
struct fb_var_screeninfo fb_var;
|
struct fb_var_screeninfo fb_var{};
|
||||||
struct fb_fix_screeninfo fb_fix;
|
struct fb_fix_screeninfo fb_fix{};
|
||||||
|
|
||||||
if ( ! fsystem )
|
if ( ! fsystem )
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
|
@ -543,9 +543,9 @@ int FTermLinux::getFramebuffer_bpp()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FTermLinux::getScreenFont()
|
bool FTermLinux::getScreenFont()
|
||||||
{
|
{
|
||||||
struct console_font_op font;
|
struct console_font_op font{};
|
||||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||||
int ret = -1;
|
int ret{-1};
|
||||||
|
|
||||||
if ( fd_tty < 0 )
|
if ( fd_tty < 0 )
|
||||||
return false;
|
return false;
|
||||||
|
@ -593,8 +593,8 @@ bool FTermLinux::getScreenFont()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FTermLinux::getUnicodeMap()
|
bool FTermLinux::getUnicodeMap()
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||||
|
int ret{-1};
|
||||||
|
|
||||||
if ( fd_tty < 0 )
|
if ( fd_tty < 0 )
|
||||||
return false;
|
return false;
|
||||||
|
@ -639,7 +639,7 @@ FTermLinux::modifier_key& FTermLinux::getModifierKey()
|
||||||
{
|
{
|
||||||
// Get Linux console shift state
|
// Get Linux console shift state
|
||||||
|
|
||||||
char subcode = 6; // Shift state command + return value
|
char subcode{6}; // Shift state command + return value
|
||||||
|
|
||||||
// Fill bit field with 0
|
// Fill bit field with 0
|
||||||
std::memset (&mod_key, 0x00, sizeof(mod_key));
|
std::memset (&mod_key, 0x00, sizeof(mod_key));
|
||||||
|
@ -668,9 +668,9 @@ int FTermLinux::setScreenFont ( uChar fontdata[], uInt count
|
||||||
, uInt fontwidth, uInt fontheight
|
, uInt fontwidth, uInt fontheight
|
||||||
, bool direct)
|
, bool direct)
|
||||||
{
|
{
|
||||||
struct console_font_op font;
|
struct console_font_op font{};
|
||||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||||
int ret = -1;
|
int ret{-1};
|
||||||
|
|
||||||
if ( fd_tty < 0 )
|
if ( fd_tty < 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -701,7 +701,7 @@ int FTermLinux::setScreenFont ( uChar fontdata[], uInt count
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::size_t i = 0; i < count; i++)
|
for (std::size_t i{0}; i < count; i++)
|
||||||
std::memcpy ( const_cast<uChar*>(font.data + bytes_per_line * 32 * i)
|
std::memcpy ( const_cast<uChar*>(font.data + bytes_per_line * 32 * i)
|
||||||
, &fontdata[i * font.height]
|
, &fontdata[i * font.height]
|
||||||
, font.height);
|
, font.height);
|
||||||
|
@ -733,7 +733,7 @@ int FTermLinux::setUnicodeMap (struct unimapdesc* unimap)
|
||||||
{
|
{
|
||||||
struct unimapinit advice;
|
struct unimapinit advice;
|
||||||
int fd_tty = FTerm::getTTYFileDescriptor();
|
int fd_tty = FTerm::getTTYFileDescriptor();
|
||||||
int ret = -1;
|
int ret{-1};
|
||||||
|
|
||||||
if ( fd_tty < 0 )
|
if ( fd_tty < 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -798,7 +798,6 @@ uChar FTermLinux::readAttributeController (uChar index)
|
||||||
if ( ! fsystem )
|
if ( ! fsystem )
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
|
|
||||||
uChar res;
|
|
||||||
// Attribute controller (write port)
|
// Attribute controller (write port)
|
||||||
static constexpr uInt16 attrib_cntlr_write = 0x3c0;
|
static constexpr uInt16 attrib_cntlr_write = 0x3c0;
|
||||||
// Attribute controller (read port)
|
// Attribute controller (read port)
|
||||||
|
@ -807,7 +806,7 @@ uChar FTermLinux::readAttributeController (uChar index)
|
||||||
|
|
||||||
fsystem->inPortByte (input_status_1); // switch to index mode
|
fsystem->inPortByte (input_status_1); // switch to index mode
|
||||||
fsystem->outPortByte (index & 0x1f, attrib_cntlr_write); // selects address register
|
fsystem->outPortByte (index & 0x1f, attrib_cntlr_write); // selects address register
|
||||||
res = fsystem->inPortByte (attrib_cntlr_read); // read from data register
|
uChar res = fsystem->inPortByte (attrib_cntlr_read); // read from data register
|
||||||
|
|
||||||
// Disable access to the palette and unblank the display
|
// Disable access to the palette and unblank the display
|
||||||
fsystem->inPortByte (input_status_1); // switch to index mode
|
fsystem->inPortByte (input_status_1); // switch to index mode
|
||||||
|
@ -916,7 +915,7 @@ void FTermLinux::setVGADefaultPalette()
|
||||||
{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++)
|
||||||
{
|
{
|
||||||
cmap.color[index].red = defaultColor[index].red;
|
cmap.color[index].red = defaultColor[index].red;
|
||||||
cmap.color[index].green = defaultColor[index].green;
|
cmap.color[index].green = defaultColor[index].green;
|
||||||
|
@ -1288,7 +1287,7 @@ sInt16 FTermLinux::getFontPos (wchar_t ucs)
|
||||||
{
|
{
|
||||||
constexpr sInt16 NOT_FOUND = -1;
|
constexpr sInt16 NOT_FOUND = -1;
|
||||||
|
|
||||||
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 sInt16(screen_unicode_map.entries[n].fontpos);
|
return sInt16(screen_unicode_map.entries[n].fontpos);
|
||||||
|
|
|
@ -29,9 +29,9 @@ namespace finalcut
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)
|
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST)
|
||||||
kbd_t FTermOpenBSD::bsd_keyboard_encoding = 0;
|
kbd_t FTermOpenBSD::bsd_keyboard_encoding{0};
|
||||||
bool FTermOpenBSD::meta_sends_escape = true;
|
bool FTermOpenBSD::meta_sends_escape{true};
|
||||||
FSystem* FTermOpenBSD::fsystem = nullptr;
|
FSystem* FTermOpenBSD::fsystem{nullptr};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ bool FTermOpenBSD::resetBeep()
|
||||||
&& fsystem->ioctl(0, WSKBDIO_GETDEFAULTBELL, &default_bell) < 0 )
|
&& fsystem->ioctl(0, WSKBDIO_GETDEFAULTBELL, &default_bell) < 0 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
default_bell.which = WSKBD_BELL_DOALL;
|
default_bell.which = WSKBD_BELL_DOALL;
|
||||||
|
|
||||||
// Sets the bell settings
|
// Sets the bell settings
|
||||||
if ( fsystem
|
if ( fsystem
|
||||||
|
@ -140,7 +140,7 @@ bool FTermOpenBSD::resetBeep()
|
||||||
bool FTermOpenBSD::saveBSDConsoleEncoding()
|
bool FTermOpenBSD::saveBSDConsoleEncoding()
|
||||||
{
|
{
|
||||||
static kbd_t k_encoding{};
|
static kbd_t k_encoding{};
|
||||||
int ret = -1;
|
int ret{-1};
|
||||||
|
|
||||||
if ( fsystem )
|
if ( fsystem )
|
||||||
ret = fsystem->ioctl (0, WSKBDIO_GETENCODING, &k_encoding);
|
ret = fsystem->ioctl (0, WSKBDIO_GETENCODING, &k_encoding);
|
||||||
|
|
|
@ -38,22 +38,22 @@ namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
bool FTermXTerminal::mouse_support;
|
bool FTermXTerminal::mouse_support{false};
|
||||||
bool FTermXTerminal::meta_sends_esc;
|
bool FTermXTerminal::meta_sends_esc{false};
|
||||||
bool FTermXTerminal::xterm_default_colors;
|
bool FTermXTerminal::xterm_default_colors{false};
|
||||||
std::size_t FTermXTerminal::term_width = 80;
|
std::size_t FTermXTerminal::term_width{80};
|
||||||
std::size_t FTermXTerminal::term_height = 24;
|
std::size_t FTermXTerminal::term_height{24};
|
||||||
const FString* FTermXTerminal::xterm_font = nullptr;
|
const FString* FTermXTerminal::xterm_font{nullptr};
|
||||||
const FString* FTermXTerminal::xterm_title = nullptr;
|
const FString* FTermXTerminal::xterm_title{nullptr};
|
||||||
const FString* FTermXTerminal::foreground_color = nullptr;
|
const FString* FTermXTerminal::foreground_color{nullptr};
|
||||||
const FString* FTermXTerminal::background_color = nullptr;
|
const FString* FTermXTerminal::background_color{nullptr};
|
||||||
const FString* FTermXTerminal::cursor_color = nullptr;
|
const FString* FTermXTerminal::cursor_color{nullptr};
|
||||||
const FString* FTermXTerminal::mouse_foreground_color = nullptr;
|
const FString* FTermXTerminal::mouse_foreground_color{nullptr};
|
||||||
const FString* FTermXTerminal::mouse_background_color = nullptr;
|
const FString* FTermXTerminal::mouse_background_color{nullptr};
|
||||||
const FString* FTermXTerminal::highlight_background_color = nullptr;
|
const FString* FTermXTerminal::highlight_background_color{nullptr};
|
||||||
FSystem* FTermXTerminal::fsystem = nullptr;
|
FSystem* FTermXTerminal::fsystem{nullptr};
|
||||||
FTermDetection* FTermXTerminal::term_detection = nullptr;
|
FTermDetection* FTermXTerminal::term_detection{nullptr};
|
||||||
fc::xtermCursorStyle FTermXTerminal::cursor_style = fc::unknown_cursor_style;
|
fc::xtermCursorStyle FTermXTerminal::cursor_style{fc::unknown_cursor_style};
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -64,10 +64,6 @@ fc::xtermCursorStyle FTermXTerminal::cursor_style = fc::unknown_cursor_style;
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FTermXTerminal::FTermXTerminal()
|
FTermXTerminal::FTermXTerminal()
|
||||||
{
|
{
|
||||||
// Preset to false
|
|
||||||
mouse_support = \
|
|
||||||
meta_sends_esc = \
|
|
||||||
xterm_default_colors = false;
|
|
||||||
// Get FSystem object
|
// Get FSystem object
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
}
|
}
|
||||||
|
@ -777,8 +773,8 @@ const FString* FTermXTerminal::captureXTermFont()
|
||||||
|| term_detection->isScreenTerm()
|
|| term_detection->isScreenTerm()
|
||||||
|| FTermcap::osc_support )
|
|| FTermcap::osc_support )
|
||||||
{
|
{
|
||||||
fd_set ifds;
|
fd_set ifds{};
|
||||||
struct timeval tv;
|
struct timeval tv{};
|
||||||
int stdin_no = FTermios::getStdIn();
|
int stdin_no = FTermios::getStdIn();
|
||||||
|
|
||||||
oscPrefix();
|
oscPrefix();
|
||||||
|
@ -794,7 +790,7 @@ const FString* FTermXTerminal::captureXTermFont()
|
||||||
// Read the terminal answer
|
// Read the terminal answer
|
||||||
if ( select(stdin_no + 1, &ifds, 0, 0, &tv) > 0 )
|
if ( select(stdin_no + 1, &ifds, 0, 0, &tv) > 0 )
|
||||||
{
|
{
|
||||||
char temp[150] = { };
|
char temp[150]{};
|
||||||
|
|
||||||
if ( std::scanf("\033]50;%148[^\n]s", temp) == 1 )
|
if ( std::scanf("\033]50;%148[^\n]s", temp) == 1 )
|
||||||
{
|
{
|
||||||
|
@ -829,8 +825,8 @@ const FString* FTermXTerminal::captureXTermTitle()
|
||||||
if ( term_detection->isKdeTerminal() )
|
if ( term_detection->isKdeTerminal() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fd_set ifds;
|
fd_set ifds{};
|
||||||
struct timeval tv;
|
struct timeval tv{};
|
||||||
int stdin_no = FTermios::getStdIn();
|
int stdin_no = FTermios::getStdIn();
|
||||||
|
|
||||||
FTerm::putstring (CSI "21t"); // get title
|
FTerm::putstring (CSI "21t"); // get title
|
||||||
|
@ -844,7 +840,7 @@ const FString* FTermXTerminal::captureXTermTitle()
|
||||||
// read the terminal answer
|
// read the terminal answer
|
||||||
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0 )
|
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0 )
|
||||||
{
|
{
|
||||||
char temp[512] = { };
|
char temp[512]{};
|
||||||
|
|
||||||
if ( std::scanf("\033]l%509[^\n]s", temp) == 1 )
|
if ( std::scanf("\033]l%509[^\n]s", temp) == 1 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,21 +61,19 @@ FTextView::~FTextView() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString FTextView::getText() const
|
const FString FTextView::getText() const
|
||||||
{
|
{
|
||||||
std::size_t len, rows, idx;
|
|
||||||
|
|
||||||
if ( data.empty() )
|
if ( data.empty() )
|
||||||
return FString("");
|
return FString("");
|
||||||
|
|
||||||
len = 0;
|
std::size_t len{0};
|
||||||
rows = getRows();
|
std::size_t rows = getRows();
|
||||||
|
|
||||||
for (std::size_t i = 0 ; i < rows; i++)
|
for (std::size_t i{0} ; i < rows; i++)
|
||||||
len += data[i].getLength() + 1;
|
len += data[i].getLength() + 1;
|
||||||
|
|
||||||
FString s(len + 1);
|
FString s(len + 1);
|
||||||
idx = 0;
|
std::size_t idx{0};
|
||||||
|
|
||||||
for (std::size_t i = 0 ; i < rows; i++)
|
for (std::size_t i{0}; i < rows; i++)
|
||||||
{
|
{
|
||||||
const wchar_t* p = data[i].wc_str();
|
const wchar_t* p = data[i].wc_str();
|
||||||
|
|
||||||
|
@ -223,7 +221,7 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
auto text_split = s.split("\r\n");
|
auto text_split = s.split("\r\n");
|
||||||
auto num = text_split.size();
|
auto num = text_split.size();
|
||||||
|
|
||||||
for (std::size_t i = 0; i < num; i++)
|
for (std::size_t i{0}; i < num; i++)
|
||||||
{
|
{
|
||||||
text_split[i] = text_split[i].removeBackspaces()
|
text_split[i] = text_split[i].removeBackspaces()
|
||||||
.removeDel()
|
.removeDel()
|
||||||
|
@ -283,7 +281,6 @@ void FTextView::replaceRange (const FString& str, int from, int to)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::clear()
|
void FTextView::clear()
|
||||||
{
|
{
|
||||||
std::size_t size;
|
|
||||||
data.clear();
|
data.clear();
|
||||||
data.shrink_to_fit();
|
data.shrink_to_fit();
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
|
@ -300,14 +297,14 @@ void FTextView::clear()
|
||||||
|
|
||||||
// clear list from screen
|
// clear list from screen
|
||||||
setColor();
|
setColor();
|
||||||
size = getWidth() - 2;
|
std::size_t size = getWidth() - 2;
|
||||||
|
|
||||||
if ( size == 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char* blank = createBlankArray(size + 1);
|
char* blank = createBlankArray(size + 1);
|
||||||
|
|
||||||
for (int y = 0; y < int(getTextHeight()); y++)
|
for (int y{0}; y < int(getTextHeight()); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(2, 2 - nf_offset + y) << blank;
|
print() << FPoint(2, 2 - nf_offset + y) << blank;
|
||||||
}
|
}
|
||||||
|
@ -479,7 +476,7 @@ void FTextView::onMouseMove (FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::onWheel (FWheelEvent* ev)
|
void FTextView::onWheel (FWheelEvent* ev)
|
||||||
{
|
{
|
||||||
int distance = 4;
|
int distance{4};
|
||||||
|
|
||||||
switch ( ev->getWheel() )
|
switch ( ev->getWheel() )
|
||||||
{
|
{
|
||||||
|
@ -705,15 +702,15 @@ void FTextView::drawText()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
for (std::size_t y = 0; y < num; y++)
|
for (std::size_t y{0}; y < num; y++)
|
||||||
{
|
{
|
||||||
std::size_t i;
|
std::size_t i{};
|
||||||
FString line;
|
std::size_t n = y + std::size_t(yoffset);
|
||||||
print() << FPoint(2, 2 - nf_offset + int(y));
|
std::size_t x = std::size_t(1 + xoffset);
|
||||||
line = data[y + std::size_t(yoffset)].mid ( std::size_t(1 + xoffset)
|
FString line(data[n].mid (x, getTextWidth()));
|
||||||
, getTextWidth() );
|
|
||||||
const auto line_str = line.wc_str();
|
const auto line_str = line.wc_str();
|
||||||
const auto len = line.getLength();
|
const auto len = line.getLength();
|
||||||
|
print() << FPoint(2, 2 - nf_offset + int(y));
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
|
@ -749,8 +746,8 @@ void FTextView::processChanged()
|
||||||
void FTextView::cb_VBarChange (FWidget*, FDataPtr)
|
void FTextView::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
FScrollbar::sType scrollType = vbar->getScrollType();
|
FScrollbar::sType scrollType = vbar->getScrollType();
|
||||||
int distance = 1;
|
int distance{1};
|
||||||
int wheel_distance = 4;
|
int wheel_distance{4};
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward
|
||||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
&& scrollType <= FScrollbar::scrollWheelDown )
|
||||||
|
@ -805,8 +802,8 @@ void FTextView::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
void FTextView::cb_HBarChange (FWidget*, FDataPtr)
|
void FTextView::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
{
|
{
|
||||||
FScrollbar::sType scrollType = hbar->getScrollType();
|
FScrollbar::sType scrollType = hbar->getScrollType();
|
||||||
int distance = 1;
|
int distance{1};
|
||||||
int wheel_distance = 4;
|
int wheel_distance{4};
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward
|
||||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
&& scrollType <= FScrollbar::scrollWheelDown )
|
||||||
|
|
|
@ -84,7 +84,7 @@ void FToggleButton::setGeometry ( const FPoint& pos, const FSize& s
|
||||||
{
|
{
|
||||||
// Set the toggle button geometry
|
// Set the toggle button geometry
|
||||||
|
|
||||||
FSize size = s;
|
FSize size(s);
|
||||||
std::size_t hotkey_mark = ( getHotkey(text) ) ? 1 : 0;
|
std::size_t hotkey_mark = ( getHotkey(text) ) ? 1 : 0;
|
||||||
std::size_t min_width = button_width + text.getLength() - hotkey_mark;
|
std::size_t min_width = button_width + text.getLength() - hotkey_mark;
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ bool FToggleButton::setChecked (bool enable)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToggleButton::setText (const FString& txt)
|
void FToggleButton::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
text = txt;
|
text.setString(txt);
|
||||||
std::size_t hotkey_mark = ( getHotkey(text) ) ? 1 : 0;
|
std::size_t hotkey_mark = ( getHotkey(text) ) ? 1 : 0;
|
||||||
|
|
||||||
setWidth(button_width + text.getLength() - hotkey_mark);
|
setWidth(button_width + text.getLength() - hotkey_mark);
|
||||||
|
@ -440,7 +440,7 @@ void FToggleButton::drawLabel()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString txt = text;
|
FString txt(text);
|
||||||
wchar_t* src = const_cast<wchar_t*>(txt.wc_str());
|
wchar_t* src = const_cast<wchar_t*>(txt.wc_str());
|
||||||
wchar_t* dest = const_cast<wchar_t*>(LabelText);
|
wchar_t* dest = const_cast<wchar_t*>(LabelText);
|
||||||
auto hotkeypos = finalcut::getHotkeyPos(src, dest, length);
|
auto hotkeypos = finalcut::getHotkeyPos(src, dest, length);
|
||||||
|
@ -566,7 +566,7 @@ void FToggleButton::drawText ( wchar_t LabelText[]
|
||||||
else
|
else
|
||||||
setColor (wc.label_inactive_fg, wc.label_inactive_bg);
|
setColor (wc.label_inactive_fg, wc.label_inactive_bg);
|
||||||
|
|
||||||
for (std::size_t z = 0; z < length; z++)
|
for (std::size_t z{0}; z < length; z++)
|
||||||
{
|
{
|
||||||
if ( (z == hotkeypos) && flags.active )
|
if ( (z == hotkeypos) && flags.active )
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,7 +55,7 @@ FToolTip::~FToolTip() // destructor
|
||||||
if ( fapp->isQuit() )
|
if ( fapp->isQuit() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FWindow* parent_win = nullptr;
|
FWindow* parent_win{nullptr};
|
||||||
|
|
||||||
if ( auto parent = getParentWidget() )
|
if ( auto parent = getParentWidget() )
|
||||||
parent_win = getWindowWidget(parent);
|
parent_win = getWindowWidget(parent);
|
||||||
|
@ -71,7 +71,7 @@ FToolTip::~FToolTip() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToolTip::setText (const FString& txt)
|
void FToolTip::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
text = txt;
|
text.setString(txt);
|
||||||
calculateDimensions();
|
calculateDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ void FToolTip::draw()
|
||||||
clearArea();
|
clearArea();
|
||||||
drawBorder();
|
drawBorder();
|
||||||
|
|
||||||
for (std::size_t i = 0; i < text_num_lines; i++)
|
for (std::size_t i{0}; i < text_num_lines; i++)
|
||||||
{
|
{
|
||||||
print() << FPoint(3, 2 + int(i)) << text_components[i];
|
print() << FPoint(3, 2 + int(i)) << text_components[i];
|
||||||
}
|
}
|
||||||
|
@ -134,8 +134,7 @@ void FToolTip::init()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToolTip::calculateDimensions()
|
void FToolTip::calculateDimensions()
|
||||||
{
|
{
|
||||||
int x, y;
|
int x{}, y{};
|
||||||
std::size_t w, h;
|
|
||||||
auto r = getRootWidget();
|
auto r = getRootWidget();
|
||||||
max_line_width = 0;
|
max_line_width = 0;
|
||||||
text_split = text.split("\n");
|
text_split = text.split("\n");
|
||||||
|
@ -144,7 +143,7 @@ void FToolTip::calculateDimensions()
|
||||||
if ( text_num_lines == 0 )
|
if ( text_num_lines == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < text_num_lines; i++)
|
for (std::size_t i{0}; i < text_num_lines; i++)
|
||||||
{
|
{
|
||||||
text_components = &text_split[0];
|
text_components = &text_split[0];
|
||||||
std::size_t len = text_components[i].getLength();
|
std::size_t len = text_components[i].getLength();
|
||||||
|
@ -153,8 +152,8 @@ void FToolTip::calculateDimensions()
|
||||||
max_line_width = len;
|
max_line_width = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
h = text_num_lines + 2;
|
std::size_t h = text_num_lines + 2;
|
||||||
w = max_line_width + 4;
|
std::size_t w = max_line_width + 4;
|
||||||
|
|
||||||
if ( r )
|
if ( r )
|
||||||
{
|
{
|
||||||
|
|
226
src/fvterm.cpp
226
src/fvterm.cpp
|
@ -45,27 +45,27 @@ namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
// global FVTerm object
|
// global FVTerm object
|
||||||
static FVTerm* init_object = nullptr;
|
static FVTerm* init_object{nullptr};
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
bool FVTerm::terminal_update_complete;
|
bool FVTerm::terminal_update_complete{false};
|
||||||
bool FVTerm::terminal_update_pending;
|
bool FVTerm::terminal_update_pending{false};
|
||||||
bool FVTerm::force_terminal_update;
|
bool FVTerm::force_terminal_update{false};
|
||||||
bool FVTerm::stop_terminal_updates;
|
bool FVTerm::stop_terminal_updates{false};
|
||||||
int FVTerm::skipped_terminal_update = 0;
|
int FVTerm::skipped_terminal_update{};
|
||||||
uInt FVTerm::erase_char_length;
|
uInt FVTerm::erase_char_length{};
|
||||||
uInt FVTerm::repeat_char_length;
|
uInt FVTerm::repeat_char_length{};
|
||||||
uInt FVTerm::clr_bol_length;
|
uInt FVTerm::clr_bol_length{};
|
||||||
uInt FVTerm::clr_eol_length;
|
uInt FVTerm::clr_eol_length{};
|
||||||
uInt FVTerm::cursor_address_length;
|
uInt FVTerm::cursor_address_length{};
|
||||||
std::queue<int>* FVTerm::output_buffer = nullptr;
|
std::queue<int>* FVTerm::output_buffer{nullptr};
|
||||||
FPoint* FVTerm::term_pos = nullptr;
|
FPoint* FVTerm::term_pos{nullptr};
|
||||||
FSystem* FVTerm::fsystem = nullptr;
|
FSystem* FVTerm::fsystem{nullptr};
|
||||||
FTerm* FVTerm::fterm = nullptr;
|
FTerm* FVTerm::fterm{nullptr};
|
||||||
FVTerm::term_area* FVTerm::vterm = nullptr;
|
FVTerm::term_area* FVTerm::vterm{nullptr};
|
||||||
FVTerm::term_area* FVTerm::vdesktop = nullptr;
|
FVTerm::term_area* FVTerm::vdesktop{nullptr};
|
||||||
FVTerm::term_area* FVTerm::active_area = nullptr;
|
FVTerm::term_area* FVTerm::active_area{nullptr};
|
||||||
FKeyboard* FVTerm::keyboard = nullptr;
|
FKeyboard* FVTerm::keyboard{nullptr};
|
||||||
charData FVTerm::term_attribute{};
|
charData FVTerm::term_attribute{};
|
||||||
charData FVTerm::next_attribute{};
|
charData FVTerm::next_attribute{};
|
||||||
charData FVTerm::s_ch{};
|
charData FVTerm::s_ch{};
|
||||||
|
@ -80,8 +80,6 @@ charData FVTerm::i_ch{};
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FVTerm::FVTerm (bool initialize, bool disable_alt_screen)
|
FVTerm::FVTerm (bool initialize, bool disable_alt_screen)
|
||||||
{
|
{
|
||||||
terminal_update_complete = false;
|
|
||||||
|
|
||||||
if ( initialize )
|
if ( initialize )
|
||||||
init (disable_alt_screen);
|
init (disable_alt_screen);
|
||||||
}
|
}
|
||||||
|
@ -119,13 +117,12 @@ FPoint FVTerm::getPrintCursor()
|
||||||
void FVTerm::setTermXY (int x, int y)
|
void FVTerm::setTermXY (int x, int y)
|
||||||
{
|
{
|
||||||
// Sets the hardware cursor to the given (x,y) position
|
// Sets the hardware cursor to the given (x,y) position
|
||||||
int term_x, term_y, term_width, term_height;
|
|
||||||
|
|
||||||
if ( term_pos->getX() == x && term_pos->getY() == y )
|
if ( term_pos->getX() == x && term_pos->getY() == y )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
term_width = int(getColumnNumber());
|
int term_width = int(getColumnNumber());
|
||||||
term_height = int(getLineNumber());
|
int term_height = int(getLineNumber());
|
||||||
|
|
||||||
if ( x >= term_width && term_width > 0 )
|
if ( x >= term_width && term_width > 0 )
|
||||||
{
|
{
|
||||||
|
@ -139,8 +136,8 @@ void FVTerm::setTermXY (int x, int y)
|
||||||
if ( y >= term_height )
|
if ( y >= term_height )
|
||||||
y = term_height - 1;
|
y = term_height - 1;
|
||||||
|
|
||||||
term_x = term_pos->getX();
|
int term_x = term_pos->getX();
|
||||||
term_y = term_pos->getY();
|
int term_y = term_pos->getY();
|
||||||
|
|
||||||
const char* move_str = FTerm::moveCursorString (term_x, term_y, x, y);
|
const char* move_str = FTerm::moveCursorString (term_x, term_y, x, y);
|
||||||
|
|
||||||
|
@ -214,7 +211,7 @@ void FVTerm::resizeVTerm (const FSize& size)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FVTerm::putVTerm()
|
void FVTerm::putVTerm()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < vterm->height; i++)
|
for (int i{0}; i < vterm->height; i++)
|
||||||
{
|
{
|
||||||
vterm->changes[i].xmin = 0;
|
vterm->changes[i].xmin = 0;
|
||||||
vterm->changes[i].xmax = uInt(vterm->width - 1);
|
vterm->changes[i].xmax = uInt(vterm->width - 1);
|
||||||
|
@ -282,7 +279,7 @@ void FVTerm::updateTerminal()
|
||||||
if ( ! vterm->has_changes )
|
if ( ! vterm->has_changes )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (uInt y = 0; y < uInt(vterm->height); y++)
|
for (uInt y{0}; y < uInt(vterm->height); y++)
|
||||||
updateTerminalLine (y);
|
updateTerminalLine (y);
|
||||||
|
|
||||||
vterm->has_changes = false;
|
vterm->has_changes = false;
|
||||||
|
@ -300,7 +297,7 @@ void FVTerm::addPreprocessingHandler ( FVTerm* instance
|
||||||
|
|
||||||
if ( print_area )
|
if ( print_area )
|
||||||
{
|
{
|
||||||
vterm_preprocessing obj = { instance, handler };
|
vterm_preprocessing obj{ instance, handler };
|
||||||
delPreprocessingHandler (instance);
|
delPreprocessingHandler (instance);
|
||||||
print_area->preprocessing_call.push_back(obj);
|
print_area->preprocessing_call.push_back(obj);
|
||||||
}
|
}
|
||||||
|
@ -330,8 +327,8 @@ void FVTerm::delPreprocessingHandler (FVTerm* instance)
|
||||||
int FVTerm::printf (const FString format, ...)
|
int FVTerm::printf (const FString format, ...)
|
||||||
{
|
{
|
||||||
static constexpr int BUFSIZE = 4096;
|
static constexpr int BUFSIZE = 4096;
|
||||||
wchar_t buffer[BUFSIZE];
|
wchar_t buffer[BUFSIZE]{};
|
||||||
va_list args;
|
va_list args{};
|
||||||
|
|
||||||
if ( format.isEmpty() )
|
if ( format.isEmpty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -364,7 +361,7 @@ int FVTerm::print (term_area* area, const FString& s)
|
||||||
if ( s.isNull() || ! area )
|
if ( s.isNull() || ! area )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
std::vector<charData> term_string;
|
std::vector<charData> term_string{};
|
||||||
const wchar_t* p = s.wc_str();
|
const wchar_t* p = s.wc_str();
|
||||||
|
|
||||||
if ( p )
|
if ( p )
|
||||||
|
@ -426,7 +423,7 @@ int FVTerm::print (const std::vector<charData>& term_string)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FVTerm::print (term_area* area, const std::vector<charData>& term_string)
|
int FVTerm::print (term_area* area, const std::vector<charData>& term_string)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len{0};
|
||||||
uInt tabstop = uInt(getTabstop());
|
uInt tabstop = uInt(getTabstop());
|
||||||
|
|
||||||
if ( ! area )
|
if ( ! area )
|
||||||
|
@ -437,7 +434,7 @@ int FVTerm::print (term_area* area, const std::vector<charData>& term_string)
|
||||||
|
|
||||||
for (auto&& ch : term_string)
|
for (auto&& ch : term_string)
|
||||||
{
|
{
|
||||||
bool printable_character = false;
|
bool printable_character{false};
|
||||||
|
|
||||||
switch ( ch.code )
|
switch ( ch.code )
|
||||||
{
|
{
|
||||||
|
@ -495,7 +492,7 @@ int FVTerm::print (wchar_t c)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FVTerm::print (term_area* area, wchar_t c)
|
int FVTerm::print (term_area* area, wchar_t c)
|
||||||
{
|
{
|
||||||
charData nc; // next character
|
charData nc{}; // next character
|
||||||
|
|
||||||
if ( ! area )
|
if ( ! area )
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -525,17 +522,16 @@ int FVTerm::print (charData& term_char)
|
||||||
int FVTerm::print (term_area* area, charData& term_char)
|
int FVTerm::print (term_area* area, charData& term_char)
|
||||||
{
|
{
|
||||||
charData& nc = term_char; // next character
|
charData& nc = term_char; // next character
|
||||||
int width, height, rsh, bsh, ax, ay;
|
|
||||||
|
|
||||||
if ( ! area )
|
if ( ! area )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
width = area->width;
|
int width = area->width;
|
||||||
height = area->height;
|
int height = area->height;
|
||||||
rsh = area->right_shadow;
|
int rsh = area->right_shadow;
|
||||||
bsh = area->bottom_shadow;
|
int bsh = area->bottom_shadow;
|
||||||
ax = area->cursor_x - 1;
|
int ax = area->cursor_x - 1;
|
||||||
ay = area->cursor_y - 1;
|
int ay = area->cursor_y - 1;
|
||||||
|
|
||||||
if ( area->cursor_x > 0
|
if ( area->cursor_x > 0
|
||||||
&& area->cursor_y > 0
|
&& area->cursor_y > 0
|
||||||
|
@ -661,19 +657,17 @@ void FVTerm::resizeArea ( const FRect& box
|
||||||
// Resize the virtual window to a new size.
|
// Resize the virtual window to a new size.
|
||||||
|
|
||||||
int offset_left = box.getX();
|
int offset_left = box.getX();
|
||||||
int offset_top = box.getY();
|
int offset_top = box.getY();
|
||||||
int width = int(box.getWidth());
|
int width = int(box.getWidth());
|
||||||
int height = int(box.getHeight());
|
int height = int(box.getHeight());
|
||||||
int rsw = int(shadow.getWidth());
|
int rsw = int(shadow.getWidth());
|
||||||
int bsh = int(shadow.getHeight());
|
int bsh = int(shadow.getHeight());
|
||||||
|
|
||||||
assert ( offset_top >= 0 );
|
assert ( offset_top >= 0 );
|
||||||
assert ( width > 0 && width + rsw > 0 );
|
assert ( width > 0 && width + rsw > 0 );
|
||||||
assert ( height > 0 && height + bsh > 0 );
|
assert ( height > 0 && height + bsh > 0 );
|
||||||
assert ( rsw >= 0 );
|
assert ( rsw >= 0 );
|
||||||
assert ( bsh >= 0 );
|
assert ( bsh >= 0 );
|
||||||
std::size_t area_size;
|
|
||||||
bool realloc_success = false;
|
|
||||||
|
|
||||||
if ( ! area )
|
if ( ! area )
|
||||||
return;
|
return;
|
||||||
|
@ -692,7 +686,8 @@ void FVTerm::resizeArea ( const FRect& box
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
area_size = std::size_t((width + rsw) * (height + bsh));
|
bool realloc_success{false};
|
||||||
|
std::size_t area_size = std::size_t((width + rsw) * (height + bsh));
|
||||||
|
|
||||||
if ( area->height + area->bottom_shadow != height + bsh )
|
if ( area->height + area->bottom_shadow != height + bsh )
|
||||||
{
|
{
|
||||||
|
@ -847,11 +842,11 @@ void FVTerm::restoreVTerm (const FRect& box)
|
||||||
if ( h < 0 )
|
if ( h < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int ty = 0; ty < h; ty++)
|
for (int ty{0}; ty < h; ty++)
|
||||||
{
|
{
|
||||||
int ypos = y + ty;
|
int ypos = y + ty;
|
||||||
|
|
||||||
for (int tx = 0; tx < w; tx++)
|
for (int tx{0}; tx < w; tx++)
|
||||||
{
|
{
|
||||||
int xpos = x + tx;
|
int xpos = x + tx;
|
||||||
auto tc = &vterm->text[ypos * vterm->width + xpos]; // terminal character
|
auto tc = &vterm->text[ypos * vterm->width + xpos]; // terminal character
|
||||||
|
@ -943,7 +938,7 @@ void FVTerm::updateOverlappedColor ( term_area* area
|
||||||
// Terminal character
|
// Terminal character
|
||||||
auto tc = &vterm->text[ty * vterm->width + tx];
|
auto tc = &vterm->text[ty * vterm->width + tx];
|
||||||
// New character
|
// New character
|
||||||
charData nc;
|
charData nc{};
|
||||||
std::memcpy (&nc, ac, sizeof(nc));
|
std::memcpy (&nc, ac, sizeof(nc));
|
||||||
// Overlapped character
|
// Overlapped character
|
||||||
auto oc = getOverlappedCharacter (terminal_pos + FPoint(1, 1), area->widget);
|
auto oc = getOverlappedCharacter (terminal_pos + FPoint(1, 1), area->widget);
|
||||||
|
@ -1032,7 +1027,7 @@ void FVTerm::updateInheritBackground ( term_area* area
|
||||||
// Terminal character
|
// Terminal character
|
||||||
auto tc = &vterm->text[ty * vterm->width + tx];
|
auto tc = &vterm->text[ty * vterm->width + tx];
|
||||||
// New character
|
// New character
|
||||||
charData nc;
|
charData nc{};
|
||||||
std::memcpy (&nc, ac, sizeof(nc));
|
std::memcpy (&nc, ac, sizeof(nc));
|
||||||
// Covered character
|
// Covered character
|
||||||
auto cc = getCoveredCharacter (terminal_pos + FPoint(1, 1), area->widget);
|
auto cc = getCoveredCharacter (terminal_pos + FPoint(1, 1), area->widget);
|
||||||
|
@ -1213,7 +1208,7 @@ void FVTerm::updateVTerm (term_area* area)
|
||||||
else
|
else
|
||||||
y_end = height;
|
y_end = height;
|
||||||
|
|
||||||
for (int y = 0; y < y_end; y++) // Line loop
|
for (int y{0}; y < y_end; y++) // Line loop
|
||||||
{
|
{
|
||||||
int _xmin, _xmax;
|
int _xmin, _xmax;
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
@ -1284,16 +1279,15 @@ bool FVTerm::updateVTermCursor (term_area* area)
|
||||||
|
|
||||||
if ( area->input_cursor_visible )
|
if ( area->input_cursor_visible )
|
||||||
{
|
{
|
||||||
int cx, cy, ax, ay, x, y;
|
|
||||||
// area offset
|
// area offset
|
||||||
ax = area->offset_left;
|
int ax = area->offset_left;
|
||||||
ay = area->offset_top;
|
int ay = area->offset_top;
|
||||||
// area cursor position
|
// area cursor position
|
||||||
cx = area->input_cursor_x;
|
int cx = area->input_cursor_x;
|
||||||
cy = area->input_cursor_y;
|
int cy = area->input_cursor_y;
|
||||||
// terminal position
|
// terminal position
|
||||||
x = ax + cx;
|
int x = ax + cx;
|
||||||
y = ay + cy;
|
int y = ay + cy;
|
||||||
|
|
||||||
if ( isInsideArea (FPoint(cx, cy), area)
|
if ( isInsideArea (FPoint(cx, cy), area)
|
||||||
&& isInsideTerminal (FPoint(x, y))
|
&& isInsideTerminal (FPoint(x, y))
|
||||||
|
@ -1362,7 +1356,7 @@ void FVTerm::getArea (const FPoint& pos, term_area* area)
|
||||||
else
|
else
|
||||||
length = area->width;
|
length = area->width;
|
||||||
|
|
||||||
for (int y = 0; y < y_end; y++) // line loop
|
for (int y{0}; y < y_end; y++) // line loop
|
||||||
{
|
{
|
||||||
auto tc = &vterm->text[(ay + y) * vterm->width + ax]; // terminal character
|
auto tc = &vterm->text[(ay + y) * vterm->width + ax]; // terminal character
|
||||||
auto ac = &area->text[y * area->width]; // area character
|
auto ac = &area->text[y * area->width]; // area character
|
||||||
|
@ -1390,8 +1384,7 @@ void FVTerm::getArea (const FRect& box, term_area* area)
|
||||||
int h = int(box.getHeight());
|
int h = int(box.getHeight());
|
||||||
int dx = x - area->offset_left + 1;
|
int dx = x - area->offset_left + 1;
|
||||||
int dy = y - area->offset_top + 1;
|
int dy = y - area->offset_top + 1;
|
||||||
int y_end;
|
int y_end{}, length{};
|
||||||
int length;
|
|
||||||
|
|
||||||
if ( x < 0 || y < 0 )
|
if ( x < 0 || y < 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -1429,8 +1422,8 @@ void FVTerm::putArea (const FPoint& pos, term_area* area)
|
||||||
{
|
{
|
||||||
// Copies the given area block to the virtual terminal position
|
// Copies the given area block to the virtual terminal position
|
||||||
|
|
||||||
charData* tc; // terminal character
|
charData* tc{}; // terminal character
|
||||||
charData* ac; // area character
|
charData* ac{}; // area character
|
||||||
|
|
||||||
if ( ! area || ! area->visible )
|
if ( ! area || ! area->visible )
|
||||||
return;
|
return;
|
||||||
|
@ -1440,7 +1433,7 @@ void FVTerm::putArea (const FPoint& pos, term_area* area)
|
||||||
int width = area->width + area->right_shadow;
|
int width = area->width + area->right_shadow;
|
||||||
int height = area->height + area->bottom_shadow;
|
int height = area->height + area->bottom_shadow;
|
||||||
int ol = 0; // outside left
|
int ol = 0; // outside left
|
||||||
int y_end, length;
|
int y_end{}, length{};
|
||||||
|
|
||||||
if ( ax < 0 )
|
if ( ax < 0 )
|
||||||
{
|
{
|
||||||
|
@ -1461,7 +1454,7 @@ void FVTerm::putArea (const FPoint& pos, term_area* area)
|
||||||
if ( length < 1 )
|
if ( length < 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int y = 0; y < y_end; y++) // line loop
|
for (int y{0}; y < y_end; y++) // line loop
|
||||||
{
|
{
|
||||||
if ( area->changes[y].trans_count == 0 )
|
if ( area->changes[y].trans_count == 0 )
|
||||||
{
|
{
|
||||||
|
@ -1473,7 +1466,7 @@ void FVTerm::putArea (const FPoint& pos, term_area* area)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Line has one or more transparent characters
|
// Line has one or more transparent characters
|
||||||
for (int x = 0; x < length; x++) // column loop
|
for (int x{0}; x < length; x++) // column loop
|
||||||
{
|
{
|
||||||
int cx = ax + x;
|
int cx = ax + x;
|
||||||
int cy = ay + y;
|
int cy = ay + y;
|
||||||
|
@ -1497,12 +1490,9 @@ void FVTerm::putArea (const FPoint& pos, term_area* area)
|
||||||
void FVTerm::scrollAreaForward (term_area* area)
|
void FVTerm::scrollAreaForward (term_area* area)
|
||||||
{
|
{
|
||||||
// Scrolls the entire area up line down
|
// Scrolls the entire area up line down
|
||||||
int total_width
|
charData nc{}; // next character
|
||||||
, length
|
charData* lc{}; // last character
|
||||||
, y_max;
|
charData* dc{}; // destination character
|
||||||
charData nc; // next character
|
|
||||||
charData* lc; // last character
|
|
||||||
charData* dc; // destination character
|
|
||||||
|
|
||||||
if ( ! area )
|
if ( ! area )
|
||||||
return;
|
return;
|
||||||
|
@ -1510,11 +1500,11 @@ void FVTerm::scrollAreaForward (term_area* area)
|
||||||
if ( area->height <= 1 )
|
if ( area->height <= 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
length = area->width;
|
int length = area->width;
|
||||||
total_width = area->width + area->right_shadow;
|
int total_width = area->width + area->right_shadow;
|
||||||
y_max = area->height - 1;
|
int y_max = area->height - 1;
|
||||||
|
|
||||||
for (int y = 0; y < y_max; y++)
|
for (int y{0}; y < y_max; y++)
|
||||||
{
|
{
|
||||||
int pos1 = y * total_width;
|
int pos1 = y * total_width;
|
||||||
int pos2 = (y + 1) * total_width;
|
int pos2 = (y + 1) * total_width;
|
||||||
|
@ -1544,7 +1534,7 @@ void FVTerm::scrollAreaForward (term_area* area)
|
||||||
putArea (FPoint(1, 1), vdesktop);
|
putArea (FPoint(1, 1), vdesktop);
|
||||||
|
|
||||||
// avoid update lines from 0 to (y_max - 1)
|
// avoid update lines from 0 to (y_max - 1)
|
||||||
for (int y = 0; y < y_max; y++)
|
for (int y{0}; y < y_max; y++)
|
||||||
{
|
{
|
||||||
area->changes[y].xmin = uInt(area->width - 1);
|
area->changes[y].xmin = uInt(area->width - 1);
|
||||||
area->changes[y].xmax = 0;
|
area->changes[y].xmax = 0;
|
||||||
|
@ -1557,12 +1547,10 @@ void FVTerm::scrollAreaForward (term_area* area)
|
||||||
void FVTerm::scrollAreaReverse (term_area* area)
|
void FVTerm::scrollAreaReverse (term_area* area)
|
||||||
{
|
{
|
||||||
// Scrolls the entire area one line down
|
// Scrolls the entire area one line down
|
||||||
int total_width
|
|
||||||
, length
|
charData nc{}; // next character
|
||||||
, y_max;
|
charData* lc{}; // last character
|
||||||
charData nc; // next character
|
charData* dc{}; // destination character
|
||||||
charData* lc; // last character
|
|
||||||
charData* dc; // destination character
|
|
||||||
|
|
||||||
if ( ! area )
|
if ( ! area )
|
||||||
return;
|
return;
|
||||||
|
@ -1570,9 +1558,9 @@ void FVTerm::scrollAreaReverse (term_area* area)
|
||||||
if ( area->height <= 1 )
|
if ( area->height <= 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
length = area->width;
|
int length = area->width;
|
||||||
total_width = area->width + area->right_shadow;
|
int total_width = area->width + area->right_shadow;
|
||||||
y_max = area->height - 1;
|
int y_max = area->height - 1;
|
||||||
|
|
||||||
for (int y = y_max; y > 0; y--)
|
for (int y = y_max; y > 0; y--)
|
||||||
{
|
{
|
||||||
|
@ -1604,7 +1592,7 @@ void FVTerm::scrollAreaReverse (term_area* area)
|
||||||
putArea (FPoint(1, 1), vdesktop);
|
putArea (FPoint(1, 1), vdesktop);
|
||||||
|
|
||||||
// avoid update lines from 1 to y_max
|
// avoid update lines from 1 to y_max
|
||||||
for (int y = 1; y <= y_max; y++)
|
for (int y{1}; y <= y_max; y++)
|
||||||
{
|
{
|
||||||
area->changes[y].xmin = uInt(area->width - 1);
|
area->changes[y].xmin = uInt(area->width - 1);
|
||||||
area->changes[y].xmax = 0;
|
area->changes[y].xmax = 0;
|
||||||
|
@ -1618,7 +1606,7 @@ void FVTerm::clearArea (term_area* area, int fillchar)
|
||||||
{
|
{
|
||||||
// Clear the area with the current attributes
|
// Clear the area with the current attributes
|
||||||
|
|
||||||
charData nc; // next character
|
charData nc{}; // next character
|
||||||
|
|
||||||
// Current attributes with a space character
|
// Current attributes with a space character
|
||||||
std::memcpy (&nc, &next_attribute, sizeof(nc));
|
std::memcpy (&nc, &next_attribute, sizeof(nc));
|
||||||
|
@ -1640,7 +1628,7 @@ void FVTerm::clearArea (term_area* area, int fillchar)
|
||||||
else
|
else
|
||||||
clearAreaWithShadow(area, nc);
|
clearAreaWithShadow(area, nc);
|
||||||
|
|
||||||
for (int i = 0; i < area->height; i++)
|
for (int i{0}; i < area->height; i++)
|
||||||
{
|
{
|
||||||
area->changes[i].xmin = 0;
|
area->changes[i].xmin = 0;
|
||||||
area->changes[i].xmax = w - 1;
|
area->changes[i].xmax = w - 1;
|
||||||
|
@ -1655,7 +1643,7 @@ void FVTerm::clearArea (term_area* area, int fillchar)
|
||||||
area->changes[i].trans_count = 0;
|
area->changes[i].trans_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < area->bottom_shadow; i++)
|
for (int i{0}; i < area->bottom_shadow; i++)
|
||||||
{
|
{
|
||||||
int y = area->height + i;
|
int y = area->height + i;
|
||||||
area->changes[y].xmin = 0;
|
area->changes[y].xmin = 0;
|
||||||
|
@ -1672,7 +1660,7 @@ charData FVTerm::generateCharacter (const FPoint& pos)
|
||||||
// Generates characters for a given position considering all areas
|
// Generates characters for a given position considering all areas
|
||||||
|
|
||||||
int x = pos.getX();
|
int x = pos.getX();
|
||||||
int y =pos.getY();
|
int y = pos.getY();
|
||||||
auto sc = &vdesktop->text[y * vdesktop->width + x]; // shown character
|
auto sc = &vdesktop->text[y * vdesktop->width + x]; // shown character
|
||||||
|
|
||||||
if ( ! FWidget::window_list || FWidget::window_list->empty() )
|
if ( ! FWidget::window_list || FWidget::window_list->empty() )
|
||||||
|
@ -1893,11 +1881,6 @@ void FVTerm::init (bool disable_alt_screen)
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preset to false
|
|
||||||
terminal_update_pending = \
|
|
||||||
force_terminal_update = \
|
|
||||||
stop_terminal_updates = false;
|
|
||||||
|
|
||||||
// term_attribute stores the current state of the terminal
|
// term_attribute stores the current state of the terminal
|
||||||
term_attribute.code = '\0';
|
term_attribute.code = '\0';
|
||||||
term_attribute.fg_color = fc::Default;
|
term_attribute.fg_color = fc::Default;
|
||||||
|
@ -1994,8 +1977,7 @@ void FVTerm::putAreaCharacter ( const FPoint& pos, FVTerm* obj
|
||||||
if ( ac->attr.bit.transparent ) // Transparent
|
if ( ac->attr.bit.transparent ) // Transparent
|
||||||
{
|
{
|
||||||
// Restore one character on vterm
|
// Restore one character on vterm
|
||||||
charData ch;
|
charData ch = getCoveredCharacter (pos, obj);
|
||||||
ch = getCoveredCharacter (pos, obj);
|
|
||||||
std::memcpy (tc, &ch, sizeof(*tc));
|
std::memcpy (tc, &ch, sizeof(*tc));
|
||||||
}
|
}
|
||||||
else // Mot transparent
|
else // Mot transparent
|
||||||
|
@ -2003,8 +1985,7 @@ void FVTerm::putAreaCharacter ( const FPoint& pos, FVTerm* obj
|
||||||
if ( ac->attr.bit.trans_shadow ) // Transparent shadow
|
if ( ac->attr.bit.trans_shadow ) // Transparent shadow
|
||||||
{
|
{
|
||||||
// Get covered character + add the current color
|
// Get covered character + add the current color
|
||||||
charData ch;
|
charData ch = getCoveredCharacter (pos, obj);
|
||||||
ch = getCoveredCharacter (pos, obj);
|
|
||||||
ch.fg_color = ac->fg_color;
|
ch.fg_color = ac->fg_color;
|
||||||
ch.bg_color = ac->bg_color;
|
ch.bg_color = ac->bg_color;
|
||||||
ch.attr.bit.reverse = false;
|
ch.attr.bit.reverse = false;
|
||||||
|
@ -2023,9 +2004,9 @@ void FVTerm::putAreaCharacter ( const FPoint& pos, FVTerm* obj
|
||||||
else if ( ac->attr.bit.inherit_bg )
|
else if ( ac->attr.bit.inherit_bg )
|
||||||
{
|
{
|
||||||
// Add the covered background to this character
|
// Add the covered background to this character
|
||||||
charData ch, cc;
|
charData ch{};
|
||||||
std::memcpy (&ch, ac, sizeof(ch));
|
std::memcpy (&ch, ac, sizeof(ch));
|
||||||
cc = getCoveredCharacter (pos, obj);
|
charData cc = getCoveredCharacter (pos, obj);
|
||||||
ch.bg_color = cc.bg_color;
|
ch.bg_color = cc.bg_color;
|
||||||
std::memcpy (tc, &ch, sizeof(*tc));
|
std::memcpy (tc, &ch, sizeof(*tc));
|
||||||
}
|
}
|
||||||
|
@ -2104,7 +2085,7 @@ bool FVTerm::clearTerm (int fillchar)
|
||||||
{
|
{
|
||||||
term_pos->setPoint(-1, -1);
|
term_pos->setPoint(-1, -1);
|
||||||
|
|
||||||
for (int i = 0; i < int(getLineNumber()); i++)
|
for (int i{0}; i < int(getLineNumber()); i++)
|
||||||
{
|
{
|
||||||
setTermXY (0, i);
|
setTermXY (0, i);
|
||||||
appendOutputBuffer (cb);
|
appendOutputBuffer (cb);
|
||||||
|
@ -2135,7 +2116,7 @@ bool FVTerm::clearFullArea (term_area* area, charData& nc)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < vdesktop->height; i++)
|
for (int i{0}; i < vdesktop->height; i++)
|
||||||
{
|
{
|
||||||
vdesktop->changes[i].xmin = 0;
|
vdesktop->changes[i].xmin = 0;
|
||||||
vdesktop->changes[i].xmax = uInt(vdesktop->width) - 1;
|
vdesktop->changes[i].xmax = uInt(vdesktop->width) - 1;
|
||||||
|
@ -2155,7 +2136,7 @@ void FVTerm::clearAreaWithShadow (term_area* area, charData& nc)
|
||||||
int total_width = area->width + area->right_shadow;
|
int total_width = area->width + area->right_shadow;
|
||||||
t_char.attr.bit.transparent = true;
|
t_char.attr.bit.transparent = true;
|
||||||
|
|
||||||
for (int y = 0; y < area->height; y++)
|
for (int y{0}; y < area->height; y++)
|
||||||
{
|
{
|
||||||
int pos = y * total_width;
|
int pos = y * total_width;
|
||||||
// Clear area
|
// Clear area
|
||||||
|
@ -2165,7 +2146,7 @@ void FVTerm::clearAreaWithShadow (term_area* area, charData& nc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make bottom shadow transparent
|
// Make bottom shadow transparent
|
||||||
for (int y = 0; y < area->bottom_shadow; y++)
|
for (int y{0}; y < area->bottom_shadow; y++)
|
||||||
{
|
{
|
||||||
int pos = total_width * (y + area->height);
|
int pos = total_width * (y + area->height);
|
||||||
std::fill_n (&area->text[pos], total_width, t_char);
|
std::fill_n (&area->text[pos], total_width, t_char);
|
||||||
|
@ -2223,7 +2204,7 @@ bool FVTerm::canClearLeadingWS (uInt& xmin, uInt y)
|
||||||
bool normal = FTerm::isNormal(first_char);
|
bool normal = FTerm::isNormal(first_char);
|
||||||
bool& ut = FTermcap::background_color_erase;
|
bool& ut = FTermcap::background_color_erase;
|
||||||
|
|
||||||
for (uInt x = 1; x < uInt(vt->width); x++)
|
for (uInt x{1}; x < uInt(vt->width); x++)
|
||||||
{
|
{
|
||||||
auto ch = &vt->text[y * uInt(vt->width) + x];
|
auto ch = &vt->text[y * uInt(vt->width) + x];
|
||||||
|
|
||||||
|
@ -2294,7 +2275,7 @@ bool FVTerm::skipUnchangedCharacters(uInt& x, uInt xmax, uInt y)
|
||||||
|
|
||||||
if ( print_char->attr.bit.no_changes )
|
if ( print_char->attr.bit.no_changes )
|
||||||
{
|
{
|
||||||
uInt count = 1;
|
uInt count{1};
|
||||||
|
|
||||||
for (uInt i = x + 1; i <= xmax; i++)
|
for (uInt i = x + 1; i <= xmax; i++)
|
||||||
{
|
{
|
||||||
|
@ -2407,7 +2388,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
|
||||||
{
|
{
|
||||||
x--;
|
x--;
|
||||||
|
|
||||||
for (uInt i = 0; i < whitespace; i++, x++)
|
for (uInt i{0}; i < whitespace; i++, x++)
|
||||||
appendCharacter (print_char);
|
appendCharacter (print_char);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2429,7 +2410,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y)
|
||||||
if ( ! rp )
|
if ( ! rp )
|
||||||
return not_used;
|
return not_used;
|
||||||
|
|
||||||
uInt repetitions = 1;
|
uInt repetitions{1};
|
||||||
|
|
||||||
for (uInt i = x + 1; i <= xmax; i++)
|
for (uInt i = x + 1; i <= xmax; i++)
|
||||||
{
|
{
|
||||||
|
@ -2464,7 +2445,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y)
|
||||||
{
|
{
|
||||||
x--;
|
x--;
|
||||||
|
|
||||||
for (uInt i = 0; i < repetitions; i++, x++)
|
for (uInt i{0}; i < repetitions; i++, x++)
|
||||||
appendCharacter (print_char);
|
appendCharacter (print_char);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2504,11 +2485,11 @@ void FVTerm::cursorWrap()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FVTerm::printWrap (term_area* area)
|
bool FVTerm::printWrap (term_area* area)
|
||||||
{
|
{
|
||||||
bool end_of_area = false;
|
bool end_of_area{false};
|
||||||
int width = area->width,
|
int width = area->width
|
||||||
height = area->height,
|
, height = area->height
|
||||||
rsh = area->right_shadow,
|
, rsh = area->right_shadow
|
||||||
bsh = area->bottom_shadow;
|
, bsh = area->bottom_shadow;
|
||||||
|
|
||||||
// Line break at right margin
|
// Line break at right margin
|
||||||
if ( area->cursor_x > width + rsh )
|
if ( area->cursor_x > width + rsh )
|
||||||
|
@ -2804,15 +2785,14 @@ int FVTerm::appendLowerRight (charData*& screen_char)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int x, y;
|
|
||||||
auto& IC = TCAP(fc::t_parm_ich);
|
auto& IC = TCAP(fc::t_parm_ich);
|
||||||
auto& im = TCAP(fc::t_enter_insert_mode);
|
auto& im = TCAP(fc::t_enter_insert_mode);
|
||||||
auto& ei = TCAP(fc::t_exit_insert_mode);
|
auto& ei = TCAP(fc::t_exit_insert_mode);
|
||||||
auto& ip = TCAP(fc::t_insert_padding);
|
auto& ip = TCAP(fc::t_insert_padding);
|
||||||
auto& ic = TCAP(fc::t_insert_character);
|
auto& ic = TCAP(fc::t_insert_character);
|
||||||
|
|
||||||
x = int(getColumnNumber()) - 2;
|
int x = int(getColumnNumber()) - 2;
|
||||||
y = int(getLineNumber()) - 1;
|
int y = int(getLineNumber()) - 1;
|
||||||
setTermXY (x, y);
|
setTermXY (x, y);
|
||||||
appendChar (screen_char);
|
appendChar (screen_char);
|
||||||
term_pos->x_ref()++;
|
term_pos->x_ref()++;
|
||||||
|
|
|
@ -35,21 +35,21 @@ namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
// global FWidget object
|
// global FWidget object
|
||||||
static FWidget* rootObject = nullptr;
|
static FWidget* rootObject{nullptr};
|
||||||
|
|
||||||
// static class attributes
|
// static class attributes
|
||||||
FStatusBar* FWidget::statusbar = nullptr;
|
FStatusBar* FWidget::statusbar{nullptr};
|
||||||
FMenuBar* FWidget::menubar = nullptr;
|
FMenuBar* FWidget::menubar{nullptr};
|
||||||
FWidget* FWidget::show_root_widget = nullptr;
|
FWidget* FWidget::show_root_widget{nullptr};
|
||||||
FWidget* FWidget::redraw_root_widget = nullptr;
|
FWidget* FWidget::redraw_root_widget{nullptr};
|
||||||
FWidget::widgetList* FWidget::window_list = nullptr;
|
FWidget::widgetList* FWidget::window_list{nullptr};
|
||||||
FWidget::widgetList* FWidget::dialog_list = nullptr;
|
FWidget::widgetList* FWidget::dialog_list{nullptr};
|
||||||
FWidget::widgetList* FWidget::always_on_top_list = nullptr;
|
FWidget::widgetList* FWidget::always_on_top_list{nullptr};
|
||||||
FWidget::widgetList* FWidget::close_widget = nullptr;
|
FWidget::widgetList* FWidget::close_widget{nullptr};
|
||||||
FWidgetColors FWidget::wc;
|
FWidgetColors FWidget::wc{};
|
||||||
bool FWidget::init_desktop;
|
bool FWidget::init_desktop{false};
|
||||||
bool FWidget::hideable;
|
bool FWidget::hideable{false};
|
||||||
uInt FWidget::modal_dialogs;
|
uInt FWidget::modal_dialogs{};
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FWidget
|
// class FWidget
|
||||||
|
@ -344,7 +344,7 @@ void FWidget::setY (int y, bool adjust)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::setPos (const FPoint& p, bool adjust)
|
void FWidget::setPos (const FPoint& p, bool adjust)
|
||||||
{
|
{
|
||||||
FPoint pos = p;
|
FPoint pos(p);
|
||||||
|
|
||||||
if ( getX() == pos.getX() && wsize.getX() == pos.getX()
|
if ( getX() == pos.getX() && wsize.getX() == pos.getX()
|
||||||
&& getY() == pos.getY() && wsize.getY() == pos.getY() )
|
&& getY() == pos.getY() && wsize.getY() == pos.getY() )
|
||||||
|
@ -668,7 +668,7 @@ void FWidget::setPrintPos (const FPoint& pos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::setDoubleFlatLine (fc::sides side, bool bit)
|
void FWidget::setDoubleFlatLine (fc::sides side, bool bit)
|
||||||
{
|
{
|
||||||
uLong length;
|
uLong length{};
|
||||||
|
|
||||||
assert ( side == fc::top
|
assert ( side == fc::top
|
||||||
|| side == fc::right
|
|| side == fc::right
|
||||||
|
@ -702,8 +702,6 @@ void FWidget::setDoubleFlatLine (fc::sides side, bool bit)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::setDoubleFlatLine (fc::sides side, int pos, bool bit)
|
void FWidget::setDoubleFlatLine (fc::sides side, int pos, bool bit)
|
||||||
{
|
{
|
||||||
uLong length, index;
|
|
||||||
|
|
||||||
assert ( side == fc::top
|
assert ( side == fc::top
|
||||||
|| side == fc::right
|
|| side == fc::right
|
||||||
|| side == fc::bottom
|
|| side == fc::bottom
|
||||||
|
@ -711,7 +709,8 @@ void FWidget::setDoubleFlatLine (fc::sides side, int pos, bool bit)
|
||||||
|
|
||||||
assert ( pos >= 1 );
|
assert ( pos >= 1 );
|
||||||
|
|
||||||
index = uLong(pos - 1);
|
uLong length{};
|
||||||
|
uLong index = uLong(pos - 1);
|
||||||
|
|
||||||
switch ( side )
|
switch ( side )
|
||||||
{
|
{
|
||||||
|
@ -789,7 +788,7 @@ int FWidget::numOfFocusableChildren()
|
||||||
if ( ! hasChildren() )
|
if ( ! hasChildren() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int num = 0;
|
int num{0};
|
||||||
auto iter = FObject::begin();
|
auto iter = FObject::begin();
|
||||||
auto last = FObject::end();
|
auto last = FObject::end();
|
||||||
|
|
||||||
|
@ -840,7 +839,7 @@ void FWidget::addCallback ( const FString& cb_signal
|
||||||
, FDataPtr data )
|
, FDataPtr data )
|
||||||
{
|
{
|
||||||
// add a (normal) function pointer as callback
|
// add a (normal) function pointer as callback
|
||||||
callback_data obj = { cb_signal, cb_handler, data };
|
callback_data obj{ cb_signal, cb_handler, data };
|
||||||
callback_objects.push_back(obj);
|
callback_objects.push_back(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,7 +850,7 @@ void FWidget::addCallback ( const FString& cb_signal
|
||||||
, FDataPtr data )
|
, FDataPtr data )
|
||||||
{
|
{
|
||||||
// add a member function pointer as callback
|
// add a member function pointer as callback
|
||||||
member_callback_data obj = { cb_signal, cb_instance, cb_handler, data };
|
member_callback_data obj{ cb_signal, cb_instance, cb_handler, data };
|
||||||
member_callback_objects.push_back(obj);
|
member_callback_objects.push_back(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1021,9 +1020,9 @@ void FWidget::resize()
|
||||||
{
|
{
|
||||||
if ( isRootWidget() )
|
if ( isRootWidget() )
|
||||||
{
|
{
|
||||||
FRect old_term_geometry = getTermGeometry();
|
FRect old_term_geometry (getTermGeometry());
|
||||||
detectTermSize();
|
detectTermSize();
|
||||||
FRect term_geometry = getTermGeometry();
|
FRect term_geometry (getTermGeometry());
|
||||||
term_geometry.move (-1, -1);
|
term_geometry.move (-1, -1);
|
||||||
|
|
||||||
if ( old_term_geometry.getSize() == term_geometry.getSize() )
|
if ( old_term_geometry.getSize() == term_geometry.getSize() )
|
||||||
|
@ -1278,7 +1277,7 @@ void FWidget::clearShadow()
|
||||||
|
|
||||||
if ( w <= offset.getX2() )
|
if ( w <= offset.getX2() )
|
||||||
{
|
{
|
||||||
for (std::size_t y = 1; y <= getHeight(); y++)
|
for (std::size_t y{1}; y <= getHeight(); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(w + 1, int(y)) << ' '; // clear █
|
print() << FPoint(w + 1, int(y)) << ' '; // clear █
|
||||||
}
|
}
|
||||||
|
@ -1288,7 +1287,7 @@ void FWidget::clearShadow()
|
||||||
{
|
{
|
||||||
print() << FPoint(2, h + 1);
|
print() << FPoint(2, h + 1);
|
||||||
|
|
||||||
for (std::size_t i = 1; i <= getWidth(); i++)
|
for (std::size_t i{1}; i <= getWidth(); i++)
|
||||||
print (' '); // clear ▀
|
print (' '); // clear ▀
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1312,7 +1311,7 @@ void FWidget::drawFlatBorder()
|
||||||
else
|
else
|
||||||
setColor (wc.dialog_fg, wc.dialog_bg);
|
setColor (wc.dialog_fg, wc.dialog_bg);
|
||||||
|
|
||||||
for (std::size_t y = 0; y < getHeight(); y++)
|
for (std::size_t y{0}; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(x1 - 1, y1 + int(y) + 1);
|
print() << FPoint(x1 - 1, y1 + int(y) + 1);
|
||||||
|
|
||||||
|
@ -1326,7 +1325,7 @@ void FWidget::drawFlatBorder()
|
||||||
|
|
||||||
print() << FPoint(x2, y1 + 1);
|
print() << FPoint(x2, y1 + 1);
|
||||||
|
|
||||||
for (std::size_t y = 0; y < getHeight(); y++)
|
for (std::size_t y{0}; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
if ( double_flatline_mask.right[y] )
|
if ( double_flatline_mask.right[y] )
|
||||||
// left+right line (on right side)
|
// left+right line (on right side)
|
||||||
|
@ -1340,7 +1339,7 @@ void FWidget::drawFlatBorder()
|
||||||
|
|
||||||
print() << FPoint(x1, y1);
|
print() << FPoint(x1, y1);
|
||||||
|
|
||||||
for (std::size_t x = 0; x < getWidth(); x++)
|
for (std::size_t x{0}; x < getWidth(); x++)
|
||||||
{
|
{
|
||||||
if ( double_flatline_mask.top[x] )
|
if ( double_flatline_mask.top[x] )
|
||||||
// top+bottom line (at top)
|
// top+bottom line (at top)
|
||||||
|
@ -1352,7 +1351,7 @@ void FWidget::drawFlatBorder()
|
||||||
|
|
||||||
print() << FPoint(x1, y2);
|
print() << FPoint(x1, y2);
|
||||||
|
|
||||||
for (std::size_t x = 0; x < getWidth(); x++)
|
for (std::size_t x{0}; x < getWidth(); x++)
|
||||||
{
|
{
|
||||||
if ( double_flatline_mask.bottom[x] )
|
if ( double_flatline_mask.bottom[x] )
|
||||||
// top+bottom line (at bottom)
|
// top+bottom line (at bottom)
|
||||||
|
@ -1380,7 +1379,7 @@ void FWidget::clearFlatBorder()
|
||||||
setColor (wc.dialog_fg, wc.dialog_bg);
|
setColor (wc.dialog_fg, wc.dialog_bg);
|
||||||
|
|
||||||
// clear on left side
|
// clear on left side
|
||||||
for (std::size_t y = 0; y < getHeight(); y++)
|
for (std::size_t y{0}; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(x1 - 1, y1 + int(y) + 1);
|
print() << FPoint(x1 - 1, y1 + int(y) + 1);
|
||||||
|
|
||||||
|
@ -1391,7 +1390,7 @@ void FWidget::clearFlatBorder()
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear on right side
|
// clear on right side
|
||||||
for (std::size_t y = 0; y < getHeight(); y++)
|
for (std::size_t y{0}; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(x2, y1 + int(y) + 1);
|
print() << FPoint(x2, y1 + int(y) + 1);
|
||||||
|
|
||||||
|
@ -1404,7 +1403,7 @@ void FWidget::clearFlatBorder()
|
||||||
// clear at top
|
// clear at top
|
||||||
print() << FPoint(x1, y1);
|
print() << FPoint(x1, y1);
|
||||||
|
|
||||||
for (std::size_t x = 0; x < getWidth(); x++)
|
for (std::size_t x{0}; x < getWidth(); x++)
|
||||||
{
|
{
|
||||||
if ( double_flatline_mask.top[x] )
|
if ( double_flatline_mask.top[x] )
|
||||||
print (fc::NF_border_line_upper);
|
print (fc::NF_border_line_upper);
|
||||||
|
@ -1415,7 +1414,7 @@ void FWidget::clearFlatBorder()
|
||||||
// clear at bottom
|
// clear at bottom
|
||||||
print() << FPoint(x1, y2);
|
print() << FPoint(x1, y2);
|
||||||
|
|
||||||
for (std::size_t x = 0; x < getWidth(); x++)
|
for (std::size_t x{0}; x < getWidth(); x++)
|
||||||
{
|
{
|
||||||
if ( double_flatline_mask.bottom[x] )
|
if ( double_flatline_mask.bottom[x] )
|
||||||
print (fc::NF_border_line_bottom);
|
print (fc::NF_border_line_bottom);
|
||||||
|
@ -1442,7 +1441,7 @@ FVTerm::term_area* FWidget::getPrintArea()
|
||||||
return print_area;
|
return print_area;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FWidget* obj;
|
FWidget* obj{};
|
||||||
FWidget* p_obj = this;
|
FWidget* p_obj = this;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -1603,7 +1602,7 @@ void FWidget::hideSize (const FSize& size)
|
||||||
if ( size.isEmpty() )
|
if ( size.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FColor fg, bg;
|
FColor fg{}, bg{};
|
||||||
auto parent_widget = getParentWidget();
|
auto parent_widget = getParentWidget();
|
||||||
|
|
||||||
if ( parent_widget )
|
if ( parent_widget )
|
||||||
|
@ -1623,7 +1622,7 @@ void FWidget::hideSize (const FSize& size)
|
||||||
if ( blank == 0 )
|
if ( blank == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int y = 0; y < int(size.getWidth()); y++)
|
for (int y{0}; y < int(size.getWidth()); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(1, 1 + y) << blank;
|
print() << FPoint(1, 1 + y) << blank;
|
||||||
}
|
}
|
||||||
|
@ -1664,7 +1663,7 @@ bool FWidget::focusNextChild()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
FWidget* next = nullptr;
|
FWidget* next{nullptr};
|
||||||
auto next_element = iter;
|
auto next_element = iter;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -1723,7 +1722,7 @@ bool FWidget::focusPrevChild()
|
||||||
if ( w != this )
|
if ( w != this )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
FWidget* prev = nullptr;
|
FWidget* prev{nullptr};
|
||||||
auto prev_element = iter;
|
auto prev_element = iter;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -2050,7 +2049,7 @@ inline void FWidget::insufficientSpaceAdjust()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::KeyPressEvent (FKeyEvent* kev)
|
void FWidget::KeyPressEvent (FKeyEvent* kev)
|
||||||
{
|
{
|
||||||
bool accpt_focus = false;
|
bool accpt_focus{false};
|
||||||
|
|
||||||
if ( kev->key() == fc::Fkey_tab )
|
if ( kev->key() == fc::Fkey_tab )
|
||||||
accpt_focus = focusNextChild();
|
accpt_focus = focusNextChild();
|
||||||
|
@ -2060,7 +2059,7 @@ void FWidget::KeyPressEvent (FKeyEvent* kev)
|
||||||
if ( accpt_focus )
|
if ( accpt_focus )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FWidget* widget = this;
|
FWidget* widget(this);
|
||||||
|
|
||||||
while ( widget )
|
while ( widget )
|
||||||
{
|
{
|
||||||
|
@ -2089,7 +2088,7 @@ void FWidget::KeyPressEvent (FKeyEvent* kev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::KeyDownEvent (FKeyEvent* kev)
|
void FWidget::KeyDownEvent (FKeyEvent* kev)
|
||||||
{
|
{
|
||||||
FWidget* widget = this;
|
FWidget* widget(this);
|
||||||
|
|
||||||
while ( widget )
|
while ( widget )
|
||||||
{
|
{
|
||||||
|
@ -2151,7 +2150,7 @@ void FWidget::draw()
|
||||||
void FWidget::drawWindows()
|
void FWidget::drawWindows()
|
||||||
{
|
{
|
||||||
// redraw windows
|
// redraw windows
|
||||||
charData default_char;
|
charData default_char{};
|
||||||
default_char.code = ' ';
|
default_char.code = ' ';
|
||||||
default_char.fg_color = fc::Black;
|
default_char.fg_color = fc::Black;
|
||||||
default_char.bg_color = fc::Black;
|
default_char.bg_color = fc::Black;
|
||||||
|
@ -2216,7 +2215,7 @@ void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
|
||||||
setColor (wc.shadow_bg, wc.shadow_fg);
|
setColor (wc.shadow_bg, wc.shadow_fg);
|
||||||
setTransShadow();
|
setTransShadow();
|
||||||
|
|
||||||
for (std::size_t y = 1; y < getHeight(); y++)
|
for (std::size_t y{1}; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(x2 + 1, y1 + int(y)) << " ";
|
print() << FPoint(x2 + 1, y1 + int(y)) << " ";
|
||||||
}
|
}
|
||||||
|
@ -2229,7 +2228,7 @@ void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
|
||||||
setColor (wc.shadow_bg, wc.shadow_fg);
|
setColor (wc.shadow_bg, wc.shadow_fg);
|
||||||
setTransShadow();
|
setTransShadow();
|
||||||
|
|
||||||
for (std::size_t x = 2; x <= getWidth() + 1; x++)
|
for (std::size_t x{2}; x <= getWidth() + 1; x++)
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
unsetTransShadow();
|
unsetTransShadow();
|
||||||
|
@ -2263,7 +2262,7 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
||||||
if ( isWindowWidget() )
|
if ( isWindowWidget() )
|
||||||
unsetInheritBackground();
|
unsetInheritBackground();
|
||||||
|
|
||||||
for (std::size_t y = 1; y < getHeight(); y++)
|
for (std::size_t y{1}; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(x2 + 1, y1 + int(y)) << block; // █
|
print() << FPoint(x2 + 1, y1 + int(y)) << block; // █
|
||||||
}
|
}
|
||||||
|
@ -2273,7 +2272,7 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
||||||
if ( isWindowWidget() )
|
if ( isWindowWidget() )
|
||||||
setInheritBackground();
|
setInheritBackground();
|
||||||
|
|
||||||
for (std::size_t x = 1; x <= getWidth(); x++)
|
for (std::size_t x{1}; x <= getWidth(); x++)
|
||||||
print (fc::UpperHalfBlock); // ▀
|
print (fc::UpperHalfBlock); // ▀
|
||||||
|
|
||||||
if ( isWindowWidget() )
|
if ( isWindowWidget() )
|
||||||
|
@ -2330,7 +2329,7 @@ FKey getHotkey (const FString& text)
|
||||||
|
|
||||||
std::size_t length = text.getLength();
|
std::size_t length = text.getLength();
|
||||||
|
|
||||||
for (std::size_t i = 0; i < length; i++)
|
for (std::size_t i{0}; i < length; i++)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -2350,11 +2349,11 @@ std::size_t getHotkeyPos (wchar_t src[], wchar_t dest[], std::size_t length)
|
||||||
{
|
{
|
||||||
// Find hotkey position in string
|
// Find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
wchar_t* txt = src;
|
const wchar_t* txt = src;
|
||||||
constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
constexpr std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
std::size_t hotkeypos = NOT_SET;
|
std::size_t hotkeypos{NOT_SET};
|
||||||
|
|
||||||
for (std::size_t i = 0; i < length; i++)
|
for (std::size_t i{0}; i < length; i++)
|
||||||
{
|
{
|
||||||
if ( i < length && txt[i] == L'&' && hotkeypos == NOT_SET )
|
if ( i < length && txt[i] == L'&' && hotkeypos == NOT_SET )
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace finalcut
|
||||||
{
|
{
|
||||||
|
|
||||||
// static attributes
|
// static attributes
|
||||||
FWindow* FWindow::previous_window = nullptr;
|
FWindow* FWindow::previous_window{nullptr};
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -45,7 +45,7 @@ FWindow::FWindow(FWidget* parent)
|
||||||
: FWidget(parent)
|
: FWidget(parent)
|
||||||
{
|
{
|
||||||
setWindowWidget();
|
setWindowWidget();
|
||||||
FRect geometry = getTermGeometry();
|
FRect geometry (getTermGeometry());
|
||||||
geometry.move(-1, -1);
|
geometry.move(-1, -1);
|
||||||
createArea (geometry, getShadow(), vwin);
|
createArea (geometry, getShadow(), vwin);
|
||||||
addWindow (this);
|
addWindow (this);
|
||||||
|
@ -322,7 +322,7 @@ void FWindow::setY (int y, bool adjust)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWindow::setPos (const FPoint& p, bool adjust)
|
void FWindow::setPos (const FPoint& p, bool adjust)
|
||||||
{
|
{
|
||||||
FPoint pos = p;
|
FPoint pos(p);
|
||||||
|
|
||||||
if ( pos.getY() < 1 )
|
if ( pos.getY() < 1 )
|
||||||
pos.setY(1);
|
pos.setY(1);
|
||||||
|
@ -344,7 +344,7 @@ void FWindow::setWidth (std::size_t w, bool adjust)
|
||||||
|
|
||||||
if ( isVirtualWindow() && getWidth() != old_width )
|
if ( isVirtualWindow() && getWidth() != old_width )
|
||||||
{
|
{
|
||||||
FRect geometry = getTermGeometry();
|
FRect geometry (getTermGeometry());
|
||||||
geometry.move(-1, -1);
|
geometry.move(-1, -1);
|
||||||
resizeArea (geometry, getShadow(), vwin);
|
resizeArea (geometry, getShadow(), vwin);
|
||||||
}
|
}
|
||||||
|
@ -358,7 +358,7 @@ void FWindow::setHeight (std::size_t h, bool adjust)
|
||||||
|
|
||||||
if ( isVirtualWindow() && getHeight() != old_height )
|
if ( isVirtualWindow() && getHeight() != old_height )
|
||||||
{
|
{
|
||||||
FRect geometry = getTermGeometry();
|
FRect geometry (getTermGeometry());
|
||||||
geometry.move(-1, -1);
|
geometry.move(-1, -1);
|
||||||
resizeArea (geometry, getShadow(), vwin);
|
resizeArea (geometry, getShadow(), vwin);
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ void FWindow::setSize (const FSize& size, bool adjust)
|
||||||
if ( isVirtualWindow()
|
if ( isVirtualWindow()
|
||||||
&& (getWidth() != old_width || getHeight() != old_height) )
|
&& (getWidth() != old_width || getHeight() != old_height) )
|
||||||
{
|
{
|
||||||
FRect geometry = getTermGeometry();
|
FRect geometry (getTermGeometry());
|
||||||
geometry.move(-1, -1);
|
geometry.move(-1, -1);
|
||||||
resizeArea (geometry, getShadow(), vwin);
|
resizeArea (geometry, getShadow(), vwin);
|
||||||
}
|
}
|
||||||
|
@ -387,8 +387,8 @@ void FWindow::setGeometry ( const FPoint& p, const FSize& size, bool adjust)
|
||||||
|
|
||||||
int old_x = getX();
|
int old_x = getX();
|
||||||
int old_y = getY();
|
int old_y = getY();
|
||||||
FPoint pos = p;
|
FPoint pos(p);
|
||||||
FSize old_size = getSize();
|
FSize old_size(getSize());
|
||||||
|
|
||||||
if ( pos.getY() < 1 )
|
if ( pos.getY() < 1 )
|
||||||
pos.setY(1);
|
pos.setY(1);
|
||||||
|
@ -400,7 +400,7 @@ void FWindow::setGeometry ( const FPoint& p, const FSize& size, bool adjust)
|
||||||
|
|
||||||
if ( getSize() != old_size )
|
if ( getSize() != old_size )
|
||||||
{
|
{
|
||||||
FRect geometry = getTermGeometry();
|
FRect geometry (getTermGeometry());
|
||||||
geometry.move(-1, -1);
|
geometry.move(-1, -1);
|
||||||
resizeArea (geometry, getShadow(), vwin);
|
resizeArea (geometry, getShadow(), vwin);
|
||||||
}
|
}
|
||||||
|
@ -659,7 +659,7 @@ bool FWindow::zoomWindow()
|
||||||
if ( zoomed )
|
if ( zoomed )
|
||||||
{
|
{
|
||||||
zoomed = false;
|
zoomed = false;
|
||||||
FRect oldGeometry = getTermGeometryWithShadow();
|
FRect oldGeometry (getTermGeometryWithShadow());
|
||||||
setGeometry (normalGeometry);
|
setGeometry (normalGeometry);
|
||||||
restoreVTerm (oldGeometry);
|
restoreVTerm (oldGeometry);
|
||||||
redraw();
|
redraw();
|
||||||
|
@ -669,7 +669,7 @@ bool FWindow::zoomWindow()
|
||||||
zoomed = true;
|
zoomed = true;
|
||||||
// save the current geometry
|
// save the current geometry
|
||||||
normalGeometry = getGeometry();
|
normalGeometry = getGeometry();
|
||||||
FRect oldGeometry = getTermGeometryWithShadow();
|
FRect oldGeometry (getTermGeometryWithShadow());
|
||||||
setGeometry (FPoint(1, 1), FSize(getMaxWidth(), getMaxHeight()));
|
setGeometry (FPoint(1, 1), FSize(getMaxWidth(), getMaxHeight()));
|
||||||
restoreVTerm (oldGeometry);
|
restoreVTerm (oldGeometry);
|
||||||
redraw();
|
redraw();
|
||||||
|
|
|
@ -275,7 +275,7 @@ inline bool FDialog::unsetScrollable()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FDialog::setText (const FString& txt)
|
inline void FDialog::setText (const FString& txt)
|
||||||
{ tb_text = txt; }
|
{ tb_text.setString(txt); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FDialog::isModal()
|
inline bool FDialog::isModal()
|
||||||
|
|
|
@ -126,7 +126,7 @@ inline FDataPtr FListBoxItem::getData() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBoxItem::setText (const FString& txt)
|
inline void FListBoxItem::setText (const FString& txt)
|
||||||
{ text = txt; }
|
{ text.setString(txt); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBoxItem::setData (FDataPtr data)
|
inline void FListBoxItem::setData (FDataPtr data)
|
||||||
|
|
|
@ -587,7 +587,7 @@ FObject::FObjectIterator
|
||||||
, std::back_inserter(str_cols)
|
, std::back_inserter(str_cols)
|
||||||
, [] (const T& col) -> const FString
|
, [] (const T& col) -> const FString
|
||||||
{
|
{
|
||||||
const FString s = FString() << col;
|
const FString s(FString() << col);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -623,7 +623,7 @@ FObject::FObjectIterator
|
||||||
, std::back_inserter(str_cols)
|
, std::back_inserter(str_cols)
|
||||||
, [] (const ColT& col) -> const FString
|
, [] (const ColT& col) -> const FString
|
||||||
{
|
{
|
||||||
const FString s = FString() << col;
|
const FString s(FString() << col);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -213,12 +213,11 @@ int FMessageBox::info ( FWidget* parent
|
||||||
, int button1
|
, int button1
|
||||||
, int button2 )
|
, int button2 )
|
||||||
{
|
{
|
||||||
int reply;
|
|
||||||
FMessageBox mbox ( caption
|
FMessageBox mbox ( caption
|
||||||
, FString() << message
|
, FString() << message
|
||||||
, button0, button1, button2
|
, button0, button1, button2
|
||||||
, parent );
|
, parent );
|
||||||
reply = mbox.exec();
|
int reply = mbox.exec();
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,8 +229,7 @@ int FMessageBox::error ( FWidget* parent
|
||||||
, int button1
|
, int button1
|
||||||
, int button2 )
|
, int button2 )
|
||||||
{
|
{
|
||||||
int reply;
|
const FString caption{"Error message"};
|
||||||
const FString& caption = "Error message";
|
|
||||||
FMessageBox mbox ( caption
|
FMessageBox mbox ( caption
|
||||||
, FString() << message
|
, FString() << message
|
||||||
, button0, button1, button2
|
, button0, button1, button2
|
||||||
|
@ -241,8 +239,8 @@ int FMessageBox::error ( FWidget* parent
|
||||||
mbox.setCenterText();
|
mbox.setCenterText();
|
||||||
mbox.setForegroundColor(mbox.wc.error_box_fg);
|
mbox.setForegroundColor(mbox.wc.error_box_fg);
|
||||||
mbox.setBackgroundColor(mbox.wc.error_box_bg);
|
mbox.setBackgroundColor(mbox.wc.error_box_bg);
|
||||||
mbox.emphasis_color = mbox.wc.error_box_emphasis_fg;
|
mbox.emphasis_color = mbox.wc.error_box_emphasis_fg;
|
||||||
reply = mbox.exec();
|
int reply = mbox.exec();
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ inline void FObject::setWidgetProperty (bool property)
|
||||||
|
|
||||||
static inline timeval operator + (const timeval& t1, const timeval& t2)
|
static inline timeval operator + (const timeval& t1, const timeval& t2)
|
||||||
{
|
{
|
||||||
timeval tmp;
|
timeval tmp{};
|
||||||
tmp.tv_sec = t1.tv_sec + t2.tv_sec;
|
tmp.tv_sec = t1.tv_sec + t2.tv_sec;
|
||||||
|
|
||||||
if ( (tmp.tv_usec = t1.tv_usec + t2.tv_usec) >= 1000000 )
|
if ( (tmp.tv_usec = t1.tv_usec + t2.tv_usec) >= 1000000 )
|
||||||
|
@ -258,7 +258,7 @@ static inline timeval operator + (const timeval& t1, const timeval& t2)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
static inline timeval operator - (const timeval& t1, const timeval& t2)
|
static inline timeval operator - (const timeval& t1, const timeval& t2)
|
||||||
{
|
{
|
||||||
timeval tmp;
|
timeval tmp{};
|
||||||
tmp.tv_sec = t1.tv_sec - t2.tv_sec;
|
tmp.tv_sec = t1.tv_sec - t2.tv_sec;
|
||||||
|
|
||||||
if ( (tmp.tv_usec = t1.tv_usec - t2.tv_usec) < 0 )
|
if ( (tmp.tv_usec = t1.tv_usec - t2.tv_usec) < 0 )
|
||||||
|
|
|
@ -153,7 +153,7 @@ inline void FStatusKey::setKey (FKey k)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FStatusKey::setText (const FString& txt)
|
inline void FStatusKey::setText (const FString& txt)
|
||||||
{ text = txt; }
|
{ text.setString(txt); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FStatusKey::unsetActive()
|
inline void FStatusKey::unsetActive()
|
||||||
|
|
|
@ -200,7 +200,7 @@ class FString
|
||||||
wchar_t back() const;
|
wchar_t back() const;
|
||||||
|
|
||||||
FString& sprintf (const FString, ...);
|
FString& sprintf (const FString, ...);
|
||||||
FString clear();
|
FString clear();
|
||||||
|
|
||||||
const wchar_t* wc_str() const;
|
const wchar_t* wc_str() const;
|
||||||
wchar_t* wc_str();
|
wchar_t* wc_str();
|
||||||
|
|
|
@ -138,7 +138,7 @@ class FSystemImpl : public FSystem
|
||||||
|
|
||||||
int ioctl (int fd, uLong request, ...) override
|
int ioctl (int fd, uLong request, ...) override
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args{};
|
||||||
va_start (args, request);
|
va_start (args, request);
|
||||||
void* argp = va_arg (args, void*);
|
void* argp = va_arg (args, void*);
|
||||||
int ret = ::ioctl (fd, request, argp);
|
int ret = ::ioctl (fd, request, argp);
|
||||||
|
@ -148,7 +148,7 @@ class FSystemImpl : public FSystem
|
||||||
|
|
||||||
int open (const char* pathname, int flags, ...) override
|
int open (const char* pathname, int flags, ...) override
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args{};
|
||||||
va_start (args, flags);
|
va_start (args, flags);
|
||||||
mode_t mode = static_cast<mode_t>(va_arg (args, int));
|
mode_t mode = static_cast<mode_t>(va_arg (args, int));
|
||||||
int ret = ::open (pathname, flags, mode);
|
int ret = ::open (pathname, flags, mode);
|
||||||
|
|
|
@ -206,38 +206,20 @@ class FTermDetection final
|
||||||
|
|
||||||
static struct colorEnv
|
static struct colorEnv
|
||||||
{
|
{
|
||||||
void setDefault()
|
char* string1{nullptr};
|
||||||
{
|
char* string2{nullptr};
|
||||||
string1 = nullptr;
|
char* string3{nullptr};
|
||||||
string2 = nullptr;
|
char* string4{nullptr};
|
||||||
string3 = nullptr;
|
char* string5{nullptr};
|
||||||
string4 = nullptr;
|
char* string6{nullptr};
|
||||||
string5 = nullptr;
|
char* string7{nullptr};
|
||||||
string6 = nullptr;
|
|
||||||
string7 = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* string1;
|
|
||||||
char* string2;
|
|
||||||
char* string3;
|
|
||||||
char* string4;
|
|
||||||
char* string5;
|
|
||||||
char* string6;
|
|
||||||
char* string7;
|
|
||||||
} color_env;
|
} color_env;
|
||||||
|
|
||||||
static struct secondaryDA
|
static struct secondaryDA
|
||||||
{
|
{
|
||||||
void setDefault()
|
int terminal_id_type{-1};
|
||||||
{
|
int terminal_id_version{-1};
|
||||||
terminal_id_type = -1;
|
int terminal_id_hardware{-1};
|
||||||
terminal_id_version = -1;
|
|
||||||
terminal_id_hardware = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int terminal_id_type;
|
|
||||||
int terminal_id_version;
|
|
||||||
int terminal_id_hardware;
|
|
||||||
} secondary_da;
|
} secondary_da;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
Loading…
Reference in New Issue