Code cleaning
This commit is contained in:
parent
66ff1ba208
commit
937654710b
10
README.md
10
README.md
|
@ -97,12 +97,12 @@ printf(...)
|
|||
│ │createArea(area) │ ║
|
||||
│ │ │ ║
|
||||
│ │ │ ║
|
||||
└───┼─────────────► ──────► updateVTerm(area) ────► ║
|
||||
└───┼────────► putArea(area) ────► ║
|
||||
│ │ ║
|
||||
│ putArea(x,y,area) ────► ║
|
||||
│ │ ║
|
||||
│ ◄──── getArea(x,y,area) ║
|
||||
│ │ ║
|
||||
│ putArea(x,y,area) ║
|
||||
│ ────────────────────► ║
|
||||
│ getArea(x,y,area) ║
|
||||
│ ◄──────────────────── ║
|
||||
│ │ ║
|
||||
│ │ ║
|
||||
│ resizeArea(area)│ ║
|
||||
|
|
|
@ -23,12 +23,12 @@ printf(...)
|
|||
│ │createArea(area) │ ║
|
||||
│ │ │ ║
|
||||
│ │ │ ║
|
||||
└───┼─────────────► ──────► updateVTerm(area) ────► ║
|
||||
└───┼────────► putArea(area) ────► ║
|
||||
│ │ ║
|
||||
│ putArea(x,y,area) ────► ║
|
||||
│ │ ║
|
||||
│ ◄──── getArea(x,y,area) ║
|
||||
│ │ ║
|
||||
│ putArea(x,y,area) ║
|
||||
│ ────────────────────► ║
|
||||
│ getArea(x,y,area) ║
|
||||
│ ◄──────────────────── ║
|
||||
│ │ ║
|
||||
│ │ ║
|
||||
│ resizeArea(area)│ ║
|
||||
|
|
|
@ -798,7 +798,7 @@ FWidget*& FApplication::determineClickedWidget()
|
|||
if ( window )
|
||||
{
|
||||
// Determine the widget at the current click position
|
||||
auto child = childWidgetAt (window, mouse_position);
|
||||
auto child = window->childWidgetAt (mouse_position);
|
||||
clicked = ( child != 0 ) ? child : window;
|
||||
setClickedWidget (clicked);
|
||||
}
|
||||
|
|
|
@ -440,9 +440,9 @@ inline std::size_t FButton::clickAnimationIndent (FWidget* parent_widget)
|
|||
|
||||
// noshadow + indent one character to the right
|
||||
if ( getFlags().flat )
|
||||
clearFlatBorder();
|
||||
clearFlatBorder(this);
|
||||
else if ( hasShadow() )
|
||||
clearShadow();
|
||||
clearShadow(this);
|
||||
|
||||
if ( parent_widget )
|
||||
setColor ( parent_widget->getForegroundColor()
|
||||
|
@ -639,7 +639,7 @@ void FButton::draw()
|
|||
setReverse(false); // Dark background
|
||||
|
||||
if ( getFlags().flat && ! button_down )
|
||||
drawFlatBorder();
|
||||
drawFlatBorder(this);
|
||||
|
||||
hotkeypos = finalcut::getHotkeyPos(text, button_text);
|
||||
|
||||
|
@ -665,7 +665,7 @@ void FButton::draw()
|
|||
|
||||
// Draw button shadow
|
||||
if ( ! getFlags().flat && getFlags().shadow && ! button_down )
|
||||
drawShadow();
|
||||
drawShadow(this);
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(false); // Dark background
|
||||
|
|
|
@ -748,7 +748,7 @@ void FDialog::drawDialogShadow()
|
|||
if ( isMonochron() && ! getFlags().trans_shadow )
|
||||
return;
|
||||
|
||||
drawShadow();
|
||||
drawShadow(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -791,7 +791,7 @@ void FLineEdit::drawInputField()
|
|||
}
|
||||
|
||||
if ( getFlags().shadow )
|
||||
drawShadow ();
|
||||
drawShadow(this);
|
||||
|
||||
// set the cursor to the insert pos.
|
||||
auto cursor_pos_column = getColumnWidth (text, cursor_pos);
|
||||
|
|
|
@ -1178,7 +1178,7 @@ void FMenu::draw()
|
|||
clearArea();
|
||||
drawBorder();
|
||||
drawItems();
|
||||
drawShadow();
|
||||
drawShadow(this);
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(false);
|
||||
|
|
|
@ -131,7 +131,7 @@ void FProgressbar::draw()
|
|||
drawProgressBar();
|
||||
|
||||
if ( getFlags().shadow )
|
||||
drawShadow ();
|
||||
drawShadow(this);
|
||||
|
||||
flush_out();
|
||||
}
|
||||
|
|
|
@ -2150,6 +2150,7 @@ void FTerm::useNormalScreenBuffer()
|
|||
//----------------------------------------------------------------------
|
||||
inline void FTerm::allocationValues()
|
||||
{
|
||||
FStartOptions::getFStartOptions();
|
||||
getFTermData();
|
||||
getFSystem();
|
||||
getFOptiMove();
|
||||
|
|
1248
src/fvterm.cpp
1248
src/fvterm.cpp
File diff suppressed because it is too large
Load Diff
697
src/fwidget.cpp
697
src/fwidget.cpp
|
@ -43,10 +43,10 @@ FStatusBar* FWidget::statusbar{nullptr};
|
|||
FMenuBar* FWidget::menubar{nullptr};
|
||||
FWidget* FWidget::show_root_widget{nullptr};
|
||||
FWidget* FWidget::redraw_root_widget{nullptr};
|
||||
FWidget::widgetList* FWidget::window_list{nullptr};
|
||||
FWidget::widgetList* FWidget::dialog_list{nullptr};
|
||||
FWidget::widgetList* FWidget::always_on_top_list{nullptr};
|
||||
FWidget::widgetList* FWidget::close_widget{nullptr};
|
||||
FWidget::FWidgetList* FWidget::window_list{nullptr};
|
||||
FWidget::FWidgetList* FWidget::dialog_list{nullptr};
|
||||
FWidget::FWidgetList* FWidget::always_on_top_list{nullptr};
|
||||
FWidget::FWidgetList* FWidget::close_widget{nullptr};
|
||||
FWidgetColors FWidget::wcolors{};
|
||||
bool FWidget::init_desktop{false};
|
||||
bool FWidget::hideable{false};
|
||||
|
@ -170,9 +170,8 @@ FWidget* FWidget::getFirstFocusableWidget (FObjectList list)
|
|||
return 0;
|
||||
|
||||
auto iter = list.begin();
|
||||
auto last = list.end();
|
||||
|
||||
while ( iter != last )
|
||||
while ( iter != list.end() )
|
||||
{
|
||||
if ( (*iter)->isWidget() )
|
||||
{
|
||||
|
@ -194,7 +193,6 @@ FWidget* FWidget::getLastFocusableWidget (FObjectList list)
|
|||
if ( list.empty() )
|
||||
return 0;
|
||||
|
||||
auto first = list.begin();
|
||||
auto iter = list.end();
|
||||
|
||||
do
|
||||
|
@ -209,19 +207,11 @@ FWidget* FWidget::getLastFocusableWidget (FObjectList list)
|
|||
if ( child->isEnabled() && child->acceptFocus() )
|
||||
return child;
|
||||
}
|
||||
while ( iter != first );
|
||||
while ( iter != list.begin() );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FPoint FWidget::getPrintPos()
|
||||
{
|
||||
const auto cur = getPrintCursor();
|
||||
return FPoint ( cur.getX() - woffset.getX1() - getX() + 1
|
||||
, cur.getY() - woffset.getY1() - getY() + 1 );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
std::vector<bool>& FWidget::doubleFlatLine_ref (fc::sides side)
|
||||
{
|
||||
|
@ -248,6 +238,14 @@ std::vector<bool>& FWidget::doubleFlatLine_ref (fc::sides side)
|
|||
return double_flatline_mask.left;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FPoint FWidget::getPrintPos()
|
||||
{
|
||||
const auto cur = getPrintCursor();
|
||||
return FPoint ( cur.getX() - woffset.getX1() - getX() + 1
|
||||
, cur.getY() - woffset.getY1() - getY() + 1 );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setMainWidget (FWidget* obj)
|
||||
{
|
||||
|
@ -757,34 +755,26 @@ void FWidget::setDoubleFlatLine (fc::sides side, int pos, bool bit)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FWidget* FWidget::childWidgetAt (FWidget* p, const FPoint& pos)
|
||||
FWidget* FWidget::childWidgetAt (const FPoint& pos)
|
||||
{
|
||||
if ( p && p->hasChildren() )
|
||||
{
|
||||
auto iter = p->begin();
|
||||
auto last = p->end();
|
||||
if ( ! hasChildren() )
|
||||
return 0;
|
||||
|
||||
while ( iter != last )
|
||||
for (auto&& child : getChildren())
|
||||
{
|
||||
if ( ! (*iter)->isWidget() )
|
||||
{
|
||||
++iter;
|
||||
if ( ! child->isWidget() )
|
||||
continue;
|
||||
}
|
||||
|
||||
auto widget = static_cast<FWidget*>(*iter);
|
||||
auto widget = static_cast<FWidget*>(child);
|
||||
|
||||
if ( widget->isEnabled()
|
||||
&& widget->isShown()
|
||||
&& ! widget->isWindowWidget()
|
||||
&& widget->getTermGeometry().contains(pos) )
|
||||
{
|
||||
auto child = childWidgetAt(widget, pos);
|
||||
auto child = widget->childWidgetAt(pos);
|
||||
return ( child != 0 ) ? child : widget;
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -797,22 +787,18 @@ int FWidget::numOfFocusableChildren()
|
|||
return 0;
|
||||
|
||||
int num{0};
|
||||
auto iter = FObject::begin();
|
||||
auto last = FObject::end();
|
||||
|
||||
while ( iter != last )
|
||||
for (auto&& child : getChildren())
|
||||
{
|
||||
if ( (*iter)->isWidget() )
|
||||
if ( child->isWidget() )
|
||||
{
|
||||
auto widget = static_cast<FWidget*>(*iter);
|
||||
auto widget = static_cast<FWidget*>(child);
|
||||
|
||||
if ( widget->isShown()
|
||||
&& widget->acceptFocus()
|
||||
&& ! widget->isWindowWidget() )
|
||||
num++;
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
|
||||
return num;
|
||||
|
@ -921,19 +907,14 @@ void FWidget::emitCallback (const FString& emit_signal)
|
|||
if ( callback_objects.empty() )
|
||||
return;
|
||||
|
||||
auto iter = callback_objects.begin();
|
||||
auto last = callback_objects.end();
|
||||
|
||||
while ( iter != last )
|
||||
for (auto&& cback : callback_objects)
|
||||
{
|
||||
if ( iter->cb_signal == emit_signal )
|
||||
if ( cback.cb_signal == emit_signal )
|
||||
{
|
||||
// Calling the stored function pointer
|
||||
auto callback = iter->cb_function;
|
||||
callback (this, iter->data);
|
||||
auto callback = cback.cb_function;
|
||||
callback (this, cback.data);
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1073,20 +1054,15 @@ void FWidget::show()
|
|||
|
||||
if ( hasChildren() )
|
||||
{
|
||||
auto iter = FObject::begin();
|
||||
auto last = FObject::end();
|
||||
|
||||
while ( iter != last )
|
||||
for (auto&& child : getChildren())
|
||||
{
|
||||
if ( (*iter)->isWidget() )
|
||||
if ( child->isWidget() )
|
||||
{
|
||||
auto widget = static_cast<FWidget*>(*iter);
|
||||
auto widget = static_cast<FWidget*>(child);
|
||||
|
||||
if ( ! widget->flags.hidden )
|
||||
widget->show();
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1208,22 +1184,6 @@ bool FWidget::focusLastChild()
|
|||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::detectTermSize()
|
||||
{
|
||||
auto r = rootObject;
|
||||
FTerm::detectTermSize();
|
||||
r->adjust_wsize.setRect (1, 1, getDesktopWidth(), getDesktopHeight());
|
||||
r->woffset.setRect (0, 0, getDesktopWidth(), getDesktopHeight());
|
||||
r->wclient_offset.setCoordinates
|
||||
(
|
||||
r->padding.left,
|
||||
r->padding.top,
|
||||
int(getDesktopWidth()) - 1 - r->padding.right,
|
||||
int(getDesktopHeight()) - 1 - r->padding.bottom
|
||||
);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::move (const FPoint& pos)
|
||||
{
|
||||
|
@ -1231,201 +1191,6 @@ void FWidget::move (const FPoint& pos)
|
|||
adjust_wsize.move(pos);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::drawShadow()
|
||||
{
|
||||
if ( isMonochron() && ! flags.trans_shadow )
|
||||
return;
|
||||
|
||||
if ( (getEncoding() == fc::VT100 && ! flags.trans_shadow)
|
||||
|| (getEncoding() == fc::ASCII && ! flags.trans_shadow) )
|
||||
{
|
||||
clearShadow();
|
||||
return;
|
||||
}
|
||||
|
||||
int x1 = 1;
|
||||
int x2 = int(getWidth());
|
||||
int y1 = 1;
|
||||
int y2 = int(getHeight());
|
||||
|
||||
if ( flags.trans_shadow )
|
||||
{
|
||||
// transparent shadow
|
||||
drawTransparentShadow (x1, y1, x2, y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// non-transparent shadow
|
||||
drawBlockShadow (x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::clearShadow()
|
||||
{
|
||||
if ( isMonochron() )
|
||||
return;
|
||||
|
||||
int w = int(getWidth());
|
||||
int h = int(getHeight());
|
||||
|
||||
if ( isWindowWidget() )
|
||||
{
|
||||
setColor (wcolors.shadow_fg, wcolors.shadow_bg);
|
||||
setInheritBackground(); // current background color will be ignored
|
||||
}
|
||||
else if ( auto p = getParentWidget() )
|
||||
setColor (wcolors.shadow_fg, p->getBackgroundColor());
|
||||
|
||||
if ( w <= woffset.getX2() )
|
||||
{
|
||||
for (std::size_t y{1}; y <= getHeight(); y++)
|
||||
{
|
||||
print() << FPoint(w + 1, int(y)) << ' '; // clear █
|
||||
}
|
||||
}
|
||||
|
||||
if ( h <= woffset.getY2() )
|
||||
{
|
||||
print() << FPoint(2, h + 1);
|
||||
|
||||
for (std::size_t i{1}; i <= getWidth(); i++)
|
||||
print (' '); // clear ▀
|
||||
}
|
||||
|
||||
if ( isWindowWidget() )
|
||||
unsetInheritBackground();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::drawFlatBorder()
|
||||
{
|
||||
if ( ! isNewFont() )
|
||||
return;
|
||||
|
||||
int x1 = 1;
|
||||
int x2 = int(getWidth() + 1);
|
||||
int y1 = 0;
|
||||
int y2 = int(getHeight() + 1);
|
||||
|
||||
if ( auto p = getParentWidget() )
|
||||
setColor (wcolors.dialog_fg, p->getBackgroundColor());
|
||||
else
|
||||
setColor (wcolors.dialog_fg, wcolors.dialog_bg);
|
||||
|
||||
for (std::size_t y{0}; y < getHeight(); y++)
|
||||
{
|
||||
print() << FPoint(x1 - 1, y1 + int(y) + 1);
|
||||
|
||||
if ( double_flatline_mask.left[uLong(y)] )
|
||||
// left+right line (on left side)
|
||||
print (fc::NF_rev_border_line_right_and_left);
|
||||
else
|
||||
// right line (on left side)
|
||||
print (fc::NF_rev_border_line_right);
|
||||
}
|
||||
|
||||
print() << FPoint(x2, y1 + 1);
|
||||
|
||||
for (std::size_t y{0}; y < getHeight(); y++)
|
||||
{
|
||||
if ( double_flatline_mask.right[y] )
|
||||
// left+right line (on right side)
|
||||
print (fc::NF_rev_border_line_right_and_left);
|
||||
else
|
||||
// left line (on right side)
|
||||
print (fc::NF_border_line_left);
|
||||
|
||||
print() << FPoint(x2, y1 + int(y) + 2);
|
||||
}
|
||||
|
||||
print() << FPoint(x1, y1);
|
||||
|
||||
for (std::size_t x{0}; x < getWidth(); x++)
|
||||
{
|
||||
if ( double_flatline_mask.top[x] )
|
||||
// top+bottom line (at top)
|
||||
print (fc::NF_border_line_up_and_down);
|
||||
else
|
||||
// bottom line (at top)
|
||||
print (fc::NF_border_line_bottom);
|
||||
}
|
||||
|
||||
print() << FPoint(x1, y2);
|
||||
|
||||
for (std::size_t x{0}; x < getWidth(); x++)
|
||||
{
|
||||
if ( double_flatline_mask.bottom[x] )
|
||||
// top+bottom line (at bottom)
|
||||
print (fc::NF_border_line_up_and_down);
|
||||
else
|
||||
// top line (at bottom)
|
||||
print (fc::NF_border_line_upper);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::clearFlatBorder()
|
||||
{
|
||||
if ( ! isNewFont() )
|
||||
return;
|
||||
|
||||
int x1 = 1;
|
||||
int x2 = int(getWidth() + 1);
|
||||
int y1 = 0;
|
||||
int y2 = int(getHeight() + 1);
|
||||
|
||||
if ( auto p = getParentWidget() )
|
||||
setColor (wcolors.dialog_fg, p->getBackgroundColor());
|
||||
else
|
||||
setColor (wcolors.dialog_fg, wcolors.dialog_bg);
|
||||
|
||||
// clear on left side
|
||||
for (std::size_t y{0}; y < getHeight(); y++)
|
||||
{
|
||||
print() << FPoint(x1 - 1, y1 + int(y) + 1);
|
||||
|
||||
if ( double_flatline_mask.left[y] )
|
||||
print (fc::NF_border_line_left);
|
||||
else
|
||||
print (' ');
|
||||
}
|
||||
|
||||
// clear on right side
|
||||
for (std::size_t y{0}; y < getHeight(); y++)
|
||||
{
|
||||
print() << FPoint(x2, y1 + int(y) + 1);
|
||||
|
||||
if ( double_flatline_mask.right[y] )
|
||||
print (fc::NF_rev_border_line_right);
|
||||
else
|
||||
print (' ');
|
||||
}
|
||||
|
||||
// clear at top
|
||||
print() << FPoint(x1, y1);
|
||||
|
||||
for (std::size_t x{0}; x < getWidth(); x++)
|
||||
{
|
||||
if ( double_flatline_mask.top[x] )
|
||||
print (fc::NF_border_line_upper);
|
||||
else
|
||||
print (' ');
|
||||
}
|
||||
|
||||
// clear at bottom
|
||||
print() << FPoint(x1, y2);
|
||||
|
||||
for (std::size_t x{0}; x < getWidth(); x++)
|
||||
{
|
||||
if ( double_flatline_mask.bottom[x] )
|
||||
print (fc::NF_border_line_bottom);
|
||||
else
|
||||
print (' ');
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::quit()
|
||||
{
|
||||
|
@ -1566,19 +1331,15 @@ void FWidget::adjustSize()
|
|||
|
||||
if ( hasChildren() )
|
||||
{
|
||||
auto iter = FObject::begin();
|
||||
auto last = FObject::end();
|
||||
|
||||
while ( iter != last )
|
||||
for (auto&& child : getChildren())
|
||||
{
|
||||
if ( (*iter)->isWidget() )
|
||||
if ( child->isWidget() )
|
||||
{
|
||||
auto widget = static_cast<FWidget*>(*iter);
|
||||
auto widget = static_cast<FWidget*>(child);
|
||||
|
||||
if ( ! widget->isWindowWidget() )
|
||||
widget->adjustSize();
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1940,10 +1701,10 @@ void FWidget::init()
|
|||
try
|
||||
{
|
||||
// Initialize widget lists
|
||||
window_list = new widgetList();
|
||||
dialog_list = new widgetList();
|
||||
always_on_top_list = new widgetList();
|
||||
close_widget = new widgetList();
|
||||
window_list = new FWidgetList();
|
||||
dialog_list = new FWidgetList();
|
||||
always_on_top_list = new FWidgetList();
|
||||
close_widget = new FWidgetList();
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -2175,22 +1936,16 @@ void FWidget::drawWindows()
|
|||
if ( ! window_list || window_list->empty() )
|
||||
return;
|
||||
|
||||
auto iter = window_list->begin();
|
||||
auto last = window_list->end();
|
||||
|
||||
while ( iter != last )
|
||||
for (auto&& window : *window_list)
|
||||
{
|
||||
if ( (*iter)->isShown() )
|
||||
if ( window->isShown() )
|
||||
{
|
||||
auto win = (*iter)->getVWin();
|
||||
auto win = window->getVWin();
|
||||
int w = win->width + win->right_shadow;
|
||||
int h = win->height + win->bottom_shadow;
|
||||
std::fill_n (win->text, w * h, default_char);
|
||||
|
||||
(*iter)->redraw();
|
||||
window->redraw();
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2201,97 +1956,18 @@ void FWidget::drawChildren()
|
|||
if ( ! hasChildren() )
|
||||
return;
|
||||
|
||||
auto iter = FObject::begin();
|
||||
auto last = FObject::end();
|
||||
|
||||
while ( iter != last )
|
||||
for (auto&& child : getChildren())
|
||||
{
|
||||
if ( (*iter)->isWidget() )
|
||||
if ( child->isWidget() )
|
||||
{
|
||||
auto widget = static_cast<FWidget*>(*iter);
|
||||
auto widget = static_cast<FWidget*>(child);
|
||||
|
||||
if ( widget->isShown() && ! widget->isWindowWidget() )
|
||||
widget->redraw();
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
|
||||
{
|
||||
// transparent shadow
|
||||
|
||||
setTransparent();
|
||||
print() << FPoint(x2 + 1, y1) << " ";
|
||||
unsetTransparent();
|
||||
|
||||
setColor (wcolors.shadow_bg, wcolors.shadow_fg);
|
||||
setTransShadow();
|
||||
|
||||
for (std::size_t y{1}; y < getHeight(); y++)
|
||||
{
|
||||
print() << FPoint(x2 + 1, y1 + int(y)) << " ";
|
||||
}
|
||||
|
||||
unsetTransShadow();
|
||||
setTransparent();
|
||||
print() << FPoint(x1, y2 + 1) << " ";
|
||||
unsetTransparent();
|
||||
|
||||
setColor (wcolors.shadow_bg, wcolors.shadow_fg);
|
||||
setTransShadow();
|
||||
|
||||
for (std::size_t x{2}; x <= getWidth() + 1; x++)
|
||||
print (' ');
|
||||
|
||||
unsetTransShadow();
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
||||
{
|
||||
// non-transparent shadow
|
||||
|
||||
if ( ! hasShadowCharacter() )
|
||||
return;
|
||||
|
||||
print() << FPoint(x2 + 1, y1);
|
||||
|
||||
if ( isWindowWidget() )
|
||||
{
|
||||
setColor (wcolors.shadow_fg, wcolors.shadow_bg);
|
||||
setInheritBackground(); // current background color will be ignored
|
||||
}
|
||||
else if ( auto p = getParentWidget() )
|
||||
setColor (wcolors.shadow_fg, p->getBackgroundColor());
|
||||
|
||||
print (fc::LowerHalfBlock); // ▄
|
||||
|
||||
if ( isWindowWidget() )
|
||||
unsetInheritBackground();
|
||||
|
||||
for (std::size_t y{1}; y < getHeight(); y++)
|
||||
{
|
||||
print() << FPoint(x2 + 1, y1 + int(y)) << fc::FullBlock; // █
|
||||
}
|
||||
|
||||
print() << FPoint(x1 + 1, y2 + 1);
|
||||
|
||||
if ( isWindowWidget() )
|
||||
setInheritBackground();
|
||||
|
||||
for (std::size_t x{1}; x <= getWidth(); x++)
|
||||
print (fc::UpperHalfBlock); // ▀
|
||||
|
||||
if ( isWindowWidget() )
|
||||
unsetInheritBackground();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setColorTheme()
|
||||
{
|
||||
|
@ -2305,6 +1981,22 @@ void FWidget::setColorTheme()
|
|||
|
||||
|
||||
// non-member functions
|
||||
//----------------------------------------------------------------------
|
||||
void detectTermSize()
|
||||
{
|
||||
auto r = rootObject;
|
||||
FTerm::detectTermSize();
|
||||
r->adjust_wsize.setRect (1, 1, r->getDesktopWidth(), r->getDesktopHeight());
|
||||
r->woffset.setRect (0, 0, r->getDesktopWidth(), r->getDesktopHeight());
|
||||
r->wclient_offset.setCoordinates
|
||||
(
|
||||
r->padding.left,
|
||||
r->padding.top,
|
||||
int(r->getDesktopWidth()) - 1 - r->padding.right,
|
||||
int(r->getDesktopHeight()) - 1 - r->padding.bottom
|
||||
);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FKey getHotkey (const FString& text)
|
||||
{
|
||||
|
@ -2382,6 +2074,273 @@ void setHotkeyViaString (FWidget* w, const FString& text)
|
|||
w->delAccelerator();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void drawShadow (FWidget* w)
|
||||
{
|
||||
if ( w->isMonochron() && ! w->flags.trans_shadow )
|
||||
return;
|
||||
|
||||
if ( (w->getEncoding() == fc::VT100 && ! w->flags.trans_shadow)
|
||||
|| (w->getEncoding() == fc::ASCII && ! w->flags.trans_shadow) )
|
||||
{
|
||||
clearShadow(w);
|
||||
return;
|
||||
}
|
||||
|
||||
int x1 = 1;
|
||||
int x2 = int(w->getWidth());
|
||||
int y1 = 1;
|
||||
int y2 = int(w->getHeight());
|
||||
|
||||
if ( w->flags.trans_shadow )
|
||||
{
|
||||
// transparent shadow
|
||||
drawTransparentShadow (w, x1, y1, x2, y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// non-transparent shadow
|
||||
drawBlockShadow (w, x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void drawTransparentShadow (FWidget* w, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
// transparent shadow
|
||||
|
||||
w->setTransparent();
|
||||
w->print() << FPoint(x2 + 1, y1) << " ";
|
||||
w->unsetTransparent();
|
||||
w->setColor (w->wcolors.shadow_bg, w->wcolors.shadow_fg);
|
||||
w->setTransShadow();
|
||||
|
||||
for (std::size_t y{1}; y < w->getHeight(); y++)
|
||||
{
|
||||
w->print() << FPoint(x2 + 1, y1 + int(y)) << " ";
|
||||
}
|
||||
|
||||
w->unsetTransShadow();
|
||||
w->setTransparent();
|
||||
w->print() << FPoint(x1, y2 + 1) << " ";
|
||||
w->unsetTransparent();
|
||||
w->setColor (w->wcolors.shadow_bg, w->wcolors.shadow_fg);
|
||||
w->setTransShadow();
|
||||
|
||||
for (std::size_t x{2}; x <= w->getWidth() + 1; x++)
|
||||
w->print (' ');
|
||||
|
||||
w->unsetTransShadow();
|
||||
|
||||
if ( w->isMonochron() )
|
||||
w->setReverse(false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void drawBlockShadow (FWidget* w, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
// non-transparent shadow
|
||||
|
||||
if ( ! w->hasShadowCharacter() )
|
||||
return;
|
||||
|
||||
w->print() << FPoint(x2 + 1, y1);
|
||||
|
||||
if ( w->isWindowWidget() )
|
||||
{
|
||||
w->setColor (w->wcolors.shadow_fg, w->wcolors.shadow_bg);
|
||||
w->setInheritBackground(); // current background color will be ignored
|
||||
}
|
||||
else if ( auto p = w->getParentWidget() )
|
||||
w->setColor (w->wcolors.shadow_fg, p->getBackgroundColor());
|
||||
|
||||
w->print (fc::LowerHalfBlock); // ▄
|
||||
|
||||
if ( w->isWindowWidget() )
|
||||
w->unsetInheritBackground();
|
||||
|
||||
for (std::size_t y{1}; y < w->getHeight(); y++)
|
||||
{
|
||||
w->print() << FPoint(x2 + 1, y1 + int(y)) << fc::FullBlock; // █
|
||||
}
|
||||
|
||||
w->print() << FPoint(x1 + 1, y2 + 1);
|
||||
|
||||
if ( w->isWindowWidget() )
|
||||
w->setInheritBackground();
|
||||
|
||||
for (std::size_t x{1}; x <= w->getWidth(); x++)
|
||||
w->print (fc::UpperHalfBlock); // ▀
|
||||
|
||||
if ( w->isWindowWidget() )
|
||||
w->unsetInheritBackground();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void clearShadow (FWidget* w)
|
||||
{
|
||||
if ( w->isMonochron() )
|
||||
return;
|
||||
|
||||
int width = int(w->getWidth());
|
||||
int height = int(w->getHeight());
|
||||
|
||||
if ( w->isWindowWidget() )
|
||||
{
|
||||
w->setColor (w->wcolors.shadow_fg, w->wcolors.shadow_bg);
|
||||
w->setInheritBackground(); // current background color will be ignored
|
||||
}
|
||||
else if ( auto p = w->getParentWidget() )
|
||||
w->setColor (w->wcolors.shadow_fg, p->getBackgroundColor());
|
||||
|
||||
if ( width <= w->woffset.getX2() )
|
||||
{
|
||||
for (std::size_t y{1}; y <= w->getHeight(); y++)
|
||||
{
|
||||
w->print() << FPoint(width + 1, int(y)) << ' '; // clear █
|
||||
}
|
||||
}
|
||||
|
||||
if ( height <= w->woffset.getY2() )
|
||||
{
|
||||
w->print() << FPoint(2, height + 1);
|
||||
|
||||
for (std::size_t i{1}; i <= w->getWidth(); i++)
|
||||
w->print (' '); // clear ▀
|
||||
}
|
||||
|
||||
if ( w->isWindowWidget() )
|
||||
w->unsetInheritBackground();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void drawFlatBorder (FWidget* w)
|
||||
{
|
||||
if ( ! w->isNewFont() )
|
||||
return;
|
||||
|
||||
int x1 = 1;
|
||||
int x2 = int(w->getWidth() + 1);
|
||||
int y1 = 0;
|
||||
int y2 = int(w->getHeight() + 1);
|
||||
|
||||
if ( auto p = w->getParentWidget() )
|
||||
w->setColor (w->wcolors.dialog_fg, p->getBackgroundColor());
|
||||
else
|
||||
w->setColor (w->wcolors.dialog_fg, w->wcolors.dialog_bg);
|
||||
|
||||
for (std::size_t y{0}; y < w->getHeight(); y++)
|
||||
{
|
||||
w->print() << FPoint(x1 - 1, y1 + int(y) + 1);
|
||||
|
||||
if ( w->double_flatline_mask.left[uLong(y)] )
|
||||
// left+right line (on left side)
|
||||
w->print (fc::NF_rev_border_line_right_and_left);
|
||||
else
|
||||
// right line (on left side)
|
||||
w->print (fc::NF_rev_border_line_right);
|
||||
}
|
||||
|
||||
w->print() << FPoint(x2, y1 + 1);
|
||||
|
||||
for (std::size_t y{0}; y < w->getHeight(); y++)
|
||||
{
|
||||
if ( w->double_flatline_mask.right[y] )
|
||||
// left+right line (on right side)
|
||||
w->print (fc::NF_rev_border_line_right_and_left);
|
||||
else
|
||||
// left line (on right side)
|
||||
w->print (fc::NF_border_line_left);
|
||||
|
||||
w->print() << FPoint(x2, y1 + int(y) + 2);
|
||||
}
|
||||
|
||||
w->print() << FPoint(x1, y1);
|
||||
|
||||
for (std::size_t x{0}; x < w->getWidth(); x++)
|
||||
{
|
||||
if ( w->double_flatline_mask.top[x] )
|
||||
// top+bottom line (at top)
|
||||
w->print (fc::NF_border_line_up_and_down);
|
||||
else
|
||||
// bottom line (at top)
|
||||
w->print (fc::NF_border_line_bottom);
|
||||
}
|
||||
|
||||
w->print() << FPoint(x1, y2);
|
||||
|
||||
for (std::size_t x{0}; x < w->getWidth(); x++)
|
||||
{
|
||||
if ( w->double_flatline_mask.bottom[x] )
|
||||
// top+bottom line (at bottom)
|
||||
w->print (fc::NF_border_line_up_and_down);
|
||||
else
|
||||
// top line (at bottom)
|
||||
w->print (fc::NF_border_line_upper);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void clearFlatBorder (FWidget* w)
|
||||
{
|
||||
if ( ! w->isNewFont() )
|
||||
return;
|
||||
|
||||
int x1 = 1;
|
||||
int x2 = int(w->getWidth() + 1);
|
||||
int y1 = 0;
|
||||
int y2 = int(w->getHeight() + 1);
|
||||
|
||||
if ( auto p = w->getParentWidget() )
|
||||
w->setColor (w->wcolors.dialog_fg, p->getBackgroundColor());
|
||||
else
|
||||
w->setColor (w->wcolors.dialog_fg, w->wcolors.dialog_bg);
|
||||
|
||||
// clear on left side
|
||||
for (std::size_t y{0}; y < w->getHeight(); y++)
|
||||
{
|
||||
w->print() << FPoint(x1 - 1, y1 + int(y) + 1);
|
||||
|
||||
if ( w->double_flatline_mask.left[y] )
|
||||
w->print (fc::NF_border_line_left);
|
||||
else
|
||||
w->print (' ');
|
||||
}
|
||||
|
||||
// clear on right side
|
||||
for (std::size_t y{0}; y < w->getHeight(); y++)
|
||||
{
|
||||
w->print() << FPoint(x2, y1 + int(y) + 1);
|
||||
|
||||
if ( w->double_flatline_mask.right[y] )
|
||||
w->print (fc::NF_rev_border_line_right);
|
||||
else
|
||||
w->print (' ');
|
||||
}
|
||||
|
||||
// clear at top
|
||||
w->print() << FPoint(x1, y1);
|
||||
|
||||
for (std::size_t x{0}; x < w->getWidth(); x++)
|
||||
{
|
||||
if ( w->double_flatline_mask.top[x] )
|
||||
w->print (fc::NF_border_line_upper);
|
||||
else
|
||||
w->print (' ');
|
||||
}
|
||||
|
||||
// clear at bottom
|
||||
w->print() << FPoint(x1, y2);
|
||||
|
||||
for (std::size_t x{0}; x < w->getWidth(); x++)
|
||||
{
|
||||
if ( w->double_flatline_mask.bottom[x] )
|
||||
w->print (fc::NF_border_line_bottom);
|
||||
else
|
||||
w->print (' ');
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void drawBox (FWidget* w, const FRect& r)
|
||||
{
|
||||
|
|
|
@ -107,18 +107,12 @@ void FWindow::setActiveWindow (FWindow* window)
|
|||
{
|
||||
// activate FWindow object window
|
||||
|
||||
if ( ! getWindowList() )
|
||||
if ( ! getWindowList() || getWindowList()->empty() )
|
||||
return;
|
||||
|
||||
if ( getWindowList()->empty() )
|
||||
return;
|
||||
|
||||
auto iter = getWindowList()->begin();
|
||||
auto end = getWindowList()->end();
|
||||
|
||||
while ( iter != end )
|
||||
for (auto&& win : *getWindowList())
|
||||
{
|
||||
if ( *iter == window )
|
||||
if ( win == window )
|
||||
{
|
||||
if ( ! window->isWindowActive() )
|
||||
{
|
||||
|
@ -129,17 +123,15 @@ void FWindow::setActiveWindow (FWindow* window)
|
|||
}
|
||||
else
|
||||
{
|
||||
auto w = static_cast<FWindow*>(*iter);
|
||||
auto w = static_cast<FWindow*>(win);
|
||||
|
||||
if ( w->isWindowActive() )
|
||||
{
|
||||
w->deactivateWindow();
|
||||
FEvent ev(fc::WindowInactive_Event);
|
||||
FApplication::sendEvent(*iter, &ev);
|
||||
FApplication::sendEvent(win, &ev);
|
||||
}
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ class FFileDialog : public FDialog
|
|||
|
||||
typedef std::vector<dir_entry> dirEntries;
|
||||
|
||||
// Method
|
||||
// Methods
|
||||
void init();
|
||||
void widgetSettings (const FPoint&);
|
||||
void initCallbacks();
|
||||
|
|
|
@ -309,7 +309,7 @@ class FMouseX11 final : public FMouse
|
|||
// Constant
|
||||
static constexpr std::size_t MOUSE_BUF_SIZE = 4;
|
||||
|
||||
// Method
|
||||
// Methods
|
||||
void setKeyState (int);
|
||||
void setMoveState (const FPoint&, int);
|
||||
void setButtonState (int, struct timeval*);
|
||||
|
|
|
@ -123,7 +123,7 @@ class FScrollView : public FWidget
|
|||
bool hasBorder();
|
||||
bool isViewportPrint();
|
||||
|
||||
// Method
|
||||
// Methods
|
||||
void clearArea (int = ' ') override;
|
||||
void scrollToX (int);
|
||||
void scrollToY (int);
|
||||
|
@ -148,7 +148,7 @@ class FScrollView : public FWidget
|
|||
// Accessor
|
||||
term_area* getPrintArea() override;
|
||||
|
||||
// Method
|
||||
// Methods
|
||||
void adjustSize() override;
|
||||
void copy2area();
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class FToggleButton : public FWidget
|
|||
// Inquiries
|
||||
bool isChecked();
|
||||
|
||||
// Methods
|
||||
// Method
|
||||
void hide() override;
|
||||
|
||||
// Event handlers
|
||||
|
|
|
@ -57,10 +57,6 @@
|
|||
#include "final/fc.h"
|
||||
#include "final/fterm.h"
|
||||
|
||||
// Preprocessing handler macro
|
||||
//#define F_PREPROC_HANDLER(i,h)
|
||||
// static_cast<FVTerm*>((i))
|
||||
// , reinterpret_cast<FVTerm::FPreprocessingHandler>((h))
|
||||
#define F_PREPROC_HANDLER(i,h) \
|
||||
reinterpret_cast<FVTerm*>((i)), \
|
||||
std::bind ( reinterpret_cast<FVTerm::FPreprocessingHandler>((h)) \
|
||||
|
@ -296,7 +292,6 @@ class FVTerm
|
|||
virtual void addPreprocessingHandler ( FVTerm*
|
||||
, FVTermPreprocessing );
|
||||
virtual void delPreprocessingHandler (FVTerm*);
|
||||
|
||||
template<typename... Args>
|
||||
int printf (const FString, Args&&...);
|
||||
int print (const FString&);
|
||||
|
@ -316,13 +311,6 @@ class FVTerm
|
|||
static void redefineDefaultColors (bool);
|
||||
|
||||
protected:
|
||||
// Enumeration
|
||||
enum character_type
|
||||
{
|
||||
overlapped_character,
|
||||
covered_character
|
||||
};
|
||||
|
||||
// Accessor
|
||||
virtual term_area* getPrintArea();
|
||||
term_area* getChildPrintArea() const;
|
||||
|
@ -341,9 +329,6 @@ class FVTerm
|
|||
static void setInsertCursor (bool);
|
||||
static void setInsertCursor();
|
||||
static void unsetInsertCursor();
|
||||
static bool setUTF8 (bool);
|
||||
static bool setUTF8();
|
||||
static bool unsetUTF8();
|
||||
|
||||
// Inquiries
|
||||
bool hasPrintArea() const;
|
||||
|
@ -353,6 +338,7 @@ class FVTerm
|
|||
static bool hasShadowCharacter();
|
||||
|
||||
// Methods
|
||||
|
||||
void createArea ( const FRect&
|
||||
, const FSize&
|
||||
, term_area*& );
|
||||
|
@ -361,15 +347,54 @@ class FVTerm
|
|||
, term_area* );
|
||||
static void removeArea (term_area*&);
|
||||
static void restoreVTerm (const FRect&);
|
||||
bool updateVTermCursor (term_area*);
|
||||
static void setAreaCursor ( const FPoint&
|
||||
, bool, term_area* );
|
||||
static void getArea (const FPoint&, term_area*);
|
||||
static void getArea (const FRect&, term_area*);
|
||||
void putArea (term_area*);
|
||||
static void putArea (const FPoint&, term_area*);
|
||||
void scrollAreaForward (term_area*);
|
||||
void scrollAreaReverse (term_area*);
|
||||
void clearArea (term_area*, int = ' ');
|
||||
void processTerminalUpdate();
|
||||
static void startTerminalUpdate();
|
||||
static void finishTerminalUpdate();
|
||||
static void flush_out();
|
||||
static void initScreenSettings();
|
||||
static void changeTermSizeFinished();
|
||||
static void exitWithMessage (const FString&)
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
__attribute__((noreturn))
|
||||
#endif
|
||||
;
|
||||
private:
|
||||
// Enumerations
|
||||
enum character_type
|
||||
{
|
||||
overlapped_character,
|
||||
covered_character
|
||||
};
|
||||
|
||||
enum exit_state
|
||||
{
|
||||
not_used,
|
||||
used,
|
||||
line_completely_printed
|
||||
};
|
||||
|
||||
// Constants
|
||||
// Buffer size for character output on the terminal
|
||||
static constexpr uInt TERMINAL_OUTPUT_BUFFER_SIZE = 32768;
|
||||
|
||||
// Methods
|
||||
void setTextToDefault (term_area*, const FSize&);
|
||||
static bool reallocateTextArea ( term_area*
|
||||
, std::size_t
|
||||
, std::size_t );
|
||||
static bool reallocateTextArea ( term_area*
|
||||
, std::size_t );
|
||||
|
||||
static covered_state isCovered (const FPoint&, term_area*);
|
||||
|
||||
static void updateOverlappedColor ( term_area*
|
||||
, const FPoint&
|
||||
, const FPoint& );
|
||||
|
@ -387,50 +412,17 @@ class FVTerm
|
|||
static bool updateVTermCharacter ( term_area*
|
||||
, const FPoint&
|
||||
, const FPoint& );
|
||||
static void callPreprocessingHandler (term_area*);
|
||||
void updateVTerm();
|
||||
void updateVTerm (term_area*);
|
||||
bool updateVTermCursor (term_area*);
|
||||
static void callPreprocessingHandler (term_area*);
|
||||
bool hasChildAreaChanges (term_area*);
|
||||
void clearChildAreaChanges (term_area*);
|
||||
static bool isInsideArea (const FPoint&, term_area*);
|
||||
static void setAreaCursor ( const FPoint&
|
||||
, bool, term_area* );
|
||||
static void getArea (const FPoint&, term_area*);
|
||||
static void getArea (const FRect&, term_area*);
|
||||
static void putArea (const FPoint&, term_area*);
|
||||
void scrollAreaForward (term_area*);
|
||||
void scrollAreaReverse (term_area*);
|
||||
void clearArea (term_area*, int = ' ');
|
||||
static charData generateCharacter (const FPoint&);
|
||||
static charData getCharacter ( character_type
|
||||
, const FPoint&
|
||||
, FVTerm* );
|
||||
static charData getCoveredCharacter (const FPoint&, FVTerm*);
|
||||
static charData getOverlappedCharacter (const FPoint&, FVTerm*);
|
||||
void processTerminalUpdate();
|
||||
static void startTerminalUpdate();
|
||||
static void finishTerminalUpdate();
|
||||
static void flush_out();
|
||||
static void initScreenSettings();
|
||||
static void changeTermSizeFinished();
|
||||
static void exitWithMessage (const FString&)
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
__attribute__((noreturn))
|
||||
#endif
|
||||
;
|
||||
private:
|
||||
// Enumeration
|
||||
enum exit_state
|
||||
{
|
||||
not_used,
|
||||
used,
|
||||
line_completely_printed
|
||||
};
|
||||
|
||||
// Constants
|
||||
// Buffer size for character output on the terminal
|
||||
static constexpr uInt TERMINAL_OUTPUT_BUFFER_SIZE = 32768;
|
||||
|
||||
// Methods
|
||||
void init (bool);
|
||||
static void init_characterLengths (FOptiMove*);
|
||||
void finish();
|
||||
|
@ -534,7 +526,7 @@ struct FVTerm::term_area // define virtual terminal character properties
|
|||
int input_cursor_x{-1}; // X-position input cursor
|
||||
int input_cursor_y{-1}; // Y-position input cursor
|
||||
FWidget* widget{nullptr}; // Widget that owns this term_area
|
||||
FPreprocessing preprocessing_call{};
|
||||
FPreprocessing preproc_list{};
|
||||
line_changes* changes{nullptr};
|
||||
charData* text{nullptr}; // Text data for the output
|
||||
bool input_cursor_visible{false};
|
||||
|
@ -1125,18 +1117,6 @@ inline void FVTerm::setInsertCursor()
|
|||
inline void FVTerm::unsetInsertCursor()
|
||||
{ return FTerm::setInsertCursor(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FVTerm::setUTF8 (bool enable)
|
||||
{ return FTerm::setUTF8(enable); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FVTerm::setUTF8()
|
||||
{ return FTerm::setUTF8(true); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FVTerm::unsetUTF8()
|
||||
{ return FTerm::setUTF8(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FVTerm::hasPrintArea() const
|
||||
{ return print_area; }
|
||||
|
|
|
@ -146,7 +146,7 @@ class FWidget : public FVTerm, public FObject
|
|||
};
|
||||
|
||||
// Typedefs
|
||||
typedef std::vector<FWidget*> widgetList;
|
||||
typedef std::vector<FWidget*> FWidgetList;
|
||||
typedef std::vector<accelerator> Accelerators;
|
||||
typedef void (*FCallbackPtr)(FWidget*, FDataPtr);
|
||||
typedef void (FWidget::*FMemberCallback)(FWidget*, FDataPtr);
|
||||
|
@ -197,16 +197,18 @@ class FWidget : public FVTerm, public FObject
|
|||
static FWidget*& getClickedWidget();
|
||||
static FWidget*& getOpenMenu();
|
||||
static FWidget*& getMoveSizeWidget();
|
||||
static FWidgetList*& getWindowList();
|
||||
static FMenuBar* getMenuBar();
|
||||
static FStatusBar* getStatusBar();
|
||||
virtual FWidget* getFirstFocusableWidget (FObjectList);
|
||||
virtual FWidget* getLastFocusableWidget (FObjectList);
|
||||
Accelerators* getAcceleratorList() const;
|
||||
static widgetList*& getWindowList();
|
||||
static FMenuBar* getMenuBar();
|
||||
static FStatusBar* getStatusBar();
|
||||
FString getStatusbarMessage() const;
|
||||
FColor getForegroundColor() const; // get the primary
|
||||
FColor getBackgroundColor() const; // widget colors
|
||||
int getX() const; // positioning
|
||||
std::vector<bool>& doubleFlatLine_ref (fc::sides);
|
||||
// Positioning and sizes accessors...
|
||||
int getX() const;
|
||||
int getY() const;
|
||||
const FPoint getPos() const;
|
||||
int getTermX() const;
|
||||
|
@ -233,7 +235,6 @@ class FWidget : public FVTerm, public FObject
|
|||
const widget_flags& getFlags() const;
|
||||
FPoint getCursorPos();
|
||||
FPoint getPrintPos();
|
||||
std::vector<bool>& doubleFlatLine_ref (fc::sides);
|
||||
|
||||
// Mutators
|
||||
static void setMainWidget (FWidget*);
|
||||
|
@ -264,7 +265,9 @@ class FWidget : public FVTerm, public FObject
|
|||
void setForegroundColor (FColor);
|
||||
void setBackgroundColor (FColor);
|
||||
void setColor();
|
||||
virtual void setX (int, bool = true); // positioning
|
||||
widget_flags& setFlags();
|
||||
// Positioning and sizes mutators...
|
||||
virtual void setX (int, bool = true);
|
||||
virtual void setY (int, bool = true);
|
||||
virtual void setPos (const FPoint&, bool = true);
|
||||
virtual void setWidth (std::size_t, bool = true);
|
||||
|
@ -295,7 +298,6 @@ class FWidget : public FVTerm, public FObject
|
|||
void unsetDoubleFlatLine (fc::sides);
|
||||
void setDoubleFlatLine (fc::sides, int, bool = true);
|
||||
void unsetDoubleFlatLine (fc::sides, int);
|
||||
widget_flags& setFlags();
|
||||
|
||||
// Inquiries
|
||||
bool isRootWidget() const;
|
||||
|
@ -311,7 +313,7 @@ class FWidget : public FVTerm, public FObject
|
|||
bool isPaddingIgnored();
|
||||
|
||||
// Methods
|
||||
static FWidget* childWidgetAt (FWidget*, const FPoint&);
|
||||
FWidget* childWidgetAt (const FPoint&);
|
||||
int numOfFocusableChildren();
|
||||
virtual bool close();
|
||||
void clearStatusbarMessage();
|
||||
|
@ -337,13 +339,8 @@ class FWidget : public FVTerm, public FObject
|
|||
virtual bool focusFirstChild(); // widget focusing
|
||||
virtual bool focusLastChild();
|
||||
FPoint termToWidgetPos (const FPoint&);
|
||||
void detectTermSize();
|
||||
void print (const FPoint&) override;
|
||||
virtual void move (const FPoint&);
|
||||
void drawShadow();
|
||||
void clearShadow();
|
||||
void drawFlatBorder();
|
||||
void clearFlatBorder();
|
||||
virtual void drawBorder();
|
||||
static void quit();
|
||||
|
||||
|
@ -363,11 +360,10 @@ class FWidget : public FVTerm, public FObject
|
|||
term_area* getPrintArea() override;
|
||||
const FWidgetColors& getFWidgetColors() const;
|
||||
static uInt getModalDialogCounter();
|
||||
static widgetList*& getDialogList();
|
||||
static widgetList*& getAlwaysOnTopList();
|
||||
static widgetList*& getWidgetCloseList();
|
||||
void addPreprocessingHandler ( FVTerm*
|
||||
, FVTermPreprocessing ) override;
|
||||
static FWidgetList*& getDialogList();
|
||||
static FWidgetList*& getAlwaysOnTopList();
|
||||
static FWidgetList*& getWidgetCloseList();
|
||||
void addPreprocessingHandler (FVTerm*, FVTermPreprocessing) override;
|
||||
void delPreprocessingHandler (FVTerm*) override;
|
||||
|
||||
// Inquiry
|
||||
|
@ -420,8 +416,6 @@ class FWidget : public FVTerm, public FObject
|
|||
virtual void draw();
|
||||
void drawWindows();
|
||||
void drawChildren();
|
||||
void drawTransparentShadow (int, int, int, int);
|
||||
void drawBlockShadow (int, int, int, int);
|
||||
static void setColorTheme();
|
||||
|
||||
// Data members
|
||||
|
@ -505,10 +499,10 @@ class FWidget : public FVTerm, public FObject
|
|||
static FWidget* move_size_widget;
|
||||
static FWidget* show_root_widget;
|
||||
static FWidget* redraw_root_widget;
|
||||
static widgetList* window_list;
|
||||
static widgetList* dialog_list;
|
||||
static widgetList* always_on_top_list;
|
||||
static widgetList* close_widget;
|
||||
static FWidgetList* window_list;
|
||||
static FWidgetList* dialog_list;
|
||||
static FWidgetList* always_on_top_list;
|
||||
static FWidgetList* close_widget;
|
||||
static FWidgetColors wcolors;
|
||||
static uInt modal_dialog_counter;
|
||||
static bool init_desktop;
|
||||
|
@ -517,15 +511,32 @@ class FWidget : public FVTerm, public FObject
|
|||
// Friend classes
|
||||
friend class FToggleButton;
|
||||
friend class FScrollView;
|
||||
|
||||
// Friend functions
|
||||
friend void detectTermSize();
|
||||
friend void drawShadow (FWidget*);
|
||||
friend void drawTransparentShadow (FWidget*, int, int, int, int);
|
||||
friend void drawBlockShadow (FWidget*, int, int, int, int);
|
||||
friend void clearShadow (FWidget*);
|
||||
friend void drawFlatBorder (FWidget*);
|
||||
friend void clearFlatBorder (FWidget*);
|
||||
};
|
||||
|
||||
|
||||
// non-member function forward declarations
|
||||
//----------------------------------------------------------------------
|
||||
void detectTermSize();
|
||||
FKey getHotkey (const FString&);
|
||||
std::size_t getHotkeyPos (const FString& src, FString& dest);
|
||||
void setHotkeyViaString (FWidget*, const FString&);
|
||||
void drawBorder (FWidget*, FRect);
|
||||
void drawShadow (FWidget*);
|
||||
void drawTransparentShadow (FWidget*, int, int, int, int);
|
||||
void drawBlockShadow (FWidget*, int, int, int, int);
|
||||
void clearShadow (FWidget*);
|
||||
void drawFlatBorder (FWidget*);
|
||||
void clearFlatBorder (FWidget*);
|
||||
|
||||
|
||||
// FWidget inline functions
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -557,11 +568,7 @@ inline FWidget*& FWidget::getMoveSizeWidget()
|
|||
{ return move_size_widget; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FWidget::Accelerators* FWidget::getAcceleratorList() const
|
||||
{ return accelerator_list; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FWidget::widgetList*& FWidget::getWindowList()
|
||||
inline FWidget::FWidgetList*& FWidget::getWindowList()
|
||||
{ return window_list; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -572,6 +579,10 @@ inline FMenuBar* FWidget::getMenuBar()
|
|||
inline FStatusBar* FWidget::getStatusBar()
|
||||
{ return statusbar; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FWidget::Accelerators* FWidget::getAcceleratorList() const
|
||||
{ return accelerator_list; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FString FWidget::getStatusbarMessage() const
|
||||
{ return statusbar_message; }
|
||||
|
@ -821,6 +832,10 @@ inline void FWidget::setBackgroundColor (FColor color)
|
|||
background_color = color;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FWidget::widget_flags& FWidget::setFlags()
|
||||
{ return flags; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setGeometry (const FRect& box, bool adjust)
|
||||
{
|
||||
|
@ -878,10 +893,6 @@ inline void FWidget::unsetDoubleFlatLine (fc::sides side)
|
|||
inline void FWidget::unsetDoubleFlatLine (fc::sides side, int pos)
|
||||
{ setDoubleFlatLine(side, pos, false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FWidget::widget_flags& FWidget::setFlags()
|
||||
{ return flags; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::isRootWidget() const
|
||||
{ return (! hasParent()); }
|
||||
|
@ -966,15 +977,15 @@ inline uInt FWidget::getModalDialogCounter()
|
|||
{ return modal_dialog_counter; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FWidget::widgetList*& FWidget::getDialogList()
|
||||
inline FWidget::FWidgetList*& FWidget::getDialogList()
|
||||
{ return dialog_list; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FWidget::widgetList*& FWidget::getAlwaysOnTopList()
|
||||
inline FWidget::FWidgetList*& FWidget::getAlwaysOnTopList()
|
||||
{ return always_on_top_list; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FWidget::widgetList*& FWidget::getWidgetCloseList()
|
||||
inline FWidget::FWidgetList*& FWidget::getWidgetCloseList()
|
||||
{ return close_widget; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue