Fixes the numerical streaming value for FLineEdit and FLabel

This commit is contained in:
Markus Gans 2019-11-16 19:10:08 +01:00
parent be1c2b2639
commit b3c367a168
11 changed files with 84 additions and 57 deletions

View File

@ -38,6 +38,15 @@ class Background : public finalcut::FDialog
public:
explicit Background (finalcut::FWidget* = nullptr);
// Disable copy constructor
Background (const Background&) = delete;
// Destructor
~Background();
// Disable assignment operator (=)
Background& operator = (const Background&) = delete;
private:
// Callback method
void cb_changed (finalcut::FWidget*, FDataPtr);
@ -79,9 +88,9 @@ Background::Background (finalcut::FWidget* parent)
// Set the initial palette values
const auto& wc = getFWidgetColors();
finalcut::FTerm::setPalette ( wc.term_bg
, red.getValue()
, green.getValue()
, blue.getValue() );
, int(red.getValue())
, int(green.getValue())
, int(blue.getValue()) );
// Quit button
quit.setGeometry(FPoint(19, 5), FSize(10, 1));
@ -112,14 +121,18 @@ Background::Background (finalcut::FWidget* parent)
);
}
//----------------------------------------------------------------------
Background::~Background() // destructor
{ }
//----------------------------------------------------------------------
void Background::cb_changed (finalcut::FWidget*, FDataPtr)
{
const auto& wc = getFWidgetColors();
finalcut::FTerm::setPalette ( wc.term_bg
, red.getValue()
, green.getValue()
, blue.getValue() );
, int(red.getValue())
, int(green.getValue())
, int(blue.getValue()) );
redraw();
updateTerminal();
}

View File

@ -43,12 +43,13 @@ INCLUDE_HEADERS = \
fsystemimpl.h \
fscrollbar.h \
fscrollview.h \
fspinbox.h \
fstatusbar.h \
fstring.h \
fmouse.h \
fkeyboard.h \
ftermcap.h \
fstartoptions.h \
ftermcap.h \
fterm.h \
ftermdata.h \
ftermdebugdata.h \
@ -104,6 +105,7 @@ OBJS = \
fdialog.o \
fwindow.o \
fscrollview.o \
fspinbox.o \
fmessagebox.o \
ftooltip.o \
ffiledialog.o \

View File

@ -39,12 +39,13 @@ INCLUDE_HEADERS = \
fprogressbar.h \
fradiobutton.h \
frect.h \
fscrollbar.h \
fscrollview.h \
fstatusbar.h \
fstring.h \
fsystem.h \
fsystemimpl.h \
fscrollbar.h \
fscrollview.h \
fspinbox.h \
fstatusbar.h \
fstring.h \
fmouse.h \
fkeyboard.h \
fstartoptions.h \
@ -104,6 +105,7 @@ OBJS = \
fdialog.o \
fwindow.o \
fscrollview.o \
fspinbox.o \
fmessagebox.o \
ftooltip.o \
ffiledialog.o \
@ -115,8 +117,8 @@ OBJS = \
fsystem.o \
fsystemimpl.o \
fkeyboard.o \
ftermcap.o \
fstartoptions.o \
ftermcap.o \
fterm.o \
fterm_functions.o \
ftermdebugdata.o \

View File

@ -107,7 +107,7 @@ FLabel& FLabel::operator << (const int num)
}
//----------------------------------------------------------------------
FLabel& FLabel::operator << (const uLong num)
FLabel& FLabel::operator << (const uInt64 num)
{
FString num_str;
num_str << num;
@ -116,7 +116,7 @@ FLabel& FLabel::operator << (const uLong num)
}
//----------------------------------------------------------------------
FLabel& FLabel::operator << (const long num)
FLabel& FLabel::operator << (const sInt64 num)
{
FString num_str;
num_str << num;

View File

@ -112,7 +112,7 @@ FLineEdit& FLineEdit::operator << (const int num)
}
//----------------------------------------------------------------------
FLineEdit& FLineEdit::operator << (const uLong num)
FLineEdit& FLineEdit::operator << (const uInt64 num)
{
FString num_str;
num_str << num;
@ -121,7 +121,7 @@ FLineEdit& FLineEdit::operator << (const uLong num)
}
//----------------------------------------------------------------------
FLineEdit& FLineEdit::operator << (const long num)
FLineEdit& FLineEdit::operator << (const sInt64 num)
{
FString num_str;
num_str << num;

View File

@ -149,38 +149,12 @@ void FSpinBox::setSuffix (const FString& text)
}
//----------------------------------------------------------------------
void FSpinBox::draw()
void FSpinBox::hide()
{
const auto& wc = getFWidgetColors();
FColorPair inc_button_color = [&] () -> FColorPair
{
if ( value == max )
return FColorPair ( wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg );
else
return FColorPair ( wc.scrollbar_button_fg
, wc.scrollbar_button_bg );
}();
FColorPair dec_button_color = [&] () -> FColorPair
{
if ( value == min )
return FColorPair ( wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg );
else
return FColorPair ( wc.scrollbar_button_fg
, wc.scrollbar_button_bg );
}();
print() << FPoint(getWidth() - 1, 1)
<< dec_button_color
<< fc::BlackDownPointingTriangle // ▼
<< inc_button_color
<< fc::BlackUpPointingTriangle; // ▲
if ( getFlags().shadow )
drawShadow(this);
input_field.hide();
FWidget::hide();
FSize shadow = hasShadow() ? FSize(1, 1) : FSize(0, 0);
hideArea (getSize() + shadow);
}
//----------------------------------------------------------------------
@ -309,7 +283,7 @@ void FSpinBox::onTimer (FTimerEvent*)
updateInputField();
break;
default:
case FSpinBox::noSpin:
break;
}
}
@ -335,6 +309,41 @@ void FSpinBox::init()
);
}
//----------------------------------------------------------------------
void FSpinBox::draw()
{
const auto& wc = getFWidgetColors();
FColorPair inc_button_color = [&] () -> FColorPair
{
if ( value == max )
return FColorPair ( wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg );
else
return FColorPair ( wc.scrollbar_button_fg
, wc.scrollbar_button_bg );
}();
FColorPair dec_button_color = [&] () -> FColorPair
{
if ( value == min )
return FColorPair ( wc.scrollbar_button_inactive_fg
, wc.scrollbar_button_inactive_bg );
else
return FColorPair ( wc.scrollbar_button_fg
, wc.scrollbar_button_bg );
}();
print() << FPoint(int(getWidth()) - 1, 1)
<< dec_button_color
<< fc::BlackDownPointingTriangle // ▼
<< inc_button_color
<< fc::BlackUpPointingTriangle; // ▲
if ( getFlags().shadow )
drawShadow(this);
}
//----------------------------------------------------------------------
inline void FSpinBox::updateInputField()
{

View File

@ -277,7 +277,7 @@ FString& FString::operator << (const uInt num)
}
//----------------------------------------------------------------------
FString& FString::operator << (const long num)
FString& FString::operator << (const sInt64 num)
{
FString numstr(FString().setNumber(num));
_insert (length, numstr.length, numstr.string);
@ -285,7 +285,7 @@ FString& FString::operator << (const long num)
}
//----------------------------------------------------------------------
FString& FString::operator << (const uLong num)
FString& FString::operator << (const uInt64 num)
{
FString numstr(FString().setNumber(num));
_insert (length, numstr.length, numstr.string);

View File

@ -90,8 +90,8 @@ class FLabel : public FWidget
FLabel& operator << (const wchar_t);
FLabel& operator << (const uInt);
FLabel& operator << (const int);
FLabel& operator << (const uLong);
FLabel& operator << (const long);
FLabel& operator << (const uInt64);
FLabel& operator << (const sInt64);
FLabel& operator << (const float);
FLabel& operator << (const double);
FLabel& operator << (const lDouble);

View File

@ -106,8 +106,8 @@ class FLineEdit : public FWidget
FLineEdit& operator << (const wchar_t);
FLineEdit& operator << (const uInt);
FLineEdit& operator << (const int);
FLineEdit& operator << (const uLong);
FLineEdit& operator << (const long);
FLineEdit& operator << (const uInt64);
FLineEdit& operator << (const sInt64);
FLineEdit& operator << (const float);
FLineEdit& operator << (const double);
FLineEdit& operator << (const lDouble);

View File

@ -114,7 +114,7 @@ class FSpinBox : public FWidget
bool hasShadow();
// Methods
void draw() override;
void hide() override;
// Event handlers
void onKeyPress (FKeyEvent*) override;
@ -134,6 +134,7 @@ class FSpinBox : public FWidget
// Methods
void init();
void draw() override;
void updateInputField();
void increaseValue();
void decreaseValue();

View File

@ -118,8 +118,8 @@ class FString
FString& operator << (const uInt16);
FString& operator << (const int);
FString& operator << (const uInt);
FString& operator << (const long);
FString& operator << (const uLong);
FString& operator << (const sInt64);
FString& operator << (const uInt64);
FString& operator << (const float);
FString& operator << (const double);
FString& operator << (const lDouble);