const type qualifiers and list initialization
This commit is contained in:
parent
0fd6439f5a
commit
a90cd1ad55
|
@ -67,7 +67,7 @@ class SegmentView final : public finalcut::FDialog
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
std::map<wchar_t, sevenSegment> code{};
|
std::map<wchar_t, sevenSegment> code{};
|
||||||
finalcut::FString line[3];
|
finalcut::FString line[3]{};
|
||||||
finalcut::FLineEdit Input{"0123", this};
|
finalcut::FLineEdit Input{"0123", this};
|
||||||
finalcut::FButton Exit{"E&xit", this};
|
finalcut::FButton Exit{"E&xit", this};
|
||||||
};
|
};
|
||||||
|
@ -80,13 +80,13 @@ SegmentView::SegmentView (finalcut::FWidget* parent)
|
||||||
// Avoids calling a virtual function from the constructor
|
// Avoids calling a virtual function from the constructor
|
||||||
// (CERT, OOP50-CPP)
|
// (CERT, OOP50-CPP)
|
||||||
FDialog::setText ("Seven-segment display");
|
FDialog::setText ("Seven-segment display");
|
||||||
FDialog::setGeometry (FPoint(25, 5), FSize(42, 15));
|
FDialog::setGeometry (FPoint{25, 5}, FSize{42, 15});
|
||||||
|
|
||||||
// Set encoding
|
// Set encoding
|
||||||
hexEncoding();
|
hexEncoding();
|
||||||
|
|
||||||
// Input field
|
// Input field
|
||||||
Input.setGeometry (FPoint(2, 2), FSize(12, 1));
|
Input.setGeometry (FPoint(2, 2), FSize{12, 1});
|
||||||
Input.setLabelText (L"&Hex value");
|
Input.setLabelText (L"&Hex value");
|
||||||
Input.setLabelText (L"&Hex-digits or (.) (:) (H) (L) (P) (U)");
|
Input.setLabelText (L"&Hex-digits or (.) (:) (H) (L) (P) (U)");
|
||||||
Input.setLabelOrientation(finalcut::FLineEdit::label_above);
|
Input.setLabelOrientation(finalcut::FLineEdit::label_above);
|
||||||
|
@ -94,7 +94,7 @@ SegmentView::SegmentView (finalcut::FWidget* parent)
|
||||||
Input.setInputFilter("[:.hHlLpPuU[:xdigit:]]");
|
Input.setInputFilter("[:.hHlLpPuU[:xdigit:]]");
|
||||||
|
|
||||||
// Exit button
|
// Exit button
|
||||||
Exit.setGeometry(FPoint(28, 11), FSize(10, 1));
|
Exit.setGeometry(FPoint{28, 11}, FSize{10, 1});
|
||||||
|
|
||||||
// Add some function callbacks
|
// Add some function callbacks
|
||||||
Input.addCallback
|
Input.addCallback
|
||||||
|
@ -203,11 +203,11 @@ void SegmentView::draw()
|
||||||
|
|
||||||
FDialog::draw();
|
FDialog::draw();
|
||||||
setColor(fc::LightGray, fc::Black);
|
setColor(fc::LightGray, fc::Black);
|
||||||
finalcut::drawBorder(this, FRect(FPoint(3, 6), FPoint(40, 11)));
|
finalcut::drawBorder(this, FRect(FPoint{3, 6}, FPoint{40, 11}));
|
||||||
|
|
||||||
for (auto&& ch : Input.getText().toUpper())
|
for (auto&& ch : Input.getText().toUpper())
|
||||||
{
|
{
|
||||||
const FColorPair color(fc::LightRed, fc::Black);
|
const 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++)
|
||||||
|
@ -219,10 +219,10 @@ void SegmentView::draw()
|
||||||
if ( length < 36 )
|
if ( length < 36 )
|
||||||
left_space << finalcut::FString(36 - length, ' ');
|
left_space << finalcut::FString(36 - length, ' ');
|
||||||
|
|
||||||
print() << FPoint (4, 7) << left_space << tbuffer[0]
|
print() << FPoint {4, 7} << left_space << tbuffer[0]
|
||||||
<< FPoint (4, 8) << left_space << tbuffer[1]
|
<< FPoint {4, 8} << left_space << tbuffer[1]
|
||||||
<< FPoint (4, 9) << left_space << tbuffer[2]
|
<< FPoint {4, 9} << left_space << tbuffer[2]
|
||||||
<< FPoint (4, 10) << finalcut::FString(36, ' ');
|
<< FPoint {4, 10} << finalcut::FString{36, ' '};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -98,10 +98,10 @@ Background::Background (finalcut::FWidget* parent)
|
||||||
// Avoids calling a virtual function from the constructor
|
// Avoids calling a virtual function from the constructor
|
||||||
// (CERT, OOP50-CPP)
|
// (CERT, OOP50-CPP)
|
||||||
FDialog::setText ("Background color palette");
|
FDialog::setText ("Background color palette");
|
||||||
FDialog::setGeometry (FPoint(25, 5), FSize(32, 12));
|
FDialog::setGeometry (FPoint{25, 5}, FSize{32, 12});
|
||||||
|
|
||||||
// Combobox
|
// Combobox
|
||||||
color_choice.setGeometry (FPoint(2, 2), FSize(18, 1));
|
color_choice.setGeometry (FPoint{2, 2}, FSize{18, 1});
|
||||||
color_choice.setLabelOrientation (finalcut::FLineEdit::label_above);
|
color_choice.setLabelOrientation (finalcut::FLineEdit::label_above);
|
||||||
color_choice.setLabelText ("Color choice");
|
color_choice.setLabelText ("Color choice");
|
||||||
color_choice.unsetEditable();
|
color_choice.unsetEditable();
|
||||||
|
@ -114,19 +114,19 @@ Background::Background (finalcut::FWidget* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spin boxes
|
// Spin boxes
|
||||||
red.setGeometry (FPoint(2, 5), FSize(7, 1));
|
red.setGeometry (FPoint{2, 5}, FSize{7, 1});
|
||||||
red.setLabelOrientation (finalcut::FLineEdit::label_above);
|
red.setLabelOrientation (finalcut::FLineEdit::label_above);
|
||||||
red.setLabelText ("Red");
|
red.setLabelText ("Red");
|
||||||
red.setRange (0, 255);
|
red.setRange (0, 255);
|
||||||
red.setValue (0x80);
|
red.setValue (0x80);
|
||||||
|
|
||||||
green.setGeometry (FPoint(12, 5), FSize(7, 1));
|
green.setGeometry (FPoint{12, 5}, FSize{7, 1});
|
||||||
green.setLabelOrientation (finalcut::FLineEdit::label_above);
|
green.setLabelOrientation (finalcut::FLineEdit::label_above);
|
||||||
green.setLabelText ("Green");
|
green.setLabelText ("Green");
|
||||||
green.setRange (0, 255);
|
green.setRange (0, 255);
|
||||||
green.setValue (0xa4);
|
green.setValue (0xa4);
|
||||||
|
|
||||||
blue.setGeometry (FPoint(22, 5), FSize(7, 1));
|
blue.setGeometry (FPoint{22, 5}, FSize{7, 1});
|
||||||
blue.setLabelOrientation (finalcut::FLineEdit::label_above);
|
blue.setLabelOrientation (finalcut::FLineEdit::label_above);
|
||||||
blue.setLabelText ("Blue");
|
blue.setLabelText ("Blue");
|
||||||
blue.setRange (0, 255);
|
blue.setRange (0, 255);
|
||||||
|
@ -142,7 +142,7 @@ Background::Background (finalcut::FWidget* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit button
|
// Quit button
|
||||||
quit.setGeometry(FPoint(19, 8), FSize(10, 1));
|
quit.setGeometry(FPoint{19, 8}, FSize{10, 1});
|
||||||
|
|
||||||
// Add some function callbacks
|
// Add some function callbacks
|
||||||
quit.addCallback
|
quit.addCallback
|
||||||
|
|
|
@ -251,7 +251,7 @@ Calc::Calc (FWidget* parent)
|
||||||
// Avoids calling a virtual function from the constructor
|
// Avoids calling a virtual function from the constructor
|
||||||
// (CERT, OOP50-CPP)
|
// (CERT, OOP50-CPP)
|
||||||
FDialog::setText ("Calculator");
|
FDialog::setText ("Calculator");
|
||||||
FDialog::setGeometry (FPoint(19, 6), FSize(37, 18));
|
FDialog::setGeometry (FPoint{19, 6}, FSize{37, 18});
|
||||||
|
|
||||||
mapKeyFunctions();
|
mapKeyFunctions();
|
||||||
clearInfixOperator();
|
clearInfixOperator();
|
||||||
|
@ -263,13 +263,13 @@ Calc::Calc (FWidget* parent)
|
||||||
button_no[key] = key;
|
button_no[key] = key;
|
||||||
|
|
||||||
if ( key == Equals )
|
if ( key == Equals )
|
||||||
btn->setGeometry(FPoint(30, 15), FSize(5, 3));
|
btn->setGeometry(FPoint{30, 15}, FSize{5, 3});
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const std::size_t n = ( key <= Three ) ? 0 : 1;
|
const std::size_t n = ( key <= Three ) ? 0 : 1;
|
||||||
const int x = int(key + n) % 5 * 7 + 2;
|
const int x = int(key + n) % 5 * 7 + 2;
|
||||||
const int y = int(key + n) / 5 * 2 + 3;
|
const int y = int(key + n) / 5 * 2 + 3;
|
||||||
btn->setGeometry(FPoint(x, y), FSize(5, 1));
|
btn->setGeometry(FPoint{x, y}, FSize{5, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
btn->setFlat();
|
btn->setFlat();
|
||||||
|
@ -398,7 +398,7 @@ void Calc::cb_buttonClicked (const finalcut::FWidget*, FDataPtr data)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
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';
|
||||||
|
@ -410,7 +410,7 @@ void Calc::drawDispay()
|
||||||
display = display.left(display.getLength() - 1);
|
display = display.left(display.getLength() - 1);
|
||||||
|
|
||||||
if ( ! display.isEmpty() && display.getLength() < max_char )
|
if ( ! display.isEmpty() && display.getLength() < max_char )
|
||||||
display.insert(finalcut::FString(max_char - display.getLength(), L' '), 0);
|
display.insert(finalcut::FString{max_char - display.getLength(), L' '}, 0);
|
||||||
|
|
||||||
if ( display.getLength() > max_char )
|
if ( display.getLength() > max_char )
|
||||||
display = display.left(max_char);
|
display = display.left(max_char);
|
||||||
|
@ -425,9 +425,9 @@ void Calc::drawDispay()
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
print() << FColorPair(fc::Black, fc::LightGray)
|
print() << FColorPair{fc::Black, fc::LightGray}
|
||||||
<< FPoint(3, 3) << display << ' '
|
<< FPoint{3, 3} << display << ' '
|
||||||
<< FColorPair(wc.dialog_fg, wc.dialog_bg);
|
<< FColorPair{wc.dialog_fg, wc.dialog_bg};
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -439,12 +439,12 @@ void Calc::drawDispay()
|
||||||
const wchar_t top_line {fc::NF_border_line_upper};
|
const wchar_t top_line {fc::NF_border_line_upper};
|
||||||
const wchar_t right_line {fc::NF_rev_border_line_right};
|
const wchar_t right_line {fc::NF_rev_border_line_right};
|
||||||
const wchar_t left_line {fc::NF_border_line_left};
|
const 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;
|
||||||
print() << FPoint(3, 4);
|
print() << FPoint{3, 4};
|
||||||
const finalcut::FString top_bottom_line_5 (5, top_bottom_line);
|
const finalcut::FString top_bottom_line_5 {5, top_bottom_line};
|
||||||
const finalcut::FString top_line_2 (2, top_line);
|
const finalcut::FString top_line_2 {2, top_line};
|
||||||
print ( top_bottom_line_5 + top_line_2
|
print ( top_bottom_line_5 + top_line_2
|
||||||
+ top_bottom_line_5 + top_line_2
|
+ top_bottom_line_5 + top_line_2
|
||||||
+ top_bottom_line_5 + top_line_2
|
+ top_bottom_line_5 + top_line_2
|
||||||
|
@ -456,10 +456,10 @@ void Calc::drawDispay()
|
||||||
const wchar_t vertical_and_right {fc::BoxDrawingsVerticalAndRight};
|
const wchar_t vertical_and_right {fc::BoxDrawingsVerticalAndRight};
|
||||||
const wchar_t horizontal {fc::BoxDrawingsHorizontal};
|
const wchar_t horizontal {fc::BoxDrawingsHorizontal};
|
||||||
const wchar_t vertical_and_left {fc::BoxDrawingsVerticalAndLeft};
|
const 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,12 +80,12 @@ CheckList::CheckList (finalcut::FWidget* parent)
|
||||||
// (CERT, OOP50-CPP)
|
// (CERT, OOP50-CPP)
|
||||||
FDialog::setText (L"Shopping list");
|
FDialog::setText (L"Shopping list");
|
||||||
const std::size_t nf_offset = ( isNewFont() ) ? 1 : 0;
|
const std::size_t nf_offset = ( isNewFont() ) ? 1 : 0;
|
||||||
FDialog::setGeometry ( FPoint(int(1 + (parent->getWidth() - 28) / 2), 5)
|
FDialog::setGeometry ( FPoint{int(1 + (parent->getWidth() - 28) / 2), 5}
|
||||||
, FSize(28 + nf_offset, 13) );
|
, FSize{28 + nf_offset, 13} );
|
||||||
setShadow();
|
setShadow();
|
||||||
listView.ignorePadding();
|
listView.ignorePadding();
|
||||||
listView.setGeometry ( FPoint(1 + int(nf_offset), 2)
|
listView.setGeometry ( FPoint{1 + int(nf_offset), 2}
|
||||||
, FSize(getWidth() - nf_offset, getHeight() - 1) );
|
, FSize{getWidth() - nf_offset, getHeight() - 1} );
|
||||||
|
|
||||||
// Add columns to the view
|
// Add columns to the view
|
||||||
listView.addColumn ("Item");
|
listView.addColumn ("Item");
|
||||||
|
@ -96,9 +96,9 @@ CheckList::CheckList (finalcut::FWidget* parent)
|
||||||
listView.setColumnSortType (2, fc::by_name);
|
listView.setColumnSortType (2, fc::by_name);
|
||||||
|
|
||||||
// Statusbar at the bottom
|
// Statusbar at the bottom
|
||||||
finalcut::FString separator;
|
finalcut::FString separator{};
|
||||||
separator << ' ' << fc::BoxDrawingsVertical << ' ';
|
separator << ' ' << fc::BoxDrawingsVertical << ' ';
|
||||||
listView.setStatusbarMessage ( finalcut::FString()
|
listView.setStatusbarMessage ( finalcut::FString{}
|
||||||
<< "<Q> exit" << separator
|
<< "<Q> exit" << separator
|
||||||
<< "<Space> select an item" << separator
|
<< "<Space> select an item" << separator
|
||||||
<< "<Enter> see your pick list");
|
<< "<Enter> see your pick list");
|
||||||
|
@ -171,7 +171,7 @@ void CheckList::onClose (finalcut::FCloseEvent* ev)
|
||||||
void CheckList::cb_showList (const finalcut::FWidget*, const FDataPtr)
|
void CheckList::cb_showList (const finalcut::FWidget*, const FDataPtr)
|
||||||
{
|
{
|
||||||
auto iter = listView.beginOfList();
|
auto iter = listView.beginOfList();
|
||||||
finalcut::FString shopping_list;
|
finalcut::FString shopping_list{};
|
||||||
|
|
||||||
while ( iter != listView.endOfList() )
|
while ( iter != listView.endOfList() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,24 +97,24 @@ 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};
|
||||||
|
|
||||||
{ // Create a simple modal dialog box in this scope
|
{ // Create a simple modal dialog box in this scope
|
||||||
finalcut::FDialog dgl(&app);
|
finalcut::FDialog dgl{&app};
|
||||||
dgl.setModal();
|
dgl.setModal();
|
||||||
dgl.setText ("UNIX select");
|
dgl.setText ("UNIX select");
|
||||||
const std::size_t w{20};
|
const std::size_t w{20};
|
||||||
const std::size_t h{13};
|
const std::size_t h{13};
|
||||||
const int x = int(app.getDesktopWidth() - w) / 2;
|
const int x = int(app.getDesktopWidth() - w) / 2;
|
||||||
const int y = int(app.getDesktopHeight() - h) / 2;
|
const int y = int(app.getDesktopHeight() - h) / 2;
|
||||||
dgl.setGeometry (FPoint(x, y), FSize(w, h));
|
dgl.setGeometry (FPoint{x, y}, FSize{w, h});
|
||||||
|
|
||||||
// Create a button group
|
// Create a button group
|
||||||
finalcut::FButtonGroup checkButtonGroup("choice", &dgl);
|
finalcut::FButtonGroup checkButtonGroup("choice", &dgl);
|
||||||
checkButtonGroup.setGeometry (FPoint(2, 1), FSize(16, 7));
|
checkButtonGroup.setGeometry (FPoint{2, 1}, FSize{16, 7});
|
||||||
|
|
||||||
// Create radio buttons
|
// Create radio buttons
|
||||||
std::vector<FRadioButtonPtr> os(9);
|
std::vector<FRadioButtonPtr> os(9);
|
||||||
|
@ -124,7 +124,7 @@ int main (int argc, char* argv[])
|
||||||
// => 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);
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ int main (int argc, char* argv[])
|
||||||
|
|
||||||
// Create a OK button
|
// Create a OK button
|
||||||
finalcut::FButton ok("&OK", &dgl);
|
finalcut::FButton ok("&OK", &dgl);
|
||||||
ok.setGeometry (FPoint(10, 9), FSize(8, 1));
|
ok.setGeometry (FPoint{10, 9}, FSize{8, 1});
|
||||||
|
|
||||||
// Connect the button signal "clicked" with the callback function
|
// Connect the button signal "clicked" with the callback function
|
||||||
ok.addCallback
|
ok.addCallback
|
||||||
|
@ -160,7 +160,7 @@ int main (int argc, char* argv[])
|
||||||
|
|
||||||
|
|
||||||
// Create and show tooltip for two seconds
|
// Create and show tooltip for two seconds
|
||||||
finalcut::FToolTip tooltip(&app);
|
finalcut::FToolTip tooltip{&app};
|
||||||
tooltip.setText ("You have chosen " + label_text);
|
tooltip.setText ("You have chosen " + label_text);
|
||||||
tooltip.show();
|
tooltip.show();
|
||||||
sleep(2);
|
sleep(2);
|
||||||
|
|
|
@ -45,32 +45,32 @@ void cb_quit (const finalcut::FWidget*, FDataPtr data)
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
|
|
||||||
// Create a simple dialog box
|
// Create a simple dialog box
|
||||||
finalcut::FDialog dgl(&app);
|
finalcut::FDialog dgl{&app};
|
||||||
dgl.setText ("FDialog");
|
dgl.setText ("FDialog");
|
||||||
dgl.setGeometry (FPoint(4, 3), FSize(41, 11));
|
dgl.setGeometry (FPoint{4, 3}, FSize{41, 11});
|
||||||
|
|
||||||
// Create text labels
|
// Create text labels
|
||||||
finalcut::FLabel label_1(&dgl);
|
finalcut::FLabel label_1{&dgl};
|
||||||
finalcut::FLabel label_2(&dgl);
|
finalcut::FLabel label_2{&dgl};
|
||||||
|
|
||||||
label_1 << finalcut::fc::BlackUpPointingTriangle
|
label_1 << finalcut::fc::BlackUpPointingTriangle
|
||||||
<< std::wstring(L"\n")
|
<< std::wstring{L"\n"}
|
||||||
<< finalcut::fc::BoxDrawingsUpAndRight
|
<< finalcut::fc::BoxDrawingsUpAndRight
|
||||||
<< finalcut::FString(2, finalcut::fc::BoxDrawingsHorizontal)
|
<< finalcut::FString{2, finalcut::fc::BoxDrawingsHorizontal}
|
||||||
<< " Double click the title bar button,";
|
<< " Double click the title bar button,";
|
||||||
label_2 << "press Q on the keyboard,\n"
|
label_2 << "press Q on the keyboard,\n"
|
||||||
<< "or push the button below to exit\n"
|
<< "or push the button below to exit\n"
|
||||||
<< "the program.";
|
<< "the program.";
|
||||||
|
|
||||||
label_1.setGeometry (FPoint(1, 1), FSize(38, 2));
|
label_1.setGeometry (FPoint{1, 1}, FSize{38, 2});
|
||||||
label_2.setGeometry (FPoint(5, 3), FSize(34, 3));
|
label_2.setGeometry (FPoint{5, 3}, FSize{34, 3});
|
||||||
|
|
||||||
// Create the quit button
|
// Create the quit button
|
||||||
finalcut::FButton btn("&Quit", &dgl);
|
finalcut::FButton btn{"&Quit", &dgl};
|
||||||
btn.setGeometry (FPoint(16, 7), FSize(9, 1));
|
btn.setGeometry (FPoint{16, 7}, FSize{9, 1});
|
||||||
|
|
||||||
// Connect the button signal "clicked" with the callback function
|
// Connect the button signal "clicked" with the callback function
|
||||||
btn.addCallback
|
btn.addCallback
|
||||||
|
|
|
@ -34,44 +34,44 @@ using finalcut::FSize;
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
|
|
||||||
// Create a simple dialog box
|
// Create a simple dialog box
|
||||||
finalcut::FDialog dgl(&app);
|
finalcut::FDialog dgl{&app};
|
||||||
dgl.setText (full("Dialog"));
|
dgl.setText (full("Dialog"));
|
||||||
dgl.setSize (FSize(37, 16));
|
dgl.setSize (FSize{37, 16});
|
||||||
dgl.setPos (FPoint( int(app.getDesktopWidth() - dgl.getWidth()) / 2
|
dgl.setPos ({ int(app.getDesktopWidth() - dgl.getWidth()) / 2
|
||||||
, int(app.getDesktopHeight() - dgl.getHeight()) / 2));
|
, int(app.getDesktopHeight() - dgl.getHeight()) / 2});
|
||||||
dgl.setShadow();
|
dgl.setShadow();
|
||||||
|
|
||||||
// Create input fields
|
// Create input fields
|
||||||
finalcut::FLineEdit field1 (&dgl);
|
finalcut::FLineEdit field1 {&dgl};
|
||||||
field1.setLabelText (full("Input"));
|
field1.setLabelText (full("Input"));
|
||||||
field1.setText (L"你好"); // Nǐ hǎo (chinese)
|
field1.setText (L"你好"); // Nǐ hǎo (chinese)
|
||||||
field1.setStatusbarMessage (full("Type your text here"));
|
field1.setStatusbarMessage (full("Type your text here"));
|
||||||
field1.setGeometry (FPoint(15, 1), FSize(19, 1));
|
field1.setGeometry (FPoint{15, 1}, FSize{19, 1});
|
||||||
|
|
||||||
finalcut::FLineEdit field2 (&dgl);
|
finalcut::FLineEdit field2 {&dgl};
|
||||||
field2.setLabelText (L"Comment");
|
field2.setLabelText (L"Comment");
|
||||||
field2.setText (full(L"Hello"));
|
field2.setText (full(L"Hello"));
|
||||||
field2.setStatusbarMessage (full("Post a comment"));
|
field2.setStatusbarMessage (full("Post a comment"));
|
||||||
field2.setGeometry (FPoint(15, 3), FSize(19, 1));
|
field2.setGeometry (FPoint{15, 3}, FSize{19, 1});
|
||||||
|
|
||||||
// Create the button group
|
// Create the button group
|
||||||
finalcut::FButtonGroup group (full("Side"), &dgl);
|
finalcut::FButtonGroup group {full("Side"), &dgl};
|
||||||
group.setGeometry(FPoint(2, 5), FSize(32, 3));
|
group.setGeometry(FPoint{2, 5}, FSize{32, 3});
|
||||||
|
|
||||||
// Create radio buttons
|
// Create radio buttons
|
||||||
finalcut::FRadioButton left ("&" + full("Left"), &group);
|
finalcut::FRadioButton left {"&" + full("Left"), &group};
|
||||||
finalcut::FRadioButton right ("&" + full("Right"), &group);
|
finalcut::FRadioButton right {"&" + full("Right"), &group};
|
||||||
left.setStatusbarMessage (full("Prefer the left side"));
|
left.setStatusbarMessage (full("Prefer the left side"));
|
||||||
right.setStatusbarMessage (full("Prefer the right side"));
|
right.setStatusbarMessage (full("Prefer the right side"));
|
||||||
left.setGeometry (FPoint(1, 1), FSize(8, 1));
|
left.setGeometry (FPoint{1, 1}, FSize{8, 1});
|
||||||
right.setGeometry (FPoint(15, 1), FSize(10, 1));
|
right.setGeometry (FPoint{15, 1}, FSize{10, 1});
|
||||||
|
|
||||||
// Create a scrollable text field
|
// Create a scrollable text field
|
||||||
finalcut::FTextView scroll_text (&dgl);
|
finalcut::FTextView scroll_text {&dgl};
|
||||||
scroll_text.setGeometry (FPoint(2, 8), FSize(32, 3));
|
scroll_text.setGeometry (FPoint{2, 8}, FSize{32, 3});
|
||||||
finalcut::FString text_line{"FINAL CUT supports "
|
finalcut::FString text_line{"FINAL CUT supports "
|
||||||
"full-width characters."};
|
"full-width characters."};
|
||||||
scroll_text << full(text_line);
|
scroll_text << full(text_line);
|
||||||
|
@ -79,16 +79,16 @@ int main (int argc, char* argv[])
|
||||||
"left with the arrow keys");
|
"left with the arrow keys");
|
||||||
|
|
||||||
// Create a OK button
|
// Create a OK button
|
||||||
finalcut::FButton btn("&OK", &dgl);
|
finalcut::FButton btn {"&OK", &dgl};
|
||||||
btn.setStatusbarMessage (full("Press Enter to exit the dialog"));
|
btn.setStatusbarMessage (full("Press Enter to exit the dialog"));
|
||||||
btn.setGeometry (FPoint(24, 12), FSize(10, 1));
|
btn.setGeometry (FPoint{24, 12}, FSize{10, 1});
|
||||||
|
|
||||||
// Create the status bar
|
// Create the status bar
|
||||||
finalcut::FStatusBar sbar(&dgl);
|
finalcut::FStatusBar sbar {&dgl};
|
||||||
finalcut::FStatusKey key_F1 (finalcut::fc::Fkey_f1, "Info", &sbar);
|
finalcut::FStatusKey key_F1 (finalcut::fc::Fkey_f1, "Info", &sbar);
|
||||||
|
|
||||||
// Create the menu bar
|
// Create the menu bar
|
||||||
finalcut::FMenuBar Menubar(&dgl);
|
finalcut::FMenuBar Menubar {&dgl};
|
||||||
|
|
||||||
// Create menu bar items
|
// Create menu bar items
|
||||||
finalcut::FMenu File{L"&File", &Menubar};
|
finalcut::FMenu File{L"&File", &Menubar};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2015-2018 Markus Gans *
|
* Copyright 2015-2020 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 *
|
||||||
|
@ -26,10 +26,10 @@
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
|
|
||||||
// Create a simple dialog box
|
// Create a simple dialog box
|
||||||
finalcut::FMessageBox mbox(&app);
|
finalcut::FMessageBox mbox{&app};
|
||||||
mbox.setText("Hello world");
|
mbox.setText("Hello world");
|
||||||
|
|
||||||
// Start the application
|
// Start the application
|
||||||
|
|
|
@ -61,21 +61,21 @@ void cb_publish (finalcut::FWidget* widget, FDataPtr data)
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
|
|
||||||
// Create a simple dialog box
|
// Create a simple dialog box
|
||||||
finalcut::FDialog dgl(&app);
|
finalcut::FDialog dgl{&app};
|
||||||
dgl.setText ("Data input");
|
dgl.setText ("Data input");
|
||||||
dgl.setGeometry (FPoint(4, 2), FSize(37, 22));
|
dgl.setGeometry (FPoint{4, 2}, FSize{37, 22});
|
||||||
dgl.setShadow();
|
dgl.setShadow();
|
||||||
|
|
||||||
// Create input fields
|
// Create input fields
|
||||||
finalcut::FLineEdit name_field (&dgl);
|
finalcut::FLineEdit name_field {&dgl};
|
||||||
finalcut::FLineEdit pw_field (&dgl);
|
finalcut::FLineEdit pw_field {&dgl};
|
||||||
finalcut::FLineEdit email_field (&dgl);
|
finalcut::FLineEdit email_field {&dgl};
|
||||||
finalcut::FLineEdit city_field (&dgl);
|
finalcut::FLineEdit city_field {&dgl};
|
||||||
finalcut::FLineEdit st_field (&dgl);
|
finalcut::FLineEdit st_field {&dgl};
|
||||||
finalcut::FLineEdit c_field (&dgl);
|
finalcut::FLineEdit c_field {&dgl};
|
||||||
|
|
||||||
// Set input type to password
|
// Set input type to password
|
||||||
pw_field.setInputType (finalcut::FLineEdit::password);
|
pw_field.setInputType (finalcut::FLineEdit::password);
|
||||||
|
@ -87,37 +87,37 @@ int main (int argc, char* argv[])
|
||||||
st_field.setLabelText (L"&State");
|
st_field.setLabelText (L"&State");
|
||||||
c_field.setLabelText (L"&Country");
|
c_field.setLabelText (L"&Country");
|
||||||
|
|
||||||
name_field.setGeometry (FPoint(11, 1), FSize(23, 1));
|
name_field.setGeometry (FPoint{11, 1}, FSize{23, 1});
|
||||||
pw_field.setGeometry (FPoint(11, 3), FSize(23, 1));
|
pw_field.setGeometry (FPoint{11, 3}, FSize{23, 1});
|
||||||
email_field.setGeometry (FPoint(11, 5), FSize(23, 1));
|
email_field.setGeometry (FPoint{11, 5}, FSize{23, 1});
|
||||||
city_field.setGeometry (FPoint(11, 7), FSize(23, 1));
|
city_field.setGeometry (FPoint{11, 7}, FSize{23, 1});
|
||||||
st_field.setGeometry (FPoint(11, 9), FSize(23, 1));
|
st_field.setGeometry (FPoint{11, 9}, FSize{23, 1});
|
||||||
c_field.setGeometry (FPoint(11, 11), FSize(4, 1));
|
c_field.setGeometry (FPoint{11, 11}, FSize{4, 1});
|
||||||
|
|
||||||
// Create the button group
|
// Create the button group
|
||||||
finalcut::FButtonGroup radioButtonGroup ("Sex", &dgl);
|
finalcut::FButtonGroup radioButtonGroup {"Sex", &dgl};
|
||||||
radioButtonGroup.setGeometry(FPoint(2, 13), FSize(13, 4));
|
radioButtonGroup.setGeometry(FPoint{2, 13}, FSize{13, 4});
|
||||||
|
|
||||||
// Create radio buttons
|
// Create radio buttons
|
||||||
finalcut::FRadioButton male ("&Male", &radioButtonGroup);
|
finalcut::FRadioButton male {"&Male", &radioButtonGroup};
|
||||||
finalcut::FRadioButton female ("&Female", &radioButtonGroup);
|
finalcut::FRadioButton female {"&Female", &radioButtonGroup};
|
||||||
male.setGeometry (FPoint(1, 1), FSize(8, 1));
|
male.setGeometry (FPoint{1, 1}, FSize{8, 1});
|
||||||
female.setGeometry (FPoint(1, 2), FSize(10, 1));
|
female.setGeometry (FPoint{1, 2}, FSize{10, 1});
|
||||||
|
|
||||||
// Create another button group
|
// Create another button group
|
||||||
finalcut::FButtonGroup checkButtonGroup ("&Data options", &dgl);
|
finalcut::FButtonGroup checkButtonGroup {"&Data options", &dgl};
|
||||||
checkButtonGroup.setGeometry(FPoint(16, 13), FSize(19, 4));
|
checkButtonGroup.setGeometry(FPoint{16, 13}, FSize{19, 4});
|
||||||
|
|
||||||
// Create checkbox buttons
|
// Create checkbox buttons
|
||||||
finalcut::FCheckBox check1 ("Save data", &checkButtonGroup);
|
finalcut::FCheckBox check1 {"Save data", &checkButtonGroup};
|
||||||
finalcut::FCheckBox check2 ("Encrypt data", &checkButtonGroup);
|
finalcut::FCheckBox check2 {"Encrypt data", &checkButtonGroup};
|
||||||
check1.setGeometry (FPoint(1, 1), FSize(13, 1));
|
check1.setGeometry (FPoint{1, 1}, FSize{13, 1});
|
||||||
check2.setGeometry (FPoint(1, 2), FSize(16, 1));
|
check2.setGeometry (FPoint{1, 2}, FSize{16, 1});
|
||||||
check2.setDisable();
|
check2.setDisable();
|
||||||
|
|
||||||
// Create a OK button
|
// Create a OK button
|
||||||
finalcut::FButton btn("&OK", &dgl);
|
finalcut::FButton btn {"&OK", &dgl};
|
||||||
btn.setGeometry (FPoint(24, 18), FSize(10, 1));
|
btn.setGeometry (FPoint{24, 18}, FSize{10, 1});
|
||||||
|
|
||||||
// Connect checkbox signal "clicked" with a callback function
|
// Connect checkbox signal "clicked" with a callback function
|
||||||
check1.addCallback
|
check1.addCallback
|
||||||
|
|
|
@ -68,8 +68,7 @@ void Keyboard::onKeyPress (finalcut::FKeyEvent* ev)
|
||||||
if ( is_last_line )
|
if ( is_last_line )
|
||||||
scrollAreaForward (getVirtualDesktop());
|
scrollAreaForward (getVirtualDesktop());
|
||||||
|
|
||||||
setAreaCursor ( finalcut::FPoint(1, getPrintPos().getY())
|
setAreaCursor ({1, getPrintPos().getY()}, true, getVirtualDesktop());
|
||||||
, true, getVirtualDesktop() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -82,11 +81,11 @@ void Keyboard::onAccel (finalcut::FAccelEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Keyboard::draw()
|
void Keyboard::draw()
|
||||||
{
|
{
|
||||||
print() << finalcut::FPoint(1, 1)
|
print() << finalcut::FPoint{1, 1}
|
||||||
<< "---------------\n"
|
<< "---------------\n"
|
||||||
<< "Press Q to quit\n"
|
<< "Press Q to quit\n"
|
||||||
<< "---------------\n";
|
<< "---------------\n";
|
||||||
setAreaCursor (finalcut::FPoint(1, 4), true, getVirtualDesktop());
|
setAreaCursor ({1, 4}, true, getVirtualDesktop());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -95,12 +94,12 @@ void Keyboard::draw()
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
app.setForegroundColor(finalcut::fc::Default);
|
app.setForegroundColor(finalcut::fc::Default);
|
||||||
app.setBackgroundColor(finalcut::fc::Default);
|
app.setBackgroundColor(finalcut::fc::Default);
|
||||||
|
|
||||||
// Create a keyboard object
|
// Create a keyboard object
|
||||||
Keyboard key(&app);
|
Keyboard key{&app};
|
||||||
key.addAccelerator('q');
|
key.addAccelerator('q');
|
||||||
|
|
||||||
// Set the keyboard object as main widget
|
// Set the keyboard object as main widget
|
||||||
|
|
|
@ -112,18 +112,18 @@ Listbox::Listbox (FWidget* parent)
|
||||||
|
|
||||||
// listbox 1
|
// listbox 1
|
||||||
//----------
|
//----------
|
||||||
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 (int i{1}; i <= 15; i++)
|
for (int i{1}; i <= 15; i++)
|
||||||
double_list.push_back(2 * double(i) + (double(i) / 100));
|
double_list.push_back(2 * double(i) + (double(i) / 100));
|
||||||
|
|
||||||
list2.setGeometry(FPoint(21, 1), FSize(10, 10));
|
list2.setGeometry(FPoint{21, 1}, FSize{10, 10});
|
||||||
list2.setText ("double");
|
list2.setText ("double");
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -146,11 +146,11 @@ Listbox::Listbox (FWidget* parent)
|
||||||
TLD["gov"] = "Government";
|
TLD["gov"] = "Government";
|
||||||
|
|
||||||
list3.insert (TLD.begin(), TLD.end(), mapToString);
|
list3.insert (TLD.begin(), TLD.end(), mapToString);
|
||||||
list3.setGeometry(FPoint(32, 1), FSize(21, 10));
|
list3.setGeometry(FPoint{32, 1}, FSize{21, 10});
|
||||||
list3.setText ("key: value");
|
list3.setText ("key: value");
|
||||||
|
|
||||||
// Quit button
|
// Quit button
|
||||||
Quit.setGeometry(FPoint(42, 12), FSize(10, 1));
|
Quit.setGeometry(FPoint{42, 12}, FSize{10, 1});
|
||||||
Quit.setText (L"&Quit");
|
Quit.setText (L"&Quit");
|
||||||
|
|
||||||
// Add quit button function callback
|
// Add quit button function callback
|
||||||
|
@ -184,8 +184,8 @@ int main (int argc, char* argv[])
|
||||||
// Create main dialog object
|
// Create main dialog object
|
||||||
Listbox d(&app);
|
Listbox d(&app);
|
||||||
d.setText (L"Listbox");
|
d.setText (L"Listbox");
|
||||||
d.setGeometry ( FPoint(int(1 + (app.getWidth() - 56) / 2), 5)
|
d.setGeometry ( FPoint{int(1 + (app.getWidth() - 56) / 2), 5}
|
||||||
, FSize(56, 16) );
|
, FSize{56, 16} );
|
||||||
d.setShadow();
|
d.setShadow();
|
||||||
|
|
||||||
// Set dialog d as main widget
|
// Set dialog d as main widget
|
||||||
|
|
|
@ -71,7 +71,7 @@ Listview::Listview (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
{
|
{
|
||||||
// Set FListView geometry
|
// Set FListView geometry
|
||||||
listView.setGeometry(FPoint(2, 1), FSize(33, 14));
|
listView.setGeometry(FPoint{2, 1}, FSize{33, 14});
|
||||||
|
|
||||||
// Add columns to the view
|
// Add columns to the view
|
||||||
listView.addColumn ("City");
|
listView.addColumn ("City");
|
||||||
|
@ -104,7 +104,7 @@ Listview::Listview (finalcut::FWidget* parent)
|
||||||
populate();
|
populate();
|
||||||
|
|
||||||
// Quit button
|
// Quit button
|
||||||
Quit.setGeometry(FPoint(24, 16), FSize(10, 1));
|
Quit.setGeometry(FPoint{24, 16}, FSize{10, 1});
|
||||||
Quit.setText (L"&Quit");
|
Quit.setText (L"&Quit");
|
||||||
|
|
||||||
// Add some function callbacks
|
// Add some function callbacks
|
||||||
|
@ -212,8 +212,8 @@ int main (int argc, char* argv[])
|
||||||
// Create main dialog object
|
// Create main dialog object
|
||||||
Listview d(&app);
|
Listview d(&app);
|
||||||
d.setText (L"Weather data");
|
d.setText (L"Weather data");
|
||||||
d.setGeometry ( FPoint(int(1 + (app.getWidth() - 37) / 2), 3)
|
d.setGeometry ( FPoint{int(1 + (app.getWidth() - 37) / 2), 3}
|
||||||
, FSize(37, 20) );
|
, FSize{37, 20} );
|
||||||
d.setShadow();
|
d.setShadow();
|
||||||
|
|
||||||
// Set dialog d as main widget
|
// Set dialog d as main widget
|
||||||
|
|
|
@ -89,7 +89,7 @@ void Mandelbrot::draw()
|
||||||
while ( y0 < y_max && current_line < Lines )
|
while ( y0 < y_max && current_line < Lines )
|
||||||
{
|
{
|
||||||
current_line++;
|
current_line++;
|
||||||
print() << FPoint(xoffset, yoffset + current_line);
|
print() << FPoint{xoffset, yoffset + current_line};
|
||||||
double x0 = x_min;
|
double x0 = x_min;
|
||||||
|
|
||||||
while ( x0 < x_max )
|
while ( x0 < x_max )
|
||||||
|
@ -152,7 +152,7 @@ void Mandelbrot::adjustSize()
|
||||||
if ( w > 10 )
|
if ( w > 10 )
|
||||||
w -= 10;
|
w -= 10;
|
||||||
|
|
||||||
setGeometry(FPoint(6, 1), FSize(w, h), false);
|
setGeometry(FPoint{6, 1}, FSize{w, h}, false);
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,11 +162,11 @@ void Mandelbrot::adjustSize()
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
|
|
||||||
// Create a simple dialog box
|
// Create a simple dialog box
|
||||||
Mandelbrot mb(&app);
|
Mandelbrot mb{&app};
|
||||||
mb.setGeometry (FPoint(6, 1), FSize(70, 23));
|
mb.setGeometry (FPoint{6, 1}, FSize{70, 23});
|
||||||
mb.setShadow();
|
mb.setShadow();
|
||||||
|
|
||||||
// Set the mandelbrot object as main widget
|
// Set the mandelbrot object as main widget
|
||||||
|
|
|
@ -140,19 +140,19 @@ Menu::Menu (finalcut::FWidget* parent)
|
||||||
// Headline labels
|
// Headline labels
|
||||||
Headline1 << " Key ";
|
Headline1 << " Key ";
|
||||||
Headline1.ignorePadding();
|
Headline1.ignorePadding();
|
||||||
Headline1.setGeometry(FPoint(3, 2), FSize(5, 1));
|
Headline1.setGeometry(FPoint{3, 2}, FSize{5, 1});
|
||||||
Headline1.setEmphasis();
|
Headline1.setEmphasis();
|
||||||
|
|
||||||
Headline2 << " Function ";
|
Headline2 << " Function ";
|
||||||
Headline2.ignorePadding();
|
Headline2.ignorePadding();
|
||||||
Headline2.setGeometry(FPoint(19, 2), FSize(10, 1));
|
Headline2.setGeometry(FPoint{19, 2}, FSize{10, 1});
|
||||||
Headline2.setEmphasis();
|
Headline2.setEmphasis();
|
||||||
|
|
||||||
// Info label
|
// Info label
|
||||||
Info << "<F10> Activate menu bar\n"
|
Info << "<F10> Activate menu bar\n"
|
||||||
<< "<Ctrl>+<Space> Activate menu bar\n"
|
<< "<Ctrl>+<Space> Activate menu bar\n"
|
||||||
<< "<Meta>+<X> Exit";
|
<< "<Meta>+<X> Exit";
|
||||||
Info.setGeometry(FPoint(2, 1), FSize(36, 3));
|
Info.setGeometry(FPoint{2, 1}, FSize{36, 3});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -320,13 +320,13 @@ void Menu::cb_message (finalcut::FWidget* widget, const FDataPtr)
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app (argc, argv);
|
finalcut::FApplication app {argc, argv};
|
||||||
|
|
||||||
// Create main dialog object
|
// Create main dialog object
|
||||||
Menu main_dlg (&app);
|
Menu main_dlg {&app};
|
||||||
main_dlg.setText ("Menu example");
|
main_dlg.setText ("Menu example");
|
||||||
main_dlg.setGeometry ( FPoint(int(1 + (app.getWidth() - 40) / 2), 2)
|
main_dlg.setGeometry ( FPoint{int(1 + (app.getWidth() - 40) / 2), 2}
|
||||||
, FSize(40, 6) );
|
, FSize{40, 6} );
|
||||||
main_dlg.setShadow();
|
main_dlg.setShadow();
|
||||||
|
|
||||||
// Set dialog main_dlg as main widget
|
// Set dialog main_dlg as main widget
|
||||||
|
|
|
@ -74,8 +74,8 @@ class ColorChooser final : public finalcut::FWidget
|
||||||
ColorChooser::ColorChooser (finalcut::FWidget* parent)
|
ColorChooser::ColorChooser (finalcut::FWidget* parent)
|
||||||
: FWidget(parent)
|
: FWidget(parent)
|
||||||
{
|
{
|
||||||
FWidget::setSize (FSize(8, 12));
|
FWidget::setSize (FSize{8, 12});
|
||||||
setFixedSize (FSize(8, 12));
|
setFixedSize (FSize{8, 12});
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
|
|
||||||
if ( parent )
|
if ( parent )
|
||||||
|
@ -89,7 +89,7 @@ ColorChooser::ColorChooser (finalcut::FWidget* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text label
|
// Text label
|
||||||
headline.setGeometry (FPoint(1, 1), FSize(8, 1));
|
headline.setGeometry (FPoint{1, 1}, FSize{8, 1});
|
||||||
headline.setEmphasis();
|
headline.setEmphasis();
|
||||||
headline.setAlignment (fc::alignCenter);
|
headline.setAlignment (fc::alignCenter);
|
||||||
headline << "Color";
|
headline << "Color";
|
||||||
|
@ -127,7 +127,7 @@ void ColorChooser::draw()
|
||||||
|
|
||||||
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};
|
||||||
|
|
||||||
if ( c < 6 )
|
if ( c < 6 )
|
||||||
setColor (fc::LightGray, c);
|
setColor (fc::LightGray, c);
|
||||||
|
@ -148,7 +148,7 @@ void ColorChooser::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void ColorChooser::drawBorder()
|
void ColorChooser::drawBorder()
|
||||||
{
|
{
|
||||||
finalcut::drawBorder (this, FRect(FPoint(1, 2), FSize(8, 10)));
|
finalcut::drawBorder (this, FRect{FPoint{1, 2}, FSize{8, 10}});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -228,8 +228,8 @@ class Brushes final : public finalcut::FWidget
|
||||||
Brushes::Brushes (finalcut::FWidget* parent)
|
Brushes::Brushes (finalcut::FWidget* parent)
|
||||||
: FWidget(parent)
|
: FWidget(parent)
|
||||||
{
|
{
|
||||||
FWidget::setSize (FSize(8, 4));
|
FWidget::setSize (FSize{8, 4});
|
||||||
setFixedSize (FSize(8, 4));
|
setFixedSize (FSize{8, 4});
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
|
|
||||||
if ( parent )
|
if ( parent )
|
||||||
|
@ -243,7 +243,7 @@ Brushes::Brushes (finalcut::FWidget* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text label
|
// Text label
|
||||||
headline.setGeometry(FPoint(1, 1), FSize(8, 1));
|
headline.setGeometry(FPoint{1, 1}, FSize{8, 1});
|
||||||
headline.setEmphasis();
|
headline.setEmphasis();
|
||||||
headline.setAlignment (fc::alignCenter);
|
headline.setAlignment (fc::alignCenter);
|
||||||
headline << "Brush";
|
headline << "Brush";
|
||||||
|
@ -267,24 +267,24 @@ void Brushes::draw()
|
||||||
int pos{0};
|
int pos{0};
|
||||||
setColor();
|
setColor();
|
||||||
drawBorder();
|
drawBorder();
|
||||||
print() << FPoint(2, 3)
|
print() << FPoint{2, 3}
|
||||||
<< FColorPair(fg_color, bg_color) << " "
|
<< FColorPair{fg_color, bg_color} << " "
|
||||||
<< finalcut::FString(3, fc::MediumShade);
|
<< finalcut::FString{3, fc::MediumShade};
|
||||||
|
|
||||||
if ( brush != L' ' )
|
if ( brush != L' ' )
|
||||||
pos = 3;
|
pos = 3;
|
||||||
|
|
||||||
setColor();
|
setColor();
|
||||||
print() << FPoint(3 + pos, 2)
|
print() << FPoint{3 + pos, 2}
|
||||||
<< fc::BlackDownPointingTriangle
|
<< fc::BlackDownPointingTriangle
|
||||||
<< FPoint(3 + pos, 4)
|
<< FPoint{3 + pos, 4}
|
||||||
<< fc::BlackUpPointingTriangle;
|
<< fc::BlackUpPointingTriangle;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Brushes::drawBorder()
|
void Brushes::drawBorder()
|
||||||
{
|
{
|
||||||
finalcut::drawBorder (this, FRect(FPoint(1, 2), FSize(8, 3)));
|
finalcut::drawBorder (this, FRect{FPoint{1, 2}, FSize{8, 3}});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -382,17 +382,17 @@ MouseDraw::MouseDraw (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
{
|
{
|
||||||
FDialog::setText ("Drawing with the mouse");
|
FDialog::setText ("Drawing with the mouse");
|
||||||
c_chooser.setPos (FPoint(1, 1));
|
c_chooser.setPos (FPoint{1, 1});
|
||||||
c_chooser.addCallback
|
c_chooser.addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MouseDraw::cb_colorChanged)
|
F_METHOD_CALLBACK (this, &MouseDraw::cb_colorChanged)
|
||||||
);
|
);
|
||||||
|
|
||||||
brush.setPos (FPoint(1, 12));
|
brush.setPos (FPoint{1, 12});
|
||||||
|
|
||||||
FSize no_shadow(0, 0);
|
FSize no_shadow{0, 0};
|
||||||
finalcut::FRect scroll_geometry(0, 0, 1, 1);
|
finalcut::FRect scroll_geometry{0, 0, 1, 1};
|
||||||
createArea (scroll_geometry, no_shadow, canvas);
|
createArea (scroll_geometry, no_shadow, canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,8 +406,8 @@ void MouseDraw::setGeometry ( const FPoint& p, const FSize& s, bool adjust)
|
||||||
finalcut::FDialog::setGeometry (p, s, adjust);
|
finalcut::FDialog::setGeometry (p, s, adjust);
|
||||||
const std::size_t w = s.getWidth();
|
const std::size_t w = s.getWidth();
|
||||||
const std::size_t h = s.getHeight();
|
const std::size_t h = s.getHeight();
|
||||||
const finalcut::FRect scroll_geometry (FPoint(0, 0), FSize(w - 11, h - 3));
|
const finalcut::FRect scroll_geometry (FPoint{0, 0}, FSize{w - 11, h - 3});
|
||||||
const FSize no_shadow(0, 0);
|
const FSize no_shadow{0, 0};
|
||||||
const int old_w = canvas->width;
|
const int old_w = canvas->width;
|
||||||
const int old_h = canvas->height;
|
const int old_h = canvas->height;
|
||||||
resizeArea (scroll_geometry, no_shadow, canvas);
|
resizeArea (scroll_geometry, no_shadow, canvas);
|
||||||
|
@ -451,24 +451,24 @@ void MouseDraw::draw()
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
print() << FPoint(10, y_max)
|
print() << FPoint{10, y_max}
|
||||||
<< fc::NF_rev_border_corner_lower_right;
|
<< fc::NF_rev_border_corner_lower_right;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
print() << FPoint(10, y_max)
|
print() << FPoint{10, y_max}
|
||||||
<< fc::BoxDrawingsUpAndHorizontal;
|
<< fc::BoxDrawingsUpAndHorizontal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ void MouseDraw::adjustSize()
|
||||||
const std::size_t h{18};
|
const std::size_t h{18};
|
||||||
const int x = 1 + int((getParentWidget()->getWidth() - w) / 2);
|
const int x = 1 + int((getParentWidget()->getWidth() - w) / 2);
|
||||||
const int y = 1 + int((getParentWidget()->getHeight() - h) / 2);
|
const int y = 1 + int((getParentWidget()->getHeight() - h) / 2);
|
||||||
setGeometry (FPoint(x, y), FSize(w, h), false);
|
setGeometry (FPoint{x, y}, FSize{w, h}, false);
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,11 +588,11 @@ void MouseDraw::cb_colorChanged (const finalcut::FWidget*, const FDataPtr)
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
|
|
||||||
// Create a simple dialog box
|
// Create a simple dialog box
|
||||||
MouseDraw mouse_draw(&app);
|
MouseDraw mouse_draw{&app};
|
||||||
mouse_draw.setGeometry (FPoint(12, 4), FSize(60, 18));
|
mouse_draw.setGeometry (FPoint{12, 4}, FSize{60, 18});
|
||||||
|
|
||||||
// Set dialog object mouse_draw as main widget
|
// Set dialog object mouse_draw as main widget
|
||||||
finalcut::FWidget::setMainWidget(&mouse_draw);
|
finalcut::FWidget::setMainWidget(&mouse_draw);
|
||||||
|
|
|
@ -139,7 +139,7 @@ void move (int xold, int yold, int xnew, int ynew)
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication TermApp(argc, argv);
|
finalcut::FApplication TermApp{argc, argv};
|
||||||
|
|
||||||
// Pointer to the global virtual terminal object
|
// Pointer to the global virtual terminal object
|
||||||
app = &TermApp;
|
app = &TermApp;
|
||||||
|
@ -147,7 +147,7 @@ int main (int argc, char* argv[])
|
||||||
// Get screen dimension
|
// Get screen dimension
|
||||||
int xmax = int(TermApp.getDesktopWidth() - 1);
|
int xmax = int(TermApp.getDesktopWidth() - 1);
|
||||||
int 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
|
||||||
TermApp.setTermXY(0, 0);
|
TermApp.setTermXY(0, 0);
|
||||||
|
|
|
@ -153,18 +153,18 @@ void RotoZoomer::rotozoomer (double cx, double cy, double r, double a)
|
||||||
{
|
{
|
||||||
Cx = Ax;
|
Cx = Ax;
|
||||||
Cy = Ay;
|
Cy = Ay;
|
||||||
print() << FPoint(2, 3 + y);
|
print() << FPoint{2, 3 + y};
|
||||||
|
|
||||||
for (int x = 0; x < Cols; x++)
|
for (int x = 0; x < Cols; x++)
|
||||||
{
|
{
|
||||||
wchar_t ch = data[((Cy >> 14) & 0xf) + ((Cx >> 10) & 0xf0)];
|
wchar_t ch = data[((Cy >> 14) & 0xf) + ((Cx >> 10) & 0xf0)];
|
||||||
|
|
||||||
if ( ch == '+' )
|
if ( ch == '+' )
|
||||||
print() << finalcut::FColorPair(fc::Black, fc::Red);
|
print() << finalcut::FColorPair{fc::Black, fc::Red};
|
||||||
else if ( ch == 'x' )
|
else if ( ch == 'x' )
|
||||||
print() << finalcut::FColorPair(fc::Black, fc::Cyan);
|
print() << finalcut::FColorPair{fc::Black, fc::Cyan};
|
||||||
else
|
else
|
||||||
print() << finalcut::FColorPair(fc::Black, fc::White);
|
print() << finalcut::FColorPair{fc::Black, fc::White};
|
||||||
|
|
||||||
print() << ch;
|
print() << ch;
|
||||||
Cx += dxdx;
|
Cx += dxdx;
|
||||||
|
@ -190,9 +190,9 @@ void RotoZoomer::generateReport()
|
||||||
time_str << double(elapsed_ms) / 1000 << "ms";
|
time_str << double(elapsed_ms) / 1000 << "ms";
|
||||||
fps_str << double(loops) * 1000.0 / double(elapsed_ms);
|
fps_str << double(loops) * 1000.0 / double(elapsed_ms);
|
||||||
|
|
||||||
rep << finalcut::FString(55, '-') << "\n"
|
rep << finalcut::FString{55, '-'} << "\n"
|
||||||
<< "Terminal Size Time Loops Frame rate\n"
|
<< "Terminal Size Time Loops Frame rate\n"
|
||||||
<< finalcut::FString(55, '-') << "\n"
|
<< finalcut::FString{55, '-'} << "\n"
|
||||||
<< std::left << std::setw(20) << term_type
|
<< std::left << std::setw(20) << term_type
|
||||||
<< std::setw(8) << dimension_str
|
<< std::setw(8) << dimension_str
|
||||||
<< std::setw(10) << time_str
|
<< std::setw(10) << time_str
|
||||||
|
@ -276,7 +276,7 @@ void RotoZoomer::adjustSize()
|
||||||
if ( w > 8 )
|
if ( w > 8 )
|
||||||
w -= 8;
|
w -= 8;
|
||||||
|
|
||||||
setGeometry(FPoint(5, 1), FSize(w, h), false);
|
setGeometry(FPoint{5, 1}, FSize{w, h}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
|
@ -292,7 +292,7 @@ int main (int argc, char* argv[])
|
||||||
int quit_code{0};
|
int quit_code{0};
|
||||||
|
|
||||||
if ( argv[1] && ( strcmp(argv[1], "--help") == 0
|
if ( argv[1] && ( strcmp(argv[1], "--help") == 0
|
||||||
|| strcmp(argv[1], "-h") == 0 ) )
|
|| strcmp(argv[1], "-h") == 0 ) )
|
||||||
{
|
{
|
||||||
std::cout << "RotoZoomer options:\n"
|
std::cout << "RotoZoomer options:\n"
|
||||||
<< " -b, --benchmark "
|
<< " -b, --benchmark "
|
||||||
|
@ -305,17 +305,17 @@ int main (int argc, char* argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Create the application object in this scope
|
{ // Create the application object in this scope
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
app.setNonBlockingRead();
|
app.setNonBlockingRead();
|
||||||
|
|
||||||
// Create a simple dialog box
|
// Create a simple dialog box
|
||||||
constexpr int iterations = 314;
|
constexpr int iterations = 314;
|
||||||
RotoZoomer roto(&app, benchmark, iterations);
|
RotoZoomer roto{&app, benchmark, iterations};
|
||||||
|
|
||||||
if ( benchmark )
|
if ( benchmark )
|
||||||
roto.setGeometry (FPoint(1, 1), FSize(80, 24));
|
roto.setGeometry (FPoint{1, 1}, FSize{80, 24});
|
||||||
else
|
else
|
||||||
roto.setGeometry (FPoint(5, 1), FSize(72, 23));
|
roto.setGeometry (FPoint{5, 1}, FSize{72, 23});
|
||||||
|
|
||||||
roto.setShadow();
|
roto.setShadow();
|
||||||
|
|
||||||
|
|
|
@ -75,14 +75,14 @@ Scrollview::Scrollview (finalcut::FWidget* parent)
|
||||||
: finalcut::FScrollView(parent)
|
: finalcut::FScrollView(parent)
|
||||||
{
|
{
|
||||||
// Sets the navigation button geometry
|
// Sets the navigation button geometry
|
||||||
go_east.setGeometry (FPoint(1, 1), FSize(5, 1));
|
go_east.setGeometry (FPoint{1, 1}, FSize{5, 1});
|
||||||
go_south.setGeometry ( FPoint(int(getScrollWidth()) - 5, 1)
|
go_south.setGeometry ( FPoint{int(getScrollWidth()) - 5, 1}
|
||||||
, FSize(5, 1) );
|
, FSize{5, 1} );
|
||||||
go_west.setGeometry ( FPoint( int(getScrollWidth()) - 5
|
go_west.setGeometry ( FPoint{ int(getScrollWidth()) - 5
|
||||||
, int(getScrollHeight()) - 2 )
|
, int(getScrollHeight()) - 2 }
|
||||||
, FSize(5, 1) );
|
, FSize{5, 1} );
|
||||||
go_north.setGeometry ( FPoint(1, int(getScrollHeight()) - 2)
|
go_north.setGeometry ( FPoint{1, int(getScrollHeight()) - 2}
|
||||||
, FSize(5, 1) );
|
, FSize{5, 1} );
|
||||||
|
|
||||||
// Add scroll function callbacks to the buttons
|
// Add scroll function callbacks to the buttons
|
||||||
go_east.addCallback
|
go_east.addCallback
|
||||||
|
@ -120,9 +120,9 @@ void Scrollview::setScrollSize (const FSize& size)
|
||||||
FScrollView::setScrollSize (size);
|
FScrollView::setScrollSize (size);
|
||||||
const int width = int(size.getWidth());
|
const int width = int(size.getWidth());
|
||||||
const int height = int(size.getHeight());
|
const int height = int(size.getHeight());
|
||||||
go_south.setPos (FPoint(width - 5, 1));
|
go_south.setPos (FPoint{width - 5, 1});
|
||||||
go_west.setPos (FPoint(width - 5, height - 1));
|
go_west.setPos (FPoint{width - 5, height - 1});
|
||||||
go_north.setPos (FPoint(1, height - 1));
|
go_north.setPos (FPoint{1, height - 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -137,7 +137,7 @@ void Scrollview::draw()
|
||||||
|
|
||||||
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));
|
||||||
|
@ -216,15 +216,15 @@ class Scrollviewdemo final : public finalcut::FDialog
|
||||||
Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
|
Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
{
|
{
|
||||||
FDialog::setGeometry (FPoint(16, 3), FSize(50, 19));
|
FDialog::setGeometry (FPoint{16, 3}, FSize{50, 19});
|
||||||
FDialog::setText ("Scrolling viewport example");
|
FDialog::setText ("Scrolling viewport example");
|
||||||
|
|
||||||
// The scrolling viewport widget
|
// The scrolling viewport widget
|
||||||
sview.setGeometry(FPoint(3, 2), FSize(44, 12));
|
sview.setGeometry(FPoint{3, 2}, FSize{44, 12});
|
||||||
sview.setScrollSize(FSize(188, 124));
|
sview.setScrollSize(FSize{188, 124});
|
||||||
|
|
||||||
// Quit button
|
// Quit button
|
||||||
quit_btn.setGeometry(FPoint(37, 15), FSize(10, 1));
|
quit_btn.setGeometry(FPoint{37, 15}, FSize{10, 1});
|
||||||
|
|
||||||
// Add function callback
|
// Add function callback
|
||||||
quit_btn.addCallback
|
quit_btn.addCallback
|
||||||
|
@ -234,7 +234,7 @@ Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Text label
|
// Text label
|
||||||
label.setGeometry(FPoint(2, 1), FSize(46, 1));
|
label.setGeometry(FPoint{2, 1}, FSize{46, 1});
|
||||||
label.setEmphasis();
|
label.setEmphasis();
|
||||||
label << L"Use scrollbars to change the viewport position";
|
label << L"Use scrollbars to change the viewport position";
|
||||||
}
|
}
|
||||||
|
@ -262,10 +262,10 @@ void Scrollviewdemo::onClose (finalcut::FCloseEvent* ev)
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
|
|
||||||
// Create a simple dialog box
|
// Create a simple dialog box
|
||||||
Scrollviewdemo svdemo(&app);
|
Scrollviewdemo svdemo{&app};
|
||||||
|
|
||||||
// Set dialog main_dlg as main widget
|
// Set dialog main_dlg as main widget
|
||||||
finalcut::FWidget::setMainWidget(&svdemo);
|
finalcut::FWidget::setMainWidget(&svdemo);
|
||||||
|
|
|
@ -76,14 +76,14 @@ AttribDlg::AttribDlg (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
{
|
{
|
||||||
FDialog::setText ( "A terminal attributes test ("
|
FDialog::setText ( "A terminal attributes test ("
|
||||||
+ finalcut::FString(getTermType())
|
+ finalcut::FString{getTermType()}
|
||||||
+ ")");
|
+ ")");
|
||||||
|
|
||||||
next_button.setGeometry ( FPoint(int(getWidth()) - 13, int(getHeight()) - 4)
|
next_button.setGeometry ( FPoint{int(getWidth()) - 13, int(getHeight()) - 4}
|
||||||
, FSize(10, 1) );
|
, FSize{10, 1} );
|
||||||
next_button.addAccelerator (fc::Fkey_right);
|
next_button.addAccelerator (fc::Fkey_right);
|
||||||
back_button.setGeometry ( FPoint(int(getWidth()) - 25, int(getHeight()) - 4)
|
back_button.setGeometry ( FPoint{int(getWidth()) - 25, int(getHeight()) - 4}
|
||||||
, FSize(10, 1) );
|
, FSize{10, 1} );
|
||||||
back_button.addAccelerator (fc::Fkey_left);
|
back_button.addAccelerator (fc::Fkey_left);
|
||||||
|
|
||||||
// Add function callbacks
|
// Add function callbacks
|
||||||
|
@ -186,11 +186,11 @@ void AttribDlg::adjustSize()
|
||||||
if ( y < 1 )
|
if ( y < 1 )
|
||||||
y = 1;
|
y = 1;
|
||||||
|
|
||||||
setGeometry(FPoint(x, y), FSize(69, 21), false);
|
setGeometry(FPoint{x, y}, FSize{69, 21}, false);
|
||||||
next_button.setGeometry ( FPoint(int(getWidth()) - 13, int(getHeight()) - 4)
|
next_button.setGeometry ( FPoint{int(getWidth()) - 13, int(getHeight()) - 4}
|
||||||
, FSize(10, 1), false );
|
, FSize{10, 1}, false );
|
||||||
back_button.setGeometry ( FPoint(int(getWidth()) - 25, int(getHeight()) - 4)
|
back_button.setGeometry ( FPoint{int(getWidth()) - 25, int(getHeight()) - 4}
|
||||||
, FSize(10, 1), false );
|
, FSize{10, 1}, false );
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ void AttribDemo::printColorLine()
|
||||||
|
|
||||||
for (FColor color{0}; color < last_color; color++)
|
for (FColor color{0}; color < last_color; color++)
|
||||||
{
|
{
|
||||||
print() << FColorPair(color, parent->getBGColor()) << " # ";
|
print() << FColorPair{color, parent->getBGColor()} << " # ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ void AttribDemo::printAltCharset()
|
||||||
if ( ! isMonochron() )
|
if ( ! isMonochron() )
|
||||||
setColor (wc.label_fg, wc.label_bg);
|
setColor (wc.label_fg, wc.label_bg);
|
||||||
|
|
||||||
print() << FPoint(1, 1) << "alternate charset: ";
|
print() << FPoint{1, 1} << "alternate charset: ";
|
||||||
|
|
||||||
if ( parent->getBGColor() == fc::Default )
|
if ( parent->getBGColor() == fc::Default )
|
||||||
{
|
{
|
||||||
|
@ -439,7 +439,7 @@ void AttribDemo::draw()
|
||||||
|
|
||||||
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)};
|
||||||
|
|
||||||
if ( ! isMonochron() )
|
if ( ! isMonochron() )
|
||||||
setColor (wc.label_fg, wc.label_bg);
|
setColor (wc.label_fg, wc.label_bg);
|
||||||
|
@ -451,7 +451,7 @@ void AttribDemo::draw()
|
||||||
if ( ! isMonochron() )
|
if ( ! isMonochron() )
|
||||||
setColor(wc.label_fg, wc.label_bg);
|
setColor(wc.label_fg, wc.label_bg);
|
||||||
|
|
||||||
print() << FPoint(1, 15);
|
print() << FPoint{1, 15};
|
||||||
const FColor bg = static_cast<AttribDlg*>(getParent())->getBGColor();
|
const FColor bg = static_cast<AttribDlg*>(getParent())->getBGColor();
|
||||||
print (" Background color:");
|
print (" Background color:");
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ void AttribDemo::draw()
|
||||||
else
|
else
|
||||||
printf ( " %d", bg);
|
printf ( " %d", bg);
|
||||||
|
|
||||||
print() << FPoint(16, 17) << "Change background color ->";
|
print() << FPoint{16, 17} << "Change background color ->";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -470,19 +470,19 @@ void AttribDemo::draw()
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app (argc, argv);
|
finalcut::FApplication app {argc, argv};
|
||||||
|
|
||||||
// Create a dialog box object.
|
// Create a dialog box object.
|
||||||
// This object will be automatically deleted by
|
// This object will be automatically deleted by
|
||||||
// the parent object "app" (FObject destructor).
|
// the parent object "app" (FObject destructor).
|
||||||
AttribDlg dialog(&app);
|
AttribDlg dialog{&app};
|
||||||
|
|
||||||
dialog.setGeometry (FPoint(6, 2), FSize(69, 21));
|
dialog.setGeometry (FPoint{6, 2}, FSize{69, 21});
|
||||||
dialog.setShadow();
|
dialog.setShadow();
|
||||||
|
|
||||||
// Create the attribute demo widget as a child object from the dialog
|
// Create the attribute demo widget as a child object from the dialog
|
||||||
AttribDemo demo(&dialog);
|
AttribDemo demo(&dialog);
|
||||||
demo.setGeometry (FPoint(1, 1), FSize(67, 19));
|
demo.setGeometry (FPoint{1, 1}, FSize{67, 19});
|
||||||
|
|
||||||
// Set the dialog object as main widget
|
// Set the dialog object as main widget
|
||||||
finalcut::FWidget::setMainWidget(&dialog);
|
finalcut::FWidget::setMainWidget(&dialog);
|
||||||
|
|
|
@ -297,7 +297,7 @@ void string()
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
const bool disable_alt_screen{true};
|
const bool disable_alt_screen{true};
|
||||||
finalcut::FApplication TermApp (argc, argv, disable_alt_screen);
|
finalcut::FApplication TermApp {argc, argv, disable_alt_screen};
|
||||||
|
|
||||||
std::cout << "--------\r\nFTermcap\r\n--------\r\n\n";
|
std::cout << "--------\r\nFTermcap\r\n--------\r\n\n";
|
||||||
std::cout << "Terminal: " << TermApp.getTermType() << "\r\n";
|
std::cout << "Terminal: " << TermApp.getTermType() << "\r\n";
|
||||||
|
|
|
@ -61,11 +61,11 @@ Timer::Timer (finalcut::FWidget* parent)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Timer::draw()
|
void Timer::draw()
|
||||||
{
|
{
|
||||||
print() << finalcut::FPoint(1, 1)
|
print() << finalcut::FPoint{1, 1}
|
||||||
<< "---------------\n"
|
<< "---------------\n"
|
||||||
<< "Press Q to quit\n"
|
<< "Press Q to quit\n"
|
||||||
<< "---------------\n";
|
<< "---------------\n";
|
||||||
setAreaCursor (finalcut::FPoint(1, 4), true, getVirtualDesktop());
|
setAreaCursor ({1, 4}, true, getVirtualDesktop());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -77,14 +77,13 @@ void Timer::onTimer (finalcut::FTimerEvent* ev)
|
||||||
if ( getPrintPos().getY() == int(getDesktopHeight()) )
|
if ( getPrintPos().getY() == int(getDesktopHeight()) )
|
||||||
is_last_line = true;
|
is_last_line = true;
|
||||||
|
|
||||||
print() << finalcut::FColorPair (FColor(1 + timer_id))
|
print() << finalcut::FColorPair {FColor(1 + timer_id)}
|
||||||
<< "Timer event, id " << timer_id << '\n';
|
<< "Timer event, id " << timer_id << '\n';
|
||||||
|
|
||||||
if ( is_last_line )
|
if ( is_last_line )
|
||||||
scrollAreaForward (getVirtualDesktop());
|
scrollAreaForward (getVirtualDesktop());
|
||||||
|
|
||||||
setAreaCursor ( finalcut::FPoint(1, getPrintPos().getY())
|
setAreaCursor ({1, getPrintPos().getY()}, true, getVirtualDesktop());
|
||||||
, true, getVirtualDesktop() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -101,12 +100,12 @@ void Timer::onAccel (finalcut::FAccelEvent* ev)
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
app.setForegroundColor(fc::Default);
|
app.setForegroundColor(fc::Default);
|
||||||
app.setBackgroundColor(fc::Default);
|
app.setBackgroundColor(fc::Default);
|
||||||
|
|
||||||
// Create a timer object t
|
// Create a timer object t
|
||||||
Timer t(&app);
|
Timer t{&app};
|
||||||
t.addAccelerator('q');
|
t.addAccelerator('q');
|
||||||
|
|
||||||
// Set the timer object t as main widget
|
// Set the timer object t as main widget
|
||||||
|
|
|
@ -95,31 +95,31 @@ void Transparent::draw()
|
||||||
if ( type == shadow )
|
if ( type == shadow )
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
print() << FColorPair (wc.shadow_bg, wc.shadow_fg)
|
print() << FColorPair {wc.shadow_bg, wc.shadow_fg}
|
||||||
<< FStyle (fc::ColorOverlay);
|
<< FStyle {fc::ColorOverlay};
|
||||||
}
|
}
|
||||||
else if ( type == inherit_background )
|
else if ( type == inherit_background )
|
||||||
{
|
{
|
||||||
if ( getMaxColor() > 8 )
|
if ( getMaxColor() > 8 )
|
||||||
print() << FColorPair (fc::Blue, fc::Black);
|
print() << FColorPair {fc::Blue, fc::Black};
|
||||||
else
|
else
|
||||||
print() << FColorPair (fc::Green, fc::Black);
|
print() << FColorPair {fc::Green, fc::Black};
|
||||||
|
|
||||||
print() << FStyle (fc::InheritBackground);
|
print() << FStyle {fc::InheritBackground};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print() << FStyle (fc::Transparent);
|
print() << FStyle {fc::Transparent};
|
||||||
|
|
||||||
const finalcut::FString line(getClientWidth(), '.');
|
const finalcut::FString line{getClientWidth(), '.'};
|
||||||
|
|
||||||
// Fill window area
|
// Fill window area
|
||||||
for (int n{1}; n <= int(getClientHeight()); n++)
|
for (int n{1}; n <= int(getClientHeight()); n++)
|
||||||
{
|
{
|
||||||
print() << FPoint(2, 2 + n)
|
print() << FPoint{2, 2 + n}
|
||||||
<< line;
|
<< line;
|
||||||
}
|
}
|
||||||
|
|
||||||
print() << FStyle (fc::Reset);
|
print() << FStyle{fc::Reset};
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -199,17 +199,17 @@ MainWindow::MainWindow (finalcut::FWidget* parent)
|
||||||
// is not required in this class and would result in a double free.
|
// is not required in this class and would result in a double free.
|
||||||
transpwin = new Transparent(this);
|
transpwin = new Transparent(this);
|
||||||
transpwin->setText("transparent");
|
transpwin->setText("transparent");
|
||||||
transpwin->setGeometry (FPoint(6, 3), FSize(29, 12));
|
transpwin->setGeometry (FPoint{6, 3}, FSize{29, 12});
|
||||||
transpwin->unsetTransparentShadow();
|
transpwin->unsetTransparentShadow();
|
||||||
|
|
||||||
shadowwin = new Transparent(this, Transparent::shadow);
|
shadowwin = new Transparent(this, Transparent::shadow);
|
||||||
shadowwin->setText("shadow");
|
shadowwin->setText("shadow");
|
||||||
shadowwin->setGeometry (FPoint(46, 11), FSize(29, 12));
|
shadowwin->setGeometry (FPoint{46, 11}, FSize{29, 12});
|
||||||
shadowwin->unsetTransparentShadow();
|
shadowwin->unsetTransparentShadow();
|
||||||
|
|
||||||
ibg = new Transparent(this, Transparent::inherit_background);
|
ibg = new Transparent(this, Transparent::inherit_background);
|
||||||
ibg->setText("inherit background");
|
ibg->setText("inherit background");
|
||||||
ibg->setGeometry (FPoint(42, 3), FSize(29, 7));
|
ibg->setGeometry (FPoint{42, 3}, FSize{29, 7});
|
||||||
ibg->unsetTransparentShadow();
|
ibg->unsetTransparentShadow();
|
||||||
|
|
||||||
// Set statusbar text for this window
|
// Set statusbar text for this window
|
||||||
|
@ -232,8 +232,8 @@ void MainWindow::draw()
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
setColor();
|
setColor();
|
||||||
print() << FPoint(2, 4) << line1;
|
print() << FPoint{2, 4} << line1;
|
||||||
print() << FPoint(2, 5) << line2;
|
print() << FPoint{2, 5} << line2;
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
@ -273,13 +273,13 @@ void MainWindow::onTimer (finalcut::FTimerEvent*)
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app (argc, argv);
|
finalcut::FApplication app {argc, argv};
|
||||||
app.setNonBlockingRead();
|
app.setNonBlockingRead();
|
||||||
|
|
||||||
// Create main dialog object
|
// Create main dialog object
|
||||||
MainWindow main_dlg (&app);
|
MainWindow main_dlg {&app};
|
||||||
main_dlg.setText ("non-transparent");
|
main_dlg.setText ("non-transparent");
|
||||||
main_dlg.setGeometry (FPoint(8, 16), FSize(26, 7));
|
main_dlg.setGeometry (FPoint{8, 16}, FSize{26, 7});
|
||||||
|
|
||||||
// Set dialog main_dlg as main widget
|
// Set dialog main_dlg as main widget
|
||||||
finalcut::FWidget::setMainWidget (&main_dlg);
|
finalcut::FWidget::setMainWidget (&main_dlg);
|
||||||
|
|
|
@ -329,7 +329,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
{
|
{
|
||||||
// Set FListView geometry
|
// Set FListView geometry
|
||||||
listView.setGeometry(FPoint(2, 1), FSize(53, 14));
|
listView.setGeometry(FPoint{2, 1}, FSize{53, 14});
|
||||||
|
|
||||||
// Add columns to the view
|
// Add columns to the view
|
||||||
listView.addColumn ("Name", 23);
|
listView.addColumn ("Name", 23);
|
||||||
|
@ -379,7 +379,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit button
|
// Quit button
|
||||||
Quit.setGeometry(FPoint(24, 16), FSize(10, 1));
|
Quit.setGeometry(FPoint{24, 16}, FSize{10, 1});
|
||||||
Quit.setText (L"&Quit");
|
Quit.setText (L"&Quit");
|
||||||
|
|
||||||
// Callback function
|
// Callback function
|
||||||
|
@ -431,13 +431,13 @@ void Treeview::onClose (finalcut::FCloseEvent* ev)
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
|
|
||||||
// Create main dialog object
|
// Create main dialog object
|
||||||
Treeview d(&app);
|
Treeview d{&app};
|
||||||
d.setText (L"Continents");
|
d.setText (L"Continents");
|
||||||
d.setGeometry ( FPoint(int(1 + (app.getWidth() - 57) / 2), 3)
|
d.setGeometry ( FPoint{int(1 + (app.getWidth() - 57) / 2), 3}
|
||||||
, FSize(57, 20) );
|
, FSize{57, 20} );
|
||||||
d.setShadow();
|
d.setShadow();
|
||||||
|
|
||||||
// Set dialog d as main widget
|
// Set dialog d as main widget
|
||||||
|
|
104
examples/ui.cpp
104
examples/ui.cpp
|
@ -81,26 +81,26 @@ ProgressDialog::ProgressDialog (finalcut::FWidget* parent)
|
||||||
// Dialog settings
|
// Dialog settings
|
||||||
// Avoids calling a virtual function from the constructor
|
// Avoids calling a virtual function from the constructor
|
||||||
// (CERT, OOP50-CPP)
|
// (CERT, OOP50-CPP)
|
||||||
FDialog::setGeometry ( FPoint(int((getParentWidget()->getWidth() - 40) / 2), 7)
|
FDialog::setGeometry ( FPoint{int((getParentWidget()->getWidth() - 40) / 2), 7}
|
||||||
, FSize(40, 10) );
|
, FSize{40, 10} );
|
||||||
FDialog::setText("Progress bar");
|
FDialog::setText("Progress bar");
|
||||||
//setModal();
|
//setModal();
|
||||||
|
|
||||||
reset.setText("&Reset");
|
reset.setText("&Reset");
|
||||||
reset.setStatusbarMessage ("Reset the progress bar");
|
reset.setStatusbarMessage ("Reset the progress bar");
|
||||||
reset.setGeometry(FPoint(2, 6), FSize(8, 1), false);
|
reset.setGeometry(FPoint{2, 6}, FSize{8, 1}, false);
|
||||||
reset.setDisable();
|
reset.setDisable();
|
||||||
|
|
||||||
more.setText("&More");
|
more.setText("&More");
|
||||||
more.setStatusbarMessage ("Increases the progress bar position");
|
more.setStatusbarMessage ("Increases the progress bar position");
|
||||||
more.setGeometry(FPoint(15, 6), FSize(8, 1), false);
|
more.setGeometry(FPoint{15, 6}, FSize{8, 1}, false);
|
||||||
more.setDisable();
|
more.setDisable();
|
||||||
|
|
||||||
quit.setText("E&xit");
|
quit.setText("E&xit");
|
||||||
quit.setGeometry(FPoint(28, 6), FSize(8, 1), false);
|
quit.setGeometry(FPoint{28, 6}, FSize{8, 1}, false);
|
||||||
quit.setDisable();
|
quit.setDisable();
|
||||||
|
|
||||||
progressBar.setGeometry(FPoint(2, 3), FSize(34, 1), false);
|
progressBar.setGeometry(FPoint{2, 3}, FSize{34, 1}, false);
|
||||||
//progressBar.setPercentage(78);
|
//progressBar.setPercentage(78);
|
||||||
|
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
|
@ -221,8 +221,8 @@ TextWindow::TextWindow (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog(parent)
|
: finalcut::FDialog(parent)
|
||||||
{
|
{
|
||||||
scrollText.ignorePadding();
|
scrollText.ignorePadding();
|
||||||
scrollText.setGeometry (FPoint(1, 2), FSize(getWidth(), getHeight() - 1));
|
scrollText.setGeometry (FPoint{1, 2}, FSize{getWidth(), getHeight() - 1});
|
||||||
setMinimumSize (FSize(51, 6));
|
setMinimumSize (FSize{51, 6});
|
||||||
scrollText.setFocus();
|
scrollText.setFocus();
|
||||||
scrollText.insert(" -----------------------------------------------\n"
|
scrollText.insert(" -----------------------------------------------\n"
|
||||||
" line 1\n"
|
" line 1\n"
|
||||||
|
@ -248,7 +248,7 @@ void TextWindow::append (const finalcut::FString& str)
|
||||||
void TextWindow::adjustSize()
|
void TextWindow::adjustSize()
|
||||||
{
|
{
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
scrollText.setGeometry (FPoint(1, 2), FSize(getWidth(), getHeight() - 1));
|
scrollText.setGeometry (FPoint{1, 2}, FSize(getWidth(), getHeight() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -563,16 +563,16 @@ void MyDialog::initWidgets()
|
||||||
initToggleButtons();
|
initToggleButtons();
|
||||||
|
|
||||||
// A text input field
|
// A text input field
|
||||||
myLineEdit.setGeometry(FPoint(22, 1), FSize(10, 1));
|
myLineEdit.setGeometry(FPoint{22, 1}, FSize{10, 1});
|
||||||
myLineEdit.setLabelText (L"&Input");
|
myLineEdit.setLabelText (L"&Input");
|
||||||
myLineEdit.setStatusbarMessage ("Press Enter to set the title");
|
myLineEdit.setStatusbarMessage ("Press Enter to set the title");
|
||||||
myLineEdit << finalcut::FString("EnTry").toLower();
|
myLineEdit << finalcut::FString{"EnTry"}.toLower();
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
initButtons();
|
initButtons();
|
||||||
|
|
||||||
// A multiple selection listbox
|
// A multiple selection listbox
|
||||||
myList.setGeometry(FPoint(38, 1), FSize(14, 17));
|
myList.setGeometry(FPoint{38, 1}, FSize{14, 17});
|
||||||
myList.setText ("Items");
|
myList.setText ("Items");
|
||||||
|
|
||||||
myList.setStatusbarMessage ("99 items in a list");
|
myList.setStatusbarMessage ("99 items in a list");
|
||||||
|
@ -580,7 +580,7 @@ void MyDialog::initWidgets()
|
||||||
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
|
||||||
initLabels();
|
initLabels();
|
||||||
|
@ -590,21 +590,21 @@ void MyDialog::initWidgets()
|
||||||
void MyDialog::initFlatButtons()
|
void MyDialog::initFlatButtons()
|
||||||
{
|
{
|
||||||
// Flat buttons
|
// Flat buttons
|
||||||
MyButton1.setGeometry(FPoint(3, 3), FSize(5, 1));
|
MyButton1.setGeometry(FPoint{3, 3}, FSize{5, 1});
|
||||||
MyButton1.setText (L"&SIN");
|
MyButton1.setText (L"&SIN");
|
||||||
MyButton1.setStatusbarMessage ("Sine function");
|
MyButton1.setStatusbarMessage ("Sine function");
|
||||||
MyButton1.setNoUnderline();
|
MyButton1.setNoUnderline();
|
||||||
MyButton1.setFlat();
|
MyButton1.setFlat();
|
||||||
MyButton1.setDoubleFlatLine (fc::bottom);
|
MyButton1.setDoubleFlatLine (fc::bottom);
|
||||||
|
|
||||||
MyButton2.setGeometry(FPoint(3, 5), FSize(5, 1));
|
MyButton2.setGeometry(FPoint{3, 5}, FSize{5, 1});
|
||||||
MyButton2.setText (L"&COS");
|
MyButton2.setText (L"&COS");
|
||||||
MyButton2.setStatusbarMessage ("Cosine function");
|
MyButton2.setStatusbarMessage ("Cosine function");
|
||||||
MyButton2.setNoUnderline();
|
MyButton2.setNoUnderline();
|
||||||
MyButton2.setFlat();
|
MyButton2.setFlat();
|
||||||
MyButton2.setDoubleFlatLine (fc::top);
|
MyButton2.setDoubleFlatLine (fc::top);
|
||||||
|
|
||||||
MyButton3.setGeometry(FPoint(10, 3), FSize(5, 3));
|
MyButton3.setGeometry(FPoint{10, 3}, FSize{5, 3});
|
||||||
MyButton3.setText (L"&=");
|
MyButton3.setText (L"&=");
|
||||||
MyButton3.setStatusbarMessage ("Equal");
|
MyButton3.setStatusbarMessage ("Equal");
|
||||||
MyButton3.setNoUnderline();
|
MyButton3.setNoUnderline();
|
||||||
|
@ -634,25 +634,25 @@ void MyDialog::initFlatButtons()
|
||||||
void MyDialog::initToggleButtons()
|
void MyDialog::initToggleButtons()
|
||||||
{
|
{
|
||||||
// Radio buttons in a group
|
// Radio buttons in a group
|
||||||
radioButtonGroup.setGeometry(FPoint(3, 8), FSize(14, 4));
|
radioButtonGroup.setGeometry(FPoint{3, 8}, FSize{14, 4});
|
||||||
//radioButtonGroup->unsetBorder();
|
//radioButtonGroup->unsetBorder();
|
||||||
|
|
||||||
radio1.setGeometry(FPoint(1, 1), FSize(10, 1));
|
radio1.setGeometry(FPoint{1, 1}, FSize{10, 1});
|
||||||
radio1.setStatusbarMessage ("Enable button Test");
|
radio1.setStatusbarMessage ("Enable button Test");
|
||||||
|
|
||||||
radio2.setGeometry(FPoint(1, 2), FSize(11, 1));
|
radio2.setGeometry(FPoint{1, 2}, FSize{11, 1});
|
||||||
radio2.setText ("&Disable");
|
radio2.setText ("&Disable");
|
||||||
radio2.setStatusbarMessage ("Disable button Test");
|
radio2.setStatusbarMessage ("Disable button Test");
|
||||||
radio2.setChecked();
|
radio2.setChecked();
|
||||||
//radio2.setDisable();
|
//radio2.setDisable();
|
||||||
|
|
||||||
// Checkboxes in a group
|
// Checkboxes in a group
|
||||||
checkButtonGroup.setGeometry(FPoint(3, 12), FSize(14, 4));
|
checkButtonGroup.setGeometry(FPoint{3, 12}, FSize{14, 4});
|
||||||
|
|
||||||
check1.setGeometry(FPoint(1, 1), FSize(11, 1));
|
check1.setGeometry(FPoint{1, 1}, FSize{11, 1});
|
||||||
check1.setNoUnderline();
|
check1.setNoUnderline();
|
||||||
|
|
||||||
check2.setGeometry(FPoint(1, 2), FSize(9, 1));
|
check2.setGeometry(FPoint{1, 2}, FSize{9, 1});
|
||||||
check2.setChecked();
|
check2.setChecked();
|
||||||
check2.setNoUnderline();
|
check2.setNoUnderline();
|
||||||
}
|
}
|
||||||
|
@ -661,17 +661,17 @@ void MyDialog::initToggleButtons()
|
||||||
void MyDialog::initButtons()
|
void MyDialog::initButtons()
|
||||||
{
|
{
|
||||||
// Buttons
|
// Buttons
|
||||||
MyButton4.setGeometry(FPoint(20, 8), FSize(12, 1));
|
MyButton4.setGeometry(FPoint{20, 8}, FSize{12, 1});
|
||||||
MyButton4.setText (L"&Get input");
|
MyButton4.setText (L"&Get input");
|
||||||
MyButton4.setStatusbarMessage ("Take text from input field");
|
MyButton4.setStatusbarMessage ("Take text from input field");
|
||||||
MyButton4.setFocus();
|
MyButton4.setFocus();
|
||||||
|
|
||||||
MyButton5.setGeometry(FPoint(20, 11), FSize(12, 1));
|
MyButton5.setGeometry(FPoint{20, 11}, FSize{12, 1});
|
||||||
MyButton5.setText (L"&Test");
|
MyButton5.setText (L"&Test");
|
||||||
MyButton5.setStatusbarMessage ("Progressbar testing dialog");
|
MyButton5.setStatusbarMessage ("Progressbar testing dialog");
|
||||||
MyButton5.setDisable();
|
MyButton5.setDisable();
|
||||||
|
|
||||||
MyButton6.setGeometry(FPoint(20, 14), FSize(12, 1));
|
MyButton6.setGeometry(FPoint{20, 14}, FSize{12, 1});
|
||||||
MyButton6.setText (L"&Quit");
|
MyButton6.setText (L"&Quit");
|
||||||
MyButton6.setStatusbarMessage ("Exit the program");
|
MyButton6.setStatusbarMessage ("Exit the program");
|
||||||
MyButton6.addAccelerator('x');
|
MyButton6.addAccelerator('x');
|
||||||
|
@ -701,20 +701,20 @@ void MyDialog::initButtons()
|
||||||
void MyDialog::initLabels()
|
void MyDialog::initLabels()
|
||||||
{
|
{
|
||||||
// Text labels
|
// Text labels
|
||||||
headline.setGeometry(FPoint(21, 3), FSize(10, 1));
|
headline.setGeometry(FPoint{21, 3}, FSize{10, 1});
|
||||||
headline.setEmphasis();
|
headline.setEmphasis();
|
||||||
headline.setAlignment (fc::alignCenter);
|
headline.setAlignment (fc::alignCenter);
|
||||||
headline = L"List items";
|
headline = L"List items";
|
||||||
|
|
||||||
tagged.setGeometry(FPoint(21, 4), FSize(7, 1));
|
tagged.setGeometry(FPoint{21, 4}, FSize{7, 1});
|
||||||
|
|
||||||
tagged_count.setGeometry(FPoint(29, 4), FSize(5, 1));
|
tagged_count.setGeometry(FPoint{29, 4}, FSize{5, 1});
|
||||||
tagged_count << 0;
|
tagged_count << 0;
|
||||||
|
|
||||||
sum.setGeometry(FPoint(21, 5), FSize(7, 3));
|
sum.setGeometry(FPoint{21, 5}, FSize{7, 3});
|
||||||
sum.setAlignment (fc::alignRight);
|
sum.setAlignment (fc::alignRight);
|
||||||
|
|
||||||
sum_count.setGeometry(FPoint(29, 5), FSize(5, 3));
|
sum_count.setGeometry(FPoint{29, 5}, FSize{5, 3});
|
||||||
sum_count << myList.getCount();
|
sum_count << myList.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,7 +809,7 @@ void MyDialog::cb_terminfo (const finalcut::FWidget*, const FDataPtr)
|
||||||
finalcut::FMessageBox info1 \
|
finalcut::FMessageBox info1 \
|
||||||
(
|
(
|
||||||
"Environment"
|
"Environment"
|
||||||
, finalcut::FString()
|
, finalcut::FString{}
|
||||||
<< " Type: " << getTermType() << "\n"
|
<< " Type: " << getTermType() << "\n"
|
||||||
<< " Name: " << getTermFileName() << "\n"
|
<< " Name: " << getTermFileName() << "\n"
|
||||||
<< " Mode: " << getEncodingString() << "\n"
|
<< " Mode: " << getEncodingString() << "\n"
|
||||||
|
@ -836,22 +836,22 @@ void MyDialog::cb_drives (const finalcut::FWidget*, const FDataPtr)
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
finalcut::FLabel drive (finalcut::NF_Drive, &info2);
|
finalcut::FLabel drive {finalcut::NF_Drive, &info2};
|
||||||
drive.setGeometry (FPoint(11, 2), FSize(4, 1));
|
drive.setGeometry (FPoint{11, 2}, FSize{4, 1});
|
||||||
finalcut::FLabel net (finalcut::NF_Net_Drive, &info2);
|
finalcut::FLabel net {finalcut::NF_Net_Drive, &info2};
|
||||||
net.setGeometry (FPoint(11, 4), FSize(4, 1));
|
net.setGeometry (FPoint{11, 4}, FSize{4, 1});
|
||||||
finalcut::FLabel cd (finalcut::NF_CD_ROM, &info2);
|
finalcut::FLabel cd {finalcut::NF_CD_ROM, &info2};
|
||||||
cd.setGeometry (FPoint(11, 6), FSize(4, 1));
|
cd.setGeometry (FPoint{11, 6}, FSize{4, 1});
|
||||||
info2.exec();
|
info2.exec();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
finalcut::FLabel drive (" - ", &info2);
|
finalcut::FLabel drive {" - ", &info2};
|
||||||
drive.setGeometry (FPoint(11, 2), FSize(4, 1));
|
drive.setGeometry (FPoint{11, 2}, FSize{4, 1});
|
||||||
finalcut::FLabel net (" N ", &info2);
|
finalcut::FLabel net {" N ", &info2};
|
||||||
net.setGeometry (FPoint(11, 4), FSize(4, 1));
|
net.setGeometry (FPoint{11, 4}, FSize{4, 1});
|
||||||
finalcut::FLabel cd (" CD ", &info2);
|
finalcut::FLabel cd {" CD ", &info2};
|
||||||
cd.setGeometry (FPoint(11, 6), FSize(4, 1));
|
cd.setGeometry (FPoint{11, 6}, FSize{4, 1});
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
{
|
{
|
||||||
|
@ -915,7 +915,7 @@ void MyDialog::cb_input2buttonText (finalcut::FWidget* widget, FDataPtr data)
|
||||||
void MyDialog::cb_setTitlebar (finalcut::FWidget* widget, const FDataPtr)
|
void MyDialog::cb_setTitlebar (finalcut::FWidget* widget, const FDataPtr)
|
||||||
{
|
{
|
||||||
auto& lineedit = *(static_cast<finalcut::FLineEdit*>(widget));
|
auto& lineedit = *(static_cast<finalcut::FLineEdit*>(widget));
|
||||||
finalcut::FString title;
|
finalcut::FString title{};
|
||||||
lineedit >> title;
|
lineedit >> title;
|
||||||
setTermTitle (title);
|
setTermTitle (title);
|
||||||
setText (title);
|
setText (title);
|
||||||
|
@ -963,7 +963,7 @@ void MyDialog::cb_activateButton (finalcut::FWidget* widget, FDataPtr data)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::cb_view (const finalcut::FWidget*, FDataPtr data)
|
void MyDialog::cb_view (const finalcut::FWidget*, FDataPtr data)
|
||||||
{
|
{
|
||||||
finalcut::FString file;
|
finalcut::FString file{};
|
||||||
const auto& item = static_cast<finalcut::FMenuItem*>(data);
|
const auto& item = static_cast<finalcut::FMenuItem*>(data);
|
||||||
|
|
||||||
if ( item && ! item->getText().isEmpty() )
|
if ( item && ! item->getText().isEmpty() )
|
||||||
|
@ -977,9 +977,9 @@ void MyDialog::cb_view (const finalcut::FWidget*, FDataPtr data)
|
||||||
const auto& view = new TextWindow(this);
|
const auto& view = new TextWindow(this);
|
||||||
finalcut::FString filename(basename(const_cast<char*>(file.c_str())));
|
finalcut::FString filename(basename(const_cast<char*>(file.c_str())));
|
||||||
view->setText ("Viewer: " + filename);
|
view->setText ("Viewer: " + filename);
|
||||||
view->setGeometry ( FPoint ( 1 + int((getRootWidget()->getWidth() - 60) / 2),
|
view->setGeometry ( FPoint { 1 + int((getRootWidget()->getWidth() - 60) / 2),
|
||||||
int(getRootWidget()->getHeight() / 6) )
|
int(getRootWidget()->getHeight() / 6) }
|
||||||
, FSize(60, getRootWidget()->getHeight() * 3 / 4) );
|
, FSize{60, getRootWidget()->getHeight() * 3 / 4} );
|
||||||
view->setResizeable();
|
view->setResizeable();
|
||||||
std::string line = "";
|
std::string line = "";
|
||||||
std::ifstream infile;
|
std::ifstream infile;
|
||||||
|
@ -1019,7 +1019,7 @@ int main (int argc, char* argv[])
|
||||||
+ " (C) 2020 by Markus Gans" };
|
+ " (C) 2020 by Markus Gans" };
|
||||||
|
|
||||||
// Create the application object app
|
// Create the application object app
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
app.setNonBlockingRead();
|
app.setNonBlockingRead();
|
||||||
app.redefineDefaultColors(true);
|
app.redefineDefaultColors(true);
|
||||||
app.setTermTitle (title);
|
app.setTermTitle (title);
|
||||||
|
@ -1034,10 +1034,10 @@ int main (int argc, char* argv[])
|
||||||
//app.setNewFont();
|
//app.setNewFont();
|
||||||
|
|
||||||
// Create main dialog object d
|
// Create main dialog object d
|
||||||
MyDialog d(&app);
|
MyDialog d{&app};
|
||||||
d.setText (title);
|
d.setText (title);
|
||||||
d.setGeometry ( FPoint(int((app.getWidth() - 56) / 2), 2)
|
d.setGeometry ( FPoint{int((app.getWidth() - 56) / 2), 2}
|
||||||
, FSize(56, app.getHeight() - 4) );
|
, FSize{56, app.getHeight() - 4} );
|
||||||
d.setShadow();
|
d.setShadow();
|
||||||
|
|
||||||
// Set the dialog object d as the main widget of the application.
|
// Set the dialog object d as the main widget of the application.
|
||||||
|
|
|
@ -80,20 +80,20 @@ Watch::Watch (FWidget* parent)
|
||||||
// (CERT, OOP50-CPP)
|
// (CERT, OOP50-CPP)
|
||||||
FDialog::setText ("Watch");
|
FDialog::setText ("Watch");
|
||||||
const int pw = int(getParentWidget()->getWidth());
|
const int pw = int(getParentWidget()->getWidth());
|
||||||
FDialog::setGeometry (FPoint(1 + (pw - 22) / 2, 3), FSize(22, 13));
|
FDialog::setGeometry (FPoint{1 + (pw - 22) / 2, 3}, FSize{22, 13});
|
||||||
|
|
||||||
// Labels
|
// Labels
|
||||||
time_label.setGeometry(FPoint(5, 2), FSize(5, 1));
|
time_label.setGeometry(FPoint{5, 2}, FSize{5, 1});
|
||||||
time_label.setEmphasis();
|
time_label.setEmphasis();
|
||||||
time_str.setGeometry(FPoint(10, 2), FSize(8, 1));
|
time_str.setGeometry(FPoint{10, 2}, FSize{8, 1});
|
||||||
|
|
||||||
// Checkbox buttons
|
// Checkbox buttons
|
||||||
clock_sw.setGeometry(FPoint(4, 4), FSize(9, 1));
|
clock_sw.setGeometry(FPoint{4, 4}, FSize{9, 1});
|
||||||
seconds_sw.setGeometry(FPoint(2, 6), FSize(11, 1));
|
seconds_sw.setGeometry(FPoint{2, 6}, FSize{11, 1});
|
||||||
sec = seconds_sw.setChecked();
|
sec = seconds_sw.setChecked();
|
||||||
|
|
||||||
// Quit button
|
// Quit button
|
||||||
quit_btn.setGeometry(FPoint(6, 9), FSize(9, 1));
|
quit_btn.setGeometry(FPoint{6, 9}, FSize{9, 1});
|
||||||
|
|
||||||
// Connect switch signal "toggled" with a callback member function
|
// Connect switch signal "toggled" with a callback member function
|
||||||
clock_sw.addCallback
|
clock_sw.addCallback
|
||||||
|
@ -202,10 +202,10 @@ void Watch::adjustSize()
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app(argc, argv);
|
finalcut::FApplication app{argc, argv};
|
||||||
|
|
||||||
// Create a simple dialog box
|
// Create a simple dialog box
|
||||||
Watch w(&app);
|
Watch w{&app};
|
||||||
|
|
||||||
// Set dialog w as main widget
|
// Set dialog w as main widget
|
||||||
finalcut::FWidget::setMainWidget(&w);
|
finalcut::FWidget::setMainWidget(&w);
|
||||||
|
|
|
@ -76,33 +76,33 @@ SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
||||||
left_arrow.setForegroundColor (wc.label_inactive_fg);
|
left_arrow.setForegroundColor (wc.label_inactive_fg);
|
||||||
left_arrow.setEmphasis();
|
left_arrow.setEmphasis();
|
||||||
left_arrow.ignorePadding();
|
left_arrow.ignorePadding();
|
||||||
left_arrow.setGeometry (FPoint(2, 2), FSize(1, 1));
|
left_arrow.setGeometry (FPoint{2, 2}, FSize{1, 1});
|
||||||
|
|
||||||
right_arrow = arrow_up;
|
right_arrow = arrow_up;
|
||||||
right_arrow.setForegroundColor (wc.label_inactive_fg);
|
right_arrow.setForegroundColor (wc.label_inactive_fg);
|
||||||
right_arrow.setEmphasis();
|
right_arrow.setEmphasis();
|
||||||
right_arrow.ignorePadding();
|
right_arrow.ignorePadding();
|
||||||
right_arrow.setGeometry (FPoint(int(getWidth()) - 1, 2), FSize(1, 1));
|
right_arrow.setGeometry (FPoint{int(getWidth()) - 1, 2}, FSize{1, 1});
|
||||||
|
|
||||||
top_left_label = "menu";
|
top_left_label = "menu";
|
||||||
top_left_label.setForegroundColor (wc.label_inactive_fg);
|
top_left_label.setForegroundColor (wc.label_inactive_fg);
|
||||||
top_left_label.setEmphasis();
|
top_left_label.setEmphasis();
|
||||||
top_left_label.setGeometry (FPoint(1, 1), FSize(6, 1));
|
top_left_label.setGeometry (FPoint{1, 1}, FSize{6, 1});
|
||||||
|
|
||||||
top_right_label = "zoom";
|
top_right_label = "zoom";
|
||||||
top_right_label.setAlignment (fc::alignRight);
|
top_right_label.setAlignment (fc::alignRight);
|
||||||
top_right_label.setForegroundColor (wc.label_inactive_fg);
|
top_right_label.setForegroundColor (wc.label_inactive_fg);
|
||||||
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);
|
||||||
bottom_label.setForegroundColor (wc.label_inactive_fg);
|
bottom_label.setForegroundColor (wc.label_inactive_fg);
|
||||||
bottom_label.setEmphasis();
|
bottom_label.setEmphasis();
|
||||||
bottom_label.setGeometry (FPoint(13, 3), FSize(6, 3));
|
bottom_label.setGeometry (FPoint{13, 3}, FSize{6, 3});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -124,12 +124,12 @@ void SmallWindow::adjustSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
right_arrow.setGeometry ( FPoint(int(getWidth()) - 1, 2)
|
right_arrow.setGeometry ( FPoint{int(getWidth()) - 1, 2}
|
||||||
, FSize(1, 1) );
|
, FSize{1, 1} );
|
||||||
top_right_label.setGeometry ( FPoint(int(getClientWidth()) - 5, 1)
|
top_right_label.setGeometry ( FPoint{int(getClientWidth()) - 5, 1}
|
||||||
, FSize(6, 1) );
|
, FSize{6, 1} );
|
||||||
bottom_label.setGeometry ( FPoint(1, int(getClientHeight()) - 2)
|
bottom_label.setGeometry ( FPoint{1, int(getClientHeight()) - 2}
|
||||||
, FSize(getClientWidth(), 3) );
|
, FSize{getClientWidth(), 3} );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -311,11 +311,11 @@ void Window::configureFileMenuItems()
|
||||||
void Window::configureDialogButtons()
|
void Window::configureDialogButtons()
|
||||||
{
|
{
|
||||||
// Dialog buttons
|
// Dialog buttons
|
||||||
CreateButton.setGeometry (FPoint(2, 2), FSize(9, 1));
|
CreateButton.setGeometry (FPoint{2, 2}, FSize{9, 1});
|
||||||
CreateButton.setText (L"&Create");
|
CreateButton.setText (L"&Create");
|
||||||
CloseButton.setGeometry (FPoint(15, 2), FSize(9, 1));
|
CloseButton.setGeometry (FPoint{15, 2}, FSize{9, 1});
|
||||||
CloseButton.setText (L"C&lose");
|
CloseButton.setText (L"C&lose");
|
||||||
QuitButton.setGeometry (FPoint(28, 2), FSize(9, 1));
|
QuitButton.setGeometry (FPoint{28, 2}, FSize{9, 1});
|
||||||
QuitButton.setText (L"&Quit");
|
QuitButton.setText (L"&Quit");
|
||||||
|
|
||||||
// Add button callback
|
// Add button callback
|
||||||
|
@ -352,7 +352,7 @@ void Window::adjustSize()
|
||||||
if ( Y < 2 )
|
if ( Y < 2 )
|
||||||
Y = 2;
|
Y = 2;
|
||||||
|
|
||||||
setPos (FPoint(X, Y));
|
setPos (FPoint{X, Y});
|
||||||
const auto& first = windows.begin();
|
const auto& first = windows.begin();
|
||||||
auto iter = first;
|
auto iter = first;
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ void Window::adjustSize()
|
||||||
const int n = int(std::distance(first, iter));
|
const int n = int(std::distance(first, iter));
|
||||||
const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
|
const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
|
||||||
const int y = dy + 11 + int(n / 3) * 3;
|
const int y = dy + 11 + int(n / 3) * 3;
|
||||||
(*iter)->dgl->setPos (FPoint(x, y));
|
(*iter)->dgl->setPos (FPoint{x, y});
|
||||||
}
|
}
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
|
@ -460,8 +460,8 @@ void Window::cb_createWindows (const finalcut::FWidget*, const FDataPtr)
|
||||||
const int n = int(std::distance(first, iter));
|
const int n = int(std::distance(first, iter));
|
||||||
const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
|
const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
|
||||||
const int y = dy + 11 + int(n / 3) * 3;
|
const int y = dy + 11 + int(n / 3) * 3;
|
||||||
win->setGeometry (FPoint(x, y), FSize(20, 8));
|
win->setGeometry (FPoint{x, y}, FSize{20, 8});
|
||||||
win->setMinimumSize (FSize(20, 8));
|
win->setMinimumSize (FSize{20, 8});
|
||||||
win->setResizeable();
|
win->setResizeable();
|
||||||
win->show();
|
win->show();
|
||||||
|
|
||||||
|
@ -561,13 +561,13 @@ void Window::cb_destroyWindow (const finalcut::FWidget*, FDataPtr data)
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app (argc, argv);
|
finalcut::FApplication app {argc, argv};
|
||||||
|
|
||||||
// Create main dialog object
|
// Create main dialog object
|
||||||
Window main_dlg (&app);
|
Window main_dlg {&app};
|
||||||
main_dlg.setText ("Main window");
|
main_dlg.setText ("Main window");
|
||||||
main_dlg.setGeometry ( FPoint(int(1 + (app.getWidth() - 40) / 2), 2)
|
main_dlg.setGeometry ( FPoint{int(1 + (app.getWidth() - 40) / 2), 2}
|
||||||
, FSize(40, 6) );
|
, FSize{40, 6} );
|
||||||
|
|
||||||
// Set dialog main_dlg as main widget
|
// Set dialog main_dlg as main widget
|
||||||
finalcut::FWidget::setMainWidget (&main_dlg);
|
finalcut::FWidget::setMainWidget (&main_dlg);
|
||||||
|
|
|
@ -86,10 +86,9 @@ FApplication::FApplication ( const int& _argc
|
||||||
|
|
||||||
if ( ! (_argc && _argv) )
|
if ( ! (_argc && _argv) )
|
||||||
{
|
{
|
||||||
app_argc = 0;
|
|
||||||
static char empty_str[1] = "";
|
static char empty_str[1] = "";
|
||||||
auto empty = const_cast<char*>(empty_str);
|
app_argc = 0;
|
||||||
app_argv = static_cast<char**>(&empty);
|
app_argv = reinterpret_cast<char**>(&empty_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
init (key_timeout, dblclick_interval);
|
init (key_timeout, dblclick_interval);
|
||||||
|
@ -392,7 +391,7 @@ void FApplication::cmd_options (const int& argc, char* argv[])
|
||||||
{
|
{
|
||||||
if ( std::strcmp(long_options[idx].name, "encoding") == 0 )
|
if ( std::strcmp(long_options[idx].name, "encoding") == 0 )
|
||||||
{
|
{
|
||||||
FString encoding(optarg);
|
FString encoding{optarg};
|
||||||
encoding = encoding.toLower();
|
encoding = encoding.toLower();
|
||||||
|
|
||||||
if ( encoding.includes("utf8") )
|
if ( encoding.includes("utf8") )
|
||||||
|
@ -482,7 +481,7 @@ inline void FApplication::findKeyboardWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FApplication::isKeyPressed()
|
inline bool FApplication::isKeyPressed() const
|
||||||
{
|
{
|
||||||
if ( mouse && mouse->isGpmMouseEnabled() )
|
if ( mouse && mouse->isGpmMouseEnabled() )
|
||||||
return mouse->getGpmKeyPressed(keyboard->unprocessedInput());
|
return mouse->getGpmKeyPressed(keyboard->unprocessedInput());
|
||||||
|
|
|
@ -169,12 +169,12 @@ bool FButton::setShadow (bool enable)
|
||||||
&& getEncoding() != fc::ASCII )
|
&& getEncoding() != fc::ASCII )
|
||||||
{
|
{
|
||||||
setFlags().shadow = true;
|
setFlags().shadow = true;
|
||||||
setShadowSize(FSize(1, 1));
|
setShadowSize(FSize{1, 1});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setFlags().shadow = false;
|
setFlags().shadow = false;
|
||||||
setShadowSize(FSize(0, 0));
|
setShadowSize(FSize{0, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
return getFlags().shadow;
|
return getFlags().shadow;
|
||||||
|
@ -233,8 +233,8 @@ void FButton::hide()
|
||||||
|
|
||||||
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))
|
print() << FPoint{1 - int(f), 1 + int(y - f)}
|
||||||
<< FString(size, L' ');
|
<< FString{size, L' '};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ void FButton::onMouseDown (FMouseEvent* ev)
|
||||||
getStatusBar()->drawMessage();
|
getStatusBar()->drawMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
const FPoint tPos(ev->getTermPos());
|
const FPoint tPos{ev->getTermPos()};
|
||||||
|
|
||||||
if ( getTermGeometry().contains(tPos) )
|
if ( getTermGeometry().contains(tPos) )
|
||||||
setDown();
|
setDown();
|
||||||
|
@ -313,7 +313,7 @@ void FButton::onMouseMove (FMouseEvent* ev)
|
||||||
if ( ev->getButton() != fc::LeftButton )
|
if ( ev->getButton() != fc::LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const FPoint tPos(ev->getTermPos());
|
const FPoint tPos{ev->getTermPos()};
|
||||||
|
|
||||||
if ( click_animation )
|
if ( click_animation )
|
||||||
{
|
{
|
||||||
|
@ -430,7 +430,7 @@ inline std::size_t FButton::clickAnimationIndent (const FWidget* parent_widget)
|
||||||
|
|
||||||
for (int y{1}; y <= int(getHeight()); y++)
|
for (int y{1}; y <= int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(1, y) << ' '; // clear one left █
|
print() << FPoint{1, y} << ' '; // clear one left █
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -452,7 +452,7 @@ inline void FButton::clearRightMargin (const FWidget* parent_widget)
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true); // Light background
|
setReverse(true); // Light background
|
||||||
|
|
||||||
print() << FPoint(1 + int(getWidth()), y) << ' '; // clear right
|
print() << FPoint{1 + int(getWidth()), y} << ' '; // clear right
|
||||||
|
|
||||||
if ( getFlags().active && isMonochron() )
|
if ( getFlags().active && isMonochron() )
|
||||||
setReverse(false); // Dark background
|
setReverse(false); // Dark background
|
||||||
|
@ -468,7 +468,7 @@ inline void FButton::drawMarginLeft()
|
||||||
|
|
||||||
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)};
|
||||||
|
|
||||||
if ( isMonochron() && active_focus && y == vcenter_offset )
|
if ( isMonochron() && active_focus && y == vcenter_offset )
|
||||||
print (fc::BlackRightPointingPointer); // ►
|
print (fc::BlackRightPointingPointer); // ►
|
||||||
|
@ -484,7 +484,7 @@ inline void FButton::drawMarginRight()
|
||||||
|
|
||||||
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)};
|
||||||
|
|
||||||
if ( isMonochron() && active_focus && y == vcenter_offset )
|
if ( isMonochron() && active_focus && y == vcenter_offset )
|
||||||
print (fc::BlackLeftPointingPointer); // ◄
|
print (fc::BlackLeftPointingPointer); // ◄
|
||||||
|
@ -503,7 +503,7 @@ inline void FButton::drawTopBottomBackground()
|
||||||
|
|
||||||
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); // █
|
||||||
|
@ -511,7 +511,7 @@ inline void FButton::drawTopBottomBackground()
|
||||||
|
|
||||||
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); // █
|
||||||
|
@ -524,8 +524,8 @@ inline void FButton::drawButtonTextLine (const FString& button_text)
|
||||||
std::size_t z{0};
|
std::size_t z{0};
|
||||||
std::size_t pos{};
|
std::size_t pos{};
|
||||||
std::size_t columns{0};
|
std::size_t columns{0};
|
||||||
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};
|
||||||
|
|
||||||
if ( getWidth() < column_width + 1 )
|
if ( getWidth() < column_width + 1 )
|
||||||
center_offset = 0;
|
center_offset = 0;
|
||||||
|
@ -537,11 +537,11 @@ inline void FButton::drawButtonTextLine (const FString& button_text)
|
||||||
print (space_char); // █
|
print (space_char); // █
|
||||||
|
|
||||||
if ( hotkeypos == NOT_SET )
|
if ( hotkeypos == NOT_SET )
|
||||||
setCursorPos (FPoint ( 2 + int(center_offset)
|
setCursorPos ({ 2 + int(center_offset)
|
||||||
, 1 + int(vcenter_offset) )); // first character
|
, 1 + int(vcenter_offset) }); // first character
|
||||||
else
|
else
|
||||||
setCursorPos (FPoint ( 2 + int(center_offset + hotkeypos)
|
setCursorPos ({ 2 + int(center_offset + hotkeypos)
|
||||||
, 1 + int(vcenter_offset) )); // hotkey
|
, 1 + int(vcenter_offset) }); // hotkey
|
||||||
|
|
||||||
if ( ! getFlags().active && isMonochron() )
|
if ( ! getFlags().active && isMonochron() )
|
||||||
setReverse(true); // Light background
|
setReverse(true); // Light background
|
||||||
|
@ -585,7 +585,7 @@ inline void FButton::drawButtonTextLine (const FString& button_text)
|
||||||
if ( column_width + 1 >= getWidth() )
|
if ( column_width + 1 >= getWidth() )
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
print() << FPoint(int(getWidth() + indent) - 2, 1) << "..";
|
print() << FPoint{int(getWidth() + indent) - 2, 1} << "..";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( active_focus && (isMonochron() || getMaxColor() < 16) )
|
if ( active_focus && (isMonochron() || getMaxColor() < 16) )
|
||||||
|
|
|
@ -211,7 +211,7 @@ void FButtonGroup::hide()
|
||||||
unsetViewportPrint();
|
unsetViewportPrint();
|
||||||
|
|
||||||
for (int y{0}; y < int(getHeight()); y++)
|
for (int y{0}; y < int(getHeight()); y++)
|
||||||
print() << FPoint(1, 1 + y) << FString(size, L' ');
|
print() << FPoint{1, 1 + y} << FString{size, L' '};
|
||||||
|
|
||||||
setViewportPrint();
|
setViewportPrint();
|
||||||
}
|
}
|
||||||
|
@ -405,9 +405,9 @@ void FButtonGroup::drawLabel()
|
||||||
const auto hotkeypos = finalcut::getHotkeyPos(txt, label_text);
|
const auto hotkeypos = finalcut::getHotkeyPos(txt, label_text);
|
||||||
|
|
||||||
if ( hasBorder() )
|
if ( hasBorder() )
|
||||||
FWidget::setPrintPos (FPoint(2, 1));
|
FWidget::setPrintPos (FPoint{2, 1});
|
||||||
else
|
else
|
||||||
FWidget::setPrintPos (FPoint(0, 1));
|
FWidget::setPrintPos (FPoint{0, 1});
|
||||||
|
|
||||||
drawText (label_text, hotkeypos);
|
drawText (label_text, hotkeypos);
|
||||||
setViewportPrint();
|
setViewportPrint();
|
||||||
|
@ -430,7 +430,7 @@ void FButtonGroup::init()
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.label_fg);
|
setForegroundColor (wc.label_fg);
|
||||||
setBackgroundColor (wc.label_bg);
|
setBackgroundColor (wc.label_bg);
|
||||||
setMinimumSize (FSize(7, 3));
|
setMinimumSize (FSize{7, 3});
|
||||||
buttonlist.clear(); // no buttons yet
|
buttonlist.clear(); // no buttons yet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ void FButtonGroup::drawText ( const FString& label_text
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ellipsis ) // Print ellipsis
|
if ( ellipsis ) // Print ellipsis
|
||||||
print() << FColorPair (wc.label_ellipsis_fg, wc.label_bg) << "..";
|
print() << FColorPair {wc.label_ellipsis_fg, wc.label_bg} << "..";
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -549,17 +549,15 @@ void FButtonGroup::cb_buttonToggled (FWidget* widget, const FDataPtr)
|
||||||
{
|
{
|
||||||
const auto& button = static_cast<FToggleButton*>(widget);
|
const auto& button = static_cast<FToggleButton*>(widget);
|
||||||
|
|
||||||
if ( ! button->isChecked() )
|
if ( (button && ! button->isChecked()) || buttonlist.empty() )
|
||||||
return;
|
|
||||||
|
|
||||||
if ( buttonlist.empty() )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto&& item : buttonlist)
|
for (auto&& item : buttonlist)
|
||||||
{
|
{
|
||||||
auto toggle_button = static_cast<FToggleButton*>(item);
|
auto toggle_button = static_cast<FToggleButton*>(item);
|
||||||
|
|
||||||
if ( toggle_button != button
|
if ( toggle_button
|
||||||
|
&& toggle_button != button
|
||||||
&& toggle_button->isChecked()
|
&& toggle_button->isChecked()
|
||||||
&& isRadioButton(toggle_button) )
|
&& isRadioButton(toggle_button) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 2014-2019 Markus Gans *
|
* Copyright 2014-2020 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 *
|
||||||
|
@ -73,7 +73,7 @@ void FCheckBox::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FCheckBox::drawCheckButton()
|
void FCheckBox::drawCheckButton()
|
||||||
{
|
{
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint{1, 1};
|
||||||
setColor();
|
setColor();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
|
|
@ -73,12 +73,12 @@ void FDropDownListBox::setGeometry ( const FPoint& pos, const FSize& size
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
FSize new_size(size);
|
FSize new_size{size};
|
||||||
new_size.scaleBy(-1, 0);
|
new_size.scaleBy(-1, 0);
|
||||||
list.setGeometry (FPoint(2, 1), new_size, adjust);
|
list.setGeometry (FPoint{2, 1}, new_size, adjust);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
list.setGeometry (FPoint(1, 1), size, adjust);
|
list.setGeometry (FPoint{1, 1}, size, adjust);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -113,10 +113,10 @@ void FDropDownListBox::init()
|
||||||
ignorePadding();
|
ignorePadding();
|
||||||
setShadow();
|
setShadow();
|
||||||
// initialize geometry values
|
// initialize geometry values
|
||||||
setGeometry (FPoint(1, 1), FSize(3, 3), false);
|
setGeometry (FPoint{1, 1}, FSize{3, 3}, false);
|
||||||
setMinimumSize (FSize(3, 3));
|
setMinimumSize (FSize{3, 3});
|
||||||
hide();
|
hide();
|
||||||
list.setGeometry (FPoint(1, 1), FSize(3, 3), false);
|
list.setGeometry (FPoint{1, 1}, FSize{3, 3}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -142,7 +142,7 @@ void FDropDownListBox::drawShadow()
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
finalcut::drawShadow(this);
|
finalcut::drawShadow(this);
|
||||||
setColor (wc.shadow_fg, wc.shadow_bg);
|
setColor (wc.shadow_fg, wc.shadow_bg);
|
||||||
print() << FPoint(int(getWidth()) + 1, 1) << fc::FullBlock; // █
|
print() << FPoint{int(getWidth()) + 1, 1} << fc::FullBlock; // █
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -183,7 +183,7 @@ FComboBox::~FComboBox() // destructor
|
||||||
void FComboBox::setSize (const FSize& size, bool adjust)
|
void FComboBox::setSize (const FSize& size, bool adjust)
|
||||||
{
|
{
|
||||||
FWidget::setSize (size, adjust);
|
FWidget::setSize (size, adjust);
|
||||||
FSize input_field_size(size);
|
FSize input_field_size{size};
|
||||||
input_field_size.scaleBy(-(1 + nf), 0);
|
input_field_size.scaleBy(-(1 + nf), 0);
|
||||||
input_field.setSize (input_field_size, adjust);
|
input_field.setSize (input_field_size, adjust);
|
||||||
}
|
}
|
||||||
|
@ -193,9 +193,9 @@ void FComboBox::setGeometry ( const FPoint& pos, const FSize& size
|
||||||
, bool adjust )
|
, bool adjust )
|
||||||
{
|
{
|
||||||
FWidget::setGeometry (pos, size, adjust);
|
FWidget::setGeometry (pos, size, adjust);
|
||||||
FSize input_field_size(size);
|
FSize input_field_size{size};
|
||||||
input_field_size.scaleBy(-(1 + nf), 0);
|
input_field_size.scaleBy(-(1 + nf), 0);
|
||||||
input_field.setGeometry (FPoint(1, 1), input_field_size, adjust);
|
input_field.setGeometry (FPoint{1, 1}, input_field_size, adjust);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -222,12 +222,12 @@ bool FComboBox::setShadow (bool enable)
|
||||||
&& getEncoding() != fc::ASCII )
|
&& getEncoding() != fc::ASCII )
|
||||||
{
|
{
|
||||||
setFlags().shadow = true;
|
setFlags().shadow = true;
|
||||||
setShadowSize(FSize(1, 1));
|
setShadowSize(FSize{1, 1});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setFlags().shadow = false;
|
setFlags().shadow = false;
|
||||||
setShadowSize(FSize(0, 0));
|
setShadowSize(FSize{0, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
return getFlags().shadow;
|
return getFlags().shadow;
|
||||||
|
@ -324,12 +324,12 @@ void FComboBox::showDropDown()
|
||||||
|
|
||||||
static constexpr std::size_t border = 2; // Size of the top and bottom border
|
static constexpr std::size_t border = 2; // Size of the top and bottom border
|
||||||
setOpenMenu(&list_window);
|
setOpenMenu(&list_window);
|
||||||
FPoint p(getTermPos());
|
FPoint p{getTermPos()};
|
||||||
p.move(0 - int(nf), 1);
|
p.move(0 - int(nf), 1);
|
||||||
setClickedWidget(&list_window.list);
|
setClickedWidget(&list_window.list);
|
||||||
const std::size_t w = getWidth();
|
const std::size_t w = getWidth();
|
||||||
const std::size_t h = ( getCount() <= max_items ) ? getCount() : max_items;
|
const std::size_t h = ( getCount() <= max_items ) ? getCount() : max_items;
|
||||||
list_window.setGeometry(p, FSize(w + std::size_t(nf), h + border));
|
list_window.setGeometry(p, FSize{w + std::size_t(nf), h + border});
|
||||||
list_window.show();
|
list_window.show();
|
||||||
list_window.list.setFocus();
|
list_window.list.setFocus();
|
||||||
list_window.redraw();
|
list_window.redraw();
|
||||||
|
@ -537,14 +537,14 @@ void FComboBox::draw()
|
||||||
const FColorPair button_color = [this, &wc] ()
|
const FColorPair button_color = [this, &wc] ()
|
||||||
{
|
{
|
||||||
if ( list_window.isEmpty() )
|
if ( list_window.isEmpty() )
|
||||||
return FColorPair ( wc.scrollbar_button_inactive_fg
|
return FColorPair { wc.scrollbar_button_inactive_fg
|
||||||
, wc.scrollbar_button_inactive_bg );
|
, wc.scrollbar_button_inactive_bg };
|
||||||
else
|
else
|
||||||
return FColorPair ( wc.scrollbar_button_fg
|
return FColorPair { wc.scrollbar_button_fg
|
||||||
, wc.scrollbar_button_bg );
|
, wc.scrollbar_button_bg };
|
||||||
}();
|
}();
|
||||||
|
|
||||||
print() << FPoint(int(getWidth()) - nf, 1)
|
print() << FPoint{int(getWidth()) - nf, 1}
|
||||||
<< button_color;
|
<< button_color;
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
|
|
|
@ -207,7 +207,7 @@ void FDialog::setPos (const FPoint& pos, bool)
|
||||||
const auto& shadow = getShadow();
|
const auto& shadow = getShadow();
|
||||||
const std::size_t width = getWidth() + shadow.getWidth(); // width + right shadow
|
const std::size_t width = getWidth() + shadow.getWidth(); // width + right shadow
|
||||||
const std::size_t height = getHeight() + shadow.getHeight(); // height + bottom shadow
|
const std::size_t height = getHeight() + shadow.getHeight(); // height + bottom shadow
|
||||||
const FRect old_geometry (getTermGeometryWithShadow());
|
const FRect old_geometry {getTermGeometryWithShadow()};
|
||||||
|
|
||||||
// move to the new position
|
// move to the new position
|
||||||
FWindow::setPos(pos, false);
|
FWindow::setPos(pos, false);
|
||||||
|
@ -273,28 +273,28 @@ void FDialog::move (const FPoint& d_pos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FDialog::moveUp (int n)
|
inline bool FDialog::moveUp (int n)
|
||||||
{
|
{
|
||||||
move (FPoint(0, -n));
|
move ({0, -n});
|
||||||
return ! setPos_error;
|
return ! setPos_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FDialog::moveDown (int n)
|
inline bool FDialog::moveDown (int n)
|
||||||
{
|
{
|
||||||
move (FPoint(0, n));
|
move ({0, n});
|
||||||
return ! setPos_error;
|
return ! setPos_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FDialog::moveLeft (int n)
|
inline bool FDialog::moveLeft (int n)
|
||||||
{
|
{
|
||||||
move (FPoint(-n, 0));
|
move ({-n, 0});
|
||||||
return ! setPos_error;
|
return ! setPos_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FDialog::moveRight (int n)
|
inline bool FDialog::moveRight (int n)
|
||||||
{
|
{
|
||||||
move (FPoint(n, 0));
|
move ({n, 0});
|
||||||
return ! setPos_error;
|
return ! setPos_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,10 +332,10 @@ void FDialog::setSize (const FSize& size, bool adjust)
|
||||||
|
|
||||||
// restoring the non-covered terminal areas
|
// restoring the non-covered terminal areas
|
||||||
if ( dw > 0 )
|
if ( dw > 0 )
|
||||||
restoreVTerm (FRect(x + int(w), y, d_width, h + d_height)); // restore right
|
restoreVTerm ({x + int(w), y, d_width, h + d_height}); // restore right
|
||||||
|
|
||||||
if ( dh > 0 )
|
if ( dh > 0 )
|
||||||
restoreVTerm (FRect(x, y + int(h), w + d_width, d_height)); // restore bottom
|
restoreVTerm ({x, y + int(h), w + d_width, d_height}); // restore bottom
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ bool FDialog::reduceHeight (int n)
|
||||||
if ( ! isResizeable() )
|
if ( ! isResizeable() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setSize (FSize(getWidth(), getHeight() - std::size_t(n)));
|
setSize (FSize{getWidth(), getHeight() - std::size_t(n)});
|
||||||
return ! setSize_error;
|
return ! setSize_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ bool FDialog::expandHeight (int n)
|
||||||
if ( ! isResizeable() || getHeight() + std::size_t(getY()) > getMaxHeight() )
|
if ( ! isResizeable() || getHeight() + std::size_t(getY()) > getMaxHeight() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setSize (FSize(getWidth(), getHeight() + std::size_t(n)));
|
setSize (FSize{getWidth(), getHeight() + std::size_t(n)});
|
||||||
return ! setSize_error;
|
return ! setSize_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ bool FDialog::reduceWidth (int n)
|
||||||
if ( ! isResizeable() )
|
if ( ! isResizeable() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setSize (FSize(getWidth() - std::size_t(n), getHeight()));
|
setSize (FSize{getWidth() - std::size_t(n), getHeight()});
|
||||||
return ! setSize_error;
|
return ! setSize_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ bool FDialog::expandWidth (int n)
|
||||||
if ( ! isResizeable() || getWidth() + std::size_t(getX()) > getMaxWidth() )
|
if ( ! isResizeable() || getWidth() + std::size_t(getX()) > getMaxWidth() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setSize (FSize(getWidth() + std::size_t(n), getHeight()));
|
setSize (FSize{getWidth() + std::size_t(n), getHeight()});
|
||||||
return ! setSize_error;
|
return ! setSize_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
||||||
&& titlebar_x < getTermX() + int(getWidth())
|
&& titlebar_x < getTermX() + int(getWidth())
|
||||||
&& titlebar_y == int(getTermY()) )
|
&& titlebar_y == int(getTermY()) )
|
||||||
{
|
{
|
||||||
const FPoint deltaPos(ms.termPos - titlebar_click_pos);
|
const FPoint deltaPos{ms.termPos - titlebar_click_pos};
|
||||||
move (deltaPos);
|
move (deltaPos);
|
||||||
titlebar_click_pos = ms.termPos;
|
titlebar_click_pos = ms.termPos;
|
||||||
}
|
}
|
||||||
|
@ -585,7 +585,7 @@ void FDialog::onMouseMove (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( ! titlebar_click_pos.isOrigin() )
|
if ( ! titlebar_click_pos.isOrigin() )
|
||||||
{
|
{
|
||||||
const FPoint deltaPos(ms.termPos - titlebar_click_pos);
|
const FPoint deltaPos{ms.termPos - titlebar_click_pos};
|
||||||
move (deltaPos);
|
move (deltaPos);
|
||||||
titlebar_click_pos = ms.termPos;
|
titlebar_click_pos = ms.termPos;
|
||||||
}
|
}
|
||||||
|
@ -615,8 +615,8 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
|
|
||||||
const int x = getTermX();
|
const int x = getTermX();
|
||||||
const int y = getTermY();
|
const int y = getTermY();
|
||||||
const FRect title_button(x, y, 3, 1);
|
const FRect title_button{x, y, 3, 1};
|
||||||
const FPoint tPos(ms.termPos);
|
const FPoint tPos{ms.termPos};
|
||||||
|
|
||||||
if ( title_button.contains(tPos) )
|
if ( title_button.contains(tPos) )
|
||||||
{
|
{
|
||||||
|
@ -758,7 +758,7 @@ void FDialog::draw()
|
||||||
clearArea();
|
clearArea();
|
||||||
drawBorder();
|
drawBorder();
|
||||||
drawTitleBar();
|
drawTitleBar();
|
||||||
setCursorPos(FPoint(2, int(getHeight()) - 1));
|
setCursorPos({2, int(getHeight()) - 1});
|
||||||
|
|
||||||
if ( getFlags().shadow )
|
if ( getFlags().shadow )
|
||||||
drawDialogShadow();
|
drawDialogShadow();
|
||||||
|
@ -795,8 +795,8 @@ void FDialog::init()
|
||||||
ignorePadding();
|
ignorePadding();
|
||||||
setDialogWidget();
|
setDialogWidget();
|
||||||
// Initialize geometry values
|
// Initialize geometry values
|
||||||
setGeometry (FPoint(1, 1), FSize(10, 10), false);
|
setGeometry (FPoint{1, 1}, FSize{10, 10}, false);
|
||||||
setMinimumSize (FSize(15, 4));
|
setMinimumSize (FSize{15, 4});
|
||||||
addDialog(this);
|
addDialog(this);
|
||||||
setActiveWindow(this);
|
setActiveWindow(this);
|
||||||
setTransparentShadow();
|
setTransparentShadow();
|
||||||
|
@ -830,7 +830,7 @@ 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();
|
||||||
|
@ -932,24 +932,24 @@ void FDialog::drawBorder()
|
||||||
|
|
||||||
if ( isNewFont() ) // Draw a newfont U-shaped frame
|
if ( isNewFont() ) // Draw a newfont U-shaped frame
|
||||||
{
|
{
|
||||||
const FRect r(FPoint(1, 1), getSize());
|
const FRect r{FPoint{1, 1}, getSize()};
|
||||||
|
|
||||||
for (int y = r.getY1() + 1; y < r.getY2(); y++)
|
for (int y = r.getY1() + 1; y < r.getY2(); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(r.getX1(), y)
|
print() << FPoint{r.getX1(), y}
|
||||||
<< fc::NF_border_line_left // border left ⎸
|
<< fc::NF_border_line_left // border left ⎸
|
||||||
<< FPoint(r.getX2(), y)
|
<< FPoint{r.getX2(), y}
|
||||||
<< fc::NF_rev_border_line_right; // border right⎹
|
<< fc::NF_rev_border_line_right; // border right⎹
|
||||||
}
|
}
|
||||||
|
|
||||||
print() << r.getLowerLeftPos()
|
print() << r.getLowerLeftPos()
|
||||||
<< fc::NF_border_corner_lower_left // ⎣
|
<< fc::NF_border_corner_lower_left // ⎣
|
||||||
<< FString(r.getWidth() - 2, fc::NF_border_line_bottom) // _
|
<< FString{r.getWidth() - 2, fc::NF_border_line_bottom} // _
|
||||||
<< fc::NF_rev_border_corner_lower_right; // ⎦
|
<< fc::NF_rev_border_corner_lower_right; // ⎦
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FRect box(FPoint(1, 2), getSize());
|
FRect box{{1, 2}, getSize()};
|
||||||
box.scaleBy(0, -1);
|
box.scaleBy(0, -1);
|
||||||
finalcut::drawBorder(this, box);
|
finalcut::drawBorder(this, box);
|
||||||
}
|
}
|
||||||
|
@ -972,7 +972,7 @@ void FDialog::drawTitleBar()
|
||||||
if ( PRINT_WIN_NUMBER )
|
if ( PRINT_WIN_NUMBER )
|
||||||
{
|
{
|
||||||
// Print the number of window in stack
|
// Print the number of window in stack
|
||||||
print() << FPoint(int(getWidth()) - 2, 1);
|
print() << FPoint{int(getWidth()) - 2, 1};
|
||||||
printf ("(%d)", getWindowLayer(this));
|
printf ("(%d)", getWindowLayer(this));
|
||||||
}
|
}
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
@ -982,7 +982,7 @@ void FDialog::drawTitleBar()
|
||||||
void FDialog::drawBarButton()
|
void FDialog::drawBarButton()
|
||||||
{
|
{
|
||||||
// Print the title button
|
// Print the title button
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint{1, 1};
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( dialog_menu && dialog_menu->isShown() )
|
if ( dialog_menu && dialog_menu->isShown() )
|
||||||
|
@ -1173,7 +1173,7 @@ void FDialog::setCursorToFocusWidget()
|
||||||
&& focus->isShown()
|
&& focus->isShown()
|
||||||
&& focus->hasVisibleCursor() )
|
&& focus->hasVisibleCursor() )
|
||||||
{
|
{
|
||||||
const FPoint cursor_pos(focus->getCursorPos());
|
const FPoint cursor_pos{focus->getCursorPos()};
|
||||||
focus->setCursorPos(cursor_pos);
|
focus->setCursorPos(cursor_pos);
|
||||||
updateVTermCursor(getVWin());
|
updateVTermCursor(getVWin());
|
||||||
}
|
}
|
||||||
|
@ -1215,7 +1215,7 @@ void FDialog::openMenu()
|
||||||
{
|
{
|
||||||
finalcut::closeOpenComboBox();
|
finalcut::closeOpenComboBox();
|
||||||
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();
|
||||||
|
@ -1327,7 +1327,7 @@ void FDialog::pressZoomButton (const mouseStates& ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FDialog::isMouseOverMenu (const FPoint& termpos)
|
inline bool FDialog::isMouseOverMenu (const FPoint& termpos) const
|
||||||
{
|
{
|
||||||
auto menu_geometry = dialog_menu->getTermGeometry();
|
auto menu_geometry = dialog_menu->getTermGeometry();
|
||||||
|
|
||||||
|
@ -1446,7 +1446,7 @@ inline void FDialog::lowerActivateDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FDialog::isOutsideTerminal (const FPoint& pos)
|
bool FDialog::isOutsideTerminal (const FPoint& pos) const
|
||||||
{
|
{
|
||||||
if ( pos.getX() + int(getWidth()) <= 1
|
if ( pos.getX() + int(getWidth()) <= 1
|
||||||
|| pos.getX() > int(getMaxWidth())
|
|| pos.getX() > int(getMaxWidth())
|
||||||
|
@ -1458,7 +1458,7 @@ bool FDialog::isOutsideTerminal (const FPoint& pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FDialog::isLowerRightResizeCorner (const mouseStates& ms)
|
bool FDialog::isLowerRightResizeCorner (const mouseStates& ms) const
|
||||||
{
|
{
|
||||||
// 3 characters in the lower right corner |
|
// 3 characters in the lower right corner |
|
||||||
// x
|
// x
|
||||||
|
@ -1484,11 +1484,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;
|
||||||
const FPoint lower_right_pos(getTermGeometry().getLowerRightPos());
|
const FPoint lower_right_pos{getTermGeometry().getLowerRightPos()};
|
||||||
|
|
||||||
if ( ms.termPos != lower_right_pos )
|
if ( ms.termPos != lower_right_pos )
|
||||||
{
|
{
|
||||||
const FPoint deltaPos(ms.termPos - lower_right_pos);
|
const FPoint deltaPos{ms.termPos - lower_right_pos};
|
||||||
const int w = lower_right_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
const int w = lower_right_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
||||||
const int h = lower_right_pos.getY() + deltaPos.getY() - getTermY() + 1;
|
const 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));
|
||||||
|
@ -1524,7 +1524,7 @@ void FDialog::resizeMouseUpMove (const mouseStates& ms, bool mouse_up)
|
||||||
{
|
{
|
||||||
int w{};
|
int w{};
|
||||||
int h{};
|
int h{};
|
||||||
const FPoint deltaPos(ms.termPos - resize_click_pos);
|
const 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;
|
||||||
|
|
|
@ -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 2014-2018 Markus Gans *
|
* Copyright 2014-2020 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 *
|
||||||
|
@ -88,7 +88,7 @@ FMouseEvent::FMouseEvent ( fc::events ev_type // constructor
|
||||||
FMouseEvent::FMouseEvent ( fc::events ev_type // constructor
|
FMouseEvent::FMouseEvent ( fc::events ev_type // constructor
|
||||||
, const FPoint& pos
|
, const FPoint& pos
|
||||||
, int button )
|
, int button )
|
||||||
: FMouseEvent(ev_type, pos, FPoint(), button)
|
: FMouseEvent(ev_type, pos, FPoint{}, button)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -142,7 +142,7 @@ FWheelEvent::FWheelEvent ( fc::events ev_type // constructor
|
||||||
FWheelEvent::FWheelEvent ( fc::events ev_type // constructor
|
FWheelEvent::FWheelEvent ( fc::events ev_type // constructor
|
||||||
, const FPoint& pos
|
, const FPoint& pos
|
||||||
, int wheel )
|
, int wheel )
|
||||||
: FWheelEvent(ev_type, pos, FPoint(), wheel)
|
: FWheelEvent(ev_type, pos, FPoint{}, wheel)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -36,16 +36,16 @@ namespace finalcut
|
||||||
|
|
||||||
// non-member functions
|
// non-member functions
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool sortByName ( const FFileDialog::dir_entry& lhs
|
bool sortByName ( const FFileDialog::FDirEntry& lhs
|
||||||
, const FFileDialog::dir_entry& rhs )
|
, const FFileDialog::FDirEntry& rhs )
|
||||||
{
|
{
|
||||||
// lhs < rhs
|
// lhs < rhs
|
||||||
return bool( strcasecmp(lhs.name.c_str(), rhs.name.c_str()) < 0 );
|
return bool( strcasecmp(lhs.name.c_str(), rhs.name.c_str()) < 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool sortDirFirst ( const FFileDialog::dir_entry& lhs
|
bool sortDirFirst ( const FFileDialog::FDirEntry& lhs
|
||||||
, const FFileDialog::dir_entry& rhs )
|
, const FFileDialog::FDirEntry& rhs )
|
||||||
{
|
{
|
||||||
// sort directories first
|
// sort directories first
|
||||||
if ( lhs.directory && ! rhs.directory )
|
if ( lhs.directory && ! rhs.directory )
|
||||||
|
@ -61,8 +61,8 @@ const FString fileChooser ( FWidget* parent
|
||||||
, 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() )
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ const FString fileChooser ( FWidget* parent
|
||||||
if ( fileopen.exec() == FDialog::Accept )
|
if ( fileopen.exec() == FDialog::Accept )
|
||||||
ret = fileopen.getPath() + fileopen.getSelectedFile();
|
ret = fileopen.getPath() + fileopen.getSelectedFile();
|
||||||
else
|
else
|
||||||
ret = FString();
|
ret = FString{};
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -170,9 +170,9 @@ const FString FFileDialog::getSelectedFile() const
|
||||||
const uLong n = uLong(filebrowser.currentItem() - 1);
|
const uLong n = uLong(filebrowser.currentItem() - 1);
|
||||||
|
|
||||||
if ( dir_entries[n].directory )
|
if ( dir_entries[n].directory )
|
||||||
return FString("");
|
return FString{""};
|
||||||
else
|
else
|
||||||
return FString(dir_entries[n].name);
|
return FString{dir_entries[n].name};
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -304,7 +304,7 @@ void FFileDialog::adjustSize()
|
||||||
setHeight (h, false);
|
setHeight (h, false);
|
||||||
const int X = 1 + int((max_width - getWidth()) / 2);
|
const int X = 1 + int((max_width - getWidth()) / 2);
|
||||||
const int Y = 1 + int((max_height - getHeight()) / 3);
|
const 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);
|
||||||
cancel_btn.setY (int(h) - 4, false);
|
cancel_btn.setY (int(h) - 4, false);
|
||||||
|
@ -326,7 +326,7 @@ void FFileDialog::init()
|
||||||
if ( ! fsystem )
|
if ( ! fsystem )
|
||||||
fsystem = FTerm::getFSystem();
|
fsystem = FTerm::getFSystem();
|
||||||
|
|
||||||
setGeometry(FPoint(1, 1), FSize(w, h), false);
|
setGeometry(FPoint{1, 1}, FSize{w, h}, false);
|
||||||
const auto& parent_widget = getParentWidget();
|
const auto& parent_widget = getParentWidget();
|
||||||
|
|
||||||
if ( parent_widget )
|
if ( parent_widget )
|
||||||
|
@ -342,7 +342,7 @@ void FFileDialog::init()
|
||||||
else
|
else
|
||||||
FDialog::setText("Open file");
|
FDialog::setText("Open file");
|
||||||
|
|
||||||
widgetSettings (FPoint(x, y)); // Create widgets
|
widgetSettings (FPoint{x, y}); // Create widgets
|
||||||
initCallbacks();
|
initCallbacks();
|
||||||
setModal();
|
setModal();
|
||||||
readDir();
|
readDir();
|
||||||
|
@ -353,24 +353,24 @@ inline void FFileDialog::widgetSettings (const FPoint& pos)
|
||||||
{
|
{
|
||||||
filename.setLabelText ("File&name");
|
filename.setLabelText ("File&name");
|
||||||
filename.setText (filter_pattern);
|
filename.setText (filter_pattern);
|
||||||
filename.setGeometry (FPoint(11, 1), FSize(28, 1));
|
filename.setGeometry (FPoint{11, 1}, FSize{28, 1});
|
||||||
filename.setFocus();
|
filename.setFocus();
|
||||||
|
|
||||||
filebrowser.setGeometry (FPoint(2, 3), FSize(38, 6));
|
filebrowser.setGeometry (FPoint{2, 3}, FSize{38, 6});
|
||||||
printPath (directory);
|
printPath (directory);
|
||||||
|
|
||||||
hidden_check.setText ("&hidden files");
|
hidden_check.setText ("&hidden files");
|
||||||
hidden_check.setGeometry (FPoint(2, 10), FSize(16, 1));
|
hidden_check.setGeometry (FPoint{2, 10}, FSize{16, 1});
|
||||||
|
|
||||||
cancel_btn.setText ("&Cancel");
|
cancel_btn.setText ("&Cancel");
|
||||||
cancel_btn.setGeometry(FPoint(19, 10), FSize(9, 1));
|
cancel_btn.setGeometry(FPoint{19, 10}, FSize{9, 1});
|
||||||
|
|
||||||
if ( dlg_type == FFileDialog::Save )
|
if ( dlg_type == FFileDialog::Save )
|
||||||
open_btn.setText ("&Save");
|
open_btn.setText ("&Save");
|
||||||
else
|
else
|
||||||
open_btn.setText ("&Open");
|
open_btn.setText ("&Open");
|
||||||
|
|
||||||
open_btn.setGeometry(FPoint(30, 10), FSize(9, 1));
|
open_btn.setGeometry(FPoint{30, 10}, FSize{9, 1});
|
||||||
setGeometry (pos, getSize());
|
setGeometry (pos, getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ sInt64 FFileDialog::numOfDirs()
|
||||||
|
|
||||||
const sInt64 n = std::count_if ( std::begin(dir_entries)
|
const sInt64 n = std::count_if ( std::begin(dir_entries)
|
||||||
, std::end(dir_entries)
|
, std::end(dir_entries)
|
||||||
, [] (const dir_entry& entry)
|
, [] (const FDirEntry& entry)
|
||||||
{
|
{
|
||||||
return entry.directory
|
return entry.directory
|
||||||
&& std::strcmp(entry.name.c_str(), ".") != 0;
|
&& std::strcmp(entry.name.c_str(), ".") != 0;
|
||||||
|
@ -555,7 +555,7 @@ int FFileDialog::readDir()
|
||||||
void FFileDialog::getEntry (const char* const dir, const struct dirent* d_entry)
|
void FFileDialog::getEntry (const char* const dir, const struct dirent* d_entry)
|
||||||
{
|
{
|
||||||
const char* const filter = filter_pattern.c_str();
|
const char* const filter = filter_pattern.c_str();
|
||||||
dir_entry entry{};
|
FDirEntry entry{};
|
||||||
|
|
||||||
entry.name = d_entry->d_name;
|
entry.name = d_entry->d_name;
|
||||||
|
|
||||||
|
@ -590,7 +590,7 @@ void FFileDialog::getEntry (const char* const dir, const struct dirent* d_entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::followSymLink (const char* const dir, dir_entry& entry)
|
void FFileDialog::followSymLink (const char* const dir, FDirEntry& entry)
|
||||||
{
|
{
|
||||||
if ( ! entry.symbolic_link )
|
if ( ! entry.symbolic_link )
|
||||||
return; // No symbolic link
|
return; // No symbolic link
|
||||||
|
@ -632,9 +632,9 @@ void FFileDialog::dirEntriesToList()
|
||||||
for (auto&& entry : dir_entries)
|
for (auto&& entry : dir_entries)
|
||||||
{
|
{
|
||||||
if ( entry.directory )
|
if ( entry.directory )
|
||||||
filebrowser.insert(FString(entry.name), fc::SquareBrackets);
|
filebrowser.insert(FString{entry.name}, fc::SquareBrackets);
|
||||||
else
|
else
|
||||||
filebrowser.insert(FString(entry.name));
|
filebrowser.insert(FString{entry.name});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ void FFileDialog::selectDirectoryEntry (const char* const name)
|
||||||
if ( std::strcmp(entry.name.c_str(), name) == 0 )
|
if ( std::strcmp(entry.name.c_str(), name) == 0 )
|
||||||
{
|
{
|
||||||
filebrowser.setCurrentItem(i);
|
filebrowser.setCurrentItem(i);
|
||||||
filename.setText(FString(name) + '/');
|
filename.setText(FString{name} + '/');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,8 +662,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();
|
||||||
|
@ -688,9 +688,9 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
if ( newdir == FString("..") )
|
if ( newdir == FString{".."} )
|
||||||
{
|
{
|
||||||
if ( lastdir == FString('/') )
|
if ( lastdir == FString{'/'} )
|
||||||
filename.setText('/');
|
filename.setText('/');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -700,7 +700,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 + '/');
|
||||||
|
@ -728,7 +728,7 @@ void FFileDialog::printPath (const FString& txt)
|
||||||
{
|
{
|
||||||
const std::size_t width = max_width - 2;
|
const std::size_t width = max_width - 2;
|
||||||
const std::size_t first = column_width + 1 - width;
|
const std::size_t first = column_width + 1 - width;
|
||||||
const FString sub_str(getColumnSubString (path, first, width));
|
const FString sub_str{getColumnSubString (path, first, width)};
|
||||||
filebrowser.setText(".." + sub_str);
|
filebrowser.setText(".." + sub_str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -748,9 +748,9 @@ const FString FFileDialog::getHomeDir()
|
||||||
const uid_t euid = fsystem->geteuid();
|
const uid_t euid = fsystem->geteuid();
|
||||||
|
|
||||||
if ( fsystem->getpwuid_r(euid, &pwd, buf, sizeof(buf), &pwd_ptr) )
|
if ( fsystem->getpwuid_r(euid, &pwd, buf, sizeof(buf), &pwd_ptr) )
|
||||||
return FString("");
|
return FString{""};
|
||||||
else
|
else
|
||||||
return FString(pwd.pw_dir);
|
return FString{pwd.pw_dir};
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -769,7 +769,7 @@ void FFileDialog::cb_processActivate (const FWidget*, const FDataPtr)
|
||||||
readDir();
|
readDir();
|
||||||
filebrowser.redraw();
|
filebrowser.redraw();
|
||||||
}
|
}
|
||||||
else if ( filename.getText().trim() == FString("..")
|
else if ( filename.getText().trim() == FString{".."}
|
||||||
|| filename.getText().includes('/')
|
|| filename.getText().includes('/')
|
||||||
|| filename.getText().includes('~') )
|
|| filename.getText().includes('~') )
|
||||||
{
|
{
|
||||||
|
@ -784,9 +784,9 @@ void FFileDialog::cb_processActivate (const FWidget*, const FDataPtr)
|
||||||
{
|
{
|
||||||
found = std::any_of ( std::begin(dir_entries)
|
found = std::any_of ( std::begin(dir_entries)
|
||||||
, std::end(dir_entries)
|
, std::end(dir_entries)
|
||||||
, [&input] (const dir_entry& entry)
|
, [&input] (const FDirEntry& entry)
|
||||||
{
|
{
|
||||||
return entry.name.c_str()
|
return ! entry.name.empty()
|
||||||
&& input
|
&& input
|
||||||
&& ! input.isNull()
|
&& ! input.isNull()
|
||||||
&& std::strcmp(entry.name.c_str(), input) == 0
|
&& std::strcmp(entry.name.c_str(), input) == 0
|
||||||
|
@ -810,7 +810,7 @@ void FFileDialog::cb_processRowChanged (const FWidget*, const FDataPtr)
|
||||||
if ( n == 0 )
|
if ( n == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
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 + '/');
|
||||||
|
|
|
@ -86,12 +86,12 @@ const FString FKeyboard::getKeyName (const 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};
|
||||||
|
|
||||||
if ( keynum > 32 && keynum < 127 )
|
if ( keynum > 32 && keynum < 127 )
|
||||||
return FString(char(keynum));
|
return FString{char(keynum)};
|
||||||
|
|
||||||
return FString("");
|
return FString{""};
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -115,7 +115,7 @@ bool& FKeyboard::unprocessedInput()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FKeyboard::isKeyPressed()
|
bool FKeyboard::isKeyPressed() const
|
||||||
{
|
{
|
||||||
fd_set ifds{};
|
fd_set ifds{};
|
||||||
struct timeval tv{};
|
struct timeval tv{};
|
||||||
|
|
|
@ -349,7 +349,7 @@ void FLabel::drawMultiLine()
|
||||||
else
|
else
|
||||||
label_text = multiline_text[y];
|
label_text = multiline_text[y];
|
||||||
|
|
||||||
print() << FPoint(1, 1 + int(y));
|
print() << FPoint{1, 1 + int(y)};
|
||||||
|
|
||||||
if ( hotkeypos != NOT_SET )
|
if ( hotkeypos != NOT_SET )
|
||||||
{
|
{
|
||||||
|
@ -374,7 +374,7 @@ void FLabel::drawSingleLine()
|
||||||
if ( hotkeypos != NOT_SET )
|
if ( hotkeypos != NOT_SET )
|
||||||
column_width--;
|
column_width--;
|
||||||
|
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint{1, 1};
|
||||||
align_offset = getAlignOffset(column_width);
|
align_offset = getAlignOffset(column_width);
|
||||||
printLine (label_text);
|
printLine (label_text);
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ void FLabel::printLine (FString& line)
|
||||||
const std::size_t width(getWidth());
|
const std::size_t width(getWidth());
|
||||||
|
|
||||||
if ( align_offset > 0 )
|
if ( align_offset > 0 )
|
||||||
print (FString(align_offset, ' ')); // leading spaces
|
print (FString{align_offset, ' '}); // leading spaces
|
||||||
|
|
||||||
if ( column_width <= width )
|
if ( column_width <= width )
|
||||||
{
|
{
|
||||||
|
@ -438,15 +438,15 @@ void FLabel::printLine (FString& line)
|
||||||
if ( column_width > width )
|
if ( column_width > width )
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
print() << FColorPair(ellipsis_color, getBackgroundColor())
|
print() << FColorPair{ellipsis_color, getBackgroundColor()}
|
||||||
<< FString("..").left(width);
|
<< FString{".."}.left(width);
|
||||||
setColor();
|
setColor();
|
||||||
}
|
}
|
||||||
else if ( align_offset + to_column < width )
|
else if ( align_offset + to_column < width )
|
||||||
{
|
{
|
||||||
// Print trailing spaces
|
// Print trailing spaces
|
||||||
const std::size_t len = width - align_offset - to_column;
|
const std::size_t len = width - align_offset - to_column;
|
||||||
print (FString(len, ' '));
|
print (FString{len, ' '});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hasReverseMode() )
|
if ( hasReverseMode() )
|
||||||
|
|
|
@ -155,12 +155,12 @@ bool FLineEdit::setShadow (bool enable)
|
||||||
&& getEncoding() != fc::ASCII )
|
&& getEncoding() != fc::ASCII )
|
||||||
{
|
{
|
||||||
setFlags().shadow = true;
|
setFlags().shadow = true;
|
||||||
setShadowSize(FSize(1, 1));
|
setShadowSize(FSize{1, 1});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setFlags().shadow = false;
|
setFlags().shadow = false;
|
||||||
setShadowSize(FSize(0, 0));
|
setShadowSize(FSize{0, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
return getFlags().shadow;
|
return getFlags().shadow;
|
||||||
|
@ -280,7 +280,7 @@ void FLineEdit::hide()
|
||||||
label->hide();
|
label->hide();
|
||||||
|
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
const FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
|
const FSize shadow = hasShadow() ? FSize{1, 1} : FSize{0, 0};
|
||||||
hideArea (getSize() + shadow);
|
hideArea (getSize() + shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,13 +629,13 @@ void FLineEdit::adjustLabel()
|
||||||
|
|
||||||
if ( label_orientation == label_above )
|
if ( label_orientation == label_above )
|
||||||
{
|
{
|
||||||
label->setGeometry ( FPoint(w->getX(), w->getY() - 1)
|
label->setGeometry ( FPoint{w->getX(), w->getY() - 1}
|
||||||
, FSize(label_width, 1) );
|
, FSize{label_width, 1} );
|
||||||
}
|
}
|
||||||
else if ( label_orientation == label_left )
|
else if ( label_orientation == label_left )
|
||||||
{
|
{
|
||||||
label->setGeometry ( FPoint(w->getX() - int(label_width) - 1, w->getY())
|
label->setGeometry ( FPoint{w->getX() - int(label_width) - 1, w->getY()}
|
||||||
, FSize(label_width, 1) );
|
, FSize{label_width, 1} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ void FLineEdit::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FLineEdit::hasHotkey()
|
bool FLineEdit::hasHotkey() const
|
||||||
{
|
{
|
||||||
if ( label_text.isEmpty() )
|
if ( label_text.isEmpty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -721,7 +721,7 @@ void FLineEdit::draw()
|
||||||
void FLineEdit::drawInputField()
|
void FLineEdit::drawInputField()
|
||||||
{
|
{
|
||||||
const bool isActiveFocus = getFlags().active && getFlags().focus;
|
const bool isActiveFocus = getFlags().active && getFlags().focus;
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint{1, 1};
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
{
|
{
|
||||||
|
@ -782,7 +782,7 @@ void FLineEdit::drawInputField()
|
||||||
const int xpos = int(2 + cursor_pos_column
|
const int xpos = int(2 + cursor_pos_column
|
||||||
- text_offset_column
|
- text_offset_column
|
||||||
+ char_width_offset);
|
+ char_width_offset);
|
||||||
setCursorPos (FPoint(xpos, 1));
|
setCursorPos ({xpos, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -804,10 +804,10 @@ inline std::size_t FLineEdit::printTextField()
|
||||||
inline std::size_t FLineEdit::printPassword()
|
inline std::size_t FLineEdit::printPassword()
|
||||||
{
|
{
|
||||||
const std::size_t text_offset_column = text_offset;
|
const std::size_t text_offset_column = text_offset;
|
||||||
const FString show_text(print_text.mid(1 + text_offset, getWidth() - 2));
|
const FString show_text{print_text.mid(1 + text_offset, getWidth() - 2)};
|
||||||
|
|
||||||
if ( ! show_text.isEmpty() )
|
if ( ! show_text.isEmpty() )
|
||||||
print() << FString(show_text.getLength(), fc::Bullet); // •
|
print() << FString{show_text.getLength(), fc::Bullet}; // •
|
||||||
|
|
||||||
x_pos = show_text.getLength();
|
x_pos = show_text.getLength();
|
||||||
return text_offset_column;
|
return text_offset_column;
|
||||||
|
@ -831,7 +831,7 @@ inline std::size_t FLineEdit::getCursorColumnPos()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString FLineEdit::getPasswordText() const
|
inline const FString FLineEdit::getPasswordText() const
|
||||||
{
|
{
|
||||||
return FString(text.getLength(), fc::Bullet); // •
|
return FString{text.getLength(), fc::Bullet}; // •
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -285,7 +285,7 @@ void FListBox::clear()
|
||||||
|
|
||||||
for (int y{0}; y < int(getHeight()) - 2; y++)
|
for (int y{0}; y < int(getHeight()) - 2; y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(2, 2 + y) << FString(size, L' ');
|
print() << FPoint{2, 2 + y} << FString{size, L' '};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@ void FListBox::init()
|
||||||
{
|
{
|
||||||
initScrollbar (vbar, fc::vertical, this, &FListBox::cb_vbarChange);
|
initScrollbar (vbar, fc::vertical, this, &FListBox::cb_vbarChange);
|
||||||
initScrollbar (hbar, fc::horizontal, this, &FListBox::cb_hbarChange);
|
initScrollbar (hbar, fc::horizontal, this, &FListBox::cb_hbarChange);
|
||||||
setGeometry (FPoint(1, 1), FSize(5, 4), false); // initialize geometry values
|
setGeometry (FPoint{1, 1}, FSize{5, 4}, false); // initialize geometry values
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc.dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc.dialog_bg);
|
||||||
|
@ -735,7 +735,7 @@ void FListBox::draw()
|
||||||
|
|
||||||
for (int y{2}; y < int(getHeight()); y++)
|
for (int y{2}; y < int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(int(getWidth()) - 1, y)
|
print() << FPoint{int(getWidth()) - 1, y}
|
||||||
<< ' '; // clear right side of the scrollbar
|
<< ' '; // clear right side of the scrollbar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -764,7 +764,7 @@ void FListBox::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::drawBorder()
|
void FListBox::drawBorder()
|
||||||
{
|
{
|
||||||
FRect box(FPoint(1, 1), getSize());
|
FRect box(FPoint{1, 1}, getSize());
|
||||||
finalcut::drawListBorder (this, box);
|
finalcut::drawListBorder (this, box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,9 +789,9 @@ void FListBox::drawHeadline()
|
||||||
if ( text.isNull() || text.isEmpty() )
|
if ( text.isNull() || text.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const FString txt(" " + text + " ");
|
const FString txt{" " + text + " "};
|
||||||
const auto column_width = getColumnWidth(txt);
|
const auto column_width = getColumnWidth(txt);
|
||||||
print() << FPoint(2, 1);
|
print() << FPoint{2, 1};
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
|
@ -805,7 +805,7 @@ void FListBox::drawHeadline()
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
print() << getColumnSubString (text, 1, getClientWidth() - 2)
|
print() << getColumnSubString (text, 1, getClientWidth() - 2)
|
||||||
<< FColorPair (wc.label_ellipsis_fg, wc.label_bg) << "..";
|
<< FColorPair {wc.label_ellipsis_fg, wc.label_bg} << "..";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -991,7 +991,7 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
const std::size_t inc_len = inc_search.getLength();
|
const std::size_t inc_len = inc_search.getLength();
|
||||||
const std::size_t inc_width = getColumnWidth(inc_search);
|
const std::size_t inc_width = getColumnWidth(inc_search);
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
print() << FPoint(2, 2 + int(y));
|
print() << FPoint{2, 2 + int(y)};
|
||||||
|
|
||||||
if ( isLineSelected )
|
if ( isLineSelected )
|
||||||
{
|
{
|
||||||
|
@ -1024,7 +1024,7 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
setColor ( wc.selected_current_element_fg
|
setColor ( wc.selected_current_element_fg
|
||||||
, wc.selected_current_element_bg );
|
, wc.selected_current_element_bg );
|
||||||
|
|
||||||
setCursorPos (FPoint(3, 2 + int(y))); // first character
|
setCursorPos ({3, 2 + int(y)}); // first character
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1041,10 +1041,10 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
{
|
{
|
||||||
serach_mark = true;
|
serach_mark = true;
|
||||||
// Place the cursor on the last found character
|
// Place the cursor on the last found character
|
||||||
setCursorPos (FPoint(2 + b + int(inc_width), 2 + int(y)));
|
setCursorPos ({2 + b + int(inc_width), 2 + int(y)});
|
||||||
}
|
}
|
||||||
else // only highlighted
|
else // only highlighted
|
||||||
setCursorPos (FPoint(3 + b, 2 + int(y))); // first character
|
setCursorPos ({3 + b, 2 + int(y)}); // first character
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
setColor ( wc.current_element_fg
|
setColor ( wc.current_element_fg
|
||||||
|
@ -1721,13 +1721,13 @@ void FListBox::changeOnResize()
|
||||||
{
|
{
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
vbar->setGeometry (FPoint(int(getWidth()), 2), FSize(2, getHeight() - 2));
|
vbar->setGeometry (FPoint{int(getWidth()), 2}, FSize{2, getHeight() - 2});
|
||||||
hbar->setGeometry (FPoint(1, int(getHeight())), FSize(getWidth() - 2, 1));
|
hbar->setGeometry (FPoint{1, int(getHeight())}, FSize{getWidth() - 2, 1});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vbar->setGeometry (FPoint(int(getWidth()), 2), FSize(1, getHeight() - 2));
|
vbar->setGeometry (FPoint{int(getWidth()), 2}, FSize{1, getHeight() - 2});
|
||||||
hbar->setGeometry (FPoint(2, int(getHeight())), FSize(getWidth() - 2, 1));
|
hbar->setGeometry (FPoint{2, int(getHeight())}, FSize{getWidth() - 2, 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1522,7 +1522,7 @@ void FListView::init()
|
||||||
selflist.push_back(this);
|
selflist.push_back(this);
|
||||||
root = selflist.begin();
|
root = selflist.begin();
|
||||||
getNullIterator() = selflist.end();
|
getNullIterator() = selflist.end();
|
||||||
setGeometry (FPoint(1, 1), FSize(5, 4), false); // initialize geometry values
|
setGeometry (FPoint{1, 1}, FSize{5, 4}, false); // initialize geometry values
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc.dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc.dialog_bg);
|
||||||
|
@ -1650,7 +1650,7 @@ void FListView::draw()
|
||||||
|
|
||||||
for (int y{2}; y < int(getHeight()); y++)
|
for (int y{2}; y < int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(int(getWidth()) - 1, y)
|
print() << FPoint{int(getWidth()) - 1, y}
|
||||||
<< ' '; // clear right side of the scrollbar
|
<< ' '; // clear right side of the scrollbar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1679,7 +1679,7 @@ void FListView::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::drawBorder()
|
void FListView::drawBorder()
|
||||||
{
|
{
|
||||||
const FRect box(FPoint(1, 1), getSize());
|
const FRect box(FPoint{1, 1}, getSize());
|
||||||
finalcut::drawListBorder (this, box);
|
finalcut::drawListBorder (this, box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1749,7 +1749,7 @@ void FListView::drawList()
|
||||||
const int tree_offset = ( tree_view ) ? int(item->getDepth() << 1) + 1 : 0;
|
const int tree_offset = ( tree_view ) ? int(item->getDepth() << 1) + 1 : 0;
|
||||||
const int checkbox_offset = ( item->isCheckable() ) ? 1 : 0;
|
const int checkbox_offset = ( item->isCheckable() ) ? 1 : 0;
|
||||||
path_end = getListEnd(item);
|
path_end = getListEnd(item);
|
||||||
print() << FPoint(2, 2 + int(y));
|
print() << FPoint{2, 2 + int(y)};
|
||||||
|
|
||||||
// Draw one FListViewItem
|
// Draw one FListViewItem
|
||||||
drawListLine (item, getFlags().focus, is_current_line);
|
drawListLine (item, getFlags().focus, is_current_line);
|
||||||
|
@ -1762,7 +1762,7 @@ void FListView::drawList()
|
||||||
xpos = -9999; // by moving it outside the visible area
|
xpos = -9999; // by moving it outside the visible area
|
||||||
|
|
||||||
setVisibleCursor (item->isCheckable());
|
setVisibleCursor (item->isCheckable());
|
||||||
setCursorPos (FPoint(xpos, 2 + int(y))); // first character
|
setCursorPos ({xpos, 2 + int(y)}); // first character
|
||||||
}
|
}
|
||||||
|
|
||||||
last_visible_line = iter;
|
last_visible_line = iter;
|
||||||
|
@ -1779,8 +1779,8 @@ void FListView::drawList()
|
||||||
// Clean empty space after last element
|
// Clean empty space after last element
|
||||||
while ( y < uInt(getClientHeight()) )
|
while ( y < uInt(getClientHeight()) )
|
||||||
{
|
{
|
||||||
print() << FPoint(2, 2 + int(y))
|
print() << FPoint{2, 2 + int(y)}
|
||||||
<< FString(std::size_t(getClientWidth()), ' ');
|
<< FString{std::size_t(getClientWidth()), ' '};
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1795,7 +1795,7 @@ void FListView::drawListLine ( const FListViewItem* item
|
||||||
|
|
||||||
// Print the entry
|
// Print the entry
|
||||||
const std::size_t indent = item->getDepth() << 1; // indent = 2 * depth
|
const 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() )
|
||||||
|
@ -1822,21 +1822,21 @@ void FListView::drawListLine ( const FListViewItem* item
|
||||||
|
|
||||||
// Insert alignment spaces
|
// Insert alignment spaces
|
||||||
if ( align_offset > 0 )
|
if ( align_offset > 0 )
|
||||||
line += FString(align_offset, L' ');
|
line += FString{align_offset, L' '};
|
||||||
|
|
||||||
if ( align_offset + column_width <= width )
|
if ( align_offset + column_width <= width )
|
||||||
{
|
{
|
||||||
// Insert text and trailing space
|
// Insert text and trailing space
|
||||||
static constexpr std::size_t leading_space = 1;
|
static constexpr std::size_t leading_space = 1;
|
||||||
line += getColumnSubString (text, 1, width);
|
line += getColumnSubString (text, 1, width);
|
||||||
line += FString ( leading_space + width
|
line += FString { leading_space + width
|
||||||
- align_offset - column_width, L' ');
|
- align_offset - column_width, L' '};
|
||||||
}
|
}
|
||||||
else if ( align == fc::alignRight )
|
else if ( align == fc::alignRight )
|
||||||
{
|
{
|
||||||
// Ellipse right align text
|
// Ellipse right align text
|
||||||
const std::size_t first = getColumnWidth(text) + 1 - width;
|
const std::size_t first = getColumnWidth(text) + 1 - width;
|
||||||
line += FString (L"..");
|
line += FString {L".."};
|
||||||
line += getColumnSubString (text, first, width - ellipsis_length);
|
line += getColumnSubString (text, first, width - ellipsis_length);
|
||||||
line += L' ';
|
line += L' ';
|
||||||
}
|
}
|
||||||
|
@ -1844,7 +1844,7 @@ void FListView::drawListLine ( const FListViewItem* item
|
||||||
{
|
{
|
||||||
// Ellipse left align text and center text
|
// Ellipse left align text and center text
|
||||||
line += getColumnSubString (text, 1, width - ellipsis_length);
|
line += getColumnSubString (text, 1, width - ellipsis_length);
|
||||||
line += FString (L".. ");
|
line += FString {L".. "};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1887,7 +1887,7 @@ void FListView::clearList()
|
||||||
|
|
||||||
for (int y{0}; y < int(getHeight()) - 2; y++)
|
for (int y{0}; y < int(getHeight()) - 2; y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(2, 2 + y) << FString(size, L' ');
|
print() << FPoint{2, 2 + y} << FString{size, L' '};
|
||||||
}
|
}
|
||||||
|
|
||||||
drawScrollbars();
|
drawScrollbars();
|
||||||
|
@ -1932,7 +1932,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() )
|
||||||
{
|
{
|
||||||
|
@ -1963,12 +1963,12 @@ 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 )
|
||||||
{
|
{
|
||||||
if ( indent > 0 )
|
if ( indent > 0 )
|
||||||
line = FString(indent, L' ');
|
line = FString{indent, L' '};
|
||||||
|
|
||||||
if ( item->isExpandable() )
|
if ( item->isExpandable() )
|
||||||
{
|
{
|
||||||
|
@ -2021,7 +2021,7 @@ inline void FListView::drawSortIndicator ( std::size_t& length
|
||||||
inline void FListView::drawHeaderBorder (std::size_t length)
|
inline void FListView::drawHeaderBorder (std::size_t length)
|
||||||
{
|
{
|
||||||
setColor();
|
setColor();
|
||||||
const FString line (length, fc::BoxDrawingsHorizontal);
|
const FString line {length, fc::BoxDrawingsHorizontal};
|
||||||
headerline << line; // horizontal line
|
headerline << line; // horizontal line
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2032,7 +2032,7 @@ void FListView::drawHeadlineLabel (const headerItems::const_iterator& iter)
|
||||||
// Print label text
|
// Print label 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};
|
||||||
const std::size_t width = std::size_t(iter->width);
|
const std::size_t width = std::size_t(iter->width);
|
||||||
std::size_t column_width = getColumnWidth(txt);
|
std::size_t column_width = getColumnWidth(txt);
|
||||||
const std::size_t column_max = leading_space + width;
|
const std::size_t column_max = leading_space + width;
|
||||||
|
@ -2144,7 +2144,7 @@ void FListView::drawBufferedHeadline()
|
||||||
column_width = getColumnWidth(headerline);
|
column_width = getColumnWidth(headerline);
|
||||||
|
|
||||||
// Print the header line
|
// Print the header line
|
||||||
print() << FPoint(2, 1);
|
print() << FPoint{2, 1};
|
||||||
|
|
||||||
if ( left_truncated_fullwidth )
|
if ( left_truncated_fullwidth )
|
||||||
print (fc::SingleLeftAngleQuotationMark); // ‹
|
print (fc::SingleLeftAngleQuotationMark); // ‹
|
||||||
|
@ -2173,7 +2173,7 @@ void FListView::drawColumnEllipsis ( const headerItems::const_iterator& iter
|
||||||
|
|
||||||
headerline << ' '
|
headerline << ' '
|
||||||
<< getColumnSubString (text, 1, uInt(width - ellipsis_length))
|
<< getColumnSubString (text, 1, uInt(width - ellipsis_length))
|
||||||
<< FColorPair (wc.label_ellipsis_fg, wc.label_bg)
|
<< FColorPair {wc.label_ellipsis_fg, wc.label_bg}
|
||||||
<< "..";
|
<< "..";
|
||||||
|
|
||||||
if ( iter == header.end() - 1 ) // Last element
|
if ( iter == header.end() - 1 ) // Last element
|
||||||
|
@ -2518,13 +2518,13 @@ void FListView::changeOnResize()
|
||||||
{
|
{
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
vbar->setGeometry (FPoint(int(getWidth()), 2), FSize(2, getHeight() - 2));
|
vbar->setGeometry (FPoint{int(getWidth()), 2}, FSize{2, getHeight() - 2});
|
||||||
hbar->setGeometry (FPoint(1, int(getHeight())), FSize(getWidth() - 2, 1));
|
hbar->setGeometry (FPoint{1, int(getHeight())}, FSize{getWidth() - 2, 1});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vbar->setGeometry (FPoint(int(getWidth()), 2), FSize(1, getHeight() - 2));
|
vbar->setGeometry (FPoint{int(getWidth()), 2}, FSize{1, getHeight() - 2});
|
||||||
hbar->setGeometry (FPoint(2, int(getHeight())), FSize(getWidth() - 2, 1));
|
hbar->setGeometry (FPoint{2, int(getHeight())}, FSize{getWidth() - 2, 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -453,7 +453,7 @@ void FMenu::init(FWidget* parent)
|
||||||
setLeftPadding(1);
|
setLeftPadding(1);
|
||||||
setBottomPadding(1);
|
setBottomPadding(1);
|
||||||
setRightPadding(1);
|
setRightPadding(1);
|
||||||
setGeometry (FPoint(1, 1), FSize(10, 2), false); // initialize geometry values
|
setGeometry (FPoint{1, 1}, FSize{10, 2}, false); // initialize geometry values
|
||||||
setTransparentShadow();
|
setTransparentShadow();
|
||||||
setMenuWidget();
|
setMenuWidget();
|
||||||
hide();
|
hide();
|
||||||
|
@ -531,8 +531,8 @@ void FMenu::calculateDimensions()
|
||||||
const int adjust_X = adjustX(getX());
|
const int adjust_X = adjustX(getX());
|
||||||
|
|
||||||
// set widget geometry
|
// set widget geometry
|
||||||
setGeometry ( FPoint(adjust_X, getY())
|
setGeometry ( FPoint{adjust_X, getY()}
|
||||||
, FSize(max_item_width + 2, getCount() + 2) );
|
, FSize{max_item_width + 2, getCount() + 2} );
|
||||||
|
|
||||||
// set geometry of all items
|
// set geometry of all items
|
||||||
const int item_X = 1;
|
const int item_X = 1;
|
||||||
|
@ -540,14 +540,14 @@ void FMenu::calculateDimensions()
|
||||||
|
|
||||||
for (auto&& item : getItemList())
|
for (auto&& item : getItemList())
|
||||||
{
|
{
|
||||||
item->setGeometry (FPoint(item_X, item_Y), FSize(max_item_width, 1));
|
item->setGeometry (FPoint{item_X, item_Y}, FSize{max_item_width, 1});
|
||||||
|
|
||||||
if ( item->hasMenu() )
|
if ( item->hasMenu() )
|
||||||
{
|
{
|
||||||
const int menu_X = getTermX() + int(max_item_width) + 1;
|
const int menu_X = getTermX() + int(max_item_width) + 1;
|
||||||
const int menu_Y = item->getTermY() - 2;
|
const int menu_Y = item->getTermY() - 2;
|
||||||
// set sub-menu position
|
// set sub-menu position
|
||||||
item->getMenu()->setPos (FPoint(menu_X, menu_Y), false);
|
item->getMenu()->setPos (FPoint{menu_X, menu_Y}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
item_Y++;
|
item_Y++;
|
||||||
|
@ -567,7 +567,7 @@ void FMenu::adjustItems()
|
||||||
const int menu_Y = item->getTermY() - 2;
|
const int menu_Y = item->getTermY() - 2;
|
||||||
|
|
||||||
// set sub-menu position
|
// set sub-menu position
|
||||||
menu->setPos (FPoint(menu_X, menu_Y));
|
menu->setPos (FPoint{menu_X, menu_Y});
|
||||||
|
|
||||||
// call sub-menu adjustItems()
|
// call sub-menu adjustItems()
|
||||||
if ( menu->getCount() > 0 )
|
if ( menu->getCount() > 0 )
|
||||||
|
@ -682,7 +682,7 @@ bool FMenu::mouseDownOverList (const FPoint& mouse_pos)
|
||||||
{
|
{
|
||||||
bool focus_changed{false};
|
bool focus_changed{false};
|
||||||
FPoint pos{mouse_pos};
|
FPoint pos{mouse_pos};
|
||||||
pos -= FPoint(getRightPadding(), getTopPadding());
|
pos -= FPoint{getRightPadding(), getTopPadding()};
|
||||||
|
|
||||||
for (auto&& item : getItemList())
|
for (auto&& item : getItemList())
|
||||||
{
|
{
|
||||||
|
@ -768,7 +768,7 @@ void FMenu::mouseDownSelection (FMenuItem* m_item, bool& focus_changed)
|
||||||
bool FMenu::mouseUpOverList (const FPoint& mouse_pos)
|
bool FMenu::mouseUpOverList (const FPoint& mouse_pos)
|
||||||
{
|
{
|
||||||
FPoint pos{mouse_pos};
|
FPoint pos{mouse_pos};
|
||||||
pos -= FPoint(getRightPadding(), getTopPadding());
|
pos -= FPoint{getRightPadding(), getTopPadding()};
|
||||||
|
|
||||||
for (auto&& item : getItemList())
|
for (auto&& item : getItemList())
|
||||||
{
|
{
|
||||||
|
@ -824,7 +824,7 @@ bool FMenu::mouseUpOverList (const FPoint& mouse_pos)
|
||||||
void FMenu::mouseMoveOverList (const FPoint& mouse_pos, mouseStates& ms)
|
void FMenu::mouseMoveOverList (const FPoint& mouse_pos, mouseStates& ms)
|
||||||
{
|
{
|
||||||
FPoint pos{mouse_pos};
|
FPoint pos{mouse_pos};
|
||||||
pos -= FPoint(getRightPadding(), getTopPadding());
|
pos -= FPoint{getRightPadding(), getTopPadding()};
|
||||||
|
|
||||||
for (auto&& item : getItemList())
|
for (auto&& item : getItemList())
|
||||||
{
|
{
|
||||||
|
@ -1243,8 +1243,8 @@ void FMenu::drawItems()
|
||||||
inline void FMenu::drawSeparator (int y)
|
inline void FMenu::drawSeparator (int y)
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
print() << FPoint(1, 2 + y)
|
print() << FPoint{1, 2 + y}
|
||||||
<< FColorPair(wc.menu_active_fg, wc.menu_active_bg);
|
<< FColorPair{wc.menu_active_fg, wc.menu_active_bg};
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -1252,16 +1252,16 @@ inline void FMenu::drawSeparator (int y)
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
print (fc::NF_border_line_vertical_right);
|
print (fc::NF_border_line_vertical_right);
|
||||||
FString line ( std::size_t(getWidth()) - 2
|
FString line { std::size_t(getWidth()) - 2
|
||||||
, fc::BoxDrawingsHorizontal );
|
, fc::BoxDrawingsHorizontal };
|
||||||
print (line);
|
print (line);
|
||||||
print (fc::NF_rev_border_line_vertical_left);
|
print (fc::NF_rev_border_line_vertical_left);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print (fc::BoxDrawingsVerticalAndRight);
|
print (fc::BoxDrawingsVerticalAndRight);
|
||||||
FString line ( std::size_t(getWidth()) - 2
|
FString line { std::size_t(getWidth()) - 2
|
||||||
, fc::BoxDrawingsHorizontal);
|
, fc::BoxDrawingsHorizontal};
|
||||||
print (line);
|
print (line);
|
||||||
print (fc::BoxDrawingsVerticalAndLeft);
|
print (fc::BoxDrawingsVerticalAndLeft);
|
||||||
}
|
}
|
||||||
|
@ -1273,7 +1273,7 @@ inline void FMenu::drawSeparator (int y)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::drawMenuLine (FMenuItem* m_item, int y)
|
inline void FMenu::drawMenuLine (FMenuItem* m_item, int y)
|
||||||
{
|
{
|
||||||
FString txt(m_item->getText());
|
FString txt{m_item->getText()};
|
||||||
menuText txtdata{};
|
menuText txtdata{};
|
||||||
std::size_t column_width = getColumnWidth(txt);
|
std::size_t column_width = getColumnWidth(txt);
|
||||||
const FKey accel_key = m_item->accel_key;
|
const FKey accel_key = m_item->accel_key;
|
||||||
|
@ -1408,7 +1408,7 @@ inline void FMenu::drawSubMenuIndicator (std::size_t& startpos)
|
||||||
if ( len > 0 )
|
if ( len > 0 )
|
||||||
{
|
{
|
||||||
// Print filling blank spaces
|
// Print filling blank spaces
|
||||||
print (FString(len, L' '));
|
print (FString{len, L' '});
|
||||||
// Print BlackRightPointingPointer ►
|
// Print BlackRightPointingPointer ►
|
||||||
print (fc::BlackRightPointingPointer);
|
print (fc::BlackRightPointingPointer);
|
||||||
startpos = max_item_width - (c + 2);
|
startpos = max_item_width - (c + 2);
|
||||||
|
@ -1418,7 +1418,7 @@ inline void FMenu::drawSubMenuIndicator (std::size_t& startpos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::drawAcceleratorKey (std::size_t& startpos, FKey accel_key)
|
inline void FMenu::drawAcceleratorKey (std::size_t& startpos, FKey accel_key)
|
||||||
{
|
{
|
||||||
const FString accel_name (getKeyName(accel_key));
|
const FString accel_name {getKeyName(accel_key)};
|
||||||
const std::size_t c = ( has_checkable_items ) ? 1 : 0;
|
const std::size_t c = ( has_checkable_items ) ? 1 : 0;
|
||||||
const std::size_t accel_len = accel_name.getLength();
|
const std::size_t accel_len = accel_name.getLength();
|
||||||
const std::size_t len = max_item_width - (startpos + accel_len + c + 2);
|
const std::size_t len = max_item_width - (startpos + accel_len + c + 2);
|
||||||
|
@ -1426,7 +1426,7 @@ inline void FMenu::drawAcceleratorKey (std::size_t& startpos, FKey accel_key)
|
||||||
if ( len > 0 )
|
if ( len > 0 )
|
||||||
{
|
{
|
||||||
// Print filling blank spaces + accelerator key name
|
// Print filling blank spaces + accelerator key name
|
||||||
const FString spaces (len, L' ');
|
const FString spaces {len, L' '};
|
||||||
print (spaces + accel_name);
|
print (spaces + accel_name);
|
||||||
startpos = max_item_width - (c + 2);
|
startpos = max_item_width - (c + 2);
|
||||||
}
|
}
|
||||||
|
@ -1477,7 +1477,7 @@ inline void FMenu::setLineAttributes (const FMenuItem* m_item, int y)
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
print() << FPoint(2, 2 + y);
|
print() << FPoint{2, 2 + y};
|
||||||
setColor();
|
setColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1493,9 +1493,9 @@ inline void FMenu::setCursorToHotkeyPosition (FMenuItem* m_item)
|
||||||
if ( is_selected )
|
if ( is_selected )
|
||||||
{
|
{
|
||||||
if ( is_checkable )
|
if ( is_checkable )
|
||||||
m_item->setCursorPos (FPoint(3, 1));
|
m_item->setCursorPos({3, 1});
|
||||||
else
|
else
|
||||||
m_item->setCursorPos (FPoint(2, 1));
|
m_item->setCursorPos({2, 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1506,9 +1506,9 @@ inline void FMenu::setCursorToHotkeyPosition (FMenuItem* m_item)
|
||||||
const auto x = getColumnWidth (m_item->getText(), hotkeypos);
|
const auto x = getColumnWidth (m_item->getText(), hotkeypos);
|
||||||
|
|
||||||
if ( is_checkable )
|
if ( is_checkable )
|
||||||
m_item->setCursorPos (FPoint(3 + int(x), 1));
|
m_item->setCursorPos({3 + int(x), 1});
|
||||||
else
|
else
|
||||||
m_item->setCursorPos (FPoint(2 + int(x), 1));
|
m_item->setCursorPos({2 + int(x), 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1621,13 +1621,21 @@ std::tuple<bool, bool> closeOpenMenus ( FMenu* menu
|
||||||
{
|
{
|
||||||
// Close the open menu
|
// Close the open menu
|
||||||
|
|
||||||
|
bool click_in_menu_structure{false};
|
||||||
bool is_dialog_menu{false};
|
bool is_dialog_menu{false};
|
||||||
|
|
||||||
if ( ! menu )
|
if ( ! menu )
|
||||||
return std::make_tuple(false, false);
|
{
|
||||||
|
auto tuple = std::make_tuple(click_in_menu_structure, is_dialog_menu);
|
||||||
|
return tuple;
|
||||||
|
}
|
||||||
|
|
||||||
if ( menu->containsMenuStructure(mouse_position) )
|
if ( menu->containsMenuStructure(mouse_position) )
|
||||||
return std::make_tuple(true, false);
|
{
|
||||||
|
click_in_menu_structure = true;
|
||||||
|
auto tuple = std::make_tuple(click_in_menu_structure, is_dialog_menu);
|
||||||
|
return tuple;
|
||||||
|
}
|
||||||
|
|
||||||
if ( menu->isDialogMenu() )
|
if ( menu->isDialogMenu() )
|
||||||
is_dialog_menu = true;
|
is_dialog_menu = true;
|
||||||
|
@ -1636,7 +1644,7 @@ std::tuple<bool, bool> closeOpenMenus ( FMenu* menu
|
||||||
menu->hide();
|
menu->hide();
|
||||||
menu->hideSubMenus();
|
menu->hideSubMenus();
|
||||||
menu->hideSuperMenus();
|
menu->hideSuperMenus();
|
||||||
return std::make_tuple (false, is_dialog_menu);
|
return std::make_tuple (click_in_menu_structure, is_dialog_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -68,7 +68,7 @@ void FMenuBar::hide()
|
||||||
FColor fg = wc.term_fg;
|
FColor fg = wc.term_fg;
|
||||||
FColor bg = wc.term_bg;
|
FColor bg = wc.term_bg;
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
print() << FPoint(1, 1) << FString(getDesktopWidth(), L' ');
|
print() << FPoint{1, 1} << FString{getDesktopWidth(), L' '};
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
FWindow::hide();
|
FWindow::hide();
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ void FMenuBar::hide()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::adjustSize()
|
void FMenuBar::adjustSize()
|
||||||
{
|
{
|
||||||
setGeometry (FPoint(1, 1), FSize(getDesktopWidth(), 1), false);
|
setGeometry (FPoint{1, 1}, FSize{getDesktopWidth(), 1}, false);
|
||||||
adjustItems();
|
adjustItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ void FMenuBar::init()
|
||||||
auto r = getRootWidget();
|
auto r = getRootWidget();
|
||||||
auto w = r->getWidth();
|
auto w = r->getWidth();
|
||||||
// initialize geometry values
|
// initialize geometry values
|
||||||
setGeometry (FPoint(1, 1), FSize(w, 1), false);
|
setGeometry (FPoint{1, 1}, FSize{w, 1}, false);
|
||||||
setAlwaysOnTop();
|
setAlwaysOnTop();
|
||||||
setMenuBar(this);
|
setMenuBar(this);
|
||||||
ignorePadding();
|
ignorePadding();
|
||||||
|
@ -257,7 +257,7 @@ void FMenuBar::init()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::calculateDimensions()
|
void FMenuBar::calculateDimensions()
|
||||||
{
|
{
|
||||||
FPoint item_pos (1, 1);
|
FPoint item_pos{1, 1};
|
||||||
|
|
||||||
// find the maximum item width
|
// find the maximum item width
|
||||||
for (auto&& item : getItemList())
|
for (auto&& item : getItemList())
|
||||||
|
@ -266,7 +266,7 @@ void FMenuBar::calculateDimensions()
|
||||||
int item_width = len + 2;
|
int item_width = len + 2;
|
||||||
|
|
||||||
// set item geometry
|
// set item geometry
|
||||||
item->setGeometry (item_pos, FSize(std::size_t(item_width), 1), false);
|
item->setGeometry (item_pos, FSize{std::size_t(item_width), 1}, false);
|
||||||
|
|
||||||
// set menu position
|
// set menu position
|
||||||
if ( item->hasMenu() )
|
if ( item->hasMenu() )
|
||||||
|
@ -475,7 +475,7 @@ void FMenuBar::drawItems()
|
||||||
if ( list.empty() )
|
if ( list.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint{1, 1};
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -499,7 +499,7 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
|
||||||
menuText txtdata{};
|
menuText txtdata{};
|
||||||
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());
|
FString txt{menuitem->getText()};
|
||||||
std::size_t column_width = getColumnWidth(txt);
|
std::size_t column_width = getColumnWidth(txt);
|
||||||
bool is_enabled = menuitem->isEnabled();
|
bool is_enabled = menuitem->isEnabled();
|
||||||
bool is_selected = menuitem->isSelected();
|
bool is_selected = menuitem->isSelected();
|
||||||
|
@ -577,13 +577,13 @@ inline void FMenuBar::setCursorToHotkeyPosition ( FMenuItem* menuitem
|
||||||
if ( hotkeypos == NOT_SET )
|
if ( hotkeypos == NOT_SET )
|
||||||
{
|
{
|
||||||
// set cursor to the first character
|
// set cursor to the first character
|
||||||
menuitem->setCursorPos (FPoint(2, 1));
|
menuitem->setCursorPos({2, 1});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set cursor to the hotkey position
|
// set cursor to the hotkey position
|
||||||
std::size_t x = getColumnWidth (menuitem->getText(), hotkeypos);
|
std::size_t x = getColumnWidth (menuitem->getText(), hotkeypos);
|
||||||
menuitem->setCursorPos (FPoint(2 + int(x), 1));
|
menuitem->setCursorPos({2 + int(x), 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -632,12 +632,12 @@ inline void FMenuBar::drawEllipsis (const menuText& txtdata, std::size_t x)
|
||||||
if ( txtdata.startpos < screenWidth )
|
if ( txtdata.startpos < screenWidth )
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
print() << FPoint(int(screenWidth) - 1, 1) << "..";
|
print() << FPoint{int(screenWidth) - 1, 1} << "..";
|
||||||
}
|
}
|
||||||
else if ( txtdata.startpos - 1 <= screenWidth )
|
else if ( txtdata.startpos - 1 <= screenWidth )
|
||||||
{
|
{
|
||||||
// Hide first character from text
|
// Hide first character from text
|
||||||
print() << FPoint(int(screenWidth), 1) << ' ';
|
print() << FPoint{int(screenWidth), 1} << ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -682,7 +682,7 @@ void FMenuBar::adjustItems()
|
||||||
auto menu = item->getMenu();
|
auto menu = item->getMenu();
|
||||||
|
|
||||||
// set menu position
|
// set menu position
|
||||||
menu->setPos (FPoint(menu->adjustX(item_X), item_Y));
|
menu->setPos (FPoint{menu->adjustX(item_X), item_Y});
|
||||||
|
|
||||||
// call menu adjustItems()
|
// call menu adjustItems()
|
||||||
menu->adjustItems();
|
menu->adjustItems();
|
||||||
|
|
|
@ -517,7 +517,7 @@ void FMenuItem::init (FWidget* parent)
|
||||||
text_width--;
|
text_width--;
|
||||||
}
|
}
|
||||||
|
|
||||||
setGeometry (FPoint(1, 1), FSize(text_width + 2, 1), false);
|
setGeometry (FPoint{1, 1}, FSize{text_width + 2, 1}, false);
|
||||||
|
|
||||||
if ( ! parent )
|
if ( ! parent )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -182,7 +182,7 @@ void FMessageBox::adjustSize()
|
||||||
|
|
||||||
const int x = 1 + int((max_width - getWidth()) / 2);
|
const int x = 1 + int((max_width - getWidth()) / 2);
|
||||||
const int y = 1 + int((max_height - getHeight()) / 3);
|
const int y = 1 + int((max_height - getHeight()) / 3);
|
||||||
setPos(FPoint(x, y), false);
|
setPos(FPoint{x, y}, false);
|
||||||
FDialog::adjustSize();
|
FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
|
||||||
{
|
{
|
||||||
button[0] = new FButton (this);
|
button[0] = new FButton (this);
|
||||||
button[0]->setText(button_text[button0]);
|
button[0]->setText(button_text[button0]);
|
||||||
button[0]->setPos(FPoint(3, int(getHeight()) - 4), false);
|
button[0]->setPos(FPoint{3, int(getHeight()) - 4}, false);
|
||||||
button[0]->setWidth(1, false);
|
button[0]->setWidth(1, false);
|
||||||
button[0]->setHeight(1, false);
|
button[0]->setHeight(1, false);
|
||||||
button[0]->setFocus();
|
button[0]->setFocus();
|
||||||
|
@ -242,7 +242,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
|
||||||
{
|
{
|
||||||
button[1] = new FButton(this);
|
button[1] = new FButton(this);
|
||||||
button[1]->setText(button_text[button1]);
|
button[1]->setText(button_text[button1]);
|
||||||
button[1]->setPos(FPoint(17, int(getHeight()) - 4), false);
|
button[1]->setPos(FPoint{17, int(getHeight()) - 4}, false);
|
||||||
button[1]->setWidth(0, false);
|
button[1]->setWidth(0, false);
|
||||||
button[1]->setHeight(1, false);
|
button[1]->setHeight(1, false);
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
|
||||||
{
|
{
|
||||||
button[2] = new FButton(this);
|
button[2] = new FButton(this);
|
||||||
button[2]->setText(button_text[button2]);
|
button[2]->setText(button_text[button2]);
|
||||||
button[2]->setPos(FPoint(32, int(getHeight()) - 4), false);
|
button[2]->setPos(FPoint{32, int(getHeight()) - 4}, false);
|
||||||
button[2]->setWidth(0, false);
|
button[2]->setWidth(0, false);
|
||||||
button[2]->setHeight(1, false);
|
button[2]->setHeight(1, false);
|
||||||
}
|
}
|
||||||
|
@ -358,7 +358,7 @@ void FMessageBox::draw()
|
||||||
if ( center_text ) // center one line
|
if ( center_text ) // center one line
|
||||||
center_x = int((max_line_width - headline_width) / 2);
|
center_x = int((max_line_width - headline_width) / 2);
|
||||||
|
|
||||||
print() << FPoint(1 + msg_x + center_x, 4) << headline_text;
|
print() << FPoint{1 + msg_x + center_x, 4} << headline_text;
|
||||||
head_offset = 2;
|
head_offset = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ void FMessageBox::draw()
|
||||||
if ( center_text ) // center one line
|
if ( center_text ) // center one line
|
||||||
center_x = int((max_line_width - line_width) / 2);
|
center_x = int((max_line_width - line_width) / 2);
|
||||||
|
|
||||||
print() << FPoint(1 + msg_x + center_x, 4 + head_offset + y)
|
print() << FPoint{1 + msg_x + center_x, 4 + head_offset + y}
|
||||||
<< line;
|
<< line;
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ const FString FMouse::getClassName() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FPoint& FMouse::getPos()
|
inline const FPoint& FMouse::getPos()
|
||||||
{
|
{
|
||||||
return mouse;
|
return mouse;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ inline FMouse::FMouseButton& FMouse::getButtonState()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FPoint& FMouse::getNewPos()
|
inline const FPoint& FMouse::getNewPos()
|
||||||
{
|
{
|
||||||
return new_mouse_position;
|
return new_mouse_position;
|
||||||
}
|
}
|
||||||
|
@ -381,8 +381,8 @@ void FMouseGPM::processEvent (struct timeval*)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
setPos (FPoint( std::max(gpm_ev.x, sInt16(1))
|
setPos (FPoint{ std::max(gpm_ev.x, sInt16(1))
|
||||||
, std::max(gpm_ev.y, sInt16(1)) ));
|
, std::max(gpm_ev.y, sInt16(1)) });
|
||||||
|
|
||||||
if ( gpmEvent(false) == mouse_event )
|
if ( gpmEvent(false) == mouse_event )
|
||||||
setPending(true);
|
setPending(true);
|
||||||
|
@ -618,7 +618,7 @@ void FMouseX11::processEvent (struct timeval* time)
|
||||||
}
|
}
|
||||||
|
|
||||||
setEvent();
|
setEvent();
|
||||||
setPos (FPoint(x, y));
|
setPos (FPoint{x, y});
|
||||||
// Get the button state from string
|
// Get the button state from string
|
||||||
x11_button_state = uChar(btn);
|
x11_button_state = uChar(btn);
|
||||||
// Delete already interpreted data
|
// Delete already interpreted data
|
||||||
|
@ -844,7 +844,7 @@ void FMouseSGR::processEvent (struct timeval* time)
|
||||||
}
|
}
|
||||||
|
|
||||||
setEvent();
|
setEvent();
|
||||||
setPos (FPoint(x, y));
|
setPos (FPoint{x, y});
|
||||||
// Get the button state from string
|
// Get the button state from string
|
||||||
sgr_button_state = uChar(((*p & 0x20) << 2) + btn);
|
sgr_button_state = uChar(((*p & 0x20) << 2) + btn);
|
||||||
// Delete already interpreted data
|
// Delete already interpreted data
|
||||||
|
@ -1099,7 +1099,7 @@ void FMouseUrxvt::processEvent (struct timeval* time)
|
||||||
}
|
}
|
||||||
|
|
||||||
setEvent();
|
setEvent();
|
||||||
setPos (FPoint(x, y));
|
setPos (FPoint{x, y});
|
||||||
urxvt_button_state = uChar(btn);
|
urxvt_button_state = uChar(btn);
|
||||||
// Delete already interpreted data
|
// Delete already interpreted data
|
||||||
urxvt_mouse[0] = '\0';
|
urxvt_mouse[0] = '\0';
|
||||||
|
@ -1234,7 +1234,7 @@ FMouseControl::~FMouseControl() // destructor
|
||||||
|
|
||||||
// public methods of FMouseControl
|
// public methods of FMouseControl
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FPoint& FMouseControl::getPos()
|
const FPoint& FMouseControl::getPos()
|
||||||
{
|
{
|
||||||
const auto& mouse_object = getMouseWithEvent();
|
const auto& mouse_object = getMouseWithEvent();
|
||||||
|
|
||||||
|
|
|
@ -1221,7 +1221,7 @@ bool FOptiAttr::hasNoAttribute (const FChar* const& attr)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FOptiAttr::hasColorChanged ( const FChar* const& term
|
inline bool FOptiAttr::hasColorChanged ( const FChar* const& term
|
||||||
, const FChar* const& next )
|
, const FChar* const& next ) const
|
||||||
{
|
{
|
||||||
if ( term && next )
|
if ( term && next )
|
||||||
{
|
{
|
||||||
|
@ -1586,7 +1586,7 @@ bool FOptiAttr::caused_reset_attributes (const char cap[], uChar test)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FOptiAttr::hasCharsetEquivalence()
|
inline bool FOptiAttr::hasCharsetEquivalence() const
|
||||||
{
|
{
|
||||||
// Detect if alt charset and pc charset are the same sequences
|
// Detect if alt charset and pc charset are the same sequences
|
||||||
|
|
||||||
|
|
|
@ -893,7 +893,7 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FOptiMove::isWideMove ( int xold, int yold
|
inline bool FOptiMove::isWideMove ( int xold, int yold
|
||||||
, int xnew, int ynew )
|
, int xnew, int ynew ) const
|
||||||
{
|
{
|
||||||
return bool ( xnew > MOVE_LIMIT
|
return bool ( xnew > MOVE_LIMIT
|
||||||
&& xnew < int(screen_width) - 1 - MOVE_LIMIT
|
&& xnew < int(screen_width) - 1 - MOVE_LIMIT
|
||||||
|
|
|
@ -96,12 +96,12 @@ bool FProgressbar::setShadow (bool enable)
|
||||||
&& getEncoding() != fc::ASCII )
|
&& getEncoding() != fc::ASCII )
|
||||||
{
|
{
|
||||||
setFlags().shadow = true;
|
setFlags().shadow = true;
|
||||||
setShadowSize(FSize(1, 1));
|
setShadowSize(FSize{1, 1});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setFlags().shadow = false;
|
setFlags().shadow = false;
|
||||||
setShadowSize(FSize(0, 0));
|
setShadowSize(FSize{0, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
return enable;
|
return enable;
|
||||||
|
@ -113,8 +113,8 @@ void FProgressbar::hide()
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
const FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
|
const FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
|
||||||
hideArea (getSize() + shadow);
|
hideArea (getSize() + shadow);
|
||||||
print() << FPoint(int(getWidth()) - 4, 0)
|
print() << FPoint{int(getWidth()) - 4, 0}
|
||||||
<< (" "); // hide percentage
|
<< " "; // hide percentage
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -162,7 +162,7 @@ void FProgressbar::drawProgressLabel()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
print() << FPoint(int(getWidth()) - 3, 0);
|
print() << FPoint{int(getWidth()) - 3, 0};
|
||||||
|
|
||||||
if ( percentage > 100 )
|
if ( percentage > 100 )
|
||||||
print ("--- %");
|
print ("--- %");
|
||||||
|
@ -177,7 +177,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 )
|
||||||
len = drawProgressIndicator();
|
len = drawProgressIndicator();
|
||||||
|
@ -202,8 +202,8 @@ std::size_t FProgressbar::drawProgressIndicator()
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
const double length = double(bar_length * percentage) / 100;
|
const double length = double(bar_length * percentage) / 100;
|
||||||
auto len = std::size_t(trunc(length));
|
auto len = std::size_t(trunc(length));
|
||||||
print() << FColorPair (wc.progressbar_fg, wc.progressbar_fg)
|
print() << FColorPair {wc.progressbar_fg, wc.progressbar_fg}
|
||||||
<< FString (len, fc::FullBlock); // █
|
<< FString {len, fc::FullBlock}; // █
|
||||||
|
|
||||||
if ( len >= bar_length )
|
if ( len >= bar_length )
|
||||||
return len;
|
return len;
|
||||||
|
@ -220,7 +220,7 @@ std::size_t FProgressbar::drawProgressIndicator()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print() << FColorPair(wc.progressbar_fg, wc.progressbar_bg)
|
print() << FColorPair{wc.progressbar_fg, wc.progressbar_bg}
|
||||||
<< fc::LeftHalfBlock; // ▌
|
<< fc::LeftHalfBlock; // ▌
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,9 +238,9 @@ void FProgressbar::drawProgressBackground (std::size_t len)
|
||||||
setColor (wc.progressbar_fg, wc.progressbar_bg);
|
setColor (wc.progressbar_fg, wc.progressbar_bg);
|
||||||
|
|
||||||
if ( getMaxColor() < 16 )
|
if ( getMaxColor() < 16 )
|
||||||
print() << FString (bg_len, fc::MediumShade); // ▒
|
print() << FString {bg_len, fc::MediumShade}; // ▒
|
||||||
else
|
else
|
||||||
print() << FString (bg_len, L' ');
|
print() << FString {bg_len, L' '};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
e Copyright 2014-2019 Markus Gans *
|
* Copyright 2014-2020 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 *
|
||||||
|
@ -73,7 +73,7 @@ void FRadioButton::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FRadioButton::drawRadioButton()
|
void FRadioButton::drawRadioButton()
|
||||||
{
|
{
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint{1, 1};
|
||||||
setColor();
|
setColor();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
|
|
@ -83,37 +83,39 @@ bool FRect::isEmpty() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FPoint FRect::getPos() const
|
const FPoint FRect::getPos() const
|
||||||
{
|
{
|
||||||
return FPoint(X1, Y1);
|
return { X1, Y1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FPoint FRect::getUpperLeftPos() const
|
const FPoint FRect::getUpperLeftPos() const
|
||||||
{
|
{
|
||||||
return FPoint(X1, Y1);
|
return { X1, Y1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FPoint FRect::getUpperRightPos() const
|
const FPoint FRect::getUpperRightPos() const
|
||||||
{
|
{
|
||||||
return FPoint(X2, Y1);
|
return { X2, Y1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FPoint FRect::getLowerLeftPos() const
|
const FPoint FRect::getLowerLeftPos() const
|
||||||
{ return FPoint(X1, Y2); }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
FPoint FRect::getLowerRightPos() const
|
|
||||||
{
|
{
|
||||||
return FPoint(X2, Y2);
|
return { X1, Y2 };
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FSize FRect::getSize() const
|
const FPoint FRect::getLowerRightPos() const
|
||||||
{
|
{
|
||||||
return FSize(getWidth(), getHeight());
|
return { X2, Y2 };
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
const FSize FRect::getSize() const
|
||||||
|
{
|
||||||
|
return { getWidth(), getHeight() };
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -310,44 +312,46 @@ 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{};
|
int _X1 = std::max(X1, r.X1);
|
||||||
new_rect.X1 = std::max(X1, r.X1);
|
int _Y1 = std::max(Y1, r.Y1);
|
||||||
new_rect.Y1 = std::max(Y1, r.Y1);
|
int _X2 = std::min(X2, r.X2);
|
||||||
new_rect.X2 = std::min(X2, r.X2);
|
int _Y2 = std::min(Y2, r.Y2);
|
||||||
new_rect.Y2 = std::min(Y2, r.Y2);
|
const FPoint p1{ _X1, _Y1 };
|
||||||
return new_rect;
|
const FPoint p2{ _X2, _Y2 };
|
||||||
|
return { p1, p2 };
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FRect FRect::combined (const FRect& r) const
|
FRect FRect::combined (const FRect& r) const
|
||||||
{
|
{
|
||||||
// Union: this ∪ r
|
// Union: this ∪ r
|
||||||
FRect new_rect{};
|
int _X1 = std::min(X1, r.X1);
|
||||||
new_rect.X1 = std::min(X1, r.X1);
|
int _Y1 = std::min(Y1, r.Y1);
|
||||||
new_rect.Y1 = std::min(Y1, r.Y1);
|
int _X2 = std::max(X2, r.X2);
|
||||||
new_rect.X2 = std::max(X2, r.X2);
|
int _Y2 = std::max(Y2, r.Y2);
|
||||||
new_rect.Y2 = std::max(Y2, r.Y2);
|
const FPoint p1{ _X1, _Y1 };
|
||||||
return new_rect;
|
const FPoint p2{ _X2, _Y2 };
|
||||||
|
return { p1, p2 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// FRect non-member operators
|
// FRect non-member operators
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FRect operator + (const FRect& r, const FSize& s)
|
const FRect operator + (const FRect& r, const FSize& s)
|
||||||
{
|
{
|
||||||
return FRect ( r.X1
|
return { r.X1
|
||||||
, r.Y1
|
, r.Y1
|
||||||
, std::size_t(r.X2 - r.X1) + 1 + s.getWidth()
|
, std::size_t(r.X2 - r.X1) + 1 + s.getWidth()
|
||||||
, std::size_t(r.Y2 - r.Y1) + 1 + s.getHeight() );
|
, std::size_t(r.Y2 - r.Y1) + 1 + s.getHeight() };
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FRect operator - (const FRect& r, const FSize& s)
|
const FRect operator - (const FRect& r, const FSize& s)
|
||||||
{
|
{
|
||||||
return FRect ( r.X1
|
return { r.X1
|
||||||
, r.Y1
|
, r.Y1
|
||||||
, std::size_t(r.X2 - r.X1) + 1 - s.getWidth()
|
, std::size_t(r.X2 - r.X1) + 1 - s.getWidth()
|
||||||
, std::size_t(r.Y2 - r.Y1) + 1 - s.getHeight() );
|
, std::size_t(r.Y2 - r.Y1) + 1 - s.getHeight() };
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -40,7 +40,7 @@ FScrollbar::FScrollbar(FWidget* parent)
|
||||||
: FWidget(parent)
|
: FWidget(parent)
|
||||||
{
|
{
|
||||||
// The default scrollbar orientation is vertical
|
// The default scrollbar orientation is vertical
|
||||||
setGeometry(FPoint(1, 1), FSize(1, length), false);
|
setGeometry(FPoint{1, 1}, FSize{1, length}, false);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ void FScrollbar::init()
|
||||||
{
|
{
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
ignorePadding();
|
ignorePadding();
|
||||||
setGeometry(FPoint(1, 1), FSize(getWidth(), getHeight()));
|
setGeometry(FPoint{1, 1}, FSize{getWidth(), getHeight()});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -464,7 +464,7 @@ void FScrollbar::drawVerticalBar()
|
||||||
|
|
||||||
for (int 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ void FScrollbar::drawVerticalBar()
|
||||||
|
|
||||||
for (int 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};
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
print (' ');
|
print (' ');
|
||||||
|
@ -490,7 +490,7 @@ void FScrollbar::drawVerticalBar()
|
||||||
|
|
||||||
for (int 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,9 +524,9 @@ void FScrollbar::drawHorizontalBar()
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
print() << FPoint(3, 1);
|
print() << FPoint{3, 1};
|
||||||
else
|
else
|
||||||
print() << FPoint(2, 1);
|
print() << FPoint{2, 1};
|
||||||
|
|
||||||
for (int z{0}; z < slider_pos; z++)
|
for (int z{0}; z < slider_pos; z++)
|
||||||
drawHorizontalBackgroundColumn();
|
drawHorizontalBackgroundColumn();
|
||||||
|
@ -571,24 +571,24 @@ void FScrollbar::drawButtons()
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint{1, 1};
|
||||||
|
|
||||||
if ( bar_orientation == fc::vertical )
|
if ( bar_orientation == fc::vertical )
|
||||||
{
|
{
|
||||||
print() << NF_button_arrow_up
|
print() << NF_button_arrow_up
|
||||||
<< FPoint(1, int(length))
|
<< FPoint{1, int(length)}
|
||||||
<< NF_button_arrow_down;
|
<< NF_button_arrow_down;
|
||||||
}
|
}
|
||||||
else // horizontal
|
else // horizontal
|
||||||
{
|
{
|
||||||
print() << NF_button_arrow_left
|
print() << NF_button_arrow_left
|
||||||
<< FPoint(int(length) - 1, 1)
|
<< FPoint{int(length) - 1, 1}
|
||||||
<< NF_button_arrow_right;
|
<< NF_button_arrow_right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint{1, 1};
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -596,13 +596,13 @@ void FScrollbar::drawButtons()
|
||||||
if ( bar_orientation == fc::vertical )
|
if ( bar_orientation == fc::vertical )
|
||||||
{
|
{
|
||||||
print() << fc::BlackUpPointingTriangle // ▲
|
print() << fc::BlackUpPointingTriangle // ▲
|
||||||
<< FPoint(1, int(length))
|
<< FPoint{1, int(length)}
|
||||||
<< fc::BlackDownPointingTriangle; // ▼
|
<< fc::BlackDownPointingTriangle; // ▼
|
||||||
}
|
}
|
||||||
else // horizontal
|
else // horizontal
|
||||||
{
|
{
|
||||||
print() << fc::BlackLeftPointingPointer // ◄
|
print() << fc::BlackLeftPointingPointer // ◄
|
||||||
<< FPoint(int(length), 1)
|
<< FPoint{int(length), 1}
|
||||||
<< fc::BlackRightPointingPointer; // ►
|
<< fc::BlackRightPointingPointer; // ►
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -276,15 +276,15 @@ void FScrollView::setGeometry ( const FPoint& pos, const FSize& size
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FScrollView::setCursorPos (const FPoint& p)
|
bool FScrollView::setCursorPos (const FPoint& p)
|
||||||
{
|
{
|
||||||
return FWidget::setCursorPos (FPoint ( p.getX() + getLeftPadding()
|
return FWidget::setCursorPos ({ p.getX() + getLeftPadding()
|
||||||
, p.getY() + getTopPadding() ));
|
, p.getY() + getTopPadding() });
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollView::setPrintPos (const FPoint& p)
|
void FScrollView::setPrintPos (const FPoint& p)
|
||||||
{
|
{
|
||||||
FWidget::setPrintPos (FPoint( p.getX() + getLeftPadding()
|
FWidget::setPrintPos (FPoint { p.getX() + getLeftPadding()
|
||||||
, p.getY() + getTopPadding() ));
|
, p.getY() + getTopPadding() });
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -296,7 +296,7 @@ bool FScrollView::setViewportPrint (bool enable)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FScrollView::setBorder (bool enable)
|
bool FScrollView::setBorder (bool enable)
|
||||||
{
|
{
|
||||||
return (border = enable);
|
return (setFlags().no_border = ! enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -424,7 +424,7 @@ void FScrollView::draw()
|
||||||
else
|
else
|
||||||
setColor();
|
setColor();
|
||||||
|
|
||||||
if ( border )
|
if ( hasBorder() )
|
||||||
drawBorder();
|
drawBorder();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -446,7 +446,7 @@ void FScrollView::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollView::drawBorder()
|
void FScrollView::drawBorder()
|
||||||
{
|
{
|
||||||
const FRect box(FPoint(1, 1), getSize());
|
const FRect box(FPoint{1, 1}, getSize());
|
||||||
finalcut::drawListBorder (this, box);
|
finalcut::drawListBorder (this, box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ void FScrollView::copy2area()
|
||||||
|
|
||||||
// private methods of FScrollView
|
// private methods of FScrollView
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FPoint FScrollView::getViewportCursorPos()
|
inline const FPoint FScrollView::getViewportCursorPos()
|
||||||
{
|
{
|
||||||
const auto& window = FWindow::getWindowWidget(this);
|
const auto& window = FWindow::getWindowWidget(this);
|
||||||
|
|
||||||
|
@ -697,10 +697,10 @@ inline FPoint FScrollView::getViewportCursorPos()
|
||||||
- viewport_geometry.getX();
|
- viewport_geometry.getX();
|
||||||
const int y = widget_offsetY + viewport->input_cursor_y
|
const int y = widget_offsetY + viewport->input_cursor_y
|
||||||
- viewport_geometry.getY();
|
- viewport_geometry.getY();
|
||||||
return FPoint (x, y);
|
return { x, y };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FPoint (-1, -1);
|
return { -1, -1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -715,8 +715,8 @@ void FScrollView::init (const FWidget* parent)
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc.dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc.dialog_bg);
|
||||||
setGeometry (FPoint(1, 1), FSize(4, 4));
|
setGeometry (FPoint{1, 1}, FSize{4, 4});
|
||||||
setMinimumSize (FSize(4, 4));
|
setMinimumSize (FSize{4, 4});
|
||||||
const int xoffset_end = int(getScrollWidth() - getViewportWidth());
|
const int xoffset_end = int(getScrollWidth() - getViewportWidth());
|
||||||
const int yoffset_end = int(getScrollHeight() - getViewportHeight());
|
const int yoffset_end = int(getScrollHeight() - getViewportHeight());
|
||||||
nf_offset = isNewFont() ? 1 : 0;
|
nf_offset = isNewFont() ? 1 : 0;
|
||||||
|
@ -724,7 +724,7 @@ void FScrollView::init (const FWidget* parent)
|
||||||
setLeftPadding (1 - getScrollX());
|
setLeftPadding (1 - getScrollX());
|
||||||
setBottomPadding (1 - (yoffset_end - getScrollY()));
|
setBottomPadding (1 - (yoffset_end - getScrollY()));
|
||||||
setRightPadding (1 - (xoffset_end - getScrollX()) + nf_offset);
|
setRightPadding (1 - (xoffset_end - getScrollX()) + nf_offset);
|
||||||
const FSize no_shadow(0, 0);
|
const FSize no_shadow{0, 0};
|
||||||
std::size_t w = getViewportWidth();
|
std::size_t w = getViewportWidth();
|
||||||
std::size_t h = getViewportHeight();
|
std::size_t h = getViewportHeight();
|
||||||
|
|
||||||
|
@ -771,13 +771,13 @@ void FScrollView::calculateScrollbarPos()
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
vbar->setGeometry (FPoint(int(width), 2), FSize(2, height - 2));
|
vbar->setGeometry (FPoint{int(width), 2}, FSize{2, height - 2});
|
||||||
hbar->setGeometry (FPoint(1, int(height)), FSize(width - 2, 1));
|
hbar->setGeometry (FPoint{1, int(height)}, FSize{width - 2, 1});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vbar->setGeometry (FPoint(int(width), 2), FSize(1, height - 2));
|
vbar->setGeometry (FPoint{int(width), 2}, FSize{1, height - 2});
|
||||||
hbar->setGeometry (FPoint(2, int(height)), FSize(width - 2, 1));
|
hbar->setGeometry (FPoint{2, int(height)}, FSize{width - 2, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
vbar->resize();
|
vbar->resize();
|
||||||
|
@ -842,9 +842,9 @@ void FScrollView::setViewportCursor()
|
||||||
if ( ! isChild(getFocusWidget()) )
|
if ( ! isChild(getFocusWidget()) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const FPoint cursor_pos ( viewport->input_cursor_x - 1
|
const FPoint cursor_pos { viewport->input_cursor_x - 1
|
||||||
, viewport->input_cursor_y - 1 );
|
, viewport->input_cursor_y - 1 };
|
||||||
const FPoint window_cursor_pos(getViewportCursorPos());
|
const FPoint window_cursor_pos{ getViewportCursorPos() };
|
||||||
auto printarea = getCurrentPrintArea();
|
auto printarea = getCurrentPrintArea();
|
||||||
printarea->input_cursor_x = window_cursor_pos.getX();
|
printarea->input_cursor_x = window_cursor_pos.getX();
|
||||||
printarea->input_cursor_y = window_cursor_pos.getY();
|
printarea->input_cursor_y = window_cursor_pos.getY();
|
||||||
|
|
|
@ -57,7 +57,7 @@ FSpinBox::~FSpinBox() // destructor
|
||||||
void FSpinBox::setSize (const FSize& size, bool adjust)
|
void FSpinBox::setSize (const FSize& size, bool adjust)
|
||||||
{
|
{
|
||||||
FWidget::setSize (size, adjust);
|
FWidget::setSize (size, adjust);
|
||||||
FSize input_field_size(size);
|
FSize input_field_size{size};
|
||||||
input_field_size.scaleBy(-2, 0);
|
input_field_size.scaleBy(-2, 0);
|
||||||
input_field.setSize (input_field_size, adjust);
|
input_field.setSize (input_field_size, adjust);
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,9 @@ void FSpinBox::setGeometry ( const FPoint& pos, const FSize& size
|
||||||
, bool adjust )
|
, bool adjust )
|
||||||
{
|
{
|
||||||
FWidget::setGeometry (pos, size, adjust);
|
FWidget::setGeometry (pos, size, adjust);
|
||||||
FSize input_field_size(size);
|
FSize input_field_size{size};
|
||||||
input_field_size.scaleBy(-2, 0);
|
input_field_size.scaleBy(-2, 0);
|
||||||
input_field.setGeometry (FPoint(1, 1), input_field_size, adjust);
|
input_field.setGeometry (FPoint{1, 1}, input_field_size, adjust);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -96,12 +96,12 @@ bool FSpinBox::setShadow (bool enable)
|
||||||
&& getEncoding() != fc::ASCII )
|
&& getEncoding() != fc::ASCII )
|
||||||
{
|
{
|
||||||
setFlags().shadow = true;
|
setFlags().shadow = true;
|
||||||
setShadowSize(FSize(1, 1));
|
setShadowSize(FSize{1, 1});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setFlags().shadow = false;
|
setFlags().shadow = false;
|
||||||
setShadowSize(FSize(0, 0));
|
setShadowSize(FSize{0, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
return getFlags().shadow;
|
return getFlags().shadow;
|
||||||
|
@ -163,7 +163,7 @@ void FSpinBox::hide()
|
||||||
{
|
{
|
||||||
input_field.hide();
|
input_field.hide();
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
const FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
|
const FSize shadow = hasShadow() ? FSize{1, 1} : FSize{0, 0};
|
||||||
hideArea (getSize() + shadow);
|
hideArea (getSize() + shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,24 +331,24 @@ void FSpinBox::draw()
|
||||||
const FColorPair inc_button_color = [this, &wc] ()
|
const FColorPair inc_button_color = [this, &wc] ()
|
||||||
{
|
{
|
||||||
if ( value == max )
|
if ( value == max )
|
||||||
return FColorPair ( wc.scrollbar_button_inactive_fg
|
return FColorPair { wc.scrollbar_button_inactive_fg
|
||||||
, wc.scrollbar_button_inactive_bg );
|
, wc.scrollbar_button_inactive_bg };
|
||||||
else
|
else
|
||||||
return FColorPair ( wc.scrollbar_button_fg
|
return FColorPair { wc.scrollbar_button_fg
|
||||||
, wc.scrollbar_button_bg );
|
, wc.scrollbar_button_bg };
|
||||||
}();
|
}();
|
||||||
|
|
||||||
const FColorPair dec_button_color = [this, &wc] ()
|
const FColorPair dec_button_color = [this, &wc] ()
|
||||||
{
|
{
|
||||||
if ( value == min )
|
if ( value == min )
|
||||||
return FColorPair ( wc.scrollbar_button_inactive_fg
|
return FColorPair { wc.scrollbar_button_inactive_fg
|
||||||
, wc.scrollbar_button_inactive_bg );
|
, wc.scrollbar_button_inactive_bg };
|
||||||
else
|
else
|
||||||
return FColorPair ( wc.scrollbar_button_fg
|
return FColorPair { wc.scrollbar_button_fg
|
||||||
, wc.scrollbar_button_bg );
|
, wc.scrollbar_button_bg };
|
||||||
}();
|
}();
|
||||||
|
|
||||||
print() << FPoint(int(getWidth()) - 1, 1)
|
print() << FPoint{int(getWidth()) - 1, 1}
|
||||||
<< dec_button_color
|
<< dec_button_color
|
||||||
<< fc::BlackDownPointingTriangle // ▼
|
<< fc::BlackDownPointingTriangle // ▼
|
||||||
<< inc_button_color
|
<< inc_button_color
|
||||||
|
|
|
@ -101,7 +101,7 @@ bool FStatusKey::setMouseFocus(bool enable)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusKey::init (FWidget* parent)
|
void FStatusKey::init (FWidget* parent)
|
||||||
{
|
{
|
||||||
setGeometry (FPoint(1, 1), FSize(1, 1));
|
setGeometry (FPoint{1, 1}, FSize{1, 1});
|
||||||
|
|
||||||
if ( parent && parent->isInstanceOf("FStatusBar") )
|
if ( parent && parent->isInstanceOf("FStatusBar") )
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,7 @@ void FStatusBar::setMessage (const FString& mgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FStatusBar::hasActivatedKey()
|
bool FStatusBar::hasActivatedKey() const
|
||||||
{
|
{
|
||||||
if ( ! key_list.empty() )
|
if ( ! key_list.empty() )
|
||||||
{
|
{
|
||||||
|
@ -178,7 +178,7 @@ void FStatusBar::hide()
|
||||||
const FColor fg = wc.term_fg;
|
const FColor fg = wc.term_fg;
|
||||||
const FColor bg = wc.term_bg;
|
const FColor bg = wc.term_bg;
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
print() << FPoint(1, 1) << FString(getDesktopWidth(), L' ');
|
print() << FPoint{1, 1} << FString{getDesktopWidth(), L' '};
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
FWindow::hide();
|
FWindow::hide();
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ void FStatusBar::drawMessage()
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
||||||
setPrintPos (FPoint(x, 1));
|
setPrintPos ({x, 1});
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -309,8 +309,8 @@ void FStatusBar::clear()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::adjustSize()
|
void FStatusBar::adjustSize()
|
||||||
{
|
{
|
||||||
setGeometry ( FPoint(1, int(getDesktopHeight()))
|
setGeometry ( FPoint{1, int(getDesktopHeight())}
|
||||||
, FSize(getDesktopWidth(), 1), false );
|
, FSize{getDesktopWidth(), 1}, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -504,7 +504,7 @@ void FStatusBar::init()
|
||||||
const std::size_t w = r->getWidth();
|
const std::size_t w = r->getWidth();
|
||||||
const int h = int(r->getHeight());
|
const int h = int(r->getHeight());
|
||||||
// initialize geometry values
|
// initialize geometry values
|
||||||
setGeometry (FPoint(1, h), FSize(w, 1), false);
|
setGeometry (FPoint{1, h}, FSize{w, 1}, false);
|
||||||
setAlwaysOnTop();
|
setAlwaysOnTop();
|
||||||
setStatusBar(this);
|
setStatusBar(this);
|
||||||
ignorePadding();
|
ignorePadding();
|
||||||
|
@ -552,7 +552,7 @@ void FStatusBar::drawKeys()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
print() << FPoint(1, 1);
|
print() << FPoint{1, 1};
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
104
src/fstring.cpp
104
src/fstring.cpp
|
@ -77,6 +77,12 @@ FString::FString (FString&& s) noexcept // move constructor
|
||||||
{
|
{
|
||||||
if ( ! s.isNull() )
|
if ( ! s.isNull() )
|
||||||
_assign (std::move(s.string));
|
_assign (std::move(s.string));
|
||||||
|
else
|
||||||
|
s.string = nullptr;
|
||||||
|
|
||||||
|
s.length = 0;
|
||||||
|
s.bufsize = 0;
|
||||||
|
s.c_string = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -188,7 +194,7 @@ const FString& FString::operator += (const FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString FString::operator + (const FString& s)
|
const FString FString::operator + (const FString& s)
|
||||||
{
|
{
|
||||||
FString tmp(string);
|
FString tmp{string};
|
||||||
tmp._insert (length, s.length, s.string);
|
tmp._insert (length, s.length, s.string);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +204,7 @@ const FString FString::operator + (const wchar_t c)
|
||||||
{
|
{
|
||||||
wchar_t s[2]{};
|
wchar_t s[2]{};
|
||||||
s[0] = c;
|
s[0] = c;
|
||||||
FString tmp(string);
|
FString tmp{string};
|
||||||
tmp._insert (length, 1, s);
|
tmp._insert (length, 1, s);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +214,7 @@ 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);
|
||||||
FString tmp(string);
|
FString tmp{string};
|
||||||
tmp._insert (length, 1, s);
|
tmp._insert (length, 1, s);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -223,7 +229,7 @@ FString& FString::operator << (const FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator << (fc::SpecialCharacter c)
|
FString& FString::operator << (fc::SpecialCharacter c)
|
||||||
{
|
{
|
||||||
FString s(static_cast<wchar_t>(c));
|
FString s{static_cast<wchar_t>(c)};
|
||||||
_insert (length, s.length, s.string);
|
_insert (length, s.length, s.string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +237,7 @@ FString& FString::operator << (fc::SpecialCharacter c)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator << (const wchar_t c)
|
FString& FString::operator << (const wchar_t c)
|
||||||
{
|
{
|
||||||
FString s(c);
|
FString s{c};
|
||||||
_insert (length, s.length, s.string);
|
_insert (length, s.length, s.string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +245,7 @@ FString& FString::operator << (const wchar_t c)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString& FString::operator << (const char c)
|
FString& FString::operator << (const char c)
|
||||||
{
|
{
|
||||||
FString s(c);
|
FString s{c};
|
||||||
_insert (length, s.length, s.string);
|
_insert (length, s.length, s.string);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -420,9 +426,9 @@ const std::string FString::toString() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::toLower() const
|
const FString FString::toLower() const
|
||||||
{
|
{
|
||||||
FString s(string);
|
FString s{*this};
|
||||||
auto to_lower = [] (wchar_t& c)
|
auto to_lower = [] (wchar_t& c)
|
||||||
{
|
{
|
||||||
c = wchar_t(std::towlower(std::wint_t(c)));
|
c = wchar_t(std::towlower(std::wint_t(c)));
|
||||||
|
@ -432,9 +438,9 @@ FString FString::toLower() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::toUpper() const
|
const FString FString::toUpper() const
|
||||||
{
|
{
|
||||||
FString s(string);
|
FString s{*this};
|
||||||
auto to_upper = [] (wchar_t& c)
|
auto to_upper = [] (wchar_t& c)
|
||||||
{
|
{
|
||||||
c = wchar_t(std::towupper(std::wint_t(c)));
|
c = wchar_t(std::towupper(std::wint_t(c)));
|
||||||
|
@ -500,7 +506,7 @@ long FString::toLong() const
|
||||||
long num{0};
|
long num{0};
|
||||||
long tenth_limit{LONG_MAX / 10};
|
long tenth_limit{LONG_MAX / 10};
|
||||||
long tenth_limit_digit{LONG_MAX % 10};
|
long tenth_limit_digit{LONG_MAX % 10};
|
||||||
const FString s(trim());
|
const FString s{trim()};
|
||||||
const wchar_t* p = s.string;
|
const wchar_t* p = s.string;
|
||||||
|
|
||||||
if ( ! p )
|
if ( ! p )
|
||||||
|
@ -553,7 +559,7 @@ uLong FString::toULong() const
|
||||||
uLong num{0};
|
uLong num{0};
|
||||||
const uLong tenth_limit{ULONG_MAX / 10};
|
const uLong tenth_limit{ULONG_MAX / 10};
|
||||||
const uLong tenth_limit_digit{ULONG_MAX % 10};
|
const uLong tenth_limit_digit{ULONG_MAX % 10};
|
||||||
const FString s(trim());
|
const FString s{trim()};
|
||||||
const wchar_t* p = s.string;
|
const wchar_t* p = s.string;
|
||||||
|
|
||||||
if ( ! p )
|
if ( ! p )
|
||||||
|
@ -633,9 +639,9 @@ double FString::toDouble() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::ltrim() const
|
const FString FString::ltrim() const
|
||||||
{
|
{
|
||||||
const FString s(string);
|
const FString s{*this};
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
if ( ! (string && *string) )
|
if ( ! (string && *string) )
|
||||||
|
@ -646,13 +652,13 @@ FString FString::ltrim() const
|
||||||
while ( std::iswspace(std::wint_t(*p)) )
|
while ( std::iswspace(std::wint_t(*p)) )
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
return FString(p);
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::rtrim() const
|
const FString FString::rtrim() const
|
||||||
{
|
{
|
||||||
FString s(string);
|
FString s{*this};
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
if ( ! (string && *string) )
|
if ( ! (string && *string) )
|
||||||
|
@ -673,20 +679,20 @@ FString FString::rtrim() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::trim() const
|
const FString FString::trim() const
|
||||||
{
|
{
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
if ( ! (string && *string) )
|
if ( ! (string && *string) )
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
const FString s(ltrim());
|
const FString s{ltrim()};
|
||||||
return s.rtrim();
|
return s.rtrim();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::left (std::size_t len) const
|
const FString FString::left (std::size_t len) const
|
||||||
{
|
{
|
||||||
FString s(string);
|
FString s{*this};
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
if ( ! (string && *string) )
|
if ( ! (string && *string) )
|
||||||
|
@ -702,9 +708,9 @@ FString FString::left (std::size_t len) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::right (std::size_t len) const
|
const FString FString::right (std::size_t len) const
|
||||||
{
|
{
|
||||||
const FString s(string);
|
const FString s{*this};
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
if ( ! (string && *string) )
|
if ( ! (string && *string) )
|
||||||
|
@ -715,13 +721,13 @@ FString FString::right (std::size_t len) const
|
||||||
|
|
||||||
const wchar_t* p = s.string;
|
const wchar_t* p = s.string;
|
||||||
p += (length - len);
|
p += (length - len);
|
||||||
return FString(p);
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::mid (std::size_t pos, std::size_t len) const
|
const FString FString::mid (std::size_t pos, std::size_t len) const
|
||||||
{
|
{
|
||||||
const FString s(string);
|
const FString s{*this};
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
if ( ! (string && *string) )
|
if ( ! (string && *string) )
|
||||||
|
@ -734,18 +740,18 @@ FString FString::mid (std::size_t pos, std::size_t len) const
|
||||||
len = length - pos + 1;
|
len = length - pos + 1;
|
||||||
|
|
||||||
if ( pos > length || pos + len - 1 > length || len == 0 )
|
if ( pos > length || pos + len - 1 > length || len == 0 )
|
||||||
return FString(L"");
|
return FString{L""};
|
||||||
|
|
||||||
wchar_t* p = s.string;
|
wchar_t* p = s.string;
|
||||||
wchar_t* first = p + pos - 1;
|
wchar_t* first = p + pos - 1;
|
||||||
*(first + len) = '\0';
|
*(first + len) = '\0';
|
||||||
return FString(first);
|
return first;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FStringList FString::split (const FString& delimiter)
|
FStringList FString::split (const FString& delimiter)
|
||||||
{
|
{
|
||||||
const FString s(string);
|
const FString s{*this};
|
||||||
FStringList string_list{};
|
FStringList string_list{};
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
|
@ -757,7 +763,7 @@ FStringList FString::split (const FString& delimiter)
|
||||||
|
|
||||||
while ( token )
|
while ( token )
|
||||||
{
|
{
|
||||||
string_list.push_back (FString(token));
|
string_list.push_back (FString{token});
|
||||||
token = extractToken (&rest, nullptr, delimiter.wc_str());
|
token = extractToken (&rest, nullptr, delimiter.wc_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1012,9 +1018,9 @@ const FString& FString::insert (const FString& s, std::size_t pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::replace (const FString& from, const FString& to)
|
FString const FString::replace (const FString& from, const FString& to)
|
||||||
{
|
{
|
||||||
FString s(string);
|
FString s{*this};
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
if ( ! (string && *string) )
|
if ( ! (string && *string) )
|
||||||
|
@ -1051,9 +1057,9 @@ FString FString::replace (const FString& from, const FString& to)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::replaceControlCodes() const
|
const FString FString::replaceControlCodes() const
|
||||||
{
|
{
|
||||||
FString s(string);
|
FString s{*this};
|
||||||
|
|
||||||
for (auto&& c : s)
|
for (auto&& c : s)
|
||||||
{
|
{
|
||||||
|
@ -1077,9 +1083,9 @@ FString FString::replaceControlCodes() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::expandTabs (int tabstop) const
|
const FString FString::expandTabs (int tabstop) const
|
||||||
{
|
{
|
||||||
FString instr(string);
|
FString instr{string};
|
||||||
FString outstr{};
|
FString outstr{};
|
||||||
|
|
||||||
if ( tabstop <= 0 )
|
if ( tabstop <= 0 )
|
||||||
|
@ -1105,7 +1111,7 @@ FString FString::expandTabs (int tabstop) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::removeDel() const
|
FString FString::removeDel() const
|
||||||
{
|
{
|
||||||
FString s(string);
|
FString s{*this};
|
||||||
std::size_t i{0};
|
std::size_t i{0};
|
||||||
std::size_t count{0};
|
std::size_t count{0};
|
||||||
|
|
||||||
|
@ -1135,7 +1141,7 @@ FString FString::removeDel() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::removeBackspaces() const
|
FString FString::removeBackspaces() const
|
||||||
{
|
{
|
||||||
FString s(string);
|
FString s{*this};
|
||||||
std::size_t i{0};
|
std::size_t i{0};
|
||||||
|
|
||||||
for (auto&& c : s)
|
for (auto&& c : s)
|
||||||
|
@ -1546,7 +1552,7 @@ inline wchar_t* FString::extractToken ( wchar_t* rest[]
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString operator + (const FString& s1, const FString& s2)
|
const FString operator + (const FString& s1, const FString& s2)
|
||||||
{
|
{
|
||||||
FString tmp(s1);
|
FString tmp{s1};
|
||||||
tmp._insert ( uInt(std::wcslen(s1.wc_str()))
|
tmp._insert ( uInt(std::wcslen(s1.wc_str()))
|
||||||
, uInt(std::wcslen(s2.wc_str()))
|
, uInt(std::wcslen(s2.wc_str()))
|
||||||
, s2.wc_str() );
|
, s2.wc_str() );
|
||||||
|
@ -1556,7 +1562,7 @@ const FString operator + (const FString& s1, const FString& s2)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString operator + (const FString& s, const wchar_t c)
|
const FString operator + (const FString& s, const wchar_t c)
|
||||||
{
|
{
|
||||||
FString tmp(s);
|
FString tmp{s};
|
||||||
tmp._insert ( uInt(std::wcslen(s.wc_str())), 1, &c);
|
tmp._insert ( uInt(std::wcslen(s.wc_str())), 1, &c);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -1564,7 +1570,7 @@ const FString operator + (const FString& s, const wchar_t c)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString operator + (const std::wstring& s1, const FString& s2)
|
const FString operator + (const std::wstring& s1, const FString& s2)
|
||||||
{
|
{
|
||||||
FString tmp(s1);
|
FString tmp{s1};
|
||||||
tmp._insert ( uInt(std::wcslen(s1.c_str()))
|
tmp._insert ( uInt(std::wcslen(s1.c_str()))
|
||||||
, uInt(std::wcslen(s2.wc_str()))
|
, uInt(std::wcslen(s2.wc_str()))
|
||||||
, s2.wc_str() );
|
, s2.wc_str() );
|
||||||
|
@ -1574,7 +1580,7 @@ const FString operator + (const std::wstring& s1, const FString& s2)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString operator + (const wchar_t s1[], const FString& s2)
|
const FString operator + (const wchar_t s1[], const FString& s2)
|
||||||
{
|
{
|
||||||
FString tmp(s1);
|
FString tmp{s1};
|
||||||
tmp._insert ( uInt(std::wcslen(s1))
|
tmp._insert ( uInt(std::wcslen(s1))
|
||||||
, uInt(std::wcslen(s2.wc_str()))
|
, uInt(std::wcslen(s2.wc_str()))
|
||||||
, s2.wc_str() );
|
, s2.wc_str() );
|
||||||
|
@ -1584,7 +1590,7 @@ const FString operator + (const wchar_t s1[], const FString& s2)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString operator + (const std::string& s1, const FString& s2)
|
const FString operator + (const std::string& s1, const FString& s2)
|
||||||
{
|
{
|
||||||
FString tmp(s1);
|
FString tmp{s1};
|
||||||
tmp._insert ( tmp.getLength()
|
tmp._insert ( tmp.getLength()
|
||||||
, uInt(std::wcslen(s2.wc_str()))
|
, uInt(std::wcslen(s2.wc_str()))
|
||||||
, s2.wc_str() );
|
, s2.wc_str() );
|
||||||
|
@ -1594,7 +1600,7 @@ const FString operator + (const std::string& s1, const FString& s2)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString operator + (const char s1[], const FString& s2)
|
const FString operator + (const char s1[], const FString& s2)
|
||||||
{
|
{
|
||||||
FString tmp(s1);
|
FString tmp{s1};
|
||||||
tmp._insert ( tmp.getLength()
|
tmp._insert ( tmp.getLength()
|
||||||
, uInt(std::wcslen(s2.wc_str()))
|
, uInt(std::wcslen(s2.wc_str()))
|
||||||
, s2.wc_str() );
|
, s2.wc_str() );
|
||||||
|
@ -1604,7 +1610,7 @@ const FString operator + (const char s1[], const FString& s2)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString operator + (const wchar_t c, const FString& s)
|
const FString operator + (const wchar_t c, const FString& s)
|
||||||
{
|
{
|
||||||
FString tmp(c);
|
FString tmp{c};
|
||||||
tmp._insert (1, uInt(std::wcslen(s.wc_str())), s.wc_str());
|
tmp._insert (1, uInt(std::wcslen(s.wc_str())), s.wc_str());
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -1612,7 +1618,7 @@ const FString operator + (const wchar_t c, const FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString operator + (const char c, const FString& s)
|
const FString operator + (const char c, const FString& s)
|
||||||
{
|
{
|
||||||
FString tmp(c);
|
FString tmp{c};
|
||||||
tmp._insert (1, uInt(std::wcslen(s.wc_str())), s.wc_str());
|
tmp._insert (1, uInt(std::wcslen(s.wc_str())), s.wc_str());
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -1620,7 +1626,7 @@ const FString operator + (const char c, const FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString operator + (const FString& s, const char c)
|
const FString operator + (const FString& s, const char c)
|
||||||
{
|
{
|
||||||
FString tmp1(s);
|
FString tmp1{s};
|
||||||
wchar_t tmp2[2];
|
wchar_t tmp2[2];
|
||||||
tmp2[0] = wchar_t(c & 0xff);
|
tmp2[0] = wchar_t(c & 0xff);
|
||||||
tmp2[1] = L'\0';
|
tmp2[1] = L'\0';
|
||||||
|
@ -1639,7 +1645,7 @@ std::ostream& operator << (std::ostream& outstr, const FString& s)
|
||||||
}
|
}
|
||||||
else if ( width > 0 )
|
else if ( width > 0 )
|
||||||
{
|
{
|
||||||
const FString fill_str(width, outstr.fill());
|
const FString fill_str{width, outstr.fill()};
|
||||||
outstr << s.wc_to_c_str(fill_str.string);
|
outstr << s.wc_to_c_str(fill_str.string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1673,7 +1679,7 @@ std::wostream& operator << (std::wostream& outstr, const FString& s)
|
||||||
}
|
}
|
||||||
else if ( width > 0 )
|
else if ( width > 0 )
|
||||||
{
|
{
|
||||||
const FString fill_str(width, outstr.fill());
|
const FString fill_str{width, outstr.fill()};
|
||||||
outstr << fill_str.string;
|
outstr << fill_str.string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ void FSwitch::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FSwitch::drawCheckButton()
|
void FSwitch::drawCheckButton()
|
||||||
{
|
{
|
||||||
print() << FPoint(1 + int(switch_offset_pos), 1);
|
print() << FPoint{1 + int(switch_offset_pos), 1};
|
||||||
|
|
||||||
if ( isChecked() )
|
if ( isChecked() )
|
||||||
drawChecked();
|
drawChecked();
|
||||||
|
@ -179,13 +179,13 @@ inline void FSwitch::drawChecked()
|
||||||
if ( isMonochron() || getMaxColor() < 16 )
|
if ( isMonochron() || getMaxColor() < 16 )
|
||||||
setBold(false);
|
setBold(false);
|
||||||
|
|
||||||
print() << FColorPair(wc.button_inactive_fg, wc.button_inactive_bg)
|
print() << FColorPair{wc.button_inactive_fg, wc.button_inactive_bg}
|
||||||
<< off;
|
<< off;
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
setCursorPos (FPoint(3 + int(switch_offset_pos), 1));
|
setCursorPos ({3 + int(switch_offset_pos), 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -233,7 +233,7 @@ inline void FSwitch::drawUnchecked()
|
||||||
if ( isMonochron() || getMaxColor() < 16 )
|
if ( isMonochron() || getMaxColor() < 16 )
|
||||||
setBold(false);
|
setBold(false);
|
||||||
|
|
||||||
setCursorPos (FPoint(7 + int(switch_offset_pos), 1));
|
setCursorPos ({7 + int(switch_offset_pos), 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -2324,7 +2324,7 @@ bool FTerm::init_terminal()
|
||||||
}
|
}
|
||||||
catch (const std::system_error& ex)
|
catch (const std::system_error& ex)
|
||||||
{
|
{
|
||||||
FString msg = "FTerm: " + FString(ex.what());
|
FString msg = "FTerm: " + FString{ex.what()};
|
||||||
data->setExitMessage(msg);
|
data->setExitMessage(msg);
|
||||||
FApplication::exit(EXIT_FAILURE);
|
FApplication::exit(EXIT_FAILURE);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -191,7 +191,7 @@ const wchar_t reverse_newfont_list[] =
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uInt env2uint (const char* env)
|
uInt env2uint (const char* env)
|
||||||
{
|
{
|
||||||
const FString str(getenv(env));
|
const FString str{getenv(env)};
|
||||||
|
|
||||||
if ( str.isEmpty() )
|
if ( str.isEmpty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -300,11 +300,11 @@ uChar unicode_to_cp437 (wchar_t ucs)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString getFullWidth (const FString& str)
|
const FString getFullWidth (const FString& str)
|
||||||
{
|
{
|
||||||
// Converts half-width to full-width characters
|
// Converts half-width to full-width characters
|
||||||
|
|
||||||
FString s(str);
|
FString s{str};
|
||||||
constexpr std::size_t HALF = 0;
|
constexpr std::size_t HALF = 0;
|
||||||
constexpr std::size_t FULL = 1;
|
constexpr std::size_t FULL = 1;
|
||||||
|
|
||||||
|
@ -328,11 +328,11 @@ FString getFullWidth (const FString& str)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString getHalfWidth (const FString& str)
|
const FString getHalfWidth (const FString& str)
|
||||||
{
|
{
|
||||||
// Converts full-width to half-width characters
|
// Converts full-width to half-width characters
|
||||||
|
|
||||||
FString s(str);
|
FString s{str};
|
||||||
constexpr std::size_t HALF = 0;
|
constexpr std::size_t HALF = 0;
|
||||||
constexpr std::size_t FULL = 1;
|
constexpr std::size_t FULL = 1;
|
||||||
|
|
||||||
|
@ -356,17 +356,18 @@ FString getHalfWidth (const FString& str)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString getColumnSubString ( const FString& str
|
const FString getColumnSubString ( const FString& str
|
||||||
, std::size_t col_pos, std::size_t col_len )
|
, std::size_t col_pos
|
||||||
|
, std::size_t col_len )
|
||||||
{
|
{
|
||||||
FString s(str);
|
FString s{str};
|
||||||
std::size_t col_first{1};
|
std::size_t col_first{1};
|
||||||
std::size_t col_num{0};
|
std::size_t col_num{0};
|
||||||
std::size_t first{1};
|
std::size_t first{1};
|
||||||
std::size_t num{0};
|
std::size_t num{0};
|
||||||
|
|
||||||
if ( col_len == 0 || s.isEmpty() )
|
if ( col_len == 0 || s.isEmpty() )
|
||||||
return FString(L"");
|
return FString{L""};
|
||||||
|
|
||||||
if ( col_pos == 0 )
|
if ( col_pos == 0 )
|
||||||
col_pos = 1;
|
col_pos = 1;
|
||||||
|
@ -406,7 +407,7 @@ FString getColumnSubString ( const FString& str
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( col_first < col_pos ) // String length < col_pos
|
if ( col_first < col_pos ) // String length < col_pos
|
||||||
return FString(L"");
|
return FString{L""};
|
||||||
|
|
||||||
return s.mid(first, num);
|
return s.mid(first, num);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ const FString FTermBuffer::toString() const
|
||||||
return fchar.ch;
|
return fchar.ch;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return FString(wide_string);
|
return wide_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -230,7 +230,7 @@ void FTermcap::termcapKeys (char*& buffer)
|
||||||
{
|
{
|
||||||
// Get termcap keys
|
// Get termcap keys
|
||||||
|
|
||||||
// Read termcap key sequences
|
// Read termcap key sequences up to the self-defined values
|
||||||
for ( std::size_t i{0};
|
for ( std::size_t i{0};
|
||||||
fc::fkey[i].string == nullptr && fc::fkey[i].tname[0] != 0;
|
fc::fkey[i].string == nullptr && fc::fkey[i].tname[0] != 0;
|
||||||
i++ )
|
i++ )
|
||||||
|
|
|
@ -667,7 +667,7 @@ const char* FTermDetection::parseSecDA (const 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
|
||||||
|
|
|
@ -716,7 +716,7 @@ const FString FTermXTerminal::captureXTermFont()
|
||||||
if ( n >= 5 && temp[n - 1] == BEL[0] && temp[n] == '\0' )
|
if ( n >= 5 && temp[n - 1] == BEL[0] && temp[n] == '\0' )
|
||||||
temp[n - 1] = '\0';
|
temp[n - 1] = '\0';
|
||||||
|
|
||||||
return FString(temp);
|
return FString{temp};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,14 +57,14 @@ FTextView::~FTextView() // destructor
|
||||||
const FString FTextView::getText() const
|
const FString FTextView::getText() const
|
||||||
{
|
{
|
||||||
if ( data.empty() )
|
if ( data.empty() )
|
||||||
return FString("");
|
return FString{""};
|
||||||
|
|
||||||
std::size_t len{0};
|
std::size_t len{0};
|
||||||
|
|
||||||
for (auto&& line : data)
|
for (auto&& line : data)
|
||||||
len += line.getLength() + 1; // String length + '\n'
|
len += line.getLength() + 1; // String length + '\n'
|
||||||
|
|
||||||
FString s(len); // Reserves storage
|
FString s{len}; // Reserves storage
|
||||||
auto iter = s.begin();
|
auto iter = s.begin();
|
||||||
|
|
||||||
for (auto&& line : data)
|
for (auto&& line : data)
|
||||||
|
@ -202,7 +202,7 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
if ( str.isEmpty() )
|
if ( str.isEmpty() )
|
||||||
s = "\n";
|
s = "\n";
|
||||||
else
|
else
|
||||||
s = FString(str).rtrim().expandTabs(getTabstop());
|
s = FString{str}.rtrim().expandTabs(getTabstop());
|
||||||
|
|
||||||
|
|
||||||
auto text_split = s.split("\r\n");
|
auto text_split = s.split("\r\n");
|
||||||
|
@ -303,8 +303,8 @@ void FTextView::clear()
|
||||||
|
|
||||||
for (int y{0}; y < int(getTextHeight()); y++)
|
for (int y{0}; y < int(getTextHeight()); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(2, 2 - nf_offset + y)
|
print() << FPoint{2, 2 - nf_offset + y}
|
||||||
<< FString(size, L' ');
|
<< FString{size, L' '};
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -601,7 +601,7 @@ void FTextView::draw()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setCursorPos (FPoint(int(getWidth()), int(getHeight())));
|
setCursorPos ({int(getWidth()), int(getHeight())});
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
@ -614,7 +614,7 @@ void FTextView::drawBorder()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
const FRect box(FPoint(1, 1), getSize());
|
const FRect box{FPoint{1, 1}, getSize()};
|
||||||
finalcut::drawListBorder (this, box);
|
finalcut::drawListBorder (this, box);
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -660,7 +660,7 @@ void FTextView::drawText()
|
||||||
const FString line(getColumnSubString(data[n], pos, text_width));
|
const FString line(getColumnSubString(data[n], pos, text_width));
|
||||||
const auto column_width = getColumnWidth(line);
|
const auto column_width = getColumnWidth(line);
|
||||||
std::size_t trailing_whitespace{0};
|
std::size_t trailing_whitespace{0};
|
||||||
print() << FPoint(2, 2 - nf_offset + int(y));
|
print() << FPoint{2, 2 - nf_offset + int(y)};
|
||||||
|
|
||||||
for (auto&& ch : line) // Column loop
|
for (auto&& ch : line) // Column loop
|
||||||
{
|
{
|
||||||
|
@ -675,7 +675,7 @@ void FTextView::drawText()
|
||||||
if ( column_width <= text_width )
|
if ( column_width <= text_width )
|
||||||
trailing_whitespace = text_width - column_width;
|
trailing_whitespace = text_width - column_width;
|
||||||
|
|
||||||
print() << FString(trailing_whitespace, L' ');
|
print() << FString{trailing_whitespace, L' '};
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -691,10 +691,10 @@ inline bool FTextView::useFDialogBorder()
|
||||||
if ( parent
|
if ( parent
|
||||||
&& parent->isDialogWidget()
|
&& parent->isDialogWidget()
|
||||||
&& isPaddingIgnored()
|
&& isPaddingIgnored()
|
||||||
&& getGeometry() == FRect ( 1
|
&& getGeometry() == FRect { 1
|
||||||
, 2
|
, 2
|
||||||
, parent->getWidth()
|
, parent->getWidth()
|
||||||
, parent->getHeight() - 1) )
|
, parent->getHeight() - 1} )
|
||||||
{
|
{
|
||||||
use_fdialog_border = true;
|
use_fdialog_border = true;
|
||||||
}
|
}
|
||||||
|
@ -730,13 +730,13 @@ void FTextView::changeOnResize()
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
vbar->setGeometry (FPoint(int(width), 1), FSize(2, height - 1));
|
vbar->setGeometry (FPoint{int(width), 1}, FSize{2, height - 1});
|
||||||
hbar->setGeometry (FPoint(1, int(height)), FSize(width - 2, 1));
|
hbar->setGeometry (FPoint{1, int(height)}, FSize{width - 2, 1});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vbar->setGeometry (FPoint(int(width), 2), FSize(1, height - 2));
|
vbar->setGeometry (FPoint{int(width), 2}, FSize{1, height - 2});
|
||||||
hbar->setGeometry (FPoint(2, int(height)), FSize(width - 2, 1));
|
hbar->setGeometry (FPoint{2, int(height)}, FSize{width - 2, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
vbar->resize();
|
vbar->resize();
|
||||||
|
|
|
@ -85,7 +85,7 @@ void FToggleButton::setSize (const FSize& s, bool adjust)
|
||||||
{
|
{
|
||||||
// Set the toggle button size
|
// Set the toggle button size
|
||||||
|
|
||||||
FSize size(s);
|
FSize size{s};
|
||||||
correctSize(size);
|
correctSize(size);
|
||||||
const FRect geometry(getPos(), size);
|
const FRect geometry(getPos(), size);
|
||||||
|
|
||||||
|
@ -101,7 +101,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};
|
||||||
correctSize(size);
|
correctSize(size);
|
||||||
const FRect geometry(pos, size);
|
const FRect geometry(pos, size);
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ void FToggleButton::draw()
|
||||||
|
|
||||||
// set the cursor to the button
|
// set the cursor to the button
|
||||||
if ( isRadioButton() || isCheckboxButton() )
|
if ( isRadioButton() || isCheckboxButton() )
|
||||||
setCursorPos (FPoint(2, 1));
|
setCursorPos ({2, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -414,7 +414,7 @@ void FToggleButton::drawLabel()
|
||||||
const FString txt(text);
|
const FString txt(text);
|
||||||
FString label_text{};
|
FString label_text{};
|
||||||
auto hotkeypos = finalcut::getHotkeyPos(txt, label_text);
|
auto hotkeypos = finalcut::getHotkeyPos(txt, label_text);
|
||||||
print() << FPoint(1 + int(label_offset_pos), 1);
|
print() << FPoint{1 + int(label_offset_pos), 1};
|
||||||
drawText (std::move(label_text), hotkeypos);
|
drawText (std::move(label_text), hotkeypos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ void FToggleButton::setGroup (FButtonGroup* btngroup)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToggleButton::init()
|
void FToggleButton::init()
|
||||||
{
|
{
|
||||||
setGeometry (FPoint(1, 1), FSize(4, 1), false); // initialize geometry values
|
setGeometry (FPoint{1, 1}, FSize{4, 1}, false); // initialize geometry values
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
|
|
|
@ -105,8 +105,8 @@ void FToolTip::init()
|
||||||
setAlwaysOnTop();
|
setAlwaysOnTop();
|
||||||
ignorePadding();
|
ignorePadding();
|
||||||
// initialize geometry values
|
// initialize geometry values
|
||||||
setGeometry (FPoint(1, 1), FSize(3, 3), false);
|
setGeometry (FPoint{1, 1}, FSize{3, 3}, false);
|
||||||
setMinimumSize (FSize(3, 3));
|
setMinimumSize (FSize{3, 3});
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getFWidgetColors();
|
||||||
setForegroundColor (wc.tooltip_fg);
|
setForegroundColor (wc.tooltip_fg);
|
||||||
setBackgroundColor (wc.tooltip_bg);
|
setBackgroundColor (wc.tooltip_bg);
|
||||||
|
@ -127,7 +127,7 @@ void FToolTip::draw()
|
||||||
|
|
||||||
for (auto&& line : text_components)
|
for (auto&& line : text_components)
|
||||||
{
|
{
|
||||||
print() << FPoint(x, y) << line;
|
print() << FPoint{x, y} << line;
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ void FToolTip::calculateDimensions()
|
||||||
else
|
else
|
||||||
x = y = 1;
|
x = y = 1;
|
||||||
|
|
||||||
setGeometry (FPoint(x, y), FSize(w, h));
|
setGeometry (FPoint{x, y}, FSize{w, h});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -103,15 +103,15 @@ FVTerm& FVTerm::operator << (const FTermBuffer& term_buffer)
|
||||||
|
|
||||||
// public methods of FVTerm
|
// public methods of FVTerm
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FPoint FVTerm::getPrintCursor()
|
const FPoint FVTerm::getPrintCursor()
|
||||||
{
|
{
|
||||||
const auto& win = getPrintArea();
|
const auto& win = getPrintArea();
|
||||||
|
|
||||||
if ( win )
|
if ( win )
|
||||||
return FPoint ( win->offset_left + win->cursor_x
|
return { win->offset_left + win->cursor_x
|
||||||
, win->offset_top + win->cursor_y );
|
, win->offset_top + win->cursor_y };
|
||||||
|
|
||||||
return FPoint(0, 0);
|
return {0, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -217,8 +217,8 @@ void FVTerm::createVTerm (const FSize& size)
|
||||||
{
|
{
|
||||||
// initialize virtual terminal
|
// initialize virtual terminal
|
||||||
|
|
||||||
const FRect box(0, 0, size.getWidth(), size.getHeight());
|
const FRect box{0, 0, size.getWidth(), size.getHeight()};
|
||||||
const FSize shadow(0, 0);
|
const FSize shadow{0, 0};
|
||||||
createArea (box, shadow, vterm);
|
createArea (box, shadow, vterm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,8 +227,8 @@ void FVTerm::resizeVTerm (const FSize& size)
|
||||||
{
|
{
|
||||||
// resize virtual terminal
|
// resize virtual terminal
|
||||||
|
|
||||||
const FRect box(0, 0, size.getWidth(), size.getHeight());
|
const FRect box{0, 0, size.getWidth(), size.getHeight()};
|
||||||
const FSize shadow(0, 0);
|
const FSize shadow{0, 0};
|
||||||
resizeArea (box, shadow, vterm);
|
resizeArea (box, shadow, vterm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -766,7 +766,7 @@ void FVTerm::resizeArea ( const FRect& box
|
||||||
area->bottom_shadow = bsh;
|
area->bottom_shadow = bsh;
|
||||||
area->has_changes = false;
|
area->has_changes = false;
|
||||||
|
|
||||||
const FSize size(full_width, full_height);
|
const FSize size{full_width, full_height};
|
||||||
setTextToDefault (area, size);
|
setTextToDefault (area, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -828,7 +828,7 @@ void FVTerm::restoreVTerm (const FRect& box)
|
||||||
{
|
{
|
||||||
const int xpos = x + tx;
|
const int xpos = x + tx;
|
||||||
auto tc = &vterm->data[ypos * vterm->width + xpos]; // terminal character
|
auto tc = &vterm->data[ypos * vterm->width + xpos]; // terminal character
|
||||||
auto sc = generateCharacter(FPoint(xpos, ypos)); // shown character
|
auto sc = generateCharacter(FPoint{xpos, ypos}); // shown character
|
||||||
std::memcpy (tc, &sc, sizeof(*tc));
|
std::memcpy (tc, &sc, sizeof(*tc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,9 +866,9 @@ bool FVTerm::updateVTermCursor (const FTermArea* area)
|
||||||
const int x = ax + cx;
|
const int x = ax + cx;
|
||||||
const int y = ay + cy;
|
const int y = ay + cy;
|
||||||
|
|
||||||
if ( isInsideArea (FPoint(cx, cy), area)
|
if ( isInsideArea (FPoint{cx, cy}, area)
|
||||||
&& isInsideTerminal (FPoint(x, y))
|
&& isInsideTerminal (FPoint{x, y})
|
||||||
&& isCovered (FPoint(x, y), area) == non_covered )
|
&& isCovered (FPoint{x, y}, area) == non_covered )
|
||||||
{
|
{
|
||||||
vterm->input_cursor_x = x;
|
vterm->input_cursor_x = x;
|
||||||
vterm->input_cursor_y = y;
|
vterm->input_cursor_y = y;
|
||||||
|
@ -1038,7 +1038,7 @@ void FVTerm::putArea (const FTermArea* area)
|
||||||
|
|
||||||
tx -= ol;
|
tx -= ol;
|
||||||
|
|
||||||
if ( updateVTermCharacter(area, FPoint(x, y), FPoint(tx, ty)) )
|
if ( updateVTermCharacter(area, FPoint{x, y}, FPoint{tx, ty}) )
|
||||||
modified = true;
|
modified = true;
|
||||||
|
|
||||||
if ( ! modified )
|
if ( ! modified )
|
||||||
|
@ -1121,7 +1121,7 @@ void FVTerm::putArea (const FPoint& pos, const FTermArea* area)
|
||||||
const int cy = ay + y;
|
const int cy = ay + y;
|
||||||
ac = &area->data[y * width + ol + x];
|
ac = &area->data[y * width + ol + x];
|
||||||
tc = &vterm->data[cy * vterm->width + cx];
|
tc = &vterm->data[cy * vterm->width + cx];
|
||||||
putAreaCharacter (FPoint(cx + 1, cy + 1), area->widget, ac, tc);
|
putAreaCharacter (FPoint{cx + 1, cy + 1}, area->widget, ac, tc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,7 +1178,7 @@ void FVTerm::scrollAreaForward (FTermArea* area)
|
||||||
{
|
{
|
||||||
setTermXY (0, vdesktop->height);
|
setTermXY (0, vdesktop->height);
|
||||||
FTerm::scrollTermForward();
|
FTerm::scrollTermForward();
|
||||||
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++)
|
||||||
|
@ -1233,7 +1233,7 @@ void FVTerm::scrollAreaReverse (FTermArea* area)
|
||||||
{
|
{
|
||||||
setTermXY (0, 0);
|
setTermXY (0, 0);
|
||||||
FTerm::scrollTermReverse();
|
FTerm::scrollTermReverse();
|
||||||
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++)
|
||||||
|
@ -1440,9 +1440,9 @@ FVTerm::covered_state FVTerm::isCovered ( const FPoint& pos
|
||||||
|
|
||||||
const int win_x = win->offset_left;
|
const int win_x = win->offset_left;
|
||||||
const int win_y = win->offset_top;
|
const int win_y = win->offset_top;
|
||||||
const FRect geometry ( win_x , win_y
|
const FRect geometry { win_x , win_y
|
||||||
, std::size_t(win->width) + std::size_t(win->right_shadow)
|
, std::size_t(win->width) + std::size_t(win->right_shadow)
|
||||||
, std::size_t(win->height) + std::size_t(win->bottom_shadow) );
|
, std::size_t(win->height) + std::size_t(win->bottom_shadow) };
|
||||||
|
|
||||||
if ( found && geometry.contains(pos) )
|
if ( found && geometry.contains(pos) )
|
||||||
{
|
{
|
||||||
|
@ -1490,7 +1490,7 @@ void FVTerm::updateOverlappedColor ( const FTermArea* area
|
||||||
FChar nc{};
|
FChar 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);
|
||||||
nc.fg_color = oc.fg_color;
|
nc.fg_color = oc.fg_color;
|
||||||
nc.bg_color = oc.bg_color;
|
nc.bg_color = oc.bg_color;
|
||||||
nc.attr.bit.reverse = false;
|
nc.attr.bit.reverse = false;
|
||||||
|
@ -1519,7 +1519,7 @@ void FVTerm::updateOverlappedCharacter ( const FTermArea* area
|
||||||
const int ty = terminal_pos.getY();
|
const int ty = terminal_pos.getY();
|
||||||
auto tc = &vterm->data[ty * vterm->width + tx];
|
auto tc = &vterm->data[ty * vterm->width + tx];
|
||||||
// Overlapped character
|
// Overlapped character
|
||||||
auto oc = getCoveredCharacter (terminal_pos + FPoint(1, 1), area->widget);
|
auto oc = getCoveredCharacter (terminal_pos + FPoint{1, 1}, area->widget);
|
||||||
oc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == oc);
|
oc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == oc);
|
||||||
std::memcpy (tc, &oc, sizeof(*tc));
|
std::memcpy (tc, &oc, sizeof(*tc));
|
||||||
}
|
}
|
||||||
|
@ -1541,7 +1541,7 @@ void FVTerm::updateShadedCharacter ( const FTermArea* area
|
||||||
// Terminal character
|
// Terminal character
|
||||||
const auto tc = &vterm->data[ty * vterm->width + tx];
|
const auto tc = &vterm->data[ty * vterm->width + tx];
|
||||||
// Overlapped character
|
// Overlapped character
|
||||||
auto oc = getCoveredCharacter (terminal_pos + FPoint(1, 1), area->widget);
|
auto oc = getCoveredCharacter (terminal_pos + FPoint{1, 1}, area->widget);
|
||||||
oc.fg_color = ac->fg_color;
|
oc.fg_color = ac->fg_color;
|
||||||
oc.bg_color = ac->bg_color;
|
oc.bg_color = ac->bg_color;
|
||||||
oc.attr.bit.reverse = false;
|
oc.attr.bit.reverse = false;
|
||||||
|
@ -1579,7 +1579,7 @@ void FVTerm::updateInheritBackground ( const FTermArea* area
|
||||||
FChar nc{};
|
FChar 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);
|
||||||
nc.bg_color = cc.bg_color;
|
nc.bg_color = cc.bg_color;
|
||||||
nc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == nc);
|
nc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == nc);
|
||||||
std::memcpy (tc, &nc, sizeof(*tc));
|
std::memcpy (tc, &nc, sizeof(*tc));
|
||||||
|
@ -1706,7 +1706,7 @@ void FVTerm::callPreprocessingHandler (const FTermArea* area)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FVTerm::hasChildAreaChanges (FTermArea* area)
|
bool FVTerm::hasChildAreaChanges (FTermArea* area) const
|
||||||
{
|
{
|
||||||
if ( ! area )
|
if ( ! area )
|
||||||
return false;
|
return false;
|
||||||
|
@ -1743,7 +1743,7 @@ bool FVTerm::isInsideArea (const FPoint& pos, const FTermArea* area)
|
||||||
|
|
||||||
const auto aw = std::size_t(area->width);
|
const auto aw = std::size_t(area->width);
|
||||||
const auto ah = std::size_t(area->height);
|
const auto ah = std::size_t(area->height);
|
||||||
FRect area_geometry(0, 0, aw, ah);
|
FRect area_geometry{0, 0, aw, ah};
|
||||||
|
|
||||||
if ( area_geometry.contains(pos) )
|
if ( area_geometry.contains(pos) )
|
||||||
return true;
|
return true;
|
||||||
|
@ -1752,7 +1752,7 @@ bool FVTerm::isInsideArea (const FPoint& pos, const FTermArea* area)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FChar FVTerm::generateCharacter (const FPoint& pos)
|
const FChar FVTerm::generateCharacter (const FPoint& pos)
|
||||||
{
|
{
|
||||||
// Generates characters for a given position considering all areas
|
// Generates characters for a given position considering all areas
|
||||||
|
|
||||||
|
@ -1772,9 +1772,9 @@ FChar FVTerm::generateCharacter (const FPoint& pos)
|
||||||
|
|
||||||
const int win_x = win->offset_left;
|
const int win_x = win->offset_left;
|
||||||
const int win_y = win->offset_top;
|
const int win_y = win->offset_top;
|
||||||
const FRect geometry ( win_x, win_y
|
const FRect geometry { win_x, win_y
|
||||||
, std::size_t(win->width) + std::size_t(win->right_shadow)
|
, std::size_t(win->width) + std::size_t(win->right_shadow)
|
||||||
, std::size_t(win->height) + std::size_t(win->bottom_shadow) );
|
, std::size_t(win->height) + std::size_t(win->bottom_shadow) };
|
||||||
|
|
||||||
// Window is visible and contains current character
|
// Window is visible and contains current character
|
||||||
if ( geometry.contains(x, y) )
|
if ( geometry.contains(x, y) )
|
||||||
|
@ -1822,7 +1822,7 @@ FChar FVTerm::generateCharacter (const FPoint& pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FChar FVTerm::getCharacter ( character_type char_type
|
const FChar FVTerm::getCharacter ( character_type char_type
|
||||||
, const FPoint& pos
|
, const FPoint& pos
|
||||||
, FVTerm* obj )
|
, FVTerm* obj )
|
||||||
{
|
{
|
||||||
|
@ -1866,13 +1866,13 @@ FChar FVTerm::getCharacter ( character_type char_type
|
||||||
if ( ! win || ! win->visible )
|
if ( ! win || ! win->visible )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const FRect geometry ( win->offset_left, win->offset_top
|
const FRect geometry { win->offset_left, win->offset_top
|
||||||
, std::size_t(win->width) + std::size_t(win->right_shadow)
|
, std::size_t(win->width) + std::size_t(win->right_shadow)
|
||||||
, std::size_t(win->height) + std::size_t(win->bottom_shadow) );
|
, std::size_t(win->height) + std::size_t(win->bottom_shadow) };
|
||||||
|
|
||||||
// Window visible and contains current character
|
// Window visible and contains current character
|
||||||
if ( geometry.contains(x, y) )
|
if ( geometry.contains(x, y) )
|
||||||
getAreaCharacter (FPoint(x, y), win, cc);
|
getAreaCharacter (FPoint{x, y}, win, cc);
|
||||||
}
|
}
|
||||||
else if ( char_type == covered_character )
|
else if ( char_type == covered_character )
|
||||||
break;
|
break;
|
||||||
|
@ -1882,14 +1882,14 @@ FChar FVTerm::getCharacter ( character_type char_type
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FChar FVTerm::getCoveredCharacter (const FPoint& pos, FVTerm* obj)
|
const FChar FVTerm::getCoveredCharacter (const FPoint& pos, FVTerm* obj)
|
||||||
{
|
{
|
||||||
// Gets the covered character for a given position
|
// Gets the covered character for a given position
|
||||||
return getCharacter (covered_character, pos, obj);
|
return getCharacter (covered_character, pos, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FChar FVTerm::getOverlappedCharacter (const FPoint& pos, FVTerm* obj)
|
const FChar FVTerm::getOverlappedCharacter (const FPoint& pos, FVTerm* obj)
|
||||||
{
|
{
|
||||||
// Gets the overlapped character for a given position
|
// Gets the overlapped character for a given position
|
||||||
return getCharacter (overlapped_character, pos, obj);
|
return getCharacter (overlapped_character, pos, obj);
|
||||||
|
@ -1928,11 +1928,11 @@ void FVTerm::init (bool disable_alt_screen)
|
||||||
std::memcpy (&next_attribute, &term_attribute, sizeof(next_attribute));
|
std::memcpy (&next_attribute, &term_attribute, sizeof(next_attribute));
|
||||||
|
|
||||||
// Create virtual terminal
|
// Create virtual terminal
|
||||||
FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
|
FRect term_geometry {0, 0, getColumnNumber(), getLineNumber()};
|
||||||
createVTerm (term_geometry.getSize());
|
createVTerm (term_geometry.getSize());
|
||||||
|
|
||||||
// Create virtual desktop area
|
// Create virtual desktop area
|
||||||
FSize shadow_size(0, 0);
|
FSize shadow_size{0, 0};
|
||||||
createArea (term_geometry, shadow_size, vdesktop);
|
createArea (term_geometry, shadow_size, vdesktop);
|
||||||
vdesktop->visible = true;
|
vdesktop->visible = true;
|
||||||
active_area = vdesktop;
|
active_area = vdesktop;
|
||||||
|
@ -2677,13 +2677,13 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FVTerm::isFullWidthChar (const FChar* const& ch)
|
inline bool FVTerm::isFullWidthChar (const FChar* const& ch) const
|
||||||
{
|
{
|
||||||
return bool(ch->attr.bit.char_width == 2);
|
return bool(ch->attr.bit.char_width == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FVTerm::isFullWidthPaddingChar (const FChar* const& ch)
|
inline bool FVTerm::isFullWidthPaddingChar (const FChar* const& ch) const
|
||||||
{
|
{
|
||||||
return ch->attr.bit.fullwidth_padding;
|
return ch->attr.bit.fullwidth_padding;
|
||||||
}
|
}
|
||||||
|
@ -2844,7 +2844,7 @@ bool FVTerm::updateTerminalCursor()
|
||||||
const int x = vterm->input_cursor_x;
|
const int x = vterm->input_cursor_x;
|
||||||
const int y = vterm->input_cursor_y;
|
const int y = vterm->input_cursor_y;
|
||||||
|
|
||||||
if ( isInsideTerminal(FPoint(x, y)) )
|
if ( isInsideTerminal(FPoint{x, y}) )
|
||||||
{
|
{
|
||||||
setTermXY (x, y);
|
setTermXY (x, y);
|
||||||
showCursor();
|
showCursor();
|
||||||
|
@ -2862,7 +2862,7 @@ bool FVTerm::isInsideTerminal (const FPoint& pos)
|
||||||
{
|
{
|
||||||
// Check whether the coordinates are within the virtual terminal
|
// Check whether the coordinates are within the virtual terminal
|
||||||
|
|
||||||
const FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
|
const FRect term_geometry {0, 0, getColumnNumber(), getLineNumber()};
|
||||||
|
|
||||||
if ( term_geometry.contains(pos) )
|
if ( term_geometry.contains(pos) )
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -242,11 +242,11 @@ std::vector<bool>& FWidget::doubleFlatLine_ref (fc::sides side)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FPoint FWidget::getPrintPos()
|
const FPoint FWidget::getPrintPos()
|
||||||
{
|
{
|
||||||
const auto& cur = getPrintCursor();
|
const auto& cur = getPrintCursor();
|
||||||
return FPoint ( cur.getX() - woffset.getX1() - getX() + 1
|
return { cur.getX() - woffset.getX1() - getX() + 1
|
||||||
, cur.getY() - woffset.getY1() - getY() + 1 );
|
, cur.getY() - woffset.getY1() - getY() + 1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -346,7 +346,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() )
|
||||||
|
@ -539,7 +539,7 @@ void FWidget::setTermSize (const FSize& size)
|
||||||
|
|
||||||
if ( isXTerminal() )
|
if ( isXTerminal() )
|
||||||
{
|
{
|
||||||
root_widget->wsize.setRect(FPoint(1, 1), size);
|
root_widget->wsize.setRect(FPoint{1, 1}, size);
|
||||||
root_widget->adjust_wsize = root_widget->wsize;
|
root_widget->adjust_wsize = root_widget->wsize;
|
||||||
FTerm::setTermSize(size); // width = columns / height = lines
|
FTerm::setTermSize(size); // width = columns / height = lines
|
||||||
detectTermSize();
|
detectTermSize();
|
||||||
|
@ -621,8 +621,8 @@ bool FWidget::setCursorPos (const FPoint& pos)
|
||||||
woffsetY += (1 - area->widget->getTopPadding());
|
woffsetY += (1 - area->widget->getTopPadding());
|
||||||
}
|
}
|
||||||
|
|
||||||
setAreaCursor ( FPoint ( woffsetX + pos.getX()
|
setAreaCursor ( { woffsetX + pos.getX()
|
||||||
, woffsetY + pos.getY() )
|
, woffsetY + pos.getY() }
|
||||||
, flags.visible_cursor
|
, flags.visible_cursor
|
||||||
, area );
|
, area );
|
||||||
return true;
|
return true;
|
||||||
|
@ -967,9 +967,9 @@ void FWidget::resize()
|
||||||
{
|
{
|
||||||
if ( isRootWidget() )
|
if ( isRootWidget() )
|
||||||
{
|
{
|
||||||
const FRect old_term_geometry (getTermGeometry());
|
const 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() )
|
||||||
|
@ -1380,7 +1380,7 @@ void FWidget::hideArea (const FSize& size)
|
||||||
|
|
||||||
for (int y{0}; y < int(size.getHeight()); y++)
|
for (int y{0}; y < int(size.getHeight()); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(1, 1 + y) << FString(size.getWidth(), L' ');
|
print() << FPoint{1, 1 + y} << FString{size.getWidth(), L' '};
|
||||||
}
|
}
|
||||||
|
|
||||||
flush();
|
flush();
|
||||||
|
@ -1887,7 +1887,12 @@ void FWidget::setWindowFocus (bool enable)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FWidget::FCallbackPtr FWidget::getCallbackPtr (const FCallback& cb_function)
|
FWidget::FCallbackPtr FWidget::getCallbackPtr (const FCallback& cb_function)
|
||||||
{
|
{
|
||||||
return *cb_function.template target<FCallbackPtr>();
|
auto ptr = cb_function.template target<FCallbackPtr>();
|
||||||
|
|
||||||
|
if ( ptr )
|
||||||
|
return *ptr;
|
||||||
|
else
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -162,26 +162,26 @@ void drawTransparentShadow (FWidget* w)
|
||||||
const std::size_t width = w->getWidth();
|
const std::size_t width = w->getWidth();
|
||||||
const std::size_t height = w->getHeight();
|
const std::size_t height = w->getHeight();
|
||||||
const auto& wcolors = FWidget::wcolors;
|
const auto& wcolors = FWidget::wcolors;
|
||||||
w->print() << FStyle (fc::Transparent)
|
w->print() << FStyle {fc::Transparent}
|
||||||
<< FPoint (int(width) + 1, 1)
|
<< FPoint {int(width) + 1, 1}
|
||||||
<< " "
|
<< " "
|
||||||
<< FStyle (fc::Reset)
|
<< FStyle {fc::Reset}
|
||||||
<< FColorPair (wcolors.shadow_bg, wcolors.shadow_fg)
|
<< FColorPair {wcolors.shadow_bg, wcolors.shadow_fg}
|
||||||
<< FStyle (fc::ColorOverlay);
|
<< FStyle {fc::ColorOverlay};
|
||||||
|
|
||||||
for (std::size_t y{1}; y < height; y++)
|
for (std::size_t y{1}; y < height; y++)
|
||||||
{
|
{
|
||||||
w->print() << FPoint(int(width) + 1, int(y) + 1) << " ";
|
w->print() << FPoint{int(width) + 1, int(y) + 1} << " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
w->print() << FStyle (fc::Reset) << FStyle (fc::Transparent)
|
w->print() << FStyle {fc::Reset} << FStyle {fc::Transparent}
|
||||||
<< FPoint (1, int(height) + 1)
|
<< FPoint {1, int(height) + 1}
|
||||||
<< " "
|
<< " "
|
||||||
<< FStyle (fc::Reset)
|
<< FStyle {fc::Reset}
|
||||||
<< FColorPair (wcolors.shadow_bg, wcolors.shadow_fg)
|
<< FColorPair {wcolors.shadow_bg, wcolors.shadow_fg}
|
||||||
<< FStyle (fc::ColorOverlay)
|
<< FStyle {fc::ColorOverlay}
|
||||||
<< FString (width, L' ')
|
<< FString {width, L' '}
|
||||||
<< FStyle (fc::Reset);
|
<< FStyle {fc::Reset};
|
||||||
|
|
||||||
if ( w->isMonochron() )
|
if ( w->isMonochron() )
|
||||||
w->setReverse(false);
|
w->setReverse(false);
|
||||||
|
@ -198,36 +198,36 @@ void drawBlockShadow (FWidget* w)
|
||||||
const std::size_t width = w->getWidth();
|
const std::size_t width = w->getWidth();
|
||||||
const std::size_t height = w->getHeight();
|
const std::size_t height = w->getHeight();
|
||||||
const auto& wcolors = FWidget::wcolors;
|
const auto& wcolors = FWidget::wcolors;
|
||||||
w->print() << FPoint(int(width) + 1, 1);
|
w->print() << FPoint {int(width) + 1, 1};
|
||||||
|
|
||||||
if ( w->isWindowWidget() )
|
if ( w->isWindowWidget() )
|
||||||
{
|
{
|
||||||
w->print() << FColorPair (wcolors.shadow_fg, wcolors.shadow_bg)
|
w->print() << FColorPair {wcolors.shadow_fg, wcolors.shadow_bg}
|
||||||
<< FStyle (fc::InheritBackground); // current background color will be ignored
|
<< FStyle {fc::InheritBackground}; // current background color will be ignored
|
||||||
}
|
}
|
||||||
else if ( auto p = w->getParentWidget() )
|
else if ( auto p = w->getParentWidget() )
|
||||||
w->print() << FColorPair (wcolors.shadow_fg, p->getBackgroundColor());
|
w->print() << FColorPair {wcolors.shadow_fg, p->getBackgroundColor()};
|
||||||
|
|
||||||
w->print (fc::LowerHalfBlock); // ▄
|
w->print (fc::LowerHalfBlock); // ▄
|
||||||
|
|
||||||
if ( w->isWindowWidget() )
|
if ( w->isWindowWidget() )
|
||||||
w->print() << FStyle (fc::InheritBackground);
|
w->print() << FStyle {fc::InheritBackground};
|
||||||
|
|
||||||
for (std::size_t y{1}; y < height; y++)
|
for (std::size_t y{1}; y < height; y++)
|
||||||
{
|
{
|
||||||
w->print() << FPoint(int(width) + 1, int(y) + 1)
|
w->print() << FPoint {int(width) + 1, int(y) + 1}
|
||||||
<< fc::FullBlock; // █
|
<< fc::FullBlock; // █
|
||||||
}
|
}
|
||||||
|
|
||||||
w->print() << FPoint(2, int(height) + 1);
|
w->print() << FPoint {2, int(height) + 1};
|
||||||
|
|
||||||
if ( w->isWindowWidget() )
|
if ( w->isWindowWidget() )
|
||||||
w->print() << FStyle (fc::InheritBackground);
|
w->print() << FStyle {fc::InheritBackground};
|
||||||
|
|
||||||
w->print() << FString(width, fc::UpperHalfBlock); // ▀
|
w->print() << FString{width, fc::UpperHalfBlock}; // ▀
|
||||||
|
|
||||||
if ( w->isWindowWidget() )
|
if ( w->isWindowWidget() )
|
||||||
w->print() << FStyle (fc::Reset);
|
w->print() << FStyle {fc::Reset};
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -242,29 +242,29 @@ void clearShadow (FWidget* w)
|
||||||
|
|
||||||
if ( w->isWindowWidget() )
|
if ( w->isWindowWidget() )
|
||||||
{
|
{
|
||||||
w->print() << FColorPair (wcolors.shadow_fg, wcolors.shadow_bg)
|
w->print() << FColorPair {wcolors.shadow_fg, wcolors.shadow_bg}
|
||||||
<< FStyle (fc::InheritBackground); // current background color will be ignored
|
<< FStyle {fc::InheritBackground}; // current background color will be ignored
|
||||||
}
|
}
|
||||||
else if ( auto p = w->getParentWidget() )
|
else if ( auto p = w->getParentWidget() )
|
||||||
w->print() << FColorPair (wcolors.shadow_fg, p->getBackgroundColor());
|
w->print() << FColorPair {wcolors.shadow_fg, p->getBackgroundColor()};
|
||||||
|
|
||||||
if ( int(width) <= w->woffset.getX2() )
|
if ( int(width) <= w->woffset.getX2() )
|
||||||
{
|
{
|
||||||
for (std::size_t y{1}; y <= height; y++)
|
for (std::size_t y{1}; y <= height; y++)
|
||||||
{
|
{
|
||||||
w->print() << FPoint(int(width) + 1, int(y))
|
w->print() << FPoint {int(width) + 1, int(y)}
|
||||||
<< ' '; // clear █
|
<< ' '; // clear █
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( int(height) <= w->woffset.getY2() )
|
if ( int(height) <= w->woffset.getY2() )
|
||||||
{
|
{
|
||||||
w->print() << FPoint(2, int(height) + 1)
|
w->print() << FPoint{2, int(height) + 1}
|
||||||
<< FString(width, L' '); // clear ▀
|
<< FString{width, L' '}; // clear ▀
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( w->isWindowWidget() )
|
if ( w->isWindowWidget() )
|
||||||
w->print() << FStyle (fc::Reset);
|
w->print() << FStyle {fc::Reset};
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -284,7 +284,7 @@ void drawFlatBorder (FWidget* w)
|
||||||
|
|
||||||
for (std::size_t y{0}; y < height; y++)
|
for (std::size_t y{0}; y < height; y++)
|
||||||
{
|
{
|
||||||
w->print() << FPoint(0, int(y) + 1);
|
w->print() << FPoint {0, int(y) + 1};
|
||||||
|
|
||||||
if ( w->double_flatline_mask.left[uLong(y)] )
|
if ( w->double_flatline_mask.left[uLong(y)] )
|
||||||
// left+right line (on left side)
|
// left+right line (on left side)
|
||||||
|
@ -293,7 +293,7 @@ void drawFlatBorder (FWidget* w)
|
||||||
// right line (on left side)
|
// right line (on left side)
|
||||||
w->print (fc::NF_rev_border_line_right);
|
w->print (fc::NF_rev_border_line_right);
|
||||||
|
|
||||||
w->print() << FPoint(int(width) + 1, int(y) + 1);
|
w->print() << FPoint {int(width) + 1, int(y) + 1};
|
||||||
|
|
||||||
if ( w->double_flatline_mask.right[y] )
|
if ( w->double_flatline_mask.right[y] )
|
||||||
// left+right line (on right side)
|
// left+right line (on right side)
|
||||||
|
@ -303,7 +303,7 @@ void drawFlatBorder (FWidget* w)
|
||||||
w->print (fc::NF_border_line_left);
|
w->print (fc::NF_border_line_left);
|
||||||
}
|
}
|
||||||
|
|
||||||
w->print() << FPoint(1, 0);
|
w->print() << FPoint {1, 0};
|
||||||
|
|
||||||
for (std::size_t x{0}; x < width; x++)
|
for (std::size_t x{0}; x < width; x++)
|
||||||
{
|
{
|
||||||
|
@ -315,7 +315,7 @@ void drawFlatBorder (FWidget* w)
|
||||||
w->print (fc::NF_border_line_bottom);
|
w->print (fc::NF_border_line_bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
w->print() << FPoint(1, int(height) + 1);
|
w->print() << FPoint {1, int(height) + 1};
|
||||||
|
|
||||||
for (std::size_t x{0}; x < width; x++)
|
for (std::size_t x{0}; x < width; x++)
|
||||||
{
|
{
|
||||||
|
@ -346,7 +346,7 @@ void clearFlatBorder (FWidget* w)
|
||||||
for (std::size_t y{0}; y < height; y++)
|
for (std::size_t y{0}; y < height; y++)
|
||||||
{
|
{
|
||||||
// clear on left side
|
// clear on left side
|
||||||
w->print() << FPoint(0, int(y) + 1);
|
w->print() << FPoint {0, int(y) + 1};
|
||||||
|
|
||||||
if ( w->double_flatline_mask.left[y] )
|
if ( w->double_flatline_mask.left[y] )
|
||||||
w->print (fc::NF_border_line_left);
|
w->print (fc::NF_border_line_left);
|
||||||
|
@ -354,7 +354,7 @@ void clearFlatBorder (FWidget* w)
|
||||||
w->print (' ');
|
w->print (' ');
|
||||||
|
|
||||||
// clear on right side
|
// clear on right side
|
||||||
w->print() << FPoint(int(width) + 1, int(y) + 1);
|
w->print() << FPoint {int(width) + 1, int(y) + 1};
|
||||||
|
|
||||||
if ( w->double_flatline_mask.right[y] )
|
if ( w->double_flatline_mask.right[y] )
|
||||||
w->print (fc::NF_rev_border_line_right);
|
w->print (fc::NF_rev_border_line_right);
|
||||||
|
@ -363,7 +363,7 @@ void clearFlatBorder (FWidget* w)
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear at top
|
// clear at top
|
||||||
w->print() << FPoint(1, 0);
|
w->print() << FPoint {1, 0};
|
||||||
|
|
||||||
for (std::size_t x{0}; x < width; x++)
|
for (std::size_t x{0}; x < width; x++)
|
||||||
{
|
{
|
||||||
|
@ -374,7 +374,7 @@ void clearFlatBorder (FWidget* w)
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear at bottom
|
// clear at bottom
|
||||||
w->print() << FPoint(1, int(height) + 1);
|
w->print() << FPoint {1, int(height) + 1};
|
||||||
|
|
||||||
for (std::size_t x{0}; x < width; x++)
|
for (std::size_t x{0}; x < width; x++)
|
||||||
{
|
{
|
||||||
|
@ -441,20 +441,20 @@ inline void drawBox (FWidget* w, const FRect& r)
|
||||||
|
|
||||||
w->print() << r.getUpperLeftPos()
|
w->print() << r.getUpperLeftPos()
|
||||||
<< fc::BoxDrawingsDownAndRight // ┌
|
<< fc::BoxDrawingsDownAndRight // ┌
|
||||||
<< FString(r.getWidth() - 2, fc::BoxDrawingsHorizontal) // ─
|
<< FString{r.getWidth() - 2, fc::BoxDrawingsHorizontal} // ─
|
||||||
<< fc::BoxDrawingsDownAndLeft; // ┐
|
<< fc::BoxDrawingsDownAndLeft; // ┐
|
||||||
|
|
||||||
for (int y = r.getY1() + 1; y < r.getY2(); y++)
|
for (int y = r.getY1() + 1; y < r.getY2(); y++)
|
||||||
{
|
{
|
||||||
w->print() << FPoint(r.getX1(), y)
|
w->print() << FPoint{r.getX1(), y}
|
||||||
<< fc::BoxDrawingsVertical // │
|
<< fc::BoxDrawingsVertical // │
|
||||||
<< FPoint(r.getX2(), y)
|
<< FPoint{r.getX2(), y}
|
||||||
<< fc::BoxDrawingsVertical; // │
|
<< fc::BoxDrawingsVertical; // │
|
||||||
}
|
}
|
||||||
|
|
||||||
w->print() << r.getLowerLeftPos()
|
w->print() << r.getLowerLeftPos()
|
||||||
<< fc::BoxDrawingsUpAndRight // └
|
<< fc::BoxDrawingsUpAndRight // └
|
||||||
<< FString(r.getWidth() - 2, fc::BoxDrawingsHorizontal) // ─
|
<< FString{r.getWidth() - 2, fc::BoxDrawingsHorizontal} // ─
|
||||||
<< fc::BoxDrawingsUpAndLeft; // ┘
|
<< fc::BoxDrawingsUpAndLeft; // ┘
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,20 +465,20 @@ inline void drawNewFontBox (FWidget* w, const FRect& r)
|
||||||
|
|
||||||
w->print() << r.getUpperLeftPos()
|
w->print() << r.getUpperLeftPos()
|
||||||
<< fc::NF_border_corner_middle_upper_left // ┌
|
<< fc::NF_border_corner_middle_upper_left // ┌
|
||||||
<< FString(r.getWidth() - 2, fc::NF_border_line_horizontal) // ─
|
<< FString{r.getWidth() - 2, fc::NF_border_line_horizontal} // ─
|
||||||
<< fc::NF_border_corner_middle_upper_right; // ┐
|
<< fc::NF_border_corner_middle_upper_right; // ┐
|
||||||
|
|
||||||
for (int y = r.getY1() + 1; y < r.getY2(); y++)
|
for (int y = r.getY1() + 1; y < r.getY2(); y++)
|
||||||
{
|
{
|
||||||
w->print() << FPoint(r.getX1(), y)
|
w->print() << FPoint{r.getX1(), y}
|
||||||
<< fc::NF_border_line_vertical // │
|
<< fc::NF_border_line_vertical // │
|
||||||
<< FPoint(r.getX2(), y)
|
<< FPoint{r.getX2(), y}
|
||||||
<< fc::NF_border_line_vertical; // │
|
<< fc::NF_border_line_vertical; // │
|
||||||
}
|
}
|
||||||
|
|
||||||
w->print() << r.getLowerLeftPos()
|
w->print() << r.getLowerLeftPos()
|
||||||
<< fc::NF_border_corner_middle_lower_left // └
|
<< fc::NF_border_corner_middle_lower_left // └
|
||||||
<< FString(r.getWidth() - 2, fc::NF_border_line_horizontal) // ─
|
<< FString{r.getWidth() - 2, fc::NF_border_line_horizontal} // ─
|
||||||
<< fc::NF_border_corner_middle_lower_right; // ┘
|
<< fc::NF_border_corner_middle_lower_right; // ┘
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,20 +487,20 @@ inline void drawNewFontListBox (FWidget* w, const FRect& r)
|
||||||
{
|
{
|
||||||
w->print() << r.getUpperLeftPos()
|
w->print() << r.getUpperLeftPos()
|
||||||
<< fc::NF_border_line_middle_left_down // ┌
|
<< fc::NF_border_line_middle_left_down // ┌
|
||||||
<< FString(r.getWidth() - 2, fc::NF_border_line_horizontal) // ─
|
<< FString{r.getWidth() - 2, fc::NF_border_line_horizontal} // ─
|
||||||
<< fc::NF_border_line_left_down; // ╷
|
<< fc::NF_border_line_left_down; // ╷
|
||||||
|
|
||||||
for (int y = r.getY1() + 1; y < r.getY2(); y++)
|
for (int y = r.getY1() + 1; y < r.getY2(); y++)
|
||||||
{
|
{
|
||||||
w->print() << FPoint(r.getX1(), y)
|
w->print() << FPoint{r.getX1(), y}
|
||||||
<< fc::NF_border_line_left // border left ⎸
|
<< fc::NF_border_line_left // border left ⎸
|
||||||
<< FPoint(r.getX2(), y)
|
<< FPoint{r.getX2(), y}
|
||||||
<< fc::NF_border_line_left; // border left ⎸
|
<< fc::NF_border_line_left; // border left ⎸
|
||||||
}
|
}
|
||||||
|
|
||||||
w->print() << r.getLowerLeftPos()
|
w->print() << r.getLowerLeftPos()
|
||||||
<< fc::NF_border_line_middle_right_up // └
|
<< fc::NF_border_line_middle_right_up // └
|
||||||
<< FString(r.getWidth() - 2, fc::NF_border_line_horizontal) // ─
|
<< FString{r.getWidth() - 2, fc::NF_border_line_horizontal} // ─
|
||||||
<< fc::NF_border_line_left_up; // ╵
|
<< fc::NF_border_line_left_up; // ╵
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,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(), getVWin());
|
createArea (geometry, getShadow(), getVWin());
|
||||||
addWindow (this);
|
addWindow (this);
|
||||||
|
@ -174,9 +174,9 @@ bool FWindow::setTransparentShadow (bool enable)
|
||||||
setFlags().shadow = setFlags().trans_shadow = enable;
|
setFlags().shadow = setFlags().trans_shadow = enable;
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
setShadowSize (FSize(2, 1));
|
setShadowSize (FSize{2, 1});
|
||||||
else
|
else
|
||||||
setShadowSize (FSize(0, 0));
|
setShadowSize (FSize{0, 0});
|
||||||
|
|
||||||
return enable;
|
return enable;
|
||||||
}
|
}
|
||||||
|
@ -191,13 +191,13 @@ bool FWindow::setShadow (bool enable)
|
||||||
{
|
{
|
||||||
setFlags().shadow = true;
|
setFlags().shadow = true;
|
||||||
setFlags().trans_shadow = false;
|
setFlags().trans_shadow = false;
|
||||||
setShadowSize (FSize(1, 1));
|
setShadowSize (FSize{1, 1});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setFlags().shadow = false;
|
setFlags().shadow = false;
|
||||||
setFlags().trans_shadow = false;
|
setFlags().trans_shadow = false;
|
||||||
setShadowSize (FSize(0, 0));
|
setShadowSize (FSize{0, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
return enable;
|
return enable;
|
||||||
|
@ -241,23 +241,23 @@ void FWindow::drawBorder()
|
||||||
{
|
{
|
||||||
if ( isNewFont() ) // Draw a newfont outer frame
|
if ( isNewFont() ) // Draw a newfont outer frame
|
||||||
{
|
{
|
||||||
const FRect r(FPoint(1, 1), getSize());
|
const FRect r{FPoint{1, 1}, getSize()};
|
||||||
print() << r.getUpperLeftPos()
|
print() << r.getUpperLeftPos()
|
||||||
<< fc::NF_border_corner_upper_left // ⎡
|
<< fc::NF_border_corner_upper_left // ⎡
|
||||||
<< FString(r.getWidth() - 2, fc::NF_border_line_upper) // ¯
|
<< FString{r.getWidth() - 2, fc::NF_border_line_upper} // ¯
|
||||||
<< fc::NF_rev_border_corner_upper_right; // ⎤
|
<< fc::NF_rev_border_corner_upper_right; // ⎤
|
||||||
|
|
||||||
for (int y = r.getY1() + 1; y < r.getY2(); y++)
|
for (int y = r.getY1() + 1; y < r.getY2(); y++)
|
||||||
{
|
{
|
||||||
print() << FPoint(r.getX1(), y)
|
print() << FPoint{r.getX1(), y}
|
||||||
<< fc::NF_border_line_left // border left ⎸
|
<< fc::NF_border_line_left // border left ⎸
|
||||||
<< FPoint(r.getX2(), y)
|
<< FPoint{r.getX2(), y}
|
||||||
<< fc::NF_rev_border_line_right; // border right⎹
|
<< fc::NF_rev_border_line_right; // border right⎹
|
||||||
}
|
}
|
||||||
|
|
||||||
print() << r.getLowerLeftPos()
|
print() << r.getLowerLeftPos()
|
||||||
<< fc::NF_border_corner_lower_left // ⎣
|
<< fc::NF_border_corner_lower_left // ⎣
|
||||||
<< FString(r.getWidth() - 2, fc::NF_border_line_bottom) // _
|
<< FString{r.getWidth() - 2, fc::NF_border_line_bottom} // _
|
||||||
<< fc::NF_rev_border_corner_lower_right; // ⎦
|
<< fc::NF_rev_border_corner_lower_right; // ⎦
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -308,7 +308,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);
|
||||||
|
@ -331,7 +331,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(), getVWin());
|
resizeArea (geometry, getShadow(), getVWin());
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,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(), getVWin());
|
resizeArea (geometry, getShadow(), getVWin());
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,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(), getVWin());
|
resizeArea (geometry, getShadow(), getVWin());
|
||||||
}
|
}
|
||||||
|
@ -374,8 +374,8 @@ void FWindow::setGeometry ( const FPoint& p, const FSize& size, bool adjust)
|
||||||
|
|
||||||
const int old_x = getX();
|
const int old_x = getX();
|
||||||
const int old_y = getY();
|
const int old_y = getY();
|
||||||
FPoint pos(p);
|
FPoint pos{p};
|
||||||
const FSize old_size(getSize());
|
const FSize old_size{getSize()};
|
||||||
|
|
||||||
if ( pos.getY() < 1 )
|
if ( pos.getY() < 1 )
|
||||||
pos.setY(1);
|
pos.setY(1);
|
||||||
|
@ -387,7 +387,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(), getVWin());
|
resizeArea (geometry, getShadow(), getVWin());
|
||||||
}
|
}
|
||||||
|
@ -658,7 +658,7 @@ bool FWindow::zoomWindow()
|
||||||
// save the current geometry
|
// save the current geometry
|
||||||
normalGeometry = getGeometry();
|
normalGeometry = getGeometry();
|
||||||
const FRect oldGeometry (getTermGeometryWithShadow());
|
const FRect oldGeometry (getTermGeometryWithShadow());
|
||||||
setGeometry (FPoint(1, 1), FSize(getMaxWidth(), getMaxHeight()));
|
setGeometry (FPoint{1, 1}, FSize{getMaxWidth(), getMaxHeight()});
|
||||||
restoreVTerm (oldGeometry);
|
restoreVTerm (oldGeometry);
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
@ -772,7 +772,7 @@ void FWindow::adjustSize()
|
||||||
FWidget::adjustSize();
|
FWidget::adjustSize();
|
||||||
|
|
||||||
if ( zoomed )
|
if ( zoomed )
|
||||||
setGeometry (FPoint(1, 1), FSize(getMaxWidth(), getMaxHeight()), false);
|
setGeometry (FPoint{1, 1}, FSize{getMaxWidth(), getMaxHeight()}, false);
|
||||||
else if ( isVirtualWindow() )
|
else if ( isVirtualWindow() )
|
||||||
{
|
{
|
||||||
if ( getTermX() != old_x )
|
if ( getTermX() != old_x )
|
||||||
|
|
|
@ -142,7 +142,7 @@ class FApplication : public FWidget
|
||||||
static void cmd_options (const int&, char*[]);
|
static void cmd_options (const int&, char*[]);
|
||||||
static FStartOptions& getStartOptions();
|
static FStartOptions& getStartOptions();
|
||||||
void findKeyboardWidget();
|
void findKeyboardWidget();
|
||||||
bool isKeyPressed();
|
bool isKeyPressed() const;
|
||||||
void keyPressed();
|
void keyPressed();
|
||||||
void keyReleased();
|
void keyReleased();
|
||||||
void escapeKeyPressed();
|
void escapeKeyPressed();
|
||||||
|
|
|
@ -116,7 +116,7 @@ class FButton : public FWidget
|
||||||
bool isFlat() const;
|
bool isFlat() const;
|
||||||
bool isDown() const;
|
bool isDown() const;
|
||||||
bool hasShadow() const;
|
bool hasShadow() const;
|
||||||
bool hasClickAnimation();
|
bool hasClickAnimation() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide() override;
|
void hide() override;
|
||||||
|
@ -257,7 +257,7 @@ inline bool FButton::hasShadow() const
|
||||||
{ return getFlags().shadow; }
|
{ return getFlags().shadow; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FButton::hasClickAnimation()
|
inline bool FButton::hasClickAnimation() const
|
||||||
{ return click_animation; }
|
{ return click_animation; }
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -89,7 +89,7 @@ class FDropDownListBox : public FWindow
|
||||||
void setGeometry ( const FPoint&, const FSize&
|
void setGeometry ( const FPoint&, const FSize&
|
||||||
, bool = true ) override;
|
, bool = true ) override;
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isEmpty();
|
bool isEmpty() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void show() override;
|
void show() override;
|
||||||
|
@ -118,7 +118,7 @@ inline const FString FDropDownListBox::getClassName() const
|
||||||
{ return "FDropDownListBox"; }
|
{ return "FDropDownListBox"; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FDropDownListBox::isEmpty()
|
inline bool FDropDownListBox::isEmpty() const
|
||||||
{ return bool( list.getCount() == 0 ); }
|
{ return bool( list.getCount() == 0 ); }
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ class FComboBox : public FWidget
|
||||||
void setLabelOrientation (const FLineEdit::label_o);
|
void setLabelOrientation (const FLineEdit::label_o);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool hasShadow();
|
bool hasShadow() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void insert (const FListBoxItem&);
|
void insert (const FListBoxItem&);
|
||||||
|
@ -294,7 +294,7 @@ inline bool FComboBox::unsetEditable()
|
||||||
{ return setEditable(false); }
|
{ return setEditable(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FComboBox::hasShadow()
|
inline bool FComboBox::hasShadow() const
|
||||||
{ return getFlags().shadow; }
|
{ return getFlags().shadow; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -192,13 +192,13 @@ class FDialog : public FWindow
|
||||||
void deactivateZoomButton();
|
void deactivateZoomButton();
|
||||||
void leaveZoomButton (const mouseStates&);
|
void leaveZoomButton (const mouseStates&);
|
||||||
void pressZoomButton (const mouseStates&);
|
void pressZoomButton (const mouseStates&);
|
||||||
bool isMouseOverMenu (const FPoint&);
|
bool isMouseOverMenu (const FPoint&) const;
|
||||||
void passEventToSubMenu (const mouseStates&, const FMouseEvent*);
|
void passEventToSubMenu (const mouseStates&, const FMouseEvent*);
|
||||||
void moveSizeKey (FKeyEvent*);
|
void moveSizeKey (FKeyEvent*);
|
||||||
void raiseActivateDialog();
|
void raiseActivateDialog();
|
||||||
void lowerActivateDialog();
|
void lowerActivateDialog();
|
||||||
bool isOutsideTerminal (const FPoint&);
|
bool isOutsideTerminal (const FPoint&) const;
|
||||||
bool isLowerRightResizeCorner (const mouseStates&);
|
bool isLowerRightResizeCorner (const mouseStates&) const;
|
||||||
void resizeMouseDown (const mouseStates&);
|
void resizeMouseDown (const mouseStates&);
|
||||||
void resizeMouseUpMove (const mouseStates&, bool = false);
|
void resizeMouseUpMove (const mouseStates&, bool = false);
|
||||||
void cancelMouseResize();
|
void cancelMouseResize();
|
||||||
|
|
|
@ -140,18 +140,18 @@ class FMouseEvent : public FEvent // mouse event
|
||||||
FMouseEvent (fc::events, const FPoint&, int);
|
FMouseEvent (fc::events, const FPoint&, int);
|
||||||
~FMouseEvent();
|
~FMouseEvent();
|
||||||
|
|
||||||
const FPoint& getPos() const;
|
const FPoint& getPos() const;
|
||||||
const FPoint& getTermPos() const;
|
const FPoint& getTermPos() const;
|
||||||
int getX() const;
|
int getX() const;
|
||||||
int getY() const;
|
int getY() const;
|
||||||
int getTermX() const;
|
int getTermX() const;
|
||||||
int getTermY() const;
|
int getTermY() const;
|
||||||
int getButton() const;
|
int getButton() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FPoint p{};
|
FPoint p{};
|
||||||
FPoint tp{};
|
FPoint tp{};
|
||||||
int b{};
|
int b{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,18 +167,18 @@ class FWheelEvent : public FEvent // wheel event
|
||||||
FWheelEvent (fc::events, const FPoint&, const FPoint&, int);
|
FWheelEvent (fc::events, const FPoint&, const FPoint&, int);
|
||||||
~FWheelEvent();
|
~FWheelEvent();
|
||||||
|
|
||||||
const FPoint& getPos() const;
|
const FPoint& getPos() const;
|
||||||
const FPoint& getTermPos() const;
|
const FPoint& getTermPos() const;
|
||||||
int getX() const;
|
int getX() const;
|
||||||
int getY() const;
|
int getY() const;
|
||||||
int getTermX() const;
|
int getTermX() const;
|
||||||
int getTermY() const;
|
int getTermY() const;
|
||||||
int getWheel() const;
|
int getWheel() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FPoint p;
|
FPoint p;
|
||||||
FPoint tp;
|
FPoint tp;
|
||||||
int w;
|
int w;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,16 +193,16 @@ class FFocusEvent : public FEvent // focus event
|
||||||
explicit FFocusEvent (fc::events);
|
explicit FFocusEvent (fc::events);
|
||||||
~FFocusEvent();
|
~FFocusEvent();
|
||||||
|
|
||||||
bool gotFocus() const;
|
bool gotFocus() const;
|
||||||
bool lostFocus() const;
|
bool lostFocus() const;
|
||||||
fc::FocusTypes getFocusType() const;
|
fc::FocusTypes getFocusType() const;
|
||||||
void setFocusType(fc::FocusTypes);
|
void setFocusType(fc::FocusTypes);
|
||||||
bool isAccepted() const;
|
bool isAccepted() const;
|
||||||
void accept();
|
void accept();
|
||||||
void ignore();
|
void ignore();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool accpt{true};
|
bool accpt{true};
|
||||||
fc::FocusTypes focus_type{fc::FocusDefiniteWidget};
|
fc::FocusTypes focus_type{fc::FocusDefiniteWidget};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -142,9 +142,39 @@ class FFileDialog : public FDialog
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Typedef
|
// Typedef
|
||||||
struct dir_entry
|
struct FDirEntry
|
||||||
{
|
{
|
||||||
std::string name;
|
// Constructor
|
||||||
|
FDirEntry()
|
||||||
|
: fifo{false}
|
||||||
|
, character_device{false}
|
||||||
|
, directory{false}
|
||||||
|
, block_device{false}
|
||||||
|
, regular_file{false}
|
||||||
|
, symbolic_link{false}
|
||||||
|
, socket{false}
|
||||||
|
{ }
|
||||||
|
|
||||||
|
// Copy constructor
|
||||||
|
FDirEntry (const FDirEntry& entry)
|
||||||
|
: name{entry.name}
|
||||||
|
, fifo{entry.fifo}
|
||||||
|
, character_device{entry.character_device}
|
||||||
|
, directory{entry.directory}
|
||||||
|
, block_device{entry.block_device}
|
||||||
|
, regular_file{entry.regular_file}
|
||||||
|
, symbolic_link{entry.symbolic_link}
|
||||||
|
, socket{entry.socket}
|
||||||
|
{ }
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
~FDirEntry() = default;
|
||||||
|
|
||||||
|
// Copy assignment operator (=)
|
||||||
|
FDirEntry& operator = (const FDirEntry&) = default;
|
||||||
|
|
||||||
|
// Data members
|
||||||
|
std::string name{};
|
||||||
// Type of file
|
// Type of file
|
||||||
uChar fifo : 1;
|
uChar fifo : 1;
|
||||||
uChar character_device : 1;
|
uChar character_device : 1;
|
||||||
|
@ -156,7 +186,7 @@ class FFileDialog : public FDialog
|
||||||
uChar : 1; // padding bits
|
uChar : 1; // padding bits
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<dir_entry> dirEntries;
|
typedef std::vector<FDirEntry> dirEntries;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
|
@ -168,7 +198,7 @@ class FFileDialog : public FDialog
|
||||||
void sortDir();
|
void sortDir();
|
||||||
int readDir();
|
int readDir();
|
||||||
void getEntry (const char* const, const struct dirent*);
|
void getEntry (const char* const, const struct dirent*);
|
||||||
void followSymLink (const char* const, dir_entry&);
|
void followSymLink (const char* const, FDirEntry&);
|
||||||
void dirEntriesToList();
|
void dirEntriesToList();
|
||||||
void selectDirectoryEntry (const char* const);
|
void selectDirectoryEntry (const char* const);
|
||||||
int changeDir (const FString&);
|
int changeDir (const FString&);
|
||||||
|
@ -198,10 +228,10 @@ class FFileDialog : public FDialog
|
||||||
bool show_hidden{false};
|
bool show_hidden{false};
|
||||||
|
|
||||||
// Friend functions
|
// Friend functions
|
||||||
friend bool sortByName ( const FFileDialog::dir_entry&
|
friend bool sortByName ( const FFileDialog::FDirEntry&
|
||||||
, const FFileDialog::dir_entry& );
|
, const FFileDialog::FDirEntry& );
|
||||||
friend bool sortDirFirst ( const FFileDialog::dir_entry&
|
friend bool sortDirFirst ( const FFileDialog::FDirEntry&
|
||||||
, const FFileDialog::dir_entry& );
|
, const FFileDialog::FDirEntry& );
|
||||||
friend const FString fileChooser ( FWidget*
|
friend const FString fileChooser ( FWidget*
|
||||||
, const FString&
|
, const FString&
|
||||||
, const FString&
|
, const FString&
|
||||||
|
|
|
@ -120,12 +120,12 @@ class FKeyboard final
|
||||||
void setEscPressedCommand (const FKeyboardCommand&);
|
void setEscPressedCommand (const FKeyboardCommand&);
|
||||||
|
|
||||||
// Inquiry
|
// Inquiry
|
||||||
bool isInputDataPending();
|
bool isInputDataPending() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
static void init();
|
static void init();
|
||||||
bool& unprocessedInput();
|
bool& unprocessedInput();
|
||||||
bool isKeyPressed();
|
bool isKeyPressed() const;
|
||||||
void clearKeyBuffer();
|
void clearKeyBuffer();
|
||||||
void clearKeyBufferOnTimeout();
|
void clearKeyBufferOnTimeout();
|
||||||
void fetchKeyCode();
|
void fetchKeyCode();
|
||||||
|
@ -248,7 +248,7 @@ inline void FKeyboard::setEscPressedCommand (const FKeyboardCommand& cmd)
|
||||||
{ escape_key_cmd = cmd; }
|
{ escape_key_cmd = cmd; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FKeyboard::isInputDataPending()
|
inline bool FKeyboard::isInputDataPending() const
|
||||||
{ return input_data_pending; }
|
{ return input_data_pending; }
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FKeyboard::setNonBlockingInput()
|
inline bool FKeyboard::setNonBlockingInput()
|
||||||
|
|
|
@ -110,8 +110,8 @@ class FLabel : public FWidget
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool hasEmphasis();
|
bool hasEmphasis() const;
|
||||||
bool hasReverseMode();
|
bool hasReverseMode() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide() override;
|
void hide() override;
|
||||||
|
@ -224,11 +224,11 @@ inline void FLabel::setNumber (lDouble num, int precision)
|
||||||
{ setText(FString().setNumber(num, precision)); }
|
{ setText(FString().setNumber(num, precision)); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FLabel::hasEmphasis()
|
inline bool FLabel::hasEmphasis() const
|
||||||
{ return emphasis; }
|
{ return emphasis; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FLabel::hasReverseMode()
|
inline bool FLabel::hasReverseMode() const
|
||||||
{ return reverse_mode; }
|
{ return reverse_mode; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -178,7 +178,7 @@ class FLineEdit : public FWidget
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
bool hasHotkey();
|
bool hasHotkey() const;
|
||||||
void draw() override;
|
void draw() override;
|
||||||
void drawInputField();
|
void drawInputField();
|
||||||
std::size_t printTextField();
|
std::size_t printTextField();
|
||||||
|
|
|
@ -189,10 +189,10 @@ class FListBox : public FWidget
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isSelected (std::size_t);
|
bool isSelected (std::size_t) const;
|
||||||
bool isSelected (listBoxItems::iterator) const;
|
bool isSelected (listBoxItems::iterator) const;
|
||||||
bool isMultiSelection() const;
|
bool isMultiSelection() const;
|
||||||
bool hasBrackets (std::size_t);
|
bool hasBrackets (std::size_t) const;
|
||||||
bool hasBrackets (listBoxItems::iterator) const;
|
bool hasBrackets (listBoxItems::iterator) const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
@ -250,8 +250,8 @@ class FListBox : public FWidget
|
||||||
static FString& getString (listBoxItems::iterator);
|
static FString& getString (listBoxItems::iterator);
|
||||||
|
|
||||||
// Inquiry
|
// Inquiry
|
||||||
bool isHorizontallyScrollable();
|
bool isHorizontallyScrollable() const;
|
||||||
bool isVerticallyScrollable();
|
bool isVerticallyScrollable() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
|
@ -451,7 +451,7 @@ inline bool FListBox::setDisable()
|
||||||
{ return setEnable(false); }
|
{ return setEnable(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListBox::isSelected (std::size_t index)
|
inline bool FListBox::isSelected (std::size_t index) const
|
||||||
{ return index2iterator(index - 1)->selected; }
|
{ return index2iterator(index - 1)->selected; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -463,7 +463,7 @@ inline bool FListBox::isMultiSelection() const
|
||||||
{ return multi_select; }
|
{ return multi_select; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListBox::hasBrackets(std::size_t index)
|
inline bool FListBox::hasBrackets(std::size_t index) const
|
||||||
{ return bool(index2iterator(index - 1)->brackets > 0); }
|
{ return bool(index2iterator(index - 1)->brackets > 0); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -534,11 +534,11 @@ void FListBox::insert ( const ItemT& item
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListBox::isHorizontallyScrollable()
|
inline bool FListBox::isHorizontallyScrollable() const
|
||||||
{ return bool( max_line_width + 1 >= getClientWidth() ); }
|
{ return bool( max_line_width + 1 >= getClientWidth() ); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListBox::isVerticallyScrollable()
|
inline bool FListBox::isVerticallyScrollable() const
|
||||||
{ return bool( getCount() > getClientHeight() ); }
|
{ return bool( getCount() > getClientHeight() ); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -168,7 +168,10 @@ inline const FString FMessageBox::getClassName() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString FMessageBox::getTitlebarText() const
|
inline const FString FMessageBox::getTitlebarText() const
|
||||||
{ return FDialog::getText(); }
|
{
|
||||||
|
const FString& tb_text = FDialog::getText(); // initialize text
|
||||||
|
return tb_text;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString FMessageBox::getHeadline() const
|
inline const FString FMessageBox::getHeadline() const
|
||||||
|
|
|
@ -103,7 +103,7 @@ class FMouse
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
virtual const FString getClassName() const;
|
virtual const FString getClassName() const;
|
||||||
FPoint& getPos();
|
const FPoint& getPos();
|
||||||
void clearEvent();
|
void clearEvent();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
|
@ -161,7 +161,7 @@ class FMouse
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
FMouseButton& getButtonState();
|
FMouseButton& getButtonState();
|
||||||
FPoint& getNewPos();
|
const FPoint& getNewPos();
|
||||||
uInt16 getMaxWidth();
|
uInt16 getMaxWidth();
|
||||||
uInt16 getMaxHeight();
|
uInt16 getMaxHeight();
|
||||||
uInt64 getDblclickInterval();
|
uInt64 getDblclickInterval();
|
||||||
|
@ -459,7 +459,7 @@ class FMouseControl
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
virtual const FString getClassName() const;
|
virtual const FString getClassName() const;
|
||||||
FPoint& getPos();
|
const FPoint& getPos();
|
||||||
void clearEvent();
|
void clearEvent();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
|
|
|
@ -260,7 +260,7 @@ class FOptiAttr final
|
||||||
static bool hasNoAttribute (const FChar* const&);
|
static bool hasNoAttribute (const FChar* const&);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
bool hasColorChanged (const FChar* const&, const FChar* const&);
|
bool hasColorChanged (const FChar* const&, const FChar* const&) const;
|
||||||
void resetColor (FChar*&);
|
void resetColor (FChar*&);
|
||||||
void prevent_no_color_video_attributes (FChar*&, bool = false);
|
void prevent_no_color_video_attributes (FChar*&, bool = false);
|
||||||
void deactivateAttributes (FChar*&, FChar*&);
|
void deactivateAttributes (FChar*&, FChar*&);
|
||||||
|
@ -272,7 +272,7 @@ class FOptiAttr final
|
||||||
void resetAttribute (FChar*&);
|
void resetAttribute (FChar*&);
|
||||||
void reset (FChar*&);
|
void reset (FChar*&);
|
||||||
bool caused_reset_attributes (const char[], uChar = all_tests);
|
bool caused_reset_attributes (const char[], uChar = all_tests);
|
||||||
bool hasCharsetEquivalence();
|
bool hasCharsetEquivalence() const;
|
||||||
void detectSwitchOn (const FChar* const&, const FChar* const&);
|
void detectSwitchOn (const FChar* const&, const FChar* const&);
|
||||||
void detectSwitchOff (const FChar* const&, const FChar* const&);
|
void detectSwitchOff (const FChar* const&, const FChar* const&);
|
||||||
bool switchOn();
|
bool switchOn();
|
||||||
|
|
|
@ -194,7 +194,7 @@ class FOptiMove final
|
||||||
void rightMove (char[], int&, int, int);
|
void rightMove (char[], int&, int, int);
|
||||||
void leftMove (char[], int&, int, int);
|
void leftMove (char[], int&, int, int);
|
||||||
|
|
||||||
bool isWideMove (int, int, int, int);
|
bool isWideMove (int, int, int, int) const;
|
||||||
bool isMethod0Faster (int&, int, int);
|
bool isMethod0Faster (int&, int, int);
|
||||||
bool isMethod1Faster (int&, int, int, int, int);
|
bool isMethod1Faster (int&, int, int, int, int);
|
||||||
bool isMethod2Faster (int&, int, int, int);
|
bool isMethod2Faster (int&, int, int, int);
|
||||||
|
|
|
@ -92,9 +92,9 @@ class FPoint
|
||||||
// Friend operator functions
|
// Friend operator functions
|
||||||
friend bool operator == (const FPoint&, const FPoint&);
|
friend bool operator == (const FPoint&, const FPoint&);
|
||||||
friend bool operator != (const FPoint&, const FPoint&);
|
friend bool operator != (const FPoint&, const FPoint&);
|
||||||
friend FPoint operator + (const FPoint&, const FPoint&);
|
friend const FPoint operator + (const FPoint&, const FPoint&);
|
||||||
friend FPoint operator - (const FPoint&, const FPoint&);
|
friend const FPoint operator - (const FPoint&, const FPoint&);
|
||||||
friend FPoint operator - (const FPoint&);
|
friend const FPoint operator - (const FPoint&);
|
||||||
friend std::ostream& operator << (std::ostream&, const FPoint&);
|
friend std::ostream& operator << (std::ostream&, const FPoint&);
|
||||||
friend std::istream& operator >> (std::istream&, FPoint&);
|
friend std::istream& operator >> (std::istream&, FPoint&);
|
||||||
};
|
};
|
||||||
|
@ -154,16 +154,16 @@ inline bool operator != (const FPoint& p1, const FPoint& p2)
|
||||||
{ return p1.xpos != p2.xpos || p1.ypos != p2.ypos; }
|
{ return p1.xpos != p2.xpos || p1.ypos != p2.ypos; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FPoint operator + (const FPoint& p1, const FPoint& p2)
|
inline const FPoint operator + (const FPoint& p1, const FPoint& p2)
|
||||||
{ return FPoint(p1.xpos + p2.xpos, p1.ypos + p2.ypos); }
|
{ return {p1.xpos + p2.xpos, p1.ypos + p2.ypos}; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FPoint operator - (const FPoint& p1, const FPoint& p2)
|
inline const FPoint operator - (const FPoint& p1, const FPoint& p2)
|
||||||
{ return FPoint(p1.xpos - p2.xpos, p1.ypos - p2.ypos); }
|
{ return {p1.xpos - p2.xpos, p1.ypos - p2.ypos}; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FPoint operator - (const FPoint& p)
|
inline const FPoint operator - (const FPoint& p)
|
||||||
{ return FPoint(-p.xpos, -p.ypos); }
|
{ return {-p.xpos, -p.ypos}; }
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ class FProgressbar : public FWidget
|
||||||
bool unsetShadow();
|
bool unsetShadow();
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool hasShadow();
|
bool hasShadow() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide() override;
|
void hide() override;
|
||||||
|
@ -123,7 +123,7 @@ inline bool FProgressbar::unsetShadow()
|
||||||
{ return setShadow(false); }
|
{ return setShadow(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FProgressbar::hasShadow()
|
inline bool FProgressbar::hasShadow() const
|
||||||
{ return getFlags().shadow; }
|
{ return getFlags().shadow; }
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -80,14 +80,14 @@ class FRect
|
||||||
int getY2() const;
|
int getY2() const;
|
||||||
int getX() const;
|
int getX() const;
|
||||||
int getY() const;
|
int getY() const;
|
||||||
FPoint getPos() const;
|
const FPoint getPos() const;
|
||||||
FPoint getUpperLeftPos() const;
|
const FPoint getUpperLeftPos() const;
|
||||||
FPoint getUpperRightPos() const;
|
const FPoint getUpperRightPos() const;
|
||||||
FPoint getLowerLeftPos() const;
|
const FPoint getLowerLeftPos() const;
|
||||||
FPoint getLowerRightPos() const;
|
const FPoint getLowerRightPos() const;
|
||||||
std::size_t getWidth() const;
|
std::size_t getWidth() const;
|
||||||
std::size_t getHeight() const;
|
std::size_t getHeight() const;
|
||||||
FSize getSize() const;
|
const FSize getSize() const;
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setX1 (int);
|
void setX1 (int);
|
||||||
|
@ -137,8 +137,8 @@ class FRect
|
||||||
int Y2{-1};
|
int Y2{-1};
|
||||||
|
|
||||||
// Friend operator functions
|
// Friend operator functions
|
||||||
friend FRect operator + (const FRect&, const FSize&);
|
friend const FRect operator + (const FRect&, const FSize&);
|
||||||
friend FRect operator - (const FRect&, const FSize&);
|
friend const FRect operator - (const FRect&, const FSize&);
|
||||||
friend bool operator == (const FRect&, const FRect&);
|
friend bool operator == (const FRect&, const FRect&);
|
||||||
friend bool operator != (const FRect&, const FRect&);
|
friend bool operator != (const FRect&, const FRect&);
|
||||||
friend std::ostream& operator << (std::ostream&, const FRect&);
|
friend std::ostream& operator << (std::ostream&, const FRect&);
|
||||||
|
|
|
@ -115,8 +115,8 @@ class FScrollView : public FWidget
|
||||||
void setVerticalScrollBarMode (fc::scrollBarMode);
|
void setVerticalScrollBarMode (fc::scrollBarMode);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool hasBorder();
|
bool hasBorder() const;
|
||||||
bool isViewportPrint();
|
bool isViewportPrint() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void clearArea (int = ' ') override;
|
void clearArea (int = ' ') override;
|
||||||
|
@ -156,7 +156,7 @@ class FScrollView : public FWidget
|
||||||
static constexpr int horizontal_border_spacing = 2;
|
static constexpr int horizontal_border_spacing = 2;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
FPoint getViewportCursorPos();
|
const FPoint getViewportCursorPos();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init (const FWidget*);
|
void init (const FWidget*);
|
||||||
|
@ -182,7 +182,6 @@ class FScrollView : public FWidget
|
||||||
FScrollbarPtr hbar{nullptr};
|
FScrollbarPtr hbar{nullptr};
|
||||||
keyMap key_map{};
|
keyMap key_map{};
|
||||||
uInt8 nf_offset{0};
|
uInt8 nf_offset{0};
|
||||||
bool border{true};
|
|
||||||
bool use_own_print_area{false};
|
bool use_own_print_area{false};
|
||||||
bool update_scrollbar{true};
|
bool update_scrollbar{true};
|
||||||
fc::scrollBarMode v_mode{fc::Auto}; // fc:Auto, fc::Hidden or fc::Scroll
|
fc::scrollBarMode v_mode{fc::Auto}; // fc:Auto, fc::Hidden or fc::Scroll
|
||||||
|
@ -247,11 +246,11 @@ inline bool FScrollView::unsetBorder()
|
||||||
{ return setBorder(false); }
|
{ return setBorder(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FScrollView::hasBorder()
|
inline bool FScrollView::hasBorder() const
|
||||||
{ return border; }
|
{ return ! getFlags().no_border; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FScrollView::isViewportPrint()
|
inline bool FScrollView::isViewportPrint() const
|
||||||
{ return ! use_own_print_area; }
|
{ return ! use_own_print_area; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -102,8 +102,8 @@ class FSize
|
||||||
friend bool operator != (const FSize&, const FSize&);
|
friend bool operator != (const FSize&, const FSize&);
|
||||||
friend bool operator >= (const FSize&, const FSize&);
|
friend bool operator >= (const FSize&, const FSize&);
|
||||||
friend bool operator > (const FSize&, const FSize&);
|
friend bool operator > (const FSize&, const FSize&);
|
||||||
friend FSize operator + (const FSize&, const FSize&);
|
friend const FSize operator + (const FSize&, const FSize&);
|
||||||
friend FSize operator - (const FSize&, const FSize&);
|
friend const FSize operator - (const FSize&, const FSize&);
|
||||||
|
|
||||||
friend std::ostream& operator << (std::ostream&, const FSize&);
|
friend std::ostream& operator << (std::ostream&, const FSize&);
|
||||||
friend std::istream& operator >> (std::istream&, FSize&);
|
friend std::istream& operator >> (std::istream&, FSize&);
|
||||||
|
@ -179,20 +179,20 @@ inline bool operator > (const FSize& s1, const FSize& s2)
|
||||||
{ return s1.width > s2.width && s1.height > s2.height; }
|
{ return s1.width > s2.width && s1.height > s2.height; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FSize operator + (const FSize& s1, const FSize& s2)
|
inline const FSize operator + (const FSize& s1, const FSize& s2)
|
||||||
{
|
{
|
||||||
constexpr std::size_t max = std::numeric_limits<std::size_t>::max();
|
constexpr std::size_t max = std::numeric_limits<std::size_t>::max();
|
||||||
const std::size_t w = ( s1.width < max - s2.width) ? s1.width + s2.width : max;
|
const std::size_t w = ( s1.width < max - s2.width) ? s1.width + s2.width : max;
|
||||||
const std::size_t h = ( s1.height < max - s2.height) ? s1.height + s2.height : max;
|
const std::size_t h = ( s1.height < max - s2.height) ? s1.height + s2.height : max;
|
||||||
return FSize(w, h);
|
return {w, h};
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FSize operator - (const FSize& s1, const FSize& s2)
|
inline const FSize operator - (const FSize& s1, const FSize& s2)
|
||||||
{
|
{
|
||||||
const std::size_t w = ( s1.width >= s2.width ) ? s1.width - s2.width : 0;
|
const std::size_t w = ( s1.width >= s2.width ) ? s1.width - s2.width : 0;
|
||||||
const std::size_t h = ( s1.height >= s2.height ) ? s1.height - s2.height : 0;
|
const std::size_t h = ( s1.height >= s2.height ) ? s1.height - s2.height : 0;
|
||||||
return FSize(w, h);
|
return {w, h};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -108,7 +108,7 @@ class FSpinBox : public FWidget
|
||||||
void setLabelOrientation (const FLineEdit::label_o);
|
void setLabelOrientation (const FLineEdit::label_o);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool hasShadow();
|
bool hasShadow() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide() override;
|
void hide() override;
|
||||||
|
@ -205,7 +205,7 @@ inline bool FSpinBox::unsetShadow()
|
||||||
{ return setShadow(false); }
|
{ return setShadow(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FSpinBox::hasShadow()
|
inline bool FSpinBox::hasShadow() const
|
||||||
{ return getFlags().shadow; }
|
{ return getFlags().shadow; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -208,7 +208,7 @@ class FStatusBar : public FWindow
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isActivated (int) const;
|
bool isActivated (int) const;
|
||||||
bool hasActivatedKey();
|
bool hasActivatedKey() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void hide() override;
|
void hide() override;
|
||||||
|
|
|
@ -190,8 +190,8 @@ class FString
|
||||||
char* c_str();
|
char* c_str();
|
||||||
const std::string toString() const;
|
const std::string toString() const;
|
||||||
|
|
||||||
FString toLower() const;
|
const FString toLower() const;
|
||||||
FString toUpper() const;
|
const FString toUpper() const;
|
||||||
|
|
||||||
sInt16 toShort() const;
|
sInt16 toShort() const;
|
||||||
uInt16 toUShort() const;
|
uInt16 toUShort() const;
|
||||||
|
@ -202,13 +202,13 @@ class FString
|
||||||
float toFloat() const;
|
float toFloat() const;
|
||||||
double toDouble() const;
|
double toDouble() const;
|
||||||
|
|
||||||
FString ltrim() const;
|
const FString ltrim() const;
|
||||||
FString rtrim() const;
|
const FString rtrim() const;
|
||||||
FString trim() const;
|
const FString trim() const;
|
||||||
|
|
||||||
FString left (std::size_t) const;
|
const FString left (std::size_t) const;
|
||||||
FString right (std::size_t) const;
|
const FString right (std::size_t) const;
|
||||||
FString mid (std::size_t, std::size_t) const;
|
const FString mid (std::size_t, std::size_t) const;
|
||||||
|
|
||||||
FStringList split (const FString&);
|
FStringList split (const FString&);
|
||||||
FString& setString (const FString&);
|
FString& setString (const FString&);
|
||||||
|
@ -227,10 +227,10 @@ class FString
|
||||||
const FString& insert (const FString&, int);
|
const FString& insert (const FString&, int);
|
||||||
const FString& insert (const FString&, std::size_t);
|
const FString& insert (const FString&, std::size_t);
|
||||||
|
|
||||||
FString replace (const FString&, const FString&);
|
const FString replace (const FString&, const FString&);
|
||||||
|
|
||||||
FString replaceControlCodes() const;
|
const FString replaceControlCodes() const;
|
||||||
FString expandTabs (int = 8) const;
|
const FString expandTabs (int = 8) const;
|
||||||
FString removeDel() const;
|
FString removeDel() const;
|
||||||
FString removeBackspaces() const;
|
FString removeBackspaces() const;
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ class FSystem
|
||||||
// Methods
|
// Methods
|
||||||
virtual uChar inPortByte (uShort) = 0;
|
virtual uChar inPortByte (uShort) = 0;
|
||||||
virtual void outPortByte (uChar, uShort) = 0;
|
virtual void outPortByte (uChar, uShort) = 0;
|
||||||
virtual int isTTY (int) = 0;
|
virtual int isTTY (int) const = 0;
|
||||||
virtual int ioctl (int, uLong, ...) = 0;
|
virtual int ioctl (int, uLong, ...) = 0;
|
||||||
virtual int open (const char*, int, ...) = 0;
|
virtual int open (const char*, int, ...) = 0;
|
||||||
virtual int close (int) = 0;
|
virtual int close (int) = 0;
|
||||||
|
|
|
@ -121,7 +121,7 @@ class FSystemImpl : public FSystem
|
||||||
{ }
|
{ }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int isTTY (int fd) override
|
int isTTY (int fd) const override
|
||||||
{
|
{
|
||||||
return ::isatty(fd);
|
return ::isatty(fd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,9 +392,9 @@ bool isReverseNewFontchar (wchar_t);
|
||||||
bool hasFullWidthSupports();
|
bool hasFullWidthSupports();
|
||||||
wchar_t cp437_to_unicode (uChar);
|
wchar_t cp437_to_unicode (uChar);
|
||||||
uChar unicode_to_cp437 (wchar_t);
|
uChar unicode_to_cp437 (wchar_t);
|
||||||
FString getFullWidth (const FString&);
|
const FString getFullWidth (const FString&);
|
||||||
FString getHalfWidth (const FString&);
|
const FString getHalfWidth (const FString&);
|
||||||
FString getColumnSubString (const FString&, std::size_t, std::size_t);
|
const FString getColumnSubString (const FString&, std::size_t, std::size_t);
|
||||||
std::size_t getLengthFromColumnWidth (const FString&, std::size_t);
|
std::size_t getLengthFromColumnWidth (const FString&, std::size_t);
|
||||||
std::size_t getColumnWidth (const FString&, std::size_t);
|
std::size_t getColumnWidth (const FString&, std::size_t);
|
||||||
std::size_t getColumnWidth (const FString&);
|
std::size_t getColumnWidth (const FString&);
|
||||||
|
|
|
@ -96,7 +96,7 @@ class FTermLinux final
|
||||||
const FString getClassName() const;
|
const FString getClassName() const;
|
||||||
fc::linuxConsoleCursorStyle getCursorStyle();
|
fc::linuxConsoleCursorStyle getCursorStyle();
|
||||||
char* getCursorStyleString();
|
char* getCursorStyleString();
|
||||||
int getFramebufferBpp();
|
int getFramebufferBpp() const;
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
bool setCursorStyle (CursorStyle);
|
bool setCursorStyle (CursorStyle);
|
||||||
|
@ -105,8 +105,8 @@ class FTermLinux final
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isLinuxConsole();
|
bool isLinuxConsole();
|
||||||
bool isVGAFontUsed();
|
bool isVGAFontUsed() const;
|
||||||
bool isNewFontUsed();
|
bool isNewFontUsed() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
|
@ -209,15 +209,15 @@ inline const FString FTermLinux::getClassName() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
inline int FTermLinux::getFramebufferBpp()
|
inline int FTermLinux::getFramebufferBpp() const
|
||||||
{ return framebuffer_bpp; }
|
{ return framebuffer_bpp; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTermLinux::isVGAFontUsed()
|
inline bool FTermLinux::isVGAFontUsed() const
|
||||||
{ return vga_font; }
|
{ return vga_font; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTermLinux::isNewFontUsed()
|
inline bool FTermLinux::isNewFontUsed() const
|
||||||
{ return new_font; }
|
{ return new_font; }
|
||||||
#endif // defined(__linux__)
|
#endif // defined(__linux__)
|
||||||
|
|
||||||
|
|
|
@ -81,19 +81,19 @@ class FTermXTerminal final
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const FString getClassName() const;
|
const FString getClassName() const;
|
||||||
fc::xtermCursorStyle getCursorStyle();
|
fc::xtermCursorStyle getCursorStyle() const;
|
||||||
const FString getFont();
|
const FString getFont() const;
|
||||||
const FString getTitle();
|
const FString getTitle() const;
|
||||||
const FString getForeground();
|
const FString getForeground() const;
|
||||||
const FString getBackground();
|
const FString getBackground() const;
|
||||||
const FString getCursorColor();
|
const FString getCursorColor() const;
|
||||||
const FString getMouseForeground();
|
const FString getMouseForeground() const;
|
||||||
const FString getMouseBackground();
|
const FString getMouseBackground() const;
|
||||||
const FString getHighlightBackground();
|
const FString getHighlightBackground() const;
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool hasFont();
|
bool hasFont() const;
|
||||||
bool hasTitle();
|
bool hasTitle() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
|
@ -171,47 +171,47 @@ inline void FTermXTerminal::redefineDefaultColors (bool enable)
|
||||||
{ xterm_default_colors = enable; }
|
{ xterm_default_colors = enable; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline fc::xtermCursorStyle FTermXTerminal::getCursorStyle()
|
inline fc::xtermCursorStyle FTermXTerminal::getCursorStyle() const
|
||||||
{ return cursor_style; }
|
{ return cursor_style; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString FTermXTerminal::getFont()
|
inline const FString FTermXTerminal::getFont() const
|
||||||
{ return xterm_font; }
|
{ return xterm_font; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString FTermXTerminal::getTitle()
|
inline const FString FTermXTerminal::getTitle() const
|
||||||
{ return xterm_title; }
|
{ return xterm_title; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString FTermXTerminal::getForeground()
|
inline const FString FTermXTerminal::getForeground() const
|
||||||
{ return foreground_color; }
|
{ return foreground_color; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString FTermXTerminal::getBackground()
|
inline const FString FTermXTerminal::getBackground() const
|
||||||
{ return background_color; }
|
{ return background_color; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString FTermXTerminal::getCursorColor()
|
inline const FString FTermXTerminal::getCursorColor() const
|
||||||
{ return cursor_color; }
|
{ return cursor_color; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString FTermXTerminal::getMouseForeground()
|
inline const FString FTermXTerminal::getMouseForeground() const
|
||||||
{ return mouse_foreground_color; }
|
{ return mouse_foreground_color; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString FTermXTerminal::getMouseBackground()
|
inline const FString FTermXTerminal::getMouseBackground() const
|
||||||
{ return mouse_background_color; }
|
{ return mouse_background_color; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString FTermXTerminal::getHighlightBackground()
|
inline const FString FTermXTerminal::getHighlightBackground() const
|
||||||
{ return highlight_background_color; }
|
{ return highlight_background_color; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTermXTerminal::hasFont()
|
inline bool FTermXTerminal::hasFont() const
|
||||||
{ return bool(xterm_font.getLength() > 2); }
|
{ return bool(xterm_font.getLength() > 2); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTermXTerminal::hasTitle()
|
inline bool FTermXTerminal::hasTitle() const
|
||||||
{ return bool(xterm_title.getLength() > 0); }
|
{ return bool(xterm_title.getLength() > 0); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -102,7 +102,7 @@ class FToggleButton : public FWidget
|
||||||
virtual void setText (const FString&);
|
virtual void setText (const FString&);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isChecked();
|
bool isChecked() const;
|
||||||
|
|
||||||
// Method
|
// Method
|
||||||
void hide() override;
|
void hide() override;
|
||||||
|
@ -208,7 +208,7 @@ inline bool FToggleButton::unsetChecked()
|
||||||
{ return setChecked(false); }
|
{ return setChecked(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FToggleButton::isChecked()
|
inline bool FToggleButton::isChecked() const
|
||||||
{ return checked; }
|
{ return checked; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -146,8 +146,8 @@ class FVTerm
|
||||||
static FColor getTermBackgroundColor();
|
static FColor getTermBackgroundColor();
|
||||||
FTermArea*& getVWin();
|
FTermArea*& getVWin();
|
||||||
const FTermArea* getVWin() const;
|
const FTermArea* getVWin() const;
|
||||||
FPoint getPrintCursor();
|
const FPoint getPrintCursor();
|
||||||
static FChar getAttribute();
|
static const FChar getAttribute();
|
||||||
static int getMaxColor();
|
static int getMaxColor();
|
||||||
static int getTabstop();
|
static int getTabstop();
|
||||||
static fc::encoding getEncoding();
|
static fc::encoding getEncoding();
|
||||||
|
@ -419,15 +419,15 @@ class FVTerm
|
||||||
, const FPoint& );
|
, const FPoint& );
|
||||||
void updateVTerm();
|
void updateVTerm();
|
||||||
static void callPreprocessingHandler (const FTermArea*);
|
static void callPreprocessingHandler (const FTermArea*);
|
||||||
bool hasChildAreaChanges (FTermArea*);
|
bool hasChildAreaChanges (FTermArea*) const;
|
||||||
void clearChildAreaChanges (const FTermArea*);
|
void clearChildAreaChanges (const FTermArea*);
|
||||||
static bool isInsideArea (const FPoint&, const FTermArea*);
|
static bool isInsideArea (const FPoint&, const FTermArea*);
|
||||||
static FChar generateCharacter (const FPoint&);
|
static const FChar generateCharacter (const FPoint&);
|
||||||
static FChar getCharacter ( character_type
|
static const FChar getCharacter ( character_type
|
||||||
, const FPoint&
|
, const FPoint&
|
||||||
, FVTerm* );
|
, FVTerm* );
|
||||||
static FChar getCoveredCharacter (const FPoint&, FVTerm*);
|
static const FChar getCoveredCharacter (const FPoint&, FVTerm*);
|
||||||
static FChar getOverlappedCharacter (const FPoint&, FVTerm*);
|
static const FChar getOverlappedCharacter (const FPoint&, FVTerm*);
|
||||||
void init (bool);
|
void init (bool);
|
||||||
static void init_characterLengths (const FOptiMove*);
|
static void init_characterLengths (const FOptiMove*);
|
||||||
void finish();
|
void finish();
|
||||||
|
@ -452,8 +452,8 @@ class FVTerm
|
||||||
void skipPaddingCharacter (uInt&, uInt, const FChar* const&);
|
void skipPaddingCharacter (uInt&, uInt, const FChar* const&);
|
||||||
exit_state eraseCharacters (uInt&, uInt, uInt, bool);
|
exit_state eraseCharacters (uInt&, uInt, uInt, bool);
|
||||||
exit_state repeatCharacter (uInt&, uInt, uInt);
|
exit_state repeatCharacter (uInt&, uInt, uInt);
|
||||||
bool isFullWidthChar (const FChar* const&);
|
bool isFullWidthChar (const FChar* const&) const;
|
||||||
bool isFullWidthPaddingChar (const FChar* const&);
|
bool isFullWidthPaddingChar (const FChar* const&) const;
|
||||||
static void cursorWrap();
|
static void cursorWrap();
|
||||||
bool printWrap (FTermArea*);
|
bool printWrap (FTermArea*);
|
||||||
void printPaddingCharacter (FTermArea*, const FChar&);
|
void printPaddingCharacter (FTermArea*, const FChar&);
|
||||||
|
@ -509,37 +509,36 @@ class FVTerm
|
||||||
|
|
||||||
struct FVTerm::FTermArea // define virtual terminal character properties
|
struct FVTerm::FTermArea // define virtual terminal character properties
|
||||||
{
|
{
|
||||||
public:
|
// Constructor
|
||||||
// Constructor
|
FTermArea() = default;
|
||||||
FTermArea() = default;
|
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FTermArea (const FTermArea&) = delete;
|
FTermArea (const FTermArea&) = delete;
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~FTermArea() = default;
|
~FTermArea() = default;
|
||||||
|
|
||||||
// Disable copy assignment operator (=)
|
// Disable copy assignment operator (=)
|
||||||
FTermArea& operator = (const FTermArea&) = delete;
|
FTermArea& operator = (const FTermArea&) = delete;
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
int offset_left{0}; // Distance from left terminal side
|
int offset_left{0}; // Distance from left terminal side
|
||||||
int offset_top{0}; // Distance from top of the terminal
|
int offset_top{0}; // Distance from top of the terminal
|
||||||
int width{-1}; // Window width
|
int width{-1}; // Window width
|
||||||
int height{-1}; // Window height
|
int height{-1}; // Window height
|
||||||
int right_shadow{0}; // Right window shadow
|
int right_shadow{0}; // Right window shadow
|
||||||
int bottom_shadow{0}; // Bottom window shadow
|
int bottom_shadow{0}; // Bottom window shadow
|
||||||
int cursor_x{0}; // X-position for the next write operation
|
int cursor_x{0}; // X-position for the next write operation
|
||||||
int cursor_y{0}; // Y-position for the next write operation
|
int cursor_y{0}; // Y-position for the next write operation
|
||||||
int input_cursor_x{-1}; // X-position input cursor
|
int input_cursor_x{-1}; // X-position input cursor
|
||||||
int input_cursor_y{-1}; // Y-position input cursor
|
int input_cursor_y{-1}; // Y-position input cursor
|
||||||
FWidget* widget{nullptr}; // Widget that owns this FTermArea
|
FWidget* widget{nullptr}; // Widget that owns this FTermArea
|
||||||
FPreprocessing preproc_list{};
|
FPreprocessing preproc_list{};
|
||||||
FLineChanges* changes{nullptr};
|
FLineChanges* changes{nullptr};
|
||||||
FChar* data{nullptr}; // FChar data of the drawing area
|
FChar* data{nullptr}; // FChar data of the drawing area
|
||||||
bool input_cursor_visible{false};
|
bool input_cursor_visible{false};
|
||||||
bool has_changes{false};
|
bool has_changes{false};
|
||||||
bool visible{false};
|
bool visible{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -675,7 +674,7 @@ inline const FVTerm::FTermArea* FVTerm::getVWin() const
|
||||||
{ return vwin; }
|
{ return vwin; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FChar FVTerm::getAttribute()
|
inline const FChar FVTerm::getAttribute()
|
||||||
{ return next_attribute; }
|
{ return next_attribute; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -692,11 +691,17 @@ inline fc::encoding FVTerm::getEncoding()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline std::string FVTerm::getEncodingString()
|
inline std::string FVTerm::getEncodingString()
|
||||||
{ return FTerm::getEncodingString(); }
|
{
|
||||||
|
const std::string& enc_str = FTerm::getEncodingString(); // init enc_str
|
||||||
|
return enc_str;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString FVTerm::getKeyName (FKey keynum)
|
inline const FString FVTerm::getKeyName (FKey keynum)
|
||||||
{ return FTerm::getKeyName(keynum); }
|
{
|
||||||
|
const FString& name = FTerm::getKeyName(keynum); // initialize name
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const char* FVTerm::getTermType()
|
inline const char* FVTerm::getTermType()
|
||||||
|
|
|
@ -231,8 +231,8 @@ class FWidget : public FVTerm, public FObject
|
||||||
std::size_t getDesktopWidth();
|
std::size_t getDesktopWidth();
|
||||||
std::size_t getDesktopHeight();
|
std::size_t getDesktopHeight();
|
||||||
const FWidgetFlags& getFlags() const;
|
const FWidgetFlags& getFlags() const;
|
||||||
FPoint getCursorPos();
|
const FPoint getCursorPos();
|
||||||
FPoint getPrintPos();
|
const FPoint getPrintPos();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
static void setMainWidget (FWidget*);
|
static void setMainWidget (FWidget*);
|
||||||
|
@ -306,7 +306,7 @@ class FWidget : public FVTerm, public FObject
|
||||||
bool hasVisibleCursor() const;
|
bool hasVisibleCursor() const;
|
||||||
bool hasFocus() const;
|
bool hasFocus() const;
|
||||||
bool acceptFocus() const; // is focusable
|
bool acceptFocus() const; // is focusable
|
||||||
bool isPaddingIgnored();
|
bool isPaddingIgnored() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
FWidget* childWidgetAt (const FPoint&);
|
FWidget* childWidgetAt (const FPoint&);
|
||||||
|
@ -334,7 +334,7 @@ class FWidget : public FVTerm, public FObject
|
||||||
virtual void hide();
|
virtual void hide();
|
||||||
virtual bool focusFirstChild(); // widget focusing
|
virtual bool focusFirstChild(); // widget focusing
|
||||||
virtual bool focusLastChild();
|
virtual bool focusLastChild();
|
||||||
FPoint termToWidgetPos (const FPoint&);
|
const FPoint termToWidgetPos (const FPoint&);
|
||||||
void print (const FPoint&) override;
|
void print (const FPoint&) override;
|
||||||
virtual void move (const FPoint&);
|
virtual void move (const FPoint&);
|
||||||
virtual void drawBorder();
|
virtual void drawBorder();
|
||||||
|
@ -675,7 +675,10 @@ inline int FWidget::getY() const // y-position relative to the widget
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FPoint FWidget::getPos() const // position relative to the widget
|
inline const FPoint FWidget::getPos() const // position relative to the widget
|
||||||
{ return adjust_wsize.getPos(); }
|
{
|
||||||
|
const FPoint& pos = adjust_wsize.getPos(); // initialize pos
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getTermX() const // x-position on terminal
|
inline int FWidget::getTermX() const // x-position on terminal
|
||||||
|
@ -687,7 +690,7 @@ inline int FWidget::getTermY() const // y-position on terminal
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FPoint FWidget::getTermPos() const // position on terminal
|
inline const FPoint FWidget::getTermPos() const // position on terminal
|
||||||
{ return FPoint(getTermX(), getTermY()); }
|
{ return {getTermX(), getTermY()}; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline std::size_t FWidget::getWidth() const
|
inline std::size_t FWidget::getWidth() const
|
||||||
|
@ -699,7 +702,10 @@ inline std::size_t FWidget::getHeight() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FSize FWidget::getSize() const
|
inline const FSize FWidget::getSize() const
|
||||||
{ return adjust_wsize.getSize(); }
|
{
|
||||||
|
const FSize& size = adjust_wsize.getSize(); // initialize size
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getTopPadding() const
|
inline int FWidget::getTopPadding() const
|
||||||
|
@ -727,7 +733,10 @@ inline std::size_t FWidget::getClientHeight() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FSize FWidget::getClientSize() const
|
inline const FSize FWidget::getClientSize() const
|
||||||
{ return wclient_offset.getSize(); }
|
{
|
||||||
|
const FSize& size = wclient_offset.getSize(); // initialize size
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline std::size_t FWidget::getMaxWidth() const
|
inline std::size_t FWidget::getMaxWidth() const
|
||||||
|
@ -800,7 +809,7 @@ inline const FWidget::FWidgetFlags& FWidget::getFlags() const
|
||||||
{ return flags; }
|
{ return flags; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FPoint FWidget::getCursorPos()
|
inline const FPoint FWidget::getCursorPos()
|
||||||
{ return widget_cursor_position; }
|
{ return widget_cursor_position; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -971,7 +980,7 @@ inline void FWidget::setFixedSize (const FSize& size)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::unsetCursorPos()
|
inline void FWidget::unsetCursorPos()
|
||||||
{ setCursorPos (FPoint(-1, -1)); }
|
{ setCursorPos ({-1, -1}); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::unsetDoubleFlatLine (fc::sides side)
|
inline void FWidget::unsetDoubleFlatLine (fc::sides side)
|
||||||
|
@ -1026,7 +1035,7 @@ inline bool FWidget::acceptFocus() const // is focusable
|
||||||
{ return flags.focusable; }
|
{ return flags.focusable; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FWidget::isPaddingIgnored()
|
inline bool FWidget::isPaddingIgnored() const
|
||||||
{ return ignore_padding; }
|
{ return ignore_padding; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1042,10 +1051,10 @@ inline void FWidget::delAccelerator()
|
||||||
{ delAccelerator(this); }
|
{ delAccelerator(this); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FPoint FWidget::termToWidgetPos (const FPoint& tPos)
|
inline const FPoint FWidget::termToWidgetPos (const FPoint& tPos)
|
||||||
{
|
{
|
||||||
return FPoint ( tPos.getX() + 1 - woffset.getX1() - adjust_wsize.getX()
|
return { tPos.getX() + 1 - woffset.getX1() - adjust_wsize.getX()
|
||||||
, tPos.getY() + 1 - woffset.getY1() - adjust_wsize.getY() );
|
, tPos.getY() + 1 - woffset.getY1() - adjust_wsize.getY() };
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1057,7 +1066,7 @@ inline void FWidget::print (const FPoint& pos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::drawBorder()
|
inline void FWidget::drawBorder()
|
||||||
{
|
{
|
||||||
finalcut::drawBorder (this, FRect(FPoint(1, 1), getSize()));
|
finalcut::drawBorder (this, FRect(FPoint{1, 1}, getSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* This file is part of the Final Cut widget toolkit *
|
||||||
* *
|
* *
|
||||||
* Copyright 2018-2019 Markus Gans *
|
* Copyright 2018-2020 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 *
|
||||||
|
@ -59,7 +59,7 @@ class FMouse_protected : public finalcut::FMouse
|
||||||
return finalcut::FMouse::getMaxHeight();
|
return finalcut::FMouse::getMaxHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
finalcut::FPoint& getNewMousePosition()
|
const finalcut::FPoint& getNewMousePosition()
|
||||||
{
|
{
|
||||||
return finalcut::FMouse::getNewPos();
|
return finalcut::FMouse::getNewPos();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 2019 Markus Gans *
|
* Copyright 2019-2020 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 *
|
||||||
|
@ -54,7 +54,7 @@ class FSystemTest : public finalcut::FSystem
|
||||||
// Methods
|
// Methods
|
||||||
uChar inPortByte (uShort) override;
|
uChar inPortByte (uShort) override;
|
||||||
void outPortByte (uChar, uShort) override;
|
void outPortByte (uChar, uShort) override;
|
||||||
int isTTY (int) override;
|
int isTTY (int) const override;
|
||||||
int ioctl (int, uLong, ...) override;
|
int ioctl (int, uLong, ...) override;
|
||||||
int open (const char*, int, ...) override;
|
int open (const char*, int, ...) override;
|
||||||
int close (int) override;
|
int close (int) override;
|
||||||
|
@ -392,7 +392,7 @@ void FSystemTest::outPortByte (uChar, uShort)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FSystemTest::isTTY (int fd)
|
int FSystemTest::isTTY (int fd) const
|
||||||
{
|
{
|
||||||
std::cerr << "Call: isatty (fd=" << fd << ")\n";
|
std::cerr << "Call: isatty (fd=" << fd << ")\n";
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue