Added FApplication::setDarkTheme() and FApplication::setDefaultTheme()
This commit is contained in:
parent
6a20b728ba
commit
f76a9d2114
|
@ -1,3 +1,9 @@
|
||||||
|
2020-05-30 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* With the two new methods FApplication::setDarkTheme() and
|
||||||
|
FApplication::setDefaultTheme() you can now change the theme
|
||||||
|
within an application. An example can be found in examples/ui
|
||||||
|
via the menu items "View" -> "Dark mode".
|
||||||
|
|
||||||
2020-05-29 Markus Gans <guru.mail@muenster.de>
|
2020-05-29 Markus Gans <guru.mail@muenster.de>
|
||||||
* Adding a dark theme. Can be activated with the --dark-theme parameter.
|
* Adding a dark theme. Can be activated with the --dark-theme parameter.
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,40 @@ void move (int xold, int yold, int xnew, int ynew)
|
||||||
<< std::right << std::setw(10) << byte << "\r\n";
|
<< std::right << std::setw(10) << byte << "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
class DirectLogger : public finalcut::FLog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void info (const std::string& entry) override
|
||||||
|
{
|
||||||
|
output << entry << "\r" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void warn (const std::string&) override
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void error (const std::string&) override
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void debug (const std::string&) override
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void setOutputStream (const std::ostream& os) override
|
||||||
|
{ output.rdbuf(os.rdbuf()); }
|
||||||
|
|
||||||
|
void setLineEnding (LineEnding) override
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void enableTimestamp() override
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void disableTimestamp() override
|
||||||
|
{ }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Data member
|
||||||
|
std::ostream output{std::cerr.rdbuf()};
|
||||||
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// main part
|
// main part
|
||||||
|
@ -189,7 +223,11 @@ int main (int argc, char* argv[])
|
||||||
keyPressed();
|
keyPressed();
|
||||||
|
|
||||||
// Show terminal speed and milliseconds for all cursor movement sequence
|
// Show terminal speed and milliseconds for all cursor movement sequence
|
||||||
std::cout << "\r" << line;
|
std::cout << "\r" << line << std::flush;
|
||||||
|
// Generation of a logger in a shared_ptr via a pointer
|
||||||
|
finalcut::FApplication::setLog(std::make_shared<DirectLogger>());
|
||||||
|
// Get the shared_ptr with the base class
|
||||||
|
std::shared_ptr<finalcut::FLog> log = finalcut::FApplication::getLog();
|
||||||
const finalcut::FOptiMove& opti_move = *finalcut::FTerm::getFOptiMove();
|
const finalcut::FOptiMove& opti_move = *finalcut::FTerm::getFOptiMove();
|
||||||
finalcut::printDurations(opti_move);
|
finalcut::printDurations(opti_move);
|
||||||
|
|
||||||
|
|
|
@ -301,6 +301,7 @@ class MyDialog final : public finalcut::FDialog
|
||||||
void cb_copyClipboard (const finalcut::FWidget*, const FDataPtr);
|
void cb_copyClipboard (const finalcut::FWidget*, const FDataPtr);
|
||||||
void cb_pasteClipboard (const finalcut::FWidget*, const FDataPtr);
|
void cb_pasteClipboard (const finalcut::FWidget*, const FDataPtr);
|
||||||
void cb_clearInput (const finalcut::FWidget*, const FDataPtr);
|
void cb_clearInput (const finalcut::FWidget*, const FDataPtr);
|
||||||
|
void cb_switchTheme (const finalcut::FWidget*, const FDataPtr);
|
||||||
void cb_input2buttonText (finalcut::FWidget*, FDataPtr);
|
void cb_input2buttonText (finalcut::FWidget*, FDataPtr);
|
||||||
void cb_setTitlebar (finalcut::FWidget*, const FDataPtr);
|
void cb_setTitlebar (finalcut::FWidget*, const FDataPtr);
|
||||||
void cb_showProgressBar (const finalcut::FWidget*, const FDataPtr);
|
void cb_showProgressBar (const finalcut::FWidget*, const FDataPtr);
|
||||||
|
@ -339,6 +340,8 @@ class MyDialog final : public finalcut::FDialog
|
||||||
// "View" menu items
|
// "View" menu items
|
||||||
finalcut::FMenuItem Env{"&Terminal...", &View};
|
finalcut::FMenuItem Env{"&Terminal...", &View};
|
||||||
finalcut::FMenuItem Drive{"&Drive symbols...", &View};
|
finalcut::FMenuItem Drive{"&Drive symbols...", &View};
|
||||||
|
finalcut::FMenuItem Line3{&View};
|
||||||
|
finalcut::FCheckMenuItem Theme{"Dark &mode", &View};
|
||||||
// Statusbar
|
// Statusbar
|
||||||
finalcut::FStatusBar Statusbar{this};
|
finalcut::FStatusBar Statusbar{this};
|
||||||
finalcut::FStatusKey key_F1{fc::Fkey_f1, "About", &Statusbar};
|
finalcut::FStatusKey key_F1{fc::Fkey_f1, "About", &Statusbar};
|
||||||
|
@ -422,6 +425,10 @@ void MyDialog::initMenu()
|
||||||
// "View" menu items
|
// "View" menu items
|
||||||
Env.setStatusbarMessage ("Informations about this terminal");
|
Env.setStatusbarMessage ("Informations about this terminal");
|
||||||
Drive.setStatusbarMessage ("Show drive symbols");
|
Drive.setStatusbarMessage ("Show drive symbols");
|
||||||
|
Line3.setSeparator();
|
||||||
|
|
||||||
|
if ( finalcut::FStartOptions::getFStartOptions().dark_theme )
|
||||||
|
Theme.setChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -517,6 +524,12 @@ void MyDialog::initViewMenuCallbacks()
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_drives)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_drives)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Theme.addCallback
|
||||||
|
(
|
||||||
|
"clicked",
|
||||||
|
F_METHOD_CALLBACK (this, &MyDialog::cb_switchTheme)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -902,6 +915,21 @@ void MyDialog::cb_clearInput (const finalcut::FWidget*, const FDataPtr)
|
||||||
myLineEdit.redraw();
|
myLineEdit.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void MyDialog::cb_switchTheme (const finalcut::FWidget* widget, const FDataPtr)
|
||||||
|
{
|
||||||
|
const auto& check_menu = *(static_cast<const finalcut::FCheckMenuItem*>(widget));
|
||||||
|
|
||||||
|
if ( check_menu.isChecked() )
|
||||||
|
finalcut::FApplication::setDarkTheme();
|
||||||
|
else
|
||||||
|
finalcut::FApplication::setDefaultTheme();
|
||||||
|
|
||||||
|
auto root_widget = getRootWidget();
|
||||||
|
root_widget->resetColors();
|
||||||
|
root_widget->redraw();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::cb_input2buttonText (finalcut::FWidget* widget, FDataPtr data)
|
void MyDialog::cb_input2buttonText (finalcut::FWidget* widget, FDataPtr data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -282,6 +282,37 @@ FWidget* FApplication::processParameters (const int& argc, char* argv[])
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FApplication::setDefaultTheme()
|
||||||
|
{
|
||||||
|
if ( FTerm::getMaxColor() < 16 ) // for 8 color mode
|
||||||
|
{
|
||||||
|
if ( getStartOptions().color_change )
|
||||||
|
FTerm::setColorPaletteTheme<default8ColorPalette>(&FTerm::setPalette);
|
||||||
|
|
||||||
|
setColorTheme<default8ColorTheme>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( getStartOptions().color_change )
|
||||||
|
FTerm::setColorPaletteTheme<default16ColorPalette>(&FTerm::setPalette);
|
||||||
|
|
||||||
|
setColorTheme<default16ColorTheme>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FApplication::setDarkTheme()
|
||||||
|
{
|
||||||
|
if ( getStartOptions().color_change )
|
||||||
|
FTerm::setColorPaletteTheme<default16DarkColorPalette>(&FTerm::setPalette);
|
||||||
|
|
||||||
|
if ( FTerm::getMaxColor() < 16 ) // for 8 color mode
|
||||||
|
setColorTheme<default8ColorDarkTheme>();
|
||||||
|
else
|
||||||
|
setColorTheme<default16ColorDarkTheme>();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FApplication::showParameterUsage()
|
void FApplication::showParameterUsage()
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,6 +127,20 @@ void FButton::setInactiveBackgroundColor (FColor color)
|
||||||
updateButtonColor();
|
updateButtonColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FButton::resetColors()
|
||||||
|
{
|
||||||
|
const auto& wc = getColorTheme();
|
||||||
|
setForegroundColor (wc->button_active_fg);
|
||||||
|
setBackgroundColor (wc->button_active_bg);
|
||||||
|
setHotkeyForegroundColor (wc->button_hotkey_fg);
|
||||||
|
setFocusForegroundColor (wc->button_active_focus_fg);
|
||||||
|
setFocusBackgroundColor (wc->button_active_focus_bg);
|
||||||
|
setInactiveForegroundColor (wc->button_inactive_fg);
|
||||||
|
setInactiveBackgroundColor (wc->button_inactive_bg);
|
||||||
|
FWidget::resetColors();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FButton::setNoUnderline (bool enable)
|
bool FButton::setNoUnderline (bool enable)
|
||||||
{
|
{
|
||||||
|
|
|
@ -383,7 +383,7 @@ void FButtonGroup::draw()
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
setColor();
|
useParentWidgetColor();
|
||||||
clearArea();
|
clearArea();
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
|
@ -427,9 +427,6 @@ bool FButtonGroup::isRadioButton (const FToggleButton* button) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButtonGroup::init()
|
void FButtonGroup::init()
|
||||||
{
|
{
|
||||||
const auto& wc = getColorTheme();
|
|
||||||
setForegroundColor (wc->label_fg);
|
|
||||||
setBackgroundColor (wc->label_bg);
|
|
||||||
setMinimumSize (FSize{7, 3});
|
setMinimumSize (FSize{7, 3});
|
||||||
buttonlist.clear(); // no buttons yet
|
buttonlist.clear(); // no buttons yet
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ void FCheckBox::draw()
|
||||||
void FCheckBox::drawCheckButton()
|
void FCheckBox::drawCheckButton()
|
||||||
{
|
{
|
||||||
print() << FPoint{1, 1};
|
print() << FPoint{1, 1};
|
||||||
setColor();
|
useParentWidgetColor();
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -177,7 +177,7 @@ void default16DarkColorPalette::setColorPalette()
|
||||||
setPalette (fc::Blue, 0x41, 0x58, 0xb3);
|
setPalette (fc::Blue, 0x41, 0x58, 0xb3);
|
||||||
setPalette (fc::Green, 0x18, 0x78, 0x18);
|
setPalette (fc::Green, 0x18, 0x78, 0x18);
|
||||||
setPalette (fc::Cyan, 0x4e, 0x66, 0x72);
|
setPalette (fc::Cyan, 0x4e, 0x66, 0x72);
|
||||||
setPalette (fc::Red, 0xba, 0x49, 0x49);
|
setPalette (fc::Red, 0xa5, 0x40, 0x40);
|
||||||
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
|
setPalette (fc::Magenta, 0xb2, 0x18, 0xb2);
|
||||||
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
|
setPalette (fc::Brown, 0xe8, 0x87, 0x1f);
|
||||||
setPalette (fc::LightGray, 0xd2, 0xd2, 0xd2);
|
setPalette (fc::LightGray, 0xd2, 0xd2, 0xd2);
|
||||||
|
|
|
@ -136,6 +136,15 @@ bool FDialog::setBorder (bool enable)
|
||||||
return (setFlags().no_border = ! enable);
|
return (setFlags().no_border = ! enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FDialog::resetColors()
|
||||||
|
{
|
||||||
|
const auto& wc = getColorTheme();
|
||||||
|
setForegroundColor (wc->dialog_fg);
|
||||||
|
setBackgroundColor (wc->dialog_bg);
|
||||||
|
FWidget::resetColors();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FDialog::setResizeable (bool enable)
|
bool FDialog::setResizeable (bool enable)
|
||||||
{
|
{
|
||||||
|
@ -800,9 +809,7 @@ void FDialog::init()
|
||||||
addDialog(this);
|
addDialog(this);
|
||||||
setActiveWindow(this);
|
setActiveWindow(this);
|
||||||
setTransparentShadow();
|
setTransparentShadow();
|
||||||
const auto& wc = getColorTheme();
|
resetColors();
|
||||||
setForegroundColor (wc->dialog_fg);
|
|
||||||
setBackgroundColor (wc->dialog_bg);
|
|
||||||
auto old_focus = FWidget::getFocusWidget();
|
auto old_focus = FWidget::getFocusWidget();
|
||||||
|
|
||||||
if ( old_focus )
|
if ( old_focus )
|
||||||
|
|
|
@ -246,20 +246,7 @@ void FLabel::cb_accelWidgetDestroyed (const FWidget*, const FDataPtr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLabel::init()
|
void FLabel::init()
|
||||||
{
|
{
|
||||||
const auto& parent_widget = getParentWidget();
|
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
|
|
||||||
if ( parent_widget )
|
|
||||||
{
|
|
||||||
setForegroundColor (parent_widget->getForegroundColor());
|
|
||||||
setBackgroundColor (parent_widget->getBackgroundColor());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const auto& wc = getColorTheme();
|
|
||||||
setForegroundColor (wc->dialog_fg);
|
|
||||||
setBackgroundColor (wc->dialog_bg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -303,6 +290,8 @@ void FLabel::draw()
|
||||||
if ( text.isEmpty() )
|
if ( text.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
useParentWidgetColor();
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
{
|
{
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
|
@ -99,28 +99,8 @@ const FLineEdit& FLineEdit::operator >> (FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FLineEdit::setEnable (bool enable)
|
bool FLineEdit::setEnable (bool enable)
|
||||||
{
|
{
|
||||||
const auto& wc = getColorTheme();
|
|
||||||
FWidget::setEnable(enable);
|
FWidget::setEnable(enable);
|
||||||
|
resetColors();
|
||||||
if ( enable )
|
|
||||||
{
|
|
||||||
if ( hasFocus() )
|
|
||||||
{
|
|
||||||
setForegroundColor (wc->inputfield_active_focus_fg);
|
|
||||||
setBackgroundColor (wc->inputfield_active_focus_bg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setForegroundColor (wc->inputfield_active_fg);
|
|
||||||
setBackgroundColor (wc->inputfield_active_bg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setForegroundColor (wc->inputfield_inactive_fg);
|
|
||||||
setBackgroundColor (wc->inputfield_inactive_bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
return enable;
|
return enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,23 +108,7 @@ bool FLineEdit::setEnable (bool enable)
|
||||||
bool FLineEdit::setFocus (bool enable)
|
bool FLineEdit::setFocus (bool enable)
|
||||||
{
|
{
|
||||||
FWidget::setFocus(enable);
|
FWidget::setFocus(enable);
|
||||||
|
resetColors();
|
||||||
if ( isEnabled() )
|
|
||||||
{
|
|
||||||
const auto& wc = getColorTheme();
|
|
||||||
|
|
||||||
if ( enable )
|
|
||||||
{
|
|
||||||
setForegroundColor (wc->inputfield_active_focus_fg);
|
|
||||||
setBackgroundColor (wc->inputfield_active_focus_bg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setForegroundColor (wc->inputfield_active_fg);
|
|
||||||
setBackgroundColor (wc->inputfield_active_bg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return enable;
|
return enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,6 +219,34 @@ void FLineEdit::setLabelOrientation (const label_o o)
|
||||||
adjustLabel();
|
adjustLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FLineEdit::resetColors()
|
||||||
|
{
|
||||||
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
|
if ( isEnabled() ) // active
|
||||||
|
{
|
||||||
|
if ( hasFocus() )
|
||||||
|
{
|
||||||
|
setForegroundColor (wc->inputfield_active_focus_fg);
|
||||||
|
setBackgroundColor (wc->inputfield_active_focus_bg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setForegroundColor (wc->inputfield_active_fg);
|
||||||
|
setBackgroundColor (wc->inputfield_active_bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // inactive
|
||||||
|
{
|
||||||
|
setForegroundColor (wc->inputfield_inactive_fg);
|
||||||
|
setBackgroundColor (wc->inputfield_inactive_bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
FWidget::resetColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::setSize (const FSize& size, bool adjust)
|
void FLineEdit::setSize (const FSize& size, bool adjust)
|
||||||
{
|
{
|
||||||
|
@ -655,34 +647,14 @@ void FLineEdit::adjustSize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::init()
|
void FLineEdit::init()
|
||||||
{
|
{
|
||||||
const auto& wc = getColorTheme();
|
|
||||||
label->setAccelWidget(this);
|
label->setAccelWidget(this);
|
||||||
|
setShadow();
|
||||||
|
resetColors();
|
||||||
|
|
||||||
if ( isReadOnly() )
|
if ( isReadOnly() )
|
||||||
unsetVisibleCursor();
|
unsetVisibleCursor();
|
||||||
else
|
else
|
||||||
setVisibleCursor();
|
setVisibleCursor();
|
||||||
|
|
||||||
setShadow();
|
|
||||||
|
|
||||||
if ( isEnabled() )
|
|
||||||
{
|
|
||||||
if ( hasFocus() )
|
|
||||||
{
|
|
||||||
setForegroundColor (wc->inputfield_active_focus_fg);
|
|
||||||
setBackgroundColor (wc->inputfield_active_focus_bg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setForegroundColor (wc->inputfield_active_fg);
|
|
||||||
setBackgroundColor (wc->inputfield_active_bg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // inactive
|
|
||||||
{
|
|
||||||
setForegroundColor (wc->inputfield_inactive_fg);
|
|
||||||
setBackgroundColor (wc->inputfield_inactive_bg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -655,9 +655,6 @@ void FListBox::init()
|
||||||
initScrollbar (vbar, fc::vertical, this, &FListBox::cb_vbarChange);
|
initScrollbar (vbar, fc::vertical, this, &FListBox::cb_vbarChange);
|
||||||
initScrollbar (hbar, fc::horizontal, this, &FListBox::cb_hbarChange);
|
initScrollbar (hbar, fc::horizontal, this, &FListBox::cb_hbarChange);
|
||||||
setGeometry (FPoint{1, 1}, FSize{5, 4}, false); // initialize geometry values
|
setGeometry (FPoint{1, 1}, FSize{5, 4}, false); // initialize geometry values
|
||||||
const auto& wc = getColorTheme();
|
|
||||||
setForegroundColor (wc->dialog_fg);
|
|
||||||
setBackgroundColor (wc->dialog_bg);
|
|
||||||
nf_offset = FTerm::isNewFont() ? 1 : 0;
|
nf_offset = FTerm::isNewFont() ? 1 : 0;
|
||||||
setTopPadding(1);
|
setTopPadding(1);
|
||||||
setLeftPadding(1);
|
setLeftPadding(1);
|
||||||
|
@ -722,7 +719,8 @@ void FListBox::draw()
|
||||||
if ( current < 1 )
|
if ( current < 1 )
|
||||||
current = 1;
|
current = 1;
|
||||||
|
|
||||||
setColor();
|
useParentWidgetColor();
|
||||||
|
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
|
@ -1523,9 +1523,6 @@ void FListView::init()
|
||||||
root = selflist.begin();
|
root = selflist.begin();
|
||||||
getNullIterator() = selflist.end();
|
getNullIterator() = selflist.end();
|
||||||
setGeometry (FPoint{1, 1}, FSize{5, 4}, false); // initialize geometry values
|
setGeometry (FPoint{1, 1}, FSize{5, 4}, false); // initialize geometry values
|
||||||
const auto& wc = getColorTheme();
|
|
||||||
setForegroundColor (wc->dialog_fg);
|
|
||||||
setBackgroundColor (wc->dialog_bg);
|
|
||||||
nf_offset = FTerm::isNewFont() ? 1 : 0;
|
nf_offset = FTerm::isNewFont() ? 1 : 0;
|
||||||
setTopPadding(1);
|
setTopPadding(1);
|
||||||
setLeftPadding(1);
|
setLeftPadding(1);
|
||||||
|
@ -1637,7 +1634,7 @@ void FListView::draw()
|
||||||
if ( current_iter.getPosition() < 1 )
|
if ( current_iter.getPosition() < 1 )
|
||||||
current_iter = itemlist.begin();
|
current_iter = itemlist.begin();
|
||||||
|
|
||||||
setColor();
|
useParentWidgetColor();
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
|
@ -83,6 +83,15 @@ void FMenu::setStatusbarMessage (const FString& msg)
|
||||||
menuitem.setStatusbarMessage(msg);
|
menuitem.setStatusbarMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FMenu::resetColors()
|
||||||
|
{
|
||||||
|
const auto& wc = getColorTheme();
|
||||||
|
setForegroundColor (wc->menu_active_fg);
|
||||||
|
setBackgroundColor (wc->menu_active_bg);
|
||||||
|
FWidget::resetColors();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::show()
|
void FMenu::show()
|
||||||
{
|
{
|
||||||
|
@ -458,10 +467,7 @@ void FMenu::init(FWidget* parent)
|
||||||
setTransparentShadow();
|
setTransparentShadow();
|
||||||
setMenuWidget();
|
setMenuWidget();
|
||||||
hide();
|
hide();
|
||||||
|
resetColors();
|
||||||
const auto& wc = getColorTheme();
|
|
||||||
setForegroundColor (wc->menu_active_fg);
|
|
||||||
setBackgroundColor (wc->menu_active_bg);
|
|
||||||
menuitem.setMenu(this);
|
menuitem.setMenu(this);
|
||||||
|
|
||||||
if ( parent )
|
if ( parent )
|
||||||
|
|
|
@ -55,6 +55,15 @@ FMenuBar::~FMenuBar() // destructor
|
||||||
|
|
||||||
|
|
||||||
// public methods of FMenuBar
|
// public methods of FMenuBar
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FMenuBar::resetColors()
|
||||||
|
{
|
||||||
|
const auto& wc = getColorTheme();
|
||||||
|
setForegroundColor (wc->menu_active_fg);
|
||||||
|
setBackgroundColor (wc->menu_active_bg);
|
||||||
|
FWidget::resetColors();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::resetMenu()
|
void FMenuBar::resetMenu()
|
||||||
{
|
{
|
||||||
|
@ -249,9 +258,7 @@ void FMenuBar::init()
|
||||||
|
|
||||||
addAccelerator (fc::Fkey_f10);
|
addAccelerator (fc::Fkey_f10);
|
||||||
addAccelerator (fc::Fckey_space);
|
addAccelerator (fc::Fckey_space);
|
||||||
const auto& wc = getColorTheme();
|
resetColors();
|
||||||
setForegroundColor (wc->menu_active_fg);
|
|
||||||
setBackgroundColor (wc->menu_active_bg);
|
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "final/fapplication.h"
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
|
#include "final/flog.h"
|
||||||
#include "final/foptimove.h"
|
#include "final/foptimove.h"
|
||||||
#include "final/ftermcap.h"
|
#include "final/ftermcap.h"
|
||||||
|
|
||||||
|
@ -1105,42 +1107,43 @@ void FOptiMove::moveByMethod ( int method
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void printDurations (const FOptiMove& om)
|
void printDurations (const FOptiMove& om)
|
||||||
{
|
{
|
||||||
std::cout << " speed: "
|
finalcut::FLog& log = *FApplication::getLog();
|
||||||
<< om.baudrate << " baud\r\n";
|
log << " speed: "
|
||||||
std::cout << " char_duration: "
|
<< om.baudrate << " baud" << std::flush;
|
||||||
<< om.char_duration << " ms\r\n";
|
log << " char_duration: "
|
||||||
std::cout << " cursor_home: "
|
<< om.char_duration << " ms" << std::flush;
|
||||||
<< om.F_cursor_home.duration << " ms\r\n";
|
log << " cursor_home: "
|
||||||
std::cout << " cursor_to_ll: "
|
<< om.F_cursor_home.duration << " ms" << std::flush;
|
||||||
<< om.F_cursor_to_ll.duration << " ms\r\n";
|
log << " cursor_to_ll: "
|
||||||
std::cout << " carriage_return: "
|
<< om.F_cursor_to_ll.duration << " ms" << std::flush;
|
||||||
<< om.F_carriage_return.duration << " ms\r\n";
|
log << " carriage_return: "
|
||||||
std::cout << " tab: "
|
<< om.F_carriage_return.duration << " ms" << std::flush;
|
||||||
<< om.F_tab.duration << " ms\r\n";
|
log << " tab: "
|
||||||
std::cout << " back_tab: "
|
<< om.F_tab.duration << " ms" << std::flush;
|
||||||
<< om.F_back_tab.duration << " ms\r\n";
|
log << " back_tab: "
|
||||||
std::cout << " cursor_up: "
|
<< om.F_back_tab.duration << " ms" << std::flush;
|
||||||
<< om.F_cursor_up.duration << " ms\r\n";
|
log << " cursor_up: "
|
||||||
std::cout << " cursor_down: "
|
<< om.F_cursor_up.duration << " ms" << std::flush;
|
||||||
<< om.F_cursor_down.duration << " ms\r\n";
|
log << " cursor_down: "
|
||||||
std::cout << " cursor_left: "
|
<< om.F_cursor_down.duration << " ms" << std::flush;
|
||||||
<< om.F_cursor_left.duration << " ms\r\n";
|
log << " cursor_left: "
|
||||||
std::cout << " cursor_right: "
|
<< om.F_cursor_left.duration << " ms" << std::flush;
|
||||||
<< om.F_cursor_right.duration << " ms\r\n";
|
log << " cursor_right: "
|
||||||
std::cout << " cursor_address: "
|
<< om.F_cursor_right.duration << " ms" << std::flush;
|
||||||
<< om.F_cursor_address.duration << " ms\r\n";
|
log << " cursor_address: "
|
||||||
std::cout << " column_address: "
|
<< om.F_cursor_address.duration << " ms" << std::flush;
|
||||||
<< om.F_column_address.duration << " ms\r\n";
|
log << " column_address: "
|
||||||
std::cout << " row_address: "
|
<< om.F_column_address.duration << " ms" << std::flush;
|
||||||
<< om.F_row_address.duration << " ms\r\n";
|
log << " row_address: "
|
||||||
std::cout << " parm_up_cursor: "
|
<< om.F_row_address.duration << " ms" << std::flush;
|
||||||
<< om.F_parm_up_cursor.duration << " ms\r\n";
|
log << " parm_up_cursor: "
|
||||||
std::cout << " parm_down_cursor: "
|
<< om.F_parm_up_cursor.duration << " ms" << std::flush;
|
||||||
<< om.F_parm_down_cursor.duration << " ms\r\n";
|
log << " parm_down_cursor: "
|
||||||
std::cout << " parm_left_cursor: "
|
<< om.F_parm_down_cursor.duration << " ms" << std::flush;
|
||||||
<< om.F_parm_left_cursor.duration << " ms\r\n";
|
log << " parm_left_cursor: "
|
||||||
std::cout << "parm_right_cursor: "
|
<< om.F_parm_left_cursor.duration << " ms" << std::flush;
|
||||||
<< om.F_parm_right_cursor.duration << " ms\r\n";
|
log << "parm_right_cursor: "
|
||||||
|
<< om.F_parm_right_cursor.duration << " ms" << std::flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -148,20 +148,10 @@ void FProgressbar::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FProgressbar::drawProgressLabel()
|
void FProgressbar::drawProgressLabel()
|
||||||
{
|
{
|
||||||
const auto& parent_widget = getParentWidget();
|
|
||||||
|
|
||||||
if ( parent_widget )
|
|
||||||
setColor ( parent_widget->getForegroundColor()
|
|
||||||
, parent_widget->getBackgroundColor() );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const auto& wc = getColorTheme();
|
|
||||||
setColor (wc->dialog_fg, wc->dialog_bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
|
useParentWidgetColor();
|
||||||
print() << FPoint{int(getWidth()) - 3, 0};
|
print() << FPoint{int(getWidth()) - 3, 0};
|
||||||
|
|
||||||
if ( percentage > 100 )
|
if ( percentage > 100 )
|
||||||
|
|
|
@ -74,7 +74,7 @@ void FRadioButton::draw()
|
||||||
void FRadioButton::drawRadioButton()
|
void FRadioButton::drawRadioButton()
|
||||||
{
|
{
|
||||||
print() << FPoint{1, 1};
|
print() << FPoint{1, 1};
|
||||||
setColor();
|
useParentWidgetColor();
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -293,6 +293,15 @@ bool FScrollView::setViewportPrint (bool enable)
|
||||||
return (use_own_print_area = ! enable);
|
return (use_own_print_area = ! enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FScrollView::resetColors()
|
||||||
|
{
|
||||||
|
const auto& wc = getColorTheme();
|
||||||
|
setForegroundColor (wc->dialog_fg);
|
||||||
|
setBackgroundColor (wc->dialog_bg);
|
||||||
|
FWidget::resetColors();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FScrollView::setBorder (bool enable)
|
bool FScrollView::setBorder (bool enable)
|
||||||
{
|
{
|
||||||
|
@ -712,9 +721,7 @@ void FScrollView::init (const FWidget* parent)
|
||||||
initScrollbar (vbar, fc::vertical, &FScrollView::cb_vbarChange);
|
initScrollbar (vbar, fc::vertical, &FScrollView::cb_vbarChange);
|
||||||
initScrollbar (hbar, fc::horizontal, &FScrollView::cb_hbarChange);
|
initScrollbar (hbar, fc::horizontal, &FScrollView::cb_hbarChange);
|
||||||
mapKeyFunctions();
|
mapKeyFunctions();
|
||||||
const auto& wc = getColorTheme();
|
resetColors();
|
||||||
setForegroundColor (wc->dialog_fg);
|
|
||||||
setBackgroundColor (wc->dialog_bg);
|
|
||||||
setGeometry (FPoint{1, 1}, FSize{4, 4});
|
setGeometry (FPoint{1, 1}, FSize{4, 4});
|
||||||
setMinimumSize (FSize{4, 4});
|
setMinimumSize (FSize{4, 4});
|
||||||
const int xoffset_end = int(getScrollWidth() - getViewportWidth());
|
const int xoffset_end = int(getScrollWidth() - getViewportWidth());
|
||||||
|
|
|
@ -158,6 +158,15 @@ void FStatusBar::setMessage (const FString& mgs)
|
||||||
text.setString(mgs);
|
text.setString(mgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FStatusBar::resetColors()
|
||||||
|
{
|
||||||
|
const auto& wc = getColorTheme();
|
||||||
|
setForegroundColor (wc->statusbar_fg);
|
||||||
|
setBackgroundColor (wc->statusbar_bg);
|
||||||
|
FWidget::resetColors();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FStatusBar::hasActivatedKey() const
|
bool FStatusBar::hasActivatedKey() const
|
||||||
{
|
{
|
||||||
|
@ -513,9 +522,7 @@ void FStatusBar::init()
|
||||||
if ( getRootWidget() )
|
if ( getRootWidget() )
|
||||||
getRootWidget()->setBottomPadding(1, true);
|
getRootWidget()->setBottomPadding(1, true);
|
||||||
|
|
||||||
const auto& wc = getColorTheme();
|
resetColors();
|
||||||
setForegroundColor (wc->statusbar_fg);
|
|
||||||
setBackgroundColor (wc->statusbar_bg);
|
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ FStringStream::~FStringStream() // destructor
|
||||||
|
|
||||||
// public methods of FStringStream
|
// public methods of FStringStream
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FStringStream& FStringStream::operator = (FStringStream&& sstream)
|
FStringStream& FStringStream::operator = (FStringStream&& sstream) noexcept
|
||||||
{
|
{
|
||||||
std::wiostream::operator = (std::move(sstream));
|
std::wiostream::operator = (std::move(sstream));
|
||||||
buffer = std::move(sstream.buffer);
|
buffer = std::move(sstream.buffer);
|
||||||
|
|
|
@ -1882,13 +1882,13 @@ void FTerm::redefineColorPalette()
|
||||||
{
|
{
|
||||||
// Redefine the color palette
|
// Redefine the color palette
|
||||||
|
|
||||||
if ( ! canChangeColorPalette() )
|
if ( ! (canChangeColorPalette() && getStartOptions().color_change) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
resetColorMap();
|
resetColorMap();
|
||||||
saveColorMap();
|
saveColorMap();
|
||||||
|
|
||||||
if ( FStartOptions::getFStartOptions().dark_theme )
|
if ( getStartOptions().dark_theme )
|
||||||
{
|
{
|
||||||
setColorPaletteTheme<default16DarkColorPalette>(&FTerm::setPalette);
|
setColorPaletteTheme<default16DarkColorPalette>(&FTerm::setPalette);
|
||||||
}
|
}
|
||||||
|
@ -1899,14 +1899,12 @@ void FTerm::redefineColorPalette()
|
||||||
else // 8 colors
|
else // 8 colors
|
||||||
setColorPaletteTheme<default8ColorPalette>(&FTerm::setPalette);
|
setColorPaletteTheme<default8ColorPalette>(&FTerm::setPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
getColorPaletteTheme()->setColorPalette();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTerm::restoreColorPalette()
|
void FTerm::restoreColorPalette()
|
||||||
{
|
{
|
||||||
if ( ! canChangeColorPalette() )
|
if ( ! (canChangeColorPalette() && getStartOptions().color_change) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Reset screen settings
|
// Reset screen settings
|
||||||
|
@ -2283,7 +2281,6 @@ void FTerm::init (bool disable_alt_screen)
|
||||||
initTermspecifics();
|
initTermspecifics();
|
||||||
|
|
||||||
// Redefine the color palette
|
// Redefine the color palette
|
||||||
if ( getStartOptions().color_change )
|
|
||||||
redefineColorPalette();
|
redefineColorPalette();
|
||||||
|
|
||||||
// Set 220 Hz beep (100 ms)
|
// Set 220 Hz beep (100 ms)
|
||||||
|
@ -2447,7 +2444,6 @@ void FTerm::finish()
|
||||||
getFTermXTerminal()->setCursorStyle (fc::steady_block);
|
getFTermXTerminal()->setCursorStyle (fc::steady_block);
|
||||||
|
|
||||||
// Restore the color palette
|
// Restore the color palette
|
||||||
if ( getStartOptions().color_change )
|
|
||||||
restoreColorPalette();
|
restoreColorPalette();
|
||||||
|
|
||||||
// Switch to normal escape key mode
|
// Switch to normal escape key mode
|
||||||
|
|
|
@ -104,6 +104,15 @@ void FTextView::setGeometry ( const FPoint& pos, const FSize& size
|
||||||
changeOnResize();
|
changeOnResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FTextView::resetColors()
|
||||||
|
{
|
||||||
|
const auto& wc = getColorTheme();
|
||||||
|
setForegroundColor (wc->dialog_fg);
|
||||||
|
setBackgroundColor (wc->dialog_bg);
|
||||||
|
FWidget::resetColors();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::setText (const FString& str)
|
void FTextView::setText (const FString& str)
|
||||||
{
|
{
|
||||||
|
@ -569,9 +578,7 @@ void FTextView::init()
|
||||||
{
|
{
|
||||||
initScrollbar (vbar, fc::vertical, this, &FTextView::cb_vbarChange);
|
initScrollbar (vbar, fc::vertical, this, &FTextView::cb_vbarChange);
|
||||||
initScrollbar (hbar, fc::horizontal, this, &FTextView::cb_hbarChange);
|
initScrollbar (hbar, fc::horizontal, this, &FTextView::cb_hbarChange);
|
||||||
const auto& wc = getColorTheme();
|
resetColors();
|
||||||
setForegroundColor (wc->dialog_fg);
|
|
||||||
setBackgroundColor (wc->dialog_bg);
|
|
||||||
nf_offset = FTerm::isNewFont() ? 1 : 0;
|
nf_offset = FTerm::isNewFont() ? 1 : 0;
|
||||||
setTopPadding(1);
|
setTopPadding(1);
|
||||||
setLeftPadding(1);
|
setLeftPadding(1);
|
||||||
|
|
|
@ -111,6 +111,33 @@ void FToggleButton::setGeometry ( const FPoint& pos, const FSize& s
|
||||||
FWidget::setGeometry (pos, size, adjust);
|
FWidget::setGeometry (pos, size, adjust);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FToggleButton::resetColors()
|
||||||
|
{
|
||||||
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
|
if ( isEnabled() ) // active
|
||||||
|
{
|
||||||
|
if ( hasFocus() )
|
||||||
|
{
|
||||||
|
setForegroundColor (wc->toggle_button_active_focus_fg);
|
||||||
|
setBackgroundColor (wc->toggle_button_active_focus_bg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setForegroundColor (wc->toggle_button_active_fg);
|
||||||
|
setBackgroundColor (wc->toggle_button_active_bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // inactive
|
||||||
|
{
|
||||||
|
setForegroundColor (wc->label_inactive_fg);
|
||||||
|
setBackgroundColor (wc->label_inactive_bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
FWidget::resetColors();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FToggleButton::setNoUnderline (bool enable)
|
bool FToggleButton::setNoUnderline (bool enable)
|
||||||
{
|
{
|
||||||
|
@ -497,26 +524,7 @@ void FToggleButton::setGroup (FButtonGroup* btngroup)
|
||||||
void FToggleButton::init()
|
void FToggleButton::init()
|
||||||
{
|
{
|
||||||
setGeometry (FPoint{1, 1}, FSize{4, 1}, false); // initialize geometry values
|
setGeometry (FPoint{1, 1}, FSize{4, 1}, false); // initialize geometry values
|
||||||
const auto& wc = getColorTheme();
|
resetColors();
|
||||||
|
|
||||||
if ( isEnabled() )
|
|
||||||
{
|
|
||||||
if ( hasFocus() )
|
|
||||||
{
|
|
||||||
setForegroundColor (wc->toggle_button_active_focus_fg);
|
|
||||||
setBackgroundColor (wc->toggle_button_active_focus_bg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setForegroundColor (wc->toggle_button_active_fg);
|
|
||||||
setBackgroundColor (wc->toggle_button_active_bg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // inactive
|
|
||||||
{
|
|
||||||
setForegroundColor (wc->label_inactive_fg);
|
|
||||||
setBackgroundColor (wc->label_inactive_bg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -73,6 +73,15 @@ void FToolTip::setText (const FString& txt)
|
||||||
calculateDimensions();
|
calculateDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FToolTip::resetColors()
|
||||||
|
{
|
||||||
|
const auto& wc = getColorTheme();
|
||||||
|
setForegroundColor (wc->tooltip_fg);
|
||||||
|
setBackgroundColor (wc->tooltip_bg);
|
||||||
|
FWidget::resetColors();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FToolTip::setBorder (bool enable)
|
bool FToolTip::setBorder (bool enable)
|
||||||
{
|
{
|
||||||
|
@ -107,9 +116,7 @@ void FToolTip::init()
|
||||||
// initialize geometry values
|
// initialize geometry values
|
||||||
setGeometry (FPoint{1, 1}, FSize{3, 3}, false);
|
setGeometry (FPoint{1, 1}, FSize{3, 3}, false);
|
||||||
setMinimumSize (FSize{3, 3});
|
setMinimumSize (FSize{3, 3});
|
||||||
const auto& wc = getColorTheme();
|
resetColors();
|
||||||
setForegroundColor (wc->tooltip_fg);
|
|
||||||
setBackgroundColor (wc->tooltip_bg);
|
|
||||||
calculateDimensions();
|
calculateDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,6 +305,42 @@ bool FWidget::setFocus (bool enable)
|
||||||
return (flags.focus = enable);
|
return (flags.focus = enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWidget::resetColors()
|
||||||
|
{
|
||||||
|
if ( ! hasChildren() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (auto&& child : getChildren())
|
||||||
|
{
|
||||||
|
if ( child->isWidget() )
|
||||||
|
{
|
||||||
|
auto widget = static_cast<FWidget*>(child);
|
||||||
|
widget->resetColors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWidget::useParentWidgetColor()
|
||||||
|
{
|
||||||
|
const auto& parent_widget = getParentWidget();
|
||||||
|
|
||||||
|
if ( parent_widget )
|
||||||
|
{
|
||||||
|
setForegroundColor (parent_widget->getForegroundColor());
|
||||||
|
setBackgroundColor (parent_widget->getBackgroundColor());
|
||||||
|
}
|
||||||
|
else // Fallback
|
||||||
|
{
|
||||||
|
const auto& wc = getColorTheme();
|
||||||
|
setForegroundColor (wc->dialog_fg);
|
||||||
|
setBackgroundColor (wc->dialog_bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
setColor();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::setColor()
|
void FWidget::setColor()
|
||||||
{
|
{
|
||||||
|
|
|
@ -442,9 +442,9 @@ void default16ColorDarkTheme::setColorTheme()
|
||||||
titlebar_active_fg = fc::White;
|
titlebar_active_fg = fc::White;
|
||||||
titlebar_active_bg = fc::DarkGray;
|
titlebar_active_bg = fc::DarkGray;
|
||||||
titlebar_inactive_fg = fc::DarkGray;
|
titlebar_inactive_fg = fc::DarkGray;
|
||||||
titlebar_inactive_bg = fc::LightGray;
|
titlebar_inactive_bg = fc::LightBlue;
|
||||||
titlebar_button_fg = fc::DarkGray;
|
titlebar_button_fg = fc::DarkGray;
|
||||||
titlebar_button_bg = fc::LightGray;
|
titlebar_button_bg = fc::LightBlue;
|
||||||
titlebar_button_focus_fg = fc::LightGray;
|
titlebar_button_focus_fg = fc::LightGray;
|
||||||
titlebar_button_focus_bg = fc::Black;
|
titlebar_button_focus_bg = fc::Black;
|
||||||
menu_active_focus_fg = fc::White;
|
menu_active_focus_fg = fc::White;
|
||||||
|
|
|
@ -131,6 +131,8 @@ class FApplication : public FWidget
|
||||||
bool removeQueuedEvent (const FObject*);
|
bool removeQueuedEvent (const FObject*);
|
||||||
virtual void processExternalUserEvent();
|
virtual void processExternalUserEvent();
|
||||||
static FWidget* processParameters (const int&, char*[]);
|
static FWidget* processParameters (const int&, char*[]);
|
||||||
|
static void setDefaultTheme();
|
||||||
|
static void setDarkTheme();
|
||||||
static void showParameterUsage ()
|
static void showParameterUsage ()
|
||||||
#if defined(__clang__) || defined(__GNUC__)
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
__attribute__((noreturn))
|
__attribute__((noreturn))
|
||||||
|
|
|
@ -88,6 +88,7 @@ class FButton : public FWidget
|
||||||
void setFocusBackgroundColor (FColor);
|
void setFocusBackgroundColor (FColor);
|
||||||
void setInactiveForegroundColor (FColor);
|
void setInactiveForegroundColor (FColor);
|
||||||
void setInactiveBackgroundColor (FColor);
|
void setInactiveBackgroundColor (FColor);
|
||||||
|
void resetColors();
|
||||||
bool setNoUnderline(bool);
|
bool setNoUnderline(bool);
|
||||||
bool setNoUnderline();
|
bool setNoUnderline();
|
||||||
bool unsetNoUnderline();
|
bool unsetNoUnderline();
|
||||||
|
|
|
@ -108,6 +108,7 @@ class FDialog : public FWindow
|
||||||
bool setBorder (bool);
|
bool setBorder (bool);
|
||||||
bool setBorder();
|
bool setBorder();
|
||||||
bool unsetBorder();
|
bool unsetBorder();
|
||||||
|
void resetColors();
|
||||||
virtual void setText (const FString&);
|
virtual void setText (const FString&);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
|
|
|
@ -120,6 +120,7 @@ class FLineEdit : public FWidget
|
||||||
void setInputType (const inputType);
|
void setInputType (const inputType);
|
||||||
void setLabelOrientation (const label_o);
|
void setLabelOrientation (const label_o);
|
||||||
void setLabelAssociatedWidget (FWidget*);
|
void setLabelAssociatedWidget (FWidget*);
|
||||||
|
void resetColors();
|
||||||
void setSize (const FSize&, bool = true) override;
|
void setSize (const FSize&, bool = true) override;
|
||||||
void setGeometry ( const FPoint&, const FSize&
|
void setGeometry ( const FPoint&, const FSize&
|
||||||
, bool = true ) override;
|
, bool = true ) override;
|
||||||
|
|
|
@ -106,6 +106,7 @@ class FMenu : public FWindow, public FMenuList
|
||||||
void setStatusbarMessage (const FString&) override;
|
void setStatusbarMessage (const FString&) override;
|
||||||
void setMenu (FMenu*);
|
void setMenu (FMenu*);
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
void resetColors();
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isSelected() const;
|
bool isSelected() const;
|
||||||
|
|
|
@ -86,6 +86,7 @@ class FMenuBar : public FWindow, public FMenuList
|
||||||
const FString getClassName() const override;
|
const FString getClassName() const override;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
void resetColors();
|
||||||
void resetMenu();
|
void resetMenu();
|
||||||
void hide() override;
|
void hide() override;
|
||||||
void adjustSize() override;
|
void adjustSize() override;
|
||||||
|
|
|
@ -108,6 +108,7 @@ class FScrollView : public FWidget
|
||||||
bool setViewportPrint (bool);
|
bool setViewportPrint (bool);
|
||||||
bool setViewportPrint();
|
bool setViewportPrint();
|
||||||
bool unsetViewportPrint();
|
bool unsetViewportPrint();
|
||||||
|
void resetColors();
|
||||||
bool setBorder (bool);
|
bool setBorder (bool);
|
||||||
bool setBorder();
|
bool setBorder();
|
||||||
bool unsetBorder();
|
bool unsetBorder();
|
||||||
|
|
|
@ -205,6 +205,7 @@ class FStatusBar : public FWindow
|
||||||
void activateKey (int);
|
void activateKey (int);
|
||||||
void deactivateKey (int);
|
void deactivateKey (int);
|
||||||
void setMessage (const FString&);
|
void setMessage (const FString&);
|
||||||
|
void resetColors();
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isActivated (int) const;
|
bool isActivated (int) const;
|
||||||
|
|
|
@ -78,7 +78,7 @@ class FStringStream : public std::wiostream
|
||||||
FStringStream& operator = (const FStringStream&) = delete;
|
FStringStream& operator = (const FStringStream&) = delete;
|
||||||
|
|
||||||
// Move assignment operator (=)
|
// Move assignment operator (=)
|
||||||
FStringStream& operator = (FStringStream&& sstream);
|
FStringStream& operator = (FStringStream&& sstream) noexcept;
|
||||||
|
|
||||||
virtual const FString getClassName() const;
|
virtual const FString getClassName() const;
|
||||||
void swap (FStringStream&) noexcept;
|
void swap (FStringStream&) noexcept;
|
||||||
|
|
|
@ -444,6 +444,7 @@ template<typename ClassT>
|
||||||
inline void FTerm::setColorPaletteTheme (const FSetPalette& f)
|
inline void FTerm::setColorPaletteTheme (const FSetPalette& f)
|
||||||
{
|
{
|
||||||
getColorPaletteTheme() = std::make_shared<ClassT>(f);
|
getColorPaletteTheme() = std::make_shared<ClassT>(f);
|
||||||
|
getColorPaletteTheme()->setColorPalette();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -100,6 +100,7 @@ class FTextView : public FWidget
|
||||||
void setSize (const FSize&, bool = true) override;
|
void setSize (const FSize&, bool = true) override;
|
||||||
void setGeometry ( const FPoint&, const FSize&
|
void setGeometry ( const FPoint&, const FSize&
|
||||||
, bool = true ) override;
|
, bool = true ) override;
|
||||||
|
void resetColors();
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
void scrollToX (int);
|
void scrollToX (int);
|
||||||
void scrollToY (int);
|
void scrollToY (int);
|
||||||
|
|
|
@ -86,6 +86,7 @@ class FToggleButton : public FWidget
|
||||||
void setSize (const FSize&, bool = true) override;
|
void setSize (const FSize&, bool = true) override;
|
||||||
void setGeometry ( const FPoint&, const FSize&
|
void setGeometry ( const FPoint&, const FSize&
|
||||||
, bool = true ) override;
|
, bool = true ) override;
|
||||||
|
void resetColors();
|
||||||
bool setNoUnderline (bool);
|
bool setNoUnderline (bool);
|
||||||
bool setNoUnderline();
|
bool setNoUnderline();
|
||||||
bool unsetNoUnderline();
|
bool unsetNoUnderline();
|
||||||
|
|
|
@ -85,6 +85,7 @@ class FToolTip : public FWindow
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
void resetColors();
|
||||||
bool setBorder (bool);
|
bool setBorder (bool);
|
||||||
bool setBorder();
|
bool setBorder();
|
||||||
bool unsetBorder();
|
bool unsetBorder();
|
||||||
|
|
|
@ -266,6 +266,8 @@ class FWidget : public FVTerm, public FObject
|
||||||
bool acceptPadding();
|
bool acceptPadding();
|
||||||
virtual void setForegroundColor (FColor);
|
virtual void setForegroundColor (FColor);
|
||||||
virtual void setBackgroundColor (FColor);
|
virtual void setBackgroundColor (FColor);
|
||||||
|
virtual void resetColors();
|
||||||
|
void useParentWidgetColor();
|
||||||
void setColor();
|
void setColor();
|
||||||
FWidgetFlags& setFlags();
|
FWidgetFlags& setFlags();
|
||||||
// Positioning and sizes mutators...
|
// Positioning and sizes mutators...
|
||||||
|
|
Loading…
Reference in New Issue