With FWidgetColors you can now create your own widget color themes
This commit is contained in:
parent
8a153c6d45
commit
45ddbd88d3
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
engines:
|
||||||
|
duplication:
|
||||||
|
enabled: true
|
||||||
|
exclude_paths:
|
||||||
|
- 'fonts/**'
|
||||||
|
- 'test/**'
|
||||||
|
exclude_paths:
|
||||||
|
- 'debian/**'
|
||||||
|
- 'doc/**'
|
||||||
|
- 'icon/**'
|
||||||
|
- 'logo/**'
|
||||||
|
- 'm4/**'
|
||||||
|
- 'scripts/**'
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2020-05-26 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* FWidgetColors now uses polymorphism, so you can now easily
|
||||||
|
create your own widget color theme
|
||||||
|
|
||||||
2020-05-24 Markus Gans <guru.mail@muenster.de>
|
2020-05-24 Markus Gans <guru.mail@muenster.de>
|
||||||
* New class FStringStream implements input and output operations
|
* New class FStringStream implements input and output operations
|
||||||
on FString based streams
|
on FString based streams
|
||||||
|
|
46
confdefs.h
46
confdefs.h
|
@ -1,46 +0,0 @@
|
||||||
/* confdefs.h */
|
|
||||||
#define PACKAGE_NAME "finalcut"
|
|
||||||
#define PACKAGE_TARNAME "finalcut"
|
|
||||||
#define PACKAGE_VERSION "0.6.1"
|
|
||||||
#define PACKAGE_STRING "finalcut 0.6.1"
|
|
||||||
#define PACKAGE_BUGREPORT ""
|
|
||||||
#define PACKAGE_URL ""
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
#define HAVE_SYS_TYPES_H 1
|
|
||||||
#define HAVE_SYS_STAT_H 1
|
|
||||||
#define HAVE_STDLIB_H 1
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
#define HAVE_MEMORY_H 1
|
|
||||||
#define HAVE_STRINGS_H 1
|
|
||||||
#define HAVE_INTTYPES_H 1
|
|
||||||
#define HAVE_STDINT_H 1
|
|
||||||
#define HAVE_UNISTD_H 1
|
|
||||||
#define __EXTENSIONS__ 1
|
|
||||||
#define _ALL_SOURCE 1
|
|
||||||
#define _GNU_SOURCE 1
|
|
||||||
#define _POSIX_PTHREAD_SEMANTICS 1
|
|
||||||
#define _TANDEM_SOURCE 1
|
|
||||||
#define PACKAGE "finalcut"
|
|
||||||
#define VERSION "0.6.1"
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
#define HAVE_LINUX_FB_H 1
|
|
||||||
#define HAVE_SYS_IO_H 1
|
|
||||||
#define HAVE_SYS_KD_H 1
|
|
||||||
#define HAVE_SYS_STAT_H 1
|
|
||||||
#define HAVE_SYS_TIME_H 1
|
|
||||||
#define HAVE_FCNTL_H 1
|
|
||||||
#define HAVE_LANGINFO_H 1
|
|
||||||
#define HAVE_TERM_H 1
|
|
||||||
#define HAVE_TERMIOS_H 1
|
|
||||||
#define HAVE_TTYENT_H 1
|
|
||||||
#define HAVE_UNISTD_H 1
|
|
||||||
#define HAVE_GETUID 1
|
|
||||||
#define HAVE_GETEUID 1
|
|
||||||
#define HAVE_GETTTYNAM 1
|
|
||||||
#define HAVE_SELECT 1
|
|
||||||
#define HAVE_STRDUP 1
|
|
||||||
#define HAVE_STRSTR 1
|
|
||||||
#define HAVE_VSNPRINTF 1
|
|
||||||
#define HAVE_DLFCN_H 1
|
|
||||||
#define LT_OBJDIR ".libs/"
|
|
||||||
#define HAVE_LIBGPM 1
|
|
|
@ -81,10 +81,10 @@ void Button::setChecked (bool enable)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setBackgroundColor(wc.button_active_bg);
|
setBackgroundColor(wc->button_active_bg);
|
||||||
setFocusForegroundColor(wc.button_active_focus_fg);
|
setFocusForegroundColor(wc->button_active_focus_fg);
|
||||||
setFocusBackgroundColor(wc.button_active_focus_bg);
|
setFocusBackgroundColor(wc->button_active_focus_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
|
@ -424,10 +424,10 @@ void Calc::drawDispay()
|
||||||
if ( finalcut::FTerm::isMonochron() )
|
if ( finalcut::FTerm::isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
print() << FColorPair{fc::Black, fc::LightGray}
|
print() << FColorPair{fc::Black, fc::LightGray}
|
||||||
<< FPoint{3, 3} << display << ' '
|
<< FPoint{3, 3} << display << ' '
|
||||||
<< FColorPair{wc.dialog_fg, wc.dialog_bg};
|
<< FColorPair{wc->dialog_fg, wc->dialog_bg};
|
||||||
|
|
||||||
if ( finalcut::FTerm::isMonochron() )
|
if ( finalcut::FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
|
@ -46,8 +46,8 @@ class Keyboard final : public finalcut::FWidget
|
||||||
Keyboard::Keyboard (finalcut::FWidget* parent)
|
Keyboard::Keyboard (finalcut::FWidget* parent)
|
||||||
: finalcut::FWidget{parent}
|
: finalcut::FWidget{parent}
|
||||||
{
|
{
|
||||||
setFWidgetColors().term_fg = finalcut::fc::Default;
|
getColorTheme()->term_fg = finalcut::fc::Default;
|
||||||
setFWidgetColors().term_bg = finalcut::fc::Default;
|
getColorTheme()->term_bg = finalcut::fc::Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -131,8 +131,8 @@ void Scrollview::draw()
|
||||||
if ( finalcut::FTerm::isMonochron() )
|
if ( finalcut::FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.label_inactive_fg, wc.dialog_bg);
|
setColor (wc->label_inactive_fg, wc->dialog_bg);
|
||||||
clearArea();
|
clearArea();
|
||||||
|
|
||||||
for (int y{0}; y < int(getScrollHeight()); y++)
|
for (int y{0}; y < int(getScrollHeight()); y++)
|
||||||
|
|
|
@ -66,7 +66,7 @@ class AttribDlg final : public finalcut::FDialog
|
||||||
void adjustSize() override;
|
void adjustSize() override;
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
FColor bgcolor{getFWidgetColors().label_bg};
|
FColor bgcolor{getColorTheme()->label_bg};
|
||||||
finalcut::FButton next_button{"&Next >", this};
|
finalcut::FButton next_button{"&Next >", this};
|
||||||
finalcut::FButton back_button{"< &Back", this};
|
finalcut::FButton back_button{"< &Back", this};
|
||||||
};
|
};
|
||||||
|
@ -267,11 +267,11 @@ void AttribDemo::printColorLine()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void AttribDemo::printAltCharset()
|
void AttribDemo::printAltCharset()
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
const auto& parent = static_cast<AttribDlg*>(getParent());
|
const auto& parent = static_cast<AttribDlg*>(getParent());
|
||||||
|
|
||||||
if ( ! finalcut::FTerm::isMonochron() )
|
if ( ! finalcut::FTerm::isMonochron() )
|
||||||
setColor (wc.label_fg, wc.label_bg);
|
setColor (wc->label_fg, wc->label_bg);
|
||||||
|
|
||||||
print() << FPoint{1, 1} << "alternate charset: ";
|
print() << FPoint{1, 1} << "alternate charset: ";
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ void AttribDemo::printProtected()
|
||||||
void AttribDemo::draw()
|
void AttribDemo::draw()
|
||||||
{
|
{
|
||||||
// test alternate character set
|
// test alternate character set
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
printAltCharset();
|
printAltCharset();
|
||||||
|
|
||||||
const std::vector<std::function<void()> > effect
|
const std::vector<std::function<void()> > effect
|
||||||
|
@ -442,14 +442,14 @@ void AttribDemo::draw()
|
||||||
print() << FPoint{1, 2 + int(y)};
|
print() << FPoint{1, 2 + int(y)};
|
||||||
|
|
||||||
if ( ! finalcut::FTerm::isMonochron() )
|
if ( ! finalcut::FTerm::isMonochron() )
|
||||||
setColor (wc.label_fg, wc.label_bg);
|
setColor (wc->label_fg, wc->label_bg);
|
||||||
|
|
||||||
if ( y < effect.size() )
|
if ( y < effect.size() )
|
||||||
effect[y]();
|
effect[y]();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! finalcut::FTerm::isMonochron() )
|
if ( ! finalcut::FTerm::isMonochron() )
|
||||||
setColor(wc.label_fg, wc.label_bg);
|
setColor(wc->label_fg, wc->label_bg);
|
||||||
|
|
||||||
print() << FPoint{1, 15};
|
print() << FPoint{1, 15};
|
||||||
const FColor bg = static_cast<AttribDlg*>(getParent())->getBGColor();
|
const FColor bg = static_cast<AttribDlg*>(getParent())->getBGColor();
|
||||||
|
|
|
@ -54,8 +54,8 @@ Timer::Timer (finalcut::FWidget* parent)
|
||||||
delTimer (id);
|
delTimer (id);
|
||||||
addTimer (250); // 250-millisecond timer
|
addTimer (250); // 250-millisecond timer
|
||||||
|
|
||||||
setFWidgetColors().term_fg = fc::Default;
|
getColorTheme()->term_fg = fc::Default;
|
||||||
setFWidgetColors().term_bg = fc::Default;
|
getColorTheme()->term_bg = fc::Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -94,8 +94,8 @@ void Transparent::draw()
|
||||||
|
|
||||||
if ( type == shadow )
|
if ( type == shadow )
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
print() << FColorPair {wc.shadow_bg, wc.shadow_fg}
|
print() << FColorPair {wc->shadow_bg, wc->shadow_fg}
|
||||||
<< FStyle {fc::ColorOverlay};
|
<< FStyle {fc::ColorOverlay};
|
||||||
}
|
}
|
||||||
else if ( type == inherit_background )
|
else if ( type == inherit_background )
|
||||||
|
|
|
@ -68,30 +68,30 @@ class SmallWindow final : public finalcut::FDialog
|
||||||
SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
||||||
: finalcut::FDialog{parent}
|
: finalcut::FDialog{parent}
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
const wchar_t arrow_up = fc::BlackUpPointingTriangle;
|
const wchar_t arrow_up = fc::BlackUpPointingTriangle;
|
||||||
const wchar_t arrow_down = fc::BlackDownPointingTriangle;
|
const wchar_t arrow_down = fc::BlackDownPointingTriangle;
|
||||||
|
|
||||||
left_arrow = arrow_up;
|
left_arrow = arrow_up;
|
||||||
left_arrow.setForegroundColor (wc.label_inactive_fg);
|
left_arrow.setForegroundColor (wc->label_inactive_fg);
|
||||||
left_arrow.setEmphasis();
|
left_arrow.setEmphasis();
|
||||||
left_arrow.ignorePadding();
|
left_arrow.ignorePadding();
|
||||||
left_arrow.setGeometry (FPoint{2, 2}, FSize{1, 1});
|
left_arrow.setGeometry (FPoint{2, 2}, FSize{1, 1});
|
||||||
|
|
||||||
right_arrow = arrow_up;
|
right_arrow = arrow_up;
|
||||||
right_arrow.setForegroundColor (wc.label_inactive_fg);
|
right_arrow.setForegroundColor (wc->label_inactive_fg);
|
||||||
right_arrow.setEmphasis();
|
right_arrow.setEmphasis();
|
||||||
right_arrow.ignorePadding();
|
right_arrow.ignorePadding();
|
||||||
right_arrow.setGeometry (FPoint{int(getWidth()) - 1, 2}, FSize{1, 1});
|
right_arrow.setGeometry (FPoint{int(getWidth()) - 1, 2}, FSize{1, 1});
|
||||||
|
|
||||||
top_left_label = "menu";
|
top_left_label = "menu";
|
||||||
top_left_label.setForegroundColor (wc.label_inactive_fg);
|
top_left_label.setForegroundColor (wc->label_inactive_fg);
|
||||||
top_left_label.setEmphasis();
|
top_left_label.setEmphasis();
|
||||||
top_left_label.setGeometry (FPoint{1, 1}, FSize{6, 1});
|
top_left_label.setGeometry (FPoint{1, 1}, FSize{6, 1});
|
||||||
|
|
||||||
top_right_label = "zoom";
|
top_right_label = "zoom";
|
||||||
top_right_label.setAlignment (fc::alignRight);
|
top_right_label.setAlignment (fc::alignRight);
|
||||||
top_right_label.setForegroundColor (wc.label_inactive_fg);
|
top_right_label.setForegroundColor (wc->label_inactive_fg);
|
||||||
top_right_label.setEmphasis();
|
top_right_label.setEmphasis();
|
||||||
top_right_label.setGeometry (FPoint{int(getClientWidth()) - 5, 1}, FSize{6, 1});
|
top_right_label.setGeometry (FPoint{int(getClientWidth()) - 5, 1}, FSize{6, 1});
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
||||||
bottom_label_text += arrow_down;
|
bottom_label_text += arrow_down;
|
||||||
bottom_label = bottom_label_text;
|
bottom_label = bottom_label_text;
|
||||||
bottom_label.setAlignment (fc::alignRight);
|
bottom_label.setAlignment (fc::alignRight);
|
||||||
bottom_label.setForegroundColor (wc.label_inactive_fg);
|
bottom_label.setForegroundColor (wc->label_inactive_fg);
|
||||||
bottom_label.setEmphasis();
|
bottom_label.setEmphasis();
|
||||||
bottom_label.setGeometry (FPoint{13, 3}, FSize{6, 3});
|
bottom_label.setGeometry (FPoint{13, 3}, FSize{6, 3});
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,6 +120,10 @@ FApplication::FLogPtr& FApplication::getLog()
|
||||||
{
|
{
|
||||||
// Global logger object
|
// Global logger object
|
||||||
static FLogPtr* logger = new FLogPtr();
|
static FLogPtr* logger = new FLogPtr();
|
||||||
|
|
||||||
|
if ( logger && logger->get() == nullptr )
|
||||||
|
*logger = std::make_shared<FLogger>();
|
||||||
|
|
||||||
return *logger;
|
return *logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +379,6 @@ void FApplication::init (uInt64 key_time, uInt64 dblclick_time)
|
||||||
mouse->setDblclickInterval (dblclick_time);
|
mouse->setDblclickInterval (dblclick_time);
|
||||||
|
|
||||||
// Initialize logging
|
// Initialize logging
|
||||||
setLog (std::make_shared<FLogger>());
|
|
||||||
getLog()->setLineEnding(FLog::CRLF);
|
getLog()->setLineEnding(FLog::CRLF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,7 +487,7 @@ inline FStartOptions& FApplication::getStartOptions()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FApplication::destroyLog()
|
inline void FApplication::destroyLog()
|
||||||
{
|
{
|
||||||
FLogPtr* logger = &(getLog());
|
const FLogPtr* logger = &(getLog());
|
||||||
delete logger;
|
delete logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1165,7 +1168,8 @@ void FApplication::performTimerAction (FObject* receiver, FEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FApplication::isEventProcessable (const FObject* receiver, const FEvent* event )
|
bool FApplication::isEventProcessable ( const FObject* receiver
|
||||||
|
, const FEvent* event )
|
||||||
{
|
{
|
||||||
if ( ! receiver->isWidget() ) // No restrictions for non-widgets
|
if ( ! receiver->isWidget() ) // No restrictions for non-widgets
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -218,9 +218,9 @@ void FButton::hide()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
fg = wc.dialog_fg;
|
fg = wc->dialog_fg;
|
||||||
bg = wc.dialog_bg;
|
bg = wc->dialog_bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
|
@ -387,9 +387,9 @@ void FButton::onFocusOut (FFocusEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButton::init()
|
void FButton::init()
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setForegroundColor (wc.button_active_fg);
|
setForegroundColor (wc->button_active_fg);
|
||||||
setBackgroundColor (wc.button_active_bg);
|
setBackgroundColor (wc->button_active_bg);
|
||||||
setShadow();
|
setShadow();
|
||||||
|
|
||||||
if ( ! text.isEmpty() )
|
if ( ! text.isEmpty() )
|
||||||
|
|
|
@ -196,9 +196,9 @@ void FButtonGroup::hide()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
fg = wc.dialog_fg;
|
fg = wc->dialog_fg;
|
||||||
bg = wc.dialog_bg;
|
bg = wc->dialog_bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
|
@ -427,9 +427,9 @@ bool FButtonGroup::isRadioButton (const FToggleButton* button) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButtonGroup::init()
|
void FButtonGroup::init()
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setForegroundColor (wc.label_fg);
|
setForegroundColor (wc->label_fg);
|
||||||
setBackgroundColor (wc.label_bg);
|
setBackgroundColor (wc->label_bg);
|
||||||
setMinimumSize (FSize{7, 3});
|
setMinimumSize (FSize{7, 3});
|
||||||
buttonlist.clear(); // no buttons yet
|
buttonlist.clear(); // no buttons yet
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ void FButtonGroup::init()
|
||||||
void FButtonGroup::drawText ( const FString& label_text
|
void FButtonGroup::drawText ( const FString& label_text
|
||||||
, std::size_t hotkeypos )
|
, std::size_t hotkeypos )
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
const std::size_t column_width = getColumnWidth(label_text);
|
const std::size_t column_width = getColumnWidth(label_text);
|
||||||
std::size_t length = label_text.getLength();
|
std::size_t length = label_text.getLength();
|
||||||
bool ellipsis{false};
|
bool ellipsis{false};
|
||||||
|
@ -455,15 +455,15 @@ void FButtonGroup::drawText ( const FString& label_text
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
setColor(wc.label_emphasis_fg, wc.label_bg);
|
setColor(wc->label_emphasis_fg, wc->label_bg);
|
||||||
else
|
else
|
||||||
setColor(wc.label_inactive_fg, wc.label_inactive_bg);
|
setColor(wc->label_inactive_fg, wc->label_inactive_bg);
|
||||||
|
|
||||||
for (std::size_t z{0}; z < length; z++)
|
for (std::size_t z{0}; z < length; z++)
|
||||||
{
|
{
|
||||||
if ( (z == hotkeypos) && getFlags().active )
|
if ( (z == hotkeypos) && getFlags().active )
|
||||||
{
|
{
|
||||||
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
|
setColor (wc->label_hotkey_fg, wc->label_hotkey_bg);
|
||||||
|
|
||||||
if ( ! getFlags().no_underline )
|
if ( ! getFlags().no_underline )
|
||||||
setUnderline();
|
setUnderline();
|
||||||
|
@ -473,14 +473,14 @@ void FButtonGroup::drawText ( const FString& label_text
|
||||||
if ( ! getFlags().no_underline )
|
if ( ! getFlags().no_underline )
|
||||||
unsetUnderline();
|
unsetUnderline();
|
||||||
|
|
||||||
setColor (wc.label_emphasis_fg, wc.label_bg);
|
setColor (wc->label_emphasis_fg, wc->label_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print (label_text[z]);
|
print (label_text[z]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ellipsis ) // Print ellipsis
|
if ( ellipsis ) // Print ellipsis
|
||||||
print() << FColorPair {wc.label_ellipsis_fg, wc.label_bg} << "..";
|
print() << FColorPair {wc->label_ellipsis_fg, wc->label_bg} << "..";
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
|
@ -124,8 +124,8 @@ void FDropDownListBox::init()
|
||||||
void FDropDownListBox::draw()
|
void FDropDownListBox::draw()
|
||||||
{
|
{
|
||||||
// Fill the background
|
// Fill the background
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.menu_active_fg, wc.menu_active_bg);
|
setColor (wc->menu_active_fg, wc->menu_active_bg);
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -140,9 +140,9 @@ void FDropDownListBox::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDropDownListBox::drawShadow()
|
void FDropDownListBox::drawShadow()
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
finalcut::drawShadow(this);
|
finalcut::drawShadow(this);
|
||||||
setColor (wc.shadow_fg, wc.shadow_bg);
|
setColor (wc->shadow_fg, wc->shadow_bg);
|
||||||
print() << FPoint{int(getWidth()) + 1, 1} << fc::FullBlock; // █
|
print() << FPoint{int(getWidth()) + 1, 1} << fc::FullBlock; // █
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,16 +533,16 @@ void FComboBox::initCallbacks()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FComboBox::draw()
|
void FComboBox::draw()
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
const FColorPair button_color = [this, &wc] ()
|
const FColorPair button_color = [this, &wc] ()
|
||||||
{
|
{
|
||||||
if ( list_window.isEmpty() )
|
if ( list_window.isEmpty() )
|
||||||
return FColorPair { wc.scrollbar_button_inactive_fg
|
return FColorPair { wc->scrollbar_button_inactive_fg
|
||||||
, wc.scrollbar_button_inactive_bg };
|
, wc->scrollbar_button_inactive_bg };
|
||||||
else
|
else
|
||||||
return FColorPair { wc.scrollbar_button_fg
|
return FColorPair { wc->scrollbar_button_fg
|
||||||
, wc.scrollbar_button_bg };
|
, wc->scrollbar_button_bg };
|
||||||
}();
|
}();
|
||||||
|
|
||||||
print() << FPoint{int(getWidth()) - nf, 1}
|
print() << FPoint{int(getWidth()) - nf, 1}
|
||||||
|
|
|
@ -800,9 +800,9 @@ void FDialog::init()
|
||||||
addDialog(this);
|
addDialog(this);
|
||||||
setActiveWindow(this);
|
setActiveWindow(this);
|
||||||
setTransparentShadow();
|
setTransparentShadow();
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc->dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc->dialog_bg);
|
||||||
auto old_focus = FWidget::getFocusWidget();
|
auto old_focus = FWidget::getFocusWidget();
|
||||||
|
|
||||||
if ( old_focus )
|
if ( old_focus )
|
||||||
|
@ -924,8 +924,8 @@ void FDialog::drawBorder()
|
||||||
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isOrigin() )
|
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isOrigin() )
|
||||||
&& ! isZoomed() )
|
&& ! isZoomed() )
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.dialog_resize_fg, getBackgroundColor());
|
setColor (wc->dialog_resize_fg, getBackgroundColor());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
setColor();
|
setColor();
|
||||||
|
@ -983,12 +983,12 @@ void FDialog::drawBarButton()
|
||||||
{
|
{
|
||||||
// Print the title button
|
// Print the title button
|
||||||
print() << FPoint{1, 1};
|
print() << FPoint{1, 1};
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( dialog_menu && dialog_menu->isShown() )
|
if ( dialog_menu && dialog_menu->isShown() )
|
||||||
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
setColor (wc->titlebar_button_focus_fg, wc->titlebar_button_focus_bg);
|
||||||
else
|
else
|
||||||
setColor (wc.titlebar_button_fg, wc.titlebar_button_bg);
|
setColor (wc->titlebar_button_fg, wc->titlebar_button_bg);
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
{
|
{
|
||||||
|
@ -1034,12 +1034,12 @@ void FDialog::drawZoomButton()
|
||||||
if ( ! isResizeable() )
|
if ( ! isResizeable() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( zoom_button_pressed )
|
if ( zoom_button_pressed )
|
||||||
setColor (wc.titlebar_button_focus_fg, wc.titlebar_button_focus_bg);
|
setColor (wc->titlebar_button_focus_fg, wc->titlebar_button_focus_bg);
|
||||||
else
|
else
|
||||||
setColor (wc.titlebar_button_fg, wc.titlebar_button_bg);
|
setColor (wc->titlebar_button_fg, wc->titlebar_button_bg);
|
||||||
|
|
||||||
if ( isZoomed() )
|
if ( isZoomed() )
|
||||||
drawRestoreSizeButton();
|
drawRestoreSizeButton();
|
||||||
|
@ -1101,15 +1101,15 @@ void FDialog::drawTextBar()
|
||||||
// Fill with spaces (left of the title)
|
// Fill with spaces (left of the title)
|
||||||
std::size_t center_offset{0};
|
std::size_t center_offset{0};
|
||||||
std::size_t x{1};
|
std::size_t x{1};
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( FTerm::getMaxColor() < 16 )
|
if ( FTerm::getMaxColor() < 16 )
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
if ( isWindowActive() || (dialog_menu && dialog_menu->isShown()) )
|
if ( isWindowActive() || (dialog_menu && dialog_menu->isShown()) )
|
||||||
setColor (wc.titlebar_active_fg, wc.titlebar_active_bg);
|
setColor (wc->titlebar_active_fg, wc->titlebar_active_bg);
|
||||||
else
|
else
|
||||||
setColor (wc.titlebar_inactive_fg, wc.titlebar_inactive_bg);
|
setColor (wc->titlebar_inactive_fg, wc->titlebar_inactive_bg);
|
||||||
|
|
||||||
const auto width = getWidth();
|
const auto width = getWidth();
|
||||||
const auto zoom_btn = getZoomButtonWidth();
|
const auto zoom_btn = getZoomButtonWidth();
|
||||||
|
|
|
@ -256,9 +256,9 @@ void FLabel::init()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc->dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc->dialog_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,8 +416,8 @@ void FLabel::printLine (FString& line)
|
||||||
|
|
||||||
if ( z == hotkeypos && getFlags().active )
|
if ( z == hotkeypos && getFlags().active )
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
|
setColor (wc->label_hotkey_fg, wc->label_hotkey_bg);
|
||||||
|
|
||||||
if ( ! getFlags().no_underline )
|
if ( ! getFlags().no_underline )
|
||||||
setUnderline();
|
setUnderline();
|
||||||
|
|
|
@ -99,26 +99,26 @@ const FLineEdit& FLineEdit::operator >> (FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FLineEdit::setEnable (bool enable)
|
bool FLineEdit::setEnable (bool enable)
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
FWidget::setEnable(enable);
|
FWidget::setEnable(enable);
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
{
|
{
|
||||||
if ( hasFocus() )
|
if ( hasFocus() )
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.inputfield_active_focus_fg);
|
setForegroundColor (wc->inputfield_active_focus_fg);
|
||||||
setBackgroundColor (wc.inputfield_active_focus_bg);
|
setBackgroundColor (wc->inputfield_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.inputfield_active_fg);
|
setForegroundColor (wc->inputfield_active_fg);
|
||||||
setBackgroundColor (wc.inputfield_active_bg);
|
setBackgroundColor (wc->inputfield_active_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.inputfield_inactive_fg);
|
setForegroundColor (wc->inputfield_inactive_fg);
|
||||||
setBackgroundColor (wc.inputfield_inactive_bg);
|
setBackgroundColor (wc->inputfield_inactive_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return enable;
|
return enable;
|
||||||
|
@ -131,17 +131,17 @@ bool FLineEdit::setFocus (bool enable)
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.inputfield_active_focus_fg);
|
setForegroundColor (wc->inputfield_active_focus_fg);
|
||||||
setBackgroundColor (wc.inputfield_active_focus_bg);
|
setBackgroundColor (wc->inputfield_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.inputfield_active_fg);
|
setForegroundColor (wc->inputfield_active_fg);
|
||||||
setBackgroundColor (wc.inputfield_active_bg);
|
setBackgroundColor (wc->inputfield_active_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,7 +655,7 @@ void FLineEdit::adjustSize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::init()
|
void FLineEdit::init()
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
label->setAccelWidget(this);
|
label->setAccelWidget(this);
|
||||||
|
|
||||||
if ( isReadOnly() )
|
if ( isReadOnly() )
|
||||||
|
@ -669,19 +669,19 @@ void FLineEdit::init()
|
||||||
{
|
{
|
||||||
if ( hasFocus() )
|
if ( hasFocus() )
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.inputfield_active_focus_fg);
|
setForegroundColor (wc->inputfield_active_focus_fg);
|
||||||
setBackgroundColor (wc.inputfield_active_focus_bg);
|
setBackgroundColor (wc->inputfield_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.inputfield_active_fg);
|
setForegroundColor (wc->inputfield_active_fg);
|
||||||
setBackgroundColor (wc.inputfield_active_bg);
|
setBackgroundColor (wc->inputfield_active_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // inactive
|
else // inactive
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.inputfield_inactive_fg);
|
setForegroundColor (wc->inputfield_inactive_fg);
|
||||||
setBackgroundColor (wc.inputfield_inactive_bg);
|
setBackgroundColor (wc->inputfield_inactive_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,8 +274,8 @@ void FListBox::clear()
|
||||||
hbar->hide();
|
hbar->hide();
|
||||||
|
|
||||||
// clear list from screen
|
// clear list from screen
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.list_fg, wc.list_bg);
|
setColor (wc->list_fg, wc->list_bg);
|
||||||
const std::size_t size = getWidth() - 2;
|
const std::size_t size = getWidth() - 2;
|
||||||
drawBorder();
|
drawBorder();
|
||||||
drawHeadline();
|
drawHeadline();
|
||||||
|
@ -655,9 +655,9 @@ 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 = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc->dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc->dialog_bg);
|
||||||
nf_offset = FTerm::isNewFont() ? 1 : 0;
|
nf_offset = FTerm::isNewFont() ? 1 : 0;
|
||||||
setTopPadding(1);
|
setTopPadding(1);
|
||||||
setLeftPadding(1);
|
setLeftPadding(1);
|
||||||
|
@ -792,12 +792,12 @@ void FListBox::drawHeadline()
|
||||||
const FString txt{" " + text + " "};
|
const FString txt{" " + text + " "};
|
||||||
const auto column_width = getColumnWidth(txt);
|
const auto column_width = getColumnWidth(txt);
|
||||||
print() << FPoint{2, 1};
|
print() << FPoint{2, 1};
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
setColor(wc.label_emphasis_fg, wc.label_bg);
|
setColor(wc->label_emphasis_fg, wc->label_bg);
|
||||||
else
|
else
|
||||||
setColor(wc.label_inactive_fg, wc.label_inactive_bg);
|
setColor(wc->label_inactive_fg, wc->label_inactive_bg);
|
||||||
|
|
||||||
if ( column_width <= getClientWidth() )
|
if ( column_width <= getClientWidth() )
|
||||||
print (txt);
|
print (txt);
|
||||||
|
@ -805,7 +805,7 @@ void FListBox::drawHeadline()
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
print() << getColumnSubString (text, 1, getClientWidth() - 2)
|
print() << getColumnSubString (text, 1, getClientWidth() - 2)
|
||||||
<< FColorPair {wc.label_ellipsis_fg, wc.label_bg} << "..";
|
<< FColorPair {wc->label_ellipsis_fg, wc->label_bg} << "..";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -870,7 +870,7 @@ inline void FListBox::drawListLine ( int y
|
||||||
, bool serach_mark )
|
, bool serach_mark )
|
||||||
{
|
{
|
||||||
const std::size_t inc_len = inc_search.getLength();
|
const std::size_t inc_len = inc_search.getLength();
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
const bool isCurrentLine( y + yoffset + 1 == int(current) );
|
const bool isCurrentLine( y + yoffset + 1 == int(current) );
|
||||||
const std::size_t first = std::size_t(xoffset) + 1;
|
const std::size_t first = std::size_t(xoffset) + 1;
|
||||||
const std::size_t max_width = getWidth() - nf_offset - 4;
|
const std::size_t max_width = getWidth() - nf_offset - 4;
|
||||||
|
@ -883,14 +883,14 @@ inline void FListBox::drawListLine ( int y
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
if ( serach_mark )
|
if ( serach_mark )
|
||||||
setColor ( wc.current_inc_search_element_fg
|
setColor ( wc->current_inc_search_element_fg
|
||||||
, wc.current_element_focus_bg );
|
, wc->current_element_focus_bg );
|
||||||
|
|
||||||
for (std::size_t i{0}; i < element.getLength(); i++)
|
for (std::size_t i{0}; i < element.getLength(); i++)
|
||||||
{
|
{
|
||||||
if ( serach_mark && i == inc_len && getFlags().focus )
|
if ( serach_mark && i == inc_len && getFlags().focus )
|
||||||
setColor ( wc.current_element_focus_fg
|
setColor ( wc->current_element_focus_fg
|
||||||
, wc.current_element_focus_bg );
|
, wc->current_element_focus_bg );
|
||||||
|
|
||||||
print (element[i]);
|
print (element[i]);
|
||||||
}
|
}
|
||||||
|
@ -945,17 +945,17 @@ inline void FListBox::drawListBracketsLine ( int y
|
||||||
std::size_t column_width = getColumnWidth(element);
|
std::size_t column_width = getColumnWidth(element);
|
||||||
const std::size_t text_width = getColumnWidth(getString(iter));
|
const std::size_t text_width = getColumnWidth(getString(iter));
|
||||||
std::size_t i{0};
|
std::size_t i{0};
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
for (; i < element.getLength(); i++)
|
for (; i < element.getLength(); i++)
|
||||||
{
|
{
|
||||||
if ( serach_mark && i == 0 )
|
if ( serach_mark && i == 0 )
|
||||||
setColor ( wc.current_inc_search_element_fg
|
setColor ( wc->current_inc_search_element_fg
|
||||||
, wc.current_element_focus_bg );
|
, wc->current_element_focus_bg );
|
||||||
|
|
||||||
if ( serach_mark && i == inc_len )
|
if ( serach_mark && i == inc_len )
|
||||||
setColor ( wc.current_element_focus_fg
|
setColor ( wc->current_element_focus_fg
|
||||||
, wc.current_element_focus_bg );
|
, wc->current_element_focus_bg );
|
||||||
|
|
||||||
print (element[i]);
|
print (element[i]);
|
||||||
}
|
}
|
||||||
|
@ -964,8 +964,8 @@ inline void FListBox::drawListBracketsLine ( int y
|
||||||
&& std::size_t(xoffset) <= text_width )
|
&& std::size_t(xoffset) <= text_width )
|
||||||
{
|
{
|
||||||
if ( serach_mark && i == inc_len )
|
if ( serach_mark && i == inc_len )
|
||||||
setColor ( wc.current_element_focus_fg
|
setColor ( wc->current_element_focus_fg
|
||||||
, wc.current_element_focus_bg );
|
, wc->current_element_focus_bg );
|
||||||
|
|
||||||
printRightBracket (iter->brackets);
|
printRightBracket (iter->brackets);
|
||||||
column_width++;
|
column_width++;
|
||||||
|
@ -990,7 +990,7 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
const bool isCurrentLine( y + yoffset + 1 == int(current) );
|
const bool isCurrentLine( y + yoffset + 1 == int(current) );
|
||||||
const std::size_t inc_len = inc_search.getLength();
|
const std::size_t inc_len = inc_search.getLength();
|
||||||
const std::size_t inc_width = getColumnWidth(inc_search);
|
const std::size_t inc_width = getColumnWidth(inc_search);
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
print() << FPoint{2, 2 + int(y)};
|
print() << FPoint{2, 2 + int(y)};
|
||||||
|
|
||||||
if ( isLineSelected )
|
if ( isLineSelected )
|
||||||
|
@ -998,14 +998,14 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setBold();
|
setBold();
|
||||||
else
|
else
|
||||||
setColor (wc.selected_list_fg, wc.selected_list_bg);
|
setColor (wc->selected_list_fg, wc->selected_list_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
unsetBold();
|
unsetBold();
|
||||||
else
|
else
|
||||||
setColor (wc.list_fg, wc.list_bg);
|
setColor (wc->list_fg, wc->list_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isCurrentLine )
|
if ( isCurrentLine )
|
||||||
|
@ -1018,11 +1018,11 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setBold();
|
setBold();
|
||||||
else if ( getFlags().focus )
|
else if ( getFlags().focus )
|
||||||
setColor ( wc.selected_current_element_focus_fg
|
setColor ( wc->selected_current_element_focus_fg
|
||||||
, wc.selected_current_element_focus_bg );
|
, wc->selected_current_element_focus_bg );
|
||||||
else
|
else
|
||||||
setColor ( wc.selected_current_element_fg
|
setColor ( wc->selected_current_element_fg
|
||||||
, wc.selected_current_element_bg );
|
, wc->selected_current_element_bg );
|
||||||
|
|
||||||
setCursorPos ({3, 2 + int(y)}); // first character
|
setCursorPos ({3, 2 + int(y)}); // first character
|
||||||
}
|
}
|
||||||
|
@ -1033,8 +1033,8 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
|
|
||||||
if ( getFlags().focus )
|
if ( getFlags().focus )
|
||||||
{
|
{
|
||||||
setColor ( wc.current_element_focus_fg
|
setColor ( wc->current_element_focus_fg
|
||||||
, wc.current_element_focus_bg );
|
, wc->current_element_focus_bg );
|
||||||
const int b = ( lineHasBrackets ) ? 1: 0;
|
const int b = ( lineHasBrackets ) ? 1: 0;
|
||||||
|
|
||||||
if ( inc_len > 0 ) // incremental search
|
if ( inc_len > 0 ) // incremental search
|
||||||
|
@ -1047,8 +1047,8 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
setCursorPos ({3 + b, 2 + int(y)}); // first character
|
setCursorPos ({3 + b, 2 + int(y)}); // first character
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
setColor ( wc.current_element_fg
|
setColor ( wc->current_element_fg
|
||||||
, wc.current_element_bg );
|
, wc->current_element_bg );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
|
|
|
@ -1523,9 +1523,9 @@ 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 = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc->dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc->dialog_bg);
|
||||||
nf_offset = FTerm::isNewFont() ? 1 : 0;
|
nf_offset = FTerm::isNewFont() ? 1 : 0;
|
||||||
setTopPadding(1);
|
setTopPadding(1);
|
||||||
setLeftPadding(1);
|
setLeftPadding(1);
|
||||||
|
@ -1876,8 +1876,8 @@ void FListView::clearList()
|
||||||
{
|
{
|
||||||
// Clear list from terminal screen
|
// Clear list from terminal screen
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.list_fg, wc.list_bg);
|
setColor (wc->list_fg, wc->list_bg);
|
||||||
const std::size_t size = getWidth() - 2;
|
const std::size_t size = getWidth() - 2;
|
||||||
drawBorder();
|
drawBorder();
|
||||||
drawHeadlines();
|
drawHeadlines();
|
||||||
|
@ -1897,8 +1897,8 @@ void FListView::clearList()
|
||||||
inline void FListView::setLineAttributes ( bool is_current
|
inline void FListView::setLineAttributes ( bool is_current
|
||||||
, bool is_focus )
|
, bool is_focus )
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.list_fg, wc.list_bg);
|
setColor (wc->list_fg, wc->list_bg);
|
||||||
|
|
||||||
if ( is_current )
|
if ( is_current )
|
||||||
{
|
{
|
||||||
|
@ -1910,12 +1910,12 @@ inline void FListView::setLineAttributes ( bool is_current
|
||||||
|
|
||||||
if ( is_focus )
|
if ( is_focus )
|
||||||
{
|
{
|
||||||
setColor ( wc.current_element_focus_fg
|
setColor ( wc->current_element_focus_fg
|
||||||
, wc.current_element_focus_bg );
|
, wc->current_element_focus_bg );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
setColor ( wc.current_element_fg
|
setColor ( wc->current_element_fg
|
||||||
, wc.current_element_bg );
|
, wc->current_element_bg );
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
@ -2039,12 +2039,12 @@ void FListView::drawHeadlineLabel (const headerItems::const_iterator& iter)
|
||||||
const headerItems::const_iterator first = header.begin();
|
const headerItems::const_iterator first = header.begin();
|
||||||
const int column = int(std::distance(first, iter)) + 1;
|
const int column = int(std::distance(first, iter)) + 1;
|
||||||
const bool has_sort_indicator( sort_column == column && ! hide_sort_indicator );
|
const bool has_sort_indicator( sort_column == column && ! hide_sort_indicator );
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
setColor (wc.label_emphasis_fg, wc.label_bg);
|
setColor (wc->label_emphasis_fg, wc->label_bg);
|
||||||
else
|
else
|
||||||
setColor (wc.label_inactive_fg, wc.label_inactive_bg);
|
setColor (wc->label_inactive_fg, wc->label_inactive_bg);
|
||||||
|
|
||||||
if ( has_sort_indicator && column_width >= column_max - 1 && column_width > 1 )
|
if ( has_sort_indicator && column_width >= column_max - 1 && column_width > 1 )
|
||||||
{
|
{
|
||||||
|
@ -2169,11 +2169,11 @@ void FListView::drawColumnEllipsis ( const headerItems::const_iterator& iter
|
||||||
// Print label ellipsis
|
// Print label ellipsis
|
||||||
static constexpr int ellipsis_length = 2;
|
static constexpr int ellipsis_length = 2;
|
||||||
const int width = iter->width;
|
const int width = iter->width;
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
headerline << ' '
|
headerline << ' '
|
||||||
<< getColumnSubString (text, 1, uInt(width - ellipsis_length))
|
<< getColumnSubString (text, 1, uInt(width - ellipsis_length))
|
||||||
<< FColorPair {wc.label_ellipsis_fg, wc.label_bg}
|
<< FColorPair {wc->label_ellipsis_fg, wc->label_bg}
|
||||||
<< "..";
|
<< "..";
|
||||||
|
|
||||||
if ( iter == header.end() - 1 ) // Last element
|
if ( iter == header.end() - 1 ) // Last element
|
||||||
|
|
|
@ -459,9 +459,9 @@ void FMenu::init(FWidget* parent)
|
||||||
setMenuWidget();
|
setMenuWidget();
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setForegroundColor (wc.menu_active_fg);
|
setForegroundColor (wc->menu_active_fg);
|
||||||
setBackgroundColor (wc.menu_active_bg);
|
setBackgroundColor (wc->menu_active_bg);
|
||||||
menuitem.setMenu(this);
|
menuitem.setMenu(this);
|
||||||
|
|
||||||
if ( parent )
|
if ( parent )
|
||||||
|
@ -1209,8 +1209,8 @@ bool FMenu::hotkeyMenu (FKeyEvent* ev)
|
||||||
void FMenu::draw()
|
void FMenu::draw()
|
||||||
{
|
{
|
||||||
// Fill the background
|
// Fill the background
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.menu_active_fg, wc.menu_active_bg);
|
setColor (wc->menu_active_fg, wc->menu_active_bg);
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -1243,9 +1243,9 @@ void FMenu::drawItems()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenu::drawSeparator (int y)
|
inline void FMenu::drawSeparator (int y)
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
print() << FPoint{1, 2 + y}
|
print() << FPoint{1, 2 + y}
|
||||||
<< FColorPair{wc.menu_active_fg, wc.menu_active_bg};
|
<< FColorPair{wc->menu_active_fg, wc->menu_active_bg};
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -1349,8 +1349,8 @@ inline void FMenu::drawCheckMarkPrefix (const FMenuItem* m_item)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.menu_inactive_fg, getBackgroundColor());
|
setColor (wc->menu_inactive_fg, getBackgroundColor());
|
||||||
|
|
||||||
if ( FTerm::getEncoding() == fc::ASCII )
|
if ( FTerm::getEncoding() == fc::ASCII )
|
||||||
print ('-');
|
print ('-');
|
||||||
|
@ -1382,8 +1382,8 @@ inline void FMenu::drawMenuText (menuText& data)
|
||||||
|
|
||||||
if ( z == data.hotkeypos )
|
if ( z == data.hotkeypos )
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
setColor (wc->menu_hotkey_fg, wc->menu_hotkey_bg);
|
||||||
|
|
||||||
if ( ! data.no_underline )
|
if ( ! data.no_underline )
|
||||||
setUnderline();
|
setUnderline();
|
||||||
|
@ -1448,22 +1448,22 @@ inline void FMenu::setLineAttributes (const FMenuItem* m_item, int y)
|
||||||
{
|
{
|
||||||
const bool is_enabled = m_item->isEnabled();
|
const bool is_enabled = m_item->isEnabled();
|
||||||
const bool is_selected = m_item->isSelected();
|
const bool is_selected = m_item->isSelected();
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( is_enabled )
|
if ( is_enabled )
|
||||||
{
|
{
|
||||||
if ( is_selected )
|
if ( is_selected )
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.menu_active_focus_fg);
|
setForegroundColor (wc->menu_active_focus_fg);
|
||||||
setBackgroundColor (wc.menu_active_focus_bg);
|
setBackgroundColor (wc->menu_active_focus_bg);
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.menu_active_fg);
|
setForegroundColor (wc->menu_active_fg);
|
||||||
setBackgroundColor (wc.menu_active_bg);
|
setBackgroundColor (wc->menu_active_bg);
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -1471,8 +1471,8 @@ inline void FMenu::setLineAttributes (const FMenuItem* m_item, int y)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.menu_inactive_fg);
|
setForegroundColor (wc->menu_inactive_fg);
|
||||||
setBackgroundColor (wc.menu_inactive_bg);
|
setBackgroundColor (wc->menu_inactive_bg);
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
|
@ -65,9 +65,9 @@ void FMenuBar::resetMenu()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenuBar::hide()
|
void FMenuBar::hide()
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
FColor fg = wc.term_fg;
|
FColor fg = wc->term_fg;
|
||||||
FColor bg = wc.term_bg;
|
FColor bg = wc->term_bg;
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
print() << FPoint{1, 1} << FString{getDesktopWidth(), L' '};
|
print() << FPoint{1, 1} << FString{getDesktopWidth(), L' '};
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -249,9 +249,9 @@ void FMenuBar::init()
|
||||||
|
|
||||||
addAccelerator (fc::Fkey_f10);
|
addAccelerator (fc::Fkey_f10);
|
||||||
addAccelerator (fc::Fckey_space);
|
addAccelerator (fc::Fckey_space);
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setForegroundColor (wc.menu_active_fg);
|
setForegroundColor (wc->menu_active_fg);
|
||||||
setBackgroundColor (wc.menu_active_bg);
|
setBackgroundColor (wc->menu_active_bg);
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,8 +529,8 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
|
||||||
drawEllipsis (txtdata, x);
|
drawEllipsis (txtdata, x);
|
||||||
drawTrailingSpace (x);
|
drawTrailingSpace (x);
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.menu_active_fg, wc.menu_active_bg);
|
setColor (wc->menu_active_fg, wc->menu_active_bg);
|
||||||
|
|
||||||
if ( FTerm::isMonochron() && is_enabled && is_selected )
|
if ( FTerm::isMonochron() && is_enabled && is_selected )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -541,7 +541,7 @@ inline void FMenuBar::setLineAttributes (const FMenuItem* menuitem)
|
||||||
{
|
{
|
||||||
bool is_enabled = menuitem->isEnabled();
|
bool is_enabled = menuitem->isEnabled();
|
||||||
bool is_selected = menuitem->isSelected();
|
bool is_selected = menuitem->isSelected();
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( is_enabled )
|
if ( is_enabled )
|
||||||
{
|
{
|
||||||
|
@ -550,19 +550,19 @@ inline void FMenuBar::setLineAttributes (const FMenuItem* menuitem)
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
setForegroundColor (wc.menu_active_focus_fg);
|
setForegroundColor (wc->menu_active_focus_fg);
|
||||||
setBackgroundColor (wc.menu_active_focus_bg);
|
setBackgroundColor (wc->menu_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.menu_active_fg);
|
setForegroundColor (wc->menu_active_fg);
|
||||||
setBackgroundColor (wc.menu_active_bg);
|
setBackgroundColor (wc->menu_active_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.menu_inactive_fg);
|
setForegroundColor (wc->menu_inactive_fg);
|
||||||
setBackgroundColor (wc.menu_inactive_bg);
|
setBackgroundColor (wc->menu_inactive_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor();
|
setColor();
|
||||||
|
@ -607,8 +607,8 @@ inline void FMenuBar::drawMenuText (menuText& data)
|
||||||
|
|
||||||
if ( z == data.hotkeypos )
|
if ( z == data.hotkeypos )
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
setColor (wc->menu_hotkey_fg, wc->menu_hotkey_bg);
|
||||||
|
|
||||||
if ( ! data.no_underline )
|
if ( ! data.no_underline )
|
||||||
setUnderline();
|
setUnderline();
|
||||||
|
|
|
@ -155,8 +155,8 @@ void FProgressbar::drawProgressLabel()
|
||||||
, parent_widget->getBackgroundColor() );
|
, parent_widget->getBackgroundColor() );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.dialog_fg, wc.dialog_bg);
|
setColor (wc->dialog_fg, wc->dialog_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
|
@ -199,10 +199,10 @@ std::size_t FProgressbar::drawProgressIndicator()
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
const double length = double(bar_length * percentage) / 100;
|
const double length = double(bar_length * percentage) / 100;
|
||||||
auto len = std::size_t(trunc(length));
|
auto len = std::size_t(trunc(length));
|
||||||
print() << FColorPair {wc.progressbar_fg, wc.progressbar_fg}
|
print() << FColorPair {wc->progressbar_fg, wc->progressbar_fg}
|
||||||
<< FString {len, fc::FullBlock}; // █
|
<< FString {len, fc::FullBlock}; // █
|
||||||
|
|
||||||
if ( len >= bar_length )
|
if ( len >= bar_length )
|
||||||
|
@ -220,7 +220,7 @@ std::size_t FProgressbar::drawProgressIndicator()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print() << FColorPair{wc.progressbar_fg, wc.progressbar_bg}
|
print() << FColorPair{wc->progressbar_fg, wc->progressbar_bg}
|
||||||
<< fc::LeftHalfBlock; // ▌
|
<< fc::LeftHalfBlock; // ▌
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,8 +234,8 @@ void FProgressbar::drawProgressBackground (std::size_t len)
|
||||||
// Draw the progress background
|
// Draw the progress background
|
||||||
|
|
||||||
const std::size_t bg_len = bar_length - len;
|
const std::size_t bg_len = bar_length - len;
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.progressbar_fg, wc.progressbar_bg);
|
setColor (wc->progressbar_fg, wc->progressbar_bg);
|
||||||
|
|
||||||
if ( FTerm::getMaxColor() < 16 )
|
if ( FTerm::getMaxColor() < 16 )
|
||||||
print() << FString {bg_len, fc::MediumShade}; // ▒
|
print() << FString {bg_len, fc::MediumShade}; // ▒
|
||||||
|
|
|
@ -459,8 +459,8 @@ void FScrollbar::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::drawVerticalBar()
|
void FScrollbar::drawVerticalBar()
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
setColor (wc->scrollbar_fg, wc->scrollbar_bg);
|
||||||
|
|
||||||
for (int z{1}; z <= slider_pos; z++)
|
for (int z{1}; z <= slider_pos; z++)
|
||||||
{
|
{
|
||||||
|
@ -468,7 +468,7 @@ void FScrollbar::drawVerticalBar()
|
||||||
drawVerticalBackgroundLine();
|
drawVerticalBackgroundLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor (wc.scrollbar_bg, wc.scrollbar_fg);
|
setColor (wc->scrollbar_bg, wc->scrollbar_fg);
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
@ -486,7 +486,7 @@ void FScrollbar::drawVerticalBar()
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
setColor (wc->scrollbar_fg, wc->scrollbar_bg);
|
||||||
|
|
||||||
for (int z = slider_pos + int(slider_length) + 1; z <= int(bar_length); z++)
|
for (int z = slider_pos + int(slider_length) + 1; z <= int(bar_length); z++)
|
||||||
{
|
{
|
||||||
|
@ -520,8 +520,8 @@ inline void FScrollbar::drawVerticalBackgroundLine()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::drawHorizontalBar()
|
void FScrollbar::drawHorizontalBar()
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
setColor (wc->scrollbar_fg, wc->scrollbar_bg);
|
||||||
|
|
||||||
if ( FTerm::isNewFont() )
|
if ( FTerm::isNewFont() )
|
||||||
print() << FPoint{3, 1};
|
print() << FPoint{3, 1};
|
||||||
|
@ -531,7 +531,7 @@ void FScrollbar::drawHorizontalBar()
|
||||||
for (int z{0}; z < slider_pos; z++)
|
for (int z{0}; z < slider_pos; z++)
|
||||||
drawHorizontalBackgroundColumn();
|
drawHorizontalBackgroundColumn();
|
||||||
|
|
||||||
setColor (wc.scrollbar_bg, wc.scrollbar_fg);
|
setColor (wc->scrollbar_bg, wc->scrollbar_fg);
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
@ -542,7 +542,7 @@ void FScrollbar::drawHorizontalBar()
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
setColor (wc->scrollbar_fg, wc->scrollbar_bg);
|
||||||
int z = slider_pos + int(slider_length) + 1;
|
int z = slider_pos + int(slider_length) + 1;
|
||||||
|
|
||||||
for (; z <= int(bar_length); z++)
|
for (; z <= int(bar_length); z++)
|
||||||
|
@ -566,8 +566,8 @@ inline void FScrollbar::drawHorizontalBackgroundColumn()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::drawButtons()
|
void FScrollbar::drawButtons()
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.scrollbar_button_fg, wc.scrollbar_button_bg);
|
setColor (wc->scrollbar_button_fg, wc->scrollbar_button_bg);
|
||||||
|
|
||||||
if ( FTerm::isNewFont() )
|
if ( FTerm::isNewFont() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -712,9 +712,9 @@ 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 = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc->dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
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());
|
||||||
|
|
|
@ -326,26 +326,26 @@ void FSpinBox::init()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FSpinBox::draw()
|
void FSpinBox::draw()
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
const FColorPair inc_button_color = [this, &wc] ()
|
const FColorPair inc_button_color = [this, &wc] ()
|
||||||
{
|
{
|
||||||
if ( value == max )
|
if ( value == max )
|
||||||
return FColorPair { wc.scrollbar_button_inactive_fg
|
return FColorPair { wc->scrollbar_button_inactive_fg
|
||||||
, wc.scrollbar_button_inactive_bg };
|
, wc->scrollbar_button_inactive_bg };
|
||||||
else
|
else
|
||||||
return FColorPair { wc.scrollbar_button_fg
|
return FColorPair { wc->scrollbar_button_fg
|
||||||
, wc.scrollbar_button_bg };
|
, wc->scrollbar_button_bg };
|
||||||
}();
|
}();
|
||||||
|
|
||||||
const FColorPair dec_button_color = [this, &wc] ()
|
const FColorPair dec_button_color = [this, &wc] ()
|
||||||
{
|
{
|
||||||
if ( value == min )
|
if ( value == min )
|
||||||
return FColorPair { wc.scrollbar_button_inactive_fg
|
return FColorPair { wc->scrollbar_button_inactive_fg
|
||||||
, wc.scrollbar_button_inactive_bg };
|
, wc->scrollbar_button_inactive_bg };
|
||||||
else
|
else
|
||||||
return FColorPair { wc.scrollbar_button_fg
|
return FColorPair { wc->scrollbar_button_fg
|
||||||
, wc.scrollbar_button_bg };
|
, wc->scrollbar_button_bg };
|
||||||
}();
|
}();
|
||||||
|
|
||||||
print() << FPoint{int(getWidth()) - 1, 1}
|
print() << FPoint{int(getWidth()) - 1, 1}
|
||||||
|
|
|
@ -174,9 +174,9 @@ bool FStatusBar::hasActivatedKey() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::hide()
|
void FStatusBar::hide()
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
const FColor fg = wc.term_fg;
|
const FColor fg = wc->term_fg;
|
||||||
const FColor bg = wc.term_bg;
|
const FColor bg = wc->term_bg;
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
print() << FPoint{1, 1} << FString{getDesktopWidth(), L' '};
|
print() << FPoint{1, 1} << FString{getDesktopWidth(), L' '};
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -210,8 +210,8 @@ void FStatusBar::drawMessage()
|
||||||
if ( isLastActiveFocus )
|
if ( isLastActiveFocus )
|
||||||
space_offset = 0;
|
space_offset = 0;
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
setColor (wc->statusbar_fg, wc->statusbar_bg);
|
||||||
setPrintPos ({x, 1});
|
setPrintPos ({x, 1});
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
|
@ -513,9 +513,9 @@ void FStatusBar::init()
|
||||||
if ( getRootWidget() )
|
if ( getRootWidget() )
|
||||||
getRootWidget()->setBottomPadding(1, true);
|
getRootWidget()->setBottomPadding(1, true);
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setForegroundColor (wc.statusbar_fg);
|
setForegroundColor (wc->statusbar_fg);
|
||||||
setBackgroundColor (wc.statusbar_bg);
|
setBackgroundColor (wc->statusbar_bg);
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,8 +573,8 @@ void FStatusBar::drawKeys()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
setColor (wc->statusbar_fg, wc->statusbar_bg);
|
||||||
|
|
||||||
for (; x <= int(screenWidth); x++)
|
for (; x <= int(screenWidth); x++)
|
||||||
print (' ');
|
print (' ');
|
||||||
|
@ -595,13 +595,13 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
||||||
// Draw not active key
|
// Draw not active key
|
||||||
|
|
||||||
const auto item = *iter;
|
const auto item = *iter;
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
|
setColor (wc->statusbar_hotkey_fg, wc->statusbar_hotkey_bg);
|
||||||
x++;
|
x++;
|
||||||
print (' ');
|
print (' ');
|
||||||
x += keyname_len;
|
x += keyname_len;
|
||||||
print (FTerm::getKeyName(item->getKey()));
|
print (FTerm::getKeyName(item->getKey()));
|
||||||
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
setColor (wc->statusbar_fg, wc->statusbar_bg);
|
||||||
x++;
|
x++;
|
||||||
print ('-');
|
print ('-');
|
||||||
const auto column_width = getColumnWidth (item->getText());
|
const auto column_width = getColumnWidth (item->getText());
|
||||||
|
@ -627,7 +627,7 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
||||||
|
|
||||||
if ( FTerm::hasHalfBlockCharacter() )
|
if ( FTerm::hasHalfBlockCharacter() )
|
||||||
{
|
{
|
||||||
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
|
setColor (wc->statusbar_active_fg, wc->statusbar_active_bg);
|
||||||
print (fc::LeftHalfBlock); // ▐
|
print (fc::LeftHalfBlock); // ▐
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -641,7 +641,7 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
||||||
else if ( iter + 1 != key_list.end() && x < int(screenWidth) )
|
else if ( iter + 1 != key_list.end() && x < int(screenWidth) )
|
||||||
{
|
{
|
||||||
// Not the last element
|
// Not the last element
|
||||||
setColor (wc.statusbar_separator_fg, wc.statusbar_bg);
|
setColor (wc->statusbar_separator_fg, wc->statusbar_bg);
|
||||||
x++;
|
x++;
|
||||||
print (fc::BoxDrawingsVertical); // │
|
print (fc::BoxDrawingsVertical); // │
|
||||||
}
|
}
|
||||||
|
@ -657,14 +657,14 @@ void FStatusBar::drawActiveKey (keyList::const_iterator iter)
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor ( wc.statusbar_active_hotkey_fg
|
setColor ( wc->statusbar_active_hotkey_fg
|
||||||
, wc.statusbar_active_hotkey_bg );
|
, wc->statusbar_active_hotkey_bg );
|
||||||
x++;
|
x++;
|
||||||
print (' ');
|
print (' ');
|
||||||
x += keyname_len;
|
x += keyname_len;
|
||||||
print (FTerm::getKeyName(item->getKey()));
|
print (FTerm::getKeyName(item->getKey()));
|
||||||
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
|
setColor (wc->statusbar_active_fg, wc->statusbar_active_bg);
|
||||||
x++;
|
x++;
|
||||||
print ('-');
|
print ('-');
|
||||||
const auto column_width = getColumnWidth (item->getText());
|
const auto column_width = getColumnWidth (item->getText());
|
||||||
|
|
|
@ -45,21 +45,21 @@ const wchar_t FString::const_null_char{L'\0'};
|
||||||
FString::FString (int len)
|
FString::FString (int len)
|
||||||
{
|
{
|
||||||
if ( len > 0 )
|
if ( len > 0 )
|
||||||
initLength(std::size_t(len));
|
_initLength(std::size_t(len));
|
||||||
else
|
else
|
||||||
initLength(0);
|
_initLength(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (std::size_t len)
|
FString::FString (std::size_t len)
|
||||||
{
|
{
|
||||||
initLength(len);
|
_initLength(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (std::size_t len, wchar_t c)
|
FString::FString (std::size_t len, wchar_t c)
|
||||||
{
|
{
|
||||||
initLength(len);
|
_initLength(len);
|
||||||
const wchar_t* ps = string;
|
const wchar_t* ps = string;
|
||||||
wchar_t* pe = string + len;
|
wchar_t* pe = string + len;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ FString::FString (const std::string& s)
|
||||||
{
|
{
|
||||||
if ( ! s.empty() )
|
if ( ! s.empty() )
|
||||||
{
|
{
|
||||||
const wchar_t* wc_string = c_to_wc_str(s.c_str());
|
const wchar_t* wc_string = _to_wcstring(s.c_str());
|
||||||
_assign(wc_string);
|
_assign(wc_string);
|
||||||
delete[] wc_string;
|
delete[] wc_string;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ FString::FString (const char s[])
|
||||||
{
|
{
|
||||||
if ( s )
|
if ( s )
|
||||||
{
|
{
|
||||||
const wchar_t* wc_string = c_to_wc_str(s);
|
const wchar_t* wc_string = _to_wcstring(s);
|
||||||
_assign( wc_string );
|
_assign( wc_string );
|
||||||
delete[] wc_string;
|
delete[] wc_string;
|
||||||
}
|
}
|
||||||
|
@ -421,9 +421,9 @@ const char* FString::c_str() const
|
||||||
// Returns a constant c-string
|
// Returns a constant c-string
|
||||||
|
|
||||||
if ( length > 0 )
|
if ( length > 0 )
|
||||||
return wc_to_c_str (string);
|
return _to_cstring(string);
|
||||||
else if ( string )
|
else if ( string )
|
||||||
return const_cast<const char*>("");
|
return "";
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -434,7 +434,7 @@ char* FString::c_str()
|
||||||
// Returns a c-string
|
// Returns a c-string
|
||||||
|
|
||||||
if ( length > 0 )
|
if ( length > 0 )
|
||||||
return wc_to_c_str (string);
|
return const_cast<char*>(_to_cstring(string));
|
||||||
else if ( string )
|
else if ( string )
|
||||||
return const_cast<char*>("");
|
return const_cast<char*>("");
|
||||||
else
|
else
|
||||||
|
@ -781,12 +781,12 @@ FStringList FString::split (const FString& delimiter)
|
||||||
return string_list;
|
return string_list;
|
||||||
|
|
||||||
wchar_t* rest{nullptr};
|
wchar_t* rest{nullptr};
|
||||||
const wchar_t* token = extractToken(&rest, s.string, delimiter.wc_str());
|
const wchar_t* token = _extractToken(&rest, s.string, delimiter.wc_str());
|
||||||
|
|
||||||
while ( token )
|
while ( token )
|
||||||
{
|
{
|
||||||
string_list.push_back (FString{token});
|
string_list.push_back (FString{token});
|
||||||
token = extractToken (&rest, nullptr, delimiter.wc_str());
|
token = _extractToken (&rest, nullptr, delimiter.wc_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return string_list;
|
return string_list;
|
||||||
|
@ -1241,7 +1241,7 @@ bool FString::includes (const FString& s) const
|
||||||
|
|
||||||
// private methods of FString
|
// private methods of FString
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FString::initLength (std::size_t len)
|
inline void FString::_initLength (std::size_t len)
|
||||||
{
|
{
|
||||||
if ( len == 0 )
|
if ( len == 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -1426,7 +1426,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 const char* FString::_to_cstring (const wchar_t s[]) const
|
||||||
{
|
{
|
||||||
if ( ! s ) // handle NULL string
|
if ( ! s ) // handle NULL string
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1476,14 +1476,14 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const
|
||||||
{
|
{
|
||||||
delete[](c_string);
|
delete[](c_string);
|
||||||
c_string = nullptr;
|
c_string = nullptr;
|
||||||
return const_cast<char*>("");
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return c_string;
|
return c_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline wchar_t* FString::c_to_wc_str (const char s[]) const
|
inline const wchar_t* FString::_to_wcstring (const char s[]) const
|
||||||
{
|
{
|
||||||
if ( ! s ) // handle NULL string
|
if ( ! s ) // handle NULL string
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1548,7 +1548,7 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline wchar_t* FString::extractToken ( wchar_t* rest[]
|
inline const wchar_t* FString::_extractToken ( wchar_t* rest[]
|
||||||
, const wchar_t s[]
|
, const wchar_t s[]
|
||||||
, const wchar_t delim[] )
|
, const wchar_t delim[] )
|
||||||
{
|
{
|
||||||
|
@ -1663,12 +1663,12 @@ std::ostream& operator << (std::ostream& outstr, const FString& s)
|
||||||
|
|
||||||
if ( s.length > 0 )
|
if ( s.length > 0 )
|
||||||
{
|
{
|
||||||
outstr << s.wc_to_c_str(s.string);
|
outstr << s._to_cstring(s.string);
|
||||||
}
|
}
|
||||||
else if ( width > 0 )
|
else if ( width > 0 )
|
||||||
{
|
{
|
||||||
const FString fill_str{width, wchar_t(outstr.fill())};
|
const FString fill_str{width, wchar_t(outstr.fill())};
|
||||||
outstr << s.wc_to_c_str(fill_str.string);
|
outstr << s._to_cstring(fill_str.string);
|
||||||
}
|
}
|
||||||
|
|
||||||
return outstr;
|
return outstr;
|
||||||
|
@ -1679,7 +1679,7 @@ std::istream& operator >> (std::istream& instr, FString& s)
|
||||||
{
|
{
|
||||||
char buf[FString::INPBUFFER + 1]{};
|
char buf[FString::INPBUFFER + 1]{};
|
||||||
instr.getline (buf, FString::INPBUFFER);
|
instr.getline (buf, FString::INPBUFFER);
|
||||||
const wchar_t* wc_str = s.c_to_wc_str(buf);
|
const wchar_t* wc_str = s._to_wcstring(buf);
|
||||||
|
|
||||||
if ( wc_str )
|
if ( wc_str )
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,7 +143,7 @@ inline void FSwitch::drawChecked()
|
||||||
{
|
{
|
||||||
wchar_t on[6]{L" On "};
|
wchar_t on[6]{L" On "};
|
||||||
const wchar_t off[6]{L" Off "};
|
const wchar_t off[6]{L" Off "};
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( hasFocus() && ! button_pressed )
|
if ( hasFocus() && ! button_pressed )
|
||||||
{
|
{
|
||||||
|
@ -155,17 +155,17 @@ inline void FSwitch::drawChecked()
|
||||||
else if ( FTerm::getMaxColor() < 16 )
|
else if ( FTerm::getMaxColor() < 16 )
|
||||||
{
|
{
|
||||||
setBold(true);
|
setBold(true);
|
||||||
setColor (wc.button_active_focus_fg, wc.button_active_focus_bg);
|
setColor (wc->button_active_focus_fg, wc->button_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
setColor (wc.button_hotkey_fg, wc.button_active_focus_bg);
|
setColor (wc->button_hotkey_fg, wc->button_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( FTerm::isMonochron() || FTerm::getMaxColor() < 16 )
|
if ( FTerm::isMonochron() || FTerm::getMaxColor() < 16 )
|
||||||
setColor (wc.button_active_focus_fg, wc.button_active_bg);
|
setColor (wc->button_active_focus_fg, wc->button_active_bg);
|
||||||
else
|
else
|
||||||
setColor (wc.button_hotkey_fg, wc.button_active_bg);
|
setColor (wc->button_hotkey_fg, wc->button_active_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
|
@ -179,7 +179,7 @@ inline void FSwitch::drawChecked()
|
||||||
if ( FTerm::isMonochron() || FTerm::getMaxColor() < 16 )
|
if ( FTerm::isMonochron() || FTerm::getMaxColor() < 16 )
|
||||||
setBold(false);
|
setBold(false);
|
||||||
|
|
||||||
print() << FColorPair{wc.button_inactive_fg, wc.button_inactive_bg}
|
print() << FColorPair{wc->button_inactive_fg, wc->button_inactive_bg}
|
||||||
<< off;
|
<< off;
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
|
@ -194,8 +194,8 @@ inline void FSwitch::drawUnchecked()
|
||||||
const wchar_t on[6]{L" On "};
|
const wchar_t on[6]{L" On "};
|
||||||
wchar_t off[6]{L" Off "};
|
wchar_t off[6]{L" Off "};
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setColor (wc.button_inactive_fg, wc.button_inactive_bg);
|
setColor (wc->button_inactive_fg, wc->button_inactive_bg);
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -212,17 +212,17 @@ inline void FSwitch::drawUnchecked()
|
||||||
else if ( FTerm::getMaxColor() < 16 )
|
else if ( FTerm::getMaxColor() < 16 )
|
||||||
{
|
{
|
||||||
setBold(true);
|
setBold(true);
|
||||||
setColor (wc.button_active_focus_fg, wc.button_active_focus_bg);
|
setColor (wc->button_active_focus_fg, wc->button_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
setColor (wc.button_hotkey_fg, wc.button_active_focus_bg);
|
setColor (wc->button_hotkey_fg, wc->button_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( FTerm::isMonochron() || FTerm::getMaxColor() < 16 )
|
if ( FTerm::isMonochron() || FTerm::getMaxColor() < 16 )
|
||||||
setColor (wc.button_active_focus_fg, wc.button_active_bg);
|
setColor (wc->button_active_focus_fg, wc->button_active_bg);
|
||||||
else
|
else
|
||||||
setColor (wc.button_hotkey_fg, wc.button_active_bg);
|
setColor (wc->button_hotkey_fg, wc->button_active_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
|
|
|
@ -132,15 +132,17 @@ void FTermcap::termcapError (int status)
|
||||||
{
|
{
|
||||||
const char* termtype = fterm_data->getTermType();
|
const char* termtype = fterm_data->getTermType();
|
||||||
log << FLog::Error
|
log << FLog::Error
|
||||||
<< "Unknown terminal: " << termtype << "\n"
|
<< "Unknown terminal: \"" << termtype << "\". "
|
||||||
<< "Check the TERM environment variable\n"
|
<< "Check the TERM environment variable. "
|
||||||
<< "Also make sure that the terminal\n"
|
<< "Also make sure that the terminal "
|
||||||
<< "is defined in the termcap/terminfo database.\n";
|
<< "is defined in the termcap/terminfo database."
|
||||||
|
<< std::endl;
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
else if ( status == db_not_found )
|
else if ( status == db_not_found )
|
||||||
{
|
{
|
||||||
log << "The termcap/terminfo database could not be found.\n";
|
log << "The termcap/terminfo database could not be found."
|
||||||
|
<< std::endl;
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -569,9 +569,9 @@ 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 = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc->dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc->dialog_bg);
|
||||||
nf_offset = FTerm::isNewFont() ? 1 : 0;
|
nf_offset = FTerm::isNewFont() ? 1 : 0;
|
||||||
setTopPadding(1);
|
setTopPadding(1);
|
||||||
setLeftPadding(1);
|
setLeftPadding(1);
|
||||||
|
|
|
@ -121,7 +121,7 @@ bool FToggleButton::setNoUnderline (bool enable)
|
||||||
bool FToggleButton::setEnable (bool enable)
|
bool FToggleButton::setEnable (bool enable)
|
||||||
{
|
{
|
||||||
FWidget::setEnable(enable);
|
FWidget::setEnable(enable);
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
{
|
{
|
||||||
|
@ -129,20 +129,20 @@ bool FToggleButton::setEnable (bool enable)
|
||||||
|
|
||||||
if ( hasFocus() )
|
if ( hasFocus() )
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.toggle_button_active_focus_fg);
|
setForegroundColor (wc->toggle_button_active_focus_fg);
|
||||||
setBackgroundColor (wc.toggle_button_active_focus_bg);
|
setBackgroundColor (wc->toggle_button_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.toggle_button_active_fg);
|
setForegroundColor (wc->toggle_button_active_fg);
|
||||||
setBackgroundColor (wc.toggle_button_active_bg);
|
setBackgroundColor (wc->toggle_button_active_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delAccelerator();
|
delAccelerator();
|
||||||
setForegroundColor (wc.toggle_button_inactive_fg);
|
setForegroundColor (wc->toggle_button_inactive_fg);
|
||||||
setBackgroundColor (wc.toggle_button_inactive_bg);
|
setBackgroundColor (wc->toggle_button_inactive_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return enable;
|
return enable;
|
||||||
|
@ -155,20 +155,20 @@ bool FToggleButton::setFocus (bool enable)
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( enable )
|
if ( enable )
|
||||||
{
|
{
|
||||||
if ( isRadioButton() )
|
if ( isRadioButton() )
|
||||||
focus_inside_group = false;
|
focus_inside_group = false;
|
||||||
|
|
||||||
setForegroundColor (wc.toggle_button_active_focus_fg);
|
setForegroundColor (wc->toggle_button_active_focus_fg);
|
||||||
setBackgroundColor (wc.toggle_button_active_focus_bg);
|
setBackgroundColor (wc->toggle_button_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.toggle_button_active_fg);
|
setForegroundColor (wc->toggle_button_active_fg);
|
||||||
setBackgroundColor (wc.toggle_button_active_bg);
|
setBackgroundColor (wc->toggle_button_active_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,25 +497,25 @@ 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 = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
if ( hasFocus() )
|
if ( hasFocus() )
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.toggle_button_active_focus_fg);
|
setForegroundColor (wc->toggle_button_active_focus_fg);
|
||||||
setBackgroundColor (wc.toggle_button_active_focus_bg);
|
setBackgroundColor (wc->toggle_button_active_focus_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.toggle_button_active_fg);
|
setForegroundColor (wc->toggle_button_active_fg);
|
||||||
setBackgroundColor (wc.toggle_button_active_bg);
|
setBackgroundColor (wc->toggle_button_active_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // inactive
|
else // inactive
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.label_inactive_fg);
|
setForegroundColor (wc->label_inactive_fg);
|
||||||
setBackgroundColor (wc.label_inactive_bg);
|
setBackgroundColor (wc->label_inactive_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,18 +525,18 @@ void FToggleButton::drawText (const FString& label_text, std::size_t hotkeypos)
|
||||||
if ( FTerm::isMonochron() )
|
if ( FTerm::isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
const auto& wc = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
setColor (wc.label_fg, wc.label_bg);
|
setColor (wc->label_fg, wc->label_bg);
|
||||||
else
|
else
|
||||||
setColor (wc.label_inactive_fg, wc.label_inactive_bg);
|
setColor (wc->label_inactive_fg, wc->label_inactive_bg);
|
||||||
|
|
||||||
for (std::size_t z{0}; z < label_text.getLength(); z++)
|
for (std::size_t z{0}; z < label_text.getLength(); z++)
|
||||||
{
|
{
|
||||||
if ( (z == hotkeypos) && flags.active )
|
if ( (z == hotkeypos) && flags.active )
|
||||||
{
|
{
|
||||||
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
|
setColor (wc->label_hotkey_fg, wc->label_hotkey_bg);
|
||||||
|
|
||||||
if ( ! flags.no_underline )
|
if ( ! flags.no_underline )
|
||||||
setUnderline();
|
setUnderline();
|
||||||
|
@ -546,7 +546,7 @@ void FToggleButton::drawText (const FString& label_text, std::size_t hotkeypos)
|
||||||
if ( ! flags.no_underline )
|
if ( ! flags.no_underline )
|
||||||
unsetUnderline();
|
unsetUnderline();
|
||||||
|
|
||||||
setColor (wc.label_fg, wc.label_bg);
|
setColor (wc->label_fg, wc->label_bg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print (label_text[z]);
|
print (label_text[z]);
|
||||||
|
|
|
@ -107,9 +107,9 @@ 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 = getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
setForegroundColor (wc.tooltip_fg);
|
setForegroundColor (wc->tooltip_fg);
|
||||||
setBackgroundColor (wc.tooltip_bg);
|
setBackgroundColor (wc->tooltip_bg);
|
||||||
calculateDimensions();
|
calculateDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ FWidget::FWidgetList* FWidget::window_list{nullptr};
|
||||||
FWidget::FWidgetList* FWidget::dialog_list{nullptr};
|
FWidget::FWidgetList* FWidget::dialog_list{nullptr};
|
||||||
FWidget::FWidgetList* FWidget::always_on_top_list{nullptr};
|
FWidget::FWidgetList* FWidget::always_on_top_list{nullptr};
|
||||||
FWidget::FWidgetList* FWidget::close_widget{nullptr};
|
FWidget::FWidgetList* FWidget::close_widget{nullptr};
|
||||||
FWidgetColors FWidget::wcolors{};
|
|
||||||
bool FWidget::init_desktop{false};
|
bool FWidget::init_desktop{false};
|
||||||
bool FWidget::hideable{false};
|
bool FWidget::hideable{false};
|
||||||
uInt FWidget::modal_dialog_counter{};
|
uInt FWidget::modal_dialog_counter{};
|
||||||
|
@ -939,7 +938,8 @@ void FWidget::redraw()
|
||||||
{
|
{
|
||||||
startTerminalUpdate();
|
startTerminalUpdate();
|
||||||
// clean desktop
|
// clean desktop
|
||||||
setColor (wcolors.term_fg, wcolors.term_bg);
|
auto color_theme = getColorTheme();
|
||||||
|
setColor (color_theme->term_fg, color_theme->term_bg);
|
||||||
clearArea (getVirtualDesktop());
|
clearArea (getVirtualDesktop());
|
||||||
}
|
}
|
||||||
else if ( ! isShown() )
|
else if ( ! isShown() )
|
||||||
|
@ -1370,8 +1370,9 @@ void FWidget::hideArea (const FSize& size)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fg = wcolors.dialog_fg;
|
auto color_theme = getColorTheme();
|
||||||
bg = wcolors.dialog_bg;
|
fg = color_theme->dialog_fg;
|
||||||
|
bg = color_theme->dialog_bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
|
@ -1708,11 +1709,12 @@ void FWidget::initRootWidget()
|
||||||
double_flatline_mask.left.resize (getHeight(), false);
|
double_flatline_mask.left.resize (getHeight(), false);
|
||||||
|
|
||||||
// Initialize default widget colors
|
// Initialize default widget colors
|
||||||
setColorTheme();
|
initColorTheme();
|
||||||
|
|
||||||
// Default foreground and background color of the desktop/terminal
|
// Default foreground and background color of the desktop/terminal
|
||||||
foreground_color = wcolors.term_fg;
|
auto color_theme = getColorTheme();
|
||||||
background_color = wcolors.term_bg;
|
foreground_color = color_theme->term_fg;
|
||||||
|
background_color = color_theme->term_bg;
|
||||||
init_desktop = false;
|
init_desktop = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1742,6 +1744,8 @@ void FWidget::finish()
|
||||||
delete window_list;
|
delete window_list;
|
||||||
window_list = nullptr;
|
window_list = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroyColorTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1984,14 +1988,21 @@ void FWidget::drawChildren()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::setColorTheme()
|
void FWidget::initColorTheme()
|
||||||
{
|
{
|
||||||
// Sets the default color theme
|
// Sets the default color theme
|
||||||
|
|
||||||
if ( FTerm::getMaxColor() < 16 ) // for 8 color mode
|
if ( FTerm::getMaxColor() < 16 ) // for 8 color mode
|
||||||
wcolors.set8ColorTheme();
|
setColorTheme<default8ColorTheme>();
|
||||||
else
|
else
|
||||||
wcolors.set16ColorTheme();
|
setColorTheme<default16ColorTheme>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWidget::destroyColorTheme()
|
||||||
|
{
|
||||||
|
FWidgetColorsPtr* theme = &(getColorTheme());
|
||||||
|
delete theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -161,12 +161,12 @@ void drawTransparentShadow (FWidget* w)
|
||||||
|
|
||||||
const std::size_t width = w->getWidth();
|
const std::size_t width = w->getWidth();
|
||||||
const std::size_t height = w->getHeight();
|
const std::size_t height = w->getHeight();
|
||||||
const auto& wcolors = FWidget::wcolors;
|
const auto& wc = FWidget::getColorTheme();
|
||||||
w->print() << FStyle {fc::Transparent}
|
w->print() << FStyle {fc::Transparent}
|
||||||
<< FPoint {int(width) + 1, 1}
|
<< FPoint {int(width) + 1, 1}
|
||||||
<< " "
|
<< " "
|
||||||
<< FStyle {fc::Reset}
|
<< FStyle {fc::Reset}
|
||||||
<< FColorPair {wcolors.shadow_bg, wcolors.shadow_fg}
|
<< FColorPair {wc->shadow_bg, wc->shadow_fg}
|
||||||
<< FStyle {fc::ColorOverlay};
|
<< FStyle {fc::ColorOverlay};
|
||||||
|
|
||||||
for (std::size_t y{1}; y < height; y++)
|
for (std::size_t y{1}; y < height; y++)
|
||||||
|
@ -178,7 +178,7 @@ void drawTransparentShadow (FWidget* w)
|
||||||
<< FPoint {1, int(height) + 1}
|
<< FPoint {1, int(height) + 1}
|
||||||
<< " "
|
<< " "
|
||||||
<< FStyle {fc::Reset}
|
<< FStyle {fc::Reset}
|
||||||
<< FColorPair {wcolors.shadow_bg, wcolors.shadow_fg}
|
<< FColorPair {wc->shadow_bg, wc->shadow_fg}
|
||||||
<< FStyle {fc::ColorOverlay}
|
<< FStyle {fc::ColorOverlay}
|
||||||
<< FString {width, L' '}
|
<< FString {width, L' '}
|
||||||
<< FStyle {fc::Reset};
|
<< FStyle {fc::Reset};
|
||||||
|
@ -197,16 +197,16 @@ void drawBlockShadow (FWidget* w)
|
||||||
|
|
||||||
const std::size_t width = w->getWidth();
|
const std::size_t width = w->getWidth();
|
||||||
const std::size_t height = w->getHeight();
|
const std::size_t height = w->getHeight();
|
||||||
const auto& wcolors = FWidget::wcolors;
|
const auto& wc = FWidget::getColorTheme();
|
||||||
w->print() << FPoint {int(width) + 1, 1};
|
w->print() << FPoint {int(width) + 1, 1};
|
||||||
|
|
||||||
if ( w->isWindowWidget() )
|
if ( w->isWindowWidget() )
|
||||||
{
|
{
|
||||||
w->print() << FColorPair {wcolors.shadow_fg, wcolors.shadow_bg}
|
w->print() << FColorPair {wc->shadow_fg, wc->shadow_bg}
|
||||||
<< FStyle {fc::InheritBackground}; // current background color will be ignored
|
<< FStyle {fc::InheritBackground}; // current background color will be ignored
|
||||||
}
|
}
|
||||||
else if ( auto p = w->getParentWidget() )
|
else if ( auto p = w->getParentWidget() )
|
||||||
w->print() << FColorPair {wcolors.shadow_fg, p->getBackgroundColor()};
|
w->print() << FColorPair {wc->shadow_fg, p->getBackgroundColor()};
|
||||||
|
|
||||||
w->print (fc::LowerHalfBlock); // ▄
|
w->print (fc::LowerHalfBlock); // ▄
|
||||||
|
|
||||||
|
@ -238,15 +238,15 @@ void clearShadow (FWidget* w)
|
||||||
|
|
||||||
const std::size_t width = w->getWidth();
|
const std::size_t width = w->getWidth();
|
||||||
const std::size_t height = w->getHeight();
|
const std::size_t height = w->getHeight();
|
||||||
const auto& wcolors = FWidget::wcolors;
|
const auto& wc = FWidget::getColorTheme();
|
||||||
|
|
||||||
if ( w->isWindowWidget() )
|
if ( w->isWindowWidget() )
|
||||||
{
|
{
|
||||||
w->print() << FColorPair {wcolors.shadow_fg, wcolors.shadow_bg}
|
w->print() << FColorPair {wc->shadow_fg, wc->shadow_bg}
|
||||||
<< FStyle {fc::InheritBackground}; // current background color will be ignored
|
<< FStyle {fc::InheritBackground}; // current background color will be ignored
|
||||||
}
|
}
|
||||||
else if ( auto p = w->getParentWidget() )
|
else if ( auto p = w->getParentWidget() )
|
||||||
w->print() << FColorPair {wcolors.shadow_fg, p->getBackgroundColor()};
|
w->print() << FColorPair {wc->shadow_fg, p->getBackgroundColor()};
|
||||||
|
|
||||||
if ( int(width) <= w->woffset.getX2() )
|
if ( int(width) <= w->woffset.getX2() )
|
||||||
{
|
{
|
||||||
|
@ -275,12 +275,12 @@ void drawFlatBorder (FWidget* w)
|
||||||
|
|
||||||
const std::size_t width = w->getWidth();
|
const std::size_t width = w->getWidth();
|
||||||
const std::size_t height = w->getHeight();
|
const std::size_t height = w->getHeight();
|
||||||
const auto& wcolors = FWidget::wcolors;
|
const auto& wc = FWidget::getColorTheme();
|
||||||
|
|
||||||
if ( auto p = w->getParentWidget() )
|
if ( auto p = w->getParentWidget() )
|
||||||
w->setColor (wcolors.dialog_fg, p->getBackgroundColor());
|
w->setColor (wc->dialog_fg, p->getBackgroundColor());
|
||||||
else
|
else
|
||||||
w->setColor (wcolors.dialog_fg, wcolors.dialog_bg);
|
w->setColor (wc->dialog_fg, wc->dialog_bg);
|
||||||
|
|
||||||
for (std::size_t y{0}; y < height; y++)
|
for (std::size_t y{0}; y < height; y++)
|
||||||
{
|
{
|
||||||
|
@ -336,12 +336,12 @@ void clearFlatBorder (FWidget* w)
|
||||||
|
|
||||||
const std::size_t width = w->getWidth();
|
const std::size_t width = w->getWidth();
|
||||||
const std::size_t height = w->getHeight();
|
const std::size_t height = w->getHeight();
|
||||||
const auto& wcolors = FWidget::wcolors;
|
const auto& wc = FWidget::getColorTheme();
|
||||||
|
|
||||||
if ( auto p = w->getParentWidget() )
|
if ( auto p = w->getParentWidget() )
|
||||||
w->setColor (wcolors.dialog_fg, p->getBackgroundColor());
|
w->setColor (wc->dialog_fg, p->getBackgroundColor());
|
||||||
else
|
else
|
||||||
w->setColor (wcolors.dialog_fg, wcolors.dialog_bg);
|
w->setColor (wc->dialog_fg, wc->dialog_bg);
|
||||||
|
|
||||||
for (std::size_t y{0}; y < height; y++)
|
for (std::size_t y{0}; y < height; y++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 *
|
||||||
|
@ -31,9 +31,34 @@ namespace finalcut
|
||||||
// class FWidgetColors
|
// class FWidgetColors
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
// public methods of FWidgetColors
|
// constructors and destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidgetColors::set8ColorTheme()
|
FWidgetColors::FWidgetColors()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FWidgetColors::~FWidgetColors()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class default8ColorTheme
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// constructors and destructor
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
default8ColorTheme::default8ColorTheme()
|
||||||
|
{
|
||||||
|
default8ColorTheme::setColorTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
default8ColorTheme::~default8ColorTheme()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
// public methods of default8ColorTheme
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void default8ColorTheme::setColorTheme()
|
||||||
{
|
{
|
||||||
term_fg = fc::Black;
|
term_fg = fc::Black;
|
||||||
term_bg = fc::Blue;
|
term_bg = fc::Blue;
|
||||||
|
@ -123,8 +148,25 @@ void FWidgetColors::set8ColorTheme()
|
||||||
progressbar_bg = fc::LightGray;
|
progressbar_bg = fc::LightGray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidgetColors::set16ColorTheme()
|
// class default16ColorTheme
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// constructors and destructor
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
default16ColorTheme::default16ColorTheme()
|
||||||
|
{
|
||||||
|
default16ColorTheme::setColorTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
default16ColorTheme::~default16ColorTheme()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
// public methods of default16ColorTheme
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void default16ColorTheme::setColorTheme()
|
||||||
{
|
{
|
||||||
term_fg = fc::Black;
|
term_fg = fc::Black;
|
||||||
term_bg = fc::LightBlue;
|
term_bg = fc::LightBlue;
|
||||||
|
|
|
@ -157,13 +157,13 @@ class FButton : public FWidget
|
||||||
bool click_animation{true};
|
bool click_animation{true};
|
||||||
int click_time{150};
|
int click_time{150};
|
||||||
int space_char{int(' ')};
|
int space_char{int(' ')};
|
||||||
FColor button_fg{getFWidgetColors().button_active_fg};
|
FColor button_fg{getColorTheme()->button_active_fg};
|
||||||
FColor button_bg{getFWidgetColors().button_active_bg};
|
FColor button_bg{getColorTheme()->button_active_bg};
|
||||||
FColor button_hotkey_fg{getFWidgetColors().button_hotkey_fg};
|
FColor button_hotkey_fg{getColorTheme()->button_hotkey_fg};
|
||||||
FColor button_focus_fg{getFWidgetColors().button_active_focus_fg};
|
FColor button_focus_fg{getColorTheme()->button_active_focus_fg};
|
||||||
FColor button_focus_bg{getFWidgetColors().button_active_focus_bg};
|
FColor button_focus_bg{getColorTheme()->button_active_focus_bg};
|
||||||
FColor button_inactive_fg{getFWidgetColors().button_inactive_fg};
|
FColor button_inactive_fg{getColorTheme()->button_inactive_fg};
|
||||||
FColor button_inactive_bg{getFWidgetColors().button_inactive_bg};
|
FColor button_inactive_bg{getColorTheme()->button_inactive_bg};
|
||||||
std::size_t hotkeypos{NOT_SET};
|
std::size_t hotkeypos{NOT_SET};
|
||||||
std::size_t indent{0};
|
std::size_t indent{0};
|
||||||
std::size_t center_offset{0};
|
std::size_t center_offset{0};
|
||||||
|
|
|
@ -145,8 +145,8 @@ class FLabel : public FWidget
|
||||||
std::size_t align_offset{0};
|
std::size_t align_offset{0};
|
||||||
std::size_t hotkeypos{NOT_SET};
|
std::size_t hotkeypos{NOT_SET};
|
||||||
std::size_t column_width{0};
|
std::size_t column_width{0};
|
||||||
FColor emphasis_color{getFWidgetColors().label_emphasis_fg};
|
FColor emphasis_color{getColorTheme()->label_emphasis_fg};
|
||||||
FColor ellipsis_color{getFWidgetColors().label_ellipsis_fg};
|
FColor ellipsis_color{getColorTheme()->label_ellipsis_fg};
|
||||||
bool multiline{false};
|
bool multiline{false};
|
||||||
bool emphasis{false};
|
bool emphasis{false};
|
||||||
bool reverse_mode{false};
|
bool reverse_mode{false};
|
||||||
|
|
|
@ -153,7 +153,7 @@ class FMessageBox : public FDialog
|
||||||
FStringList text_components{};
|
FStringList text_components{};
|
||||||
FButton* button[3]{nullptr};
|
FButton* button[3]{nullptr};
|
||||||
std::size_t max_line_width{0};
|
std::size_t max_line_width{0};
|
||||||
FColor emphasis_color{getFWidgetColors().dialog_emphasis_fg};
|
FColor emphasis_color{getColorTheme()->dialog_emphasis_fg};
|
||||||
int button_digit[3]{0};
|
int button_digit[3]{0};
|
||||||
uInt num_buttons{0};
|
uInt num_buttons{0};
|
||||||
std::size_t text_num_lines{0};
|
std::size_t text_num_lines{0};
|
||||||
|
@ -231,10 +231,10 @@ int FMessageBox::error ( FWidget* parent
|
||||||
FTerm::beep();
|
FTerm::beep();
|
||||||
mbox.setHeadline("Warning:");
|
mbox.setHeadline("Warning:");
|
||||||
mbox.setCenterText();
|
mbox.setCenterText();
|
||||||
const auto& wc = mbox.getFWidgetColors();
|
const auto& wc = getColorTheme();
|
||||||
mbox.setForegroundColor(wc.error_box_fg);
|
mbox.setForegroundColor(wc->error_box_fg);
|
||||||
mbox.setBackgroundColor(wc.error_box_bg);
|
mbox.setBackgroundColor(wc->error_box_bg);
|
||||||
mbox.emphasis_color = wc.error_box_emphasis_fg;
|
mbox.emphasis_color = wc->error_box_emphasis_fg;
|
||||||
const int reply = mbox.exec();
|
const int reply = mbox.exec();
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,14 +247,14 @@ class FString
|
||||||
static constexpr uInt CHAR_SIZE = sizeof(wchar_t); // bytes per character
|
static constexpr uInt CHAR_SIZE = sizeof(wchar_t); // bytes per character
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void initLength (std::size_t);
|
void _initLength (std::size_t);
|
||||||
void _assign (const wchar_t[]);
|
void _assign (const wchar_t[]);
|
||||||
void _insert (std::size_t, const wchar_t[]);
|
void _insert (std::size_t, const wchar_t[]);
|
||||||
void _insert (std::size_t, std::size_t, const wchar_t[]);
|
void _insert (std::size_t, std::size_t, const wchar_t[]);
|
||||||
void _remove (std::size_t, std::size_t);
|
void _remove (std::size_t, std::size_t);
|
||||||
char* wc_to_c_str (const wchar_t[]) const;
|
const char* _to_cstring (const wchar_t[]) const;
|
||||||
wchar_t* c_to_wc_str (const char[]) const;
|
const wchar_t* _to_wcstring (const char[]) const;
|
||||||
wchar_t* extractToken (wchar_t*[], const wchar_t[], const wchar_t[]);
|
const wchar_t* _extractToken (wchar_t*[], const wchar_t[], const wchar_t[]);
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
wchar_t* string{nullptr};
|
wchar_t* string{nullptr};
|
||||||
|
|
|
@ -146,6 +146,7 @@ class FWidget : public FVTerm, public FObject
|
||||||
typedef void (*FCallbackPtr)(FWidget*, FDataPtr);
|
typedef void (*FCallbackPtr)(FWidget*, FDataPtr);
|
||||||
typedef void (FWidget::*FMemberCallback)(FWidget*, FDataPtr);
|
typedef void (FWidget::*FMemberCallback)(FWidget*, FDataPtr);
|
||||||
typedef std::function<void(FWidget*, FDataPtr)> FCallback;
|
typedef std::function<void(FWidget*, FDataPtr)> FCallback;
|
||||||
|
typedef std::shared_ptr<FWidgetColors> FWidgetColorsPtr;
|
||||||
|
|
||||||
struct FWidgetFlags // Properties of a widget ⚑
|
struct FWidgetFlags // Properties of a widget ⚑
|
||||||
{
|
{
|
||||||
|
@ -196,10 +197,10 @@ class FWidget : public FVTerm, public FObject
|
||||||
static FWidgetList*& getWindowList();
|
static FWidgetList*& getWindowList();
|
||||||
static FMenuBar* getMenuBar();
|
static FMenuBar* getMenuBar();
|
||||||
static FStatusBar* getStatusBar();
|
static FStatusBar* getStatusBar();
|
||||||
|
static FWidgetColorsPtr& getColorTheme();
|
||||||
virtual FWidget* getFirstFocusableWidget (FObjectList);
|
virtual FWidget* getFirstFocusableWidget (FObjectList);
|
||||||
virtual FWidget* getLastFocusableWidget (FObjectList);
|
virtual FWidget* getLastFocusableWidget (FObjectList);
|
||||||
const FAcceleratorList& getAcceleratorList() const;
|
const FAcceleratorList& getAcceleratorList() const;
|
||||||
FAcceleratorList& setAcceleratorList();
|
|
||||||
FString getStatusbarMessage() const;
|
FString getStatusbarMessage() const;
|
||||||
FColor getForegroundColor() const; // get the primary
|
FColor getForegroundColor() const; // get the primary
|
||||||
FColor getBackgroundColor() const; // widget colors
|
FColor getBackgroundColor() const; // widget colors
|
||||||
|
@ -241,6 +242,9 @@ class FWidget : public FVTerm, public FObject
|
||||||
static void setMoveSizeWidget (FWidget*);
|
static void setMoveSizeWidget (FWidget*);
|
||||||
static void setActiveWindow (FWidget*);
|
static void setActiveWindow (FWidget*);
|
||||||
static void setOpenMenu (FWidget*);
|
static void setOpenMenu (FWidget*);
|
||||||
|
template<typename ClassT>
|
||||||
|
static void setColorTheme();
|
||||||
|
FAcceleratorList& setAcceleratorList();
|
||||||
virtual void setStatusbarMessage (const FString&);
|
virtual void setStatusbarMessage (const FString&);
|
||||||
bool setVisible (bool);
|
bool setVisible (bool);
|
||||||
bool setVisible();
|
bool setVisible();
|
||||||
|
@ -348,7 +352,6 @@ class FWidget : public FVTerm, public FObject
|
||||||
|
|
||||||
// Accessor
|
// Accessor
|
||||||
FTermArea* getPrintArea() override;
|
FTermArea* getPrintArea() override;
|
||||||
const FWidgetColors& getFWidgetColors() const;
|
|
||||||
static uInt getModalDialogCounter();
|
static uInt getModalDialogCounter();
|
||||||
static FWidgetList*& getDialogList();
|
static FWidgetList*& getDialogList();
|
||||||
static FWidgetList*& getAlwaysOnTopList();
|
static FWidgetList*& getAlwaysOnTopList();
|
||||||
|
@ -363,7 +366,6 @@ class FWidget : public FVTerm, public FObject
|
||||||
// Mutators
|
// Mutators
|
||||||
virtual void setStatusBar (FStatusBar*);
|
virtual void setStatusBar (FStatusBar*);
|
||||||
virtual void setMenuBar (FMenuBar*);
|
virtual void setMenuBar (FMenuBar*);
|
||||||
FWidgetColors& setFWidgetColors();
|
|
||||||
static uInt& setModalDialogCounter();
|
static uInt& setModalDialogCounter();
|
||||||
void setParentOffset();
|
void setParentOffset();
|
||||||
void setTermOffset();
|
void setTermOffset();
|
||||||
|
@ -456,7 +458,8 @@ class FWidget : public FVTerm, public FObject
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void drawWindows();
|
void drawWindows();
|
||||||
void drawChildren();
|
void drawChildren();
|
||||||
static void setColorTheme();
|
static void initColorTheme();
|
||||||
|
void destroyColorTheme();
|
||||||
void setStatusbarText (bool);
|
void setStatusbarText (bool);
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
|
@ -501,7 +504,6 @@ class FWidget : public FVTerm, public FObject
|
||||||
static FWidgetList* dialog_list;
|
static FWidgetList* dialog_list;
|
||||||
static FWidgetList* always_on_top_list;
|
static FWidgetList* always_on_top_list;
|
||||||
static FWidgetList* close_widget;
|
static FWidgetList* close_widget;
|
||||||
static FWidgetColors wcolors;
|
|
||||||
static uInt modal_dialog_counter;
|
static uInt modal_dialog_counter;
|
||||||
static bool init_desktop;
|
static bool init_desktop;
|
||||||
static bool hideable;
|
static bool hideable;
|
||||||
|
@ -645,6 +647,13 @@ inline FMenuBar* FWidget::getMenuBar()
|
||||||
inline FStatusBar* FWidget::getStatusBar()
|
inline FStatusBar* FWidget::getStatusBar()
|
||||||
{ return statusbar; }
|
{ return statusbar; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline FWidget::FWidgetColorsPtr& FWidget::getColorTheme()
|
||||||
|
{
|
||||||
|
static FWidgetColorsPtr* color_theme = new FWidgetColorsPtr();
|
||||||
|
return *color_theme;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FWidget::FAcceleratorList& FWidget::getAcceleratorList() const
|
inline const FWidget::FAcceleratorList& FWidget::getAcceleratorList() const
|
||||||
{ return accelerator_list; }
|
{ return accelerator_list; }
|
||||||
|
@ -828,6 +837,13 @@ inline void FWidget::setClickedWidget (FWidget* obj)
|
||||||
inline void FWidget::setOpenMenu (FWidget* obj)
|
inline void FWidget::setOpenMenu (FWidget* obj)
|
||||||
{ open_menu = obj; }
|
{ open_menu = obj; }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
template<typename ClassT>
|
||||||
|
inline void FWidget::setColorTheme()
|
||||||
|
{
|
||||||
|
getColorTheme() = std::make_shared<ClassT>();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::setMoveSizeWidget (FWidget* obj)
|
inline void FWidget::setMoveSizeWidget (FWidget* obj)
|
||||||
{ move_size_widget = obj; }
|
{ move_size_widget = obj; }
|
||||||
|
@ -1069,10 +1085,6 @@ inline void FWidget::drawBorder()
|
||||||
finalcut::drawBorder (this, FRect(FPoint{1, 1}, getSize()));
|
finalcut::drawBorder (this, FRect(FPoint{1, 1}, getSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline const FWidgetColors& FWidget::getFWidgetColors() const
|
|
||||||
{ return wcolors; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline uInt FWidget::getModalDialogCounter()
|
inline uInt FWidget::getModalDialogCounter()
|
||||||
{ return modal_dialog_counter; }
|
{ return modal_dialog_counter; }
|
||||||
|
@ -1089,10 +1101,6 @@ inline FWidget::FWidgetList*& FWidget::getAlwaysOnTopList()
|
||||||
inline FWidget::FWidgetList*& FWidget::getWidgetCloseList()
|
inline FWidget::FWidgetList*& FWidget::getWidgetCloseList()
|
||||||
{ return close_widget; }
|
{ return close_widget; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline FWidgetColors& FWidget::setFWidgetColors()
|
|
||||||
{ return wcolors; }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline uInt& FWidget::setModalDialogCounter()
|
inline uInt& FWidget::setModalDialogCounter()
|
||||||
{ return modal_dialog_counter; }
|
{ return modal_dialog_counter; }
|
||||||
|
|
|
@ -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 *
|
||||||
|
@ -44,12 +44,17 @@ namespace finalcut
|
||||||
// class FWidgetColors
|
// class FWidgetColors
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
class FWidgetColors final
|
class FWidgetColors
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Methods
|
// Constructor
|
||||||
void set8ColorTheme();
|
FWidgetColors();
|
||||||
void set16ColorTheme();
|
|
||||||
|
// Destructor
|
||||||
|
virtual ~FWidgetColors();
|
||||||
|
|
||||||
|
// Method
|
||||||
|
virtual void setColorTheme() = 0;
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
FColor term_fg{fc::Default};
|
FColor term_fg{fc::Default};
|
||||||
|
@ -140,6 +145,42 @@ class FWidgetColors final
|
||||||
FColor progressbar_bg{fc::Default};
|
FColor progressbar_bg{fc::Default};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class default8ColorTheme
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
class default8ColorTheme final : public FWidgetColors
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Constructor
|
||||||
|
default8ColorTheme();
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
virtual ~default8ColorTheme() override;
|
||||||
|
|
||||||
|
// Method
|
||||||
|
void setColorTheme() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class default16ColorTheme
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
class default16ColorTheme final : public FWidgetColors
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Constructor
|
||||||
|
default16ColorTheme();
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
virtual ~default16ColorTheme() override;
|
||||||
|
|
||||||
|
// Method
|
||||||
|
void setColorTheme() override;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
||||||
#endif // FWIDGETCOLORS_H
|
#endif // FWIDGETCOLORS_H
|
||||||
|
|
Loading…
Reference in New Issue