const type qualifiers and list initialization

This commit is contained in:
Markus Gans 2020-05-02 00:07:35 +02:00
parent 0fd6439f5a
commit a90cd1ad55
103 changed files with 1182 additions and 1117 deletions

View File

@ -67,7 +67,7 @@ class SegmentView final : public finalcut::FDialog
// Data members
std::map<wchar_t, sevenSegment> code{};
finalcut::FString line[3];
finalcut::FString line[3]{};
finalcut::FLineEdit Input{"0123", this};
finalcut::FButton Exit{"E&xit", this};
};
@ -80,13 +80,13 @@ SegmentView::SegmentView (finalcut::FWidget* parent)
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FDialog::setText ("Seven-segment display");
FDialog::setGeometry (FPoint(25, 5), FSize(42, 15));
FDialog::setGeometry (FPoint{25, 5}, FSize{42, 15});
// Set encoding
hexEncoding();
// 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-digits or (.) (:) (H) (L) (P) (U)");
Input.setLabelOrientation(finalcut::FLineEdit::label_above);
@ -94,7 +94,7 @@ SegmentView::SegmentView (finalcut::FWidget* parent)
Input.setInputFilter("[:.hHlLpPuU[:xdigit:]]");
// Exit button
Exit.setGeometry(FPoint(28, 11), FSize(10, 1));
Exit.setGeometry(FPoint{28, 11}, FSize{10, 1});
// Add some function callbacks
Input.addCallback
@ -203,11 +203,11 @@ void SegmentView::draw()
FDialog::draw();
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())
{
const FColorPair color(fc::LightRed, fc::Black);
const FColorPair color{fc::LightRed, fc::Black};
get7Segment(ch);
for (std::size_t i{0}; i < 3; i++)
@ -219,10 +219,10 @@ void SegmentView::draw()
if ( length < 36 )
left_space << finalcut::FString(36 - length, ' ');
print() << FPoint (4, 7) << left_space << tbuffer[0]
<< FPoint (4, 8) << left_space << tbuffer[1]
<< FPoint (4, 9) << left_space << tbuffer[2]
<< FPoint (4, 10) << finalcut::FString(36, ' ');
print() << FPoint {4, 7} << left_space << tbuffer[0]
<< FPoint {4, 8} << left_space << tbuffer[1]
<< FPoint {4, 9} << left_space << tbuffer[2]
<< FPoint {4, 10} << finalcut::FString{36, ' '};
}

View File

@ -98,10 +98,10 @@ Background::Background (finalcut::FWidget* parent)
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FDialog::setText ("Background color palette");
FDialog::setGeometry (FPoint(25, 5), FSize(32, 12));
FDialog::setGeometry (FPoint{25, 5}, FSize{32, 12});
// 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.setLabelText ("Color choice");
color_choice.unsetEditable();
@ -114,19 +114,19 @@ Background::Background (finalcut::FWidget* parent)
}
// 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.setLabelText ("Red");
red.setRange (0, 255);
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.setLabelText ("Green");
green.setRange (0, 255);
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.setLabelText ("Blue");
blue.setRange (0, 255);
@ -142,7 +142,7 @@ Background::Background (finalcut::FWidget* parent)
}
// Quit button
quit.setGeometry(FPoint(19, 8), FSize(10, 1));
quit.setGeometry(FPoint{19, 8}, FSize{10, 1});
// Add some function callbacks
quit.addCallback

View File

@ -251,7 +251,7 @@ Calc::Calc (FWidget* parent)
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FDialog::setText ("Calculator");
FDialog::setGeometry (FPoint(19, 6), FSize(37, 18));
FDialog::setGeometry (FPoint{19, 6}, FSize{37, 18});
mapKeyFunctions();
clearInfixOperator();
@ -263,13 +263,13 @@ Calc::Calc (FWidget* parent)
button_no[key] = key;
if ( key == Equals )
btn->setGeometry(FPoint(30, 15), FSize(5, 3));
btn->setGeometry(FPoint{30, 15}, FSize{5, 3});
else
{
const std::size_t n = ( key <= Three ) ? 0 : 1;
const int x = int(key + n) % 5 * 7 + 2;
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();
@ -398,7 +398,7 @@ void Calc::cb_buttonClicked (const finalcut::FWidget*, FDataPtr data)
//----------------------------------------------------------------------
void Calc::drawDispay()
{
finalcut::FString display(input);
finalcut::FString display{input};
if ( display.isNull() || display.isEmpty() )
display = L'0';
@ -410,7 +410,7 @@ void Calc::drawDispay()
display = display.left(display.getLength() - 1);
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 )
display = display.left(max_char);
@ -425,9 +425,9 @@ void Calc::drawDispay()
setReverse(false);
const auto& wc = getFWidgetColors();
print() << FColorPair(fc::Black, fc::LightGray)
<< FPoint(3, 3) << display << ' '
<< FColorPair(wc.dialog_fg, wc.dialog_bg);
print() << FColorPair{fc::Black, fc::LightGray}
<< FPoint{3, 3} << display << ' '
<< FColorPair{wc.dialog_fg, wc.dialog_bg};
if ( isMonochron() )
setReverse(true);
@ -439,12 +439,12 @@ void Calc::drawDispay()
const wchar_t top_line {fc::NF_border_line_upper};
const wchar_t right_line {fc::NF_rev_border_line_right};
const wchar_t left_line {fc::NF_border_line_left};
print() << FPoint(3, 2) << finalcut::FString(33, bottom_line);
print() << FPoint(2, 3) << right_line;
print() << FPoint(36, 3) << left_line;
print() << FPoint(3, 4);
const finalcut::FString top_bottom_line_5 (5, top_bottom_line);
const finalcut::FString top_line_2 (2, top_line);
print() << FPoint{3, 2} << finalcut::FString{33, bottom_line};
print() << FPoint{2, 3} << right_line;
print() << FPoint{36, 3} << left_line;
print() << FPoint{3, 4};
const finalcut::FString top_bottom_line_5 {5, top_bottom_line};
const finalcut::FString top_line_2 {2, top_line};
print ( 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 horizontal {fc::BoxDrawingsHorizontal};
const wchar_t vertical_and_left {fc::BoxDrawingsVerticalAndLeft};
finalcut::FString separator ( finalcut::FString(vertical_and_right)
+ finalcut::FString(35, horizontal)
+ finalcut::FString(vertical_and_left) );
print() << FPoint(1, 4) << separator;
finalcut::FString separator ( finalcut::FString{vertical_and_right}
+ finalcut::FString{35, horizontal}
+ finalcut::FString{vertical_and_left} );
print() << FPoint{1, 4} << separator;
}
}

View File

@ -80,12 +80,12 @@ CheckList::CheckList (finalcut::FWidget* parent)
// (CERT, OOP50-CPP)
FDialog::setText (L"Shopping list");
const std::size_t nf_offset = ( isNewFont() ) ? 1 : 0;
FDialog::setGeometry ( FPoint(int(1 + (parent->getWidth() - 28) / 2), 5)
, FSize(28 + nf_offset, 13) );
FDialog::setGeometry ( FPoint{int(1 + (parent->getWidth() - 28) / 2), 5}
, FSize{28 + nf_offset, 13} );
setShadow();
listView.ignorePadding();
listView.setGeometry ( FPoint(1 + int(nf_offset), 2)
, FSize(getWidth() - nf_offset, getHeight() - 1) );
listView.setGeometry ( FPoint{1 + int(nf_offset), 2}
, FSize{getWidth() - nf_offset, getHeight() - 1} );
// Add columns to the view
listView.addColumn ("Item");
@ -96,9 +96,9 @@ CheckList::CheckList (finalcut::FWidget* parent)
listView.setColumnSortType (2, fc::by_name);
// Statusbar at the bottom
finalcut::FString separator;
finalcut::FString separator{};
separator << ' ' << fc::BoxDrawingsVertical << ' ';
listView.setStatusbarMessage ( finalcut::FString()
listView.setStatusbarMessage ( finalcut::FString{}
<< "<Q> exit" << separator
<< "<Space> select an item" << separator
<< "<Enter> see your pick list");
@ -171,7 +171,7 @@ void CheckList::onClose (finalcut::FCloseEvent* ev)
void CheckList::cb_showList (const finalcut::FWidget*, const FDataPtr)
{
auto iter = listView.beginOfList();
finalcut::FString shopping_list;
finalcut::FString shopping_list{};
while ( iter != listView.endOfList() )
{

View File

@ -97,24 +97,24 @@ void preset (std::vector<FRadioButtonPtr>& os)
//----------------------------------------------------------------------
int main (int argc, char* argv[])
{
finalcut::FString label_text("no OS");
finalcut::FString label_text{"no OS"};
// Create the application object
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
{ // Create a simple modal dialog box in this scope
finalcut::FDialog dgl(&app);
finalcut::FDialog dgl{&app};
dgl.setModal();
dgl.setText ("UNIX select");
const std::size_t w{20};
const std::size_t h{13};
const int x = int(app.getDesktopWidth() - w) / 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
finalcut::FButtonGroup checkButtonGroup("choice", &dgl);
checkButtonGroup.setGeometry (FPoint(2, 1), FSize(16, 7));
checkButtonGroup.setGeometry (FPoint{2, 1}, FSize{16, 7});
// Create radio buttons
std::vector<FRadioButtonPtr> os(9);
@ -124,7 +124,7 @@ int main (int argc, char* argv[])
// => checkButtonGroup.setScrollSize(...) is not required
// because a FButtonGroup is self-adjusting
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);
@ -134,7 +134,7 @@ int main (int argc, char* argv[])
// Create a OK button
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
ok.addCallback
@ -160,7 +160,7 @@ int main (int argc, char* argv[])
// Create and show tooltip for two seconds
finalcut::FToolTip tooltip(&app);
finalcut::FToolTip tooltip{&app};
tooltip.setText ("You have chosen " + label_text);
tooltip.show();
sleep(2);

View File

@ -45,32 +45,32 @@ void cb_quit (const finalcut::FWidget*, FDataPtr data)
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
// Create a simple dialog box
finalcut::FDialog dgl(&app);
finalcut::FDialog dgl{&app};
dgl.setText ("FDialog");
dgl.setGeometry (FPoint(4, 3), FSize(41, 11));
dgl.setGeometry (FPoint{4, 3}, FSize{41, 11});
// Create text labels
finalcut::FLabel label_1(&dgl);
finalcut::FLabel label_2(&dgl);
finalcut::FLabel label_1{&dgl};
finalcut::FLabel label_2{&dgl};
label_1 << finalcut::fc::BlackUpPointingTriangle
<< std::wstring(L"\n")
<< std::wstring{L"\n"}
<< finalcut::fc::BoxDrawingsUpAndRight
<< finalcut::FString(2, finalcut::fc::BoxDrawingsHorizontal)
<< finalcut::FString{2, finalcut::fc::BoxDrawingsHorizontal}
<< " Double click the title bar button,";
label_2 << "press Q on the keyboard,\n"
<< "or push the button below to exit\n"
<< "the program.";
label_1.setGeometry (FPoint(1, 1), FSize(38, 2));
label_2.setGeometry (FPoint(5, 3), FSize(34, 3));
label_1.setGeometry (FPoint{1, 1}, FSize{38, 2});
label_2.setGeometry (FPoint{5, 3}, FSize{34, 3});
// Create the quit button
finalcut::FButton btn("&Quit", &dgl);
btn.setGeometry (FPoint(16, 7), FSize(9, 1));
finalcut::FButton btn{"&Quit", &dgl};
btn.setGeometry (FPoint{16, 7}, FSize{9, 1});
// Connect the button signal "clicked" with the callback function
btn.addCallback

View File

@ -34,44 +34,44 @@ using finalcut::FSize;
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
// Create a simple dialog box
finalcut::FDialog dgl(&app);
finalcut::FDialog dgl{&app};
dgl.setText (full("Dialog"));
dgl.setSize (FSize(37, 16));
dgl.setPos (FPoint( int(app.getDesktopWidth() - dgl.getWidth()) / 2
, int(app.getDesktopHeight() - dgl.getHeight()) / 2));
dgl.setSize (FSize{37, 16});
dgl.setPos ({ int(app.getDesktopWidth() - dgl.getWidth()) / 2
, int(app.getDesktopHeight() - dgl.getHeight()) / 2});
dgl.setShadow();
// Create input fields
finalcut::FLineEdit field1 (&dgl);
finalcut::FLineEdit field1 {&dgl};
field1.setLabelText (full("Input"));
field1.setText (L"你好"); // Nǐ hǎo (chinese)
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.setText (full(L"Hello"));
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
finalcut::FButtonGroup group (full("Side"), &dgl);
group.setGeometry(FPoint(2, 5), FSize(32, 3));
finalcut::FButtonGroup group {full("Side"), &dgl};
group.setGeometry(FPoint{2, 5}, FSize{32, 3});
// Create radio buttons
finalcut::FRadioButton left ("&" + full("Left"), &group);
finalcut::FRadioButton right ("&" + full("Right"), &group);
finalcut::FRadioButton left {"&" + full("Left"), &group};
finalcut::FRadioButton right {"&" + full("Right"), &group};
left.setStatusbarMessage (full("Prefer the left side"));
right.setStatusbarMessage (full("Prefer the right side"));
left.setGeometry (FPoint(1, 1), FSize(8, 1));
right.setGeometry (FPoint(15, 1), FSize(10, 1));
left.setGeometry (FPoint{1, 1}, FSize{8, 1});
right.setGeometry (FPoint{15, 1}, FSize{10, 1});
// Create a scrollable text field
finalcut::FTextView scroll_text (&dgl);
scroll_text.setGeometry (FPoint(2, 8), FSize(32, 3));
finalcut::FTextView scroll_text {&dgl};
scroll_text.setGeometry (FPoint{2, 8}, FSize{32, 3});
finalcut::FString text_line{"FINAL CUT supports "
"full-width characters."};
scroll_text << full(text_line);
@ -79,16 +79,16 @@ int main (int argc, char* argv[])
"left with the arrow keys");
// Create a OK button
finalcut::FButton btn("&", &dgl);
finalcut::FButton btn {"&", &dgl};
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
finalcut::FStatusBar sbar(&dgl);
finalcut::FStatusBar sbar {&dgl};
finalcut::FStatusKey key_F1 (finalcut::fc::Fkey_f1, "Info", &sbar);
// Create the menu bar
finalcut::FMenuBar Menubar(&dgl);
finalcut::FMenuBar Menubar {&dgl};
// Create menu bar items
finalcut::FMenu File{L"&", &Menubar};

View File

@ -3,7 +3,7 @@
* *
* 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 *
* modify it under the terms of the GNU Lesser General Public License *
@ -26,10 +26,10 @@
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
// Create a simple dialog box
finalcut::FMessageBox mbox(&app);
finalcut::FMessageBox mbox{&app};
mbox.setText("Hello world");
// Start the application

View File

@ -61,21 +61,21 @@ void cb_publish (finalcut::FWidget* widget, FDataPtr data)
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
// Create a simple dialog box
finalcut::FDialog dgl(&app);
finalcut::FDialog dgl{&app};
dgl.setText ("Data input");
dgl.setGeometry (FPoint(4, 2), FSize(37, 22));
dgl.setGeometry (FPoint{4, 2}, FSize{37, 22});
dgl.setShadow();
// Create input fields
finalcut::FLineEdit name_field (&dgl);
finalcut::FLineEdit pw_field (&dgl);
finalcut::FLineEdit email_field (&dgl);
finalcut::FLineEdit city_field (&dgl);
finalcut::FLineEdit st_field (&dgl);
finalcut::FLineEdit c_field (&dgl);
finalcut::FLineEdit name_field {&dgl};
finalcut::FLineEdit pw_field {&dgl};
finalcut::FLineEdit email_field {&dgl};
finalcut::FLineEdit city_field {&dgl};
finalcut::FLineEdit st_field {&dgl};
finalcut::FLineEdit c_field {&dgl};
// Set input type to password
pw_field.setInputType (finalcut::FLineEdit::password);
@ -87,37 +87,37 @@ int main (int argc, char* argv[])
st_field.setLabelText (L"&State");
c_field.setLabelText (L"&Country");
name_field.setGeometry (FPoint(11, 1), FSize(23, 1));
pw_field.setGeometry (FPoint(11, 3), FSize(23, 1));
email_field.setGeometry (FPoint(11, 5), FSize(23, 1));
city_field.setGeometry (FPoint(11, 7), FSize(23, 1));
st_field.setGeometry (FPoint(11, 9), FSize(23, 1));
c_field.setGeometry (FPoint(11, 11), FSize(4, 1));
name_field.setGeometry (FPoint{11, 1}, FSize{23, 1});
pw_field.setGeometry (FPoint{11, 3}, FSize{23, 1});
email_field.setGeometry (FPoint{11, 5}, FSize{23, 1});
city_field.setGeometry (FPoint{11, 7}, FSize{23, 1});
st_field.setGeometry (FPoint{11, 9}, FSize{23, 1});
c_field.setGeometry (FPoint{11, 11}, FSize{4, 1});
// Create the button group
finalcut::FButtonGroup radioButtonGroup ("Sex", &dgl);
radioButtonGroup.setGeometry(FPoint(2, 13), FSize(13, 4));
finalcut::FButtonGroup radioButtonGroup {"Sex", &dgl};
radioButtonGroup.setGeometry(FPoint{2, 13}, FSize{13, 4});
// Create radio buttons
finalcut::FRadioButton male ("&Male", &radioButtonGroup);
finalcut::FRadioButton female ("&Female", &radioButtonGroup);
male.setGeometry (FPoint(1, 1), FSize(8, 1));
female.setGeometry (FPoint(1, 2), FSize(10, 1));
finalcut::FRadioButton male {"&Male", &radioButtonGroup};
finalcut::FRadioButton female {"&Female", &radioButtonGroup};
male.setGeometry (FPoint{1, 1}, FSize{8, 1});
female.setGeometry (FPoint{1, 2}, FSize{10, 1});
// Create another button group
finalcut::FButtonGroup checkButtonGroup ("&Data options", &dgl);
checkButtonGroup.setGeometry(FPoint(16, 13), FSize(19, 4));
finalcut::FButtonGroup checkButtonGroup {"&Data options", &dgl};
checkButtonGroup.setGeometry(FPoint{16, 13}, FSize{19, 4});
// Create checkbox buttons
finalcut::FCheckBox check1 ("Save data", &checkButtonGroup);
finalcut::FCheckBox check2 ("Encrypt data", &checkButtonGroup);
check1.setGeometry (FPoint(1, 1), FSize(13, 1));
check2.setGeometry (FPoint(1, 2), FSize(16, 1));
finalcut::FCheckBox check1 {"Save data", &checkButtonGroup};
finalcut::FCheckBox check2 {"Encrypt data", &checkButtonGroup};
check1.setGeometry (FPoint{1, 1}, FSize{13, 1});
check2.setGeometry (FPoint{1, 2}, FSize{16, 1});
check2.setDisable();
// Create a OK button
finalcut::FButton btn("&OK", &dgl);
btn.setGeometry (FPoint(24, 18), FSize(10, 1));
finalcut::FButton btn {"&OK", &dgl};
btn.setGeometry (FPoint{24, 18}, FSize{10, 1});
// Connect checkbox signal "clicked" with a callback function
check1.addCallback

View File

@ -68,8 +68,7 @@ void Keyboard::onKeyPress (finalcut::FKeyEvent* ev)
if ( is_last_line )
scrollAreaForward (getVirtualDesktop());
setAreaCursor ( finalcut::FPoint(1, getPrintPos().getY())
, true, getVirtualDesktop() );
setAreaCursor ({1, getPrintPos().getY()}, true, getVirtualDesktop());
}
//----------------------------------------------------------------------
@ -82,11 +81,11 @@ void Keyboard::onAccel (finalcut::FAccelEvent* ev)
//----------------------------------------------------------------------
void Keyboard::draw()
{
print() << finalcut::FPoint(1, 1)
print() << finalcut::FPoint{1, 1}
<< "---------------\n"
<< "Press Q to quit\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[])
{
// Create the application object
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
app.setForegroundColor(finalcut::fc::Default);
app.setBackgroundColor(finalcut::fc::Default);
// Create a keyboard object
Keyboard key(&app);
Keyboard key{&app};
key.addAccelerator('q');
// Set the keyboard object as main widget

View File

@ -112,18 +112,18 @@ Listbox::Listbox (FWidget* parent)
// listbox 1
//----------
list1.setGeometry(FPoint(2, 1), FSize(18, 10));
list1.setGeometry(FPoint{2, 1}, FSize{18, 10});
list1.setText ("FListBoxItem");
for (int i{1}; i < 30; i++)
list1.insert (L"----- " + (FString() << i) + L" -----");
list1.insert (L"----- " + (FString{} << i) + L" -----");
// listbox 2
//----------
for (int i{1}; i <= 15; i++)
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");
//
@ -146,11 +146,11 @@ Listbox::Listbox (FWidget* parent)
TLD["gov"] = "Government";
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");
// Quit button
Quit.setGeometry(FPoint(42, 12), FSize(10, 1));
Quit.setGeometry(FPoint{42, 12}, FSize{10, 1});
Quit.setText (L"&Quit");
// Add quit button function callback
@ -184,8 +184,8 @@ int main (int argc, char* argv[])
// Create main dialog object
Listbox d(&app);
d.setText (L"Listbox");
d.setGeometry ( FPoint(int(1 + (app.getWidth() - 56) / 2), 5)
, FSize(56, 16) );
d.setGeometry ( FPoint{int(1 + (app.getWidth() - 56) / 2), 5}
, FSize{56, 16} );
d.setShadow();
// Set dialog d as main widget

View File

@ -71,7 +71,7 @@ Listview::Listview (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
{
// Set FListView geometry
listView.setGeometry(FPoint(2, 1), FSize(33, 14));
listView.setGeometry(FPoint{2, 1}, FSize{33, 14});
// Add columns to the view
listView.addColumn ("City");
@ -104,7 +104,7 @@ Listview::Listview (finalcut::FWidget* parent)
populate();
// Quit button
Quit.setGeometry(FPoint(24, 16), FSize(10, 1));
Quit.setGeometry(FPoint{24, 16}, FSize{10, 1});
Quit.setText (L"&Quit");
// Add some function callbacks
@ -212,8 +212,8 @@ int main (int argc, char* argv[])
// Create main dialog object
Listview d(&app);
d.setText (L"Weather data");
d.setGeometry ( FPoint(int(1 + (app.getWidth() - 37) / 2), 3)
, FSize(37, 20) );
d.setGeometry ( FPoint{int(1 + (app.getWidth() - 37) / 2), 3}
, FSize{37, 20} );
d.setShadow();
// Set dialog d as main widget

View File

@ -89,7 +89,7 @@ void Mandelbrot::draw()
while ( y0 < y_max && current_line < Lines )
{
current_line++;
print() << FPoint(xoffset, yoffset + current_line);
print() << FPoint{xoffset, yoffset + current_line};
double x0 = x_min;
while ( x0 < x_max )
@ -152,7 +152,7 @@ void Mandelbrot::adjustSize()
if ( w > 10 )
w -= 10;
setGeometry(FPoint(6, 1), FSize(w, h), false);
setGeometry(FPoint{6, 1}, FSize{w, h}, false);
finalcut::FDialog::adjustSize();
}
@ -162,11 +162,11 @@ void Mandelbrot::adjustSize()
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
// Create a simple dialog box
Mandelbrot mb(&app);
mb.setGeometry (FPoint(6, 1), FSize(70, 23));
Mandelbrot mb{&app};
mb.setGeometry (FPoint{6, 1}, FSize{70, 23});
mb.setShadow();
// Set the mandelbrot object as main widget

View File

@ -140,19 +140,19 @@ Menu::Menu (finalcut::FWidget* parent)
// Headline labels
Headline1 << " Key ";
Headline1.ignorePadding();
Headline1.setGeometry(FPoint(3, 2), FSize(5, 1));
Headline1.setGeometry(FPoint{3, 2}, FSize{5, 1});
Headline1.setEmphasis();
Headline2 << " Function ";
Headline2.ignorePadding();
Headline2.setGeometry(FPoint(19, 2), FSize(10, 1));
Headline2.setGeometry(FPoint{19, 2}, FSize{10, 1});
Headline2.setEmphasis();
// Info label
Info << "<F10> Activate menu bar\n"
<< "<Ctrl>+<Space> Activate menu bar\n"
<< "<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[])
{
// Create the application object
finalcut::FApplication app (argc, argv);
finalcut::FApplication app {argc, argv};
// Create main dialog object
Menu main_dlg (&app);
Menu main_dlg {&app};
main_dlg.setText ("Menu example");
main_dlg.setGeometry ( FPoint(int(1 + (app.getWidth() - 40) / 2), 2)
, FSize(40, 6) );
main_dlg.setGeometry ( FPoint{int(1 + (app.getWidth() - 40) / 2), 2}
, FSize{40, 6} );
main_dlg.setShadow();
// Set dialog main_dlg as main widget

View File

@ -74,8 +74,8 @@ class ColorChooser final : public finalcut::FWidget
ColorChooser::ColorChooser (finalcut::FWidget* parent)
: FWidget(parent)
{
FWidget::setSize (FSize(8, 12));
setFixedSize (FSize(8, 12));
FWidget::setSize (FSize{8, 12});
setFixedSize (FSize{8, 12});
unsetFocusable();
if ( parent )
@ -89,7 +89,7 @@ ColorChooser::ColorChooser (finalcut::FWidget* parent)
}
// Text label
headline.setGeometry (FPoint(1, 1), FSize(8, 1));
headline.setGeometry (FPoint{1, 1}, FSize{8, 1});
headline.setEmphasis();
headline.setAlignment (fc::alignCenter);
headline << "Color";
@ -127,7 +127,7 @@ void ColorChooser::draw()
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 )
setColor (fc::LightGray, c);
@ -148,7 +148,7 @@ void ColorChooser::draw()
//----------------------------------------------------------------------
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)
: FWidget(parent)
{
FWidget::setSize (FSize(8, 4));
setFixedSize (FSize(8, 4));
FWidget::setSize (FSize{8, 4});
setFixedSize (FSize{8, 4});
unsetFocusable();
if ( parent )
@ -243,7 +243,7 @@ Brushes::Brushes (finalcut::FWidget* parent)
}
// Text label
headline.setGeometry(FPoint(1, 1), FSize(8, 1));
headline.setGeometry(FPoint{1, 1}, FSize{8, 1});
headline.setEmphasis();
headline.setAlignment (fc::alignCenter);
headline << "Brush";
@ -267,24 +267,24 @@ void Brushes::draw()
int pos{0};
setColor();
drawBorder();
print() << FPoint(2, 3)
<< FColorPair(fg_color, bg_color) << " "
<< finalcut::FString(3, fc::MediumShade);
print() << FPoint{2, 3}
<< FColorPair{fg_color, bg_color} << " "
<< finalcut::FString{3, fc::MediumShade};
if ( brush != L' ' )
pos = 3;
setColor();
print() << FPoint(3 + pos, 2)
print() << FPoint{3 + pos, 2}
<< fc::BlackDownPointingTriangle
<< FPoint(3 + pos, 4)
<< FPoint{3 + pos, 4}
<< fc::BlackUpPointingTriangle;
}
//----------------------------------------------------------------------
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)
{
FDialog::setText ("Drawing with the mouse");
c_chooser.setPos (FPoint(1, 1));
c_chooser.setPos (FPoint{1, 1});
c_chooser.addCallback
(
"clicked",
F_METHOD_CALLBACK (this, &MouseDraw::cb_colorChanged)
);
brush.setPos (FPoint(1, 12));
brush.setPos (FPoint{1, 12});
FSize no_shadow(0, 0);
finalcut::FRect scroll_geometry(0, 0, 1, 1);
FSize no_shadow{0, 0};
finalcut::FRect scroll_geometry{0, 0, 1, 1};
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);
const std::size_t w = s.getWidth();
const std::size_t h = s.getHeight();
const finalcut::FRect scroll_geometry (FPoint(0, 0), FSize(w - 11, h - 3));
const FSize no_shadow(0, 0);
const finalcut::FRect scroll_geometry (FPoint{0, 0}, FSize{w - 11, h - 3});
const FSize no_shadow{0, 0};
const int old_w = canvas->width;
const int old_h = canvas->height;
resizeArea (scroll_geometry, no_shadow, canvas);
@ -451,24 +451,24 @@ void MouseDraw::draw()
{
for (int y{2}; y < y_max; y++)
{
print() << FPoint(10, y)
print() << FPoint{10, y}
<< fc::NF_rev_border_line_right;
}
print() << FPoint(10, y_max)
print() << FPoint{10, y_max}
<< fc::NF_rev_border_corner_lower_right;
}
else
{
print() << FPoint(10, 2)
print() << FPoint{10, 2}
<< fc::BoxDrawingsDownAndHorizontal;
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;
}
@ -541,7 +541,7 @@ void MouseDraw::adjustSize()
const std::size_t h{18};
const int x = 1 + int((getParentWidget()->getWidth() - w) / 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();
}
@ -588,11 +588,11 @@ void MouseDraw::cb_colorChanged (const finalcut::FWidget*, const FDataPtr)
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
// Create a simple dialog box
MouseDraw mouse_draw(&app);
mouse_draw.setGeometry (FPoint(12, 4), FSize(60, 18));
MouseDraw mouse_draw{&app};
mouse_draw.setGeometry (FPoint{12, 4}, FSize{60, 18});
// Set dialog object mouse_draw as main widget
finalcut::FWidget::setMainWidget(&mouse_draw);

View File

@ -139,7 +139,7 @@ void move (int xold, int yold, int xnew, int ynew)
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication TermApp(argc, argv);
finalcut::FApplication TermApp{argc, argv};
// Pointer to the global virtual terminal object
app = &TermApp;
@ -147,7 +147,7 @@ int main (int argc, char* argv[])
// Get screen dimension
int xmax = int(TermApp.getDesktopWidth() - 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
TermApp.setTermXY(0, 0);

View File

@ -153,18 +153,18 @@ void RotoZoomer::rotozoomer (double cx, double cy, double r, double a)
{
Cx = Ax;
Cy = Ay;
print() << FPoint(2, 3 + y);
print() << FPoint{2, 3 + y};
for (int x = 0; x < Cols; x++)
{
wchar_t ch = data[((Cy >> 14) & 0xf) + ((Cx >> 10) & 0xf0)];
if ( ch == '+' )
print() << finalcut::FColorPair(fc::Black, fc::Red);
print() << finalcut::FColorPair{fc::Black, fc::Red};
else if ( ch == 'x' )
print() << finalcut::FColorPair(fc::Black, fc::Cyan);
print() << finalcut::FColorPair{fc::Black, fc::Cyan};
else
print() << finalcut::FColorPair(fc::Black, fc::White);
print() << finalcut::FColorPair{fc::Black, fc::White};
print() << ch;
Cx += dxdx;
@ -190,9 +190,9 @@ void RotoZoomer::generateReport()
time_str << double(elapsed_ms) / 1000 << "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"
<< finalcut::FString(55, '-') << "\n"
<< finalcut::FString{55, '-'} << "\n"
<< std::left << std::setw(20) << term_type
<< std::setw(8) << dimension_str
<< std::setw(10) << time_str
@ -276,7 +276,7 @@ void RotoZoomer::adjustSize()
if ( w > 8 )
w -= 8;
setGeometry(FPoint(5, 1), FSize(w, h), false);
setGeometry(FPoint{5, 1}, FSize{w, h}, false);
}
finalcut::FDialog::adjustSize();
@ -292,7 +292,7 @@ int main (int argc, char* argv[])
int quit_code{0};
if ( argv[1] && ( strcmp(argv[1], "--help") == 0
|| strcmp(argv[1], "-h") == 0 ) )
|| strcmp(argv[1], "-h") == 0 ) )
{
std::cout << "RotoZoomer options:\n"
<< " -b, --benchmark "
@ -305,17 +305,17 @@ int main (int argc, char* argv[])
}
{ // Create the application object in this scope
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
app.setNonBlockingRead();
// Create a simple dialog box
constexpr int iterations = 314;
RotoZoomer roto(&app, benchmark, iterations);
RotoZoomer roto{&app, benchmark, iterations};
if ( benchmark )
roto.setGeometry (FPoint(1, 1), FSize(80, 24));
roto.setGeometry (FPoint{1, 1}, FSize{80, 24});
else
roto.setGeometry (FPoint(5, 1), FSize(72, 23));
roto.setGeometry (FPoint{5, 1}, FSize{72, 23});
roto.setShadow();

View File

@ -75,14 +75,14 @@ Scrollview::Scrollview (finalcut::FWidget* parent)
: finalcut::FScrollView(parent)
{
// Sets the navigation button geometry
go_east.setGeometry (FPoint(1, 1), FSize(5, 1));
go_south.setGeometry ( FPoint(int(getScrollWidth()) - 5, 1)
, FSize(5, 1) );
go_west.setGeometry ( FPoint( int(getScrollWidth()) - 5
, int(getScrollHeight()) - 2 )
, FSize(5, 1) );
go_north.setGeometry ( FPoint(1, int(getScrollHeight()) - 2)
, FSize(5, 1) );
go_east.setGeometry (FPoint{1, 1}, FSize{5, 1});
go_south.setGeometry ( FPoint{int(getScrollWidth()) - 5, 1}
, FSize{5, 1} );
go_west.setGeometry ( FPoint{ int(getScrollWidth()) - 5
, int(getScrollHeight()) - 2 }
, FSize{5, 1} );
go_north.setGeometry ( FPoint{1, int(getScrollHeight()) - 2}
, FSize{5, 1} );
// Add scroll function callbacks to the buttons
go_east.addCallback
@ -120,9 +120,9 @@ void Scrollview::setScrollSize (const FSize& size)
FScrollView::setScrollSize (size);
const int width = int(size.getWidth());
const int height = int(size.getHeight());
go_south.setPos (FPoint(width - 5, 1));
go_west.setPos (FPoint(width - 5, height - 1));
go_north.setPos (FPoint(1, height - 1));
go_south.setPos (FPoint{width - 5, 1});
go_west.setPos (FPoint{width - 5, height - 1});
go_north.setPos (FPoint{1, height - 1});
}
//----------------------------------------------------------------------
@ -137,7 +137,7 @@ void Scrollview::draw()
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++)
print (32 + ((x + y) % 0x5f));
@ -216,15 +216,15 @@ class Scrollviewdemo final : public finalcut::FDialog
Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* 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");
// The scrolling viewport widget
sview.setGeometry(FPoint(3, 2), FSize(44, 12));
sview.setScrollSize(FSize(188, 124));
sview.setGeometry(FPoint{3, 2}, FSize{44, 12});
sview.setScrollSize(FSize{188, 124});
// Quit button
quit_btn.setGeometry(FPoint(37, 15), FSize(10, 1));
quit_btn.setGeometry(FPoint{37, 15}, FSize{10, 1});
// Add function callback
quit_btn.addCallback
@ -234,7 +234,7 @@ Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
);
// Text label
label.setGeometry(FPoint(2, 1), FSize(46, 1));
label.setGeometry(FPoint{2, 1}, FSize{46, 1});
label.setEmphasis();
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[])
{
// Create the application object
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
// Create a simple dialog box
Scrollviewdemo svdemo(&app);
Scrollviewdemo svdemo{&app};
// Set dialog main_dlg as main widget
finalcut::FWidget::setMainWidget(&svdemo);

View File

@ -76,14 +76,14 @@ AttribDlg::AttribDlg (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
{
FDialog::setText ( "A terminal attributes test ("
+ finalcut::FString(getTermType())
+ finalcut::FString{getTermType()}
+ ")");
next_button.setGeometry ( FPoint(int(getWidth()) - 13, int(getHeight()) - 4)
, FSize(10, 1) );
next_button.setGeometry ( FPoint{int(getWidth()) - 13, int(getHeight()) - 4}
, FSize{10, 1} );
next_button.addAccelerator (fc::Fkey_right);
back_button.setGeometry ( FPoint(int(getWidth()) - 25, int(getHeight()) - 4)
, FSize(10, 1) );
back_button.setGeometry ( FPoint{int(getWidth()) - 25, int(getHeight()) - 4}
, FSize{10, 1} );
back_button.addAccelerator (fc::Fkey_left);
// Add function callbacks
@ -186,11 +186,11 @@ void AttribDlg::adjustSize()
if ( y < 1 )
y = 1;
setGeometry(FPoint(x, y), FSize(69, 21), false);
next_button.setGeometry ( FPoint(int(getWidth()) - 13, int(getHeight()) - 4)
, FSize(10, 1), false );
back_button.setGeometry ( FPoint(int(getWidth()) - 25, int(getHeight()) - 4)
, FSize(10, 1), false );
setGeometry(FPoint{x, y}, FSize{69, 21}, false);
next_button.setGeometry ( FPoint{int(getWidth()) - 13, int(getHeight()) - 4}
, FSize{10, 1}, false );
back_button.setGeometry ( FPoint{int(getWidth()) - 25, int(getHeight()) - 4}
, FSize{10, 1}, false );
finalcut::FDialog::adjustSize();
}
@ -260,7 +260,7 @@ void AttribDemo::printColorLine()
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() )
setColor (wc.label_fg, wc.label_bg);
print() << FPoint(1, 1) << "alternate charset: ";
print() << FPoint{1, 1} << "alternate charset: ";
if ( parent->getBGColor() == fc::Default )
{
@ -439,7 +439,7 @@ void AttribDemo::draw()
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() )
setColor (wc.label_fg, wc.label_bg);
@ -451,7 +451,7 @@ void AttribDemo::draw()
if ( ! isMonochron() )
setColor(wc.label_fg, wc.label_bg);
print() << FPoint(1, 15);
print() << FPoint{1, 15};
const FColor bg = static_cast<AttribDlg*>(getParent())->getBGColor();
print (" Background color:");
@ -460,7 +460,7 @@ void AttribDemo::draw()
else
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[])
{
// Create the application object
finalcut::FApplication app (argc, argv);
finalcut::FApplication app {argc, argv};
// Create a dialog box object.
// This object will be automatically deleted by
// 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();
// Create the attribute demo widget as a child object from the 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
finalcut::FWidget::setMainWidget(&dialog);

View File

@ -297,7 +297,7 @@ void string()
int main (int argc, char* argv[])
{
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 << "Terminal: " << TermApp.getTermType() << "\r\n";

View File

@ -61,11 +61,11 @@ Timer::Timer (finalcut::FWidget* parent)
//----------------------------------------------------------------------
void Timer::draw()
{
print() << finalcut::FPoint(1, 1)
print() << finalcut::FPoint{1, 1}
<< "---------------\n"
<< "Press Q to quit\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()) )
is_last_line = true;
print() << finalcut::FColorPair (FColor(1 + timer_id))
print() << finalcut::FColorPair {FColor(1 + timer_id)}
<< "Timer event, id " << timer_id << '\n';
if ( is_last_line )
scrollAreaForward (getVirtualDesktop());
setAreaCursor ( finalcut::FPoint(1, getPrintPos().getY())
, true, getVirtualDesktop() );
setAreaCursor ({1, getPrintPos().getY()}, true, getVirtualDesktop());
}
//----------------------------------------------------------------------
@ -101,12 +100,12 @@ void Timer::onAccel (finalcut::FAccelEvent* ev)
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
app.setForegroundColor(fc::Default);
app.setBackgroundColor(fc::Default);
// Create a timer object t
Timer t(&app);
Timer t{&app};
t.addAccelerator('q');
// Set the timer object t as main widget

View File

@ -95,31 +95,31 @@ void Transparent::draw()
if ( type == shadow )
{
const auto& wc = getFWidgetColors();
print() << FColorPair (wc.shadow_bg, wc.shadow_fg)
<< FStyle (fc::ColorOverlay);
print() << FColorPair {wc.shadow_bg, wc.shadow_fg}
<< FStyle {fc::ColorOverlay};
}
else if ( type == inherit_background )
{
if ( getMaxColor() > 8 )
print() << FColorPair (fc::Blue, fc::Black);
print() << FColorPair {fc::Blue, fc::Black};
else
print() << FColorPair (fc::Green, fc::Black);
print() << FColorPair {fc::Green, fc::Black};
print() << FStyle (fc::InheritBackground);
print() << FStyle {fc::InheritBackground};
}
else
print() << FStyle (fc::Transparent);
print() << FStyle {fc::Transparent};
const finalcut::FString line(getClientWidth(), '.');
const finalcut::FString line{getClientWidth(), '.'};
// Fill window area
for (int n{1}; n <= int(getClientHeight()); n++)
{
print() << FPoint(2, 2 + n)
print() << FPoint{2, 2 + n}
<< 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.
transpwin = new Transparent(this);
transpwin->setText("transparent");
transpwin->setGeometry (FPoint(6, 3), FSize(29, 12));
transpwin->setGeometry (FPoint{6, 3}, FSize{29, 12});
transpwin->unsetTransparentShadow();
shadowwin = new Transparent(this, Transparent::shadow);
shadowwin->setText("shadow");
shadowwin->setGeometry (FPoint(46, 11), FSize(29, 12));
shadowwin->setGeometry (FPoint{46, 11}, FSize{29, 12});
shadowwin->unsetTransparentShadow();
ibg = new Transparent(this, Transparent::inherit_background);
ibg->setText("inherit background");
ibg->setGeometry (FPoint(42, 3), FSize(29, 7));
ibg->setGeometry (FPoint{42, 3}, FSize{29, 7});
ibg->unsetTransparentShadow();
// Set statusbar text for this window
@ -232,8 +232,8 @@ void MainWindow::draw()
setReverse(true);
setColor();
print() << FPoint(2, 4) << line1;
print() << FPoint(2, 5) << line2;
print() << FPoint{2, 4} << line1;
print() << FPoint{2, 5} << line2;
if ( isMonochron() )
setReverse(false);
@ -273,13 +273,13 @@ void MainWindow::onTimer (finalcut::FTimerEvent*)
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication app (argc, argv);
finalcut::FApplication app {argc, argv};
app.setNonBlockingRead();
// Create main dialog object
MainWindow main_dlg (&app);
MainWindow main_dlg {&app};
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
finalcut::FWidget::setMainWidget (&main_dlg);

View File

@ -329,7 +329,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
{
// Set FListView geometry
listView.setGeometry(FPoint(2, 1), FSize(53, 14));
listView.setGeometry(FPoint{2, 1}, FSize{53, 14});
// Add columns to the view
listView.addColumn ("Name", 23);
@ -379,7 +379,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
}
// Quit button
Quit.setGeometry(FPoint(24, 16), FSize(10, 1));
Quit.setGeometry(FPoint{24, 16}, FSize{10, 1});
Quit.setText (L"&Quit");
// Callback function
@ -431,13 +431,13 @@ void Treeview::onClose (finalcut::FCloseEvent* ev)
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
// Create main dialog object
Treeview d(&app);
Treeview d{&app};
d.setText (L"Continents");
d.setGeometry ( FPoint(int(1 + (app.getWidth() - 57) / 2), 3)
, FSize(57, 20) );
d.setGeometry ( FPoint{int(1 + (app.getWidth() - 57) / 2), 3}
, FSize{57, 20} );
d.setShadow();
// Set dialog d as main widget

View File

@ -81,26 +81,26 @@ ProgressDialog::ProgressDialog (finalcut::FWidget* parent)
// Dialog settings
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FDialog::setGeometry ( FPoint(int((getParentWidget()->getWidth() - 40) / 2), 7)
, FSize(40, 10) );
FDialog::setGeometry ( FPoint{int((getParentWidget()->getWidth() - 40) / 2), 7}
, FSize{40, 10} );
FDialog::setText("Progress bar");
//setModal();
reset.setText("&Reset");
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();
more.setText("&More");
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();
quit.setText("E&xit");
quit.setGeometry(FPoint(28, 6), FSize(8, 1), false);
quit.setGeometry(FPoint{28, 6}, FSize{8, 1}, false);
quit.setDisable();
progressBar.setGeometry(FPoint(2, 3), FSize(34, 1), false);
progressBar.setGeometry(FPoint{2, 3}, FSize{34, 1}, false);
//progressBar.setPercentage(78);
using namespace std::placeholders;
@ -221,8 +221,8 @@ TextWindow::TextWindow (finalcut::FWidget* parent)
: finalcut::FDialog(parent)
{
scrollText.ignorePadding();
scrollText.setGeometry (FPoint(1, 2), FSize(getWidth(), getHeight() - 1));
setMinimumSize (FSize(51, 6));
scrollText.setGeometry (FPoint{1, 2}, FSize{getWidth(), getHeight() - 1});
setMinimumSize (FSize{51, 6});
scrollText.setFocus();
scrollText.insert(" -----------------------------------------------\n"
" line 1\n"
@ -248,7 +248,7 @@ void TextWindow::append (const finalcut::FString& str)
void TextWindow::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();
// 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.setStatusbarMessage ("Press Enter to set the title");
myLineEdit << finalcut::FString("EnTry").toLower();
myLineEdit << finalcut::FString{"EnTry"}.toLower();
// Buttons
initButtons();
// A multiple selection listbox
myList.setGeometry(FPoint(38, 1), FSize(14, 17));
myList.setGeometry(FPoint{38, 1}, FSize{14, 17});
myList.setText ("Items");
myList.setStatusbarMessage ("99 items in a list");
@ -580,7 +580,7 @@ void MyDialog::initWidgets()
myList.reserve(100);
for (int z{1}; z < 100; z++)
myList.insert (finalcut::FString() << z << L" placeholder");
myList.insert (finalcut::FString{} << z << L" placeholder");
// Text labels
initLabels();
@ -590,21 +590,21 @@ void MyDialog::initWidgets()
void MyDialog::initFlatButtons()
{
// Flat buttons
MyButton1.setGeometry(FPoint(3, 3), FSize(5, 1));
MyButton1.setGeometry(FPoint{3, 3}, FSize{5, 1});
MyButton1.setText (L"&SIN");
MyButton1.setStatusbarMessage ("Sine function");
MyButton1.setNoUnderline();
MyButton1.setFlat();
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.setStatusbarMessage ("Cosine function");
MyButton2.setNoUnderline();
MyButton2.setFlat();
MyButton2.setDoubleFlatLine (fc::top);
MyButton3.setGeometry(FPoint(10, 3), FSize(5, 3));
MyButton3.setGeometry(FPoint{10, 3}, FSize{5, 3});
MyButton3.setText (L"&=");
MyButton3.setStatusbarMessage ("Equal");
MyButton3.setNoUnderline();
@ -634,25 +634,25 @@ void MyDialog::initFlatButtons()
void MyDialog::initToggleButtons()
{
// Radio buttons in a group
radioButtonGroup.setGeometry(FPoint(3, 8), FSize(14, 4));
radioButtonGroup.setGeometry(FPoint{3, 8}, FSize{14, 4});
//radioButtonGroup->unsetBorder();
radio1.setGeometry(FPoint(1, 1), FSize(10, 1));
radio1.setGeometry(FPoint{1, 1}, FSize{10, 1});
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.setStatusbarMessage ("Disable button Test");
radio2.setChecked();
//radio2.setDisable();
// 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();
check2.setGeometry(FPoint(1, 2), FSize(9, 1));
check2.setGeometry(FPoint{1, 2}, FSize{9, 1});
check2.setChecked();
check2.setNoUnderline();
}
@ -661,17 +661,17 @@ void MyDialog::initToggleButtons()
void MyDialog::initButtons()
{
// Buttons
MyButton4.setGeometry(FPoint(20, 8), FSize(12, 1));
MyButton4.setGeometry(FPoint{20, 8}, FSize{12, 1});
MyButton4.setText (L"&Get input");
MyButton4.setStatusbarMessage ("Take text from input field");
MyButton4.setFocus();
MyButton5.setGeometry(FPoint(20, 11), FSize(12, 1));
MyButton5.setGeometry(FPoint{20, 11}, FSize{12, 1});
MyButton5.setText (L"&Test");
MyButton5.setStatusbarMessage ("Progressbar testing dialog");
MyButton5.setDisable();
MyButton6.setGeometry(FPoint(20, 14), FSize(12, 1));
MyButton6.setGeometry(FPoint{20, 14}, FSize{12, 1});
MyButton6.setText (L"&Quit");
MyButton6.setStatusbarMessage ("Exit the program");
MyButton6.addAccelerator('x');
@ -701,20 +701,20 @@ void MyDialog::initButtons()
void MyDialog::initLabels()
{
// Text labels
headline.setGeometry(FPoint(21, 3), FSize(10, 1));
headline.setGeometry(FPoint{21, 3}, FSize{10, 1});
headline.setEmphasis();
headline.setAlignment (fc::alignCenter);
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;
sum.setGeometry(FPoint(21, 5), FSize(7, 3));
sum.setGeometry(FPoint{21, 5}, FSize{7, 3});
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();
}
@ -809,7 +809,7 @@ void MyDialog::cb_terminfo (const finalcut::FWidget*, const FDataPtr)
finalcut::FMessageBox info1 \
(
"Environment"
, finalcut::FString()
, finalcut::FString{}
<< " Type: " << getTermType() << "\n"
<< " Name: " << getTermFileName() << "\n"
<< " Mode: " << getEncodingString() << "\n"
@ -836,22 +836,22 @@ void MyDialog::cb_drives (const finalcut::FWidget*, const FDataPtr)
if ( isNewFont() )
{
finalcut::FLabel drive (finalcut::NF_Drive, &info2);
drive.setGeometry (FPoint(11, 2), FSize(4, 1));
finalcut::FLabel net (finalcut::NF_Net_Drive, &info2);
net.setGeometry (FPoint(11, 4), FSize(4, 1));
finalcut::FLabel cd (finalcut::NF_CD_ROM, &info2);
cd.setGeometry (FPoint(11, 6), FSize(4, 1));
finalcut::FLabel drive {finalcut::NF_Drive, &info2};
drive.setGeometry (FPoint{11, 2}, FSize{4, 1});
finalcut::FLabel net {finalcut::NF_Net_Drive, &info2};
net.setGeometry (FPoint{11, 4}, FSize{4, 1});
finalcut::FLabel cd {finalcut::NF_CD_ROM, &info2};
cd.setGeometry (FPoint{11, 6}, FSize{4, 1});
info2.exec();
}
else
{
finalcut::FLabel drive (" - ", &info2);
drive.setGeometry (FPoint(11, 2), FSize(4, 1));
finalcut::FLabel net (" N ", &info2);
net.setGeometry (FPoint(11, 4), FSize(4, 1));
finalcut::FLabel cd (" CD ", &info2);
cd.setGeometry (FPoint(11, 6), FSize(4, 1));
finalcut::FLabel drive {" - ", &info2};
drive.setGeometry (FPoint{11, 2}, FSize{4, 1});
finalcut::FLabel net {" N ", &info2};
net.setGeometry (FPoint{11, 4}, FSize{4, 1});
finalcut::FLabel cd {" CD ", &info2};
cd.setGeometry (FPoint{11, 6}, FSize{4, 1});
if ( isMonochron() )
{
@ -915,7 +915,7 @@ void MyDialog::cb_input2buttonText (finalcut::FWidget* widget, FDataPtr data)
void MyDialog::cb_setTitlebar (finalcut::FWidget* widget, const FDataPtr)
{
auto& lineedit = *(static_cast<finalcut::FLineEdit*>(widget));
finalcut::FString title;
finalcut::FString title{};
lineedit >> title;
setTermTitle (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)
{
finalcut::FString file;
finalcut::FString file{};
const auto& item = static_cast<finalcut::FMenuItem*>(data);
if ( item && ! item->getText().isEmpty() )
@ -977,9 +977,9 @@ void MyDialog::cb_view (const finalcut::FWidget*, FDataPtr data)
const auto& view = new TextWindow(this);
finalcut::FString filename(basename(const_cast<char*>(file.c_str())));
view->setText ("Viewer: " + filename);
view->setGeometry ( FPoint ( 1 + int((getRootWidget()->getWidth() - 60) / 2),
int(getRootWidget()->getHeight() / 6) )
, FSize(60, getRootWidget()->getHeight() * 3 / 4) );
view->setGeometry ( FPoint { 1 + int((getRootWidget()->getWidth() - 60) / 2),
int(getRootWidget()->getHeight() / 6) }
, FSize{60, getRootWidget()->getHeight() * 3 / 4} );
view->setResizeable();
std::string line = "";
std::ifstream infile;
@ -1019,7 +1019,7 @@ int main (int argc, char* argv[])
+ " (C) 2020 by Markus Gans" };
// Create the application object app
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
app.setNonBlockingRead();
app.redefineDefaultColors(true);
app.setTermTitle (title);
@ -1034,10 +1034,10 @@ int main (int argc, char* argv[])
//app.setNewFont();
// Create main dialog object d
MyDialog d(&app);
MyDialog d{&app};
d.setText (title);
d.setGeometry ( FPoint(int((app.getWidth() - 56) / 2), 2)
, FSize(56, app.getHeight() - 4) );
d.setGeometry ( FPoint{int((app.getWidth() - 56) / 2), 2}
, FSize{56, app.getHeight() - 4} );
d.setShadow();
// Set the dialog object d as the main widget of the application.

View File

@ -80,20 +80,20 @@ Watch::Watch (FWidget* parent)
// (CERT, OOP50-CPP)
FDialog::setText ("Watch");
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
time_label.setGeometry(FPoint(5, 2), FSize(5, 1));
time_label.setGeometry(FPoint{5, 2}, FSize{5, 1});
time_label.setEmphasis();
time_str.setGeometry(FPoint(10, 2), FSize(8, 1));
time_str.setGeometry(FPoint{10, 2}, FSize{8, 1});
// Checkbox buttons
clock_sw.setGeometry(FPoint(4, 4), FSize(9, 1));
seconds_sw.setGeometry(FPoint(2, 6), FSize(11, 1));
clock_sw.setGeometry(FPoint{4, 4}, FSize{9, 1});
seconds_sw.setGeometry(FPoint{2, 6}, FSize{11, 1});
sec = seconds_sw.setChecked();
// 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
clock_sw.addCallback
@ -202,10 +202,10 @@ void Watch::adjustSize()
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication app(argc, argv);
finalcut::FApplication app{argc, argv};
// Create a simple dialog box
Watch w(&app);
Watch w{&app};
// Set dialog w as main widget
finalcut::FWidget::setMainWidget(&w);

View File

@ -76,33 +76,33 @@ SmallWindow::SmallWindow (finalcut::FWidget* parent)
left_arrow.setForegroundColor (wc.label_inactive_fg);
left_arrow.setEmphasis();
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.setForegroundColor (wc.label_inactive_fg);
right_arrow.setEmphasis();
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.setForegroundColor (wc.label_inactive_fg);
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.setAlignment (fc::alignRight);
top_right_label.setForegroundColor (wc.label_inactive_fg);
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"
"corner\n" );
finalcut::FString bottom_label_text { "resize\n"
"corner\n" };
bottom_label_text += arrow_down;
bottom_label = bottom_label_text;
bottom_label.setAlignment (fc::alignRight);
bottom_label.setForegroundColor (wc.label_inactive_fg);
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();
right_arrow.setGeometry ( FPoint(int(getWidth()) - 1, 2)
, FSize(1, 1) );
top_right_label.setGeometry ( FPoint(int(getClientWidth()) - 5, 1)
, FSize(6, 1) );
bottom_label.setGeometry ( FPoint(1, int(getClientHeight()) - 2)
, FSize(getClientWidth(), 3) );
right_arrow.setGeometry ( FPoint{int(getWidth()) - 1, 2}
, FSize{1, 1} );
top_right_label.setGeometry ( FPoint{int(getClientWidth()) - 5, 1}
, FSize{6, 1} );
bottom_label.setGeometry ( FPoint{1, int(getClientHeight()) - 2}
, FSize{getClientWidth(), 3} );
}
//----------------------------------------------------------------------
@ -311,11 +311,11 @@ void Window::configureFileMenuItems()
void Window::configureDialogButtons()
{
// Dialog buttons
CreateButton.setGeometry (FPoint(2, 2), FSize(9, 1));
CreateButton.setGeometry (FPoint{2, 2}, FSize{9, 1});
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");
QuitButton.setGeometry (FPoint(28, 2), FSize(9, 1));
QuitButton.setGeometry (FPoint{28, 2}, FSize{9, 1});
QuitButton.setText (L"&Quit");
// Add button callback
@ -352,7 +352,7 @@ void Window::adjustSize()
if ( Y < 2 )
Y = 2;
setPos (FPoint(X, Y));
setPos (FPoint{X, Y});
const auto& first = windows.begin();
auto iter = first;
@ -363,7 +363,7 @@ void Window::adjustSize()
const int n = int(std::distance(first, iter));
const int x = dx + 5 + (n % 3) * 25 + 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;
@ -460,8 +460,8 @@ void Window::cb_createWindows (const finalcut::FWidget*, const FDataPtr)
const int n = int(std::distance(first, iter));
const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
const int y = dy + 11 + int(n / 3) * 3;
win->setGeometry (FPoint(x, y), FSize(20, 8));
win->setMinimumSize (FSize(20, 8));
win->setGeometry (FPoint{x, y}, FSize{20, 8});
win->setMinimumSize (FSize{20, 8});
win->setResizeable();
win->show();
@ -561,13 +561,13 @@ void Window::cb_destroyWindow (const finalcut::FWidget*, FDataPtr data)
int main (int argc, char* argv[])
{
// Create the application object
finalcut::FApplication app (argc, argv);
finalcut::FApplication app {argc, argv};
// Create main dialog object
Window main_dlg (&app);
Window main_dlg {&app};
main_dlg.setText ("Main window");
main_dlg.setGeometry ( FPoint(int(1 + (app.getWidth() - 40) / 2), 2)
, FSize(40, 6) );
main_dlg.setGeometry ( FPoint{int(1 + (app.getWidth() - 40) / 2), 2}
, FSize{40, 6} );
// Set dialog main_dlg as main widget
finalcut::FWidget::setMainWidget (&main_dlg);

View File

@ -86,10 +86,9 @@ FApplication::FApplication ( const int& _argc
if ( ! (_argc && _argv) )
{
app_argc = 0;
static char empty_str[1] = "";
auto empty = const_cast<char*>(empty_str);
app_argv = static_cast<char**>(&empty);
app_argc = 0;
app_argv = reinterpret_cast<char**>(&empty_str);
}
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 )
{
FString encoding(optarg);
FString encoding{optarg};
encoding = encoding.toLower();
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() )
return mouse->getGpmKeyPressed(keyboard->unprocessedInput());

View File

@ -169,12 +169,12 @@ bool FButton::setShadow (bool enable)
&& getEncoding() != fc::ASCII )
{
setFlags().shadow = true;
setShadowSize(FSize(1, 1));
setShadowSize(FSize{1, 1});
}
else
{
setFlags().shadow = false;
setShadowSize(FSize(0, 0));
setShadowSize(FSize{0, 0});
}
return getFlags().shadow;
@ -233,8 +233,8 @@ void FButton::hide()
for (std::size_t y{0}; y < getHeight() + s + (f << 1); y++)
{
print() << FPoint(1 - int(f), 1 + int(y - f))
<< FString(size, L' ');
print() << FPoint{1 - int(f), 1 + int(y - f)}
<< FString{size, L' '};
}
}
@ -286,7 +286,7 @@ void FButton::onMouseDown (FMouseEvent* ev)
getStatusBar()->drawMessage();
}
const FPoint tPos(ev->getTermPos());
const FPoint tPos{ev->getTermPos()};
if ( getTermGeometry().contains(tPos) )
setDown();
@ -313,7 +313,7 @@ void FButton::onMouseMove (FMouseEvent* ev)
if ( ev->getButton() != fc::LeftButton )
return;
const FPoint tPos(ev->getTermPos());
const FPoint tPos{ev->getTermPos()};
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++)
{
print() << FPoint(1, y) << ' '; // clear one left █
print() << FPoint{1, y} << ' '; // clear one left █
}
return 1;
@ -452,7 +452,7 @@ inline void FButton::clearRightMargin (const FWidget* parent_widget)
if ( isMonochron() )
setReverse(true); // Light background
print() << FPoint(1 + int(getWidth()), y) << ' '; // clear right
print() << FPoint{1 + int(getWidth()), y} << ' '; // clear right
if ( getFlags().active && isMonochron() )
setReverse(false); // Dark background
@ -468,7 +468,7 @@ inline void FButton::drawMarginLeft()
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 )
print (fc::BlackRightPointingPointer); // ►
@ -484,7 +484,7 @@ inline void FButton::drawMarginRight()
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 )
print (fc::BlackLeftPointingPointer); // ◄
@ -503,7 +503,7 @@ inline void FButton::drawTopBottomBackground()
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++)
print (space_char); // █
@ -511,7 +511,7 @@ inline void FButton::drawTopBottomBackground()
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++)
print (space_char); // █
@ -524,8 +524,8 @@ inline void FButton::drawButtonTextLine (const FString& button_text)
std::size_t z{0};
std::size_t pos{};
std::size_t columns{0};
print() << FPoint(2 + int(indent), 1 + int(vcenter_offset))
<< FColorPair (button_fg, button_bg);
print() << FPoint{2 + int(indent), 1 + int(vcenter_offset)}
<< FColorPair{button_fg, button_bg};
if ( getWidth() < column_width + 1 )
center_offset = 0;
@ -537,11 +537,11 @@ inline void FButton::drawButtonTextLine (const FString& button_text)
print (space_char); // █
if ( hotkeypos == NOT_SET )
setCursorPos (FPoint ( 2 + int(center_offset)
, 1 + int(vcenter_offset) )); // first character
setCursorPos ({ 2 + int(center_offset)
, 1 + int(vcenter_offset) }); // first character
else
setCursorPos (FPoint ( 2 + int(center_offset + hotkeypos)
, 1 + int(vcenter_offset) )); // hotkey
setCursorPos ({ 2 + int(center_offset + hotkeypos)
, 1 + int(vcenter_offset) }); // hotkey
if ( ! getFlags().active && isMonochron() )
setReverse(true); // Light background
@ -585,7 +585,7 @@ inline void FButton::drawButtonTextLine (const FString& button_text)
if ( column_width + 1 >= getWidth() )
{
// Print ellipsis
print() << FPoint(int(getWidth() + indent) - 2, 1) << "..";
print() << FPoint{int(getWidth() + indent) - 2, 1} << "..";
}
if ( active_focus && (isMonochron() || getMaxColor() < 16) )

View File

@ -211,7 +211,7 @@ void FButtonGroup::hide()
unsetViewportPrint();
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();
}
@ -405,9 +405,9 @@ void FButtonGroup::drawLabel()
const auto hotkeypos = finalcut::getHotkeyPos(txt, label_text);
if ( hasBorder() )
FWidget::setPrintPos (FPoint(2, 1));
FWidget::setPrintPos (FPoint{2, 1});
else
FWidget::setPrintPos (FPoint(0, 1));
FWidget::setPrintPos (FPoint{0, 1});
drawText (label_text, hotkeypos);
setViewportPrint();
@ -430,7 +430,7 @@ void FButtonGroup::init()
const auto& wc = getFWidgetColors();
setForegroundColor (wc.label_fg);
setBackgroundColor (wc.label_bg);
setMinimumSize (FSize(7, 3));
setMinimumSize (FSize{7, 3});
buttonlist.clear(); // no buttons yet
}
@ -480,7 +480,7 @@ void FButtonGroup::drawText ( const FString& label_text
}
if ( ellipsis ) // Print ellipsis
print() << FColorPair (wc.label_ellipsis_fg, wc.label_bg) << "..";
print() << FColorPair {wc.label_ellipsis_fg, wc.label_bg} << "..";
if ( isMonochron() )
setReverse(true);
@ -549,17 +549,15 @@ void FButtonGroup::cb_buttonToggled (FWidget* widget, const FDataPtr)
{
const auto& button = static_cast<FToggleButton*>(widget);
if ( ! button->isChecked() )
return;
if ( buttonlist.empty() )
if ( (button && ! button->isChecked()) || buttonlist.empty() )
return;
for (auto&& item : buttonlist)
{
auto toggle_button = static_cast<FToggleButton*>(item);
if ( toggle_button != button
if ( toggle_button
&& toggle_button != button
&& toggle_button->isChecked()
&& isRadioButton(toggle_button) )
{

View File

@ -3,7 +3,7 @@
* *
* 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 *
* modify it under the terms of the GNU Lesser General Public License *
@ -73,7 +73,7 @@ void FCheckBox::draw()
//----------------------------------------------------------------------
void FCheckBox::drawCheckButton()
{
print() << FPoint(1, 1);
print() << FPoint{1, 1};
setColor();
if ( isMonochron() )

View File

@ -73,12 +73,12 @@ void FDropDownListBox::setGeometry ( const FPoint& pos, const FSize& size
if ( isNewFont() )
{
FSize new_size(size);
FSize new_size{size};
new_size.scaleBy(-1, 0);
list.setGeometry (FPoint(2, 1), new_size, adjust);
list.setGeometry (FPoint{2, 1}, new_size, adjust);
}
else
list.setGeometry (FPoint(1, 1), size, adjust);
list.setGeometry (FPoint{1, 1}, size, adjust);
}
//----------------------------------------------------------------------
@ -113,10 +113,10 @@ void FDropDownListBox::init()
ignorePadding();
setShadow();
// initialize geometry values
setGeometry (FPoint(1, 1), FSize(3, 3), false);
setMinimumSize (FSize(3, 3));
setGeometry (FPoint{1, 1}, FSize{3, 3}, false);
setMinimumSize (FSize{3, 3});
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();
finalcut::drawShadow(this);
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)
{
FWidget::setSize (size, adjust);
FSize input_field_size(size);
FSize input_field_size{size};
input_field_size.scaleBy(-(1 + nf), 0);
input_field.setSize (input_field_size, adjust);
}
@ -193,9 +193,9 @@ void FComboBox::setGeometry ( const FPoint& pos, const FSize& size
, bool 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.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 )
{
setFlags().shadow = true;
setShadowSize(FSize(1, 1));
setShadowSize(FSize{1, 1});
}
else
{
setFlags().shadow = false;
setShadowSize(FSize(0, 0));
setShadowSize(FSize{0, 0});
}
return getFlags().shadow;
@ -324,12 +324,12 @@ void FComboBox::showDropDown()
static constexpr std::size_t border = 2; // Size of the top and bottom border
setOpenMenu(&list_window);
FPoint p(getTermPos());
FPoint p{getTermPos()};
p.move(0 - int(nf), 1);
setClickedWidget(&list_window.list);
const std::size_t w = getWidth();
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.list.setFocus();
list_window.redraw();
@ -537,14 +537,14 @@ void FComboBox::draw()
const FColorPair button_color = [this, &wc] ()
{
if ( list_window.isEmpty() )
return FColorPair ( wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg );
return FColorPair { wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg };
else
return FColorPair ( wc.scrollbar_button_fg
, wc.scrollbar_button_bg );
return FColorPair { wc.scrollbar_button_fg
, wc.scrollbar_button_bg };
}();
print() << FPoint(int(getWidth()) - nf, 1)
print() << FPoint{int(getWidth()) - nf, 1}
<< button_color;
if ( isNewFont() )

View File

@ -207,7 +207,7 @@ void FDialog::setPos (const FPoint& pos, bool)
const auto& shadow = getShadow();
const std::size_t width = getWidth() + shadow.getWidth(); // width + right 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
FWindow::setPos(pos, false);
@ -273,28 +273,28 @@ void FDialog::move (const FPoint& d_pos)
//----------------------------------------------------------------------
inline bool FDialog::moveUp (int n)
{
move (FPoint(0, -n));
move ({0, -n});
return ! setPos_error;
}
//----------------------------------------------------------------------
inline bool FDialog::moveDown (int n)
{
move (FPoint(0, n));
move ({0, n});
return ! setPos_error;
}
//----------------------------------------------------------------------
inline bool FDialog::moveLeft (int n)
{
move (FPoint(-n, 0));
move ({-n, 0});
return ! setPos_error;
}
//----------------------------------------------------------------------
inline bool FDialog::moveRight (int n)
{
move (FPoint(n, 0));
move ({n, 0});
return ! setPos_error;
}
@ -332,10 +332,10 @@ void FDialog::setSize (const FSize& size, bool adjust)
// restoring the non-covered terminal areas
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 )
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();
@ -352,7 +352,7 @@ bool FDialog::reduceHeight (int n)
if ( ! isResizeable() )
return false;
setSize (FSize(getWidth(), getHeight() - std::size_t(n)));
setSize (FSize{getWidth(), getHeight() - std::size_t(n)});
return ! setSize_error;
}
@ -362,7 +362,7 @@ bool FDialog::expandHeight (int n)
if ( ! isResizeable() || getHeight() + std::size_t(getY()) > getMaxHeight() )
return false;
setSize (FSize(getWidth(), getHeight() + std::size_t(n)));
setSize (FSize{getWidth(), getHeight() + std::size_t(n)});
return ! setSize_error;
}
@ -372,7 +372,7 @@ bool FDialog::reduceWidth (int n)
if ( ! isResizeable() )
return false;
setSize (FSize(getWidth() - std::size_t(n), getHeight()));
setSize (FSize{getWidth() - std::size_t(n), getHeight()});
return ! setSize_error;
}
@ -382,7 +382,7 @@ bool FDialog::expandWidth (int n)
if ( ! isResizeable() || getWidth() + std::size_t(getX()) > getMaxWidth() )
return false;
setSize (FSize(getWidth() + std::size_t(n), getHeight()));
setSize (FSize{getWidth() + std::size_t(n), getHeight()});
return ! setSize_error;
}
@ -541,7 +541,7 @@ void FDialog::onMouseUp (FMouseEvent* ev)
&& titlebar_x < getTermX() + int(getWidth())
&& titlebar_y == int(getTermY()) )
{
const FPoint deltaPos(ms.termPos - titlebar_click_pos);
const FPoint deltaPos{ms.termPos - titlebar_click_pos};
move (deltaPos);
titlebar_click_pos = ms.termPos;
}
@ -585,7 +585,7 @@ void FDialog::onMouseMove (FMouseEvent* ev)
if ( ! titlebar_click_pos.isOrigin() )
{
const FPoint deltaPos(ms.termPos - titlebar_click_pos);
const FPoint deltaPos{ms.termPos - titlebar_click_pos};
move (deltaPos);
titlebar_click_pos = ms.termPos;
}
@ -615,8 +615,8 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
const int x = getTermX();
const int y = getTermY();
const FRect title_button(x, y, 3, 1);
const FPoint tPos(ms.termPos);
const FRect title_button{x, y, 3, 1};
const FPoint tPos{ms.termPos};
if ( title_button.contains(tPos) )
{
@ -758,7 +758,7 @@ void FDialog::draw()
clearArea();
drawBorder();
drawTitleBar();
setCursorPos(FPoint(2, int(getHeight()) - 1));
setCursorPos({2, int(getHeight()) - 1});
if ( getFlags().shadow )
drawDialogShadow();
@ -795,8 +795,8 @@ void FDialog::init()
ignorePadding();
setDialogWidget();
// Initialize geometry values
setGeometry (FPoint(1, 1), FSize(10, 10), false);
setMinimumSize (FSize(15, 4));
setGeometry (FPoint{1, 1}, FSize{10, 10}, false);
setMinimumSize (FSize{15, 4});
addDialog(this);
setActiveWindow(this);
setTransparentShadow();
@ -830,7 +830,7 @@ void FDialog::initDialogMenu()
return;
}
FPoint p(getPos());
FPoint p{getPos()};
p.y_ref()++;
dialog_menu->setPos(p);
dgl_menuitem = dialog_menu->getItem();
@ -932,24 +932,24 @@ void FDialog::drawBorder()
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++)
{
print() << FPoint(r.getX1(), y)
print() << FPoint{r.getX1(), y}
<< fc::NF_border_line_left // border left ⎸
<< FPoint(r.getX2(), y)
<< FPoint{r.getX2(), y}
<< fc::NF_rev_border_line_right; // border right⎹
}
print() << r.getLowerLeftPos()
<< 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; // ⎦
}
else
{
FRect box(FPoint(1, 2), getSize());
FRect box{{1, 2}, getSize()};
box.scaleBy(0, -1);
finalcut::drawBorder(this, box);
}
@ -972,7 +972,7 @@ void FDialog::drawTitleBar()
if ( PRINT_WIN_NUMBER )
{
// Print the number of window in stack
print() << FPoint(int(getWidth()) - 2, 1);
print() << FPoint{int(getWidth()) - 2, 1};
printf ("(%d)", getWindowLayer(this));
}
#endif // DEBUG
@ -982,7 +982,7 @@ void FDialog::drawTitleBar()
void FDialog::drawBarButton()
{
// Print the title button
print() << FPoint(1, 1);
print() << FPoint{1, 1};
const auto& wc = getFWidgetColors();
if ( dialog_menu && dialog_menu->isShown() )
@ -1173,7 +1173,7 @@ void FDialog::setCursorToFocusWidget()
&& focus->isShown()
&& focus->hasVisibleCursor() )
{
const FPoint cursor_pos(focus->getCursorPos());
const FPoint cursor_pos{focus->getCursorPos()};
focus->setCursorPos(cursor_pos);
updateVTermCursor(getVWin());
}
@ -1215,7 +1215,7 @@ void FDialog::openMenu()
{
finalcut::closeOpenComboBox();
setOpenMenu(dialog_menu);
FPoint pos(getPos());
FPoint pos{getPos()};
pos.y_ref()++;
dialog_menu->setPos (pos);
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();
@ -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
|| 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 |
// x
@ -1484,11 +1484,11 @@ void FDialog::resizeMouseDown (const mouseStates& ms)
if ( isResizeable() && isLowerRightResizeCorner(ms) )
{
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 )
{
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 h = lower_right_pos.getY() + deltaPos.getY() - getTermY() + 1;
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 h{};
const FPoint deltaPos(ms.termPos - resize_click_pos);
const FPoint deltaPos{ms.termPos - resize_click_pos};
if ( x2 - x2_offset <= int(getMaxWidth()) )
w = resize_click_pos.getX() + deltaPos.getX() - getTermX() + 1;

View File

@ -3,7 +3,7 @@
* *
* 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 *
* 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
, const FPoint& pos
, 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
, const FPoint& pos
, int wheel )
: FWheelEvent(ev_type, pos, FPoint(), wheel)
: FWheelEvent(ev_type, pos, FPoint{}, wheel)
{ }
//----------------------------------------------------------------------

View File

@ -36,16 +36,16 @@ namespace finalcut
// non-member functions
//----------------------------------------------------------------------
bool sortByName ( const FFileDialog::dir_entry& lhs
, const FFileDialog::dir_entry& rhs )
bool sortByName ( const FFileDialog::FDirEntry& lhs
, const FFileDialog::FDirEntry& rhs )
{
// lhs < rhs
return bool( strcasecmp(lhs.name.c_str(), rhs.name.c_str()) < 0 );
}
//----------------------------------------------------------------------
bool sortDirFirst ( const FFileDialog::dir_entry& lhs
, const FFileDialog::dir_entry& rhs )
bool sortDirFirst ( const FFileDialog::FDirEntry& lhs
, const FFileDialog::FDirEntry& rhs )
{
// sort directories first
if ( lhs.directory && ! rhs.directory )
@ -61,8 +61,8 @@ const FString fileChooser ( FWidget* parent
, FFileDialog::DialogType type )
{
FString ret{};
FString path(dirname);
FString file_filter(filter);
FString path{dirname};
FString file_filter{filter};
if ( path.isNull() || path.isEmpty() )
{
@ -83,7 +83,7 @@ const FString fileChooser ( FWidget* parent
if ( fileopen.exec() == FDialog::Accept )
ret = fileopen.getPath() + fileopen.getSelectedFile();
else
ret = FString();
ret = FString{};
return ret;
}
@ -170,9 +170,9 @@ const FString FFileDialog::getSelectedFile() const
const uLong n = uLong(filebrowser.currentItem() - 1);
if ( dir_entries[n].directory )
return FString("");
return FString{""};
else
return FString(dir_entries[n].name);
return FString{dir_entries[n].name};
}
//----------------------------------------------------------------------
@ -304,7 +304,7 @@ void FFileDialog::adjustSize()
setHeight (h, false);
const int X = 1 + int((max_width - getWidth()) / 2);
const int Y = 1 + int((max_height - getHeight()) / 3);
setPos(FPoint(X, Y), false);
setPos(FPoint{X, Y}, false);
filebrowser.setHeight (h - 8, false);
hidden_check.setY (int(h) - 4, false);
cancel_btn.setY (int(h) - 4, false);
@ -326,7 +326,7 @@ void FFileDialog::init()
if ( ! fsystem )
fsystem = FTerm::getFSystem();
setGeometry(FPoint(1, 1), FSize(w, h), false);
setGeometry(FPoint{1, 1}, FSize{w, h}, false);
const auto& parent_widget = getParentWidget();
if ( parent_widget )
@ -342,7 +342,7 @@ void FFileDialog::init()
else
FDialog::setText("Open file");
widgetSettings (FPoint(x, y)); // Create widgets
widgetSettings (FPoint{x, y}); // Create widgets
initCallbacks();
setModal();
readDir();
@ -353,24 +353,24 @@ inline void FFileDialog::widgetSettings (const FPoint& pos)
{
filename.setLabelText ("File&name");
filename.setText (filter_pattern);
filename.setGeometry (FPoint(11, 1), FSize(28, 1));
filename.setGeometry (FPoint{11, 1}, FSize{28, 1});
filename.setFocus();
filebrowser.setGeometry (FPoint(2, 3), FSize(38, 6));
filebrowser.setGeometry (FPoint{2, 3}, FSize{38, 6});
printPath (directory);
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.setGeometry(FPoint(19, 10), FSize(9, 1));
cancel_btn.setGeometry(FPoint{19, 10}, FSize{9, 1});
if ( dlg_type == FFileDialog::Save )
open_btn.setText ("&Save");
else
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());
}
@ -455,7 +455,7 @@ sInt64 FFileDialog::numOfDirs()
const sInt64 n = std::count_if ( std::begin(dir_entries)
, std::end(dir_entries)
, [] (const dir_entry& entry)
, [] (const FDirEntry& entry)
{
return entry.directory
&& 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)
{
const char* const filter = filter_pattern.c_str();
dir_entry entry{};
FDirEntry entry{};
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 )
return; // No symbolic link
@ -632,9 +632,9 @@ void FFileDialog::dirEntriesToList()
for (auto&& entry : dir_entries)
{
if ( entry.directory )
filebrowser.insert(FString(entry.name), fc::SquareBrackets);
filebrowser.insert(FString{entry.name}, fc::SquareBrackets);
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 )
{
filebrowser.setCurrentItem(i);
filename.setText(FString(name) + '/');
filename.setText(FString{name} + '/');
break;
}
@ -662,8 +662,8 @@ void FFileDialog::selectDirectoryEntry (const char* const name)
//----------------------------------------------------------------------
int FFileDialog::changeDir (const FString& dirname)
{
FString lastdir(directory);
FString newdir(dirname);
FString lastdir{directory};
FString newdir{dirname};
if ( ! fsystem )
fsystem = FTerm::getFSystem();
@ -688,9 +688,9 @@ int FFileDialog::changeDir (const FString& dirname)
return -2;
case 0:
if ( newdir == FString("..") )
if ( newdir == FString{".."} )
{
if ( lastdir == FString('/') )
if ( lastdir == FString{'/'} )
filename.setText('/');
else
{
@ -700,7 +700,7 @@ int FFileDialog::changeDir (const FString& dirname)
}
else
{
FString firstname(dir_entries[0].name);
FString firstname{dir_entries[0].name};
if ( dir_entries[0].directory )
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 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);
}
else
@ -748,9 +748,9 @@ const FString FFileDialog::getHomeDir()
const uid_t euid = fsystem->geteuid();
if ( fsystem->getpwuid_r(euid, &pwd, buf, sizeof(buf), &pwd_ptr) )
return FString("");
return FString{""};
else
return FString(pwd.pw_dir);
return FString{pwd.pw_dir};
}
//----------------------------------------------------------------------
@ -769,7 +769,7 @@ void FFileDialog::cb_processActivate (const FWidget*, const FDataPtr)
readDir();
filebrowser.redraw();
}
else if ( filename.getText().trim() == FString("..")
else if ( filename.getText().trim() == FString{".."}
|| 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)
, std::end(dir_entries)
, [&input] (const dir_entry& entry)
, [&input] (const FDirEntry& entry)
{
return entry.name.c_str()
return ! entry.name.empty()
&& input
&& ! input.isNull()
&& std::strcmp(entry.name.c_str(), input) == 0
@ -810,7 +810,7 @@ void FFileDialog::cb_processRowChanged (const FWidget*, const FDataPtr)
if ( n == 0 )
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 )
filename.setText(name + '/');

View File

@ -86,12 +86,12 @@ const FString FKeyboard::getKeyName (const FKey keynum)
{
for (std::size_t i{0}; fc::fkeyname[i].string[0] != 0; i++)
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 )
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{};
struct timeval tv{};

View File

@ -349,7 +349,7 @@ void FLabel::drawMultiLine()
else
label_text = multiline_text[y];
print() << FPoint(1, 1 + int(y));
print() << FPoint{1, 1 + int(y)};
if ( hotkeypos != NOT_SET )
{
@ -374,7 +374,7 @@ void FLabel::drawSingleLine()
if ( hotkeypos != NOT_SET )
column_width--;
print() << FPoint(1, 1);
print() << FPoint{1, 1};
align_offset = getAlignOffset(column_width);
printLine (label_text);
}
@ -387,7 +387,7 @@ void FLabel::printLine (FString& line)
const std::size_t width(getWidth());
if ( align_offset > 0 )
print (FString(align_offset, ' ')); // leading spaces
print (FString{align_offset, ' '}); // leading spaces
if ( column_width <= width )
{
@ -438,15 +438,15 @@ void FLabel::printLine (FString& line)
if ( column_width > width )
{
// Print ellipsis
print() << FColorPair(ellipsis_color, getBackgroundColor())
<< FString("..").left(width);
print() << FColorPair{ellipsis_color, getBackgroundColor()}
<< FString{".."}.left(width);
setColor();
}
else if ( align_offset + to_column < width )
{
// Print trailing spaces
const std::size_t len = width - align_offset - to_column;
print (FString(len, ' '));
print (FString{len, ' '});
}
if ( hasReverseMode() )

View File

@ -155,12 +155,12 @@ bool FLineEdit::setShadow (bool enable)
&& getEncoding() != fc::ASCII )
{
setFlags().shadow = true;
setShadowSize(FSize(1, 1));
setShadowSize(FSize{1, 1});
}
else
{
setFlags().shadow = false;
setShadowSize(FSize(0, 0));
setShadowSize(FSize{0, 0});
}
return getFlags().shadow;
@ -280,7 +280,7 @@ void FLineEdit::hide()
label->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);
}
@ -629,13 +629,13 @@ void FLineEdit::adjustLabel()
if ( label_orientation == label_above )
{
label->setGeometry ( FPoint(w->getX(), w->getY() - 1)
, FSize(label_width, 1) );
label->setGeometry ( FPoint{w->getX(), w->getY() - 1}
, FSize{label_width, 1} );
}
else if ( label_orientation == label_left )
{
label->setGeometry ( FPoint(w->getX() - int(label_width) - 1, w->getY())
, FSize(label_width, 1) );
label->setGeometry ( FPoint{w->getX() - int(label_width) - 1, w->getY()}
, FSize{label_width, 1} );
}
}
@ -685,7 +685,7 @@ void FLineEdit::init()
}
//----------------------------------------------------------------------
bool FLineEdit::hasHotkey()
bool FLineEdit::hasHotkey() const
{
if ( label_text.isEmpty() )
return 0;
@ -721,7 +721,7 @@ void FLineEdit::draw()
void FLineEdit::drawInputField()
{
const bool isActiveFocus = getFlags().active && getFlags().focus;
print() << FPoint(1, 1);
print() << FPoint{1, 1};
if ( isMonochron() )
{
@ -782,7 +782,7 @@ void FLineEdit::drawInputField()
const int xpos = int(2 + cursor_pos_column
- text_offset_column
+ 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()
{
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() )
print() << FString(show_text.getLength(), fc::Bullet); // •
print() << FString{show_text.getLength(), fc::Bullet}; // •
x_pos = show_text.getLength();
return text_offset_column;
@ -831,7 +831,7 @@ inline std::size_t FLineEdit::getCursorColumnPos()
//----------------------------------------------------------------------
inline const FString FLineEdit::getPasswordText() const
{
return FString(text.getLength(), fc::Bullet); // •
return FString{text.getLength(), fc::Bullet}; // •
}
//----------------------------------------------------------------------

View File

@ -285,7 +285,7 @@ void FListBox::clear()
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 (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();
setForegroundColor (wc.dialog_fg);
setBackgroundColor (wc.dialog_bg);
@ -735,7 +735,7 @@ void FListBox::draw()
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
}
}
@ -764,7 +764,7 @@ void FListBox::draw()
//----------------------------------------------------------------------
void FListBox::drawBorder()
{
FRect box(FPoint(1, 1), getSize());
FRect box(FPoint{1, 1}, getSize());
finalcut::drawListBorder (this, box);
}
@ -789,9 +789,9 @@ void FListBox::drawHeadline()
if ( text.isNull() || text.isEmpty() )
return;
const FString txt(" " + text + " ");
const FString txt{" " + text + " "};
const auto column_width = getColumnWidth(txt);
print() << FPoint(2, 1);
print() << FPoint{2, 1};
const auto& wc = getFWidgetColors();
if ( isEnabled() )
@ -805,7 +805,7 @@ void FListBox::drawHeadline()
{
// Print ellipsis
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_width = getColumnWidth(inc_search);
const auto& wc = getFWidgetColors();
print() << FPoint(2, 2 + int(y));
print() << FPoint{2, 2 + int(y)};
if ( isLineSelected )
{
@ -1024,7 +1024,7 @@ inline void FListBox::setLineAttributes ( int y
setColor ( wc.selected_current_element_fg
, wc.selected_current_element_bg );
setCursorPos (FPoint(3, 2 + int(y))); // first character
setCursorPos ({3, 2 + int(y)}); // first character
}
else
{
@ -1041,10 +1041,10 @@ inline void FListBox::setLineAttributes ( int y
{
serach_mark = true;
// 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
setCursorPos (FPoint(3 + b, 2 + int(y))); // first character
setCursorPos ({3 + b, 2 + int(y)}); // first character
}
else
setColor ( wc.current_element_fg
@ -1721,13 +1721,13 @@ void FListBox::changeOnResize()
{
if ( isNewFont() )
{
vbar->setGeometry (FPoint(int(getWidth()), 2), FSize(2, getHeight() - 2));
hbar->setGeometry (FPoint(1, int(getHeight())), FSize(getWidth() - 2, 1));
vbar->setGeometry (FPoint{int(getWidth()), 2}, FSize{2, getHeight() - 2});
hbar->setGeometry (FPoint{1, int(getHeight())}, FSize{getWidth() - 2, 1});
}
else
{
vbar->setGeometry (FPoint(int(getWidth()), 2), FSize(1, getHeight() - 2));
hbar->setGeometry (FPoint(2, int(getHeight())), FSize(getWidth() - 2, 1));
vbar->setGeometry (FPoint{int(getWidth()), 2}, FSize{1, getHeight() - 2});
hbar->setGeometry (FPoint{2, int(getHeight())}, FSize{getWidth() - 2, 1});
}
}

View File

@ -1522,7 +1522,7 @@ void FListView::init()
selflist.push_back(this);
root = selflist.begin();
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();
setForegroundColor (wc.dialog_fg);
setBackgroundColor (wc.dialog_bg);
@ -1650,7 +1650,7 @@ void FListView::draw()
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
}
}
@ -1679,7 +1679,7 @@ void FListView::draw()
//----------------------------------------------------------------------
void FListView::drawBorder()
{
const FRect box(FPoint(1, 1), getSize());
const FRect box(FPoint{1, 1}, getSize());
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 checkbox_offset = ( item->isCheckable() ) ? 1 : 0;
path_end = getListEnd(item);
print() << FPoint(2, 2 + int(y));
print() << FPoint{2, 2 + int(y)};
// Draw one FListViewItem
drawListLine (item, getFlags().focus, is_current_line);
@ -1762,7 +1762,7 @@ void FListView::drawList()
xpos = -9999; // by moving it outside the visible area
setVisibleCursor (item->isCheckable());
setCursorPos (FPoint(xpos, 2 + int(y))); // first character
setCursorPos ({xpos, 2 + int(y)}); // first character
}
last_visible_line = iter;
@ -1779,8 +1779,8 @@ void FListView::drawList()
// Clean empty space after last element
while ( y < uInt(getClientHeight()) )
{
print() << FPoint(2, 2 + int(y))
<< FString(std::size_t(getClientWidth()), ' ');
print() << FPoint{2, 2 + int(y)}
<< FString{std::size_t(getClientWidth()), ' '};
y++;
}
}
@ -1795,7 +1795,7 @@ void FListView::drawListLine ( const FListViewItem* item
// Print the entry
const std::size_t indent = item->getDepth() << 1; // indent = 2 * depth
FString line(getLinePrefix (item, indent));
FString line{getLinePrefix (item, indent)};
// Print columns
if ( ! item->column_list.empty() )
@ -1822,21 +1822,21 @@ void FListView::drawListLine ( const FListViewItem* item
// Insert alignment spaces
if ( align_offset > 0 )
line += FString(align_offset, L' ');
line += FString{align_offset, L' '};
if ( align_offset + column_width <= width )
{
// Insert text and trailing space
static constexpr std::size_t leading_space = 1;
line += getColumnSubString (text, 1, width);
line += FString ( leading_space + width
- align_offset - column_width, L' ');
line += FString { leading_space + width
- align_offset - column_width, L' '};
}
else if ( align == fc::alignRight )
{
// Ellipse right align text
const std::size_t first = getColumnWidth(text) + 1 - width;
line += FString (L"..");
line += FString {L".."};
line += getColumnSubString (text, first, width - ellipsis_length);
line += L' ';
}
@ -1844,7 +1844,7 @@ void FListView::drawListLine ( const FListViewItem* item
{
// Ellipse left align text and center text
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++)
{
print() << FPoint(2, 2 + y) << FString(size, L' ');
print() << FPoint{2, 2 + y} << FString{size, L' '};
}
drawScrollbars();
@ -1932,7 +1932,7 @@ inline void FListView::setLineAttributes ( bool is_current
//----------------------------------------------------------------------
inline FString FListView::getCheckBox (const FListViewItem* item)
{
FString checkbox{};
FString checkbox{""};
if ( isNewFont() )
{
@ -1963,12 +1963,12 @@ inline FString FListView::getCheckBox (const FListViewItem* item)
inline FString FListView::getLinePrefix ( const FListViewItem* item
, std::size_t indent )
{
FString line{};
FString line{""};
if ( tree_view )
{
if ( indent > 0 )
line = FString(indent, L' ');
line = FString{indent, L' '};
if ( item->isExpandable() )
{
@ -2021,7 +2021,7 @@ inline void FListView::drawSortIndicator ( std::size_t& length
inline void FListView::drawHeaderBorder (std::size_t length)
{
setColor();
const FString line (length, fc::BoxDrawingsHorizontal);
const FString line {length, fc::BoxDrawingsHorizontal};
headerline << line; // horizontal line
}
@ -2032,7 +2032,7 @@ void FListView::drawHeadlineLabel (const headerItems::const_iterator& iter)
// Print label text
static constexpr std::size_t leading_space = 1;
const auto& text = iter->name;
FString txt(" " + text);
FString txt{" " + text};
const std::size_t width = std::size_t(iter->width);
std::size_t column_width = getColumnWidth(txt);
const std::size_t column_max = leading_space + width;
@ -2144,7 +2144,7 @@ void FListView::drawBufferedHeadline()
column_width = getColumnWidth(headerline);
// Print the header line
print() << FPoint(2, 1);
print() << FPoint{2, 1};
if ( left_truncated_fullwidth )
print (fc::SingleLeftAngleQuotationMark); //
@ -2173,7 +2173,7 @@ void FListView::drawColumnEllipsis ( const headerItems::const_iterator& iter
headerline << ' '
<< 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
@ -2518,13 +2518,13 @@ void FListView::changeOnResize()
{
if ( isNewFont() )
{
vbar->setGeometry (FPoint(int(getWidth()), 2), FSize(2, getHeight() - 2));
hbar->setGeometry (FPoint(1, int(getHeight())), FSize(getWidth() - 2, 1));
vbar->setGeometry (FPoint{int(getWidth()), 2}, FSize{2, getHeight() - 2});
hbar->setGeometry (FPoint{1, int(getHeight())}, FSize{getWidth() - 2, 1});
}
else
{
vbar->setGeometry (FPoint(int(getWidth()), 2), FSize(1, getHeight() - 2));
hbar->setGeometry (FPoint(2, int(getHeight())), FSize(getWidth() - 2, 1));
vbar->setGeometry (FPoint{int(getWidth()), 2}, FSize{1, getHeight() - 2});
hbar->setGeometry (FPoint{2, int(getHeight())}, FSize{getWidth() - 2, 1});
}
}

View File

@ -453,7 +453,7 @@ void FMenu::init(FWidget* parent)
setLeftPadding(1);
setBottomPadding(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();
setMenuWidget();
hide();
@ -531,8 +531,8 @@ void FMenu::calculateDimensions()
const int adjust_X = adjustX(getX());
// set widget geometry
setGeometry ( FPoint(adjust_X, getY())
, FSize(max_item_width + 2, getCount() + 2) );
setGeometry ( FPoint{adjust_X, getY()}
, FSize{max_item_width + 2, getCount() + 2} );
// set geometry of all items
const int item_X = 1;
@ -540,14 +540,14 @@ void FMenu::calculateDimensions()
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() )
{
const int menu_X = getTermX() + int(max_item_width) + 1;
const int menu_Y = item->getTermY() - 2;
// set sub-menu position
item->getMenu()->setPos (FPoint(menu_X, menu_Y), false);
item->getMenu()->setPos (FPoint{menu_X, menu_Y}, false);
}
item_Y++;
@ -567,7 +567,7 @@ void FMenu::adjustItems()
const int menu_Y = item->getTermY() - 2;
// set sub-menu position
menu->setPos (FPoint(menu_X, menu_Y));
menu->setPos (FPoint{menu_X, menu_Y});
// call sub-menu adjustItems()
if ( menu->getCount() > 0 )
@ -682,7 +682,7 @@ bool FMenu::mouseDownOverList (const FPoint& mouse_pos)
{
bool focus_changed{false};
FPoint pos{mouse_pos};
pos -= FPoint(getRightPadding(), getTopPadding());
pos -= FPoint{getRightPadding(), getTopPadding()};
for (auto&& item : getItemList())
{
@ -768,7 +768,7 @@ void FMenu::mouseDownSelection (FMenuItem* m_item, bool& focus_changed)
bool FMenu::mouseUpOverList (const FPoint& mouse_pos)
{
FPoint pos{mouse_pos};
pos -= FPoint(getRightPadding(), getTopPadding());
pos -= FPoint{getRightPadding(), getTopPadding()};
for (auto&& item : getItemList())
{
@ -824,7 +824,7 @@ bool FMenu::mouseUpOverList (const FPoint& mouse_pos)
void FMenu::mouseMoveOverList (const FPoint& mouse_pos, mouseStates& ms)
{
FPoint pos{mouse_pos};
pos -= FPoint(getRightPadding(), getTopPadding());
pos -= FPoint{getRightPadding(), getTopPadding()};
for (auto&& item : getItemList())
{
@ -1243,8 +1243,8 @@ void FMenu::drawItems()
inline void FMenu::drawSeparator (int y)
{
const auto& wc = getFWidgetColors();
print() << FPoint(1, 2 + y)
<< FColorPair(wc.menu_active_fg, wc.menu_active_bg);
print() << FPoint{1, 2 + y}
<< FColorPair{wc.menu_active_fg, wc.menu_active_bg};
if ( isMonochron() )
setReverse(true);
@ -1252,16 +1252,16 @@ inline void FMenu::drawSeparator (int y)
if ( isNewFont() )
{
print (fc::NF_border_line_vertical_right);
FString line ( std::size_t(getWidth()) - 2
, fc::BoxDrawingsHorizontal );
FString line { std::size_t(getWidth()) - 2
, fc::BoxDrawingsHorizontal };
print (line);
print (fc::NF_rev_border_line_vertical_left);
}
else
{
print (fc::BoxDrawingsVerticalAndRight);
FString line ( std::size_t(getWidth()) - 2
, fc::BoxDrawingsHorizontal);
FString line { std::size_t(getWidth()) - 2
, fc::BoxDrawingsHorizontal};
print (line);
print (fc::BoxDrawingsVerticalAndLeft);
}
@ -1273,7 +1273,7 @@ inline void FMenu::drawSeparator (int y)
//----------------------------------------------------------------------
inline void FMenu::drawMenuLine (FMenuItem* m_item, int y)
{
FString txt(m_item->getText());
FString txt{m_item->getText()};
menuText txtdata{};
std::size_t column_width = getColumnWidth(txt);
const FKey accel_key = m_item->accel_key;
@ -1408,7 +1408,7 @@ inline void FMenu::drawSubMenuIndicator (std::size_t& startpos)
if ( len > 0 )
{
// Print filling blank spaces
print (FString(len, L' '));
print (FString{len, L' '});
// Print BlackRightPointingPointer ►
print (fc::BlackRightPointingPointer);
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)
{
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 accel_len = accel_name.getLength();
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 )
{
// Print filling blank spaces + accelerator key name
const FString spaces (len, L' ');
const FString spaces {len, L' '};
print (spaces + accel_name);
startpos = max_item_width - (c + 2);
}
@ -1477,7 +1477,7 @@ inline void FMenu::setLineAttributes (const FMenuItem* m_item, int y)
setReverse(true);
}
print() << FPoint(2, 2 + y);
print() << FPoint{2, 2 + y};
setColor();
}
@ -1493,9 +1493,9 @@ inline void FMenu::setCursorToHotkeyPosition (FMenuItem* m_item)
if ( is_selected )
{
if ( is_checkable )
m_item->setCursorPos (FPoint(3, 1));
m_item->setCursorPos({3, 1});
else
m_item->setCursorPos (FPoint(2, 1));
m_item->setCursorPos({2, 1});
}
}
else
@ -1506,9 +1506,9 @@ inline void FMenu::setCursorToHotkeyPosition (FMenuItem* m_item)
const auto x = getColumnWidth (m_item->getText(), hotkeypos);
if ( is_checkable )
m_item->setCursorPos (FPoint(3 + int(x), 1));
m_item->setCursorPos({3 + int(x), 1});
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
bool click_in_menu_structure{false};
bool is_dialog_menu{false};
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) )
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() )
is_dialog_menu = true;
@ -1636,7 +1644,7 @@ std::tuple<bool, bool> closeOpenMenus ( FMenu* menu
menu->hide();
menu->hideSubMenus();
menu->hideSuperMenus();
return std::make_tuple (false, is_dialog_menu);
return std::make_tuple (click_in_menu_structure, is_dialog_menu);
}
} // namespace finalcut

View File

@ -68,7 +68,7 @@ void FMenuBar::hide()
FColor fg = wc.term_fg;
FColor bg = wc.term_bg;
setColor (fg, bg);
print() << FPoint(1, 1) << FString(getDesktopWidth(), L' ');
print() << FPoint{1, 1} << FString{getDesktopWidth(), L' '};
updateTerminal();
FWindow::hide();
}
@ -76,7 +76,7 @@ void FMenuBar::hide()
//----------------------------------------------------------------------
void FMenuBar::adjustSize()
{
setGeometry (FPoint(1, 1), FSize(getDesktopWidth(), 1), false);
setGeometry (FPoint{1, 1}, FSize{getDesktopWidth(), 1}, false);
adjustItems();
}
@ -238,7 +238,7 @@ void FMenuBar::init()
auto r = getRootWidget();
auto w = r->getWidth();
// initialize geometry values
setGeometry (FPoint(1, 1), FSize(w, 1), false);
setGeometry (FPoint{1, 1}, FSize{w, 1}, false);
setAlwaysOnTop();
setMenuBar(this);
ignorePadding();
@ -257,7 +257,7 @@ void FMenuBar::init()
//----------------------------------------------------------------------
void FMenuBar::calculateDimensions()
{
FPoint item_pos (1, 1);
FPoint item_pos{1, 1};
// find the maximum item width
for (auto&& item : getItemList())
@ -266,7 +266,7 @@ void FMenuBar::calculateDimensions()
int item_width = len + 2;
// 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
if ( item->hasMenu() )
@ -475,7 +475,7 @@ void FMenuBar::drawItems()
if ( list.empty() )
return;
print() << FPoint(1, 1);
print() << FPoint{1, 1};
if ( isMonochron() )
setReverse(true);
@ -499,7 +499,7 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
menuText txtdata{};
txtdata.startpos = x + 1;
txtdata.no_underline = menuitem->getFlags().no_underline;
FString txt(menuitem->getText());
FString txt{menuitem->getText()};
std::size_t column_width = getColumnWidth(txt);
bool is_enabled = menuitem->isEnabled();
bool is_selected = menuitem->isSelected();
@ -577,13 +577,13 @@ inline void FMenuBar::setCursorToHotkeyPosition ( FMenuItem* menuitem
if ( hotkeypos == NOT_SET )
{
// set cursor to the first character
menuitem->setCursorPos (FPoint(2, 1));
menuitem->setCursorPos({2, 1});
return;
}
// set cursor to the hotkey position
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 )
{
// Print ellipsis
print() << FPoint(int(screenWidth) - 1, 1) << "..";
print() << FPoint{int(screenWidth) - 1, 1} << "..";
}
else if ( txtdata.startpos - 1 <= screenWidth )
{
// 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();
// set menu position
menu->setPos (FPoint(menu->adjustX(item_X), item_Y));
menu->setPos (FPoint{menu->adjustX(item_X), item_Y});
// call menu adjustItems()
menu->adjustItems();

View File

@ -517,7 +517,7 @@ void FMenuItem::init (FWidget* parent)
text_width--;
}
setGeometry (FPoint(1, 1), FSize(text_width + 2, 1), false);
setGeometry (FPoint{1, 1}, FSize{text_width + 2, 1}, false);
if ( ! parent )
return;

View File

@ -182,7 +182,7 @@ void FMessageBox::adjustSize()
const int x = 1 + int((max_width - getWidth()) / 2);
const int y = 1 + int((max_height - getHeight()) / 3);
setPos(FPoint(x, y), false);
setPos(FPoint{x, y}, false);
FDialog::adjustSize();
}
@ -233,7 +233,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
{
button[0] = new FButton (this);
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]->setHeight(1, false);
button[0]->setFocus();
@ -242,7 +242,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
{
button[1] = new FButton(this);
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]->setHeight(1, false);
}
@ -251,7 +251,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
{
button[2] = new FButton(this);
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]->setHeight(1, false);
}
@ -358,7 +358,7 @@ void FMessageBox::draw()
if ( center_text ) // center one line
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;
}
@ -371,7 +371,7 @@ void FMessageBox::draw()
if ( center_text ) // center one line
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;
y++;
}

View File

@ -59,7 +59,7 @@ const FString FMouse::getClassName() const
}
//----------------------------------------------------------------------
inline FPoint& FMouse::getPos()
inline const FPoint& FMouse::getPos()
{
return mouse;
}
@ -227,7 +227,7 @@ inline FMouse::FMouseButton& FMouse::getButtonState()
}
//----------------------------------------------------------------------
inline FPoint& FMouse::getNewPos()
inline const FPoint& FMouse::getNewPos()
{
return new_mouse_position;
}
@ -381,8 +381,8 @@ void FMouseGPM::processEvent (struct timeval*)
break;
}
setPos (FPoint( std::max(gpm_ev.x, sInt16(1))
, std::max(gpm_ev.y, sInt16(1)) ));
setPos (FPoint{ std::max(gpm_ev.x, sInt16(1))
, std::max(gpm_ev.y, sInt16(1)) });
if ( gpmEvent(false) == mouse_event )
setPending(true);
@ -618,7 +618,7 @@ void FMouseX11::processEvent (struct timeval* time)
}
setEvent();
setPos (FPoint(x, y));
setPos (FPoint{x, y});
// Get the button state from string
x11_button_state = uChar(btn);
// Delete already interpreted data
@ -844,7 +844,7 @@ void FMouseSGR::processEvent (struct timeval* time)
}
setEvent();
setPos (FPoint(x, y));
setPos (FPoint{x, y});
// Get the button state from string
sgr_button_state = uChar(((*p & 0x20) << 2) + btn);
// Delete already interpreted data
@ -1099,7 +1099,7 @@ void FMouseUrxvt::processEvent (struct timeval* time)
}
setEvent();
setPos (FPoint(x, y));
setPos (FPoint{x, y});
urxvt_button_state = uChar(btn);
// Delete already interpreted data
urxvt_mouse[0] = '\0';
@ -1234,7 +1234,7 @@ FMouseControl::~FMouseControl() // destructor
// public methods of FMouseControl
//----------------------------------------------------------------------
FPoint& FMouseControl::getPos()
const FPoint& FMouseControl::getPos()
{
const auto& mouse_object = getMouseWithEvent();

View File

@ -1221,7 +1221,7 @@ bool FOptiAttr::hasNoAttribute (const FChar* const& attr)
//----------------------------------------------------------------------
inline bool FOptiAttr::hasColorChanged ( const FChar* const& term
, const FChar* const& next )
, const FChar* const& next ) const
{
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

View File

@ -893,7 +893,7 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
//----------------------------------------------------------------------
inline bool FOptiMove::isWideMove ( int xold, int yold
, int xnew, int ynew )
, int xnew, int ynew ) const
{
return bool ( xnew > MOVE_LIMIT
&& xnew < int(screen_width) - 1 - MOVE_LIMIT

View File

@ -96,12 +96,12 @@ bool FProgressbar::setShadow (bool enable)
&& getEncoding() != fc::ASCII )
{
setFlags().shadow = true;
setShadowSize(FSize(1, 1));
setShadowSize(FSize{1, 1});
}
else
{
setFlags().shadow = false;
setShadowSize(FSize(0, 0));
setShadowSize(FSize{0, 0});
}
return enable;
@ -113,8 +113,8 @@ void FProgressbar::hide()
FWidget::hide();
const FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
hideArea (getSize() + shadow);
print() << FPoint(int(getWidth()) - 4, 0)
<< (" "); // hide percentage
print() << FPoint{int(getWidth()) - 4, 0}
<< " "; // hide percentage
}
//----------------------------------------------------------------------
@ -162,7 +162,7 @@ void FProgressbar::drawProgressLabel()
if ( isMonochron() )
setReverse(true);
print() << FPoint(int(getWidth()) - 3, 0);
print() << FPoint{int(getWidth()) - 3, 0};
if ( percentage > 100 )
print ("--- %");
@ -177,7 +177,7 @@ void FProgressbar::drawProgressLabel()
void FProgressbar::drawProgressBar()
{
std::size_t len{0};
print() << FPoint(1, 1);
print() << FPoint{1, 1};
if ( percentage > 0 && percentage <= 100 )
len = drawProgressIndicator();
@ -202,8 +202,8 @@ std::size_t FProgressbar::drawProgressIndicator()
const auto& wc = getFWidgetColors();
const double length = double(bar_length * percentage) / 100;
auto len = std::size_t(trunc(length));
print() << FColorPair (wc.progressbar_fg, wc.progressbar_fg)
<< FString (len, fc::FullBlock); // █
print() << FColorPair {wc.progressbar_fg, wc.progressbar_fg}
<< FString {len, fc::FullBlock}; // █
if ( len >= bar_length )
return len;
@ -220,7 +220,7 @@ std::size_t FProgressbar::drawProgressIndicator()
}
else
{
print() << FColorPair(wc.progressbar_fg, wc.progressbar_bg)
print() << FColorPair{wc.progressbar_fg, wc.progressbar_bg}
<< fc::LeftHalfBlock; // ▌
}
@ -238,9 +238,9 @@ void FProgressbar::drawProgressBackground (std::size_t len)
setColor (wc.progressbar_fg, wc.progressbar_bg);
if ( getMaxColor() < 16 )
print() << FString (bg_len, fc::MediumShade); // ▒
print() << FString {bg_len, fc::MediumShade}; // ▒
else
print() << FString (bg_len, L' ');
print() << FString {bg_len, L' '};
}
} // namespace finalcut

View File

@ -3,7 +3,7 @@
* *
* 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 *
* modify it under the terms of the GNU Lesser General Public License *
@ -73,7 +73,7 @@ void FRadioButton::draw()
//----------------------------------------------------------------------
void FRadioButton::drawRadioButton()
{
print() << FPoint(1, 1);
print() << FPoint{1, 1};
setColor();
if ( isMonochron() )

View File

@ -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
{ return FPoint(X1, Y2); }
//----------------------------------------------------------------------
FPoint FRect::getLowerRightPos() const
const FPoint FRect::getLowerLeftPos() 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
{
// intersection: this ∩ r
FRect new_rect{};
new_rect.X1 = std::max(X1, r.X1);
new_rect.Y1 = std::max(Y1, r.Y1);
new_rect.X2 = std::min(X2, r.X2);
new_rect.Y2 = std::min(Y2, r.Y2);
return new_rect;
int _X1 = std::max(X1, r.X1);
int _Y1 = std::max(Y1, r.Y1);
int _X2 = std::min(X2, r.X2);
int _Y2 = std::min(Y2, r.Y2);
const FPoint p1{ _X1, _Y1 };
const FPoint p2{ _X2, _Y2 };
return { p1, p2 };
}
//----------------------------------------------------------------------
FRect FRect::combined (const FRect& r) const
{
// Union: this r
FRect new_rect{};
new_rect.X1 = std::min(X1, r.X1);
new_rect.Y1 = std::min(Y1, r.Y1);
new_rect.X2 = std::max(X2, r.X2);
new_rect.Y2 = std::max(Y2, r.Y2);
return new_rect;
int _X1 = std::min(X1, r.X1);
int _Y1 = std::min(Y1, r.Y1);
int _X2 = std::max(X2, r.X2);
int _Y2 = std::max(Y2, r.Y2);
const FPoint p1{ _X1, _Y1 };
const FPoint p2{ _X2, _Y2 };
return { p1, p2 };
}
// 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
, r.Y1
, std::size_t(r.X2 - r.X1) + 1 + s.getWidth()
, std::size_t(r.Y2 - r.Y1) + 1 + s.getHeight() );
return { r.X1
, r.Y1
, std::size_t(r.X2 - r.X1) + 1 + s.getWidth()
, 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
, r.Y1
, std::size_t(r.X2 - r.X1) + 1 - s.getWidth()
, std::size_t(r.Y2 - r.Y1) + 1 - s.getHeight() );
return { r.X1
, r.Y1
, std::size_t(r.X2 - r.X1) + 1 - s.getWidth()
, std::size_t(r.Y2 - r.Y1) + 1 - s.getHeight() };
}
//----------------------------------------------------------------------

View File

@ -40,7 +40,7 @@ FScrollbar::FScrollbar(FWidget* parent)
: FWidget(parent)
{
// The default scrollbar orientation is vertical
setGeometry(FPoint(1, 1), FSize(1, length), false);
setGeometry(FPoint{1, 1}, FSize{1, length}, false);
init();
}
@ -440,7 +440,7 @@ void FScrollbar::init()
{
unsetFocusable();
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++)
{
print() << FPoint(1, 1 + z);
print() << FPoint{1, 1 + z};
drawVerticalBackgroundLine();
}
@ -475,7 +475,7 @@ void FScrollbar::drawVerticalBar()
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() )
print (' ');
@ -490,7 +490,7 @@ void FScrollbar::drawVerticalBar()
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();
}
@ -524,9 +524,9 @@ void FScrollbar::drawHorizontalBar()
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
if ( isNewFont() )
print() << FPoint(3, 1);
print() << FPoint{3, 1};
else
print() << FPoint(2, 1);
print() << FPoint{2, 1};
for (int z{0}; z < slider_pos; z++)
drawHorizontalBackgroundColumn();
@ -571,24 +571,24 @@ void FScrollbar::drawButtons()
if ( isNewFont() )
{
print() << FPoint(1, 1);
print() << FPoint{1, 1};
if ( bar_orientation == fc::vertical )
{
print() << NF_button_arrow_up
<< FPoint(1, int(length))
<< FPoint{1, int(length)}
<< NF_button_arrow_down;
}
else // horizontal
{
print() << NF_button_arrow_left
<< FPoint(int(length) - 1, 1)
<< FPoint{int(length) - 1, 1}
<< NF_button_arrow_right;
}
}
else
{
print() << FPoint(1, 1);
print() << FPoint{1, 1};
if ( isMonochron() )
setReverse(true);
@ -596,13 +596,13 @@ void FScrollbar::drawButtons()
if ( bar_orientation == fc::vertical )
{
print() << fc::BlackUpPointingTriangle // ▲
<< FPoint(1, int(length))
<< FPoint{1, int(length)}
<< fc::BlackDownPointingTriangle; // ▼
}
else // horizontal
{
print() << fc::BlackLeftPointingPointer // ◄
<< FPoint(int(length), 1)
<< FPoint{int(length), 1}
<< fc::BlackRightPointingPointer; // ►
}

View File

@ -276,15 +276,15 @@ void FScrollView::setGeometry ( const FPoint& pos, const FSize& size
//----------------------------------------------------------------------
bool FScrollView::setCursorPos (const FPoint& p)
{
return FWidget::setCursorPos (FPoint ( p.getX() + getLeftPadding()
, p.getY() + getTopPadding() ));
return FWidget::setCursorPos ({ p.getX() + getLeftPadding()
, p.getY() + getTopPadding() });
}
//----------------------------------------------------------------------
void FScrollView::setPrintPos (const FPoint& p)
{
FWidget::setPrintPos (FPoint( p.getX() + getLeftPadding()
, p.getY() + getTopPadding() ));
FWidget::setPrintPos (FPoint { p.getX() + getLeftPadding()
, p.getY() + getTopPadding() });
}
//----------------------------------------------------------------------
@ -296,7 +296,7 @@ bool FScrollView::setViewportPrint (bool enable)
//----------------------------------------------------------------------
bool FScrollView::setBorder (bool enable)
{
return (border = enable);
return (setFlags().no_border = ! enable);
}
//----------------------------------------------------------------------
@ -424,7 +424,7 @@ void FScrollView::draw()
else
setColor();
if ( border )
if ( hasBorder() )
drawBorder();
if ( isMonochron() )
@ -446,7 +446,7 @@ void FScrollView::draw()
//----------------------------------------------------------------------
void FScrollView::drawBorder()
{
const FRect box(FPoint(1, 1), getSize());
const FRect box(FPoint{1, 1}, getSize());
finalcut::drawListBorder (this, box);
}
@ -685,7 +685,7 @@ void FScrollView::copy2area()
// private methods of FScrollView
//----------------------------------------------------------------------
inline FPoint FScrollView::getViewportCursorPos()
inline const FPoint FScrollView::getViewportCursorPos()
{
const auto& window = FWindow::getWindowWidget(this);
@ -697,10 +697,10 @@ inline FPoint FScrollView::getViewportCursorPos()
- viewport_geometry.getX();
const int y = widget_offsetY + viewport->input_cursor_y
- viewport_geometry.getY();
return FPoint (x, y);
return { x, y };
}
else
return FPoint (-1, -1);
return { -1, -1 };
}
//----------------------------------------------------------------------
@ -715,8 +715,8 @@ void FScrollView::init (const FWidget* parent)
const auto& wc = getFWidgetColors();
setForegroundColor (wc.dialog_fg);
setBackgroundColor (wc.dialog_bg);
setGeometry (FPoint(1, 1), FSize(4, 4));
setMinimumSize (FSize(4, 4));
setGeometry (FPoint{1, 1}, FSize{4, 4});
setMinimumSize (FSize{4, 4});
const int xoffset_end = int(getScrollWidth() - getViewportWidth());
const int yoffset_end = int(getScrollHeight() - getViewportHeight());
nf_offset = isNewFont() ? 1 : 0;
@ -724,7 +724,7 @@ void FScrollView::init (const FWidget* parent)
setLeftPadding (1 - getScrollX());
setBottomPadding (1 - (yoffset_end - getScrollY()));
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 h = getViewportHeight();
@ -771,13 +771,13 @@ void FScrollView::calculateScrollbarPos()
if ( isNewFont() )
{
vbar->setGeometry (FPoint(int(width), 2), FSize(2, height - 2));
hbar->setGeometry (FPoint(1, int(height)), FSize(width - 2, 1));
vbar->setGeometry (FPoint{int(width), 2}, FSize{2, height - 2});
hbar->setGeometry (FPoint{1, int(height)}, FSize{width - 2, 1});
}
else
{
vbar->setGeometry (FPoint(int(width), 2), FSize(1, height - 2));
hbar->setGeometry (FPoint(2, int(height)), FSize(width - 2, 1));
vbar->setGeometry (FPoint{int(width), 2}, FSize{1, height - 2});
hbar->setGeometry (FPoint{2, int(height)}, FSize{width - 2, 1});
}
vbar->resize();
@ -842,9 +842,9 @@ void FScrollView::setViewportCursor()
if ( ! isChild(getFocusWidget()) )
return;
const FPoint cursor_pos ( viewport->input_cursor_x - 1
, viewport->input_cursor_y - 1 );
const FPoint window_cursor_pos(getViewportCursorPos());
const FPoint cursor_pos { viewport->input_cursor_x - 1
, viewport->input_cursor_y - 1 };
const FPoint window_cursor_pos{ getViewportCursorPos() };
auto printarea = getCurrentPrintArea();
printarea->input_cursor_x = window_cursor_pos.getX();
printarea->input_cursor_y = window_cursor_pos.getY();

View File

@ -57,7 +57,7 @@ FSpinBox::~FSpinBox() // destructor
void FSpinBox::setSize (const FSize& size, bool adjust)
{
FWidget::setSize (size, adjust);
FSize input_field_size(size);
FSize input_field_size{size};
input_field_size.scaleBy(-2, 0);
input_field.setSize (input_field_size, adjust);
}
@ -67,9 +67,9 @@ void FSpinBox::setGeometry ( const FPoint& pos, const FSize& size
, bool adjust )
{
FWidget::setGeometry (pos, size, adjust);
FSize input_field_size(size);
FSize input_field_size{size};
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 )
{
setFlags().shadow = true;
setShadowSize(FSize(1, 1));
setShadowSize(FSize{1, 1});
}
else
{
setFlags().shadow = false;
setShadowSize(FSize(0, 0));
setShadowSize(FSize{0, 0});
}
return getFlags().shadow;
@ -163,7 +163,7 @@ void FSpinBox::hide()
{
input_field.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);
}
@ -331,24 +331,24 @@ void FSpinBox::draw()
const FColorPair inc_button_color = [this, &wc] ()
{
if ( value == max )
return FColorPair ( wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg );
return FColorPair { wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg };
else
return FColorPair ( wc.scrollbar_button_fg
, wc.scrollbar_button_bg );
return FColorPair { wc.scrollbar_button_fg
, wc.scrollbar_button_bg };
}();
const FColorPair dec_button_color = [this, &wc] ()
{
if ( value == min )
return FColorPair ( wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg );
return FColorPair { wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg };
else
return FColorPair ( wc.scrollbar_button_fg
, wc.scrollbar_button_bg );
return FColorPair { wc.scrollbar_button_fg
, wc.scrollbar_button_bg };
}();
print() << FPoint(int(getWidth()) - 1, 1)
print() << FPoint{int(getWidth()) - 1, 1}
<< dec_button_color
<< fc::BlackDownPointingTriangle // ▼
<< inc_button_color

View File

@ -101,7 +101,7 @@ bool FStatusKey::setMouseFocus(bool enable)
//----------------------------------------------------------------------
void FStatusKey::init (FWidget* parent)
{
setGeometry (FPoint(1, 1), FSize(1, 1));
setGeometry (FPoint{1, 1}, FSize{1, 1});
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() )
{
@ -178,7 +178,7 @@ void FStatusBar::hide()
const FColor fg = wc.term_fg;
const FColor bg = wc.term_bg;
setColor (fg, bg);
print() << FPoint(1, 1) << FString(getDesktopWidth(), L' ');
print() << FPoint{1, 1} << FString{getDesktopWidth(), L' '};
updateTerminal();
FWindow::hide();
}
@ -212,7 +212,7 @@ void FStatusBar::drawMessage()
const auto& wc = getFWidgetColors();
setColor (wc.statusbar_fg, wc.statusbar_bg);
setPrintPos (FPoint(x, 1));
setPrintPos ({x, 1});
if ( isMonochron() )
setReverse(true);
@ -309,8 +309,8 @@ void FStatusBar::clear()
//----------------------------------------------------------------------
void FStatusBar::adjustSize()
{
setGeometry ( FPoint(1, int(getDesktopHeight()))
, FSize(getDesktopWidth(), 1), false );
setGeometry ( FPoint{1, int(getDesktopHeight())}
, FSize{getDesktopWidth(), 1}, false );
}
//----------------------------------------------------------------------
@ -504,7 +504,7 @@ void FStatusBar::init()
const std::size_t w = r->getWidth();
const int h = int(r->getHeight());
// initialize geometry values
setGeometry (FPoint(1, h), FSize(w, 1), false);
setGeometry (FPoint{1, h}, FSize{w, 1}, false);
setAlwaysOnTop();
setStatusBar(this);
ignorePadding();
@ -552,7 +552,7 @@ void FStatusBar::drawKeys()
return;
}
print() << FPoint(1, 1);
print() << FPoint{1, 1};
if ( isMonochron() )
setReverse(true);

View File

@ -77,6 +77,12 @@ FString::FString (FString&& s) noexcept // move constructor
{
if ( ! s.isNull() )
_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)
{
FString tmp(string);
FString tmp{string};
tmp._insert (length, s.length, s.string);
return tmp;
}
@ -198,7 +204,7 @@ const FString FString::operator + (const wchar_t c)
{
wchar_t s[2]{};
s[0] = c;
FString tmp(string);
FString tmp{string};
tmp._insert (length, 1, s);
return tmp;
}
@ -208,7 +214,7 @@ const FString FString::operator + (const char c)
{
wchar_t s[2]{};
s[0] = wchar_t(c & 0xff);
FString tmp(string);
FString tmp{string};
tmp._insert (length, 1, s);
return tmp;
}
@ -223,7 +229,7 @@ FString& FString::operator << (const FString& s)
//----------------------------------------------------------------------
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);
return *this;
}
@ -231,7 +237,7 @@ FString& FString::operator << (fc::SpecialCharacter c)
//----------------------------------------------------------------------
FString& FString::operator << (const wchar_t c)
{
FString s(c);
FString s{c};
_insert (length, s.length, s.string);
return *this;
}
@ -239,7 +245,7 @@ FString& FString::operator << (const wchar_t c)
//----------------------------------------------------------------------
FString& FString::operator << (const char c)
{
FString s(c);
FString s{c};
_insert (length, s.length, s.string);
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)
{
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)
{
c = wchar_t(std::towupper(std::wint_t(c)));
@ -500,7 +506,7 @@ long FString::toLong() const
long num{0};
long tenth_limit{LONG_MAX / 10};
long tenth_limit_digit{LONG_MAX % 10};
const FString s(trim());
const FString s{trim()};
const wchar_t* p = s.string;
if ( ! p )
@ -553,7 +559,7 @@ uLong FString::toULong() const
uLong num{0};
const uLong tenth_limit{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;
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
if ( ! (string && *string) )
@ -646,13 +652,13 @@ FString FString::ltrim() const
while ( std::iswspace(std::wint_t(*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
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
if ( ! (string && *string) )
return *this;
const FString s(ltrim());
const FString s{ltrim()};
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
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
if ( ! (string && *string) )
@ -715,13 +721,13 @@ FString FString::right (std::size_t len) const
const wchar_t* p = s.string;
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
if ( ! (string && *string) )
@ -734,18 +740,18 @@ FString FString::mid (std::size_t pos, std::size_t len) const
len = length - pos + 1;
if ( pos > length || pos + len - 1 > length || len == 0 )
return FString(L"");
return FString{L""};
wchar_t* p = s.string;
wchar_t* first = p + pos - 1;
*(first + len) = '\0';
return FString(first);
return first;
}
//----------------------------------------------------------------------
FStringList FString::split (const FString& delimiter)
{
const FString s(string);
const FString s{*this};
FStringList string_list{};
// handle NULL and empty string
@ -757,7 +763,7 @@ FStringList FString::split (const FString& delimiter)
while ( token )
{
string_list.push_back (FString(token));
string_list.push_back (FString{token});
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
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)
{
@ -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{};
if ( tabstop <= 0 )
@ -1105,7 +1111,7 @@ FString FString::expandTabs (int tabstop) const
//----------------------------------------------------------------------
FString FString::removeDel() const
{
FString s(string);
FString s{*this};
std::size_t i{0};
std::size_t count{0};
@ -1135,7 +1141,7 @@ FString FString::removeDel() const
//----------------------------------------------------------------------
FString FString::removeBackspaces() const
{
FString s(string);
FString s{*this};
std::size_t i{0};
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)
{
FString tmp(s1);
FString tmp{s1};
tmp._insert ( uInt(std::wcslen(s1.wc_str()))
, uInt(std::wcslen(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)
{
FString tmp(s);
FString tmp{s};
tmp._insert ( uInt(std::wcslen(s.wc_str())), 1, &c);
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)
{
FString tmp(s1);
FString tmp{s1};
tmp._insert ( uInt(std::wcslen(s1.c_str()))
, uInt(std::wcslen(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)
{
FString tmp(s1);
FString tmp{s1};
tmp._insert ( uInt(std::wcslen(s1))
, uInt(std::wcslen(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)
{
FString tmp(s1);
FString tmp{s1};
tmp._insert ( tmp.getLength()
, uInt(std::wcslen(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)
{
FString tmp(s1);
FString tmp{s1};
tmp._insert ( tmp.getLength()
, uInt(std::wcslen(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)
{
FString tmp(c);
FString tmp{c};
tmp._insert (1, uInt(std::wcslen(s.wc_str())), s.wc_str());
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)
{
FString tmp(c);
FString tmp{c};
tmp._insert (1, uInt(std::wcslen(s.wc_str())), s.wc_str());
return tmp;
}
@ -1620,7 +1626,7 @@ const FString operator + (const char c, const FString& s)
//----------------------------------------------------------------------
const FString operator + (const FString& s, const char c)
{
FString tmp1(s);
FString tmp1{s};
wchar_t tmp2[2];
tmp2[0] = wchar_t(c & 0xff);
tmp2[1] = L'\0';
@ -1639,7 +1645,7 @@ std::ostream& operator << (std::ostream& outstr, const FString& s)
}
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);
}
@ -1673,7 +1679,7 @@ std::wostream& operator << (std::wostream& outstr, const FString& s)
}
else if ( width > 0 )
{
const FString fill_str(width, outstr.fill());
const FString fill_str{width, outstr.fill()};
outstr << fill_str.string;
}

View File

@ -130,7 +130,7 @@ void FSwitch::draw()
//----------------------------------------------------------------------
void FSwitch::drawCheckButton()
{
print() << FPoint(1 + int(switch_offset_pos), 1);
print() << FPoint{1 + int(switch_offset_pos), 1};
if ( isChecked() )
drawChecked();
@ -179,13 +179,13 @@ inline void FSwitch::drawChecked()
if ( isMonochron() || getMaxColor() < 16 )
setBold(false);
print() << FColorPair(wc.button_inactive_fg, wc.button_inactive_bg)
print() << FColorPair{wc.button_inactive_fg, wc.button_inactive_bg}
<< off;
if ( isMonochron() )
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 )
setBold(false);
setCursorPos (FPoint(7 + int(switch_offset_pos), 1));
setCursorPos ({7 + int(switch_offset_pos), 1});
}
} // namespace finalcut

View File

@ -2324,7 +2324,7 @@ bool FTerm::init_terminal()
}
catch (const std::system_error& ex)
{
FString msg = "FTerm: " + FString(ex.what());
FString msg = "FTerm: " + FString{ex.what()};
data->setExitMessage(msg);
FApplication::exit(EXIT_FAILURE);
return false;

View File

@ -191,7 +191,7 @@ const wchar_t reverse_newfont_list[] =
//----------------------------------------------------------------------
uInt env2uint (const char* env)
{
const FString str(getenv(env));
const FString str{getenv(env)};
if ( str.isEmpty() )
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
FString s(str);
FString s{str};
constexpr std::size_t HALF = 0;
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
FString s(str);
FString s{str};
constexpr std::size_t HALF = 0;
constexpr std::size_t FULL = 1;
@ -356,17 +356,18 @@ FString getHalfWidth (const FString& str)
}
//----------------------------------------------------------------------
FString getColumnSubString ( const FString& str
, std::size_t col_pos, std::size_t col_len )
const FString getColumnSubString ( const FString& str
, 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_num{0};
std::size_t first{1};
std::size_t num{0};
if ( col_len == 0 || s.isEmpty() )
return FString(L"");
return FString{L""};
if ( col_pos == 0 )
col_pos = 1;
@ -406,7 +407,7 @@ FString getColumnSubString ( const FString& str
}
if ( col_first < col_pos ) // String length < col_pos
return FString(L"");
return FString{L""};
return s.mid(first, num);
}

View File

@ -55,7 +55,7 @@ const FString FTermBuffer::toString() const
return fchar.ch;
}
);
return FString(wide_string);
return wide_string;
}
//----------------------------------------------------------------------

View File

@ -230,7 +230,7 @@ void FTermcap::termcapKeys (char*& buffer)
{
// Get termcap keys
// Read termcap key sequences
// Read termcap key sequences up to the self-defined values
for ( std::size_t i{0};
fc::fkey[i].string == nullptr && fc::fkey[i].tname[0] != 0;
i++ )

View File

@ -667,7 +667,7 @@ const char* FTermDetection::parseSecDA (const char current_termtype[])
return current_termtype;
// 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")
temp.remove(temp.getLength() - 1, 1);
// split into components

View File

@ -716,7 +716,7 @@ const FString FTermXTerminal::captureXTermFont()
if ( n >= 5 && temp[n - 1] == BEL[0] && temp[n] == '\0' )
temp[n - 1] = '\0';
return FString(temp);
return FString{temp};
}
}
}

View File

@ -57,14 +57,14 @@ FTextView::~FTextView() // destructor
const FString FTextView::getText() const
{
if ( data.empty() )
return FString("");
return FString{""};
std::size_t len{0};
for (auto&& line : data)
len += line.getLength() + 1; // String length + '\n'
FString s(len); // Reserves storage
FString s{len}; // Reserves storage
auto iter = s.begin();
for (auto&& line : data)
@ -202,7 +202,7 @@ void FTextView::insert (const FString& str, int pos)
if ( str.isEmpty() )
s = "\n";
else
s = FString(str).rtrim().expandTabs(getTabstop());
s = FString{str}.rtrim().expandTabs(getTabstop());
auto text_split = s.split("\r\n");
@ -303,8 +303,8 @@ void FTextView::clear()
for (int y{0}; y < int(getTextHeight()); y++)
{
print() << FPoint(2, 2 - nf_offset + y)
<< FString(size, L' ');
print() << FPoint{2, 2 - nf_offset + y}
<< FString{size, L' '};
}
updateTerminal();
@ -601,7 +601,7 @@ void FTextView::draw()
}
}
setCursorPos (FPoint(int(getWidth()), int(getHeight())));
setCursorPos ({int(getWidth()), int(getHeight())});
updateTerminal();
flush();
}
@ -614,7 +614,7 @@ void FTextView::drawBorder()
if ( isMonochron() )
setReverse(true);
const FRect box(FPoint(1, 1), getSize());
const FRect box{FPoint{1, 1}, getSize()};
finalcut::drawListBorder (this, box);
if ( isMonochron() )
@ -660,7 +660,7 @@ void FTextView::drawText()
const FString line(getColumnSubString(data[n], pos, text_width));
const auto column_width = getColumnWidth(line);
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
{
@ -675,7 +675,7 @@ void FTextView::drawText()
if ( column_width <= text_width )
trailing_whitespace = text_width - column_width;
print() << FString(trailing_whitespace, L' ');
print() << FString{trailing_whitespace, L' '};
}
if ( isMonochron() )
@ -691,10 +691,10 @@ inline bool FTextView::useFDialogBorder()
if ( parent
&& parent->isDialogWidget()
&& isPaddingIgnored()
&& getGeometry() == FRect ( 1
&& getGeometry() == FRect { 1
, 2
, parent->getWidth()
, parent->getHeight() - 1) )
, parent->getHeight() - 1} )
{
use_fdialog_border = true;
}
@ -730,13 +730,13 @@ void FTextView::changeOnResize()
if ( isNewFont() )
{
vbar->setGeometry (FPoint(int(width), 1), FSize(2, height - 1));
hbar->setGeometry (FPoint(1, int(height)), FSize(width - 2, 1));
vbar->setGeometry (FPoint{int(width), 1}, FSize{2, height - 1});
hbar->setGeometry (FPoint{1, int(height)}, FSize{width - 2, 1});
}
else
{
vbar->setGeometry (FPoint(int(width), 2), FSize(1, height - 2));
hbar->setGeometry (FPoint(2, int(height)), FSize(width - 2, 1));
vbar->setGeometry (FPoint{int(width), 2}, FSize{1, height - 2});
hbar->setGeometry (FPoint{2, int(height)}, FSize{width - 2, 1});
}
vbar->resize();

View File

@ -85,7 +85,7 @@ void FToggleButton::setSize (const FSize& s, bool adjust)
{
// Set the toggle button size
FSize size(s);
FSize size{s};
correctSize(size);
const FRect geometry(getPos(), size);
@ -101,7 +101,7 @@ void FToggleButton::setGeometry ( const FPoint& pos, const FSize& s
{
// Set the toggle button geometry
FSize size(s);
FSize size{s};
correctSize(size);
const FRect geometry(pos, size);
@ -402,7 +402,7 @@ void FToggleButton::draw()
// set the cursor to the button
if ( isRadioButton() || isCheckboxButton() )
setCursorPos (FPoint(2, 1));
setCursorPos ({2, 1});
}
//----------------------------------------------------------------------
@ -414,7 +414,7 @@ void FToggleButton::drawLabel()
const FString txt(text);
FString 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);
}
@ -496,7 +496,7 @@ void FToggleButton::setGroup (FButtonGroup* btngroup)
//----------------------------------------------------------------------
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();
if ( isEnabled() )

View File

@ -105,8 +105,8 @@ void FToolTip::init()
setAlwaysOnTop();
ignorePadding();
// initialize geometry values
setGeometry (FPoint(1, 1), FSize(3, 3), false);
setMinimumSize (FSize(3, 3));
setGeometry (FPoint{1, 1}, FSize{3, 3}, false);
setMinimumSize (FSize{3, 3});
const auto& wc = getFWidgetColors();
setForegroundColor (wc.tooltip_fg);
setBackgroundColor (wc.tooltip_bg);
@ -127,7 +127,7 @@ void FToolTip::draw()
for (auto&& line : text_components)
{
print() << FPoint(x, y) << line;
print() << FPoint{x, y} << line;
y++;
}
}
@ -164,7 +164,7 @@ void FToolTip::calculateDimensions()
else
x = y = 1;
setGeometry (FPoint(x, y), FSize(w, h));
setGeometry (FPoint{x, y}, FSize{w, h});
}
//----------------------------------------------------------------------

View File

@ -103,15 +103,15 @@ FVTerm& FVTerm::operator << (const FTermBuffer& term_buffer)
// public methods of FVTerm
//----------------------------------------------------------------------
FPoint FVTerm::getPrintCursor()
const FPoint FVTerm::getPrintCursor()
{
const auto& win = getPrintArea();
if ( win )
return FPoint ( win->offset_left + win->cursor_x
, win->offset_top + win->cursor_y );
return { win->offset_left + win->cursor_x
, 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
const FRect box(0, 0, size.getWidth(), size.getHeight());
const FSize shadow(0, 0);
const FRect box{0, 0, size.getWidth(), size.getHeight()};
const FSize shadow{0, 0};
createArea (box, shadow, vterm);
}
@ -227,8 +227,8 @@ void FVTerm::resizeVTerm (const FSize& size)
{
// resize virtual terminal
const FRect box(0, 0, size.getWidth(), size.getHeight());
const FSize shadow(0, 0);
const FRect box{0, 0, size.getWidth(), size.getHeight()};
const FSize shadow{0, 0};
resizeArea (box, shadow, vterm);
}
@ -766,7 +766,7 @@ void FVTerm::resizeArea ( const FRect& box
area->bottom_shadow = bsh;
area->has_changes = false;
const FSize size(full_width, full_height);
const FSize size{full_width, full_height};
setTextToDefault (area, size);
}
@ -828,7 +828,7 @@ void FVTerm::restoreVTerm (const FRect& box)
{
const int xpos = x + tx;
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));
}
@ -866,9 +866,9 @@ bool FVTerm::updateVTermCursor (const FTermArea* area)
const int x = ax + cx;
const int y = ay + cy;
if ( isInsideArea (FPoint(cx, cy), area)
&& isInsideTerminal (FPoint(x, y))
&& isCovered (FPoint(x, y), area) == non_covered )
if ( isInsideArea (FPoint{cx, cy}, area)
&& isInsideTerminal (FPoint{x, y})
&& isCovered (FPoint{x, y}, area) == non_covered )
{
vterm->input_cursor_x = x;
vterm->input_cursor_y = y;
@ -1038,7 +1038,7 @@ void FVTerm::putArea (const FTermArea* area)
tx -= ol;
if ( updateVTermCharacter(area, FPoint(x, y), FPoint(tx, ty)) )
if ( updateVTermCharacter(area, FPoint{x, y}, FPoint{tx, ty}) )
modified = true;
if ( ! modified )
@ -1121,7 +1121,7 @@ void FVTerm::putArea (const FPoint& pos, const FTermArea* area)
const int cy = ay + y;
ac = &area->data[y * width + ol + x];
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);
FTerm::scrollTermForward();
putArea (FPoint(1, 1), vdesktop);
putArea (FPoint{1, 1}, vdesktop);
// avoid update lines from 0 to (y_max - 1)
for (int y{0}; y < y_max; y++)
@ -1233,7 +1233,7 @@ void FVTerm::scrollAreaReverse (FTermArea* area)
{
setTermXY (0, 0);
FTerm::scrollTermReverse();
putArea (FPoint(1, 1), vdesktop);
putArea (FPoint{1, 1}, vdesktop);
// avoid update lines from 1 to y_max
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_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->height) + std::size_t(win->bottom_shadow) );
, std::size_t(win->height) + std::size_t(win->bottom_shadow) };
if ( found && geometry.contains(pos) )
{
@ -1490,7 +1490,7 @@ void FVTerm::updateOverlappedColor ( const FTermArea* area
FChar nc{};
std::memcpy (&nc, ac, sizeof(nc));
// 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.bg_color = oc.bg_color;
nc.attr.bit.reverse = false;
@ -1519,7 +1519,7 @@ void FVTerm::updateOverlappedCharacter ( const FTermArea* area
const int ty = terminal_pos.getY();
auto tc = &vterm->data[ty * vterm->width + tx];
// 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);
std::memcpy (tc, &oc, sizeof(*tc));
}
@ -1541,7 +1541,7 @@ void FVTerm::updateShadedCharacter ( const FTermArea* area
// Terminal character
const auto tc = &vterm->data[ty * vterm->width + tx];
// 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.bg_color = ac->bg_color;
oc.attr.bit.reverse = false;
@ -1579,7 +1579,7 @@ void FVTerm::updateInheritBackground ( const FTermArea* area
FChar nc{};
std::memcpy (&nc, ac, sizeof(nc));
// 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.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == nc);
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 )
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 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) )
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
@ -1772,9 +1772,9 @@ FChar FVTerm::generateCharacter (const FPoint& pos)
const int win_x = win->offset_left;
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->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
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
, FVTerm* obj )
{
@ -1866,13 +1866,13 @@ FChar FVTerm::getCharacter ( character_type char_type
if ( ! win || ! win->visible )
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->height) + std::size_t(win->bottom_shadow) );
, std::size_t(win->height) + std::size_t(win->bottom_shadow) };
// Window visible and contains current character
if ( geometry.contains(x, y) )
getAreaCharacter (FPoint(x, y), win, cc);
getAreaCharacter (FPoint{x, y}, win, cc);
}
else if ( char_type == covered_character )
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
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
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));
// Create virtual terminal
FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
FRect term_geometry {0, 0, getColumnNumber(), getLineNumber()};
createVTerm (term_geometry.getSize());
// Create virtual desktop area
FSize shadow_size(0, 0);
FSize shadow_size{0, 0};
createArea (term_geometry, shadow_size, vdesktop);
vdesktop->visible = true;
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);
}
//----------------------------------------------------------------------
inline bool FVTerm::isFullWidthPaddingChar (const FChar* const& ch)
inline bool FVTerm::isFullWidthPaddingChar (const FChar* const& ch) const
{
return ch->attr.bit.fullwidth_padding;
}
@ -2844,7 +2844,7 @@ bool FVTerm::updateTerminalCursor()
const int x = vterm->input_cursor_x;
const int y = vterm->input_cursor_y;
if ( isInsideTerminal(FPoint(x, y)) )
if ( isInsideTerminal(FPoint{x, y}) )
{
setTermXY (x, y);
showCursor();
@ -2862,7 +2862,7 @@ bool FVTerm::isInsideTerminal (const FPoint& pos)
{
// 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) )
return true;

View File

@ -242,11 +242,11 @@ std::vector<bool>& FWidget::doubleFlatLine_ref (fc::sides side)
}
//----------------------------------------------------------------------
FPoint FWidget::getPrintPos()
const FPoint FWidget::getPrintPos()
{
const auto& cur = getPrintCursor();
return FPoint ( cur.getX() - woffset.getX1() - getX() + 1
, cur.getY() - woffset.getY1() - getY() + 1 );
return { cur.getX() - woffset.getX1() - getX() + 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)
{
FPoint pos(p);
FPoint pos{p};
if ( getX() == pos.getX() && wsize.getX() == pos.getX()
&& getY() == pos.getY() && wsize.getY() == pos.getY() )
@ -539,7 +539,7 @@ void FWidget::setTermSize (const FSize& size)
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;
FTerm::setTermSize(size); // width = columns / height = lines
detectTermSize();
@ -621,8 +621,8 @@ bool FWidget::setCursorPos (const FPoint& pos)
woffsetY += (1 - area->widget->getTopPadding());
}
setAreaCursor ( FPoint ( woffsetX + pos.getX()
, woffsetY + pos.getY() )
setAreaCursor ( { woffsetX + pos.getX()
, woffsetY + pos.getY() }
, flags.visible_cursor
, area );
return true;
@ -967,9 +967,9 @@ void FWidget::resize()
{
if ( isRootWidget() )
{
const FRect old_term_geometry (getTermGeometry());
const FRect old_term_geometry {getTermGeometry()};
detectTermSize();
FRect term_geometry (getTermGeometry());
FRect term_geometry {getTermGeometry()};
term_geometry.move (-1, -1);
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++)
{
print() << FPoint(1, 1 + y) << FString(size.getWidth(), L' ');
print() << FPoint{1, 1 + y} << FString{size.getWidth(), L' '};
}
flush();
@ -1887,7 +1887,12 @@ void FWidget::setWindowFocus (bool enable)
//----------------------------------------------------------------------
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;
}
//----------------------------------------------------------------------

View File

@ -162,26 +162,26 @@ void drawTransparentShadow (FWidget* w)
const std::size_t width = w->getWidth();
const std::size_t height = w->getHeight();
const auto& wcolors = FWidget::wcolors;
w->print() << FStyle (fc::Transparent)
<< FPoint (int(width) + 1, 1)
w->print() << FStyle {fc::Transparent}
<< FPoint {int(width) + 1, 1}
<< " "
<< FStyle (fc::Reset)
<< FColorPair (wcolors.shadow_bg, wcolors.shadow_fg)
<< FStyle (fc::ColorOverlay);
<< FStyle {fc::Reset}
<< FColorPair {wcolors.shadow_bg, wcolors.shadow_fg}
<< FStyle {fc::ColorOverlay};
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)
<< FPoint (1, int(height) + 1)
w->print() << FStyle {fc::Reset} << FStyle {fc::Transparent}
<< FPoint {1, int(height) + 1}
<< " "
<< FStyle (fc::Reset)
<< FColorPair (wcolors.shadow_bg, wcolors.shadow_fg)
<< FStyle (fc::ColorOverlay)
<< FString (width, L' ')
<< FStyle (fc::Reset);
<< FStyle {fc::Reset}
<< FColorPair {wcolors.shadow_bg, wcolors.shadow_fg}
<< FStyle {fc::ColorOverlay}
<< FString {width, L' '}
<< FStyle {fc::Reset};
if ( w->isMonochron() )
w->setReverse(false);
@ -198,36 +198,36 @@ void drawBlockShadow (FWidget* w)
const std::size_t width = w->getWidth();
const std::size_t height = w->getHeight();
const auto& wcolors = FWidget::wcolors;
w->print() << FPoint(int(width) + 1, 1);
w->print() << FPoint {int(width) + 1, 1};
if ( w->isWindowWidget() )
{
w->print() << FColorPair (wcolors.shadow_fg, wcolors.shadow_bg)
<< FStyle (fc::InheritBackground); // current background color will be ignored
w->print() << FColorPair {wcolors.shadow_fg, wcolors.shadow_bg}
<< FStyle {fc::InheritBackground}; // current background color will be ignored
}
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); // ▄
if ( w->isWindowWidget() )
w->print() << FStyle (fc::InheritBackground);
w->print() << FStyle {fc::InheritBackground};
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; // █
}
w->print() << FPoint(2, int(height) + 1);
w->print() << FPoint {2, int(height) + 1};
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() )
w->print() << FStyle (fc::Reset);
w->print() << FStyle {fc::Reset};
}
//----------------------------------------------------------------------
@ -242,29 +242,29 @@ void clearShadow (FWidget* w)
if ( w->isWindowWidget() )
{
w->print() << FColorPair (wcolors.shadow_fg, wcolors.shadow_bg)
<< FStyle (fc::InheritBackground); // current background color will be ignored
w->print() << FColorPair {wcolors.shadow_fg, wcolors.shadow_bg}
<< FStyle {fc::InheritBackground}; // current background color will be ignored
}
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() )
{
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 █
}
}
if ( int(height) <= w->woffset.getY2() )
{
w->print() << FPoint(2, int(height) + 1)
<< FString(width, L' '); // clear ▀
w->print() << FPoint{2, int(height) + 1}
<< FString{width, L' '}; // clear ▀
}
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++)
{
w->print() << FPoint(0, int(y) + 1);
w->print() << FPoint {0, int(y) + 1};
if ( w->double_flatline_mask.left[uLong(y)] )
// left+right line (on left side)
@ -293,7 +293,7 @@ void drawFlatBorder (FWidget* w)
// right line (on left side)
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] )
// left+right line (on right side)
@ -303,7 +303,7 @@ void drawFlatBorder (FWidget* w)
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++)
{
@ -315,7 +315,7 @@ void drawFlatBorder (FWidget* w)
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++)
{
@ -346,7 +346,7 @@ void clearFlatBorder (FWidget* w)
for (std::size_t y{0}; y < height; y++)
{
// 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] )
w->print (fc::NF_border_line_left);
@ -354,7 +354,7 @@ void clearFlatBorder (FWidget* w)
w->print (' ');
// 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] )
w->print (fc::NF_rev_border_line_right);
@ -363,7 +363,7 @@ void clearFlatBorder (FWidget* w)
}
// clear at top
w->print() << FPoint(1, 0);
w->print() << FPoint {1, 0};
for (std::size_t x{0}; x < width; x++)
{
@ -374,7 +374,7 @@ void clearFlatBorder (FWidget* w)
}
// 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++)
{
@ -441,20 +441,20 @@ inline void drawBox (FWidget* w, const FRect& r)
w->print() << r.getUpperLeftPos()
<< fc::BoxDrawingsDownAndRight // ┌
<< FString(r.getWidth() - 2, fc::BoxDrawingsHorizontal) // ─
<< FString{r.getWidth() - 2, fc::BoxDrawingsHorizontal} // ─
<< fc::BoxDrawingsDownAndLeft; // ┐
for (int y = r.getY1() + 1; y < r.getY2(); y++)
{
w->print() << FPoint(r.getX1(), y)
w->print() << FPoint{r.getX1(), y}
<< fc::BoxDrawingsVertical // │
<< FPoint(r.getX2(), y)
<< FPoint{r.getX2(), y}
<< fc::BoxDrawingsVertical; // │
}
w->print() << r.getLowerLeftPos()
<< fc::BoxDrawingsUpAndRight // └
<< FString(r.getWidth() - 2, fc::BoxDrawingsHorizontal) // ─
<< FString{r.getWidth() - 2, fc::BoxDrawingsHorizontal} // ─
<< fc::BoxDrawingsUpAndLeft; // ┘
}
@ -465,20 +465,20 @@ inline void drawNewFontBox (FWidget* w, const FRect& r)
w->print() << r.getUpperLeftPos()
<< 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; // ┐
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 // │
<< FPoint(r.getX2(), y)
<< FPoint{r.getX2(), y}
<< fc::NF_border_line_vertical; // │
}
w->print() << r.getLowerLeftPos()
<< 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; // ┘
}
@ -487,20 +487,20 @@ inline void drawNewFontListBox (FWidget* w, const FRect& r)
{
w->print() << r.getUpperLeftPos()
<< 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; // ╷
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 ⎸
<< FPoint(r.getX2(), y)
<< FPoint{r.getX2(), y}
<< fc::NF_border_line_left; // border left ⎸
}
w->print() << r.getLowerLeftPos()
<< 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; // ╵
}

View File

@ -47,7 +47,7 @@ FWindow::FWindow(FWidget* parent)
: FWidget(parent)
{
setWindowWidget();
FRect geometry (getTermGeometry());
FRect geometry {getTermGeometry()};
geometry.move(-1, -1);
createArea (geometry, getShadow(), getVWin());
addWindow (this);
@ -174,9 +174,9 @@ bool FWindow::setTransparentShadow (bool enable)
setFlags().shadow = setFlags().trans_shadow = enable;
if ( enable )
setShadowSize (FSize(2, 1));
setShadowSize (FSize{2, 1});
else
setShadowSize (FSize(0, 0));
setShadowSize (FSize{0, 0});
return enable;
}
@ -191,13 +191,13 @@ bool FWindow::setShadow (bool enable)
{
setFlags().shadow = true;
setFlags().trans_shadow = false;
setShadowSize (FSize(1, 1));
setShadowSize (FSize{1, 1});
}
else
{
setFlags().shadow = false;
setFlags().trans_shadow = false;
setShadowSize (FSize(0, 0));
setShadowSize (FSize{0, 0});
}
return enable;
@ -241,23 +241,23 @@ void FWindow::drawBorder()
{
if ( isNewFont() ) // Draw a newfont outer frame
{
const FRect r(FPoint(1, 1), getSize());
const FRect r{FPoint{1, 1}, getSize()};
print() << r.getUpperLeftPos()
<< 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; // ⎤
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 ⎸
<< FPoint(r.getX2(), y)
<< FPoint{r.getX2(), y}
<< fc::NF_rev_border_line_right; // border right⎹
}
print() << r.getLowerLeftPos()
<< 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; // ⎦
}
else
@ -308,7 +308,7 @@ void FWindow::setY (int y, bool adjust)
//----------------------------------------------------------------------
void FWindow::setPos (const FPoint& p, bool adjust)
{
FPoint pos(p);
FPoint pos{p};
if ( pos.getY() < 1 )
pos.setY(1);
@ -331,7 +331,7 @@ void FWindow::setWidth (std::size_t w, bool adjust)
if ( isVirtualWindow() && getWidth() != old_width )
{
FRect geometry (getTermGeometry());
FRect geometry {getTermGeometry()};
geometry.move(-1, -1);
resizeArea (geometry, getShadow(), getVWin());
}
@ -345,7 +345,7 @@ void FWindow::setHeight (std::size_t h, bool adjust)
if ( isVirtualWindow() && getHeight() != old_height )
{
FRect geometry (getTermGeometry());
FRect geometry {getTermGeometry()};
geometry.move(-1, -1);
resizeArea (geometry, getShadow(), getVWin());
}
@ -361,7 +361,7 @@ void FWindow::setSize (const FSize& size, bool adjust)
if ( isVirtualWindow()
&& (getWidth() != old_width || getHeight() != old_height) )
{
FRect geometry (getTermGeometry());
FRect geometry {getTermGeometry()};
geometry.move(-1, -1);
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_y = getY();
FPoint pos(p);
const FSize old_size(getSize());
FPoint pos{p};
const FSize old_size{getSize()};
if ( pos.getY() < 1 )
pos.setY(1);
@ -387,7 +387,7 @@ void FWindow::setGeometry ( const FPoint& p, const FSize& size, bool adjust)
if ( getSize() != old_size )
{
FRect geometry (getTermGeometry());
FRect geometry {getTermGeometry()};
geometry.move(-1, -1);
resizeArea (geometry, getShadow(), getVWin());
}
@ -658,7 +658,7 @@ bool FWindow::zoomWindow()
// save the current geometry
normalGeometry = getGeometry();
const FRect oldGeometry (getTermGeometryWithShadow());
setGeometry (FPoint(1, 1), FSize(getMaxWidth(), getMaxHeight()));
setGeometry (FPoint{1, 1}, FSize{getMaxWidth(), getMaxHeight()});
restoreVTerm (oldGeometry);
redraw();
}
@ -772,7 +772,7 @@ void FWindow::adjustSize()
FWidget::adjustSize();
if ( zoomed )
setGeometry (FPoint(1, 1), FSize(getMaxWidth(), getMaxHeight()), false);
setGeometry (FPoint{1, 1}, FSize{getMaxWidth(), getMaxHeight()}, false);
else if ( isVirtualWindow() )
{
if ( getTermX() != old_x )

View File

@ -142,7 +142,7 @@ class FApplication : public FWidget
static void cmd_options (const int&, char*[]);
static FStartOptions& getStartOptions();
void findKeyboardWidget();
bool isKeyPressed();
bool isKeyPressed() const;
void keyPressed();
void keyReleased();
void escapeKeyPressed();

View File

@ -116,7 +116,7 @@ class FButton : public FWidget
bool isFlat() const;
bool isDown() const;
bool hasShadow() const;
bool hasClickAnimation();
bool hasClickAnimation() const;
// Methods
void hide() override;
@ -257,7 +257,7 @@ inline bool FButton::hasShadow() const
{ return getFlags().shadow; }
//----------------------------------------------------------------------
inline bool FButton::hasClickAnimation()
inline bool FButton::hasClickAnimation() const
{ return click_animation; }
} // namespace finalcut

View File

@ -89,7 +89,7 @@ class FDropDownListBox : public FWindow
void setGeometry ( const FPoint&, const FSize&
, bool = true ) override;
// Inquiries
bool isEmpty();
bool isEmpty() const;
// Methods
void show() override;
@ -118,7 +118,7 @@ inline const FString FDropDownListBox::getClassName() const
{ return "FDropDownListBox"; }
//----------------------------------------------------------------------
inline bool FDropDownListBox::isEmpty()
inline bool FDropDownListBox::isEmpty() const
{ return bool( list.getCount() == 0 ); }
@ -178,7 +178,7 @@ class FComboBox : public FWidget
void setLabelOrientation (const FLineEdit::label_o);
// Inquiries
bool hasShadow();
bool hasShadow() const;
// Methods
void insert (const FListBoxItem&);
@ -294,7 +294,7 @@ inline bool FComboBox::unsetEditable()
{ return setEditable(false); }
//----------------------------------------------------------------------
inline bool FComboBox::hasShadow()
inline bool FComboBox::hasShadow() const
{ return getFlags().shadow; }
//----------------------------------------------------------------------

View File

@ -192,13 +192,13 @@ class FDialog : public FWindow
void deactivateZoomButton();
void leaveZoomButton (const mouseStates&);
void pressZoomButton (const mouseStates&);
bool isMouseOverMenu (const FPoint&);
bool isMouseOverMenu (const FPoint&) const;
void passEventToSubMenu (const mouseStates&, const FMouseEvent*);
void moveSizeKey (FKeyEvent*);
void raiseActivateDialog();
void lowerActivateDialog();
bool isOutsideTerminal (const FPoint&);
bool isLowerRightResizeCorner (const mouseStates&);
bool isOutsideTerminal (const FPoint&) const;
bool isLowerRightResizeCorner (const mouseStates&) const;
void resizeMouseDown (const mouseStates&);
void resizeMouseUpMove (const mouseStates&, bool = false);
void cancelMouseResize();

View File

@ -140,18 +140,18 @@ class FMouseEvent : public FEvent // mouse event
FMouseEvent (fc::events, const FPoint&, int);
~FMouseEvent();
const FPoint& getPos() const;
const FPoint& getTermPos() const;
int getX() const;
int getY() const;
int getTermX() const;
int getTermY() const;
int getButton() const;
const FPoint& getPos() const;
const FPoint& getTermPos() const;
int getX() const;
int getY() const;
int getTermX() const;
int getTermY() const;
int getButton() const;
private:
FPoint p{};
FPoint tp{};
int b{};
FPoint p{};
FPoint tp{};
int b{};
};
@ -167,18 +167,18 @@ class FWheelEvent : public FEvent // wheel event
FWheelEvent (fc::events, const FPoint&, const FPoint&, int);
~FWheelEvent();
const FPoint& getPos() const;
const FPoint& getTermPos() const;
int getX() const;
int getY() const;
int getTermX() const;
int getTermY() const;
int getWheel() const;
const FPoint& getPos() const;
const FPoint& getTermPos() const;
int getX() const;
int getY() const;
int getTermX() const;
int getTermY() const;
int getWheel() const;
private:
FPoint p;
FPoint tp;
int w;
FPoint p;
FPoint tp;
int w;
};
@ -193,16 +193,16 @@ class FFocusEvent : public FEvent // focus event
explicit FFocusEvent (fc::events);
~FFocusEvent();
bool gotFocus() const;
bool lostFocus() const;
bool gotFocus() const;
bool lostFocus() const;
fc::FocusTypes getFocusType() const;
void setFocusType(fc::FocusTypes);
bool isAccepted() const;
void accept();
void ignore();
void setFocusType(fc::FocusTypes);
bool isAccepted() const;
void accept();
void ignore();
private:
bool accpt{true};
bool accpt{true};
fc::FocusTypes focus_type{fc::FocusDefiniteWidget};
};

View File

@ -142,9 +142,39 @@ class FFileDialog : public FDialog
private:
// 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
uChar fifo : 1;
uChar character_device : 1;
@ -156,7 +186,7 @@ class FFileDialog : public FDialog
uChar : 1; // padding bits
};
typedef std::vector<dir_entry> dirEntries;
typedef std::vector<FDirEntry> dirEntries;
// Methods
void init();
@ -168,7 +198,7 @@ class FFileDialog : public FDialog
void sortDir();
int readDir();
void getEntry (const char* const, const struct dirent*);
void followSymLink (const char* const, dir_entry&);
void followSymLink (const char* const, FDirEntry&);
void dirEntriesToList();
void selectDirectoryEntry (const char* const);
int changeDir (const FString&);
@ -198,10 +228,10 @@ class FFileDialog : public FDialog
bool show_hidden{false};
// Friend functions
friend bool sortByName ( const FFileDialog::dir_entry&
, const FFileDialog::dir_entry& );
friend bool sortDirFirst ( const FFileDialog::dir_entry&
, const FFileDialog::dir_entry& );
friend bool sortByName ( const FFileDialog::FDirEntry&
, const FFileDialog::FDirEntry& );
friend bool sortDirFirst ( const FFileDialog::FDirEntry&
, const FFileDialog::FDirEntry& );
friend const FString fileChooser ( FWidget*
, const FString&
, const FString&

View File

@ -120,12 +120,12 @@ class FKeyboard final
void setEscPressedCommand (const FKeyboardCommand&);
// Inquiry
bool isInputDataPending();
bool isInputDataPending() const;
// Methods
static void init();
bool& unprocessedInput();
bool isKeyPressed();
bool isKeyPressed() const;
void clearKeyBuffer();
void clearKeyBufferOnTimeout();
void fetchKeyCode();
@ -248,7 +248,7 @@ inline void FKeyboard::setEscPressedCommand (const FKeyboardCommand& cmd)
{ escape_key_cmd = cmd; }
//----------------------------------------------------------------------
inline bool FKeyboard::isInputDataPending()
inline bool FKeyboard::isInputDataPending() const
{ return input_data_pending; }
//----------------------------------------------------------------------
inline bool FKeyboard::setNonBlockingInput()

View File

@ -110,8 +110,8 @@ class FLabel : public FWidget
void setText (const FString&);
// Inquiries
bool hasEmphasis();
bool hasReverseMode();
bool hasEmphasis() const;
bool hasReverseMode() const;
// Methods
void hide() override;
@ -224,11 +224,11 @@ inline void FLabel::setNumber (lDouble num, int precision)
{ setText(FString().setNumber(num, precision)); }
//----------------------------------------------------------------------
inline bool FLabel::hasEmphasis()
inline bool FLabel::hasEmphasis() const
{ return emphasis; }
//----------------------------------------------------------------------
inline bool FLabel::hasReverseMode()
inline bool FLabel::hasReverseMode() const
{ return reverse_mode; }
//----------------------------------------------------------------------

View File

@ -178,7 +178,7 @@ class FLineEdit : public FWidget
// Methods
void init();
bool hasHotkey();
bool hasHotkey() const;
void draw() override;
void drawInputField();
std::size_t printTextField();

View File

@ -189,10 +189,10 @@ class FListBox : public FWidget
void setText (const FString&);
// Inquiries
bool isSelected (std::size_t);
bool isSelected (std::size_t) const;
bool isSelected (listBoxItems::iterator) const;
bool isMultiSelection() const;
bool hasBrackets (std::size_t);
bool hasBrackets (std::size_t) const;
bool hasBrackets (listBoxItems::iterator) const;
// Methods
@ -250,8 +250,8 @@ class FListBox : public FWidget
static FString& getString (listBoxItems::iterator);
// Inquiry
bool isHorizontallyScrollable();
bool isVerticallyScrollable();
bool isHorizontallyScrollable() const;
bool isVerticallyScrollable() const;
// Methods
void init();
@ -451,7 +451,7 @@ inline bool FListBox::setDisable()
{ 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; }
//----------------------------------------------------------------------
@ -463,7 +463,7 @@ inline bool FListBox::isMultiSelection() const
{ 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); }
//----------------------------------------------------------------------
@ -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() ); }
//----------------------------------------------------------------------
inline bool FListBox::isVerticallyScrollable()
inline bool FListBox::isVerticallyScrollable() const
{ return bool( getCount() > getClientHeight() ); }
//----------------------------------------------------------------------

View File

@ -168,7 +168,10 @@ inline const FString FMessageBox::getClassName() 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

View File

@ -103,7 +103,7 @@ class FMouse
// Accessors
virtual const FString getClassName() const;
FPoint& getPos();
const FPoint& getPos();
void clearEvent();
// Mutators
@ -161,7 +161,7 @@ class FMouse
// Accessors
FMouseButton& getButtonState();
FPoint& getNewPos();
const FPoint& getNewPos();
uInt16 getMaxWidth();
uInt16 getMaxHeight();
uInt64 getDblclickInterval();
@ -459,7 +459,7 @@ class FMouseControl
// Accessors
virtual const FString getClassName() const;
FPoint& getPos();
const FPoint& getPos();
void clearEvent();
// Mutators

View File

@ -260,7 +260,7 @@ class FOptiAttr final
static bool hasNoAttribute (const FChar* const&);
// Methods
bool hasColorChanged (const FChar* const&, const FChar* const&);
bool hasColorChanged (const FChar* const&, const FChar* const&) const;
void resetColor (FChar*&);
void prevent_no_color_video_attributes (FChar*&, bool = false);
void deactivateAttributes (FChar*&, FChar*&);
@ -272,7 +272,7 @@ class FOptiAttr final
void resetAttribute (FChar*&);
void reset (FChar*&);
bool caused_reset_attributes (const char[], uChar = all_tests);
bool hasCharsetEquivalence();
bool hasCharsetEquivalence() const;
void detectSwitchOn (const FChar* const&, const FChar* const&);
void detectSwitchOff (const FChar* const&, const FChar* const&);
bool switchOn();

View File

@ -194,7 +194,7 @@ class FOptiMove final
void rightMove (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 isMethod1Faster (int&, int, int, int, int);
bool isMethod2Faster (int&, int, int, int);

View File

@ -92,9 +92,9 @@ class FPoint
// Friend operator functions
friend bool operator == (const FPoint&, const FPoint&);
friend bool operator != (const FPoint&, const FPoint&);
friend FPoint operator + (const FPoint&, const FPoint&);
friend FPoint operator - (const FPoint&, const FPoint&);
friend FPoint operator - (const FPoint&);
friend const FPoint operator + (const FPoint&, const FPoint&);
friend const FPoint operator - (const FPoint&, const FPoint&);
friend const FPoint operator - (const FPoint&);
friend std::ostream& operator << (std::ostream&, const 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; }
//----------------------------------------------------------------------
inline FPoint operator + (const FPoint& p1, const FPoint& p2)
{ return FPoint(p1.xpos + p2.xpos, p1.ypos + p2.ypos); }
inline const FPoint operator + (const FPoint& p1, const FPoint& p2)
{ return {p1.xpos + p2.xpos, p1.ypos + p2.ypos}; }
//----------------------------------------------------------------------
inline FPoint operator - (const FPoint& p1, const FPoint& p2)
{ return FPoint(p1.xpos - p2.xpos, p1.ypos - p2.ypos); }
inline const FPoint operator - (const FPoint& p1, const FPoint& p2)
{ return {p1.xpos - p2.xpos, p1.ypos - p2.ypos}; }
//----------------------------------------------------------------------
inline FPoint operator - (const FPoint& p)
{ return FPoint(-p.xpos, -p.ypos); }
inline const FPoint operator - (const FPoint& p)
{ return {-p.xpos, -p.ypos}; }
} // namespace finalcut

View File

@ -82,7 +82,7 @@ class FProgressbar : public FWidget
bool unsetShadow();
// Inquiries
bool hasShadow();
bool hasShadow() const;
// Methods
void hide() override;
@ -123,7 +123,7 @@ inline bool FProgressbar::unsetShadow()
{ return setShadow(false); }
//----------------------------------------------------------------------
inline bool FProgressbar::hasShadow()
inline bool FProgressbar::hasShadow() const
{ return getFlags().shadow; }
} // namespace finalcut

View File

@ -80,14 +80,14 @@ class FRect
int getY2() const;
int getX() const;
int getY() const;
FPoint getPos() const;
FPoint getUpperLeftPos() const;
FPoint getUpperRightPos() const;
FPoint getLowerLeftPos() const;
FPoint getLowerRightPos() const;
const FPoint getPos() const;
const FPoint getUpperLeftPos() const;
const FPoint getUpperRightPos() const;
const FPoint getLowerLeftPos() const;
const FPoint getLowerRightPos() const;
std::size_t getWidth() const;
std::size_t getHeight() const;
FSize getSize() const;
const FSize getSize() const;
// Mutators
void setX1 (int);
@ -137,8 +137,8 @@ class FRect
int Y2{-1};
// Friend operator functions
friend FRect operator + (const FRect&, const FSize&);
friend FRect operator - (const FRect&, const FSize&);
friend const 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 std::ostream& operator << (std::ostream&, const FRect&);

View File

@ -115,8 +115,8 @@ class FScrollView : public FWidget
void setVerticalScrollBarMode (fc::scrollBarMode);
// Inquiries
bool hasBorder();
bool isViewportPrint();
bool hasBorder() const;
bool isViewportPrint() const;
// Methods
void clearArea (int = ' ') override;
@ -156,7 +156,7 @@ class FScrollView : public FWidget
static constexpr int horizontal_border_spacing = 2;
// Accessors
FPoint getViewportCursorPos();
const FPoint getViewportCursorPos();
// Methods
void init (const FWidget*);
@ -182,7 +182,6 @@ class FScrollView : public FWidget
FScrollbarPtr hbar{nullptr};
keyMap key_map{};
uInt8 nf_offset{0};
bool border{true};
bool use_own_print_area{false};
bool update_scrollbar{true};
fc::scrollBarMode v_mode{fc::Auto}; // fc:Auto, fc::Hidden or fc::Scroll
@ -247,11 +246,11 @@ inline bool FScrollView::unsetBorder()
{ return setBorder(false); }
//----------------------------------------------------------------------
inline bool FScrollView::hasBorder()
{ return border; }
inline bool FScrollView::hasBorder() const
{ return ! getFlags().no_border; }
//----------------------------------------------------------------------
inline bool FScrollView::isViewportPrint()
inline bool FScrollView::isViewportPrint() const
{ return ! use_own_print_area; }
//----------------------------------------------------------------------

View File

@ -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 FSize operator + (const FSize&, const FSize&);
friend FSize operator - (const FSize&, const FSize&);
friend const FSize operator + (const FSize&, const FSize&);
friend const FSize operator - (const FSize&, const FSize&);
friend std::ostream& operator << (std::ostream&, const 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; }
//----------------------------------------------------------------------
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();
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;
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 h = ( s1.height >= s2.height ) ? s1.height - s2.height : 0;
return FSize(w, h);
return {w, h};
}
} // namespace finalcut

View File

@ -108,7 +108,7 @@ class FSpinBox : public FWidget
void setLabelOrientation (const FLineEdit::label_o);
// Inquiries
bool hasShadow();
bool hasShadow() const;
// Methods
void hide() override;
@ -205,7 +205,7 @@ inline bool FSpinBox::unsetShadow()
{ return setShadow(false); }
//----------------------------------------------------------------------
inline bool FSpinBox::hasShadow()
inline bool FSpinBox::hasShadow() const
{ return getFlags().shadow; }
//----------------------------------------------------------------------

View File

@ -208,7 +208,7 @@ class FStatusBar : public FWindow
// Inquiries
bool isActivated (int) const;
bool hasActivatedKey();
bool hasActivatedKey() const;
// Methods
void hide() override;

View File

@ -190,8 +190,8 @@ class FString
char* c_str();
const std::string toString() const;
FString toLower() const;
FString toUpper() const;
const FString toLower() const;
const FString toUpper() const;
sInt16 toShort() const;
uInt16 toUShort() const;
@ -202,13 +202,13 @@ class FString
float toFloat() const;
double toDouble() const;
FString ltrim() const;
FString rtrim() const;
FString trim() const;
const FString ltrim() const;
const FString rtrim() const;
const FString trim() const;
FString left (std::size_t) const;
FString right (std::size_t) const;
FString mid (std::size_t, std::size_t) const;
const FString left (std::size_t) const;
const FString right (std::size_t) const;
const FString mid (std::size_t, std::size_t) const;
FStringList split (const FString&);
FString& setString (const FString&);
@ -227,10 +227,10 @@ class FString
const FString& insert (const FString&, int);
const FString& insert (const FString&, std::size_t);
FString replace (const FString&, const FString&);
const FString replace (const FString&, const FString&);
FString replaceControlCodes() const;
FString expandTabs (int = 8) const;
const FString replaceControlCodes() const;
const FString expandTabs (int = 8) const;
FString removeDel() const;
FString removeBackspaces() const;

View File

@ -60,7 +60,7 @@ class FSystem
// Methods
virtual uChar inPortByte (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 open (const char*, int, ...) = 0;
virtual int close (int) = 0;

View File

@ -121,7 +121,7 @@ class FSystemImpl : public FSystem
{ }
#endif
int isTTY (int fd) override
int isTTY (int fd) const override
{
return ::isatty(fd);
}

View File

@ -392,9 +392,9 @@ bool isReverseNewFontchar (wchar_t);
bool hasFullWidthSupports();
wchar_t cp437_to_unicode (uChar);
uChar unicode_to_cp437 (wchar_t);
FString getFullWidth (const FString&);
FString getHalfWidth (const FString&);
FString getColumnSubString (const FString&, std::size_t, std::size_t);
const FString getFullWidth (const FString&);
const FString getHalfWidth (const FString&);
const FString getColumnSubString (const FString&, std::size_t, 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&);

View File

@ -96,7 +96,7 @@ class FTermLinux final
const FString getClassName() const;
fc::linuxConsoleCursorStyle getCursorStyle();
char* getCursorStyleString();
int getFramebufferBpp();
int getFramebufferBpp() const;
// Mutators
bool setCursorStyle (CursorStyle);
@ -105,8 +105,8 @@ class FTermLinux final
// Inquiries
bool isLinuxConsole();
bool isVGAFontUsed();
bool isNewFontUsed();
bool isVGAFontUsed() const;
bool isNewFontUsed() const;
// Methods
void init();
@ -209,15 +209,15 @@ inline const FString FTermLinux::getClassName() const
//----------------------------------------------------------------------
#if defined(__linux__)
inline int FTermLinux::getFramebufferBpp()
inline int FTermLinux::getFramebufferBpp() const
{ return framebuffer_bpp; }
//----------------------------------------------------------------------
inline bool FTermLinux::isVGAFontUsed()
inline bool FTermLinux::isVGAFontUsed() const
{ return vga_font; }
//----------------------------------------------------------------------
inline bool FTermLinux::isNewFontUsed()
inline bool FTermLinux::isNewFontUsed() const
{ return new_font; }
#endif // defined(__linux__)

View File

@ -81,19 +81,19 @@ class FTermXTerminal final
// Accessors
const FString getClassName() const;
fc::xtermCursorStyle getCursorStyle();
const FString getFont();
const FString getTitle();
const FString getForeground();
const FString getBackground();
const FString getCursorColor();
const FString getMouseForeground();
const FString getMouseBackground();
const FString getHighlightBackground();
fc::xtermCursorStyle getCursorStyle() const;
const FString getFont() const;
const FString getTitle() const;
const FString getForeground() const;
const FString getBackground() const;
const FString getCursorColor() const;
const FString getMouseForeground() const;
const FString getMouseBackground() const;
const FString getHighlightBackground() const;
// Inquiries
bool hasFont();
bool hasTitle();
bool hasFont() const;
bool hasTitle() const;
// Methods
void init();
@ -171,47 +171,47 @@ inline void FTermXTerminal::redefineDefaultColors (bool enable)
{ xterm_default_colors = enable; }
//----------------------------------------------------------------------
inline fc::xtermCursorStyle FTermXTerminal::getCursorStyle()
inline fc::xtermCursorStyle FTermXTerminal::getCursorStyle() const
{ return cursor_style; }
//----------------------------------------------------------------------
inline const FString FTermXTerminal::getFont()
inline const FString FTermXTerminal::getFont() const
{ return xterm_font; }
//----------------------------------------------------------------------
inline const FString FTermXTerminal::getTitle()
inline const FString FTermXTerminal::getTitle() const
{ return xterm_title; }
//----------------------------------------------------------------------
inline const FString FTermXTerminal::getForeground()
inline const FString FTermXTerminal::getForeground() const
{ return foreground_color; }
//----------------------------------------------------------------------
inline const FString FTermXTerminal::getBackground()
inline const FString FTermXTerminal::getBackground() const
{ return background_color; }
//----------------------------------------------------------------------
inline const FString FTermXTerminal::getCursorColor()
inline const FString FTermXTerminal::getCursorColor() const
{ return cursor_color; }
//----------------------------------------------------------------------
inline const FString FTermXTerminal::getMouseForeground()
inline const FString FTermXTerminal::getMouseForeground() const
{ return mouse_foreground_color; }
//----------------------------------------------------------------------
inline const FString FTermXTerminal::getMouseBackground()
inline const FString FTermXTerminal::getMouseBackground() const
{ return mouse_background_color; }
//----------------------------------------------------------------------
inline const FString FTermXTerminal::getHighlightBackground()
inline const FString FTermXTerminal::getHighlightBackground() const
{ return highlight_background_color; }
//----------------------------------------------------------------------
inline bool FTermXTerminal::hasFont()
inline bool FTermXTerminal::hasFont() const
{ return bool(xterm_font.getLength() > 2); }
//----------------------------------------------------------------------
inline bool FTermXTerminal::hasTitle()
inline bool FTermXTerminal::hasTitle() const
{ return bool(xterm_title.getLength() > 0); }
//----------------------------------------------------------------------

View File

@ -102,7 +102,7 @@ class FToggleButton : public FWidget
virtual void setText (const FString&);
// Inquiries
bool isChecked();
bool isChecked() const;
// Method
void hide() override;
@ -208,7 +208,7 @@ inline bool FToggleButton::unsetChecked()
{ return setChecked(false); }
//----------------------------------------------------------------------
inline bool FToggleButton::isChecked()
inline bool FToggleButton::isChecked() const
{ return checked; }
//----------------------------------------------------------------------

View File

@ -146,8 +146,8 @@ class FVTerm
static FColor getTermBackgroundColor();
FTermArea*& getVWin();
const FTermArea* getVWin() const;
FPoint getPrintCursor();
static FChar getAttribute();
const FPoint getPrintCursor();
static const FChar getAttribute();
static int getMaxColor();
static int getTabstop();
static fc::encoding getEncoding();
@ -419,15 +419,15 @@ class FVTerm
, const FPoint& );
void updateVTerm();
static void callPreprocessingHandler (const FTermArea*);
bool hasChildAreaChanges (FTermArea*);
bool hasChildAreaChanges (FTermArea*) const;
void clearChildAreaChanges (const FTermArea*);
static bool isInsideArea (const FPoint&, const FTermArea*);
static FChar generateCharacter (const FPoint&);
static FChar getCharacter ( character_type
static const FChar generateCharacter (const FPoint&);
static const FChar getCharacter ( character_type
, const FPoint&
, FVTerm* );
static FChar getCoveredCharacter (const FPoint&, FVTerm*);
static FChar getOverlappedCharacter (const FPoint&, FVTerm*);
static const FChar getCoveredCharacter (const FPoint&, FVTerm*);
static const FChar getOverlappedCharacter (const FPoint&, FVTerm*);
void init (bool);
static void init_characterLengths (const FOptiMove*);
void finish();
@ -452,8 +452,8 @@ class FVTerm
void skipPaddingCharacter (uInt&, uInt, const FChar* const&);
exit_state eraseCharacters (uInt&, uInt, uInt, bool);
exit_state repeatCharacter (uInt&, uInt, uInt);
bool isFullWidthChar (const FChar* const&);
bool isFullWidthPaddingChar (const FChar* const&);
bool isFullWidthChar (const FChar* const&) const;
bool isFullWidthPaddingChar (const FChar* const&) const;
static void cursorWrap();
bool printWrap (FTermArea*);
void printPaddingCharacter (FTermArea*, const FChar&);
@ -509,37 +509,36 @@ class FVTerm
struct FVTerm::FTermArea // define virtual terminal character properties
{
public:
// Constructor
FTermArea() = default;
// Constructor
FTermArea() = default;
// Disable copy constructor
FTermArea (const FTermArea&) = delete;
// Disable copy constructor
FTermArea (const FTermArea&) = delete;
// Destructor
~FTermArea() = default;
// Destructor
~FTermArea() = default;
// Disable copy assignment operator (=)
FTermArea& operator = (const FTermArea&) = delete;
// Disable copy assignment operator (=)
FTermArea& operator = (const FTermArea&) = delete;
// Data members
int offset_left{0}; // Distance from left terminal side
int offset_top{0}; // Distance from top of the terminal
int width{-1}; // Window width
int height{-1}; // Window height
int right_shadow{0}; // Right window shadow
int bottom_shadow{0}; // Bottom window shadow
int cursor_x{0}; // X-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_y{-1}; // Y-position input cursor
FWidget* widget{nullptr}; // Widget that owns this FTermArea
FPreprocessing preproc_list{};
FLineChanges* changes{nullptr};
FChar* data{nullptr}; // FChar data of the drawing area
bool input_cursor_visible{false};
bool has_changes{false};
bool visible{false};
// Data members
int offset_left{0}; // Distance from left terminal side
int offset_top{0}; // Distance from top of the terminal
int width{-1}; // Window width
int height{-1}; // Window height
int right_shadow{0}; // Right window shadow
int bottom_shadow{0}; // Bottom window shadow
int cursor_x{0}; // X-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_y{-1}; // Y-position input cursor
FWidget* widget{nullptr}; // Widget that owns this FTermArea
FPreprocessing preproc_list{};
FLineChanges* changes{nullptr};
FChar* data{nullptr}; // FChar data of the drawing area
bool input_cursor_visible{false};
bool has_changes{false};
bool visible{false};
};
@ -675,7 +674,7 @@ inline const FVTerm::FTermArea* FVTerm::getVWin() const
{ return vwin; }
//----------------------------------------------------------------------
inline FChar FVTerm::getAttribute()
inline const FChar FVTerm::getAttribute()
{ return next_attribute; }
//----------------------------------------------------------------------
@ -692,11 +691,17 @@ inline fc::encoding FVTerm::getEncoding()
//----------------------------------------------------------------------
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)
{ return FTerm::getKeyName(keynum); }
{
const FString& name = FTerm::getKeyName(keynum); // initialize name
return name;
}
//----------------------------------------------------------------------
inline const char* FVTerm::getTermType()

View File

@ -231,8 +231,8 @@ class FWidget : public FVTerm, public FObject
std::size_t getDesktopWidth();
std::size_t getDesktopHeight();
const FWidgetFlags& getFlags() const;
FPoint getCursorPos();
FPoint getPrintPos();
const FPoint getCursorPos();
const FPoint getPrintPos();
// Mutators
static void setMainWidget (FWidget*);
@ -306,7 +306,7 @@ class FWidget : public FVTerm, public FObject
bool hasVisibleCursor() const;
bool hasFocus() const;
bool acceptFocus() const; // is focusable
bool isPaddingIgnored();
bool isPaddingIgnored() const;
// Methods
FWidget* childWidgetAt (const FPoint&);
@ -334,7 +334,7 @@ class FWidget : public FVTerm, public FObject
virtual void hide();
virtual bool focusFirstChild(); // widget focusing
virtual bool focusLastChild();
FPoint termToWidgetPos (const FPoint&);
const FPoint termToWidgetPos (const FPoint&);
void print (const FPoint&) override;
virtual void move (const FPoint&);
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
{ return adjust_wsize.getPos(); }
{
const FPoint& pos = adjust_wsize.getPos(); // initialize pos
return pos;
}
//----------------------------------------------------------------------
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
{ return FPoint(getTermX(), getTermY()); }
{ return {getTermX(), getTermY()}; }
//----------------------------------------------------------------------
inline std::size_t FWidget::getWidth() const
@ -699,7 +702,10 @@ inline std::size_t FWidget::getHeight() 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
@ -727,7 +733,10 @@ inline std::size_t FWidget::getClientHeight() 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
@ -800,7 +809,7 @@ inline const FWidget::FWidgetFlags& FWidget::getFlags() const
{ return flags; }
//----------------------------------------------------------------------
inline FPoint FWidget::getCursorPos()
inline const FPoint FWidget::getCursorPos()
{ return widget_cursor_position; }
//----------------------------------------------------------------------
@ -971,7 +980,7 @@ inline void FWidget::setFixedSize (const FSize& size)
//----------------------------------------------------------------------
inline void FWidget::unsetCursorPos()
{ setCursorPos (FPoint(-1, -1)); }
{ setCursorPos ({-1, -1}); }
//----------------------------------------------------------------------
inline void FWidget::unsetDoubleFlatLine (fc::sides side)
@ -1026,7 +1035,7 @@ inline bool FWidget::acceptFocus() const // is focusable
{ return flags.focusable; }
//----------------------------------------------------------------------
inline bool FWidget::isPaddingIgnored()
inline bool FWidget::isPaddingIgnored() const
{ return ignore_padding; }
//----------------------------------------------------------------------
@ -1042,10 +1051,10 @@ inline void FWidget::delAccelerator()
{ 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()
, tPos.getY() + 1 - woffset.getY1() - adjust_wsize.getY() );
return { tPos.getX() + 1 - woffset.getX1() - adjust_wsize.getX()
, tPos.getY() + 1 - woffset.getY1() - adjust_wsize.getY() };
}
//----------------------------------------------------------------------
@ -1057,7 +1066,7 @@ inline void FWidget::print (const FPoint& pos)
//----------------------------------------------------------------------
inline void FWidget::drawBorder()
{
finalcut::drawBorder (this, FRect(FPoint(1, 1), getSize()));
finalcut::drawBorder (this, FRect(FPoint{1, 1}, getSize()));
}
//----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
* *
* 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 *
* 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();
}
finalcut::FPoint& getNewMousePosition()
const finalcut::FPoint& getNewMousePosition()
{
return finalcut::FMouse::getNewPos();
}

View File

@ -3,7 +3,7 @@
* *
* 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 *
* modify it under the terms of the GNU Lesser General Public License *
@ -54,7 +54,7 @@ class FSystemTest : public finalcut::FSystem
// Methods
uChar inPortByte (uShort) override;
void outPortByte (uChar, uShort) override;
int isTTY (int) override;
int isTTY (int) const override;
int ioctl (int, uLong, ...) override;
int open (const char*, 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";
return 1;

Some files were not shown because too many files have changed in this diff Show More