term-attributes now used a vector of lambda expressions to print the effects
This commit is contained in:
parent
fd924233c3
commit
b459d55ae8
|
@ -1,6 +1,8 @@
|
||||||
2018-12-15 Markus Gans <guru.mail@muenster.de>
|
2018-12-15 Markus Gans <guru.mail@muenster.de>
|
||||||
* Use of the C++11 auto specifier in the program code
|
* Use of the C++11 auto specifier in the program code
|
||||||
* Code reduction by using of Range-based for loop
|
* Code reduction by using of Range-based for loop
|
||||||
|
* The example program for video attributes now replaces
|
||||||
|
the switch statement with a vector of lambda expressions
|
||||||
|
|
||||||
2018-12-09 Markus Gans <guru.mail@muenster.de>
|
2018-12-09 Markus Gans <guru.mail@muenster.de>
|
||||||
* Better handling of the scrollbar maximum
|
* Better handling of the scrollbar maximum
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
* <http://www.gnu.org/licenses/>. *
|
* <http://www.gnu.org/licenses/>. *
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <final/final.h>
|
#include <final/final.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -405,67 +406,32 @@ void AttribDemo::draw()
|
||||||
// test alternate character set
|
// test alternate character set
|
||||||
printAltCharset();
|
printAltCharset();
|
||||||
|
|
||||||
for (int y = 0; y < int(getParentWidget()->getHeight()) - 7; y++)
|
std::vector<std::function<void()> > effect
|
||||||
{
|
{
|
||||||
setPrintPos (1, 2 + y);
|
[&] { printDim(); },
|
||||||
|
[&] { printNormal(); },
|
||||||
|
[&] { printBold(); },
|
||||||
|
[&] { printBoldDim(); },
|
||||||
|
[&] { printItalic(); },
|
||||||
|
[&] { printUnderline(); },
|
||||||
|
[&] { printDblUnderline(); },
|
||||||
|
[&] { printCrossesOut(); },
|
||||||
|
[&] { printBlink(); },
|
||||||
|
[&] { printReverse(); },
|
||||||
|
[&] { printStandout(); },
|
||||||
|
[&] { printInvisible(); },
|
||||||
|
[&] { printProtected(); },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (std::size_t y = 0; y < getParentWidget()->getHeight() - 7; y++)
|
||||||
|
{
|
||||||
|
setPrintPos (1, 2 + int(y));
|
||||||
|
|
||||||
if ( ! isMonochron() )
|
if ( ! isMonochron() )
|
||||||
setColor (wc.label_fg, wc.label_bg);
|
setColor (wc.label_fg, wc.label_bg);
|
||||||
|
|
||||||
switch (y)
|
if ( y < effect.size() )
|
||||||
{
|
effect[y]();
|
||||||
case 0:
|
|
||||||
printDim();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
printNormal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
printBold();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
printBoldDim();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
printItalic();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
printUnderline();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 6:
|
|
||||||
printDblUnderline();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
printCrossesOut();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
printBlink();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 9:
|
|
||||||
printReverse();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 10:
|
|
||||||
printStandout();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 11:
|
|
||||||
printInvisible();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 12:
|
|
||||||
printProtected();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! isMonochron() )
|
if ( ! isMonochron() )
|
||||||
|
|
Loading…
Reference in New Issue