diff --git a/examples/7segment.cpp b/examples/7segment.cpp index 82d61ddc..3faf48e6 100644 --- a/examples/7segment.cpp +++ b/examples/7segment.cpp @@ -59,9 +59,6 @@ class SegmentView final : public finalcut::FDialog unsigned char : 1; // padding bit } sevenSegment; - // Mutator - void setGeometry (const FRect&, bool = true) override; - // Methods void hexEncoding(); void get7Segment (const wchar_t); @@ -79,13 +76,15 @@ class SegmentView final : public finalcut::FDialog SegmentView::SegmentView (finalcut::FWidget* parent) : FDialog(parent) { + // Dialog settings + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FDialog::setText ("Seven-segment display"); + FDialog::setGeometry (FPoint(25, 5), FSize(42, 15)); + // Set encoding hexEncoding(); - // Dialog settings - setText ("Seven-segment display"); - setGeometry (FPoint(25, 5), FSize(42, 15)); - // Input field Input.setGeometry (FPoint(2, 2), FSize(12, 1)); Input.setLabelText (L"&Hex value"); @@ -116,14 +115,6 @@ SegmentView::SegmentView (finalcut::FWidget* parent) ); } -//---------------------------------------------------------------------- -void SegmentView::setGeometry (const FRect& box, bool adjust) -{ - // Avoids calling a virtual function from the constructor - // (CERT, OOP50-CPP) - FDialog::setGeometry (box, adjust); -} - //---------------------------------------------------------------------- void SegmentView::hexEncoding() { diff --git a/examples/background-color.cpp b/examples/background-color.cpp index 3f4c73a8..7e59610b 100644 --- a/examples/background-color.cpp +++ b/examples/background-color.cpp @@ -57,9 +57,6 @@ class Background final : public finalcut::FDialog Background& operator = (const Background&) = delete; private: - // Mutator - void setGeometry (const FRect&, bool = true) override; - // Callback method void cb_changed (const finalcut::FWidget*, const FDataPtr); void cb_choice (const finalcut::FWidget*, const FDataPtr); @@ -98,8 +95,10 @@ Background::Background (finalcut::FWidget* parent) : FDialog(parent) { // Dialog settings - setText ("Background color palette"); - setGeometry (FPoint(25, 5), FSize(32, 12)); + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FDialog::setText ("Background color palette"); + FDialog::setGeometry (FPoint(25, 5), FSize(32, 12)); // Combobox color_choice.setGeometry (FPoint(2, 2), FSize(18, 1)); @@ -175,14 +174,6 @@ Background::Background (finalcut::FWidget* parent) Background::~Background() // destructor { } -//---------------------------------------------------------------------- -void Background::setGeometry (const FRect& box, bool adjust) -{ - // Avoids calling a virtual function from the constructor - // (CERT, OOP50-CPP) - FDialog::setGeometry (box, adjust); -} - //---------------------------------------------------------------------- void Background::cb_changed (const finalcut::FWidget*, const FDataPtr) { diff --git a/examples/calculator.cpp b/examples/calculator.cpp index 4d480b6b..1a21c805 100644 --- a/examples/calculator.cpp +++ b/examples/calculator.cpp @@ -119,9 +119,6 @@ class Calc final : public finalcut::FDialog // Destructor ~Calc() override; - // Mutator - void setGeometry (const FRect&, bool = true) override; - // Event handlers void onKeyPress (finalcut::FKeyEvent*) override; void onClose (finalcut::FCloseEvent*) override; @@ -249,11 +246,15 @@ class Calc final : public finalcut::FDialog Calc::Calc (FWidget* parent) : finalcut::FDialog(parent) { + // Dialog settings + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FDialog::setText ("Calculator"); + FDialog::setGeometry (FPoint(19, 6), FSize(37, 18)); + mapKeyFunctions(); clearInfixOperator(); std::setlocale(LC_NUMERIC, "C"); - setText ("Calculator"); - setGeometry (FPoint(19, 6), FSize(37, 18)); for (std::size_t key{0}; key < Calc::NUM_OF_BUTTONS; key++) { @@ -306,14 +307,6 @@ Calc::Calc (FWidget* parent) Calc::~Calc() { } -//---------------------------------------------------------------------- -void Calc::setGeometry (const FRect& box, bool adjust) -{ - // Avoids calling a virtual function from the constructor - // (CERT, OOP50-CPP) - FDialog::setGeometry (box, adjust); -} - //---------------------------------------------------------------------- void Calc::onKeyPress (finalcut::FKeyEvent* ev) { diff --git a/examples/checklist.cpp b/examples/checklist.cpp index 48f0c5aa..1c9c0d05 100644 --- a/examples/checklist.cpp +++ b/examples/checklist.cpp @@ -55,9 +55,6 @@ class CheckList final : public finalcut::FDialog // Disable copy assignment operator (=) CheckList& operator = (const CheckList&) = delete; - // Mutator - void setGeometry (const FRect&, bool = true) override; - private: // Method void populate(); @@ -78,11 +75,14 @@ class CheckList final : public finalcut::FDialog CheckList::CheckList (finalcut::FWidget* parent) : finalcut::FDialog(parent) { - setText (L"Shopping list"); - setShadow(); + // Dialog settings + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FDialog::setText (L"Shopping list"); const std::size_t nf_offset = ( isNewFont() ) ? 1 : 0; - 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) ); @@ -118,14 +118,6 @@ CheckList::CheckList (finalcut::FWidget* parent) CheckList::~CheckList() // destructor { } -//---------------------------------------------------------------------- -void CheckList::setGeometry (const FRect& box, bool adjust) -{ - // Avoids calling a virtual function from the constructor - // (CERT, OOP50-CPP) - FDialog::setGeometry (box, adjust); -} - //---------------------------------------------------------------------- void CheckList::populate() { diff --git a/examples/mandelbrot.cpp b/examples/mandelbrot.cpp index 3f4b0e3f..4cd3e001 100644 --- a/examples/mandelbrot.cpp +++ b/examples/mandelbrot.cpp @@ -55,7 +55,7 @@ class Mandelbrot final : public finalcut::FDialog Mandelbrot::Mandelbrot (finalcut::FWidget* parent) : finalcut::FDialog(parent) { - setText ("Mandelbrot set"); + FDialog::setText ("Mandelbrot set"); } //---------------------------------------------------------------------- diff --git a/examples/mouse.cpp b/examples/mouse.cpp index 506a63ae..b31db2e5 100644 --- a/examples/mouse.cpp +++ b/examples/mouse.cpp @@ -82,8 +82,8 @@ ColorChooser::ColorChooser (finalcut::FWidget* parent) { const FColor fg = parent->getForegroundColor(); const FColor bg = parent->getBackgroundColor(); - setForegroundColor(fg); - setBackgroundColor(bg); + FWidget::setForegroundColor(fg); + FWidget::setBackgroundColor(bg); headline.setForegroundColor(fg); headline.setBackgroundColor(bg); } @@ -236,8 +236,8 @@ Brushes::Brushes (finalcut::FWidget* parent) { const FColor fg = parent->getForegroundColor(); const FColor bg = parent->getBackgroundColor(); - setForegroundColor(fg); - setBackgroundColor(bg); + FWidget::setForegroundColor(fg); + FWidget::setBackgroundColor(bg); headline.setForegroundColor(fg); headline.setBackgroundColor(bg); } @@ -381,7 +381,7 @@ class MouseDraw final : public finalcut::FDialog MouseDraw::MouseDraw (finalcut::FWidget* parent) : finalcut::FDialog(parent) { - setText ("Drawing with the mouse"); + FDialog::setText ("Drawing with the mouse"); c_chooser.setPos (FPoint(1, 1)); c_chooser.addCallback ( diff --git a/examples/rotozoomer.cpp b/examples/rotozoomer.cpp index c9e0cef6..a4e38f15 100644 --- a/examples/rotozoomer.cpp +++ b/examples/rotozoomer.cpp @@ -84,7 +84,7 @@ RotoZoomer::RotoZoomer (finalcut::FWidget* parent, bool b, int l) , benchmark(b) , loops(l) { - setText ("Rotozoomer effect"); + FDialog::setText ("Rotozoomer effect"); int h{0}; diff --git a/examples/scrollview.cpp b/examples/scrollview.cpp index d9ffb32f..da9bf11b 100644 --- a/examples/scrollview.cpp +++ b/examples/scrollview.cpp @@ -216,8 +216,8 @@ class Scrollviewdemo final : public finalcut::FDialog Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent) : finalcut::FDialog(parent) { - setGeometry (FPoint(16, 3), FSize(50, 19)); - setText ("Scrolling viewport example"); + 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)); diff --git a/examples/string-operations.cpp b/examples/string-operations.cpp index 931da414..8a3b74c3 100644 --- a/examples/string-operations.cpp +++ b/examples/string-operations.cpp @@ -222,15 +222,15 @@ void streamToInterger() finalcut::FString("-321") >> stream_int; std::cout << "stream out: " << stream_int << std::endl; } - catch (const std::invalid_argument& ex) + catch (const std::underflow_error& ex) { - std::cerr << "Invalid argument: " << ex.what() << std::endl; + std::cerr << "underflow: " << ex.what() << std::endl; } catch (const std::overflow_error& ex) { std::cerr << "overflow: " << ex.what() << std::endl; } - catch (const std::exception& ex) + catch (const std::invalid_argument& ex) { std::cerr << "Arithmetic error: " << ex.what() << std::endl; } @@ -246,15 +246,15 @@ void streamToUnsignedInterger() finalcut::FString("123") >> stream_uint; std::cout << "stream out: " << stream_uint << std::endl; } - catch (const std::invalid_argument& ex) + catch (const std::underflow_error& ex) { - std::cerr << "Invalid argument: " << ex.what() << std::endl; + std::cerr << "underflow: " << ex.what() << std::endl; } catch (const std::overflow_error& ex) { std::cerr << "overflow: " << ex.what() << std::endl; } - catch (const std::exception& ex) + catch (const std::invalid_argument& ex) { std::cerr << "Arithmetic error: " << ex.what() << std::endl; } @@ -270,11 +270,15 @@ void streamToDouble() finalcut::FString("0.123456e+2") >> stream_double; std::cout << "stream out: " << stream_double << std::endl; } - catch (const std::invalid_argument& ex) + catch (const std::underflow_error& ex) { - std::cerr << "Invalid argument: " << ex.what() << std::endl; + std::cerr << "underflow: " << ex.what() << std::endl; } - catch (const std::exception& ex) + catch (const std::overflow_error& ex) + { + std::cerr << "overflow: " << ex.what() << std::endl; + } + catch (const std::invalid_argument& ex) { std::cerr << "Arithmetic error: " << ex.what() << std::endl; } @@ -290,11 +294,15 @@ void streamToFloat() finalcut::FString("0.123e-3") >> stream_float; std::cout << "stream out: " << stream_float << std::endl; } - catch (const std::invalid_argument& ex) + catch (const std::underflow_error& ex) { - std::cerr << "Invalid argument: " << ex.what() << std::endl; + std::cerr << "underflow: " << ex.what() << std::endl; } - catch (const std::exception& ex) + catch (const std::overflow_error& ex) + { + std::cerr << "overflow: " << ex.what() << std::endl; + } + catch (const std::invalid_argument& ex) { std::cerr << "Arithmetic error: " << ex.what() << std::endl; } @@ -486,11 +494,15 @@ void convertToNumberExample() const uLong ulong_num = finalcut::FString("123456789").toULong(); std::cout << " toULong: " << ulong_num << std::endl; } - catch (const std::invalid_argument& ex) + catch (const std::underflow_error& ex) { - std::cerr << "Invalid argument: " << ex.what() << std::endl; + std::cerr << "underflow: " << ex.what() << std::endl; } - catch (const std::exception& ex) + catch (const std::overflow_error& ex) + { + std::cerr << "overflow: " << ex.what() << std::endl; + } + catch (const std::invalid_argument& ex) { std::cerr << "Arithmetic error: " << ex.what() << std::endl; } @@ -501,11 +513,15 @@ void convertToNumberExample() const long long_num = finalcut::FString("-9876543210").toLong(); std::cout << " toLong: " << long_num << std::endl; } - catch (const std::invalid_argument& ex) + catch (const std::underflow_error& ex) { - std::cerr << "Invalid argument: " << ex.what() << std::endl; + std::cerr << "underflow: " << ex.what() << std::endl; } - catch (const std::exception& ex) + catch (const std::overflow_error& ex) + { + std::cerr << "overflow: " << ex.what() << std::endl; + } + catch (const std::invalid_argument& ex) { std::cerr << "Arithmetic error: " << ex.what() << std::endl; } @@ -522,11 +538,15 @@ void convertToNumberExample() << double_num << std::endl; std::cout.flags(save_flags); } - catch (const std::invalid_argument& ex) + catch (const std::underflow_error& ex) { - std::cerr << "Invalid argument: " << ex.what() << std::endl; + std::cerr << "underflow: " << ex.what() << std::endl; } - catch (const std::exception& ex) + catch (const std::overflow_error& ex) + { + std::cerr << "overflow: " << ex.what() << std::endl; + } + catch (const std::invalid_argument& ex) { std::cerr << "Arithmetic error: " << ex.what() << std::endl; } diff --git a/examples/term-attributes.cpp b/examples/term-attributes.cpp index f601c3b0..82f3c4d6 100644 --- a/examples/term-attributes.cpp +++ b/examples/term-attributes.cpp @@ -66,7 +66,7 @@ class AttribDlg final : public finalcut::FDialog void adjustSize() override; // Data members - FColor bgcolor; + FColor bgcolor{getFWidgetColors().label_bg}; finalcut::FButton next_button{"&Next >", this}; finalcut::FButton back_button{"< &Back", this}; }; @@ -74,11 +74,10 @@ class AttribDlg final : public finalcut::FDialog //---------------------------------------------------------------------- AttribDlg::AttribDlg (finalcut::FWidget* parent) : finalcut::FDialog(parent) - , bgcolor(getFWidgetColors().label_bg) { - setText ( "A terminal attributes test (" - + finalcut::FString(getTermType()) - + ")"); + FDialog::setText ( "A terminal attributes test (" + + finalcut::FString(getTermType()) + + ")"); next_button.setGeometry ( FPoint(int(getWidth()) - 13, int(getHeight()) - 4) , FSize(10, 1) ); diff --git a/examples/transparent.cpp b/examples/transparent.cpp index 6ba2a3f1..333220af 100644 --- a/examples/transparent.cpp +++ b/examples/transparent.cpp @@ -189,8 +189,8 @@ class MainWindow final : public finalcut::FDialog } // Data members - finalcut::FString line1{}; - finalcut::FString line2{}; + finalcut::FString line1{" .-. .-. .-."}; + finalcut::FString line2{"`._.' `._.' `._.' "}; Transparent* transpwin{nullptr}; Transparent* shadowwin{nullptr}; Transparent* ibg{nullptr}; @@ -202,9 +202,6 @@ class MainWindow final : public finalcut::FDialog MainWindow::MainWindow (finalcut::FWidget* parent) : FDialog(parent) { - line1 = " .-. .-. .-."; - line2 = "`._.' `._.' `._.' "; - // The memory allocation for the following three sub windows occurs // with the operator new. The lifetime of the generated widget // is managed by the parent object (this). The operator delete diff --git a/examples/ui.cpp b/examples/ui.cpp index 9ad6bb82..268cebdd 100644 --- a/examples/ui.cpp +++ b/examples/ui.cpp @@ -57,9 +57,6 @@ class ProgressDialog final : public finalcut::FDialog // Disable copy assignment operator (=) ProgressDialog& operator = (const ProgressDialog&) = delete; - // Mutator - void setGeometry (const FRect&, bool = true) override; - private: // Event handlers void onShow (finalcut::FShowEvent*) override; @@ -81,9 +78,12 @@ class ProgressDialog final : public finalcut::FDialog ProgressDialog::ProgressDialog (finalcut::FWidget* parent) : finalcut::FDialog(parent) { - setGeometry ( FPoint(int((getParentWidget()->getWidth() - 40) / 2), 7) - , FSize(40, 10) ); - setText("Progress bar"); + // 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::setText("Progress bar"); //setModal(); reset.setText("&Reset"); @@ -132,14 +132,6 @@ ProgressDialog::~ProgressDialog() // destructor delCallback(&reset); } -//---------------------------------------------------------------------- -void ProgressDialog::setGeometry (const FRect& box, bool adjust) -{ - // Avoids calling a virtual function from the constructor - // (CERT, OOP50-CPP) - FDialog::setGeometry (box, adjust); -} - //---------------------------------------------------------------------- void ProgressDialog::onShow (finalcut::FShowEvent*) { @@ -150,7 +142,8 @@ void ProgressDialog::onShow (finalcut::FShowEvent*) void ProgressDialog::onTimer (finalcut::FTimerEvent*) { auto p = progressBar.getPercentage(); - progressBar.setPercentage(++p); + p++; + progressBar.setPercentage(p); flush(); if ( p != 100 ) @@ -182,7 +175,8 @@ void ProgressDialog::cb_reset_bar (const finalcut::FWidget*, const FDataPtr) void ProgressDialog::cb_more_bar (const finalcut::FWidget*, const FDataPtr) { auto p = progressBar.getPercentage(); - progressBar.setPercentage(++p); + p++; + progressBar.setPercentage(p); } //---------------------------------------------------------------------- @@ -279,6 +273,7 @@ class MyDialog final : public finalcut::FDialog private: // Methods + void init(); void initMenu(); void initMenuCallbacks(); void initFileMenuCallbacks(); @@ -375,6 +370,16 @@ class MyDialog final : public finalcut::FDialog //---------------------------------------------------------------------- MyDialog::MyDialog (finalcut::FWidget* parent) : finalcut::FDialog(parent) +{ + init(); +} + +//---------------------------------------------------------------------- +MyDialog::~MyDialog() // destructor +{ } + +//---------------------------------------------------------------------- +void MyDialog::init() { initMenu(); // Initialize the program menu initMenuCallbacks(); // Initialize program menu callbacks @@ -384,10 +389,6 @@ MyDialog::MyDialog (finalcut::FWidget* parent) initialized = true; } -//---------------------------------------------------------------------- -MyDialog::~MyDialog() // destructor -{ } - //---------------------------------------------------------------------- void MyDialog::initMenu() { diff --git a/examples/watch.cpp b/examples/watch.cpp index d6fab591..c49fb798 100644 --- a/examples/watch.cpp +++ b/examples/watch.cpp @@ -75,7 +75,10 @@ class Watch final : public finalcut::FDialog Watch::Watch (FWidget* parent) : finalcut::FDialog(parent) { - setText ("Watch"); + // Dialog settings + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FDialog::setText ("Watch"); const int pw = int(getParentWidget()->getWidth()); FDialog::setGeometry (FPoint(1 + (pw - 22) / 2, 3), FSize(22, 13)); diff --git a/examples/windows.cpp b/examples/windows.cpp index b85a076d..98895dd8 100644 --- a/examples/windows.cpp +++ b/examples/windows.cpp @@ -201,8 +201,8 @@ class Window final : public finalcut::FDialog void configureDialogButtons(); void activateWindow (finalcut::FDialog*); void adjustSize() override; - void addClickedCallback (finalcut::FWidget*, WindowCallback); - void addClickedCallback (finalcut::FWidget*, FAppCallback); + template + void addClickedCallback (finalcut::FWidget*, CallbackT); template finalcut::FDialog* getNext (IteratorT); template @@ -373,22 +373,9 @@ void Window::adjustSize() } //---------------------------------------------------------------------- +template void Window::addClickedCallback ( finalcut::FWidget* widget - , WindowCallback call ) -{ - FMemberCallback callback - = reinterpret_cast(call); - - widget->addCallback - ( - "clicked", - F_METHOD_CALLBACK (this, callback) - ); -} - -//---------------------------------------------------------------------- -void Window::addClickedCallback ( finalcut::FWidget* widget - , FAppCallback call ) + , CallbackT call ) { FMemberCallback callback = reinterpret_cast(call); diff --git a/sonar-project.properties b/sonar-project.properties index 58d8aad4..7a0dc1c4 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,4 +3,5 @@ sonar.projectName=finalcut sonar.projectVersion=0.6.1 sonar.sources=. sonar.cfamily.build-wrapper-output=bw-output +sonar.exclusions=src/include/final/fconfig.h diff --git a/src/.depend b/src/.depend new file mode 100644 index 00000000..ecab4579 --- /dev/null +++ b/src/.depend @@ -0,0 +1,403 @@ +fapplication.o: fapplication.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fevent.h include/final/fmenu.h \ + include/final/fwindow.h include/final/fmenulist.h \ + include/final/fmenuitem.h include/final/fmenubar.h \ + include/final/fmessagebox.h include/final/fdialog.h \ + include/final/fwidgetcolors.h include/final/fmouse.h \ + include/final/fkeyboard.h include/final/fstartoptions.h \ + include/final/fstatusbar.h include/final/ftermdata.h \ + include/final/ftermios.h +fbutton.o: fbutton.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fcolorpair.h \ + include/final/fevent.h include/final/fbutton.h \ + include/final/fwidgetcolors.h include/final/fstatusbar.h \ + include/final/fwindow.h +fbuttongroup.o: fbuttongroup.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fbuttongroup.h \ + include/final/fscrollview.h include/final/fscrollbar.h \ + include/final/fwidgetcolors.h include/final/fcolorpair.h \ + include/final/fevent.h include/final/fstatusbar.h \ + include/final/fwindow.h include/final/ftogglebutton.h +fcharmap.o: fcharmap.cpp include/final/fc.h include/final/ftypes.h \ + include/final/fcharmap.h +fcheckbox.o: fcheckbox.cpp include/final/fc.h include/final/ftypes.h \ + include/final/fcheckbox.h include/final/ftogglebutton.h \ + include/final/fwidget.h include/final/fvterm.h include/final/fterm.h \ + include/final/fconfig.h include/final/fstring.h \ + include/final/fsystem.h include/final/fobject.h include/final/fpoint.h \ + include/final/frect.h include/final/fsize.h +fcheckmenuitem.o: fcheckmenuitem.cpp include/final/fc.h \ + include/final/ftypes.h include/final/fcheckmenuitem.h \ + include/final/fmenuitem.h include/final/fwidget.h \ + include/final/fvterm.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fmenu.h include/final/fwindow.h \ + include/final/fmenulist.h +fcombobox.o: fcombobox.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fcolorpair.h \ + include/final/fcombobox.h include/final/flineedit.h \ + include/final/flistbox.h include/final/fscrollbar.h \ + include/final/fwindow.h include/final/fevent.h include/final/flabel.h \ + include/final/fwidgetcolors.h include/final/fmouse.h \ + include/final/fkeyboard.h include/final/fstatusbar.h +fdialog.o: fdialog.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fcombobox.h \ + include/final/flineedit.h include/final/flistbox.h \ + include/final/fscrollbar.h include/final/fwindow.h \ + include/final/fdialog.h include/final/fmenu.h \ + include/final/fmenulist.h include/final/fmenuitem.h \ + include/final/fevent.h include/final/fkeyboard.h \ + include/final/fstatusbar.h include/final/ftooltip.h \ + include/final/fwidgetcolors.h +fdialoglistmenu.o: fdialoglistmenu.cpp include/final/fc.h \ + include/final/ftypes.h include/final/fdialoglistmenu.h \ + include/final/fmenu.h include/final/fwindow.h include/final/fwidget.h \ + include/final/fvterm.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fmenulist.h \ + include/final/fmenuitem.h +fevent.o: fevent.cpp include/final/fevent.h include/final/fc.h \ + include/final/ftypes.h include/final/fpoint.h include/final/fstring.h +ffiledialog.o: ffiledialog.cpp include/final/fevent.h include/final/fc.h \ + include/final/ftypes.h include/final/fpoint.h include/final/fstring.h \ + include/final/fsystem.h include/final/ffiledialog.h \ + include/final/fbutton.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fterm.h include/final/fconfig.h include/final/fobject.h \ + include/final/frect.h include/final/fsize.h \ + include/final/fwidgetcolors.h include/final/fcheckbox.h \ + include/final/ftogglebutton.h include/final/fdialog.h \ + include/final/fmenu.h include/final/fwindow.h \ + include/final/fmenulist.h include/final/fmenuitem.h \ + include/final/flineedit.h include/final/flistbox.h \ + include/final/fscrollbar.h include/final/fmessagebox.h \ + include/final/fstatusbar.h +fkey_map.o: fkey_map.cpp include/final/fc.h include/final/ftypes.h \ + include/final/fkey_map.h +fkeyboard.o: fkeyboard.cpp include/final/fkeyboard.h \ + include/final/fstring.h include/final/fc.h include/final/ftypes.h \ + include/final/fkey_map.h include/final/fobject.h include/final/fterm.h \ + include/final/fconfig.h include/final/fsystem.h \ + include/final/ftermios.h include/final/ftermlinux.h \ + include/final/ftermdata.h include/final/frect.h +flabel.o: flabel.cpp include/final/fapplication.h include/final/ftypes.h \ + include/final/fwidget.h include/final/fvterm.h include/final/fc.h \ + include/final/fterm.h include/final/fconfig.h include/final/fstring.h \ + include/final/fsystem.h include/final/fobject.h include/final/fpoint.h \ + include/final/frect.h include/final/fsize.h include/final/fcolorpair.h \ + include/final/fevent.h include/final/flabel.h \ + include/final/fwidgetcolors.h include/final/fstatusbar.h \ + include/final/fwindow.h +flineedit.o: flineedit.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fevent.h include/final/flabel.h \ + include/final/fwidgetcolors.h include/final/flineedit.h \ + include/final/fstatusbar.h include/final/fwindow.h +flistbox.o: flistbox.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fcolorpair.h \ + include/final/fevent.h include/final/flistbox.h \ + include/final/fscrollbar.h include/final/fstatusbar.h \ + include/final/fwindow.h include/final/fwidgetcolors.h +flistview.o: flistview.cpp include/final/emptyfstring.h \ + include/final/fstring.h include/final/fc.h include/final/ftypes.h \ + include/final/fapplication.h include/final/fwidget.h \ + include/final/fvterm.h include/final/fterm.h include/final/fconfig.h \ + include/final/fsystem.h include/final/fobject.h include/final/fpoint.h \ + include/final/frect.h include/final/fsize.h include/final/fcolorpair.h \ + include/final/fevent.h include/final/flistview.h \ + include/final/fscrollbar.h include/final/ftermbuffer.h \ + include/final/fstatusbar.h include/final/fwindow.h \ + include/final/fwidgetcolors.h +fmenu.o: fmenu.cpp include/final/fapplication.h include/final/ftypes.h \ + include/final/fwidget.h include/final/fvterm.h include/final/fc.h \ + include/final/fterm.h include/final/fconfig.h include/final/fstring.h \ + include/final/fsystem.h include/final/fobject.h include/final/fpoint.h \ + include/final/frect.h include/final/fsize.h include/final/fcolorpair.h \ + include/final/fdialog.h include/final/fmenu.h include/final/fwindow.h \ + include/final/fmenulist.h include/final/fmenuitem.h \ + include/final/fevent.h include/final/fmenubar.h \ + include/final/fstatusbar.h include/final/fwidgetcolors.h +fmenubar.o: fmenubar.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fevent.h include/final/fmenu.h \ + include/final/fwindow.h include/final/fmenulist.h \ + include/final/fmenuitem.h include/final/fmenubar.h \ + include/final/fstatusbar.h include/final/fwidgetcolors.h +fmenuitem.o: fmenuitem.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fdialog.h include/final/fmenu.h \ + include/final/fwindow.h include/final/fmenulist.h \ + include/final/fmenuitem.h include/final/fevent.h \ + include/final/fmenubar.h include/final/fstatusbar.h +fmenulist.o: fmenulist.cpp include/final/fc.h include/final/ftypes.h \ + include/final/fmenulist.h include/final/fmenuitem.h \ + include/final/fwidget.h include/final/fvterm.h include/final/fterm.h \ + include/final/fconfig.h include/final/fstring.h \ + include/final/fsystem.h include/final/fobject.h include/final/fpoint.h \ + include/final/frect.h include/final/fsize.h +fmessagebox.o: fmessagebox.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fbutton.h \ + include/final/fwidgetcolors.h include/final/fmessagebox.h \ + include/final/fdialog.h include/final/fmenu.h include/final/fwindow.h \ + include/final/fmenulist.h include/final/fmenuitem.h +fmouse.o: fmouse.cpp include/final/fconfig.h include/final/fkeyboard.h \ + include/final/fstring.h include/final/fc.h include/final/ftypes.h \ + include/final/fmouse.h include/final/fpoint.h include/final/fobject.h \ + include/final/fterm.h include/final/fsystem.h \ + include/final/ftermxterminal.h +fobject.o: fobject.cpp include/final/emptyfstring.h \ + include/final/fstring.h include/final/fc.h include/final/ftypes.h \ + include/final/fevent.h include/final/fpoint.h include/final/fobject.h +foptiattr.o: foptiattr.cpp include/final/fc.h include/final/ftypes.h \ + include/final/foptiattr.h include/final/fstring.h \ + include/final/sgr_optimizer.h include/final/fstartoptions.h +foptimove.o: foptimove.cpp include/final/fc.h include/final/ftypes.h \ + include/final/foptimove.h include/final/fstring.h +fpoint.o: fpoint.cpp include/final/fpoint.h include/final/fstring.h \ + include/final/fc.h include/final/ftypes.h +fprogressbar.o: fprogressbar.cpp include/final/fevent.h \ + include/final/fc.h include/final/ftypes.h include/final/fpoint.h \ + include/final/fstring.h include/final/fcolorpair.h \ + include/final/fprogressbar.h include/final/fwidget.h \ + include/final/fvterm.h include/final/fterm.h include/final/fconfig.h \ + include/final/fsystem.h include/final/fobject.h include/final/frect.h \ + include/final/fsize.h include/final/fwidgetcolors.h +fradiobutton.o: fradiobutton.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fradiobutton.h \ + include/final/ftogglebutton.h +fradiomenuitem.o: fradiomenuitem.cpp include/final/fc.h \ + include/final/ftypes.h include/final/fradiomenuitem.h \ + include/final/fmenuitem.h include/final/fwidget.h \ + include/final/fvterm.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fmenu.h include/final/fwindow.h \ + include/final/fmenulist.h +frect.o: frect.cpp include/final/fpoint.h include/final/fstring.h \ + include/final/fc.h include/final/ftypes.h include/final/frect.h \ + include/final/fsize.h +fscrollbar.o: fscrollbar.cpp include/final/fevent.h include/final/fc.h \ + include/final/ftypes.h include/final/fpoint.h include/final/fstring.h \ + include/final/fscrollbar.h include/final/fwidget.h \ + include/final/fvterm.h include/final/fterm.h include/final/fconfig.h \ + include/final/fsystem.h include/final/fobject.h include/final/frect.h \ + include/final/fsize.h include/final/fwidgetcolors.h +fscrollview.o: fscrollview.cpp include/final/fevent.h include/final/fc.h \ + include/final/ftypes.h include/final/fpoint.h include/final/fstring.h \ + include/final/fscrollview.h include/final/fscrollbar.h \ + include/final/fwidget.h include/final/fvterm.h include/final/fterm.h \ + include/final/fconfig.h include/final/fsystem.h \ + include/final/fobject.h include/final/frect.h include/final/fsize.h \ + include/final/fwindow.h include/final/fwidgetcolors.h +fsize.o: fsize.cpp include/final/fpoint.h include/final/fstring.h \ + include/final/fc.h include/final/ftypes.h include/final/fsize.h +fspinbox.o: fspinbox.cpp include/final/fcolorpair.h include/final/fc.h \ + include/final/ftypes.h include/final/fstring.h include/final/fevent.h \ + include/final/fpoint.h include/final/flabel.h include/final/fwidget.h \ + include/final/fvterm.h include/final/fterm.h include/final/fconfig.h \ + include/final/fsystem.h include/final/fobject.h include/final/frect.h \ + include/final/fsize.h include/final/fwidgetcolors.h \ + include/final/flineedit.h include/final/fspinbox.h \ + include/final/fstatusbar.h include/final/fwindow.h +fstartoptions.o: fstartoptions.cpp include/final/fstartoptions.h \ + include/final/fc.h include/final/ftypes.h include/final/fstring.h +fstatusbar.o: fstatusbar.cpp include/final/fevent.h include/final/fc.h \ + include/final/ftypes.h include/final/fpoint.h include/final/fstring.h \ + include/final/fstatusbar.h include/final/fwidget.h \ + include/final/fvterm.h include/final/fterm.h include/final/fconfig.h \ + include/final/fsystem.h include/final/fobject.h include/final/frect.h \ + include/final/fsize.h include/final/fwindow.h \ + include/final/fwidgetcolors.h +fstring.o: fstring.cpp include/final/fstring.h include/final/fc.h \ + include/final/ftypes.h +fswitch.o: fswitch.cpp include/final/fcolorpair.h include/final/fc.h \ + include/final/ftypes.h include/final/fstring.h include/final/fevent.h \ + include/final/fpoint.h include/final/fswitch.h \ + include/final/ftogglebutton.h include/final/fwidget.h \ + include/final/fvterm.h include/final/fterm.h include/final/fconfig.h \ + include/final/fsystem.h include/final/fobject.h include/final/frect.h \ + include/final/fsize.h include/final/fwidgetcolors.h +fsystem.o: fsystem.cpp include/final/fsystem.h include/final/ftypes.h +fsystemimpl.o: fsystemimpl.cpp include/final/fsystemimpl.h \ + include/final/fc.h include/final/ftypes.h include/final/fsystem.h +fterm.o: fterm.cpp include/final/fapplication.h include/final/ftypes.h \ + include/final/fwidget.h include/final/fvterm.h include/final/fc.h \ + include/final/fterm.h include/final/fconfig.h include/final/fstring.h \ + include/final/fsystem.h include/final/fobject.h include/final/fpoint.h \ + include/final/frect.h include/final/fsize.h include/final/fcharmap.h \ + include/final/fcolorpalette.h include/final/fkey_map.h \ + include/final/fkeyboard.h include/final/fmouse.h \ + include/final/foptiattr.h include/final/sgr_optimizer.h \ + include/final/foptimove.h include/final/fstartoptions.h \ + include/final/fsystemimpl.h include/final/ftermbuffer.h \ + include/final/ftermcap.h include/final/ftermcapquirks.h \ + include/final/ftermdata.h include/final/ftermdebugdata.h \ + include/final/ftermdetection.h include/final/ftermios.h \ + include/final/ftermxterminal.h include/final/ftermlinux.h +fterm_functions.o: fterm_functions.cpp include/final/fcharmap.h \ + include/final/fc.h include/final/ftypes.h include/final/fterm.h \ + include/final/fconfig.h include/final/fstring.h \ + include/final/fsystem.h include/final/ftermbuffer.h +ftermbuffer.o: ftermbuffer.cpp include/final/fc.h include/final/ftypes.h \ + include/final/fcolorpair.h include/final/fstring.h \ + include/final/fstyle.h include/final/ftermbuffer.h \ + include/final/fvterm.h include/final/fterm.h include/final/fconfig.h \ + include/final/fsystem.h +ftermcap.o: ftermcap.cpp include/final/emptyfstring.h \ + include/final/fstring.h include/final/fc.h include/final/ftypes.h \ + include/final/fkey_map.h include/final/fterm.h include/final/fconfig.h \ + include/final/fsystem.h include/final/ftermdata.h \ + include/final/frect.h include/final/ftermcap.h \ + include/final/ftermdetection.h +ftermcapquirks.o: ftermcapquirks.cpp include/final/fc.h \ + include/final/ftypes.h include/final/fkey_map.h include/final/fterm.h \ + include/final/fconfig.h include/final/fstring.h \ + include/final/fsystem.h include/final/ftermcap.h \ + include/final/ftermcapquirks.h include/final/ftermdata.h \ + include/final/frect.h include/final/ftermdetection.h +ftermdebugdata.o: ftermdebugdata.cpp include/final/fc.h \ + include/final/ftypes.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/ftermdata.h include/final/frect.h \ + include/final/ftermdetection.h include/final/ftermdebugdata.h +ftermdetection.o: ftermdetection.cpp include/final/emptyfstring.h \ + include/final/fstring.h include/final/fc.h include/final/ftypes.h \ + include/final/fsystem.h include/final/fterm.h include/final/fconfig.h \ + include/final/ftermdata.h include/final/frect.h \ + include/final/ftermdetection.h include/final/ftermios.h +ftermfreebsd.o: ftermfreebsd.cpp include/final/fcharmap.h \ + include/final/fc.h include/final/ftypes.h include/final/fsystem.h \ + include/final/fterm.h include/final/fconfig.h include/final/fstring.h \ + include/final/ftermdata.h include/final/frect.h \ + include/final/ftermfreebsd.h +ftermios.o: ftermios.cpp include/final/ftermios.h include/final/fstring.h \ + include/final/fc.h include/final/ftypes.h include/final/fterm.h \ + include/final/fconfig.h include/final/fsystem.h +ftermlinux.o: ftermlinux.cpp include/final/fc.h include/final/ftypes.h \ + include/final/fcharmap.h include/final/fsystem.h include/final/fterm.h \ + include/final/fconfig.h include/final/fstring.h \ + include/final/ftermcap.h include/final/ftermdetection.h \ + include/final/ftermlinux.h include/final/ftermdata.h \ + include/final/frect.h ../fonts/newfont.h ../fonts/newfont_8x16.h \ + ../fonts/newfont_9x16.h ../fonts/unicodemap.h ../fonts/vgafont.h +ftermopenbsd.o: ftermopenbsd.cpp include/final/fsystem.h \ + include/final/ftypes.h include/final/fterm.h include/final/fconfig.h \ + include/final/fc.h include/final/fstring.h \ + include/final/ftermopenbsd.h +ftermxterminal.o: ftermxterminal.cpp include/final/fc.h \ + include/final/ftypes.h include/final/fstring.h include/final/fterm.h \ + include/final/fconfig.h include/final/fsystem.h \ + include/final/ftermcap.h include/final/ftermdetection.h \ + include/final/ftermfreebsd.h include/final/ftermios.h \ + include/final/ftermxterminal.h include/final/fsize.h +ftextview.o: ftextview.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fdialog.h include/final/fmenu.h \ + include/final/fwindow.h include/final/fmenulist.h \ + include/final/fmenuitem.h include/final/fevent.h \ + include/final/fscrollbar.h include/final/fstatusbar.h \ + include/final/ftextview.h include/final/fwidgetcolors.h +ftogglebutton.o: ftogglebutton.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fbuttongroup.h \ + include/final/fscrollview.h include/final/fscrollbar.h \ + include/final/fwidgetcolors.h include/final/fevent.h \ + include/final/fstatusbar.h include/final/fwindow.h \ + include/final/ftogglebutton.h +ftooltip.o: ftooltip.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/ftooltip.h include/final/fwindow.h \ + include/final/fwidgetcolors.h +fvterm.o: fvterm.cpp include/final/fapplication.h include/final/ftypes.h \ + include/final/fwidget.h include/final/fvterm.h include/final/fc.h \ + include/final/fterm.h include/final/fconfig.h include/final/fstring.h \ + include/final/fsystem.h include/final/fobject.h include/final/fpoint.h \ + include/final/frect.h include/final/fsize.h include/final/fcharmap.h \ + include/final/fcolorpair.h include/final/fkeyboard.h \ + include/final/foptiattr.h include/final/sgr_optimizer.h \ + include/final/foptimove.h include/final/fstyle.h \ + include/final/ftermdata.h include/final/ftermbuffer.h \ + include/final/ftermcap.h include/final/fwindow.h +fwidget.o: fwidget.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fevent.h include/final/fmenubar.h \ + include/final/fmenulist.h include/final/fmenuitem.h \ + include/final/fwindow.h include/final/fstatusbar.h \ + include/final/ftermdata.h include/final/fwidgetcolors.h +fwidget_functions.o: fwidget_functions.cpp include/final/fcolorpair.h \ + include/final/fc.h include/final/ftypes.h include/final/fstring.h \ + include/final/fstyle.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fterm.h include/final/fconfig.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fwidgetcolors.h +fwidgetcolors.o: fwidgetcolors.cpp include/final/fc.h \ + include/final/ftypes.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fwidgetcolors.h +fwindow.o: fwindow.cpp include/final/fapplication.h \ + include/final/ftypes.h include/final/fwidget.h include/final/fvterm.h \ + include/final/fc.h include/final/fterm.h include/final/fconfig.h \ + include/final/fstring.h include/final/fsystem.h \ + include/final/fobject.h include/final/fpoint.h include/final/frect.h \ + include/final/fsize.h include/final/fcombobox.h \ + include/final/flineedit.h include/final/flistbox.h \ + include/final/fscrollbar.h include/final/fwindow.h \ + include/final/fevent.h include/final/fmenu.h include/final/fmenulist.h \ + include/final/fmenuitem.h include/final/fmenubar.h \ + include/final/fstatusbar.h +sgr_optimizer.o: sgr_optimizer.cpp include/final/fc.h \ + include/final/ftypes.h include/final/sgr_optimizer.h diff --git a/src/fcombobox.cpp b/src/fcombobox.cpp index fc5a7b14..bad7631c 100644 --- a/src/fcombobox.cpp +++ b/src/fcombobox.cpp @@ -277,7 +277,7 @@ void FComboBox::setMaxVisibleItems (std::size_t items) } //---------------------------------------------------------------------- -void FComboBox::insert (FListBoxItem listItem) +void FComboBox::insert (const FListBoxItem& listItem) { list_window.list.insert(listItem); diff --git a/src/ffiledialog.cpp b/src/ffiledialog.cpp index f3eeff27..c72e3e2f 100644 --- a/src/ffiledialog.cpp +++ b/src/ffiledialog.cpp @@ -40,7 +40,7 @@ bool sortByName ( const FFileDialog::dir_entry& lhs , const FFileDialog::dir_entry& rhs ) { // lhs < rhs - return bool( strcasecmp(lhs.name, rhs.name) < 0 ); + return bool( strcasecmp(lhs.name.c_str(), rhs.name.c_str()) < 0 ); } //---------------------------------------------------------------------- @@ -189,13 +189,10 @@ void FFileDialog::setPath (const FString& dir) return; } - if ( S_ISLNK(sb.st_mode) ) + if ( S_ISLNK(sb.st_mode) && lstat(dirname, &sb) != 0 ) { - if ( lstat(dirname, &sb) != 0 ) - { - directory = '/'; - return; - } + directory = '/'; + return; } if ( ! S_ISDIR(sb.st_mode) ) @@ -446,10 +443,6 @@ void FFileDialog::clear() if ( dir_entries.empty() ) return; - // delete all directory entries; - for (auto&& entry : dir_entries) - std::free (entry.name); - dir_entries.clear(); dir_entries.shrink_to_fit(); } @@ -465,7 +458,7 @@ sInt64 FFileDialog::numOfDirs() , [] (const dir_entry& entry) { return entry.directory - && std::strcmp(entry.name, ".") != 0; + && std::strcmp(entry.name.c_str(), ".") != 0; } ); return n; @@ -476,7 +469,7 @@ void FFileDialog::sortDir() { sInt64 start{0}; - if ( std::strcmp((*dir_entries.begin()).name, "..") == 0 ) + if ( std::strcmp((*dir_entries.begin()).name.c_str(), "..") == 0 ) start = 1; const sInt64 dir_num = numOfDirs(); @@ -564,7 +557,7 @@ void FFileDialog::getEntry (const char* const dir, const struct dirent* d_entry) const char* const filter = filter_pattern.c_str(); dir_entry entry{}; - entry.name = strdup(d_entry->d_name); + entry.name = d_entry->d_name; #if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE entry.fifo = (d_entry->d_type & DT_FIFO) == DT_FIFO; @@ -590,10 +583,10 @@ void FFileDialog::getEntry (const char* const dir, const struct dirent* d_entry) if ( entry.directory ) dir_entries.push_back (entry); - else if ( pattern_match(filter, entry.name) ) + else if ( pattern_match(filter, entry.name.c_str()) ) dir_entries.push_back (entry); else - std::free(entry.name); + entry.name.clear(); } //---------------------------------------------------------------------- @@ -612,7 +605,7 @@ void FFileDialog::followSymLink (const char* const dir, dir_entry& entry) std::strncpy (symLink, dir, sizeof(symLink)); symLink[sizeof(symLink) - 1] = '\0'; std::strncat ( symLink - , entry.name + , entry.name.c_str() , sizeof(symLink) - std::strlen(symLink) - 1); symLink[sizeof(symLink) - 1] = '\0'; @@ -655,7 +648,7 @@ void FFileDialog::selectDirectoryEntry (const char* const name) for (auto&& entry : dir_entries) { - if ( std::strcmp(entry.name, name) == 0 ) + if ( std::strcmp(entry.name.c_str(), name) == 0 ) { filebrowser.setCurrentItem(i); filename.setText(FString(name) + '/'); @@ -793,10 +786,10 @@ void FFileDialog::cb_processActivate (const FWidget*, const FDataPtr) , std::end(dir_entries) , [&input] (const dir_entry& entry) { - return entry.name + return entry.name.c_str() && input && ! input.isNull() - && std::strcmp(entry.name, input) == 0 + && std::strcmp(entry.name.c_str(), input) == 0 && entry.directory; } ); diff --git a/src/fkeyboard.cpp b/src/fkeyboard.cpp index b27e0f62..999ad02b 100644 --- a/src/fkeyboard.cpp +++ b/src/fkeyboard.cpp @@ -255,12 +255,13 @@ inline FKey FKeyboard::getMetaKey() { std::size_t n{}; - if ( len == 2 && ( fifo_buf[1] == 'O' - || fifo_buf[1] == '[' - || fifo_buf[1] == ']' ) ) + if ( len == 2 + && ( fifo_buf[1] == 'O' + || fifo_buf[1] == '[' + || fifo_buf[1] == ']' ) + && ! isKeypressTimeout() ) { - if ( ! isKeypressTimeout() ) - return fc::Fkey_incomplete; + return fc::Fkey_incomplete; } for (n = len; n < FIFO_BUF_SIZE; n++) // Remove founded entry diff --git a/src/flabel.cpp b/src/flabel.cpp index d44c7ad5..bcdb733c 100644 --- a/src/flabel.cpp +++ b/src/flabel.cpp @@ -271,11 +271,13 @@ void FLabel::setHotkeyAccelerator() std::size_t FLabel::getAlignOffset (const std::size_t length) { const std::size_t width(getWidth()); + assert ( alignment == fc::alignLeft + || alignment == fc::alignCenter + || alignment == fc::alignRight ); switch ( alignment ) { case fc::alignLeft: - default: return 0; case fc::alignCenter: @@ -357,7 +359,7 @@ void FLabel::drawMultiLine() else align_offset = getAlignOffset(length); - printLine (std::move(label_text)); + printLine (label_text); y++; } } @@ -374,11 +376,11 @@ void FLabel::drawSingleLine() print() << FPoint(1, 1); align_offset = getAlignOffset(column_width); - printLine (std::move(label_text)); + printLine (label_text); } //---------------------------------------------------------------------- -void FLabel::printLine (FString&& line) +void FLabel::printLine (FString& line) { std::size_t to_char{}; std::size_t to_column{}; diff --git a/src/flineedit.cpp b/src/flineedit.cpp index eb3d2c5a..ca1afa42 100644 --- a/src/flineedit.cpp +++ b/src/flineedit.cpp @@ -627,18 +627,15 @@ void FLineEdit::adjustLabel() assert ( label_orientation == label_above || label_orientation == label_left ); - switch ( label_orientation ) + if ( label_orientation == label_above ) { - case label_above: - label->setGeometry ( FPoint(w->getX(), w->getY() - 1) - , FSize(label_width, 1) ); - break; - - case label_left: - default: - label->setGeometry ( FPoint(w->getX() - int(label_width) - 1, w->getY()) - , FSize(label_width, 1) ); - break; + 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) ); } } @@ -745,19 +742,21 @@ void FLineEdit::drawInputField() if ( isActiveFocus && getMaxColor() < 16 ) setBold(); - const std::size_t text_offset_column = [this] () -> std::size_t + const std::size_t text_offset_column = [this] () { + assert ( input_type == FLineEdit::textfield + || input_type == FLineEdit::password ); + switch ( input_type ) { case FLineEdit::textfield: - default: return printTextField(); case FLineEdit::password: return printPassword(); } - return 0; + return std::size_t(0); }(); while ( x_pos + 1 < getWidth() ) @@ -817,14 +816,13 @@ inline std::size_t FLineEdit::printPassword() //---------------------------------------------------------------------- inline std::size_t FLineEdit::getCursorColumnPos() { - switch ( input_type ) + if ( input_type == FLineEdit::textfield ) { - case FLineEdit::textfield: - default: - return getColumnWidth (print_text, cursor_pos); - - case FLineEdit::password: - return cursor_pos; + return getColumnWidth (print_text, cursor_pos); + } + else if ( input_type == FLineEdit::password ) + { + return cursor_pos; } return 0; diff --git a/src/flistbox.cpp b/src/flistbox.cpp index d2f558df..2a99b416 100644 --- a/src/flistbox.cpp +++ b/src/flistbox.cpp @@ -189,7 +189,7 @@ void FListBox::hide() } //---------------------------------------------------------------------- -void FListBox::insert (FListBoxItem listItem) +void FListBox::insert (const FListBoxItem& listItem) { const std::size_t column_width = getColumnWidth(listItem.text); const bool has_brackets(listItem.brackets); @@ -374,10 +374,10 @@ void FListBox::onMouseUp (FMouseEvent* ev) const int mouse_y = ev->getY(); if ( mouse_x > 1 && mouse_x < int(getWidth()) - && mouse_y > 1 && mouse_y < int(getHeight()) ) + && mouse_y > 1 && mouse_y < int(getHeight()) + && ! isMultiSelection() ) { - if ( ! isMultiSelection() ) - processSelect(); + processSelect(); } } } @@ -1754,11 +1754,18 @@ void FListBox::cb_vbarChange (const FWidget*, const FDataPtr) int distance{1}; const int yoffset_before = yoffset; scrollType = vbar->getScrollType(); + assert ( scrollType == FScrollbar::noScroll + || scrollType == FScrollbar::scrollJump + || scrollType == FScrollbar::scrollStepBackward + || scrollType == FScrollbar::scrollStepForward + || scrollType == FScrollbar::scrollPageBackward + || scrollType == FScrollbar::scrollPageForward + || scrollType == FScrollbar::scrollWheelUp + || scrollType == FScrollbar::scrollWheelDown ); switch ( scrollType ) { case FScrollbar::noScroll: - default: break; case FScrollbar::scrollPageBackward: @@ -1818,11 +1825,18 @@ void FListBox::cb_hbarChange (const FWidget*, const FDataPtr) int distance{1}; const int xoffset_before = xoffset; scrollType = hbar->getScrollType(); + assert ( scrollType == FScrollbar::noScroll + || scrollType == FScrollbar::scrollJump + || scrollType == FScrollbar::scrollStepBackward + || scrollType == FScrollbar::scrollStepForward + || scrollType == FScrollbar::scrollPageBackward + || scrollType == FScrollbar::scrollPageForward + || scrollType == FScrollbar::scrollWheelUp + || scrollType == FScrollbar::scrollWheelDown ); switch ( scrollType ) { case FScrollbar::noScroll: - default: break; case FScrollbar::scrollPageBackward: diff --git a/src/flistview.cpp b/src/flistview.cpp index 69265035..e796aeb8 100644 --- a/src/flistview.cpp +++ b/src/flistview.cpp @@ -94,10 +94,18 @@ uInt64 firstNumberFromString (const FString& str) { number = uInt64(num_str.toLong()); } - catch (const std::exception&) + catch (const std::invalid_argument&) { return 0; } + catch (const std::underflow_error&) + { + return std::numeric_limits::min(); + } + catch (const std::overflow_error&) + { + return std::numeric_limits::max(); + } return number; } @@ -504,14 +512,10 @@ FListViewIterator::FListViewIterator (const FListViewIterator& i) //---------------------------------------------------------------------- FListViewIterator::FListViewIterator (FListViewIterator&& i) noexcept - : iter_path(i.iter_path) // move constructor - , node(i.node) - , position(i.position) -{ - i.iter_path = iterator_stack{}; - i.node = iterator{}; - i.position = 0; -} + : iter_path(std::move(i.iter_path)) // move constructor + , node(std::move(i.node)) + , position(std::move(i.position)) +{ } // FListViewIterator operators //---------------------------------------------------------------------- @@ -526,12 +530,9 @@ FListViewIterator& FListViewIterator::operator = (const FListViewIterator& i) //---------------------------------------------------------------------- FListViewIterator& FListViewIterator::operator = (FListViewIterator&& i) noexcept { - iter_path = i.iter_path; - node = i.node; - position = i.position; - i.iter_path = iterator_stack{}; - i.node = iterator{}; - i.position = 0; + iter_path = std::move(i.iter_path); + node = std::move(i.node); + position = std::move(i.position); return *this; } @@ -1014,11 +1015,16 @@ void FListView::sort() if ( sort_column < 1 && sort_column > int(header.size()) ) return; - switch ( getColumnSortType(sort_column) ) + fc::sorting_type column_sort_type = getColumnSortType(sort_column); + assert ( column_sort_type == fc::by_name + || column_sort_type == fc::by_number + || column_sort_type == fc::user_defined + || column_sort_type == fc::unknown ); + + switch ( column_sort_type ) { case fc::unknown: case fc::by_name: - default: if ( sort_order == fc::ascending ) { sort (sortAscendingByName); @@ -1584,10 +1590,13 @@ std::size_t FListView::getAlignOffset ( const fc::text_alignment align , const std::size_t column_width , const std::size_t width ) { + assert ( align == fc::alignLeft + || align == fc::alignCenter + || align == fc::alignRight ); + switch ( align ) { case fc::alignLeft: - default: return 0; case fc::alignCenter: @@ -2855,11 +2864,18 @@ void FListView::cb_vbarChange (const FWidget*, const FDataPtr) static constexpr int wheel_distance = 4; int distance{1}; first_line_position_before = first_visible_line.getPosition(); + assert ( scrollType == FScrollbar::noScroll + || scrollType == FScrollbar::scrollJump + || scrollType == FScrollbar::scrollStepBackward + || scrollType == FScrollbar::scrollStepForward + || scrollType == FScrollbar::scrollPageBackward + || scrollType == FScrollbar::scrollPageForward + || scrollType == FScrollbar::scrollWheelUp + || scrollType == FScrollbar::scrollWheelDown ); switch ( scrollType ) { case FScrollbar::noScroll: - default: break; case FScrollbar::scrollPageBackward: @@ -2884,12 +2900,12 @@ void FListView::cb_vbarChange (const FWidget*, const FDataPtr) } case FScrollbar::scrollWheelUp: - wheelUp (wheel_distance); - break; + wheelUp (wheel_distance); + break; case FScrollbar::scrollWheelDown: - wheelDown (wheel_distance); - break; + wheelDown (wheel_distance); + break; } if ( isShown() ) @@ -2915,11 +2931,18 @@ void FListView::cb_hbarChange (const FWidget*, const FDataPtr) static constexpr int wheel_distance = 4; int distance{1}; const int xoffset_before = xoffset; + assert ( scrollType == FScrollbar::noScroll + || scrollType == FScrollbar::scrollJump + || scrollType == FScrollbar::scrollStepBackward + || scrollType == FScrollbar::scrollStepForward + || scrollType == FScrollbar::scrollPageBackward + || scrollType == FScrollbar::scrollPageForward + || scrollType == FScrollbar::scrollWheelUp + || scrollType == FScrollbar::scrollWheelDown ); switch ( scrollType ) { case FScrollbar::noScroll: - default: break; case FScrollbar::scrollPageBackward: diff --git a/src/fmenu.cpp b/src/fmenu.cpp index 898e8190..b94edb08 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -678,18 +678,19 @@ void FMenu::hideSuperMenus() } //---------------------------------------------------------------------- -bool FMenu::mouseDownOverList (FPoint mouse_pos) +bool FMenu::mouseDownOverList (const FPoint& mouse_pos) { bool focus_changed{false}; - mouse_pos -= FPoint(getRightPadding(), getTopPadding()); + FPoint pos{mouse_pos}; + pos -= FPoint(getRightPadding(), getTopPadding()); for (auto&& item : getItemList()) { const int x1 = item->getX(); const int x2 = item->getX() + int(item->getWidth()); const int y = item->getY(); - const int mouse_x = mouse_pos.getX(); - const int mouse_y = mouse_pos.getY(); + const int mouse_x = pos.getX(); + const int mouse_y = pos.getY(); if ( mouse_x >= x1 && mouse_x < x2 @@ -764,17 +765,18 @@ void FMenu::mouseDownSelection (FMenuItem* m_item, bool& focus_changed) } //---------------------------------------------------------------------- -bool FMenu::mouseUpOverList (FPoint mouse_pos) +bool FMenu::mouseUpOverList (const FPoint& mouse_pos) { - mouse_pos -= FPoint(getRightPadding(), getTopPadding()); + FPoint pos{mouse_pos}; + pos -= FPoint(getRightPadding(), getTopPadding()); for (auto&& item : getItemList()) { const int x1 = item->getX(); const int x2 = item->getX() + int(item->getWidth()); const int y = item->getY(); - const int mouse_x = mouse_pos.getX(); - const int mouse_y = mouse_pos.getY(); + const int mouse_x = pos.getX(); + const int mouse_y = pos.getY(); if ( item->isSelected() && mouse_x >= x1 @@ -819,17 +821,18 @@ bool FMenu::mouseUpOverList (FPoint mouse_pos) } //---------------------------------------------------------------------- -void FMenu::mouseMoveOverList (FPoint mouse_pos, mouseStates& ms) +void FMenu::mouseMoveOverList (const FPoint& mouse_pos, mouseStates& ms) { - mouse_pos -= FPoint(getRightPadding(), getTopPadding()); + FPoint pos{mouse_pos}; + pos -= FPoint(getRightPadding(), getTopPadding()); for (auto&& item : getItemList()) { const int x1 = item->getX(); const int x2 = item->getX() + int(item->getWidth()); const int y = item->getY(); - const int mouse_x = mouse_pos.getX(); - const int mouse_y = mouse_pos.getY(); + const int mouse_x = pos.getX(); + const int mouse_y = pos.getY(); if ( mouse_x >= x1 && mouse_x < x2 && mouse_y == y ) mouseMoveSelection (item, ms); @@ -1367,15 +1370,13 @@ inline void FMenu::drawMenuText (menuText& data) for (std::size_t z{0}; z < data.text.getLength(); z++) { - if ( ! std::iswprint(std::wint_t(data.text[z])) ) + if ( ! std::iswprint(std::wint_t(data.text[z])) + && ! isNewFont() + && ( data.text[z] < fc::NF_rev_left_arrow2 + || data.text[z] > fc::NF_check_mark ) + && ! charEncodable(wchar_t(data.text[z])) ) { - if ( ! isNewFont() - && ( data.text[z] < fc::NF_rev_left_arrow2 - || data.text[z] > fc::NF_check_mark ) - && ! charEncodable(wchar_t(data.text[z])) ) - { - data.text[z] = L' '; - } + data.text[z] = L' '; } if ( z == data.hotkeypos ) diff --git a/src/fmenubar.cpp b/src/fmenubar.cpp index b9f1f5a8..73b07fe1 100644 --- a/src/fmenubar.cpp +++ b/src/fmenubar.cpp @@ -596,14 +596,12 @@ inline void FMenuBar::drawMenuText (menuText& data) if ( data.startpos > screenWidth - z ) break; - if ( ! std::iswprint(std::wint_t(data.text[z])) ) + if ( ! std::iswprint(std::wint_t(data.text[z])) + && ! isNewFont() + && ( data.text[z] < fc::NF_rev_left_arrow2 + || data.text[z] > fc::NF_check_mark ) ) { - if ( ! isNewFont() - && ( data.text[z] < fc::NF_rev_left_arrow2 - || data.text[z] > fc::NF_check_mark ) ) - { - data.text[z] = L' '; - } + data.text[z] = L' '; } if ( z == data.hotkeypos ) @@ -849,11 +847,8 @@ void FMenuBar::mouseUpOverList (const FMouseEvent* ev) && item->isSelected() ) { // Mouse pointer over item - if ( ! activateMenu(item) ) - { - if ( clickItem(item) ) - return; - } + if ( ! activateMenu(item) && clickItem(item) ) + return; } else { diff --git a/src/fmenuitem.cpp b/src/fmenuitem.cpp index f65e8fa2..776ff201 100644 --- a/src/fmenuitem.cpp +++ b/src/fmenuitem.cpp @@ -684,9 +684,11 @@ void FMenuItem::passMouseEvent ( T widget, const FMouseEvent* ev break; case fc::MouseMove_Event: - default: widget->onMouseMove(_ev.get()); break; + + default: + break; } } diff --git a/src/fmouse.cpp b/src/fmouse.cpp index 175d1a21..109a7bbb 100644 --- a/src/fmouse.cpp +++ b/src/fmouse.cpp @@ -180,17 +180,22 @@ inline bool FMouse::isInputDataPending() //---------------------------------------------------------------------- inline FMouse* FMouse::createMouseObject (const mouse_type mt) { + assert ( mt == FMouse::none + || mt == FMouse::gpm + || mt == FMouse::x11 + || mt == FMouse::sgr + || mt == FMouse::urxvt ); + switch ( mt ) { case none: - default: return nullptr; case gpm: #ifdef F_HAVE_LIBGPM return new FMouseGPM; #else - break; + return nullptr; #endif case x11: @@ -203,7 +208,7 @@ inline FMouse* FMouse::createMouseObject (const mouse_type mt) return new FMouseUrxvt; } - return new FMouseX11; + return nullptr; } //---------------------------------------------------------------------- diff --git a/src/foptimove.cpp b/src/foptimove.cpp index 2bb8ebd0..681788e0 100644 --- a/src/foptimove.cpp +++ b/src/foptimove.cpp @@ -490,14 +490,12 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew) check_boundaries (xold, yold, xnew, ynew); // Method 0: direct cursor addressing - if ( isMethod0Faster(move_time, xnew, ynew) ) - { - if ( xold < 0 + if ( isMethod0Faster(move_time, xnew, ynew) + && ( xold < 0 || yold < 0 - || isWideMove (xold, yold, xnew, ynew) ) - { - return ( move_time < LONG_DURATION ) ? move_buf : nullptr; - } + || isWideMove (xold, yold, xnew, ynew) ) ) + { + return ( move_time < LONG_DURATION ) ? move_buf : nullptr; } // Method 1: local movement diff --git a/src/fpoint.cpp b/src/fpoint.cpp index 47b55db4..51ea2ecc 100644 --- a/src/fpoint.cpp +++ b/src/fpoint.cpp @@ -44,9 +44,8 @@ FPoint& FPoint::operator = (const FPoint& p) //---------------------------------------------------------------------- FPoint& FPoint::operator = (FPoint&& p) noexcept { - xpos = p.xpos; - ypos = p.ypos; - p.xpos = p.ypos = 0; + xpos = std::move(p.xpos); + ypos = std::move(p.ypos); return *this; } diff --git a/src/frect.cpp b/src/frect.cpp index c2fa83df..3c93957b 100644 --- a/src/frect.cpp +++ b/src/frect.cpp @@ -69,12 +69,10 @@ FRect& FRect::operator = (const FRect& r) //---------------------------------------------------------------------- FRect& FRect::operator = (FRect&& r) noexcept { - X1 = r.X1; - Y1 = r.Y1; - X2 = r.X2; - Y2 = r.Y2; - r.X1 = r.Y1 = 0; - r.X2 = r.Y2 = -1; + X1 = std::move(r.X1); + Y1 = std::move(r.Y1); + X2 = std::move(r.X2); + Y2 = std::move(r.Y2); return *this; } diff --git a/src/fscrollview.cpp b/src/fscrollview.cpp index f4dde428..58e56b7c 100644 --- a/src/fscrollview.cpp +++ b/src/fscrollview.cpp @@ -202,13 +202,10 @@ void FScrollView::setPos (const FPoint& p, bool adjust) scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1 , getTermY() + getTopPadding() - 1 ); - if ( ! adjust ) + if ( ! adjust && viewport ) { - if ( viewport ) - { - viewport->offset_left = scroll_geometry.getX(); - viewport->offset_top = scroll_geometry.getY(); - } + viewport->offset_left = scroll_geometry.getX(); + viewport->offset_top = scroll_geometry.getY(); } } @@ -790,10 +787,13 @@ void FScrollView::calculateScrollbarPos() //---------------------------------------------------------------------- void FScrollView::setHorizontalScrollBarVisibility() { + assert ( v_mode == fc::Auto + || v_mode == fc::Hidden + || v_mode == fc::Scroll ); + switch ( h_mode ) { case fc::Auto: - default: if ( getScrollWidth() > getViewportWidth() ) hbar->show(); else @@ -813,10 +813,13 @@ void FScrollView::setHorizontalScrollBarVisibility() //---------------------------------------------------------------------- void FScrollView::setVerticalScrollBarVisibility() { + assert ( v_mode == fc::Auto + || v_mode == fc::Hidden + || v_mode == fc::Scroll ); + switch ( v_mode ) { case fc::Auto: - default: if ( getScrollHeight() > getViewportHeight() ) vbar->show(); else @@ -859,6 +862,14 @@ void FScrollView::cb_vbarChange (const FWidget*, const FDataPtr) FScrollbar::sType scrollType = vbar->getScrollType(); static constexpr int wheel_distance = 4; int distance{1}; + assert ( scrollType == FScrollbar::noScroll + || scrollType == FScrollbar::scrollJump + || scrollType == FScrollbar::scrollStepBackward + || scrollType == FScrollbar::scrollStepForward + || scrollType == FScrollbar::scrollPageBackward + || scrollType == FScrollbar::scrollPageForward + || scrollType == FScrollbar::scrollWheelUp + || scrollType == FScrollbar::scrollWheelDown ); if ( scrollType >= FScrollbar::scrollStepBackward ) { @@ -872,7 +883,6 @@ void FScrollView::cb_vbarChange (const FWidget*, const FDataPtr) switch ( scrollType ) { case FScrollbar::noScroll: - default: break; case FScrollbar::scrollPageBackward: @@ -911,6 +921,14 @@ void FScrollView::cb_hbarChange (const FWidget*, const FDataPtr) FScrollbar::sType scrollType = hbar->getScrollType(); static constexpr int wheel_distance = 4; int distance{1}; + assert ( scrollType == FScrollbar::noScroll + || scrollType == FScrollbar::scrollJump + || scrollType == FScrollbar::scrollStepBackward + || scrollType == FScrollbar::scrollStepForward + || scrollType == FScrollbar::scrollPageBackward + || scrollType == FScrollbar::scrollPageForward + || scrollType == FScrollbar::scrollWheelUp + || scrollType == FScrollbar::scrollWheelDown ); if ( scrollType >= FScrollbar::scrollStepBackward ) { @@ -924,7 +942,6 @@ void FScrollView::cb_hbarChange (const FWidget*, const FDataPtr) switch ( scrollType ) { case FScrollbar::noScroll: - default: break; case FScrollbar::scrollPageBackward: diff --git a/src/fsize.cpp b/src/fsize.cpp index 8eb7e00e..1baba394 100644 --- a/src/fsize.cpp +++ b/src/fsize.cpp @@ -47,9 +47,8 @@ FSize& FSize::operator = (const FSize& s) //---------------------------------------------------------------------- FSize& FSize::operator = (FSize&& s) noexcept { - width = s.width; - height = s.height; - s.width = s.height = 0; + width = std::move(s.width); + height = std::move(s.height); return *this; } @@ -83,7 +82,7 @@ void FSize::setHeight (std::size_t h) } //---------------------------------------------------------------------- -void FSize::setSize (FSize s) +void FSize::setSize (const FSize& s) { width = s.width; height = s.height; diff --git a/src/fspinbox.cpp b/src/fspinbox.cpp index db83c281..f3743057 100644 --- a/src/fspinbox.cpp +++ b/src/fspinbox.cpp @@ -281,8 +281,15 @@ void FSpinBox::onTimer (FTimerEvent*) addTimer(repeat_time); } + assert ( spining_state == FSpinBox::noSpin + || spining_state == FSpinBox::spinUp + || spining_state == FSpinBox::spinDown ); + switch ( spining_state ) { + case FSpinBox::noSpin: + break; + case FSpinBox::spinUp: increaseValue(); updateInputField(); @@ -292,10 +299,6 @@ void FSpinBox::onTimer (FTimerEvent*) decreaseValue(); updateInputField(); break; - - case FSpinBox::noSpin: - default: - break; } } diff --git a/src/fstartoptions.cpp b/src/fstartoptions.cpp index 8034f1c2..4093f980 100644 --- a/src/fstartoptions.cpp +++ b/src/fstartoptions.cpp @@ -43,7 +43,6 @@ FStartOptions::FStartOptions() , sgr_optimizer{true} , vgafont{false} , newfont{false} - , encoding{fc::UNKNOWN} #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST) , meta_sends_escape{true} , change_cursorstyle{true} diff --git a/src/fswitch.cpp b/src/fswitch.cpp index 13d116e0..d64e35eb 100644 --- a/src/fswitch.cpp +++ b/src/fswitch.cpp @@ -43,8 +43,8 @@ FSwitch::FSwitch(FWidget* parent) //---------------------------------------------------------------------- FSwitch::FSwitch (const FString& txt, FWidget* parent) : FToggleButton(txt, parent) + , switch_offset_pos(txt.getLength() + 1) { - switch_offset_pos = txt.getLength() + 1; setButtonWidth(11); } diff --git a/src/fterm.cpp b/src/fterm.cpp index 83ee8311..de9488da 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -1070,7 +1070,9 @@ void FTerm::setEncoding (fc::encoding enc) assert ( enc == fc::UTF8 || enc == fc::VT100 // VT100 line drawing || enc == fc::PC // CP-437 - || enc == fc::ASCII ); + || enc == fc::ASCII + || enc == fc::UNKNOWN + || enc == fc::NUM_OF_ENCODINGS ); // Set the new putchar() function pointer switch ( enc ) @@ -1090,7 +1092,6 @@ void FTerm::setEncoding (fc::encoding enc) case fc::ASCII: case fc::UNKNOWN: case fc::NUM_OF_ENCODINGS: - default: putchar() = &FTerm::putchar_ASCII; } @@ -1794,11 +1795,10 @@ void FTerm::init_individual_term_encoding() data->setTermEncoding (fc::PC); putchar() = &FTerm::putchar_ASCII; // function pointer - if ( hasUTF8() && getStartOptions().encoding == fc::UNKNOWN ) - { - if ( isXTerminal() ) - putchar() = &FTerm::putchar_UTF8; // function pointer - } + if ( hasUTF8() + && getStartOptions().encoding == fc::UNKNOWN + && isXTerminal() ) + putchar() = &FTerm::putchar_UTF8; // function pointer } } @@ -2326,7 +2326,7 @@ bool FTerm::init_terminal() { FTermios::storeTTYsettings(); } - catch (const std::runtime_error& ex) + catch (const std::system_error& ex) { FString msg = "FTerm: " + FString(ex.what()); data->setExitMessage(msg); @@ -2554,7 +2554,6 @@ void FTerm::signal_handler (int signum) << signum << " (" << strsignal(signum) << ")" << std::endl; std::terminate(); - break; default: break; diff --git a/src/fterm_functions.cpp b/src/fterm_functions.cpp index 4670901c..1f439f59 100644 --- a/src/fterm_functions.cpp +++ b/src/fterm_functions.cpp @@ -200,10 +200,18 @@ uInt env2uint (const char* env) { return str.toUInt(); } - catch (const std::exception&) + catch (const std::invalid_argument&) { return 0; } + catch (const std::underflow_error&) + { + return std::numeric_limits::min(); + } + catch (const std::overflow_error&) + { + return std::numeric_limits::max(); + } } //---------------------------------------------------------------------- @@ -507,7 +515,7 @@ std::size_t getColumnWidth (const FTermBuffer& tb) return std::accumulate ( std::next(tb.begin()) , tb.end() , tb.front().attr.bit.char_width - , [] (std::size_t s, FChar c) -> std::size_t + , [] (std::size_t s, FChar c) { return std::move(s) + c.attr.bit.char_width; } diff --git a/src/ftermbuffer.cpp b/src/ftermbuffer.cpp index a9fcb7e5..b6f5daac 100644 --- a/src/ftermbuffer.cpp +++ b/src/ftermbuffer.cpp @@ -50,7 +50,7 @@ const FString FTermBuffer::toString() const std::transform ( data.begin() , data.end() , std::back_inserter(wide_string) - , [] (const FChar& fchar) -> wchar_t + , [] (const FChar& fchar) { return fchar.ch; } diff --git a/src/ftermdetection.cpp b/src/ftermdetection.cpp index 0d7cf2c6..2bbd11f7 100644 --- a/src/ftermdetection.cpp +++ b/src/ftermdetection.cpp @@ -558,22 +558,20 @@ const FString FTermDetection::getXTermColorName (FColor color) tv.tv_usec = 150000; // 150 ms // read the terminal answer - if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 ) + if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 + && std::scanf("\033]4;%10hu;%509[^\n]s", &color, temp) == 2 ) { - if ( std::scanf("\033]4;%10hu;%509[^\n]s", &color, temp) == 2 ) - { - std::size_t n = std::strlen(temp); + std::size_t n = std::strlen(temp); - // BEL + '\0' = string terminator - if ( n >= 6 && temp[n - 1] == BEL[0] && temp[n] == '\0' ) - temp[n - 1] = '\0'; + // BEL + '\0' = string terminator + if ( n >= 6 && temp[n - 1] == BEL[0] && temp[n] == '\0' ) + temp[n - 1] = '\0'; - // Esc + \ = OSC string terminator (mintty) - if ( n >= 6 && temp[n - 2] == ESC[0] && temp[n - 1] == '\\' ) - temp[n - 2] = '\0'; + // Esc + \ = OSC string terminator (mintty) + if ( n >= 6 && temp[n - 2] == ESC[0] && temp[n - 1] == '\\' ) + temp[n - 2] = '\0'; - color_str = temp; - } + color_str = temp; } return color_str; @@ -640,9 +638,9 @@ const FString FTermDetection::getAnswerbackMsg() tv.tv_usec = 150000; // 150 ms // Read the answerback message - if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 ) - if ( std::fgets (temp, sizeof(temp) - 1, stdin) != nullptr ) - answerback = temp; + if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 + && std::fgets (temp, sizeof(temp) - 1, stdin) != nullptr ) + answerback = temp; return answerback; } @@ -712,16 +710,30 @@ char* FTermDetection::parseSecDA (char current_termtype[]) //---------------------------------------------------------------------- int FTermDetection::str2int (const FString& s) { + // This is not a general string to integer conversion method. + // It is only used in this class to convert the device attribute + // parameters into numbers. + + constexpr int ERROR = -1; + if ( ! s ) - return -1; + return ERROR; try { return s.toInt(); } - catch (const std::exception&) + catch (const std::invalid_argument&) { - return -1; + return ERROR; + } + catch (const std::underflow_error&) + { + return ERROR; + } + catch (const std::overflow_error&) + { + return ERROR; } } diff --git a/src/ftermios.cpp b/src/ftermios.cpp index e16df869..45aa912d 100644 --- a/src/ftermios.cpp +++ b/src/ftermios.cpp @@ -24,6 +24,7 @@ #undef __STRICT_ANSI__ // need for fileno #endif +#include #include #include "final/ftermios.h" @@ -74,7 +75,7 @@ termios FTermios::getTTY() struct termios t{}; if ( tcgetattr(stdin_no, &t) == -1 ) - throw std::runtime_error("Cannot find tty"); + throw std::system_error(errno, std::generic_category()); return t; } diff --git a/src/ftextview.cpp b/src/ftextview.cpp index ad924e89..b3b61084 100644 --- a/src/ftextview.cpp +++ b/src/ftextview.cpp @@ -749,6 +749,14 @@ void FTextView::cb_vbarChange (const FWidget*, const FDataPtr) const FScrollbar::sType scrollType = vbar->getScrollType(); static constexpr int wheel_distance = 4; int distance{1}; + assert ( scrollType == FScrollbar::noScroll + || scrollType == FScrollbar::scrollJump + || scrollType == FScrollbar::scrollStepBackward + || scrollType == FScrollbar::scrollStepForward + || scrollType == FScrollbar::scrollPageBackward + || scrollType == FScrollbar::scrollPageForward + || scrollType == FScrollbar::scrollWheelUp + || scrollType == FScrollbar::scrollWheelDown ); if ( scrollType >= FScrollbar::scrollStepBackward ) update_scrollbar = true; @@ -758,7 +766,6 @@ void FTextView::cb_vbarChange (const FWidget*, const FDataPtr) switch ( scrollType ) { case FScrollbar::noScroll: - default: break; case FScrollbar::scrollPageBackward: @@ -801,6 +808,14 @@ void FTextView::cb_hbarChange (const FWidget*, const FDataPtr) const FScrollbar::sType scrollType = hbar->getScrollType(); static constexpr int wheel_distance = 4; int distance{1}; + assert ( scrollType == FScrollbar::noScroll + || scrollType == FScrollbar::scrollJump + || scrollType == FScrollbar::scrollStepBackward + || scrollType == FScrollbar::scrollStepForward + || scrollType == FScrollbar::scrollPageBackward + || scrollType == FScrollbar::scrollPageForward + || scrollType == FScrollbar::scrollWheelUp + || scrollType == FScrollbar::scrollWheelDown ); if ( scrollType >= FScrollbar::scrollStepBackward ) update_scrollbar = true; @@ -810,7 +825,6 @@ void FTextView::cb_hbarChange (const FWidget*, const FDataPtr) switch ( scrollType ) { case FScrollbar::noScroll: - default: break; case FScrollbar::scrollPageBackward: diff --git a/src/ftogglebutton.cpp b/src/ftogglebutton.cpp index 6c0aac86..94d1fd07 100644 --- a/src/ftogglebutton.cpp +++ b/src/ftogglebutton.cpp @@ -520,7 +520,7 @@ void FToggleButton::init() } //---------------------------------------------------------------------- -void FToggleButton::drawText (FString&& label_text, std::size_t hotkeypos) +void FToggleButton::drawText (const FString& label_text, std::size_t hotkeypos) { if ( isMonochron() ) setReverse(true); diff --git a/src/ftooltip.cpp b/src/ftooltip.cpp index 986b44ce..76273a1c 100644 --- a/src/ftooltip.cpp +++ b/src/ftooltip.cpp @@ -90,12 +90,6 @@ void FToolTip::show() FWindow::show(); } -//---------------------------------------------------------------------- -void FToolTip::hide() -{ - FWindow::hide(); -} - //---------------------------------------------------------------------- void FToolTip::onMouseDown (FMouseEvent*) { diff --git a/src/fvterm.cpp b/src/fvterm.cpp index e767229a..75ff8046 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -151,16 +151,14 @@ void FVTerm::setTermXY (int x, int y) //---------------------------------------------------------------------- void FVTerm::setTerminalUpdates (terminal_update refresh_state) { - switch ( refresh_state ) + if ( refresh_state == stop_terminal_updates ) { - case stop_terminal_updates: - no_terminal_updates = true; - break; - - case continue_terminal_updates: - case start_terminal_updates: - default: - no_terminal_updates = false; + no_terminal_updates = true; + } + else if ( refresh_state == continue_terminal_updates + || refresh_state == start_terminal_updates ) + { + no_terminal_updates = false; } if ( refresh_state == start_terminal_updates ) @@ -1176,20 +1174,17 @@ void FVTerm::scrollAreaForward (FTermArea* area) area->changes[y_max].xmax = uInt(area->width - 1); area->has_changes = true; - if ( area == vdesktop ) + if ( area == vdesktop && TCAP(fc::t_scroll_forward) ) { - if ( TCAP(fc::t_scroll_forward) ) - { - setTermXY (0, vdesktop->height); - FTerm::scrollTermForward(); - putArea (FPoint(1, 1), vdesktop); + setTermXY (0, vdesktop->height); + FTerm::scrollTermForward(); + putArea (FPoint(1, 1), vdesktop); - // avoid update lines from 0 to (y_max - 1) - for (int y{0}; y < y_max; y++) - { - area->changes[y].xmin = uInt(area->width - 1); - area->changes[y].xmax = 0; - } + // avoid update lines from 0 to (y_max - 1) + for (int y{0}; y < y_max; y++) + { + area->changes[y].xmin = uInt(area->width - 1); + area->changes[y].xmax = 0; } } } @@ -1234,20 +1229,17 @@ void FVTerm::scrollAreaReverse (FTermArea* area) area->changes[0].xmax = uInt(area->width - 1); area->has_changes = true; - if ( area == vdesktop ) + if ( area == vdesktop && TCAP(fc::t_scroll_reverse) ) { - if ( TCAP(fc::t_scroll_reverse) ) - { - setTermXY (0, 0); - FTerm::scrollTermReverse(); - putArea (FPoint(1, 1), vdesktop); + setTermXY (0, 0); + FTerm::scrollTermReverse(); + putArea (FPoint(1, 1), vdesktop); - // avoid update lines from 1 to y_max - for (int y{1}; y <= y_max; y++) - { - area->changes[y].xmin = uInt(area->width - 1); - area->changes[y].xmax = 0; - } + // avoid update lines from 1 to y_max + for (int y{1}; y <= y_max; y++) + { + area->changes[y].xmin = uInt(area->width - 1); + area->changes[y].xmax = 0; } } } @@ -1721,7 +1713,7 @@ bool FVTerm::hasChildAreaChanges (FTermArea* area) return std::any_of ( area->preproc_list.begin() , area->preproc_list.end() - , [] (const FVTermPreprocessing& pcall) -> bool + , [] (const FVTermPreprocessing& pcall) { return pcall.instance && pcall.instance->child_print_area diff --git a/src/fwidget.cpp b/src/fwidget.cpp index 0aaa7d73..ff0c1aec 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -235,11 +235,11 @@ std::vector& FWidget::doubleFlatLine_ref (fc::sides side) return double_flatline_mask.bottom; case fc::left: - default: return double_flatline_mask.left; } - return double_flatline_mask.left; + static std::vector empty; + return empty; } //---------------------------------------------------------------------- @@ -671,9 +671,6 @@ void FWidget::setDoubleFlatLine (fc::sides side, bool bit) length = double_flatline_mask.left.size(); double_flatline_mask.left.assign(length, bit); break; - - default: - break; } } @@ -723,9 +720,6 @@ void FWidget::setDoubleFlatLine (fc::sides side, int pos, bool bit) double_flatline_mask.left[index] = bit; break; - - default: - break; } } @@ -807,7 +801,7 @@ bool FWidget::close() //---------------------------------------------------------------------- void FWidget::addCallback ( const FString& cb_signal - , FCallback cb_function + , const FCallback& cb_function , FDataPtr data ) { // Add a (normal) function pointer as callback @@ -819,7 +813,7 @@ void FWidget::addCallback ( const FString& cb_signal //---------------------------------------------------------------------- void FWidget::addCallback ( const FString& cb_signal , FWidget* cb_instance - , FCallback cb_function + , const FCallback& cb_function , FDataPtr data ) { // Add a member function pointer as callback @@ -829,7 +823,7 @@ void FWidget::addCallback ( const FString& cb_signal } //---------------------------------------------------------------------- -void FWidget::delCallback (FCallback cb_function) +void FWidget::delCallback (const FCallback& cb_function) { // Delete cb_function form callback list @@ -1103,13 +1097,12 @@ bool FWidget::focusFirstChild() { widget->setFocus(); - if ( widget->numOfChildren() >= 1 ) + if ( widget->numOfChildren() >= 1 + && ! widget->focusFirstChild() + && widget->isWindowWidget() ) { - if ( ! widget->focusFirstChild() && widget->isWindowWidget() ) - { - ++iter; - continue; - } + ++iter; + continue; } return true; @@ -1145,11 +1138,9 @@ bool FWidget::focusLastChild() { widget->setFocus(); - if ( widget->numOfChildren() >= 1 ) - { - if ( ! widget->focusLastChild() && widget->isWindowWidget() ) - continue; - } + if ( widget->numOfChildren() >= 1 + && ! widget->focusLastChild() && widget->isWindowWidget() ) + continue; return true; } diff --git a/src/include/final/fcolorpair.h b/src/include/final/fcolorpair.h index 1b60833d..6214e665 100644 --- a/src/include/final/fcolorpair.h +++ b/src/include/final/fcolorpair.h @@ -56,21 +56,13 @@ class FColorPair { } // Copy constructor - FColorPair (const FColorPair& pair) - : fg_color{pair.fg_color} - , bg_color{pair.bg_color} - { } + FColorPair (const FColorPair& pair) = default; // Destructor ~FColorPair() = default; // copy assignment operator (=) - FColorPair& operator = (const FColorPair& pair) - { - fg_color = pair.fg_color; - bg_color = pair.bg_color; - return *this; - } + FColorPair& operator = (const FColorPair& pair) = default; // Accessor const FString getClassName() const diff --git a/src/include/final/fcombobox.h b/src/include/final/fcombobox.h index cc6b72ba..bccfb7ae 100644 --- a/src/include/final/fcombobox.h +++ b/src/include/final/fcombobox.h @@ -181,7 +181,7 @@ class FComboBox : public FWidget bool hasShadow(); // Methods - void insert (FListBoxItem); + void insert (const FListBoxItem&); template void insert ( const std::initializer_list& list , FDataPtr = nullptr ); diff --git a/src/include/final/ffiledialog.h b/src/include/final/ffiledialog.h index 321f254c..5c6f3479 100644 --- a/src/include/final/ffiledialog.h +++ b/src/include/final/ffiledialog.h @@ -144,7 +144,7 @@ class FFileDialog : public FDialog // Typedef struct dir_entry { - char* name; + std::string name; // Type of file uChar fifo : 1; uChar character_device : 1; diff --git a/src/include/final/fkeyboard.h b/src/include/final/fkeyboard.h index 9dca7e56..d16578aa 100644 --- a/src/include/final/fkeyboard.h +++ b/src/include/final/fkeyboard.h @@ -115,9 +115,9 @@ class FKeyboard final void disableUTF8(); void enableMouseSequences(); void disableMouseSequences(); - void setPressCommand (FKeyboardCommand); - void setReleaseCommand (FKeyboardCommand); - void setEscPressedCommand (FKeyboardCommand); + void setPressCommand (const FKeyboardCommand&); + void setReleaseCommand (const FKeyboardCommand&); + void setEscPressedCommand (const FKeyboardCommand&); // Inquiry bool isInputDataPending(); @@ -236,15 +236,15 @@ inline void FKeyboard::disableMouseSequences() { mouse_support = false; } //---------------------------------------------------------------------- -inline void FKeyboard::setPressCommand (FKeyboardCommand cmd) +inline void FKeyboard::setPressCommand (const FKeyboardCommand& cmd) { keypressed_cmd = cmd; } //---------------------------------------------------------------------- -inline void FKeyboard::setReleaseCommand (FKeyboardCommand cmd) +inline void FKeyboard::setReleaseCommand (const FKeyboardCommand& cmd) { keyreleased_cmd = cmd; } //---------------------------------------------------------------------- -inline void FKeyboard::setEscPressedCommand (FKeyboardCommand cmd) +inline void FKeyboard::setEscPressedCommand (const FKeyboardCommand& cmd) { escape_key_cmd = cmd; } //---------------------------------------------------------------------- diff --git a/src/include/final/flabel.h b/src/include/final/flabel.h index 52286415..9c884519 100644 --- a/src/include/final/flabel.h +++ b/src/include/final/flabel.h @@ -135,7 +135,7 @@ class FLabel : public FWidget void draw() override; void drawMultiLine(); void drawSingleLine(); - void printLine (FString&&); + void printLine (FString&); // Data members FStringList multiline_text{}; diff --git a/src/include/final/flistbox.h b/src/include/final/flistbox.h index e2a71688..adb6312c 100644 --- a/src/include/final/flistbox.h +++ b/src/include/final/flistbox.h @@ -201,7 +201,7 @@ class FListBox : public FWidget void insert (Iterator, Iterator, InsertConverter); template void insert (Container, LazyConverter); - void insert (FListBoxItem); + void insert (const FListBoxItem&); template void insert ( const std::initializer_list& list , fc::brackets_type = fc::NoBrackets diff --git a/src/include/final/fmenu.h b/src/include/final/fmenu.h index a7d0dc54..5b4c0b02 100644 --- a/src/include/final/fmenu.h +++ b/src/include/final/fmenu.h @@ -179,11 +179,11 @@ class FMenu : public FWindow, public FMenuList void closeOpenedSubMenu(); void hideSubMenus(); void hideSuperMenus(); - bool mouseDownOverList (FPoint); + bool mouseDownOverList (const FPoint&); void mouseDownSubmenu (const FMenuItem*); void mouseDownSelection (FMenuItem*, bool&); - bool mouseUpOverList (FPoint); - void mouseMoveOverList (FPoint, mouseStates&); + bool mouseUpOverList (const FPoint&); + void mouseMoveOverList (const FPoint&, mouseStates&); void mouseMoveSelection (FMenuItem*, mouseStates&); void mouseMoveDeselection (FMenuItem*, mouseStates&); void mouseUpOverBorder(); diff --git a/src/include/final/fpoint.h b/src/include/final/fpoint.h index 857d6cd6..396923d2 100644 --- a/src/include/final/fpoint.h +++ b/src/include/final/fpoint.h @@ -109,9 +109,9 @@ inline FPoint::FPoint (const FPoint& p) // copy constructor //---------------------------------------------------------------------- inline FPoint::FPoint (FPoint&& p) noexcept // move constructor - : xpos(p.xpos) - , ypos(p.ypos) -{ p.xpos = p.ypos = 0; } + : xpos(std::move(p.xpos)) + , ypos(std::move(p.ypos)) +{ } //---------------------------------------------------------------------- inline FPoint::FPoint (int x, int y) diff --git a/src/include/final/frect.h b/src/include/final/frect.h index e3b50194..af4e1cc8 100644 --- a/src/include/final/frect.h +++ b/src/include/final/frect.h @@ -156,14 +156,11 @@ inline FRect::FRect (const FRect& r) // copy constructor //---------------------------------------------------------------------- inline FRect::FRect (FRect&& r) noexcept // move constructor - : X1(r.X1) - , Y1(r.Y1) - , X2(r.X2) - , Y2(r.Y2) -{ - r.X1 = r.Y1 = 0; - r.X2 = r.Y2 = -1; -} + : X1(std::move(r.X1)) + , Y1(std::move(r.Y1)) + , X2(std::move(r.X2)) + , Y2(std::move(r.Y2)) +{ } //---------------------------------------------------------------------- inline FRect::FRect (int x, int y, std::size_t width, std::size_t height) diff --git a/src/include/final/fsize.h b/src/include/final/fsize.h index 4549b2d7..21c30ae4 100644 --- a/src/include/final/fsize.h +++ b/src/include/final/fsize.h @@ -76,7 +76,7 @@ class FSize std::size_t getArea() const; void setWidth (std::size_t); void setHeight (std::size_t); - void setSize (FSize); + void setSize (const FSize&); void setSize (std::size_t, std::size_t); // Inquiry @@ -118,9 +118,9 @@ inline FSize::FSize (const FSize& s) // copy constructor //---------------------------------------------------------------------- inline FSize::FSize (FSize&& s) noexcept // move constructor - : width(s.width) - , height(s.height) -{ s.width = s.height = 0; } + : width(std::move(s.width)) + , height(std::move(s.height)) +{ } //---------------------------------------------------------------------- inline FSize::FSize (std::size_t w, std::size_t h) diff --git a/src/include/final/fstartoptions.h b/src/include/final/fstartoptions.h index af377ca1..b9e7bac1 100644 --- a/src/include/final/fstartoptions.h +++ b/src/include/final/fstartoptions.h @@ -82,7 +82,7 @@ class FStartOptions final uInt8 sgr_optimizer : 1; uInt8 vgafont : 1; uInt8 newfont : 1; - fc::encoding encoding; + fc::encoding encoding{fc::UNKNOWN}; #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST) uInt8 meta_sends_escape : 1; @@ -93,7 +93,7 @@ class FStartOptions final uInt8 : 7; // padding bits #endif - static FStartOptions* start_options; + static FStartOptions* start_options; }; //---------------------------------------------------------------------- diff --git a/src/include/final/fsystem.h b/src/include/final/fsystem.h index 99c7bd7e..f1a494ef 100644 --- a/src/include/final/fsystem.h +++ b/src/include/final/fsystem.h @@ -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 * @@ -48,6 +48,9 @@ namespace finalcut class FSystem { public: + // Using-declaration + using fn_putc = int (*)(int); + // Constructor FSystem(); @@ -64,7 +67,7 @@ class FSystem virtual FILE* fopen (const char*, const char*) = 0; virtual int fclose (FILE*) = 0; virtual int putchar (int) = 0; - virtual int tputs (const char*, int, int (*)(int)) = 0; + virtual int tputs (const char*, int, fn_putc) = 0; virtual uid_t getuid() = 0; virtual uid_t geteuid() = 0; virtual int getpwuid_r ( uid_t, struct passwd*, char* diff --git a/src/include/final/fsystemimpl.h b/src/include/final/fsystemimpl.h index a57147aa..6804e4b9 100644 --- a/src/include/final/fsystemimpl.h +++ b/src/include/final/fsystemimpl.h @@ -170,7 +170,7 @@ class FSystemImpl : public FSystem #endif } - int tputs (const char* str, int affcnt, int (*putc)(int)) override + int tputs (const char* str, int affcnt, fn_putc putc) override { #if defined(__sun) && defined(__SVR4) return ::tputs ( C_STR(str) diff --git a/src/include/final/ftermopenbsd.h b/src/include/final/ftermopenbsd.h index 91c530c0..051fa1e2 100644 --- a/src/include/final/ftermopenbsd.h +++ b/src/include/final/ftermopenbsd.h @@ -102,8 +102,8 @@ class FTermOpenBSD final static bool setBeep (int, int); static bool resetBeep(); - private: #if defined(__NetBSD__) || defined(__OpenBSD__) || defined(UNIT_TEST) + private: // Methods static bool saveBSDConsoleEncoding(); static bool setBSDConsoleEncoding (kbd_t); diff --git a/src/include/final/ftogglebutton.h b/src/include/final/ftogglebutton.h index 2531c5ee..cbf6038d 100644 --- a/src/include/final/ftogglebutton.h +++ b/src/include/final/ftogglebutton.h @@ -147,7 +147,7 @@ class FToggleButton : public FWidget // Methods void init(); - void drawText (FString&&, std::size_t); + void drawText (const FString&, std::size_t); void correctSize (FSize&); // Data members diff --git a/src/include/final/ftooltip.h b/src/include/final/ftooltip.h index 6800927f..16769727 100644 --- a/src/include/final/ftooltip.h +++ b/src/include/final/ftooltip.h @@ -94,7 +94,6 @@ class FToolTip : public FWindow // Methods void show() override; - void hide() override; // Event handler void onMouseDown (FMouseEvent*) override; diff --git a/src/include/final/fvterm.h b/src/include/final/fvterm.h index c6d078b4..004e9312 100644 --- a/src/include/final/fvterm.h +++ b/src/include/final/fvterm.h @@ -566,12 +566,9 @@ struct FVTerm::FVTermPreprocessing { } FVTermPreprocessing (FVTermPreprocessing&& p) noexcept // move constructor - : instance(p.instance) - , function(p.function) - { - p.instance = nullptr; - p.function = nullptr; - } + : instance(std::move(p.instance)) + , function(std::move(p.function)) + { } // Overloaded operators FVTermPreprocessing& operator = (const FVTermPreprocessing& p) diff --git a/src/include/final/fwidget.h b/src/include/final/fwidget.h index e3789558..c1acf85d 100644 --- a/src/include/final/fwidget.h +++ b/src/include/final/fwidget.h @@ -313,13 +313,13 @@ class FWidget : public FVTerm, public FObject virtual bool close(); void clearStatusbarMessage(); void addCallback ( const FString& - , FCallback + , const FCallback& , FDataPtr = nullptr ); void addCallback ( const FString& , FWidget* - , FCallback + , const FCallback& , FDataPtr = nullptr ); - void delCallback (FCallback); + void delCallback (const FCallback&); void delCallback (const FWidget*); void delCallbacks(); void emitCallback (const FString&); @@ -524,13 +524,9 @@ struct FWidget::FCallbackData { // Constructor FCallbackData() - : cb_signal() - , cb_instance(nullptr) - , cb_function() - , data(nullptr) { } - FCallbackData (FString s, FWidget* i, FCallback c, FDataPtr d) + FCallbackData (const FString& s, FWidget* i, const FCallback& c, FDataPtr d) : cb_signal(s) , cb_instance(i) , cb_function(c) @@ -545,16 +541,11 @@ struct FWidget::FCallbackData { } FCallbackData (FCallbackData&& c) noexcept // move constructor - : cb_signal(c.cb_signal) - , cb_instance(c.cb_instance) - , cb_function(c.cb_function) - , data(c.data) - { - c.cb_signal.clear(); - c.cb_instance = nullptr; - c.cb_function = nullptr; - c.data = nullptr; - } + : cb_signal(std::move(c.cb_signal)) + , cb_instance(std::move(c.cb_instance)) + , cb_function(std::move(c.cb_function)) + , data(std::move(c.data)) + { } // Destructor ~FCallbackData() @@ -572,14 +563,10 @@ struct FWidget::FCallbackData FCallbackData& operator = (FCallbackData&& c) noexcept { - cb_signal = c.cb_signal; - cb_instance = c.cb_instance; - cb_function = c.cb_function; - data = c.data; - c.cb_signal.clear(); - c.cb_instance = nullptr; - c.cb_function = nullptr; - c.data = nullptr; + cb_signal = std::move(c.cb_signal); + cb_instance = std::move(c.cb_instance); + cb_function = std::move(c.cb_function); + data = std::move(c.data); return *this; } diff --git a/src/libfinal.so.0 b/src/libfinal.so.0 new file mode 120000 index 00000000..7d9ba4d7 --- /dev/null +++ b/src/libfinal.so.0 @@ -0,0 +1 @@ +libfinal.so.0.6.1 \ No newline at end of file diff --git a/src/libfinal.so.0.6.1 b/src/libfinal.so.0.6.1 new file mode 100755 index 00000000..cb551772 Binary files /dev/null and b/src/libfinal.so.0.6.1 differ diff --git a/test/fpoint-test.cpp b/test/fpoint-test.cpp index d0cfe1fc..eb1d1f5b 100644 --- a/test/fpoint-test.cpp +++ b/test/fpoint-test.cpp @@ -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 * @@ -117,8 +117,8 @@ void FPointTest::moveConstructorTest() { finalcut::FPoint p1 (25, 16); const finalcut::FPoint p2 (std::move(p1)); - CPPUNIT_ASSERT ( p1.getX() == 0 ); - CPPUNIT_ASSERT ( p1.getY() == 0 ); + CPPUNIT_ASSERT ( p1.getX() == 25 ); + CPPUNIT_ASSERT ( p1.getY() == 16 ); CPPUNIT_ASSERT ( p2.getX() == 25 ); CPPUNIT_ASSERT ( p2.getY() == 16 ); } @@ -153,9 +153,9 @@ void FPointTest::assignmentTest() // Move assignment operator finalcut::FPoint p3 = std::move(p2); - CPPUNIT_ASSERT ( p2.getX() == 0 ); - CPPUNIT_ASSERT ( p2.getY() == 0 ); - CPPUNIT_ASSERT ( p2.isOrigin() ); + CPPUNIT_ASSERT ( p2.getX() == 40 ); + CPPUNIT_ASSERT ( p2.getY() == 12 ); + CPPUNIT_ASSERT ( ! p2.isOrigin() ); CPPUNIT_ASSERT ( p3.getX() == 40 ); CPPUNIT_ASSERT ( p3.getY() == 12 ); diff --git a/test/frect-test.cpp b/test/frect-test.cpp index 130741fe..71fb5b77 100644 --- a/test/frect-test.cpp +++ b/test/frect-test.cpp @@ -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 * @@ -134,11 +134,11 @@ void FRectTest::moveConstructorTest() { finalcut::FRect r1(3, 3, 15, 7); const finalcut::FRect r2 (std::move(r1)); - CPPUNIT_ASSERT ( r1.getX() == 0 ); - CPPUNIT_ASSERT ( r1.getY() == 0 ); - CPPUNIT_ASSERT ( r1.isEmpty() ); - CPPUNIT_ASSERT ( r1.getWidth() == 0 ); - CPPUNIT_ASSERT ( r1.getHeight() == 0 ); + CPPUNIT_ASSERT ( r1.getX() == 3 ); + CPPUNIT_ASSERT ( r1.getY() == 3 ); + CPPUNIT_ASSERT ( ! r1.isEmpty() ); + CPPUNIT_ASSERT ( r1.getWidth() == 15 ); + CPPUNIT_ASSERT ( r1.getHeight() == 7 ); CPPUNIT_ASSERT ( r2.getX() == 3 ); CPPUNIT_ASSERT ( r2.getY() == 3 ); CPPUNIT_ASSERT ( ! r2.isEmpty() ); @@ -359,15 +359,15 @@ void FRectTest::assignmentTest() finalcut::FRect r6; r6 = std::move(r5); // Move assignment operator - CPPUNIT_ASSERT ( r5.getX1() == 0 ); - CPPUNIT_ASSERT ( r5.getY1() == 0 ); - CPPUNIT_ASSERT ( r5.getX2() == -1 ); - CPPUNIT_ASSERT ( r5.getY2() == -1 ); - CPPUNIT_ASSERT ( r5.isEmpty() ); - CPPUNIT_ASSERT ( r5.getWidth() == 0 ); - CPPUNIT_ASSERT ( r5.getHeight() == 0 ); - CPPUNIT_ASSERT ( r5.getSize() == finalcut::FSize(0, 0) ); - CPPUNIT_ASSERT ( r5.getPos() == finalcut::FPoint(0, 0) ); + CPPUNIT_ASSERT ( r5.getX1() == 2 ); + CPPUNIT_ASSERT ( r5.getY1() == 9 ); + CPPUNIT_ASSERT ( r5.getX2() == 11 ); + CPPUNIT_ASSERT ( r5.getY2() == 18 ); + CPPUNIT_ASSERT ( ! r5.isEmpty() ); + CPPUNIT_ASSERT ( r5.getWidth() == 10 ); + CPPUNIT_ASSERT ( r5.getHeight() == 10 ); + CPPUNIT_ASSERT ( r5.getSize() == finalcut::FSize(10, 10) ); + CPPUNIT_ASSERT ( r5.getPos() == finalcut::FPoint(2, 9) ); CPPUNIT_ASSERT ( r6.getX1() == 2 ); CPPUNIT_ASSERT ( r6.getY1() == 9 ); CPPUNIT_ASSERT ( r6.getX2() == 11 ); diff --git a/test/fsize-test.cpp b/test/fsize-test.cpp index b9516c7b..96295535 100644 --- a/test/fsize-test.cpp +++ b/test/fsize-test.cpp @@ -122,9 +122,9 @@ void FSizeTest::moveConstructorTest() { finalcut::FSize s1 (120, 36); const finalcut::FSize s2 (std::move(s1)); - CPPUNIT_ASSERT ( s1.getWidth() == 0 ); - CPPUNIT_ASSERT ( s1.getHeight() == 0 ); - CPPUNIT_ASSERT ( s1.isEmpty() ); + CPPUNIT_ASSERT ( s1.getWidth() == 120 ); + CPPUNIT_ASSERT ( s1.getHeight() == 36 ); + CPPUNIT_ASSERT ( ! s1.isEmpty() ); CPPUNIT_ASSERT ( s2.getWidth() == 120 ); CPPUNIT_ASSERT ( s2.getHeight() == 36 ); } @@ -161,9 +161,9 @@ void FSizeTest::assignmentTest() // Move assignment operator finalcut::FSize s3; s3 = std::move(s2); - CPPUNIT_ASSERT ( s2.getWidth() == 0 ); - CPPUNIT_ASSERT ( s2.getHeight() == 0 ); - CPPUNIT_ASSERT ( s2.isEmpty() ); + CPPUNIT_ASSERT ( s2.getWidth() == 5 ); + CPPUNIT_ASSERT ( s2.getHeight() == 4 ); + CPPUNIT_ASSERT ( ! s2.isEmpty() ); CPPUNIT_ASSERT ( s3.getWidth() == 5 ); CPPUNIT_ASSERT ( s3.getHeight() == 4 );