diff --git a/examples/7segment.cpp b/examples/7segment.cpp index 81f83237..82d61ddc 100644 --- a/examples/7segment.cpp +++ b/examples/7segment.cpp @@ -39,6 +39,10 @@ using finalcut::FSize; class SegmentView final : public finalcut::FDialog { public: + // Using-declaration + using FDialog::setGeometry; + + // Constructor explicit SegmentView (finalcut::FWidget* = nullptr); private: @@ -55,11 +59,15 @@ class SegmentView final : public finalcut::FDialog unsigned char : 1; // padding bit } sevenSegment; + // Mutator + void setGeometry (const FRect&, bool = true) override; + // Methods void hexEncoding(); void get7Segment (const wchar_t); void draw() override; + // Data members std::map code{}; finalcut::FString line[3]; @@ -108,6 +116,14 @@ SegmentView::SegmentView (finalcut::FWidget* parent) ); } +//---------------------------------------------------------------------- +void SegmentView::setGeometry (const FRect& box, bool adjust) +{ + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FDialog::setGeometry (box, adjust); +} + //---------------------------------------------------------------------- void SegmentView::hexEncoding() { diff --git a/examples/background-color.cpp b/examples/background-color.cpp index c4411203..3f4c73a8 100644 --- a/examples/background-color.cpp +++ b/examples/background-color.cpp @@ -27,6 +27,7 @@ #include using finalcut::FPoint; +using finalcut::FRect; using finalcut::FSize; @@ -37,10 +38,13 @@ using finalcut::FSize; class Background final : public finalcut::FDialog { public: + // Using-declaration + using FDialog::setGeometry; + // Typedef typedef std::tuple RGB; - // Constructors + // Constructor explicit Background (finalcut::FWidget* = nullptr); // Disable copy constructor @@ -53,6 +57,9 @@ class Background final : public finalcut::FDialog Background& operator = (const Background&) = delete; private: + // Mutator + void setGeometry (const FRect&, bool = true) override; + // Callback method void cb_changed (const finalcut::FWidget*, const FDataPtr); void cb_choice (const finalcut::FWidget*, const FDataPtr); @@ -168,6 +175,14 @@ Background::Background (finalcut::FWidget* parent) Background::~Background() // destructor { } +//---------------------------------------------------------------------- +void Background::setGeometry (const FRect& box, bool adjust) +{ + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FDialog::setGeometry (box, adjust); +} + //---------------------------------------------------------------------- void Background::cb_changed (const finalcut::FWidget*, const FDataPtr) { diff --git a/examples/calculator.cpp b/examples/calculator.cpp index 87c62951..4d480b6b 100644 --- a/examples/calculator.cpp +++ b/examples/calculator.cpp @@ -32,6 +32,7 @@ namespace fc = finalcut::fc; using finalcut::FPoint; +using finalcut::FRect; using finalcut::FSize; using finalcut::FColorPair; @@ -109,12 +110,18 @@ void Button::onKeyPress (finalcut::FKeyEvent* ev) class Calc final : public finalcut::FDialog { public: + // Using-declaration + using FDialog::setGeometry; + // Constructor explicit Calc (finalcut::FWidget* parent = nullptr); // Destructor ~Calc() override; + // Mutator + void setGeometry (const FRect&, bool = true) override; + // Event handlers void onKeyPress (finalcut::FKeyEvent*) override; void onClose (finalcut::FCloseEvent*) override; @@ -299,6 +306,105 @@ Calc::Calc (FWidget* parent) Calc::~Calc() { } +//---------------------------------------------------------------------- +void Calc::setGeometry (const FRect& box, bool adjust) +{ + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FDialog::setGeometry (box, adjust); +} + +//---------------------------------------------------------------------- +void Calc::onKeyPress (finalcut::FKeyEvent* ev) +{ + const std::size_t len = input.getLength(); + const FKey key = ev->key(); + + switch ( key ) + { + case fc::Fkey_erase: + case fc::Fkey_backspace: + if ( len > 0 ) + { + lDouble& x = getValue(); + + if ( len == 1 ) + { + input = ""; + x = 0.0L; + } + else + { + input = input.left(input.getLength() - 1); + x = std::strtold(input.c_str(), nullptr); + } + + drawDispay(); + updateTerminal(); + } + + ev->accept(); + break; + + case fc::Fkey_escape: + case fc::Fkey_escape_mintty: + { + finalcut::FAccelEvent a_ev( fc::Accelerator_Event + , getFocusWidget() ); + calculator_buttons[On]->onAccel(&a_ev); + } + ev->accept(); + break; + + case 'q': + close(); + ev->accept(); + break; + + default: + finalcut::FDialog::onKeyPress(ev); + break; + } +} + +//---------------------------------------------------------------------- +void Calc::onClose (finalcut::FCloseEvent* ev) +{ + finalcut::FApplication::closeConfirmationDialog (this, ev); +} + +//---------------------------------------------------------------------- +void Calc::cb_buttonClicked (const finalcut::FWidget*, FDataPtr data) +{ + lDouble& x = getValue(); + const Calc::button& key = *(static_cast(data)); + + // Call the key function + (this->*key_map[key])(x); + + if ( ! input.isEmpty() ) + { + if ( isDataEntryKey(key) ) + x = lDouble(input.toDouble()); + else + { + // Remove trailing zeros + while ( ! input.includes(L'e') + && input.includes(L'.') + && input.back() == L'0' ) + input = input.left(input.getLength() - 1); + } + } + + drawDispay(); + updateTerminal(); + + if ( infix_operator && ! isDataEntryKey(key) ) + input = ""; + + last_key = key; +} + //---------------------------------------------------------------------- void Calc::drawDispay() { @@ -977,97 +1083,6 @@ void Calc::calcInfixOperator() clearInfixOperator(); } -//---------------------------------------------------------------------- -void Calc::onKeyPress (finalcut::FKeyEvent* ev) -{ - const std::size_t len = input.getLength(); - const FKey key = ev->key(); - - switch ( key ) - { - case fc::Fkey_erase: - case fc::Fkey_backspace: - if ( len > 0 ) - { - lDouble& x = getValue(); - - if ( len == 1 ) - { - input = ""; - x = 0.0L; - } - else - { - input = input.left(input.getLength() - 1); - x = std::strtold(input.c_str(), nullptr); - } - - drawDispay(); - updateTerminal(); - } - - ev->accept(); - break; - - case fc::Fkey_escape: - case fc::Fkey_escape_mintty: - { - finalcut::FAccelEvent a_ev( fc::Accelerator_Event - , getFocusWidget() ); - calculator_buttons[On]->onAccel(&a_ev); - } - ev->accept(); - break; - - case 'q': - close(); - ev->accept(); - break; - - default: - finalcut::FDialog::onKeyPress(ev); - break; - } -} - -//---------------------------------------------------------------------- -void Calc::onClose (finalcut::FCloseEvent* ev) -{ - finalcut::FApplication::closeConfirmationDialog (this, ev); -} - -//---------------------------------------------------------------------- -void Calc::cb_buttonClicked (const finalcut::FWidget*, FDataPtr data) -{ - lDouble& x = getValue(); - const Calc::button& key = *(static_cast(data)); - - // Call the key function - (this->*key_map[key])(x); - - if ( ! input.isEmpty() ) - { - if ( isDataEntryKey(key) ) - x = lDouble(input.toDouble()); - else - { - // Remove trailing zeros - while ( ! input.includes(L'e') - && input.includes(L'.') - && input.back() == L'0' ) - input = input.left(input.getLength() - 1); - } - } - - drawDispay(); - updateTerminal(); - - if ( infix_operator && ! isDataEntryKey(key) ) - input = ""; - - last_key = key; -} - //---------------------------------------------------------------------- void Calc::adjustSize() { diff --git a/examples/checklist.cpp b/examples/checklist.cpp index a2fd7a69..48f0c5aa 100644 --- a/examples/checklist.cpp +++ b/examples/checklist.cpp @@ -29,6 +29,7 @@ namespace fc = finalcut::fc; using finalcut::FPoint; +using finalcut::FRect; using finalcut::FSize; @@ -39,6 +40,9 @@ using finalcut::FSize; class CheckList final : public finalcut::FDialog { public: + // Using-declaration + using FDialog::setGeometry; + // Constructor explicit CheckList (finalcut::FWidget* = nullptr); @@ -51,6 +55,9 @@ class CheckList final : public finalcut::FDialog // Disable copy assignment operator (=) CheckList& operator = (const CheckList&) = delete; + // Mutator + void setGeometry (const FRect&, bool = true) override; + private: // Method void populate(); @@ -111,6 +118,14 @@ CheckList::CheckList (finalcut::FWidget* parent) CheckList::~CheckList() // destructor { } +//---------------------------------------------------------------------- +void CheckList::setGeometry (const FRect& box, bool adjust) +{ + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FDialog::setGeometry (box, adjust); +} + //---------------------------------------------------------------------- void CheckList::populate() { diff --git a/examples/mouse.cpp b/examples/mouse.cpp index 5189db9c..506a63ae 100644 --- a/examples/mouse.cpp +++ b/examples/mouse.cpp @@ -53,6 +53,9 @@ class ColorChooser final : public finalcut::FWidget FColor getBackground(); private: + // Mutator + void setSize (const FSize&, bool = true) override; + // Method void draw() override; void drawBorder() override; @@ -66,6 +69,7 @@ class ColorChooser final : public finalcut::FWidget finalcut::FLabel headline{this}; }; + //---------------------------------------------------------------------- ColorChooser::ColorChooser (finalcut::FWidget* parent) : FWidget(parent) @@ -96,31 +100,23 @@ ColorChooser::~ColorChooser() { } //---------------------------------------------------------------------- -void ColorChooser::onMouseDown (finalcut::FMouseEvent* ev) +inline FColor ColorChooser::getForeground() { - const int mouse_x = ev->getX(); - const int mouse_y = ev->getY(); + return fg_color; +} - if ( ev->getButton() == fc::MiddleButton ) - return; +//---------------------------------------------------------------------- +inline FColor ColorChooser::getBackground() +{ + return bg_color; +} - for (int c{0}; c < 16; c++) - { - const int xmin = 2 + (c / 8) * 3; - const int xmax = 4 + (c / 8) * 3; - const int y = 3 + c % 8; - - if ( mouse_x >= xmin && mouse_x <= xmax && mouse_y == y ) - { - if ( ev->getButton() == fc::LeftButton ) - bg_color = FColor(c); - else if ( ev->getButton() == fc::RightButton ) - fg_color = FColor(c); - - redraw(); - emitCallback("clicked"); - } - } +//---------------------------------------------------------------------- +void ColorChooser::setSize (const FSize& size, bool adjust) +{ + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FWidget::setSize (size, adjust); } //---------------------------------------------------------------------- @@ -156,15 +152,31 @@ void ColorChooser::drawBorder() } //---------------------------------------------------------------------- -inline FColor ColorChooser::getForeground() +void ColorChooser::onMouseDown (finalcut::FMouseEvent* ev) { - return fg_color; -} + const int mouse_x = ev->getX(); + const int mouse_y = ev->getY(); -//---------------------------------------------------------------------- -inline FColor ColorChooser::getBackground() -{ - return bg_color; + if ( ev->getButton() == fc::MiddleButton ) + return; + + for (int c{0}; c < 16; c++) + { + const int xmin = 2 + (c / 8) * 3; + const int xmax = 4 + (c / 8) * 3; + const int y = 3 + c % 8; + + if ( mouse_x >= xmin && mouse_x <= xmax && mouse_y == y ) + { + if ( ev->getButton() == fc::LeftButton ) + bg_color = FColor(c); + else if ( ev->getButton() == fc::RightButton ) + fg_color = FColor(c); + + redraw(); + emitCallback("clicked"); + } + } } @@ -195,6 +207,9 @@ class Brushes final : public finalcut::FWidget void setBackground (FColor); private: + // Mutator + void setSize (const FSize&, bool = true) override; + // Method void draw() override; void drawBorder() override; @@ -238,6 +253,14 @@ Brushes::Brushes (finalcut::FWidget* parent) Brushes::~Brushes() { } +//---------------------------------------------------------------------- +void Brushes::setSize (const FSize& size, bool adjust) +{ + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FWidget::setSize (size, adjust); +} + //---------------------------------------------------------------------- void Brushes::draw() { diff --git a/examples/transparent.cpp b/examples/transparent.cpp index f34ebe2a..6ba2a3f1 100644 --- a/examples/transparent.cpp +++ b/examples/transparent.cpp @@ -57,6 +57,9 @@ class Transparent final : public finalcut::FDialog // Disable copy assignment operator (=) Transparent& operator = (const Transparent&) = delete; + // Mutator + void setStatusbarMessage (const finalcut::FString&) override; + private: // Method void draw() override; @@ -82,6 +85,14 @@ Transparent::Transparent ( finalcut::FWidget* parent Transparent::~Transparent() { } +//---------------------------------------------------------------------- +void Transparent::setStatusbarMessage (const finalcut::FString& msg) +{ + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FWidget::setStatusbarMessage(msg); +} + //---------------------------------------------------------------------- void Transparent::draw() { diff --git a/examples/ui.cpp b/examples/ui.cpp index 2a68c9c3..9ad6bb82 100644 --- a/examples/ui.cpp +++ b/examples/ui.cpp @@ -31,6 +31,7 @@ namespace fc = finalcut::fc; using finalcut::FPoint; +using finalcut::FRect; using finalcut::FSize; @@ -41,6 +42,9 @@ using finalcut::FSize; class ProgressDialog final : public finalcut::FDialog { public: + // Using-declaration + using FDialog::setGeometry; + // Constructor explicit ProgressDialog (finalcut::FWidget* = nullptr); @@ -53,6 +57,9 @@ class ProgressDialog final : public finalcut::FDialog // Disable copy assignment operator (=) ProgressDialog& operator = (const ProgressDialog&) = delete; + // Mutator + void setGeometry (const FRect&, bool = true) override; + private: // Event handlers void onShow (finalcut::FShowEvent*) override; @@ -125,6 +132,14 @@ ProgressDialog::~ProgressDialog() // destructor delCallback(&reset); } +//---------------------------------------------------------------------- +void ProgressDialog::setGeometry (const FRect& box, bool adjust) +{ + // Avoids calling a virtual function from the constructor + // (CERT, OOP50-CPP) + FDialog::setGeometry (box, adjust); +} + //---------------------------------------------------------------------- void ProgressDialog::onShow (finalcut::FShowEvent*) { diff --git a/src/Makefile.am b/src/Makefile.am index 776d66ab..846b28be 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -67,7 +67,6 @@ libfinal_la_SOURCES = \ foptimove.cpp \ ftermbuffer.cpp \ fapplication.cpp \ - fcolorpalette.cpp \ fwidgetcolors.cpp \ fwidget.cpp \ fwidget_functions.cpp \ diff --git a/src/Makefile.clang b/src/Makefile.clang index 1341c7ca..0429f70d 100644 --- a/src/Makefile.clang +++ b/src/Makefile.clang @@ -139,7 +139,6 @@ OBJS = \ foptimove.o \ ftermbuffer.o \ fapplication.o \ - fcolorpalette.o \ fwidgetcolors.o \ fwidget.o \ fwidget_functions.o \ diff --git a/src/Makefile.gcc b/src/Makefile.gcc index 4800f483..d3c5c420 100644 --- a/src/Makefile.gcc +++ b/src/Makefile.gcc @@ -139,7 +139,6 @@ OBJS = \ foptimove.o \ ftermbuffer.o \ fapplication.o \ - fcolorpalette.o \ fwidgetcolors.o \ fwidget.o \ fwidget_functions.o \ diff --git a/src/fapplication.cpp b/src/fapplication.cpp index 84249e9e..b22d374f 100644 --- a/src/fapplication.cpp +++ b/src/fapplication.cpp @@ -1122,7 +1122,7 @@ void FApplication::performTimerAction (FObject* receiver, FEvent* event) } //---------------------------------------------------------------------- -bool FApplication::isEventProcessable (FObject* receiver, FEvent* event ) +bool FApplication::isEventProcessable (const FObject* receiver, const FEvent* event ) { if ( ! receiver->isWidget() ) // No restrictions for non-widgets return true; diff --git a/src/fcolorpalette.cpp b/src/fcolorpalette.cpp deleted file mode 100644 index eaa27106..00000000 --- a/src/fcolorpalette.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/*********************************************************************** -* fcolorpalette.cpp - Define RGB color value for a palette entry * -* * -* This file is part of the Final Cut widget toolkit * -* * -* Copyright 2018-2020 Markus Gans * -* * -* The Final Cut is free software; you can redistribute it and/or * -* modify it under the terms of the GNU Lesser General Public License * -* as published by the Free Software Foundation; either version 3 of * -* the License, or (at your option) any later version. * -* * -* The Final Cut is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU Lesser General Public License for more details. * -* * -* You should have received a copy of the GNU Lesser General Public * -* License along with this program. If not, see * -* . * -***********************************************************************/ - -#include "final/fc.h" -#include "final/fcolorpalette.h" - -namespace finalcut -{ - -//---------------------------------------------------------------------- -// class FColorPalette -//---------------------------------------------------------------------- -FColorPalette::~FColorPalette() // destructor -{ } - -// public methods of FColorPalette -//---------------------------------------------------------------------- -void FColorPalette::set8ColorPalette (func setPalette) -{ - setPalette (fc::Black, 0x00, 0x00, 0x00); - setPalette (fc::Blue, 0x10, 0x3b, 0x9e); - setPalette (fc::Green, 0x18, 0x78, 0x18); - setPalette (fc::Cyan, 0xa0, 0xb2, 0xb2); - setPalette (fc::Red, 0xb2, 0x18, 0x18); - setPalette (fc::Magenta, 0xb2, 0x18, 0xb2); - setPalette (fc::Brown, 0xe8, 0x87, 0x1f); - setPalette (fc::LightGray, 0xe0, 0xe0, 0xe0); - // The same colors again... - setPalette (fc::DarkGray, 0x00, 0x00, 0x00); - setPalette (fc::LightBlue, 0x10, 0x3b, 0x9e); - setPalette (fc::LightGreen, 0x18, 0x78, 0x18); - setPalette (fc::Cyan, 0xa0, 0xb2, 0xb2); - setPalette (fc::LightRed, 0xb2, 0x18, 0x18); - setPalette (fc::LightMagenta, 0xb2, 0x18, 0xb2); - setPalette (fc::Yellow, 0xe8, 0x87, 0x1f); - setPalette (fc::White, 0xe0, 0xe0, 0xe0); -} - -//---------------------------------------------------------------------- -void FColorPalette::set16ColorPalette (func setPalette) -{ - setPalette (fc::Black, 0x00, 0x00, 0x00); - setPalette (fc::Blue, 0x10, 0x3b, 0x9e); - setPalette (fc::Green, 0x18, 0x78, 0x18); - setPalette (fc::Cyan, 0x55, 0x6a, 0xcf); - setPalette (fc::Red, 0xba, 0x1a, 0x1a); - setPalette (fc::Magenta, 0xb2, 0x18, 0xb2); - setPalette (fc::Brown, 0xe8, 0x87, 0x1f); - setPalette (fc::LightGray, 0xbc, 0xbc, 0xbc); - setPalette (fc::DarkGray, 0x50, 0x50, 0x50); - setPalette (fc::LightBlue, 0x80, 0xa4, 0xec); - setPalette (fc::LightGreen, 0x5e, 0xeb, 0x5c); - setPalette (fc::LightCyan, 0x62, 0xbf, 0xf8); - setPalette (fc::LightRed, 0xee, 0x44, 0x44); - setPalette (fc::LightMagenta, 0xe9, 0xad, 0xff); - setPalette (fc::Yellow, 0xfb, 0xe8, 0x67); - setPalette (fc::White, 0xff, 0xff, 0xff); -} - -//---------------------------------------------------------------------- -void FColorPalette::reset8ColorPalette (func setPalette) -{ - reset16ColorPalette(setPalette); -} - -//---------------------------------------------------------------------- -void FColorPalette::reset16ColorPalette (func setPalette) -{ - setPalette (fc::Black, 0x00, 0x00, 0x00); - setPalette (fc::Blue, 0x00, 0x00, 0xaa); - setPalette (fc::Green, 0x00, 0xaa, 0x00); - setPalette (fc::Cyan, 0x00, 0x55, 0xaa); - setPalette (fc::Red, 0xaa, 0x00, 0x00); - setPalette (fc::Magenta, 0xaa, 0x00, 0xaa); - setPalette (fc::Brown, 0xaa, 0xaa, 0x00); - setPalette (fc::LightGray, 0xaa, 0xaa, 0xaa); - setPalette (fc::DarkGray, 0x55, 0x55, 0x55); - setPalette (fc::LightBlue, 0x55, 0x55, 0xff); - setPalette (fc::LightGreen, 0x55, 0xff, 0x55); - setPalette (fc::LightCyan, 0x55, 0xff, 0xff); - setPalette (fc::LightRed, 0xff, 0x55, 0x55); - setPalette (fc::LightMagenta, 0xff, 0x55, 0xff); - setPalette (fc::Yellow, 0xff, 0xff, 0x55); - setPalette (fc::White, 0xff, 0xff, 0xff); -} - -} // namespace finalcut diff --git a/src/fcombobox.cpp b/src/fcombobox.cpp index f1dbb234..fc5a7b14 100644 --- a/src/fcombobox.cpp +++ b/src/fcombobox.cpp @@ -427,10 +427,6 @@ void FComboBox::onMouseDown (FMouseEvent* ev) updateTerminal(); } -//---------------------------------------------------------------------- -void FComboBox::onMouseUp (FMouseEvent*) -{ } - //---------------------------------------------------------------------- void FComboBox::onMouseMove (FMouseEvent* ev) { diff --git a/src/fdialog.cpp b/src/fdialog.cpp index f17fcc0c..42b35ab0 100644 --- a/src/fdialog.cpp +++ b/src/fdialog.cpp @@ -776,14 +776,6 @@ void FDialog::drawDialogShadow() drawShadow(this); } -//---------------------------------------------------------------------- -void FDialog::onShow (FShowEvent*) -{ } - -//---------------------------------------------------------------------- -void FDialog::onHide (FHideEvent*) -{ } - //---------------------------------------------------------------------- void FDialog::onClose (FCloseEvent* ev) { diff --git a/src/ftermcap.cpp b/src/ftermcap.cpp index 39da7cc2..6663a849 100644 --- a/src/ftermcap.cpp +++ b/src/ftermcap.cpp @@ -287,25 +287,25 @@ void FTermcap::termcapKeysVt100() for (std::size_t i{0}; fc::fkey[i].tname[0] != 0; i++) { if ( std::strncmp(fc::fkey[i].tname, "kux", 3) == 0 ) - fc::fkey[i].string = C_STR(CSI "A"); // Key up (standard mode) + fc::fkey[i].string = C_STR(CSI "A"); // Key up (standard mode) if ( std::strncmp(fc::fkey[i].tname, "kuX", 3) == 0 ) fc::fkey[i].string = C_STR(ESC "OA"); // Key up (application mode) if ( std::strncmp(fc::fkey[i].tname, "kdx", 3) == 0 ) - fc::fkey[i].string = C_STR(CSI "B"); // Key down (standard mode) + fc::fkey[i].string = C_STR(CSI "B"); // Key down (standard mode) if ( std::strncmp(fc::fkey[i].tname, "kdX", 3) == 0 ) fc::fkey[i].string = C_STR(ESC "OB"); // Key down (application mode) if ( std::strncmp(fc::fkey[i].tname, "krx", 3) == 0 ) - fc::fkey[i].string = C_STR(CSI "C"); // Key right (standard mode) + fc::fkey[i].string = C_STR(CSI "C"); // Key right (standard mode) if ( std::strncmp(fc::fkey[i].tname, "krX", 3) == 0 ) fc::fkey[i].string = C_STR(ESC "OC"); // Key right (application mode) if ( std::strncmp(fc::fkey[i].tname, "klx", 3) == 0 ) - fc::fkey[i].string = C_STR(CSI "D"); // Key left (standard mode) + fc::fkey[i].string = C_STR(CSI "D"); // Key left (standard mode) if ( std::strncmp(fc::fkey[i].tname, "klX", 3) == 0 ) fc::fkey[i].string = C_STR(ESC "OD"); // Key left (application mode) diff --git a/src/include/final/fapplication.h b/src/include/final/fapplication.h index c0f768dd..9c7d0608 100644 --- a/src/include/final/fapplication.h +++ b/src/include/final/fapplication.h @@ -179,7 +179,7 @@ class FApplication : public FWidget void processCloseWidget(); bool processNextEvent(); void performTimerAction (FObject*, FEvent*) override; - static bool isEventProcessable (FObject*, FEvent*); + static bool isEventProcessable (const FObject*, const FEvent*); // Data members int app_argc{}; diff --git a/src/include/final/fcolorpalette.h b/src/include/final/fcolorpalette.h index 0e19b7b4..1f519f40 100644 --- a/src/include/final/fcolorpalette.h +++ b/src/include/final/fcolorpalette.h @@ -49,9 +49,6 @@ namespace finalcut class FColorPalette final { public: - // Using-declaration - using func = std::function; - // Constructor FColorPalette() = default; @@ -62,10 +59,14 @@ class FColorPalette final const FString getClassName() const; // Methods - static void set8ColorPalette (func); - static void set16ColorPalette (func); - static void reset8ColorPalette (func); - static void reset16ColorPalette (func); + template + static void set8ColorPalette (funcT); + template + static void set16ColorPalette (funcT); + template + static void reset8ColorPalette (funcT); + template + static void reset16ColorPalette (funcT); }; // FColorPalette inline functions @@ -73,6 +74,86 @@ class FColorPalette final inline const FString FColorPalette::getClassName() const { return "FColorPalette"; } +// constructors and destructor +//---------------------------------------------------------------------- +inline FColorPalette::~FColorPalette() // destructor +{ } + +// public methods of FColorPalette +//---------------------------------------------------------------------- +template +void FColorPalette::set8ColorPalette (funcT set_palette) +{ + set_palette (fc::Black, 0x00, 0x00, 0x00); + set_palette (fc::Blue, 0x10, 0x3b, 0x9e); + set_palette (fc::Green, 0x18, 0x78, 0x18); + set_palette (fc::Cyan, 0xa0, 0xb2, 0xb2); + set_palette (fc::Red, 0xb2, 0x18, 0x18); + set_palette (fc::Magenta, 0xb2, 0x18, 0xb2); + set_palette (fc::Brown, 0xe8, 0x87, 0x1f); + set_palette (fc::LightGray, 0xe0, 0xe0, 0xe0); + // The same colors again... + set_palette (fc::DarkGray, 0x00, 0x00, 0x00); + set_palette (fc::LightBlue, 0x10, 0x3b, 0x9e); + set_palette (fc::LightGreen, 0x18, 0x78, 0x18); + set_palette (fc::Cyan, 0xa0, 0xb2, 0xb2); + set_palette (fc::LightRed, 0xb2, 0x18, 0x18); + set_palette (fc::LightMagenta, 0xb2, 0x18, 0xb2); + set_palette (fc::Yellow, 0xe8, 0x87, 0x1f); + set_palette (fc::White, 0xe0, 0xe0, 0xe0); +} + +//---------------------------------------------------------------------- +template +void FColorPalette::set16ColorPalette (funcT set_palette) +{ + set_palette (fc::Black, 0x00, 0x00, 0x00); + set_palette (fc::Blue, 0x10, 0x3b, 0x9e); + set_palette (fc::Green, 0x18, 0x78, 0x18); + set_palette (fc::Cyan, 0x55, 0x6a, 0xcf); + set_palette (fc::Red, 0xba, 0x1a, 0x1a); + set_palette (fc::Magenta, 0xb2, 0x18, 0xb2); + set_palette (fc::Brown, 0xe8, 0x87, 0x1f); + set_palette (fc::LightGray, 0xbc, 0xbc, 0xbc); + set_palette (fc::DarkGray, 0x50, 0x50, 0x50); + set_palette (fc::LightBlue, 0x80, 0xa4, 0xec); + set_palette (fc::LightGreen, 0x5e, 0xeb, 0x5c); + set_palette (fc::LightCyan, 0x62, 0xbf, 0xf8); + set_palette (fc::LightRed, 0xee, 0x44, 0x44); + set_palette (fc::LightMagenta, 0xe9, 0xad, 0xff); + set_palette (fc::Yellow, 0xfb, 0xe8, 0x67); + set_palette (fc::White, 0xff, 0xff, 0xff); +} + +//---------------------------------------------------------------------- +template +void FColorPalette::reset8ColorPalette (funcT set_palette) +{ + reset16ColorPalette(set_palette); +} + +//---------------------------------------------------------------------- +template +void FColorPalette::reset16ColorPalette (funcT set_palette) +{ + set_palette (fc::Black, 0x00, 0x00, 0x00); + set_palette (fc::Blue, 0x00, 0x00, 0xaa); + set_palette (fc::Green, 0x00, 0xaa, 0x00); + set_palette (fc::Cyan, 0x00, 0x55, 0xaa); + set_palette (fc::Red, 0xaa, 0x00, 0x00); + set_palette (fc::Magenta, 0xaa, 0x00, 0xaa); + set_palette (fc::Brown, 0xaa, 0xaa, 0x00); + set_palette (fc::LightGray, 0xaa, 0xaa, 0xaa); + set_palette (fc::DarkGray, 0x55, 0x55, 0x55); + set_palette (fc::LightBlue, 0x55, 0x55, 0xff); + set_palette (fc::LightGreen, 0x55, 0xff, 0x55); + set_palette (fc::LightCyan, 0x55, 0xff, 0xff); + set_palette (fc::LightRed, 0xff, 0x55, 0x55); + set_palette (fc::LightMagenta, 0xff, 0x55, 0xff); + set_palette (fc::Yellow, 0xff, 0xff, 0x55); + set_palette (fc::White, 0xff, 0xff, 0xff); +} + } // namespace finalcut #endif // FCOLORPALETTE_H diff --git a/src/include/final/fcombobox.h b/src/include/final/fcombobox.h index ac72195a..cc6b72ba 100644 --- a/src/include/final/fcombobox.h +++ b/src/include/final/fcombobox.h @@ -196,7 +196,6 @@ class FComboBox : public FWidget // Event handlers void onKeyPress (FKeyEvent*) override; void onMouseDown (FMouseEvent*) override; - void onMouseUp (FMouseEvent*) override; void onMouseMove (FMouseEvent*) override; void onWheel (FWheelEvent*) override; void onFocusOut (FFocusEvent*) override; diff --git a/src/include/final/fdialog.h b/src/include/final/fdialog.h index bdfc6458..1863056f 100644 --- a/src/include/final/fdialog.h +++ b/src/include/final/fdialog.h @@ -151,8 +151,6 @@ class FDialog : public FWindow void drawDialogShadow(); // Event handlers - void onShow (FShowEvent*) override; - void onHide (FHideEvent*) override; void onClose (FCloseEvent*) override; private: