Some small code improvements

This commit is contained in:
Markus Gans 2020-02-19 21:59:13 +01:00
parent a33a9e1b6b
commit 164487096c
85 changed files with 642 additions and 620 deletions

View File

@ -1,3 +1,6 @@
2020-02-19 Markus Gans <guru.mail@muenster.de>
* Some small code improvements
2020-02-16 Markus Gans <guru.mail@muenster.de> 2020-02-16 Markus Gans <guru.mail@muenster.de>
* Printing a FStyle object allows you to change video attributes * Printing a FStyle object allows you to change video attributes

View File

@ -113,7 +113,7 @@ class Calc : public finalcut::FDialog
explicit Calc (finalcut::FWidget* parent = nullptr); explicit Calc (finalcut::FWidget* parent = nullptr);
// Destructor // Destructor
~Calc(); ~Calc() override;
// Event handlers // Event handlers
void onKeyPress (finalcut::FKeyEvent*) override; void onKeyPress (finalcut::FKeyEvent*) override;

View File

@ -46,7 +46,7 @@ class CheckList : public finalcut::FDialog
CheckList (const CheckList&) = delete; CheckList (const CheckList&) = delete;
// Destructor // Destructor
~CheckList(); ~CheckList() override;
// Disable assignment operator (=) // Disable assignment operator (=)
CheckList& operator = (const CheckList&) = delete; CheckList& operator = (const CheckList&) = delete;

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2017-2019 Markus Gans * * Copyright 2017-2020 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -86,7 +86,7 @@ class Listbox : public FDialog
Listbox (const Listbox&) = delete; Listbox (const Listbox&) = delete;
// Destructor // Destructor
~Listbox(); ~Listbox() override;
// Disable assignment operator (=) // Disable assignment operator (=)
Listbox& operator = (const Listbox&) = delete; Listbox& operator = (const Listbox&) = delete;

View File

@ -46,7 +46,7 @@ class Listview : public finalcut::FDialog
Listview (const Listview&) = delete; Listview (const Listview&) = delete;
// Destructor // Destructor
~Listview(); ~Listview() override;
// Disable assignment operator (=) // Disable assignment operator (=)
Listview& operator = (const Listview&) = delete; Listview& operator = (const Listview&) = delete;

View File

@ -38,7 +38,7 @@ class Mandelbrot : public finalcut::FDialog
explicit Mandelbrot (finalcut::FWidget* = nullptr); explicit Mandelbrot (finalcut::FWidget* = nullptr);
// Destructor // Destructor
~Mandelbrot(); ~Mandelbrot() override;
// Event handlers // Event handlers
void onKeyPress (finalcut::FKeyEvent*) override; void onKeyPress (finalcut::FKeyEvent*) override;
@ -138,8 +138,15 @@ void Mandelbrot::onClose (finalcut::FCloseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Mandelbrot::adjustSize() void Mandelbrot::adjustSize()
{ {
const std::size_t h = getDesktopHeight() - 1; std::size_t h = getDesktopHeight();
const std::size_t w = getDesktopWidth() - 10; std::size_t w = getDesktopWidth();
if ( h > 1 )
h--;
if ( w > 10 )
w -= 10;
setGeometry(FPoint(6, 1), FSize(w, h), false); setGeometry(FPoint(6, 1), FSize(w, h), false);
finalcut::FDialog::adjustSize(); finalcut::FDialog::adjustSize();
} }

View File

@ -41,7 +41,7 @@ class Menu : public finalcut::FDialog
Menu (const Menu&) = delete; Menu (const Menu&) = delete;
// Destructor // Destructor
~Menu(); ~Menu() override;
// Disable assignment operator (=) // Disable assignment operator (=)
Menu& operator = (const Menu&) = delete; Menu& operator = (const Menu&) = delete;

View File

@ -43,7 +43,7 @@ class ColorChooser : public finalcut::FWidget
ColorChooser (const ColorChooser&) = delete; ColorChooser (const ColorChooser&) = delete;
// Destructor // Destructor
~ColorChooser(); ~ColorChooser() override;
// Disable assignment operator (=) // Disable assignment operator (=)
ColorChooser& operator = (const ColorChooser&) = delete; ColorChooser& operator = (const ColorChooser&) = delete;
@ -182,7 +182,7 @@ class Brushes : public finalcut::FWidget
Brushes (const Brushes&) = delete; Brushes (const Brushes&) = delete;
// Destructor // Destructor
~Brushes(); ~Brushes() override;
// Disable assignment operator (=) // Disable assignment operator (=)
Brushes& operator = (const Brushes&) = delete; Brushes& operator = (const Brushes&) = delete;
@ -321,7 +321,7 @@ class MouseDraw : public finalcut::FDialog
MouseDraw (const MouseDraw&) = delete; MouseDraw (const MouseDraw&) = delete;
// Destructor // Destructor
~MouseDraw(); ~MouseDraw() override;
// Disable assignment operator (=) // Disable assignment operator (=)
MouseDraw& operator = (const MouseDraw&) = delete; MouseDraw& operator = (const MouseDraw&) = delete;

View File

@ -41,7 +41,7 @@ class Scrollview : public finalcut::FScrollView
Scrollview (const Scrollview&) = delete; Scrollview (const Scrollview&) = delete;
// Destructor // Destructor
~Scrollview (); ~Scrollview() override;
// Disable assignment operator (=) // Disable assignment operator (=)
Scrollview& operator = (const Scrollview&) = delete; Scrollview& operator = (const Scrollview&) = delete;
@ -197,7 +197,7 @@ class Scrollviewdemo : public finalcut::FDialog
explicit Scrollviewdemo (finalcut::FWidget* = nullptr); explicit Scrollviewdemo (finalcut::FWidget* = nullptr);
// Destructor // Destructor
~Scrollviewdemo(); ~Scrollviewdemo() override;
// Event handler // Event handler
void onClose (finalcut::FCloseEvent*) override; void onClose (finalcut::FCloseEvent*) override;

View File

@ -44,7 +44,7 @@ class AttribDlg : public finalcut::FDialog
AttribDlg (const AttribDlg&) = delete; AttribDlg (const AttribDlg&) = delete;
// Destructor // Destructor
~AttribDlg(); ~AttribDlg() override;
// Disable assignment operator (=) // Disable assignment operator (=)
AttribDlg& operator = (const AttribDlg&) = delete; AttribDlg& operator = (const AttribDlg&) = delete;
@ -200,7 +200,7 @@ class AttribDemo : public finalcut::FWidget
explicit AttribDemo (FWidget* = nullptr); explicit AttribDemo (FWidget* = nullptr);
// Destructor // Destructor
~AttribDemo() ~AttribDemo() override
{ } { }
// Event handler // Event handler

View File

@ -168,7 +168,7 @@ void tcapString (const std::string& name, const char cap_str[])
std::string sequence{}; std::string sequence{};
std::cout << name << ": "; std::cout << name << ": ";
if ( cap_str == 0 ) if ( cap_str == nullptr )
{ {
std::cout << "\r\n"; std::cout << "\r\n";
return; return;

View File

@ -52,7 +52,7 @@ class Transparent : public finalcut::FDialog
Transparent (const Transparent&) = delete; Transparent (const Transparent&) = delete;
// Destructor // Destructor
~Transparent(); ~Transparent() override;
// Disable assignment operator (=) // Disable assignment operator (=)
Transparent& operator = (const Transparent&) = delete; Transparent& operator = (const Transparent&) = delete;
@ -149,7 +149,7 @@ class MainWindow : public finalcut::FDialog
MainWindow (const MainWindow&) = delete; MainWindow (const MainWindow&) = delete;
// Destructor // Destructor
~MainWindow(); ~MainWindow() override;
// Disable assignment operator (=) // Disable assignment operator (=)
MainWindow& operator = (const MainWindow&) = delete; MainWindow& operator = (const MainWindow&) = delete;

View File

@ -122,7 +122,7 @@ class Treeview : public finalcut::FDialog
Treeview (const Treeview&) = delete; Treeview (const Treeview&) = delete;
// Destructor // Destructor
~Treeview(); ~Treeview() override;
// Disable assignment operator (=) // Disable assignment operator (=)
Treeview& operator = (const Treeview&) = delete; Treeview& operator = (const Treeview&) = delete;
@ -174,124 +174,124 @@ struct Treeview::TreeItem
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Treeview::TreeItem Treeview::africa[] = Treeview::TreeItem Treeview::africa[] =
{ {
{ "Algeria", "40,400,000", "15.9", 0 }, { "Algeria", "40,400,000", "15.9", nullptr },
{ "Angola", "25,789,024", "20.69", 0 }, { "Angola", "25,789,024", "20.69", nullptr },
{ "Botswana", "2,250,260", "3.7", 0 }, { "Botswana", "2,250,260", "3.7", nullptr },
{ "Cameroon", "22,534,532", "39.7", 0 }, { "Cameroon", "22,534,532", "39.7", nullptr },
{ "Chad", "13,670,084", "8.6", 0 }, { "Chad", "13,670,084", "8.6", nullptr },
{ "Egypt", "94,666,000", "87", 0 }, { "Egypt", "94,666,000", "87", nullptr },
{ "Ethiopia", "102,374,044", "92.7", 0 }, { "Ethiopia", "102,374,044", "92.7", nullptr },
{ "Ivory Coast", "23,740,424", "63.9", 0 }, { "Ivory Coast", "23,740,424", "63.9", nullptr },
{ "Libya", "6,541,948", "3.55", 0 }, { "Libya", "6,541,948", "3.55", nullptr },
{ "Madagascar", "24,430,325", "35.2", 0 }, { "Madagascar", "24,430,325", "35.2", nullptr },
{ "Mali", "14,517,176", "11.7", 0 }, { "Mali", "14,517,176", "11.7", nullptr },
{ "Mauritania", "4,301,018", "3.4", 0 }, { "Mauritania", "4,301,018", "3.4", nullptr },
{ "Mozambique", "24,692,144", "28.7", 0 }, { "Mozambique", "24,692,144", "28.7", nullptr },
{ "Namibia", "2,113,077", "2.54", 0 }, { "Namibia", "2,113,077", "2.54", nullptr },
{ "Niger", "20,672,987", "12.1", 0 }, { "Niger", "20,672,987", "12.1", nullptr },
{ "Nigeria", "185,989,640", "197.2", 0 }, { "Nigeria", "185,989,640", "197.2", nullptr },
{ "Somalia", "14,317,996", "19.31", 0 }, { "Somalia", "14,317,996", "19.31", nullptr },
{ "South Africa", "54,956,900", "42.4", 0 }, { "South Africa", "54,956,900", "42.4", nullptr },
{ "South Sudan", "12,340,000", "13.33", 0 }, { "South Sudan", "12,340,000", "13.33", nullptr },
{ "Sudan", "39,578,828", "21.3", 0 }, { "Sudan", "39,578,828", "21.3", nullptr },
{ "Tanzania", "51,820,00", "47.5", 0 }, { "Tanzania", "51,820,00", "47.5", nullptr },
{ "Zambia", "16,212,000", "17.2", 0 }, { "Zambia", "16,212,000", "17.2", nullptr },
{ 0, 0, 0, 0 } { nullptr, nullptr, nullptr, nullptr }
}; };
Treeview::TreeItem Treeview::asia[] = Treeview::TreeItem Treeview::asia[] =
{ {
{ "Afghanistan", "34,656,032", "49.88", 0 }, { "Afghanistan", "34,656,032", "49.88", nullptr },
{ "China", "1,403,500,365", "145.0", 0 }, { "China", "1,403,500,365", "145.0", nullptr },
{ "India", "1,324,171,354", "393.9", 0 }, { "India", "1,324,171,354", "393.9", nullptr },
{ "Indonesia", "261,115,456", "124.66", 0 }, { "Indonesia", "261,115,456", "124.66", nullptr },
{ "Iran", "80,829,192", "48.0", 0 }, { "Iran", "80,829,192", "48.0", nullptr },
{ "Iraq", "37,202,572", "82.7", 0 }, { "Iraq", "37,202,572", "82.7", nullptr },
{ "Japan", "126,740,000", "336.0", 0 }, { "Japan", "126,740,000", "336.0", nullptr },
{ "Kazakhstan", "17,987,736", "6.49", 0 }, { "Kazakhstan", "17,987,736", "6.49", nullptr },
{ "Mongolia", "3,081,677", "1.97", 0 }, { "Mongolia", "3,081,677", "1.97", nullptr },
{ "Myanmar", "51,486,253", "76.0", 0 }, { "Myanmar", "51,486,253", "76.0", nullptr },
{ "Pakistan", "207,774,520", "244.4", 0 }, { "Pakistan", "207,774,520", "244.4", nullptr },
{ "Russia", "144,463,451", "8.4", 0 }, { "Russia", "144,463,451", "8.4", nullptr },
{ "Saudi Arabia", "33,000,000", "15.0", 0 }, { "Saudi Arabia", "33,000,000", "15.0", nullptr },
{ "Thailand", "68,863,514", "132.1", 0 }, { "Thailand", "68,863,514", "132.1", nullptr },
{ "Turkey", "79,814,871", "102.0", 0 }, { "Turkey", "79,814,871", "102.0", nullptr },
{ "Turkmenistan", "5,662,544", "10.5", 0 }, { "Turkmenistan", "5,662,544", "10.5", nullptr },
{ "Uzbekistan", "32,979,000", "70.5", 0 }, { "Uzbekistan", "32,979,000", "70.5", nullptr },
{ "Vietnam", "94,569,072", "276.03", 0 }, { "Vietnam", "94,569,072", "276.03", nullptr },
{ "Yemen", "27,584,213", "44.7", 0 }, { "Yemen", "27,584,213", "44.7", nullptr },
{ 0, 0, 0, 0 } { nullptr, nullptr, nullptr, nullptr }
}; };
Treeview::TreeItem Treeview::europe[] = Treeview::TreeItem Treeview::europe[] =
{ {
{ "Austria", "8,794,267", "104.0", 0 }, { "Austria", "8,794,267", "104.0", nullptr },
{ "Belarus", "9,498,700", "45.8", 0 }, { "Belarus", "9,498,700", "45.8", nullptr },
{ "Bulgaria", "7,101,859", "64.9", 0 }, { "Bulgaria", "7,101,859", "64.9", nullptr },
{ "Czech Republic", "10,610,947", "134.0", 0 }, { "Czech Republic", "10,610,947", "134.0", nullptr },
{ "Finland", "5,506,312", "16.0", 0 }, { "Finland", "5,506,312", "16.0", nullptr },
{ "France", "66,991,000", "103.0", 0 }, { "France", "66,991,000", "103.0", nullptr },
{ "Germany", "82,175,700", "227.0", 0 }, { "Germany", "82,175,700", "227.0", nullptr },
{ "Greece", "11,183,716", "82.0", 0 }, { "Greece", "11,183,716", "82.0", nullptr },
{ "Hungary", "9,797,561", "105.3", 0 }, { "Hungary", "9,797,561", "105.3", nullptr },
{ "Iceland", "332,529", "3.2", 0 }, { "Iceland", "332,529", "3.2", nullptr },
{ "Italy", "60,589,445", "201.3", 0 }, { "Italy", "60,589,445", "201.3", nullptr },
{ "Norway", "5,267,146", "15.8", 0 }, { "Norway", "5,267,146", "15.8", nullptr },
{ "Poland", "38,634,007", "123.0", 0 }, { "Poland", "38,634,007", "123.0", nullptr },
{ "Portugal", "10,309,573", "115.0", 0 }, { "Portugal", "10,309,573", "115.0", nullptr },
{ "Romania", "19,638,000", "84.4", 0 }, { "Romania", "19,638,000", "84.4", nullptr },
{ "Serbia", "7,058,322", "91.1", 0 }, { "Serbia", "7,058,322", "91.1", nullptr },
{ "Spain", "46,468,102", "92.0", 0 }, { "Spain", "46,468,102", "92.0", nullptr },
{ "Sweden", "10,065,389", "22.0", 0 }, { "Sweden", "10,065,389", "22.0", nullptr },
{ "United Kingdom", "65,648,000", "270.7", 0 }, { "United Kingdom", "65,648,000", "270.7", nullptr },
{ 0, 0, 0, 0 } { nullptr, nullptr, nullptr, nullptr }
}; };
Treeview::TreeItem Treeview::north_america[] = Treeview::TreeItem Treeview::north_america[] =
{ {
{ "Canada", "35,151,728", "3.92", 0 }, { "Canada", "35,151,728", "3.92", nullptr },
{ "Cuba", "11,239,224", "102.3", 0 }, { "Cuba", "11,239,224", "102.3", nullptr },
{ "Greenland", "56,483", "0.028", 0 }, { "Greenland", "56,483", "0.028", nullptr },
{ "Guatemala", "16,582,469", "129.0", 0 }, { "Guatemala", "16,582,469", "129.0", nullptr },
{ "Honduras", "9,112,867", "64.0", 0 }, { "Honduras", "9,112,867", "64.0", nullptr },
{ "Mexico", "119,530,753", "61.0", 0 }, { "Mexico", "119,530,753", "61.0", nullptr },
{ "Nicaragua", "6,167,237", "51.0", 0 }, { "Nicaragua", "6,167,237", "51.0", nullptr },
{ "USA", "325,365,189", "35.0", 0 }, { "USA", "325,365,189", "35.0", nullptr },
{ 0, 0, 0, 0 } { nullptr, nullptr, nullptr, nullptr }
}; };
Treeview::TreeItem Treeview::south_america[] = Treeview::TreeItem Treeview::south_america[] =
{ {
{ "Argentina", "43,847,430", "14.4", 0 }, { "Argentina", "43,847,430", "14.4", nullptr },
{ "Bolivia", "11,410,651", "10.4", 0 }, { "Bolivia", "11,410,651", "10.4", nullptr },
{ "Brazil", "208,064,000", "24.35", 0 }, { "Brazil", "208,064,000", "24.35", nullptr },
{ "Chile", "18,006,407", "24.0", 0 }, { "Chile", "18,006,407", "24.0", nullptr },
{ "Colombia", "49,364,592", "40.74", 0 }, { "Colombia", "49,364,592", "40.74", nullptr },
{ "Ecuador", "16,385,068", "58.95", 0 }, { "Ecuador", "16,385,068", "58.95", nullptr },
{ "Guyana", "773,303", "3.502", 0 }, { "Guyana", "773,303", "3.502", nullptr },
{ "Paraguay", "6,725,308", "17.2", 0 }, { "Paraguay", "6,725,308", "17.2", nullptr },
{ "Peru", "31,826,018", "23.0", 0 }, { "Peru", "31,826,018", "23.0", nullptr },
{ "Venezuela", "31,568,179", "33.75", 0 }, { "Venezuela", "31,568,179", "33.75", nullptr },
{ 0, 0, 0, 0 } { nullptr, nullptr, nullptr, nullptr }
}; };
Treeview::TreeItem Treeview::oceania[] = Treeview::TreeItem Treeview::oceania[] =
{ {
{ "Australia", "24,675,900", "3.2", 0 }, { "Australia", "24,675,900", "3.2", nullptr },
{ "Papua New Guinea", "7,059,653", "15.0", 0 }, { "Papua New Guinea", "7,059,653", "15.0", nullptr },
{ "Papua", "3,486,432", "11.0", 0 }, { "Papua", "3,486,432", "11.0", nullptr },
{ "New Zealand", "4,823,090", "17.5", 0 }, { "New Zealand", "4,823,090", "17.5", nullptr },
{ "West Papua", "877,437", "6.3", 0 }, { "West Papua", "877,437", "6.3", nullptr },
{ "Solomon Islands", "599,419", "18.1", 0 }, { "Solomon Islands", "599,419", "18.1", nullptr },
{ "New Caledonia", "268,767", "14.5", 0 }, { "New Caledonia", "268,767", "14.5", nullptr },
{ "Fiji", "898,76", "46.4", 0 }, { "Fiji", "898,76", "46.4", nullptr },
{ "Hawaii", "1,428,557", "82.6", 0 }, { "Hawaii", "1,428,557", "82.6", nullptr },
{ "Vanuatu", "270,402", "19.7", 0 }, { "Vanuatu", "270,402", "19.7", nullptr },
{ "French Polynesia", "280,208", "76.0", 0 }, { "French Polynesia", "280,208", "76.0", nullptr },
{ "Samoa", "192,342", "68.0", 0 }, { "Samoa", "192,342", "68.0", nullptr },
{ "Kiribati", "110,136", "152.0", 0 }, { "Kiribati", "110,136", "152.0", nullptr },
{ 0, 0, 0, 0 } { nullptr, nullptr, nullptr, nullptr }
}; };
// constructors and destructor // constructors and destructor
@ -329,7 +329,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
{ "Europe", "733,000,000", "69.9", europe }, { "Europe", "733,000,000", "69.9", europe },
{ "North America", "523,000,000", "21", north_america }, { "North America", "523,000,000", "21", north_america },
{ "South America", "381,000,000", "21.4", south_america }, { "South America", "381,000,000", "21.4", south_america },
{ "Antarctica", "1000", "0", 0 }, { "Antarctica", "1000", "0", nullptr },
{ "Australia/Oceania", "34,000,000", "4", oceania } { "Australia/Oceania", "34,000,000", "4", oceania }
}; };

View File

@ -48,7 +48,7 @@ class ProgressDialog : public finalcut::FDialog
ProgressDialog (const ProgressDialog&) = delete; ProgressDialog (const ProgressDialog&) = delete;
// Destructor // Destructor
~ProgressDialog(); ~ProgressDialog() override;
// Disable assignment operator (=) // Disable assignment operator (=)
ProgressDialog& operator = (const ProgressDialog&) = delete; ProgressDialog& operator = (const ProgressDialog&) = delete;
@ -191,7 +191,7 @@ class TextWindow : public finalcut::FDialog
TextWindow (const TextWindow&) = delete; TextWindow (const TextWindow&) = delete;
// Destructor // Destructor
~TextWindow(); ~TextWindow() override;
// Disable assignment operator (=) // Disable assignment operator (=)
TextWindow& operator = (const TextWindow&) = delete; TextWindow& operator = (const TextWindow&) = delete;
@ -257,7 +257,7 @@ class MyDialog : public finalcut::FDialog
MyDialog (const MyDialog&) = delete; MyDialog (const MyDialog&) = delete;
// Destructor // Destructor
~MyDialog(); ~MyDialog() override;
// Disable assignment operator (=) // Disable assignment operator (=)
MyDialog& operator = (const MyDialog&) = delete; MyDialog& operator = (const MyDialog&) = delete;

View File

@ -41,7 +41,7 @@ class Watch : public finalcut::FDialog
Watch (const Watch&) = delete; Watch (const Watch&) = delete;
// Destructor // Destructor
~Watch(); ~Watch() override;
// Disable assignment operator (=) // Disable assignment operator (=)
Watch& operator = (const Watch&) = delete; Watch& operator = (const Watch&) = delete;
@ -126,7 +126,7 @@ void Watch::printTime()
finalcut::FString str{}; finalcut::FString str{};
std::tm now{}; std::tm now{};
const std::time_t t = std::time(0); // get current time const std::time_t t = std::time(nullptr); // get current time
localtime_r(&t, &now); localtime_r(&t, &now);
if ( sec ) if ( sec )

View File

@ -42,7 +42,7 @@ class SmallWindow : public finalcut::FDialog
SmallWindow (const SmallWindow&) = delete; SmallWindow (const SmallWindow&) = delete;
// Destructor // Destructor
~SmallWindow(); ~SmallWindow() override;
// Disable assignment operator (=) // Disable assignment operator (=)
SmallWindow& operator = (const SmallWindow&) = delete; SmallWindow& operator = (const SmallWindow&) = delete;
@ -173,7 +173,7 @@ class Window : public finalcut::FDialog
Window (const Window&) = delete; Window (const Window&) = delete;
// Destructor // Destructor
~Window(); ~Window() override;
// Disable assignment operator (=) // Disable assignment operator (=)
Window& operator = (const Window&) = delete; Window& operator = (const Window&) = delete;

View File

@ -298,7 +298,7 @@ FWidget* FApplication::processParameters (const int& argc, char* argv[])
getStartOptions().setDefault(); getStartOptions().setDefault();
cmd_options (argc, argv); cmd_options (argc, argv);
return 0; return nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -414,20 +414,20 @@ void FApplication::cmd_options (const int& argc, char* argv[])
{ {
static struct option long_options[] = static struct option long_options[] =
{ {
{C_STR("encoding"), required_argument, 0, 0 }, {C_STR("encoding"), required_argument, nullptr, 0 },
{C_STR("no-mouse"), no_argument, 0, 0 }, {C_STR("no-mouse"), no_argument, nullptr, 0 },
{C_STR("no-optimized-cursor"), no_argument, 0, 0 }, {C_STR("no-optimized-cursor"), no_argument, nullptr, 0 },
{C_STR("no-terminal-detection"), no_argument, 0, 0 }, {C_STR("no-terminal-detection"), no_argument, nullptr, 0 },
{C_STR("no-color-change"), no_argument, 0, 0 }, {C_STR("no-color-change"), no_argument, nullptr, 0 },
{C_STR("no-sgr-optimizer"), no_argument, 0, 0 }, {C_STR("no-sgr-optimizer"), no_argument, nullptr, 0 },
{C_STR("vgafont"), no_argument, 0, 0 }, {C_STR("vgafont"), no_argument, nullptr, 0 },
{C_STR("newfont"), no_argument, 0, 0 }, {C_STR("newfont"), no_argument, nullptr, 0 },
#if defined(__FreeBSD__) || defined(__DragonFly__) #if defined(__FreeBSD__) || defined(__DragonFly__)
{C_STR("no-esc-for-alt-meta"), no_argument, 0, 0 }, {C_STR("no-esc-for-alt-meta"), no_argument, nullptr, 0 },
{C_STR("no-cursorstyle-change"), no_argument, 0, 0 }, {C_STR("no-cursorstyle-change"), no_argument, nullptr, 0 },
#elif defined(__NetBSD__) || defined(__OpenBSD__) #elif defined(__NetBSD__) || defined(__OpenBSD__)
{C_STR("no-esc-for-alt-meta"), no_argument, 0, 0 }, {C_STR("no-esc-for-alt-meta"), no_argument, nullptr, 0 },
#endif #endif
{nullptr, 0, nullptr, 0 } {nullptr, 0, nullptr, 0 }
@ -719,7 +719,7 @@ bool FApplication::processDialogSwitchAccelerator()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FApplication::processAccelerator (const FWidget*& widget) bool FApplication::processAccelerator (const FWidget* const& widget)
{ {
bool accpt{false}; bool accpt{false};
@ -750,7 +750,7 @@ bool FApplication::processAccelerator (const FWidget*& widget)
sendEvent (iter->object, &a_ev); sendEvent (iter->object, &a_ev);
accpt = a_ev.isAccepted(); accpt = a_ev.isAccepted();
break; break;
}; }
++iter; ++iter;
} }
@ -800,7 +800,7 @@ FWidget*& FApplication::determineClickedWidget()
{ {
// Determine the widget at the current click position // Determine the widget at the current click position
auto child = window->childWidgetAt (mouse_position); auto child = window->childWidgetAt (mouse_position);
clicked = ( child != 0 ) ? child : window; clicked = ( child != nullptr ) ? child : window;
setClickedWidget (clicked); setClickedWidget (clicked);
} }

View File

@ -75,10 +75,10 @@ FButtonGroup::~FButtonGroup() // destructor
FToggleButton* FButtonGroup::getButton (int index) const FToggleButton* FButtonGroup::getButton (int index) const
{ {
if ( buttonlist.empty() ) if ( buttonlist.empty() )
return 0; return nullptr;
if ( index <= 0 || index > int(getCount()) ) if ( index <= 0 || index > int(getCount()) )
return 0; return nullptr;
auto iter = buttonlist.begin(); auto iter = buttonlist.begin();
std::advance (iter, index - 1); std::advance (iter, index - 1);

View File

@ -595,7 +595,7 @@ void FComboBox::onePosDown()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FComboBox::passEventToListWindow (FMouseEvent*& ev) void FComboBox::passEventToListWindow (FMouseEvent* const& ev)
{ {
// Mouse event handover to list window // Mouse event handover to list window

View File

@ -204,7 +204,7 @@ void FFileDialog::setPath (const FString& dir)
return; return;
} }
if ( fsystem->realpath(dir.c_str(), resolved_path) != 0 ) if ( fsystem->realpath(dir.c_str(), resolved_path) != nullptr )
r_dir.setString(resolved_path); r_dir.setString(resolved_path);
else else
r_dir.setString(dir); r_dir.setString(dir);
@ -460,7 +460,7 @@ sInt64 FFileDialog::numOfDirs()
const sInt64 n = std::count_if ( std::begin(dir_entries) const sInt64 n = std::count_if ( std::begin(dir_entries)
, std::end(dir_entries) , std::end(dir_entries)
, [] (dir_entry& entry) , [] (const dir_entry& entry)
{ {
return entry.directory return entry.directory
&& std::strcmp(entry.name, ".") != 0; && std::strcmp(entry.name, ".") != 0;
@ -614,7 +614,7 @@ void FFileDialog::followSymLink (const char* const dir, dir_entry& entry)
, sizeof(symLink) - std::strlen(symLink) - 1); , sizeof(symLink) - std::strlen(symLink) - 1);
symLink[sizeof(symLink) - 1] = '\0'; symLink[sizeof(symLink) - 1] = '\0';
if ( fsystem->realpath(symLink, resolved_path) == 0 ) if ( fsystem->realpath(symLink, resolved_path) == nullptr )
return; // Cannot follow the symlink return; // Cannot follow the symlink
if ( lstat(resolved_path, &sb) == -1 ) if ( lstat(resolved_path, &sb) == -1 )
@ -789,7 +789,7 @@ void FFileDialog::cb_processActivate (FWidget*, FDataPtr)
{ {
found = std::any_of ( std::begin(dir_entries) found = std::any_of ( std::begin(dir_entries)
, std::end(dir_entries) , std::end(dir_entries)
, [&input] (dir_entry& entry) , [&input] (const dir_entry& entry)
{ {
return entry.name return entry.name
&& input && input

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2018-2019 Markus Gans * * Copyright 2018-2020 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -32,177 +32,177 @@ namespace fc
FKeyMap fkey[] = FKeyMap fkey[] =
{ {
{ fc::Fkey_backspace , 0, "kb" }, // backspace key { fc::Fkey_backspace , nullptr, "kb" }, // backspace key
{ fc::Fkey_catab , 0, "ka" }, // clear-all-tabs key { fc::Fkey_catab , nullptr, "ka" }, // clear-all-tabs key
{ fc::Fkey_clear , 0, "kC" }, // clear-screen or erase key { fc::Fkey_clear , nullptr, "kC" }, // clear-screen or erase key
{ fc::Fkey_ctab , 0, "kt" }, // clear-tab key { fc::Fkey_ctab , nullptr, "kt" }, // clear-tab key
{ fc::Fkey_dc , 0, "kD" }, // delete-character key { fc::Fkey_dc , nullptr, "kD" }, // delete-character key
{ fc::Fkey_dc , 0, "kDx"}, // keypad delete { fc::Fkey_dc , nullptr, "kDx"}, // keypad delete
{ fc::Fkey_dl , 0, "kL" }, // delete-line key { fc::Fkey_dl , nullptr, "kL" }, // delete-line key
{ fc::Fkey_down , 0, "kd" }, // down-arrow key { fc::Fkey_down , nullptr, "kd" }, // down-arrow key
{ fc::Fkey_down , 0, "kdx"}, // down-arrow key { fc::Fkey_down , nullptr, "kdx"}, // down-arrow key
{ fc::Fkey_eic , 0, "kM" }, // sent by rmir or smir in insert mode { fc::Fkey_eic , nullptr, "kM" }, // sent by rmir or smir in insert mode
{ fc::Fkey_eol , 0, "kE" }, // clear-to-end-of-line key { fc::Fkey_eol , nullptr, "kE" }, // clear-to-end-of-line key
{ fc::Fkey_eos , 0, "kS" }, // clear-to-end-of-screen key { fc::Fkey_eos , nullptr, "kS" }, // clear-to-end-of-screen key
{ fc::Fkey_f0 , 0, "k0" }, // F0 function key { fc::Fkey_f0 , nullptr, "k0" }, // F0 function key
{ fc::Fkey_f1 , 0, "k1" }, // F1 function key { fc::Fkey_f1 , nullptr, "k1" }, // F1 function key
{ fc::Fkey_f1 , 0, "k1x"}, // F1 function key { fc::Fkey_f1 , nullptr, "k1x"}, // F1 function key
{ fc::Fkey_f1 , 0, "k1X"}, // F1 function key { fc::Fkey_f1 , nullptr, "k1X"}, // F1 function key
{ fc::Fkey_f2 , 0, "k2" }, // F2 function key { fc::Fkey_f2 , nullptr, "k2" }, // F2 function key
{ fc::Fkey_f2 , 0, "k2x"}, // F2 function key { fc::Fkey_f2 , nullptr, "k2x"}, // F2 function key
{ fc::Fkey_f2 , 0, "k2X"}, // F2 function key { fc::Fkey_f2 , nullptr, "k2X"}, // F2 function key
{ fc::Fkey_f3 , 0, "k3" }, // F3 function key { fc::Fkey_f3 , nullptr, "k3" }, // F3 function key
{ fc::Fkey_f3 , 0, "k3x"}, // F3 function key { fc::Fkey_f3 , nullptr, "k3x"}, // F3 function key
{ fc::Fkey_f3 , 0, "k3X"}, // F3 function key { fc::Fkey_f3 , nullptr, "k3X"}, // F3 function key
{ fc::Fkey_f4 , 0, "k4" }, // F4 function key { fc::Fkey_f4 , nullptr, "k4" }, // F4 function key
{ fc::Fkey_f4 , 0, "k4x"}, // F4 function key { fc::Fkey_f4 , nullptr, "k4x"}, // F4 function key
{ fc::Fkey_f4 , 0, "k4X"}, // F4 function key { fc::Fkey_f4 , nullptr, "k4X"}, // F4 function key
{ fc::Fkey_f5 , 0, "k5" }, // F5 function key { fc::Fkey_f5 , nullptr, "k5" }, // F5 function key
{ fc::Fkey_f6 , 0, "k6" }, // F6 function key { fc::Fkey_f6 , nullptr, "k6" }, // F6 function key
{ fc::Fkey_f7 , 0, "k7" }, // F7 function key { fc::Fkey_f7 , nullptr, "k7" }, // F7 function key
{ fc::Fkey_f8 , 0, "k8" }, // F8 fucntion key { fc::Fkey_f8 , nullptr, "k8" }, // F8 fucntion key
{ fc::Fkey_f9 , 0, "k9" }, // F9 function key { fc::Fkey_f9 , nullptr, "k9" }, // F9 function key
{ fc::Fkey_f10 , 0, "k;" }, // F10 function key { fc::Fkey_f10 , nullptr, "k;" }, // F10 function key
{ fc::Fkey_home , 0, "kh" }, // home key { fc::Fkey_home , nullptr, "kh" }, // home key
{ fc::Fkey_home , 0, "khx"}, // home key { fc::Fkey_home , nullptr, "khx"}, // home key
{ fc::Fkey_ic , 0, "kI" }, // insert-character key { fc::Fkey_ic , nullptr, "kI" }, // insert-character key
{ fc::Fkey_il , 0, "kA" }, // insert-line key { fc::Fkey_il , nullptr, "kA" }, // insert-line key
{ fc::Fkey_left , 0, "kl" }, // left-arrow key { fc::Fkey_left , nullptr, "kl" }, // left-arrow key
{ fc::Fkey_left , 0, "klx"}, // left-arrow key { fc::Fkey_left , nullptr, "klx"}, // left-arrow key
{ fc::Fkey_ll , 0, "kH" }, // last-line key { fc::Fkey_ll , nullptr, "kH" }, // last-line key
{ fc::Fkey_npage , 0, "kN" }, // next-page key { fc::Fkey_npage , nullptr, "kN" }, // next-page key
{ fc::Fkey_ppage , 0, "kP" }, // prev-page key { fc::Fkey_ppage , nullptr, "kP" }, // prev-page key
{ fc::Fkey_right , 0, "kr" }, // right-arrow key { fc::Fkey_right , nullptr, "kr" }, // right-arrow key
{ fc::Fkey_right , 0, "krx"}, // right-arrow key { fc::Fkey_right , nullptr, "krx"}, // right-arrow key
{ fc::Fkey_sf , 0, "kF" }, // scroll-forward key (shift-up) { fc::Fkey_sf , nullptr, "kF" }, // scroll-forward key (shift-up)
{ fc::Fkey_sr , 0, "kR" }, // scroll-backward key (shift-down) { fc::Fkey_sr , nullptr, "kR" }, // scroll-backward key (shift-down)
{ fc::Fkey_stab , 0, "kT" }, // set-tab key { fc::Fkey_stab , nullptr, "kT" }, // set-tab key
{ fc::Fkey_up , 0, "ku" }, // up-arrow key { fc::Fkey_up , nullptr, "ku" }, // up-arrow key
{ fc::Fkey_up , 0, "kux"}, // up-arrow key { fc::Fkey_up , nullptr, "kux"}, // up-arrow key
{ fc::Fkey_a1 , 0, "K1" }, // upper left of keypad { fc::Fkey_a1 , nullptr, "K1" }, // upper left of keypad
{ fc::Fkey_a3 , 0, "K3" }, // upper right of keypad { fc::Fkey_a3 , nullptr, "K3" }, // upper right of keypad
{ fc::Fkey_b2 , 0, "K2" }, // center of keypad { fc::Fkey_b2 , nullptr, "K2" }, // center of keypad
{ fc::Fkey_c1 , 0, "K4" }, // lower left of keypad { fc::Fkey_c1 , nullptr, "K4" }, // lower left of keypad
{ fc::Fkey_c3 , 0, "K5" }, // lower right of keypad { fc::Fkey_c3 , nullptr, "K5" }, // lower right of keypad
{ fc::Fkey_btab , 0, "kB" }, // back-tab key { fc::Fkey_btab , nullptr, "kB" }, // back-tab key
{ fc::Fkey_beg , 0, "@1" }, // begin key { fc::Fkey_beg , nullptr, "@1" }, // begin key
{ fc::Fkey_cancel , 0, "@2" }, // cancel key { fc::Fkey_cancel , nullptr, "@2" }, // cancel key
{ fc::Fkey_close , 0, "@3" }, // close key { fc::Fkey_close , nullptr, "@3" }, // close key
{ fc::Fkey_command , 0, "@4" }, // command key { fc::Fkey_command , nullptr, "@4" }, // command key
{ fc::Fkey_copy , 0, "@5" }, // copy key { fc::Fkey_copy , nullptr, "@5" }, // copy key
{ fc::Fkey_create , 0, "@6" }, // create key { fc::Fkey_create , nullptr, "@6" }, // create key
{ fc::Fkey_end , 0, "@7" }, // end key { fc::Fkey_end , nullptr, "@7" }, // end key
{ fc::Fkey_end , 0, "@7x"}, // end key { fc::Fkey_end , nullptr, "@7x"}, // end key
{ fc::Fkey_end , 0, "@7X"}, // end key { fc::Fkey_end , nullptr, "@7X"}, // end key
{ fc::Fkey_enter , 0, "@8" }, // enter/send key { fc::Fkey_enter , nullptr, "@8" }, // enter/send key
{ fc::Fkey_enter , 0, "@8x"}, // enter/send key { fc::Fkey_enter , nullptr, "@8x"}, // enter/send key
{ fc::Fkey_exit , 0, "@9" }, // exit key { fc::Fkey_exit , nullptr, "@9" }, // exit key
{ fc::Fkey_find , 0, "@0" }, // find key { fc::Fkey_find , nullptr, "@0" }, // find key
{ fc::Fkey_slash , 0, "KP1"}, // keypad slash { fc::Fkey_slash , nullptr, "KP1"}, // keypad slash
{ fc::Fkey_asterisk , 0, "KP2"}, // keypad asterisk { fc::Fkey_asterisk , nullptr, "KP2"}, // keypad asterisk
{ fc::Fkey_minus_sign, 0, "KP3"}, // keypad minus sign { fc::Fkey_minus_sign, nullptr, "KP3"}, // keypad minus sign
{ fc::Fkey_plus_sign , 0, "KP4"}, // keypad plus sign { fc::Fkey_plus_sign , nullptr, "KP4"}, // keypad plus sign
{ fc::Fkey_help , 0, "%1" }, // help key { fc::Fkey_help , nullptr, "%1" }, // help key
{ fc::Fkey_mark , 0, "%2" }, // mark key { fc::Fkey_mark , nullptr, "%2" }, // mark key
{ fc::Fkey_message , 0, "%3" }, // message key { fc::Fkey_message , nullptr, "%3" }, // message key
{ fc::Fkey_move , 0, "%4" }, // move key { fc::Fkey_move , nullptr, "%4" }, // move key
{ fc::Fkey_next , 0, "%5" }, // next key { fc::Fkey_next , nullptr, "%5" }, // next key
{ fc::Fkey_open , 0, "%6" }, // open key { fc::Fkey_open , nullptr, "%6" }, // open key
{ fc::Fkey_options , 0, "%7" }, // options key { fc::Fkey_options , nullptr, "%7" }, // options key
{ fc::Fkey_previous , 0, "%8" }, // previous key { fc::Fkey_previous , nullptr, "%8" }, // previous key
{ fc::Fkey_print , 0, "%9" }, // print key { fc::Fkey_print , nullptr, "%9" }, // print key
{ fc::Fkey_redo , 0, "%0" }, // redo key { fc::Fkey_redo , nullptr, "%0" }, // redo key
{ fc::Fkey_reference , 0, "&1" }, // reference key { fc::Fkey_reference , nullptr, "&1" }, // reference key
{ fc::Fkey_refresh , 0, "&2" }, // refresh key { fc::Fkey_refresh , nullptr, "&2" }, // refresh key
{ fc::Fkey_replace , 0, "&3" }, // replace key { fc::Fkey_replace , nullptr, "&3" }, // replace key
{ fc::Fkey_restart , 0, "&4" }, // restart key { fc::Fkey_restart , nullptr, "&4" }, // restart key
{ fc::Fkey_resume , 0, "&5" }, // resume key { fc::Fkey_resume , nullptr, "&5" }, // resume key
{ fc::Fkey_save , 0, "&6" }, // save key { fc::Fkey_save , nullptr, "&6" }, // save key
{ fc::Fkey_suspend , 0, "&7" }, // suspend key { fc::Fkey_suspend , nullptr, "&7" }, // suspend key
{ fc::Fkey_undo , 0, "&8" }, // undo key { fc::Fkey_undo , nullptr, "&8" }, // undo key
{ fc::Fkey_sbeg , 0, "&9" }, // shifted begin key { fc::Fkey_sbeg , nullptr, "&9" }, // shifted begin key
{ fc::Fkey_scancel , 0, "&0" }, // shifted cancel key { fc::Fkey_scancel , nullptr, "&0" }, // shifted cancel key
{ fc::Fkey_scommand , 0, "*1" }, // shifted command key { fc::Fkey_scommand , nullptr, "*1" }, // shifted command key
{ fc::Fkey_scopy , 0, "*2" }, // shifted copy key { fc::Fkey_scopy , nullptr, "*2" }, // shifted copy key
{ fc::Fkey_screate , 0, "*3" }, // shifted create key { fc::Fkey_screate , nullptr, "*3" }, // shifted create key
{ fc::Fkey_sdc , 0, "*4" }, // shifted delete-character key { fc::Fkey_sdc , nullptr, "*4" }, // shifted delete-character key
{ fc::Fkey_sdl , 0, "*5" }, // shifted delete-line key { fc::Fkey_sdl , nullptr, "*5" }, // shifted delete-line key
{ fc::Fkey_select , 0, "*6" }, // select key { fc::Fkey_select , nullptr, "*6" }, // select key
{ fc::Fkey_send , 0, "*7" }, // shifted end key { fc::Fkey_send , nullptr, "*7" }, // shifted end key
{ fc::Fkey_seol , 0, "*8" }, // shifted clear-to-end-of-line key { fc::Fkey_seol , nullptr, "*8" }, // shifted clear-to-end-of-line key
{ fc::Fkey_sexit , 0, "*9" }, // shifted exit key { fc::Fkey_sexit , nullptr, "*9" }, // shifted exit key
{ fc::Fkey_sfind , 0, "*0" }, // shifted find key { fc::Fkey_sfind , nullptr, "*0" }, // shifted find key
{ fc::Fkey_shelp , 0, "#1" }, // shifted help key { fc::Fkey_shelp , nullptr, "#1" }, // shifted help key
{ fc::Fkey_shome , 0, "#2" }, // shifted home key { fc::Fkey_shome , nullptr, "#2" }, // shifted home key
{ fc::Fkey_sic , 0, "#3" }, // shifted insert-character key { fc::Fkey_sic , nullptr, "#3" }, // shifted insert-character key
{ fc::Fkey_sleft , 0, "#4" }, // shifted left-arrow key { fc::Fkey_sleft , nullptr, "#4" }, // shifted left-arrow key
{ fc::Fkey_smessage , 0, "%a" }, // shifted message key { fc::Fkey_smessage , nullptr, "%a" }, // shifted message key
{ fc::Fkey_smove , 0, "%b" }, // shifted move key { fc::Fkey_smove , nullptr, "%b" }, // shifted move key
{ fc::Fkey_snext , 0, "%c" }, // shifted next key { fc::Fkey_snext , nullptr, "%c" }, // shifted next key
{ fc::Fkey_soptions , 0, "%d" }, // shifted options key { fc::Fkey_soptions , nullptr, "%d" }, // shifted options key
{ fc::Fkey_sprevious , 0, "%e" }, // shifted previous key { fc::Fkey_sprevious , nullptr, "%e" }, // shifted previous key
{ fc::Fkey_sprint , 0, "%f" }, // shifted print key { fc::Fkey_sprint , nullptr, "%f" }, // shifted print key
{ fc::Fkey_sredo , 0, "%g" }, // shifted redo key { fc::Fkey_sredo , nullptr, "%g" }, // shifted redo key
{ fc::Fkey_sreplace , 0, "%h" }, // shifted replace key { fc::Fkey_sreplace , nullptr, "%h" }, // shifted replace key
{ fc::Fkey_sright , 0, "%i" }, // shifted right-arrow key { fc::Fkey_sright , nullptr, "%i" }, // shifted right-arrow key
{ fc::Fkey_srsume , 0, "%j" }, // shifted resume key { fc::Fkey_srsume , nullptr, "%j" }, // shifted resume key
{ fc::Fkey_ssave , 0, "!1" }, // shifted save key { fc::Fkey_ssave , nullptr, "!1" }, // shifted save key
{ fc::Fkey_ssuspend , 0, "!2" }, // shifted suspend key { fc::Fkey_ssuspend , nullptr, "!2" }, // shifted suspend key
{ fc::Fkey_sundo , 0, "!3" }, // shifted undo key { fc::Fkey_sundo , nullptr, "!3" }, // shifted undo key
{ fc::Fkey_f11 , 0, "F1" }, // F11 function key { fc::Fkey_f11 , nullptr, "F1" }, // F11 function key
{ fc::Fkey_f12 , 0, "F2" }, // F12 function key { fc::Fkey_f12 , nullptr, "F2" }, // F12 function key
{ fc::Fkey_f13 , 0, "F3" }, // F13 function key { fc::Fkey_f13 , nullptr, "F3" }, // F13 function key
{ fc::Fkey_f14 , 0, "F4" }, // F14 function key { fc::Fkey_f14 , nullptr, "F4" }, // F14 function key
{ fc::Fkey_f15 , 0, "F5" }, // F15 function key { fc::Fkey_f15 , nullptr, "F5" }, // F15 function key
{ fc::Fkey_f16 , 0, "F6" }, // F16 function key { fc::Fkey_f16 , nullptr, "F6" }, // F16 function key
{ fc::Fkey_f17 , 0, "F7" }, // F17 function key { fc::Fkey_f17 , nullptr, "F7" }, // F17 function key
{ fc::Fkey_f18 , 0, "F8" }, // F18 function key { fc::Fkey_f18 , nullptr, "F8" }, // F18 function key
{ fc::Fkey_f19 , 0, "F9" }, // F19 function key { fc::Fkey_f19 , nullptr, "F9" }, // F19 function key
{ fc::Fkey_f20 , 0, "FA" }, // F20 function key { fc::Fkey_f20 , nullptr, "FA" }, // F20 function key
{ fc::Fkey_f21 , 0, "FB" }, // F21 function key { fc::Fkey_f21 , nullptr, "FB" }, // F21 function key
{ fc::Fkey_f22 , 0, "FC" }, // F22 function key { fc::Fkey_f22 , nullptr, "FC" }, // F22 function key
{ fc::Fkey_f23 , 0, "FD" }, // F23 function key { fc::Fkey_f23 , nullptr, "FD" }, // F23 function key
{ fc::Fkey_f24 , 0, "FE" }, // F24 function key { fc::Fkey_f24 , nullptr, "FE" }, // F24 function key
{ fc::Fkey_f25 , 0, "FF" }, // F25 function key { fc::Fkey_f25 , nullptr, "FF" }, // F25 function key
{ fc::Fkey_f26 , 0, "FG" }, // F26 function key { fc::Fkey_f26 , nullptr, "FG" }, // F26 function key
{ fc::Fkey_f27 , 0, "FH" }, // F27 function key { fc::Fkey_f27 , nullptr, "FH" }, // F27 function key
{ fc::Fkey_f28 , 0, "FI" }, // F28 function key { fc::Fkey_f28 , nullptr, "FI" }, // F28 function key
{ fc::Fkey_f29 , 0, "FJ" }, // F29 function key { fc::Fkey_f29 , nullptr, "FJ" }, // F29 function key
{ fc::Fkey_f30 , 0, "FK" }, // F30 function key { fc::Fkey_f30 , nullptr, "FK" }, // F30 function key
{ fc::Fkey_f31 , 0, "FL" }, // F31 function key { fc::Fkey_f31 , nullptr, "FL" }, // F31 function key
{ fc::Fkey_f32 , 0, "FM" }, // F32 function key { fc::Fkey_f32 , nullptr, "FM" }, // F32 function key
{ fc::Fkey_f33 , 0, "FN" }, // F33 function key { fc::Fkey_f33 , nullptr, "FN" }, // F33 function key
{ fc::Fkey_f34 , 0, "FO" }, // F34 function key { fc::Fkey_f34 , nullptr, "FO" }, // F34 function key
{ fc::Fkey_f35 , 0, "FP" }, // F35 function key { fc::Fkey_f35 , nullptr, "FP" }, // F35 function key
{ fc::Fkey_f36 , 0, "FQ" }, // F36 function key { fc::Fkey_f36 , nullptr, "FQ" }, // F36 function key
{ fc::Fkey_f37 , 0, "FR" }, // F37 function key { fc::Fkey_f37 , nullptr, "FR" }, // F37 function key
{ fc::Fkey_f38 , 0, "FS" }, // F38 function key { fc::Fkey_f38 , nullptr, "FS" }, // F38 function key
{ fc::Fkey_f39 , 0, "FT" }, // F39 function key { fc::Fkey_f39 , nullptr, "FT" }, // F39 function key
{ fc::Fkey_f40 , 0, "FU" }, // F40 function key { fc::Fkey_f40 , nullptr, "FU" }, // F40 function key
{ fc::Fkey_f41 , 0, "FV" }, // F41 function key { fc::Fkey_f41 , nullptr, "FV" }, // F41 function key
{ fc::Fkey_f42 , 0, "FW" }, // F42 function key { fc::Fkey_f42 , nullptr, "FW" }, // F42 function key
{ fc::Fkey_f43 , 0, "FX" }, // F43 function key { fc::Fkey_f43 , nullptr, "FX" }, // F43 function key
{ fc::Fkey_f44 , 0, "FY" }, // F44 function key { fc::Fkey_f44 , nullptr, "FY" }, // F44 function key
{ fc::Fkey_f45 , 0, "FZ" }, // F45 function key { fc::Fkey_f45 , nullptr, "FZ" }, // F45 function key
{ fc::Fkey_f46 , 0, "Fa" }, // F46 function key { fc::Fkey_f46 , nullptr, "Fa" }, // F46 function key
{ fc::Fkey_f47 , 0, "Fb" }, // F47 function key { fc::Fkey_f47 , nullptr, "Fb" }, // F47 function key
{ fc::Fkey_f48 , 0, "Fc" }, // F48 function key { fc::Fkey_f48 , nullptr, "Fc" }, // F48 function key
{ fc::Fkey_f49 , 0, "Fd" }, // F49 function key { fc::Fkey_f49 , nullptr, "Fd" }, // F49 function key
{ fc::Fkey_f50 , 0, "Fe" }, // F50 function key { fc::Fkey_f50 , nullptr, "Fe" }, // F50 function key
{ fc::Fkey_f51 , 0, "Ff" }, // F51 function key { fc::Fkey_f51 , nullptr, "Ff" }, // F51 function key
{ fc::Fkey_f52 , 0, "Fg" }, // F52 function key { fc::Fkey_f52 , nullptr, "Fg" }, // F52 function key
{ fc::Fkey_f53 , 0, "Fh" }, // F53 function key { fc::Fkey_f53 , nullptr, "Fh" }, // F53 function key
{ fc::Fkey_f54 , 0, "Fi" }, // F54 function key { fc::Fkey_f54 , nullptr, "Fi" }, // F54 function key
{ fc::Fkey_f55 , 0, "Fj" }, // F55 function key { fc::Fkey_f55 , nullptr, "Fj" }, // F55 function key
{ fc::Fkey_f56 , 0, "Fk" }, // F56 function key { fc::Fkey_f56 , nullptr, "Fk" }, // F56 function key
{ fc::Fkey_f57 , 0, "Fl" }, // F57 function key { fc::Fkey_f57 , nullptr, "Fl" }, // F57 function key
{ fc::Fkey_f58 , 0, "Fm" }, // F58 function key { fc::Fkey_f58 , nullptr, "Fm" }, // F58 function key
{ fc::Fkey_f59 , 0, "Fn" }, // F59 function key { fc::Fkey_f59 , nullptr, "Fn" }, // F59 function key
{ fc::Fkey_f60 , 0, "Fo" }, // F60 function key { fc::Fkey_f60 , nullptr, "Fo" }, // F60 function key
{ fc::Fkey_f61 , 0, "Fp" }, // F61 function key { fc::Fkey_f61 , nullptr, "Fp" }, // F61 function key
{ fc::Fkey_f62 , 0, "Fq" }, // F62 function key { fc::Fkey_f62 , nullptr, "Fq" }, // F62 function key
{ fc::Fkey_f63 , 0, "Fr" }, // F63 function key { fc::Fkey_f63 , nullptr, "Fr" }, // F63 function key
{ 0 , 0, "\0" } { 0 , nullptr, "\0" }
}; };
FMetakeyMap fmetakey[] = FMetakeyMap fmetakey[] =

View File

@ -124,7 +124,7 @@ bool FKeyboard::isKeyPressed()
FD_SET(stdin_no, &ifds); FD_SET(stdin_no, &ifds);
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_usec = 100000; // 100 ms tv.tv_usec = 100000; // 100 ms
const int result = select (stdin_no + 1, &ifds, 0, 0, &tv); const int result = select (stdin_no + 1, &ifds, nullptr, nullptr, &tv);
if ( result > 0 && FD_ISSET(stdin_no, &ifds) ) if ( result > 0 && FD_ISSET(stdin_no, &ifds) )
FD_CLR (stdin_no, &ifds); FD_CLR (stdin_no, &ifds);

View File

@ -1107,10 +1107,7 @@ inline bool FLineEdit::keyInput (FKey key)
else if ( len > 0 ) else if ( len > 0 )
{ {
if ( insert_mode ) if ( insert_mode )
{
text.insert(ch, cursor_pos); text.insert(ch, cursor_pos);
len++;
}
else else
text.overwrite(ch, cursor_pos); text.overwrite(ch, cursor_pos);
} }

View File

@ -895,7 +895,7 @@ void FMenu::mouseMoveOverBorder (mouseStates& ms)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::passEventToSubMenu (FMouseEvent*& ev) void FMenu::passEventToSubMenu (FMouseEvent* const& ev)
{ {
// Mouse event handover to sub-menu // Mouse event handover to sub-menu
@ -918,7 +918,7 @@ void FMenu::passEventToSubMenu (FMouseEvent*& ev)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::passEventToSuperMenu (FMouseEvent*& ev) void FMenu::passEventToSuperMenu (FMouseEvent* const& ev)
{ {
// Mouse event handover to super-menu // Mouse event handover to super-menu
@ -942,7 +942,7 @@ void FMenu::passEventToSuperMenu (FMouseEvent*& ev)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::passEventToMenuBar (FMouseEvent*& ev) void FMenu::passEventToMenuBar (FMouseEvent* const& ev)
{ {
// Mouse event handover to the menu bar // Mouse event handover to the menu bar
@ -989,7 +989,7 @@ FMenu* FMenu::superMenuAt (int x, int y)
// Check mouse click position for super menu // Check mouse click position for super menu
if ( getTermGeometry().contains(x, y) ) if ( getTermGeometry().contains(x, y) )
return 0; return nullptr;
auto super = getSuperMenu(); auto super = getSuperMenu();
@ -1006,7 +1006,7 @@ FMenu* FMenu::superMenuAt (int x, int y)
} }
} }
return 0; return nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -925,7 +925,7 @@ void FMenuBar::mouseMoveOverList (const FMouseEvent* ev)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuBar::passEventToMenu (const FMouseEvent*& ev) void FMenuBar::passEventToMenu (const FMouseEvent* const& ev)
{ {
if ( ! hasSelectedItem() || ! getSelectedItem()->hasMenu() ) if ( ! hasSelectedItem() || ! getSelectedItem()->hasMenu() )
return; return;

View File

@ -31,7 +31,7 @@ namespace finalcut
static const char* const button_text[] = static const char* const button_text[] =
{ {
0, nullptr,
"&OK", "&OK",
"&Cancel", "&Cancel",
"&Yes", "&Yes",
@ -39,7 +39,7 @@ static const char* const button_text[] =
"&Abort", "&Abort",
"&Retry", "&Retry",
"&Ignore", "&Ignore",
0 nullptr
}; };
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -183,7 +183,7 @@ inline FMouse* FMouse::createMouseObject (const mouse_type mt)
switch ( mt ) switch ( mt )
{ {
case none: case none:
return 0; return nullptr;
case gpm: case gpm:
#ifdef F_HAVE_LIBGPM #ifdef F_HAVE_LIBGPM
@ -528,7 +528,7 @@ int FMouseGPM::gpmEvent (bool clear)
FD_SET(gpm_fd, &ifds); FD_SET(gpm_fd, &ifds);
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_usec = 100000; // 100 ms tv.tv_usec = 100000; // 100 ms
const int result = select (max + 1, &ifds, 0, 0, &tv); const int result = select (max + 1, &ifds, nullptr, nullptr, &tv);
if ( result > 0 && FD_ISSET(stdin_no, &ifds) ) if ( result > 0 && FD_ISSET(stdin_no, &ifds) )
{ {
@ -1249,7 +1249,7 @@ void FMouseControl::clearEvent()
{ {
FMouse* mouse_object; FMouse* mouse_object;
while ( (mouse_object = getMouseWithEvent()) != 0 ) while ( (mouse_object = getMouseWithEvent()) != nullptr )
mouse_object->clearEvent(); mouse_object->clearEvent();
} }
@ -1612,7 +1612,7 @@ FMouse* FMouseControl::getMouseWithData()
} }
); );
return ( iter != mouse_protocol.end() ) ? iter->second : 0; return ( iter != mouse_protocol.end() ) ? iter->second : nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1628,7 +1628,7 @@ FMouse* FMouseControl::getMouseWithEvent()
} }
); );
return ( iter != mouse_protocol.end() ) ? iter->second : 0; return ( iter != mouse_protocol.end() ) ? iter->second : nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -105,10 +105,10 @@ FObject* FObject::getChild (int index) const
// returns the child for the index number // returns the child for the index number
if ( ! hasChildren() ) if ( ! hasChildren() )
return 0; return nullptr;
if ( index <= 0 || index > numOfChildren() ) if ( index <= 0 || index > numOfChildren() )
return 0; return nullptr;
auto iter = begin(); auto iter = begin();
std::advance (iter, index - 1); std::advance (iter, index - 1);
@ -213,7 +213,7 @@ void FObject::getCurrentTime (timeval* time)
{ {
// Get the current time as timeval struct // Get the current time as timeval struct
gettimeofday(time, 0); gettimeofday(time, nullptr);
// NTP fix // NTP fix
while ( time->tv_usec >= 1000000 ) while ( time->tv_usec >= 1000000 )

View File

@ -451,7 +451,7 @@ void FOptiAttr::set_orig_orig_colors (char cap[])
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FOptiAttr::isNormal (FChar*& ch) bool FOptiAttr::isNormal (const FChar* const& ch)
{ {
return hasNoAttribute(ch) && ! hasColor(ch); return hasNoAttribute(ch) && ! hasColor(ch);
} }
@ -563,7 +563,7 @@ char* FOptiAttr::changeAttribute (FChar*& term, FChar*& next)
// Look for no changes // Look for no changes
if ( ! (switchOn() || switchOff() || hasColorChanged(term, next)) ) if ( ! (switchOn() || switchOff() || hasColorChanged(term, next)) )
return 0; return nullptr;
if ( hasNoAttribute(next) ) if ( hasNoAttribute(next) )
{ {
@ -1180,7 +1180,7 @@ void FOptiAttr::setAttributesOff (FChar*& term)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FOptiAttr::hasColor (FChar*& attr) bool FOptiAttr::hasColor (const FChar* const& attr)
{ {
if ( attr if ( attr
&& attr->fg_color == fc::Default && attr->fg_color == fc::Default
@ -1191,7 +1191,7 @@ bool FOptiAttr::hasColor (FChar*& attr)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FOptiAttr::hasAttribute (FChar*& attr) bool FOptiAttr::hasAttribute (const FChar* const& attr)
{ {
if ( attr ) if ( attr )
{ {
@ -1214,13 +1214,14 @@ bool FOptiAttr::hasAttribute (FChar*& attr)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FOptiAttr::hasNoAttribute (FChar*& attr) bool FOptiAttr::hasNoAttribute (const FChar* const& attr)
{ {
return ! hasAttribute(attr); return ! hasAttribute(attr);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FOptiAttr::hasColorChanged (FChar*& term, FChar*& next) inline bool FOptiAttr::hasColorChanged ( const FChar* const& term
, const FChar* const& next )
{ {
if ( term && next ) if ( term && next )
{ {
@ -1478,7 +1479,7 @@ inline void FOptiAttr::change_to_default_color ( FChar*& term
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FOptiAttr::change_current_color ( FChar*& term inline void FOptiAttr::change_current_color ( const FChar* const& term
, FColor fg, FColor bg ) , FColor fg, FColor bg )
{ {
char* color_str{}; char* color_str{};
@ -1597,7 +1598,7 @@ inline bool FOptiAttr::hasCharsetEquivalence()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FOptiAttr::detectSwitchOn (FChar*& term, FChar*& next) inline void FOptiAttr::detectSwitchOn (const FChar* const& term, const FChar* const& next)
{ {
if ( ! (term && next) ) if ( ! (term && next) )
return; return;
@ -1618,7 +1619,7 @@ inline void FOptiAttr::detectSwitchOn (FChar*& term, FChar*& next)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FOptiAttr::detectSwitchOff (FChar*& term, FChar*& next) inline void FOptiAttr::detectSwitchOff (const FChar* const& term, const FChar* const& next)
{ {
if ( ! (term && next) ) if ( ! (term && next) )
return; return;

View File

@ -59,7 +59,6 @@ FOptiMove::~FOptiMove() // destructor
void FOptiMove::setBaudRate (int baud) void FOptiMove::setBaudRate (int baud)
{ {
assert ( baud >= 0 ); assert ( baud >= 0 );
baudrate = baud; baudrate = baud;
calculateCharDuration(); calculateCharDuration();
} }
@ -497,7 +496,7 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
|| yold < 0 || yold < 0
|| isWideMove (xold, yold, xnew, ynew) ) || isWideMove (xold, yold, xnew, ynew) )
{ {
return ( move_time < LONG_DURATION ) ? move_buf : 0; return ( move_time < LONG_DURATION ) ? move_buf : nullptr;
} }
} }
@ -527,7 +526,7 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
if ( move_time < LONG_DURATION ) if ( move_time < LONG_DURATION )
return move_buf; return move_buf;
else else
return 0; return nullptr;
} }

View File

@ -167,7 +167,7 @@ void FProgressbar::drawProgressLabel()
if ( percentage > 100 ) if ( percentage > 100 )
print ("--- %"); print ("--- %");
else else
printf ("%3d %%", percentage); printf ("%3zu %%", percentage);
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);

View File

@ -709,7 +709,7 @@ inline FPoint FScrollView::getViewportCursorPos()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollView::init (FWidget* parent) void FScrollView::init (FWidget* parent)
{ {
assert ( parent != 0 ); assert ( parent != nullptr );
assert ( ! parent->isInstanceOf("FScrollView") ); assert ( ! parent->isInstanceOf("FScrollView") );
initScrollbar (vbar, fc::vertical, &FScrollView::cb_VBarChange); initScrollbar (vbar, fc::vertical, &FScrollView::cb_VBarChange);

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2019 Markus Gans * * Copyright 2019-2020 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -59,7 +59,7 @@ FStartOptions::~FStartOptions() // destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FStartOptions& FStartOptions::getFStartOptions() FStartOptions& FStartOptions::getFStartOptions()
{ {
if ( start_options == 0 ) if ( start_options == nullptr )
{ {
try try
{ {

View File

@ -397,7 +397,7 @@ const char* FString::c_str() const
else if ( string ) else if ( string )
return const_cast<char*>(""); return const_cast<char*>("");
else else
return 0; return nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -410,7 +410,7 @@ char* FString::c_str()
else if ( string ) else if ( string )
return const_cast<char*>(""); return const_cast<char*>("");
else else
return 0; return nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -617,7 +617,7 @@ double FString::toDouble() const
wchar_t* p{}; wchar_t* p{};
const double ret = std::wcstod(string, &p); const double ret = std::wcstod(string, &p);
if ( p != 0 && *p != '\0' ) if ( p != nullptr && *p != '\0' )
throw std::invalid_argument ("no valid floating point value"); throw std::invalid_argument ("no valid floating point value");
if ( errno == ERANGE ) if ( errno == ERANGE )
@ -758,7 +758,7 @@ FStringList FString::split (const FString& delimiter)
while ( token ) while ( token )
{ {
string_list.push_back (FString(token)); string_list.push_back (FString(token));
token = extractToken (&rest, 0, delimiter.wc_str()); token = extractToken (&rest, nullptr, delimiter.wc_str());
} }
return string_list; return string_list;
@ -1205,7 +1205,7 @@ bool FString::includes (const FString& s) const
if ( ! (string && s.string) ) if ( ! (string && s.string) )
return false; return false;
return ( std::wcsstr(string, s.string) != 0 ); return ( std::wcsstr(string, s.string) != nullptr );
} }
@ -1398,7 +1398,7 @@ void FString::_remove (std::size_t pos, std::size_t len)
inline char* FString::wc_to_c_str (const wchar_t s[]) const inline char* FString::wc_to_c_str (const wchar_t s[]) const
{ {
if ( ! s ) // handle NULL string if ( ! s ) // handle NULL string
return 0; return nullptr;
if ( ! *s ) // handle empty string if ( ! *s ) // handle empty string
{ {
@ -1410,7 +1410,7 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const
catch (const std::bad_alloc& ex) catch (const std::bad_alloc& ex)
{ {
std::cerr << bad_alloc_str << " " << ex.what() << std::endl; std::cerr << bad_alloc_str << " " << ex.what() << std::endl;
return 0; return nullptr;
} }
return c_string; return c_string;
@ -1435,7 +1435,7 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const
catch (const std::bad_alloc& ex) catch (const std::bad_alloc& ex)
{ {
std::cerr << bad_alloc_str << " " << ex.what() << std::endl; std::cerr << bad_alloc_str << " " << ex.what() << std::endl;
return 0; return nullptr;
} }
const int mblength = \ const int mblength = \
@ -1455,7 +1455,7 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const
inline wchar_t* FString::c_to_wc_str (const char s[]) const inline wchar_t* FString::c_to_wc_str (const char s[]) const
{ {
if ( ! s ) // handle NULL string if ( ! s ) // handle NULL string
return 0; return nullptr;
if ( ! *s ) // handle empty string if ( ! *s ) // handle empty string
{ {
@ -1467,7 +1467,7 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const
catch (const std::bad_alloc& ex) catch (const std::bad_alloc& ex)
{ {
std::cerr << bad_alloc_str << " " << ex.what() << std::endl; std::cerr << bad_alloc_str << " " << ex.what() << std::endl;
return 0; return nullptr;
} }
} }
@ -1487,7 +1487,7 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const
catch (const std::bad_alloc& ex) catch (const std::bad_alloc& ex)
{ {
std::cerr << bad_alloc_str << " " << ex.what() << std::endl; std::cerr << bad_alloc_str << " " << ex.what() << std::endl;
return 0; return nullptr;
} }
const int wclength = \ const int wclength = \
@ -1500,7 +1500,7 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const
else else
{ {
delete[] dest; delete[] dest;
return 0; return nullptr;
} }
} }
@ -1512,7 +1512,7 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const
else else
{ {
delete[] dest; delete[] dest;
return 0; return nullptr;
} }
} }
@ -1524,10 +1524,10 @@ inline wchar_t* FString::extractToken ( wchar_t* rest[]
wchar_t* token = ( s ) ? const_cast<wchar_t*>(s) : *rest; wchar_t* token = ( s ) ? const_cast<wchar_t*>(s) : *rest;
if ( ! token ) if ( ! token )
return 0; return nullptr;
if ( ! token[0] ) if ( ! token[0] )
return 0; return nullptr;
*rest = std::wcspbrk(token, delim); *rest = std::wcspbrk(token, delim);

View File

@ -183,7 +183,7 @@ int FTerm::getMaxColor()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermData* FTerm::getFTermData() FTermData* FTerm::getFTermData()
{ {
if ( data == 0 ) if ( data == nullptr )
{ {
try try
{ {
@ -202,7 +202,7 @@ FTermData* FTerm::getFTermData()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FSystem* FTerm::getFSystem() FSystem* FTerm::getFSystem()
{ {
if ( fsys == 0 ) if ( fsys == nullptr )
{ {
try try
{ {
@ -221,7 +221,7 @@ FSystem* FTerm::getFSystem()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FOptiMove* FTerm::getFOptiMove() FOptiMove* FTerm::getFOptiMove()
{ {
if ( opti_move == 0 ) if ( opti_move == nullptr )
{ {
try try
{ {
@ -240,7 +240,7 @@ FOptiMove* FTerm::getFOptiMove()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FOptiAttr* FTerm::getFOptiAttr() FOptiAttr* FTerm::getFOptiAttr()
{ {
if ( opti_attr == 0 ) if ( opti_attr == nullptr )
{ {
try try
{ {
@ -259,7 +259,7 @@ FOptiAttr* FTerm::getFOptiAttr()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermDetection* FTerm::getFTermDetection() FTermDetection* FTerm::getFTermDetection()
{ {
if ( term_detection == 0 ) if ( term_detection == nullptr )
{ {
try try
{ {
@ -278,7 +278,7 @@ FTermDetection* FTerm::getFTermDetection()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermXTerminal* FTerm::getFTermXTerminal() FTermXTerminal* FTerm::getFTermXTerminal()
{ {
if ( xterm == 0 ) if ( xterm == nullptr )
{ {
try try
{ {
@ -297,7 +297,7 @@ FTermXTerminal* FTerm::getFTermXTerminal()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FKeyboard* FTerm::getFKeyboard() FKeyboard* FTerm::getFKeyboard()
{ {
if ( keyboard == 0 ) if ( keyboard == nullptr )
{ {
try try
{ {
@ -316,7 +316,7 @@ FKeyboard* FTerm::getFKeyboard()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMouseControl* FTerm::getFMouseControl() FMouseControl* FTerm::getFMouseControl()
{ {
if ( mouse == 0 ) if ( mouse == nullptr )
{ {
try try
{ {
@ -336,7 +336,7 @@ FMouseControl* FTerm::getFMouseControl()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermLinux* FTerm::getFTermLinux() FTermLinux* FTerm::getFTermLinux()
{ {
if ( linux == 0 ) if ( linux == nullptr )
{ {
try try
{ {
@ -356,7 +356,7 @@ FTermLinux* FTerm::getFTermLinux()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermFreeBSD* FTerm::getFTermFreeBSD() FTermFreeBSD* FTerm::getFTermFreeBSD()
{ {
if ( freebsd == 0 ) if ( freebsd == nullptr )
{ {
try try
{ {
@ -376,7 +376,7 @@ FTermFreeBSD* FTerm::getFTermFreeBSD()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermOpenBSD* FTerm::getFTermOpenBSD() FTermOpenBSD* FTerm::getFTermOpenBSD()
{ {
if ( openbsd == 0 ) if ( openbsd == nullptr )
{ {
try try
{ {
@ -397,7 +397,7 @@ FTermOpenBSD* FTerm::getFTermOpenBSD()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FTermDebugData& FTerm::getFTermDebugData() FTermDebugData& FTerm::getFTermDebugData()
{ {
if ( debug_data == 0 ) if ( debug_data == nullptr )
{ {
try try
{ {
@ -415,7 +415,7 @@ FTermDebugData& FTerm::getFTermDebugData()
#endif // DEBUG #endif // DEBUG
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::isNormal (FChar*& ch) bool FTerm::isNormal (const FChar* const& ch)
{ {
return opti_attr->isNormal(ch); return opti_attr->isNormal(ch);
} }
@ -782,7 +782,7 @@ int FTerm::openConsole()
"/dev/vc/0", "/dev/vc/0",
"/dev/systty", "/dev/systty",
"/dev/console", "/dev/console",
0 nullptr
}; };
if ( fd >= 0 ) // console is already opened if ( fd >= 0 ) // console is already opened
@ -791,7 +791,7 @@ int FTerm::openConsole()
if ( ! *termfilename || ! fsys ) if ( ! *termfilename || ! fsys )
return 0; return 0;
for (std::size_t i{0}; terminal_devices[i] != 0; i++) for (std::size_t i{0}; terminal_devices[i] != nullptr; i++)
{ {
fd = fsys->open(terminal_devices[i], O_RDWR, 0); fd = fsys->open(terminal_devices[i], O_RDWR, 0);
data->setTTYFileDescriptor(fd); data->setTTYFileDescriptor(fd);
@ -847,7 +847,7 @@ char* FTerm::cursorsVisibilityString (bool enable)
char* visibility_str{nullptr}; char* visibility_str{nullptr};
if ( data->isCursorHidden() == enable ) if ( data->isCursorHidden() == enable )
return 0; return nullptr;
if ( enable ) if ( enable )
{ {
@ -1689,7 +1689,7 @@ void FTerm::init_locale()
// Try to found a meaningful content for locale_name // Try to found a meaningful content for locale_name
if ( locale_name ) if ( locale_name )
locale_name = std::setlocale (LC_CTYPE, 0); locale_name = std::setlocale (LC_CTYPE, nullptr);
else else
{ {
locale_name = std::getenv("LC_ALL"); locale_name = std::getenv("LC_ALL");
@ -1770,7 +1770,7 @@ void FTerm::init_term_encoding()
} }
else if ( fsys->isTTY(stdout_no) else if ( fsys->isTTY(stdout_no)
&& (std::strlen(termtype) > 0) && (std::strlen(termtype) > 0)
&& (TCAP(fc::t_exit_alt_charset_mode) != 0) ) && (TCAP(fc::t_exit_alt_charset_mode) != nullptr) )
{ {
data->setVT100Console (true); data->setVT100Console (true);
data->setTermEncoding (fc::VT100); data->setTermEncoding (fc::VT100);
@ -1983,7 +1983,7 @@ char* FTerm::disableCursorString()
if ( vi ) if ( vi )
return vi; return vi;
return 0; return nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -25,6 +25,7 @@
#endif #endif
#include <algorithm> #include <algorithm>
#include <numeric>
#include "final/fcharmap.h" #include "final/fcharmap.h"
#include "final/fterm.h" #include "final/fterm.h"
@ -497,14 +498,16 @@ std::size_t getColumnWidth (FChar& term_char)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
std::size_t getColumnWidth (const FTermBuffer& termbuffer) std::size_t getColumnWidth (const FTermBuffer& tb)
{ {
std::size_t column_width{0}; return std::accumulate ( std::next(tb.begin())
, tb.end()
for (auto&& tc : termbuffer) , tb.front().attr.bit.char_width
column_width += tc.attr.bit.char_width; , [] (std::size_t s, FChar c) -> std::size_t
{
return column_width; return std::move(s) + c.attr.bit.char_width;
}
);
} }
} // namespace finalcut } // namespace finalcut

View File

@ -20,6 +20,7 @@
* <http://www.gnu.org/licenses/>. * * <http://www.gnu.org/licenses/>. *
***********************************************************************/ ***********************************************************************/
#include <algorithm>
#include <string> #include <string>
#include <vector> #include <vector>
@ -46,10 +47,14 @@ const FString FTermBuffer::toString() const
{ {
std::wstring wide_string{}; std::wstring wide_string{};
wide_string.reserve(data.size()); wide_string.reserve(data.size());
std::transform ( data.begin()
for (auto&& fchar : data) , data.end()
wide_string.push_back(fchar.ch); , std::back_inserter(wide_string)
, [] (const FChar& fchar) -> wchar_t
{
return fchar.ch;
}
);
return FString(wide_string); return FString(wide_string);
} }

View File

@ -328,92 +328,92 @@ FTermcap::tcap_map FTermcap::strings[] =
// | .-------- Tcap-code // | .-------- Tcap-code
// | | // variable name -> description // | | // variable name -> description
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ 0, "bl" }, // bell -> audible signal (bell) (P) { nullptr, "bl" }, // bell -> audible signal (bell) (P)
{ 0, "ec" }, // erase_chars -> erase #1 characters (P) { nullptr, "ec" }, // erase_chars -> erase #1 characters (P)
{ 0, "cl" }, // clear_screen -> clear screen and home cursor (P*) { nullptr, "cl" }, // clear_screen -> clear screen and home cursor (P*)
{ 0, "cd" }, // clr_eos -> clear to end of screen (P*) { nullptr, "cd" }, // clr_eos -> clear to end of screen (P*)
{ 0, "ce" }, // clr_eol -> clear to end of line (P) { nullptr, "ce" }, // clr_eol -> clear to end of line (P)
{ 0, "cb" }, // clr_bol -> Clear to beginning of line { nullptr, "cb" }, // clr_bol -> Clear to beginning of line
{ 0, "ho" }, // cursor_home -> home cursor (if no cup) { nullptr, "ho" }, // cursor_home -> home cursor (if no cup)
{ 0, "ll" }, // cursor_to_ll -> last line, first column (if no cup) { nullptr, "ll" }, // cursor_to_ll -> last line, first column (if no cup)
{ 0, "cr" }, // carriage_return -> carriage return (P*) { nullptr, "cr" }, // carriage_return -> carriage return (P*)
{ 0, "ta" }, // tab -> tab to next 8-space hardware tab stop { nullptr, "ta" }, // tab -> tab to next 8-space hardware tab stop
{ 0, "bt" }, // back_tab -> back tab (P) { nullptr, "bt" }, // back_tab -> back tab (P)
{ 0, "ip" }, // insert_padding -> insert padding after inserted character { nullptr, "ip" }, // insert_padding -> insert padding after inserted character
{ 0, "ic" }, // insert_character -> insert character (P) { nullptr, "ic" }, // insert_character -> insert character (P)
{ 0, "IC" }, // parm_ich -> insert #1 characters (P*) { nullptr, "IC" }, // parm_ich -> insert #1 characters (P*)
{ 0, "rp" }, // repeat_char -> repeat char #1 #2 times (P*) { nullptr, "rp" }, // repeat_char -> repeat char #1 #2 times (P*)
{ 0, "Ic" }, // initialize_color -> initialize color #1 to (#2,#3,#4) { nullptr, "Ic" }, // initialize_color -> initialize color #1 to (#2,#3,#4)
{ 0, "Ip" }, // initialize_pair -> Initialize color pair #1 to { nullptr, "Ip" }, // initialize_pair -> Initialize color pair #1 to
// fg=(#2,#3,#4), bg=(#5,#6,#7) // fg=(#2,#3,#4), bg=(#5,#6,#7)
{ 0, "AF" }, // set_a_foreground -> Set ANSI background color to #1 { nullptr, "AF" }, // set_a_foreground -> Set ANSI background color to #1
{ 0, "AB" }, // set_a_background -> Set ANSI background color to #1 { nullptr, "AB" }, // set_a_background -> Set ANSI background color to #1
{ 0, "Sf" }, // set_foreground -> Set foreground color #1 { nullptr, "Sf" }, // set_foreground -> Set foreground color #1
{ 0, "Sb" }, // set_background -> Set background color #1 { nullptr, "Sb" }, // set_background -> Set background color #1
{ 0, "sp" }, // set_color_pair -> Set current color pair to #1 { nullptr, "sp" }, // set_color_pair -> Set current color pair to #1
{ 0, "op" }, // orig_pair -> Set default pair to original value { nullptr, "op" }, // orig_pair -> Set default pair to original value
{ 0, "oc" }, // orig_colors -> Set all color pairs to the original { nullptr, "oc" }, // orig_colors -> Set all color pairs to the original
{ 0, "NC" }, // no_color_video -> video attributes that cannot be used { nullptr, "NC" }, // no_color_video -> video attributes that cannot be used
// with colors // with colors
{ 0, "cm" }, // cursor_address -> move to row #1 columns #2 { nullptr, "cm" }, // cursor_address -> move to row #1 columns #2
{ 0, "ch" }, // column_address -> horizontal position #1, absolute (P) { nullptr, "ch" }, // column_address -> horizontal position #1, absolute (P)
{ 0, "cv" }, // row_address -> vertical position #1 absolute (P) { nullptr, "cv" }, // row_address -> vertical position #1 absolute (P)
{ 0, "vs" }, // cursor_visible -> make cursor very visible { nullptr, "vs" }, // cursor_visible -> make cursor very visible
{ 0, "vi" }, // cursor_invisible -> make cursor invisible { nullptr, "vi" }, // cursor_invisible -> make cursor invisible
{ 0, "ve" }, // cursor_normal -> make cursor appear normal (undo vi/vs) { nullptr, "ve" }, // cursor_normal -> make cursor appear normal (undo vi/vs)
{ 0, "up" }, // cursor_up -> up one line { nullptr, "up" }, // cursor_up -> up one line
{ 0, "do" }, // cursor_down -> down one line { nullptr, "do" }, // cursor_down -> down one line
{ 0, "le" }, // cursor_left -> move left one space { nullptr, "le" }, // cursor_left -> move left one space
{ 0, "nd" }, // cursor_right -> non-destructive space (move right) { nullptr, "nd" }, // cursor_right -> non-destructive space (move right)
{ 0, "UP" }, // parm_up_cursor -> up #1 lines (P*) { nullptr, "UP" }, // parm_up_cursor -> up #1 lines (P*)
{ 0, "DO" }, // parm_down_cursor -> down #1 lines (P*) { nullptr, "DO" }, // parm_down_cursor -> down #1 lines (P*)
{ 0, "LE" }, // parm_left_cursor -> move #1 characters to the left (P) { nullptr, "LE" }, // parm_left_cursor -> move #1 characters to the left (P)
{ 0, "RI" }, // parm_right_cursor -> move #1 characters to the right (P*) { nullptr, "RI" }, // parm_right_cursor -> move #1 characters to the right (P*)
{ 0, "sc" }, // save_cursor -> save current cursor position (P) { nullptr, "sc" }, // save_cursor -> save current cursor position (P)
{ 0, "rc" }, // restore_cursor -> restore cursor to save_cursor { nullptr, "rc" }, // restore_cursor -> restore cursor to save_cursor
{ 0, "Ss" }, // set cursor style -> Select the DECSCUSR cursor style { nullptr, "Ss" }, // set cursor style -> Select the DECSCUSR cursor style
{ 0, "sf" }, // scroll_forward -> scroll text up (P) { nullptr, "sf" }, // scroll_forward -> scroll text up (P)
{ 0, "sr" }, // scroll_reverse -> scroll text down (P) { nullptr, "sr" }, // scroll_reverse -> scroll text down (P)
{ 0, "ti" }, // enter_ca_mode -> string to start programs using cup { nullptr, "ti" }, // enter_ca_mode -> string to start programs using cup
{ 0, "te" }, // exit_ca_mode -> strings to end programs using cup { nullptr, "te" }, // exit_ca_mode -> strings to end programs using cup
{ 0, "eA" }, // enable_acs -> enable alternate char set { nullptr, "eA" }, // enable_acs -> enable alternate char set
{ 0, "md" }, // enter_bold_mode -> turn on bold (double-bright) mode { nullptr, "md" }, // enter_bold_mode -> turn on bold (double-bright) mode
{ 0, "me" }, // exit_bold_mode -> turn off bold mode { nullptr, "me" }, // exit_bold_mode -> turn off bold mode
{ 0, "mh" }, // enter_dim_mode -> turn on half-bright { nullptr, "mh" }, // enter_dim_mode -> turn on half-bright
{ 0, "me" }, // exit_dim_mode -> turn off half-bright { nullptr, "me" }, // exit_dim_mode -> turn off half-bright
{ 0, "ZH" }, // enter_italics_mode -> Enter italic mode { nullptr, "ZH" }, // enter_italics_mode -> Enter italic mode
{ 0, "ZR" }, // exit_italics_mode -> End italic mode { nullptr, "ZR" }, // exit_italics_mode -> End italic mode
{ 0, "us" }, // enter_underline_mode -> begin underline mode { nullptr, "us" }, // enter_underline_mode -> begin underline mode
{ 0, "ue" }, // exit_underline_mode -> exit underline mode { nullptr, "ue" }, // exit_underline_mode -> exit underline mode
{ 0, "mb" }, // enter_blink_mode -> turn on blinking { nullptr, "mb" }, // enter_blink_mode -> turn on blinking
{ 0, "me" }, // exit_blink_mode -> turn off blinking { nullptr, "me" }, // exit_blink_mode -> turn off blinking
{ 0, "mr" }, // enter_reverse_mode -> turn on reverse video mode { nullptr, "mr" }, // enter_reverse_mode -> turn on reverse video mode
{ 0, "me" }, // exit_reverse_mode -> turn off reverse video mode { nullptr, "me" }, // exit_reverse_mode -> turn off reverse video mode
{ 0, "so" }, // enter_standout_mode -> begin standout mode { nullptr, "so" }, // enter_standout_mode -> begin standout mode
{ 0, "se" }, // exit_standout_mode -> exit standout mode { nullptr, "se" }, // exit_standout_mode -> exit standout mode
{ 0, "mk" }, // enter_secure_mode -> turn on blank mode (characters invisible) { nullptr, "mk" }, // enter_secure_mode -> turn on blank mode (characters invisible)
{ 0, "me" }, // exit_secure_mode -> turn off blank mode (characters visible) { nullptr, "me" }, // exit_secure_mode -> turn off blank mode (characters visible)
{ 0, "mp" }, // enter_protected_mode -> turn on protected mode { nullptr, "mp" }, // enter_protected_mode -> turn on protected mode
{ 0, "me" }, // exit_protected_mode -> turn off protected mode { nullptr, "me" }, // exit_protected_mode -> turn off protected mode
{ 0, "XX" }, // enter_crossed_out_mode -> turn on mark character as deleted { nullptr, "XX" }, // enter_crossed_out_mode -> turn on mark character as deleted
{ 0, "me" }, // exit_crossed_out_mode -> turn off mark character as deleted { nullptr, "me" }, // exit_crossed_out_mode -> turn off mark character as deleted
{ 0, "Us" }, // enter_dbl_underline_mode -> begin double underline mode { nullptr, "Us" }, // enter_dbl_underline_mode -> begin double underline mode
{ 0, "Ue" }, // exit_dbl_underline_mode -> exit double underline mode { nullptr, "Ue" }, // exit_dbl_underline_mode -> exit double underline mode
{ 0, "sa" }, // set_attributes -> define videoattributes #1-#9 (PG9) { nullptr, "sa" }, // set_attributes -> define videoattributes #1-#9 (PG9)
{ 0, "me" }, // exit_attribute_mode -> turn off all attributes { nullptr, "me" }, // exit_attribute_mode -> turn off all attributes
{ 0, "as" }, // enter_alt_charset_mode -> start alternate character set (P) { nullptr, "as" }, // enter_alt_charset_mode -> start alternate character set (P)
{ 0, "ae" }, // exit_alt_charset_mode -> end alternate character set (P) { nullptr, "ae" }, // exit_alt_charset_mode -> end alternate character set (P)
{ 0, "S2" }, // enter_pc_charset_mode -> Enter PC character display mode { nullptr, "S2" }, // enter_pc_charset_mode -> Enter PC character display mode
{ 0, "S3" }, // exit_pc_charset_mode -> Exit PC character display mode { nullptr, "S3" }, // exit_pc_charset_mode -> Exit PC character display mode
{ 0, "im" }, // enter_insert_mode -> enter insert mode { nullptr, "im" }, // enter_insert_mode -> enter insert mode
{ 0, "ei" }, // exit_insert_mode -> exit insert mode { nullptr, "ei" }, // exit_insert_mode -> exit insert mode
{ 0, "SA" }, // enter_am_mode -> turn on automatic margins { nullptr, "SA" }, // enter_am_mode -> turn on automatic margins
{ 0, "RA" }, // exit_am_mode -> turn off automatic margins { nullptr, "RA" }, // exit_am_mode -> turn off automatic margins
{ 0, "ac" }, // acs_chars -> graphics charset pairs (vt100) { nullptr, "ac" }, // acs_chars -> graphics charset pairs (vt100)
{ 0, "ks" }, // keypad_xmit -> enter 'key-board_transmit' mode { nullptr, "ks" }, // keypad_xmit -> enter 'key-board_transmit' mode
{ 0, "ke" }, // keypad_local -> leave 'key-board_transmit' mode { nullptr, "ke" }, // keypad_local -> leave 'key-board_transmit' mode
{ 0, "Km" }, // key_mouse -> Mouse event has occurred { nullptr, "Km" }, // key_mouse -> Mouse event has occurred
{ 0, "\0" } { nullptr, "\0" }
}; };
/* /*

View File

@ -197,7 +197,7 @@ bool FTermDetection::getTTYtype()
const char* termfilename = fterm_data->getTermFileName(); const char* termfilename = fterm_data->getTermFileName();
const char* term_basename = std::strrchr(termfilename, '/'); const char* term_basename = std::strrchr(termfilename, '/');
if ( term_basename == 0 ) if ( term_basename == nullptr )
term_basename = termfilename; term_basename = termfilename;
else else
term_basename++; term_basename++;
@ -205,10 +205,10 @@ bool FTermDetection::getTTYtype()
std::FILE* fp{}; std::FILE* fp{};
char str[BUFSIZ]{}; char str[BUFSIZ]{};
if ( fsystem && (fp = fsystem->fopen(ttytypename, "r")) != 0 ) if ( fsystem && (fp = fsystem->fopen(ttytypename, "r")) != nullptr )
{ {
// Read and parse the file // Read and parse the file
while ( fgets(str, sizeof(str) - 1, fp) != 0 ) while ( fgets(str, sizeof(str) - 1, fp) != nullptr )
{ {
const char* type{nullptr}; // nullptr == not found const char* type{nullptr}; // nullptr == not found
const char* name{nullptr}; const char* name{nullptr};
@ -218,15 +218,15 @@ bool FTermDetection::getTTYtype()
{ {
if ( std::isspace(uChar(*p)) ) if ( std::isspace(uChar(*p)) )
*p = '\0'; *p = '\0';
else if ( type == 0 ) else if ( type == nullptr )
type = p; type = p;
else if ( name == 0 && p != str && p[-1] == '\0' ) else if ( name == nullptr && p != str && p[-1] == '\0' )
name = p; name = p;
p++; p++;
} }
if ( type != 0 && name != 0 && ! std::strcmp(name, term_basename) ) if ( type != nullptr && name != nullptr && ! std::strcmp(name, term_basename) )
{ {
// Save name in termtype // Save name in termtype
std::strncpy (termtype, type, sizeof(termtype)); std::strncpy (termtype, type, sizeof(termtype));
@ -252,7 +252,7 @@ bool FTermDetection::getTTYSFileEntry()
const char* termfilename = fterm_data->getTermFileName(); const char* termfilename = fterm_data->getTermFileName();
const char* term_basename = std::strrchr(termfilename, '/'); const char* term_basename = std::strrchr(termfilename, '/');
if ( term_basename == 0 ) if ( term_basename == nullptr )
term_basename = termfilename; term_basename = termfilename;
else else
term_basename++; term_basename++;
@ -264,7 +264,7 @@ bool FTermDetection::getTTYSFileEntry()
{ {
const char* type = ttys_entryt->ty_type; const char* type = ttys_entryt->ty_type;
if ( type != 0 ) if ( type != nullptr )
{ {
// Save name in termtype // Save name in termtype
std::strncpy (termtype, type, sizeof(termtype)); std::strncpy (termtype, type, sizeof(termtype));
@ -424,25 +424,25 @@ bool FTermDetection::get256colorEnvString()
color_env.string6 = std::getenv("KONSOLE_DCOP"); color_env.string6 = std::getenv("KONSOLE_DCOP");
color_env.string7 = std::getenv("COLORFGBG"); color_env.string7 = std::getenv("COLORFGBG");
if ( color_env.string1 != 0 ) if ( color_env.string1 != nullptr )
return true; return true;
if ( color_env.string2 != 0 ) if ( color_env.string2 != nullptr )
return true; return true;
if ( color_env.string3 != 0 ) if ( color_env.string3 != nullptr )
return true; return true;
if ( color_env.string4 != 0 ) if ( color_env.string4 != nullptr )
return true; return true;
if ( color_env.string5 != 0 ) if ( color_env.string5 != nullptr )
return true; return true;
if ( color_env.string6 != 0 ) if ( color_env.string6 != nullptr )
return true; return true;
if ( color_env.string7 != 0 ) if ( color_env.string7 != nullptr )
return true; return true;
return false; return false;
@ -556,7 +556,7 @@ const FString FTermDetection::getXTermColorName (FColor color)
tv.tv_usec = 150000; // 150 ms tv.tv_usec = 150000; // 150 ms
// read the terminal answer // read the terminal answer
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0 ) if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
{ {
if ( std::scanf("\033]4;%10hu;%509[^\n]s", &color, temp) == 2 ) if ( std::scanf("\033]4;%10hu;%509[^\n]s", &color, temp) == 2 )
{ {
@ -590,7 +590,7 @@ char* FTermDetection::parseAnswerbackMsg (char current_termtype[])
catch (const std::bad_alloc& ex) catch (const std::bad_alloc& ex)
{ {
std::cerr << bad_alloc_str << ex.what() << std::endl; std::cerr << bad_alloc_str << ex.what() << std::endl;
return 0; return nullptr;
} }
if ( *answer_back == "PuTTY" ) if ( *answer_back == "PuTTY" )
@ -638,8 +638,8 @@ const FString FTermDetection::getAnswerbackMsg()
tv.tv_usec = 150000; // 150 ms tv.tv_usec = 150000; // 150 ms
// Read the answerback message // Read the answerback message
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0 ) if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
if ( std::fgets (temp, sizeof(temp) - 1, stdin) != 0 ) if ( std::fgets (temp, sizeof(temp) - 1, stdin) != nullptr )
answerback = temp; answerback = temp;
return answerback; return answerback;
@ -749,7 +749,7 @@ const FString FTermDetection::getSecDA()
tv.tv_usec = 600000; // 600 ms tv.tv_usec = 600000; // 600 ms
// Read the answer // Read the answer
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) == 1 if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) == 1
&& std::scanf("\033[>%10d;%10d;%10dc", &a, &b, &c) == 3 ) && std::scanf("\033[>%10d;%10d;%10dc", &a, &b, &c) == 3 )
sec_da_str.sprintf("\033[>%d;%d;%dc", a, b, c); sec_da_str.sprintf("\033[>%d;%d;%dc", a, b, c);
@ -801,7 +801,7 @@ char* FTermDetection::secDA_Analysis (char current_termtype[])
break; break;
case 82: // rxvt case 82: // rxvt
new_termtype = secDA_Analysis_82(current_termtype); new_termtype = secDA_Analysis_82();
break; break;
case 83: // screen case 83: // screen
@ -813,7 +813,7 @@ char* FTermDetection::secDA_Analysis (char current_termtype[])
break; break;
case 85: // rxvt-unicode case 85: // rxvt-unicode
new_termtype = secDA_Analysis_85(current_termtype); new_termtype = secDA_Analysis_85();
break; break;
default: default:
@ -933,11 +933,11 @@ inline char* FTermDetection::secDA_Analysis_77 (char[])
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline char* FTermDetection::secDA_Analysis_82 (char current_termtype[]) inline char* FTermDetection::secDA_Analysis_82()
{ {
// Terminal ID 82 - rxvt // Terminal ID 82 - rxvt
char* new_termtype = current_termtype; char* new_termtype{};
terminal_type.rxvt = true; terminal_type.rxvt = true;
if ( std::strncmp(termtype, "rxvt-", 5) != 0 if ( std::strncmp(termtype, "rxvt-", 5) != 0
@ -971,11 +971,11 @@ inline char* FTermDetection::secDA_Analysis_84 (char current_termtype[])
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline char* FTermDetection::secDA_Analysis_85 (char current_termtype[]) inline char* FTermDetection::secDA_Analysis_85()
{ {
// Terminal ID 85 - rxvt-unicode // Terminal ID 85 - rxvt-unicode
char* new_termtype = current_termtype; char* new_termtype{};
terminal_type.rxvt = true; terminal_type.rxvt = true;
terminal_type.urxvt = true; terminal_type.urxvt = true;

View File

@ -74,7 +74,7 @@ termios FTermios::getTTY()
struct termios t{}; struct termios t{};
if ( tcgetattr(stdin_no, &t) == -1 ) if ( tcgetattr(stdin_no, &t) == -1 )
std::runtime_error("Cannot find tty"); throw std::runtime_error("Cannot find tty");
return t; return t;
} }

View File

@ -704,7 +704,7 @@ const FString FTermXTerminal::captureXTermFont()
tv.tv_usec = 150000; // 150 ms tv.tv_usec = 150000; // 150 ms
// Read the terminal answer // Read the terminal answer
if ( select(stdin_no + 1, &ifds, 0, 0, &tv) > 0 ) if ( select(stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
{ {
char temp[150]{}; char temp[150]{};
@ -743,7 +743,7 @@ const FString FTermXTerminal::captureXTermTitle()
tv.tv_usec = 150000; // 150 ms tv.tv_usec = 150000; // 150 ms
// read the terminal answer // read the terminal answer
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0 ) if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 )
{ {
char temp[512]{}; char temp[512]{};

View File

@ -764,15 +764,15 @@ void FVTerm::removeArea (FTermArea*& area)
{ {
// remove the virtual window // remove the virtual window
if ( area != 0 ) if ( area != nullptr )
{ {
if ( area->changes != 0 ) if ( area->changes != nullptr )
{ {
delete[] area->changes; delete[] area->changes;
area->changes = nullptr; area->changes = nullptr;
} }
if ( area->data != 0 ) if ( area->data != nullptr )
{ {
delete[] area->data; delete[] area->data;
area->data = nullptr; area->data = nullptr;
@ -1363,10 +1363,10 @@ inline bool FVTerm::reallocateTextArea ( FTermArea* area
// Reallocate "height" lines for changes // Reallocate "height" lines for changes
// and "size" bytes for the text area // and "size" bytes for the text area
if ( area->changes != 0 ) if ( area->changes != nullptr )
delete[] area->changes; delete[] area->changes;
if ( area->data != 0 ) if ( area->data != nullptr )
delete[] area->data; delete[] area->data;
try try
@ -1388,7 +1388,7 @@ inline bool FVTerm::reallocateTextArea (FTermArea* area, std::size_t size)
{ {
// Reallocate "size" bytes for the text area // Reallocate "size" bytes for the text area
if ( area->data != 0 ) if ( area->data != nullptr )
delete[] area->data; delete[] area->data;
try try
@ -1702,15 +1702,15 @@ bool FVTerm::hasChildAreaChanges (FTermArea* area)
if ( ! area ) if ( ! area )
return false; return false;
for (auto&& pcall : area->preproc_list) return std::any_of ( area->preproc_list.begin()
, area->preproc_list.end()
, [] (const FVTermPreprocessing& pcall) -> bool
{ {
if ( pcall.instance return pcall.instance
&& pcall.instance->child_print_area && pcall.instance->child_print_area
&& pcall.instance->child_print_area->has_changes ) && pcall.instance->child_print_area->has_changes;
return true;
} }
);
return false;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2155,7 +2155,7 @@ bool FVTerm::clearFullArea (FTermArea* area, FChar& nc)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::clearAreaWithShadow (FTermArea* area, FChar& nc) void FVTerm::clearAreaWithShadow (FTermArea* area, const FChar& nc)
{ {
FChar t_char = nc; FChar t_char = nc;
const int total_width = area->width + area->right_shadow; const int total_width = area->width + area->right_shadow;
@ -2530,7 +2530,7 @@ void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::skipPaddingCharacter ( uInt& x, uInt y inline void FVTerm::skipPaddingCharacter ( uInt& x, uInt y
, FChar*& print_char ) , const FChar* const& print_char )
{ {
if ( isFullWidthChar(print_char) ) // full-width character if ( isFullWidthChar(print_char) ) // full-width character
{ {
@ -2661,13 +2661,13 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::isFullWidthChar (FChar*& ch) inline bool FVTerm::isFullWidthChar (const FChar* const& ch)
{ {
return bool(ch->attr.bit.char_width == 2); return bool(ch->attr.bit.char_width == 2);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FVTerm::isFullWidthPaddingChar (FChar*& ch) inline bool FVTerm::isFullWidthPaddingChar (const FChar* const& ch)
{ {
return ch->attr.bit.fullwidth_padding; return ch->attr.bit.fullwidth_padding;
} }

View File

@ -162,14 +162,14 @@ FWidget* FWidget::getParentWidget() const
if ( p_obj && p_obj->isWidget() ) if ( p_obj && p_obj->isWidget() )
return static_cast<FWidget*>(p_obj); return static_cast<FWidget*>(p_obj);
else else
return 0; return nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWidget* FWidget::getFirstFocusableWidget (FObjectList list) FWidget* FWidget::getFirstFocusableWidget (FObjectList list)
{ {
if ( list.empty() ) if ( list.empty() )
return 0; return nullptr;
auto iter = list.begin(); auto iter = list.begin();
@ -186,14 +186,14 @@ FWidget* FWidget::getFirstFocusableWidget (FObjectList list)
++iter; ++iter;
} }
return 0; return nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWidget* FWidget::getLastFocusableWidget (FObjectList list) FWidget* FWidget::getLastFocusableWidget (FObjectList list)
{ {
if ( list.empty() ) if ( list.empty() )
return 0; return nullptr;
auto iter = list.end(); auto iter = list.end();
@ -211,7 +211,7 @@ FWidget* FWidget::getLastFocusableWidget (FObjectList list)
} }
while ( iter != list.begin() ); while ( iter != list.begin() );
return 0; return nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -720,7 +720,7 @@ void FWidget::setDoubleFlatLine (fc::sides side, int pos, bool bit)
FWidget* FWidget::childWidgetAt (const FPoint& pos) FWidget* FWidget::childWidgetAt (const FPoint& pos)
{ {
if ( ! hasChildren() ) if ( ! hasChildren() )
return 0; return nullptr;
for (auto&& child : getChildren()) for (auto&& child : getChildren())
{ {
@ -735,11 +735,11 @@ FWidget* FWidget::childWidgetAt (const FPoint& pos)
&& widget->getTermGeometry().contains(pos) ) && widget->getTermGeometry().contains(pos) )
{ {
auto sub_child = widget->childWidgetAt(pos); auto sub_child = widget->childWidgetAt(pos);
return ( sub_child != 0 ) ? sub_child : widget; return ( sub_child != nullptr ) ? sub_child : widget;
} }
} }
return 0; return nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -995,11 +995,11 @@ void FWidget::show()
{ {
// Sets the initial screen settings // Sets the initial screen settings
initScreenSettings(); initScreenSettings();
// Draw the vdesktop
// draw the vdesktop
const auto& r = getRootWidget(); const auto& r = getRootWidget();
setColor(r->getForegroundColor(), r->getBackgroundColor()); setColor(r->getForegroundColor(), r->getBackgroundColor());
clearArea (getVirtualDesktop()); clearArea (getVirtualDesktop());
// Destop is now initialized
init_desktop = true; init_desktop = true;
} }

View File

@ -440,7 +440,7 @@ FWindow* FWindow::getWindowWidgetAt (int x, int y)
while ( iter != begin ); while ( iter != begin );
} }
return 0; return nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -489,7 +489,7 @@ FWindow* FWindow::getWindowWidget (const FWidget* obj)
if ( obj->isWindowWidget() ) if ( obj->isWindowWidget() )
return const_cast<FWindow*>(reinterpret_cast<const FWindow*>(obj)); return const_cast<FWindow*>(reinterpret_cast<const FWindow*>(obj));
else else
return 0; return nullptr;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -507,7 +507,7 @@ int FWindow::getWindowLayer (const FWidget* obj)
if ( ! obj->isWindowWidget() ) if ( ! obj->isWindowWidget() )
{ {
if ( (window = getWindowWidget(obj)) == 0 ) if ( (window = getWindowWidget(obj)) == nullptr )
return -1; return -1;
} }
else else

View File

@ -96,7 +96,7 @@ class FApplication : public FWidget
FApplication (const FApplication&) = delete; FApplication (const FApplication&) = delete;
// Destructor // Destructor
virtual ~FApplication(); ~FApplication() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FApplication& operator = (const FApplication&) = delete; FApplication& operator = (const FApplication&) = delete;
@ -154,7 +154,7 @@ class FApplication : public FWidget
void sendKeyboardAccelerator(); void sendKeyboardAccelerator();
void processKeyboardEvent(); void processKeyboardEvent();
bool processDialogSwitchAccelerator(); bool processDialogSwitchAccelerator();
bool processAccelerator (const FWidget*&); bool processAccelerator (const FWidget* const&);
bool getMouseEvent(); bool getMouseEvent();
FWidget*& determineClickedWidget(); FWidget*& determineClickedWidget();
void unsetMoveSizeMode(); void unsetMoveSizeMode();

View File

@ -68,7 +68,7 @@ class FButton : public FWidget
FButton (const FButton&) = delete; FButton (const FButton&) = delete;
// Destructor // Destructor
virtual ~FButton(); ~FButton() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FButton& operator = (const FButton&) = delete; FButton& operator = (const FButton&) = delete;

View File

@ -72,7 +72,7 @@ class FButtonGroup : public FScrollView
FButtonGroup (const FButtonGroup&) = delete; FButtonGroup (const FButtonGroup&) = delete;
// Destructor // Destructor
virtual ~FButtonGroup(); ~FButtonGroup() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FButtonGroup& operator = (const FButtonGroup&) = delete; FButtonGroup& operator = (const FButtonGroup&) = delete;

View File

@ -72,7 +72,7 @@ class FCheckBox : public FToggleButton
FCheckBox (const FCheckBox&) = delete; FCheckBox (const FCheckBox&) = delete;
// Destructor // Destructor
virtual ~FCheckBox(); ~FCheckBox() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FCheckBox& operator = (const FCheckBox&) = delete; FCheckBox& operator = (const FCheckBox&) = delete;

View File

@ -72,7 +72,7 @@ class FCheckMenuItem : public FMenuItem
FCheckMenuItem (const FCheckMenuItem&) = delete; FCheckMenuItem (const FCheckMenuItem&) = delete;
// Destructor // Destructor
virtual ~FCheckMenuItem(); ~FCheckMenuItem() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FCheckMenuItem& operator = (const FCheckMenuItem&) = delete; FCheckMenuItem& operator = (const FCheckMenuItem&) = delete;

View File

@ -77,7 +77,7 @@ class FDropDownListBox : public FWindow
FDropDownListBox (const FDropDownListBox&) = delete; FDropDownListBox (const FDropDownListBox&) = delete;
// Destructor // Destructor
virtual ~FDropDownListBox (); ~FDropDownListBox () override;
// Disable assignment operator (=) // Disable assignment operator (=)
FDropDownListBox& operator = (const FDropDownListBox&) = delete; FDropDownListBox& operator = (const FDropDownListBox&) = delete;
@ -139,7 +139,7 @@ class FComboBox : public FWidget
FComboBox (const FComboBox&) = delete; FComboBox (const FComboBox&) = delete;
// Destructor // Destructor
~FComboBox(); ~FComboBox() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FComboBox& operator = (const FComboBox&) = delete; FComboBox& operator = (const FComboBox&) = delete;
@ -211,7 +211,7 @@ class FComboBox : public FWidget
void draw() override; void draw() override;
void onePosUp(); void onePosUp();
void onePosDown(); void onePosDown();
void passEventToListWindow (FMouseEvent*&); void passEventToListWindow (FMouseEvent* const&);
void processClick(); void processClick();
void processChanged(); void processChanged();

View File

@ -85,7 +85,7 @@ class FDialog : public FWindow
FDialog (const FDialog&) = delete; FDialog (const FDialog&) = delete;
// Destructor // Destructor
virtual ~FDialog(); ~FDialog() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FDialog& operator = (const FDialog&) = delete; FDialog& operator = (const FDialog&) = delete;

View File

@ -78,7 +78,7 @@ class FDialogListMenu : public FMenu
FDialogListMenu (const FDialogListMenu&) = delete; FDialogListMenu (const FDialogListMenu&) = delete;
// Destructor // Destructor
virtual ~FDialogListMenu(); ~FDialogListMenu() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FDialogListMenu& operator = (const FDialogListMenu&) = delete; FDialogListMenu& operator = (const FDialogListMenu&) = delete;

View File

@ -106,7 +106,7 @@ class FFileDialog : public FDialog
, FWidget* = nullptr ); , FWidget* = nullptr );
// Destructor // Destructor
virtual ~FFileDialog(); ~FFileDialog() override;
// Assignment operator (=) // Assignment operator (=)
FFileDialog& operator = (const FFileDialog&); FFileDialog& operator = (const FFileDialog&);

View File

@ -73,7 +73,7 @@ class FLabel : public FWidget
FLabel (const FLabel&) = delete; FLabel (const FLabel&) = delete;
// Destructor // Destructor
virtual ~FLabel(); ~FLabel() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FLabel& operator = (const FLabel&) = delete; FLabel& operator = (const FLabel&) = delete;

View File

@ -89,7 +89,7 @@ class FLineEdit : public FWidget
FLineEdit (const FLineEdit&) = delete; FLineEdit (const FLineEdit&) = delete;
// Destructor // Destructor
virtual ~FLineEdit(); ~FLineEdit() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FLineEdit& operator = (const FLineEdit&) = delete; FLineEdit& operator = (const FLineEdit&) = delete;

View File

@ -154,7 +154,7 @@ class FListBox : public FWidget
FListBox (const FListBox&) = delete; FListBox (const FListBox&) = delete;
// Destructor // Destructor
virtual ~FListBox(); ~FListBox() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FListBox& operator = (const FListBox&) = delete; FListBox& operator = (const FListBox&) = delete;

View File

@ -78,7 +78,7 @@ class FListViewItem : public FObject
, iterator ); , iterator );
// Destructor // Destructor
virtual ~FListViewItem(); ~FListViewItem() override;
// Assignment operator (=) // Assignment operator (=)
FListViewItem& operator = (const FListViewItem&); FListViewItem& operator = (const FListViewItem&);
@ -265,7 +265,7 @@ class FListView : public FWidget
FListView (const FListView&) = delete; FListView (const FListView&) = delete;
// Destructor // Destructor
virtual ~FListView(); ~FListView() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FListView& operator = (const FListView&) = delete; FListView& operator = (const FListView&) = delete;
@ -556,7 +556,7 @@ inline FObject::iterator
inline FObject::iterator inline FObject::iterator
FListView::insert ( const FStringList& cols FListView::insert ( const FStringList& cols
, iterator parent_iter ) , iterator parent_iter )
{ return insert (cols, 0, parent_iter); } { return insert (cols, nullptr, parent_iter); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
template<typename T> template<typename T>

View File

@ -79,7 +79,7 @@ class FMenu : public FWindow, public FMenuList
FMenu (const FMenu&) = delete; FMenu (const FMenu&) = delete;
// Destructor // Destructor
virtual ~FMenu(); ~FMenu() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FMenu& operator = (const FMenu&) = delete; FMenu& operator = (const FMenu&) = delete;
@ -183,9 +183,9 @@ class FMenu : public FWindow, public FMenuList
void mouseMoveDeselection (FMenuItem*, mouseStates&); void mouseMoveDeselection (FMenuItem*, mouseStates&);
void mouseUpOverBorder(); void mouseUpOverBorder();
void mouseMoveOverBorder (mouseStates&); void mouseMoveOverBorder (mouseStates&);
void passEventToSubMenu (FMouseEvent*&); void passEventToSubMenu (FMouseEvent* const&);
void passEventToSuperMenu (FMouseEvent*&); void passEventToSuperMenu (FMouseEvent* const&);
void passEventToMenuBar (FMouseEvent*&); void passEventToMenuBar (FMouseEvent* const&);
bool containsMenuStructure (const FPoint&); bool containsMenuStructure (const FPoint&);
bool containsMenuStructure (int, int); bool containsMenuStructure (int, int);
FMenu* superMenuAt (const FPoint&); FMenu* superMenuAt (const FPoint&);

View File

@ -77,7 +77,7 @@ class FMenuBar : public FWindow, public FMenuList
FMenuBar (const FMenuBar&) = delete; FMenuBar (const FMenuBar&) = delete;
// Destructor // Destructor
virtual ~FMenuBar(); ~FMenuBar() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FMenuBar& operator = (const FMenuBar&) = delete; FMenuBar& operator = (const FMenuBar&) = delete;
@ -139,7 +139,7 @@ class FMenuBar : public FWindow, public FMenuList
void mouseDownOverList (const FMouseEvent*); void mouseDownOverList (const FMouseEvent*);
void mouseUpOverList (const FMouseEvent*); void mouseUpOverList (const FMouseEvent*);
void mouseMoveOverList (const FMouseEvent*); void mouseMoveOverList (const FMouseEvent*);
void passEventToMenu (const FMouseEvent*&); void passEventToMenu (const FMouseEvent* const&);
void leaveMenuBar(); void leaveMenuBar();
// Data members // Data members

View File

@ -82,7 +82,7 @@ class FMenuItem : public FWidget
FMenuItem (const FMenuItem&) = delete; FMenuItem (const FMenuItem&) = delete;
// Destructor // Destructor
virtual ~FMenuItem(); ~FMenuItem() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FMenuItem& operator = (const FMenuItem&) = delete; FMenuItem& operator = (const FMenuItem&) = delete;
@ -293,7 +293,7 @@ inline bool FMenuItem::hasHotkey() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FMenuItem::hasMenu() const inline bool FMenuItem::hasMenu() const
{ return bool(menu != 0); } { return bool(menu != nullptr); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FWidget* FMenuItem::getSuperMenu() const inline FWidget* FMenuItem::getSuperMenu() const

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2015-2019 Markus Gans * * Copyright 2015-2020 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -113,7 +113,7 @@ inline std::size_t FMenuList::getCount() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FMenuItem* FMenuList::getItem (int index) const inline FMenuItem* FMenuList::getItem (int index) const
{ return ( index > 0 ) ? item_list[uInt(index - 1)] : 0; } { return ( index > 0 ) ? item_list[uInt(index - 1)] : nullptr; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FMenuItem* FMenuList::getSelectedItem() const inline FMenuItem* FMenuList::getSelectedItem() const

View File

@ -95,7 +95,7 @@ class FMessageBox : public FDialog
, int, int, int , int, int, int
, FWidget* = nullptr ); , FWidget* = nullptr );
// Destructor // Destructor
virtual ~FMessageBox(); ~FMessageBox() override;
// Assignment operator (=) // Assignment operator (=)
FMessageBox& operator = (const FMessageBox&); FMessageBox& operator = (const FMessageBox&);

View File

@ -204,7 +204,7 @@ class FMouseGPM final : public FMouse
FMouseGPM(); FMouseGPM();
// Destructor // Destructor
virtual ~FMouseGPM(); ~FMouseGPM() override;
// Accessors // Accessors
const FString getClassName() const override; const FString getClassName() const override;
@ -272,7 +272,7 @@ class FMouseX11 final : public FMouse
FMouseX11() = default; FMouseX11() = default;
// Destructor // Destructor
virtual ~FMouseX11() = default; ~FMouseX11() override = default;
// Accessors // Accessors
const FString getClassName() const override; const FString getClassName() const override;
@ -331,7 +331,7 @@ class FMouseSGR final : public FMouse
FMouseSGR() = default; FMouseSGR() = default;
// Destructor // Destructor
virtual ~FMouseSGR() = default; ~FMouseSGR() override = default;
// Accessors // Accessors
const FString getClassName() const override; const FString getClassName() const override;
@ -390,7 +390,7 @@ class FMouseUrxvt final : public FMouse
FMouseUrxvt() = default; FMouseUrxvt() = default;
// Destructor // Destructor
virtual ~FMouseUrxvt() = default; ~FMouseUrxvt() override = default;
// Accessors // Accessors
const FString getClassName() const override; const FString getClassName() const override;

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2016-2019 Markus Gans * * Copyright 2016-2020 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -172,7 +172,7 @@ class FOptiAttr final
void set_orig_orig_colors (char[]); void set_orig_orig_colors (char[]);
// Inquiry // Inquiry
static bool isNormal (FChar*&); static bool isNormal (const FChar* const&);
// Methods // Methods
void initialize(); void initialize();
@ -258,12 +258,12 @@ class FOptiAttr final
void setAttributesOff (FChar*&); void setAttributesOff (FChar*&);
// Inquiries // Inquiries
static bool hasColor (FChar*&); static bool hasColor (const FChar* const&);
static bool hasAttribute (FChar*&); static bool hasAttribute (const FChar* const&);
static bool hasNoAttribute (FChar*&); static bool hasNoAttribute (const FChar* const&);
// Methods // Methods
bool hasColorChanged (FChar*&, FChar*&); bool hasColorChanged (const FChar* const&, const FChar* const&);
void resetColor (FChar*&); void resetColor (FChar*&);
void prevent_no_color_video_attributes (FChar*&, bool = false); void prevent_no_color_video_attributes (FChar*&, bool = false);
void deactivateAttributes (FChar*&, FChar*&); void deactivateAttributes (FChar*&, FChar*&);
@ -271,13 +271,13 @@ class FOptiAttr final
void changeAttributeSeparately (FChar*&, FChar*&); void changeAttributeSeparately (FChar*&, FChar*&);
void change_color (FChar*&, FChar*&); void change_color (FChar*&, FChar*&);
void change_to_default_color (FChar*&, FChar*&, FColor&, FColor&); void change_to_default_color (FChar*&, FChar*&, FColor&, FColor&);
void change_current_color (FChar*&, FColor, FColor); void change_current_color (const FChar* const&, FColor, FColor);
void resetAttribute (FChar*&); void resetAttribute (FChar*&);
void reset (FChar*&); void reset (FChar*&);
bool caused_reset_attributes (char[], uChar = all_tests); bool caused_reset_attributes (char[], uChar = all_tests);
bool hasCharsetEquivalence(); bool hasCharsetEquivalence();
void detectSwitchOn (FChar*&, FChar*&); void detectSwitchOn (const FChar* const&, const FChar* const&);
void detectSwitchOff (FChar*&, FChar*&); void detectSwitchOff (const FChar* const&, const FChar* const&);
bool switchOn(); bool switchOn();
bool switchOff(); bool switchOff();
bool append_sequence (char[]); bool append_sequence (char[]);

View File

@ -66,7 +66,7 @@ class FProgressbar : public FWidget
explicit FProgressbar(FWidget* = nullptr); explicit FProgressbar(FWidget* = nullptr);
// Destructor // Destructor
virtual ~FProgressbar(); ~FProgressbar() override;
// Accessors // Accessors
const FString getClassName() const override; const FString getClassName() const override;

View File

@ -72,7 +72,7 @@ class FRadioButton : public FToggleButton
FRadioButton (const FRadioButton&) = delete; FRadioButton (const FRadioButton&) = delete;
// Destructor // Destructor
virtual ~FRadioButton(); ~FRadioButton() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FRadioButton& operator = (const FRadioButton&) = delete; FRadioButton& operator = (const FRadioButton&) = delete;

View File

@ -72,7 +72,7 @@ class FRadioMenuItem : public FMenuItem
FRadioMenuItem (const FRadioMenuItem&) = delete; FRadioMenuItem (const FRadioMenuItem&) = delete;
// Destructor // Destructor
virtual ~FRadioMenuItem(); ~FRadioMenuItem() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FRadioMenuItem& operator = (const FRadioMenuItem&) = delete; FRadioMenuItem& operator = (const FRadioMenuItem&) = delete;

View File

@ -92,7 +92,7 @@ class FScrollbar : public FWidget
FScrollbar (const FScrollbar&) = delete; FScrollbar (const FScrollbar&) = delete;
// Destructor // Destructor
virtual ~FScrollbar(); ~FScrollbar() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FScrollbar& operator = (const FScrollbar&) = delete; FScrollbar& operator = (const FScrollbar&) = delete;

View File

@ -74,7 +74,7 @@ class FScrollView : public FWidget
FScrollView (const FScrollView&) = delete; FScrollView (const FScrollView&) = delete;
// Destructor // Destructor
virtual ~FScrollView(); ~FScrollView() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FScrollView& operator = (const FScrollView&) = delete; FScrollView& operator = (const FScrollView&) = delete;

View File

@ -72,7 +72,7 @@ class FSpinBox : public FWidget
FSpinBox (const FSpinBox&) = delete; FSpinBox (const FSpinBox&) = delete;
// Destructor // Destructor
~FSpinBox(); ~FSpinBox() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FSpinBox& operator = (const FSpinBox&) = delete; FSpinBox& operator = (const FSpinBox&) = delete;

View File

@ -81,7 +81,7 @@ class FStatusKey : public FWidget
FStatusKey (const FStatusKey&) = delete; FStatusKey (const FStatusKey&) = delete;
// Destructor // Destructor
virtual ~FStatusKey(); ~FStatusKey() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FStatusKey& operator = (const FStatusKey&) = delete; FStatusKey& operator = (const FStatusKey&) = delete;
@ -190,7 +190,7 @@ class FStatusBar : public FWindow
FStatusBar (const FStatusBar&) = delete; FStatusBar (const FStatusBar&) = delete;
// Destructor // Destructor
virtual ~FStatusBar(); ~FStatusBar() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FStatusBar& operator = (const FStatusBar&) = delete; FStatusBar& operator = (const FStatusBar&) = delete;

View File

@ -72,7 +72,7 @@ class FSwitch : public FToggleButton
FSwitch (const FSwitch&) = delete; FSwitch (const FSwitch&) = delete;
// Destructor // Destructor
virtual ~FSwitch(); ~FSwitch() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FSwitch& operator = (const FSwitch&) = delete; FSwitch& operator = (const FSwitch&) = delete;

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2019 Markus Gans * * Copyright 2019-2020 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -95,7 +95,7 @@ class FSystemImpl : public FSystem
FSystemImpl(); FSystemImpl();
// Destructor // Destructor
virtual ~FSystemImpl(); ~FSystemImpl() override;
// Methods // Methods
#if defined(ISA_SYSCTL_SUPPORT) #if defined(ISA_SYSCTL_SUPPORT)

View File

@ -210,7 +210,7 @@ class FTerm final
#endif #endif
// Inquiries // Inquiries
static bool isNormal (FChar*&); static bool isNormal (const FChar* const&);
static bool isRaw(); static bool isRaw();
static bool hasUTF8(); static bool hasUTF8();
static bool hasVT100(); static bool hasVT100();
@ -424,8 +424,7 @@ inline bool FTerm::unsetUTF8()
template<typename... Args> template<typename... Args>
inline void FTerm::putstringf (const char format[], Args&&... args) inline void FTerm::putstringf (const char format[], Args&&... args)
{ {
const int size = std::snprintf ( nullptr, 0, format const int size = std::snprintf (nullptr, 0, format, args...) + 1;
, std::forward<Args>(args)... ) + 1;
if ( size == -1 ) if ( size == -1 )
return; return;

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2016-2019 Markus Gans * * Copyright 2016-2020 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -87,7 +87,7 @@ class FTermcap final
FTermcap() = default; FTermcap() = default;
// Destructor // Destructor
~FTermcap() = default; virtual ~FTermcap() = default;
// Accessors // Accessors
const FString getClassName() const; const FString getClassName() const;

View File

@ -57,13 +57,15 @@ class FTermData final
typedef std::unordered_map<std::string, fc::encoding> encodingMap; typedef std::unordered_map<std::string, fc::encoding> encodingMap;
// Constructors // Constructors
FTermData() {} FTermData()
{ }
// Disable copy constructor // Disable copy constructor
FTermData (const FTermData&) = delete; FTermData (const FTermData&) = delete;
// Destructor // Destructor
~FTermData() {} ~FTermData()
{ }
// Disable assignment operator (=) // Disable assignment operator (=)
FTermData& operator = (const FTermData&) = delete; FTermData& operator = (const FTermData&) = delete;

View File

@ -176,10 +176,10 @@ class FTermDetection final
static char* secDA_Analysis_65 (char[]); static char* secDA_Analysis_65 (char[]);
static char* secDA_Analysis_67 (char[]); static char* secDA_Analysis_67 (char[]);
static char* secDA_Analysis_77 (char[]); static char* secDA_Analysis_77 (char[]);
static char* secDA_Analysis_82 (char[]); static char* secDA_Analysis_82 ();
static char* secDA_Analysis_83 (char[]); static char* secDA_Analysis_83 (char[]);
static char* secDA_Analysis_84 (char[]); static char* secDA_Analysis_84 (char[]);
static char* secDA_Analysis_85 (char[]); static char* secDA_Analysis_85 ();
static char* secDA_Analysis_vte (char[]); static char* secDA_Analysis_vte (char[]);
// Data members // Data members

View File

@ -76,7 +76,7 @@ class FTextView : public FWidget
FTextView (const FTextView&) = delete; FTextView (const FTextView&) = delete;
// Destructor // Destructor
virtual ~FTextView(); ~FTextView() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FTextView& operator = (const FTextView&) = delete; FTextView& operator = (const FTextView&) = delete;

View File

@ -73,7 +73,7 @@ class FToggleButton : public FWidget
FToggleButton (const FToggleButton&) = delete; FToggleButton (const FToggleButton&) = delete;
// Destructor // Destructor
virtual ~FToggleButton(); ~FToggleButton() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FToggleButton& operator = (const FToggleButton&) = delete; FToggleButton& operator = (const FToggleButton&) = delete;

View File

@ -74,7 +74,7 @@ class FToolTip : public FWindow
FToolTip (const FToolTip&) = delete; FToolTip (const FToolTip&) = delete;
// Destructor // Destructor
virtual ~FToolTip (); ~FToolTip () override;
// Disable assignment operator (=) // Disable assignment operator (=)
FToolTip& operator = (const FToolTip&) = delete; FToolTip& operator = (const FToolTip&) = delete;

View File

@ -437,7 +437,7 @@ class FVTerm
, FChar*& ); , FChar*& );
bool clearTerm (int = ' '); bool clearTerm (int = ' ');
bool clearFullArea (FTermArea*, FChar&); bool clearFullArea (FTermArea*, FChar&);
static void clearAreaWithShadow (FTermArea*, FChar&); static void clearAreaWithShadow (FTermArea*, const FChar&);
static bool canClearToEOL (uInt, uInt); static bool canClearToEOL (uInt, uInt);
static bool canClearLeadingWS (uInt&, uInt); static bool canClearLeadingWS (uInt&, uInt);
static bool canClearTrailingWS (uInt&, uInt); static bool canClearTrailingWS (uInt&, uInt);
@ -448,11 +448,11 @@ class FVTerm
void printFullWidthCharacter (uInt&, uInt, FChar*&); void printFullWidthCharacter (uInt&, uInt, FChar*&);
void printFullWidthPaddingCharacter (uInt&, uInt, FChar*&); void printFullWidthPaddingCharacter (uInt&, uInt, FChar*&);
void printHalfCovertFullWidthCharacter (uInt&, uInt, FChar*&); void printHalfCovertFullWidthCharacter (uInt&, uInt, FChar*&);
void skipPaddingCharacter (uInt&, uInt, FChar*&); void skipPaddingCharacter (uInt&, uInt, const FChar* const&);
exit_state eraseCharacters (uInt&, uInt, uInt, bool); exit_state eraseCharacters (uInt&, uInt, uInt, bool);
exit_state repeatCharacter (uInt&, uInt, uInt); exit_state repeatCharacter (uInt&, uInt, uInt);
bool isFullWidthChar (FChar*&); bool isFullWidthChar (const FChar* const&);
bool isFullWidthPaddingChar (FChar*&); bool isFullWidthPaddingChar (const FChar* const&);
static void cursorWrap(); static void cursorWrap();
bool printWrap (FTermArea*); bool printWrap (FTermArea*);
void printPaddingCharacter (FTermArea*, FChar&); void printPaddingCharacter (FTermArea*, FChar&);

View File

@ -177,7 +177,7 @@ class FWidget : public FVTerm, public FObject
FWidget (const FWidget&) = delete; FWidget (const FWidget&) = delete;
// Destructor // Destructor
virtual ~FWidget(); ~FWidget() override;
// Disable assignment operator (=) // Disable assignment operator (=)
FWidget& operator = (const FWidget&) = delete; FWidget& operator = (const FWidget&) = delete;

View File

@ -77,7 +77,7 @@ class FWindow : public FWidget
FWindow (const FWindow&) = delete; FWindow (const FWindow&) = delete;
// Destructor // Destructor
virtual ~FWindow (); ~FWindow () override;
// Disable assignment operator (=) // Disable assignment operator (=)
FWindow& operator = (const FWindow&) = delete; FWindow& operator = (const FWindow&) = delete;

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2019 Markus Gans * * Copyright 2019-2020 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -54,7 +54,7 @@ class SGRoptimizer final
typedef char attributebuffer[ATTR_BUF_SIZE]; typedef char attributebuffer[ATTR_BUF_SIZE];
// Constructors // Constructors
SGRoptimizer (attributebuffer&); explicit SGRoptimizer (attributebuffer&);
// Destructor // Destructor
virtual ~SGRoptimizer(); virtual ~SGRoptimizer();

View File

@ -269,6 +269,12 @@ void FOptiAttrTest::sgrOptimizerTest()
sgr_optimizer.optimize(); sgr_optimizer.optimize();
CPPUNIT_ASSERT_CSTRING ( buffer, C_STR(CSI "0;38;5;20;48;5;229m") ); CPPUNIT_ASSERT_CSTRING ( buffer, C_STR(CSI "0;38;5;20;48;5;229m") );
std::strcpy(buffer, CSI "m" CSI "38;5;20m" XXXX<<< CSI "48;5;229m");
sgr_optimizer.optimize();
CPPUNIT_ASSERT_CSTRING ( buffer, C_STR(CSI "0;38;5;20;48;5;229m") );
std::strcpy(buffer, CSI "m" CSI "1m" CSI "2m" CSI "3m" CSI "4m" std::strcpy(buffer, CSI "m" CSI "1m" CSI "2m" CSI "3m" CSI "4m"
CSI "5m" CSI "7m" CSI "8m" CSI "9m"); CSI "5m" CSI "7m" CSI "8m" CSI "9m");
sgr_optimizer.optimize(); sgr_optimizer.optimize();