Minor code changes
This commit is contained in:
parent
bc3afa6235
commit
e15f1a344a
2
build.sh
2
build.sh
|
@ -59,7 +59,7 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--fulldebug"|"fulldebug")
|
"--fulldebug"|"fulldebug")
|
||||||
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -fstack-protector -Wstrict-aliasing -Wstrict-aliasing=3 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy -ftree-loop-distribute-patterns -Wmemset-transposed-args"
|
if ! ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -fstack-protector -Wstrict-aliasing -Wstrict-aliasing=3 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy -ftree-loop-distribute-patterns -Wmemset-transposed-args"
|
||||||
then
|
then
|
||||||
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
||||||
exit 255
|
exit 255
|
||||||
|
|
|
@ -26,9 +26,6 @@
|
||||||
#include <final/final.h>
|
#include <final/final.h>
|
||||||
|
|
||||||
|
|
||||||
// Global FVTerm object
|
|
||||||
static finalcut::FVTerm* terminal;
|
|
||||||
|
|
||||||
// Global FApplication object
|
// Global FApplication object
|
||||||
static finalcut::FApplication* app{nullptr};
|
static finalcut::FApplication* app{nullptr};
|
||||||
|
|
||||||
|
@ -145,7 +142,6 @@ int main (int argc, char* argv[])
|
||||||
finalcut::FApplication TermApp(argc, argv);
|
finalcut::FApplication TermApp(argc, argv);
|
||||||
|
|
||||||
// Pointer to the global virtual terminal object
|
// Pointer to the global virtual terminal object
|
||||||
terminal = static_cast<finalcut::FVTerm*>(&TermApp);
|
|
||||||
app = &TermApp;
|
app = &TermApp;
|
||||||
|
|
||||||
// Get screen dimension
|
// Get screen dimension
|
||||||
|
|
|
@ -28,9 +28,6 @@
|
||||||
|
|
||||||
namespace fc = finalcut::fc;
|
namespace fc = finalcut::fc;
|
||||||
|
|
||||||
// Global FVTerm object
|
|
||||||
static finalcut::FVTerm* terminal;
|
|
||||||
|
|
||||||
// Function prototype
|
// Function prototype
|
||||||
void tcapBoolean (const std::string&, bool);
|
void tcapBoolean (const std::string&, bool);
|
||||||
void tcapNumeric (const std::string&, int);
|
void tcapNumeric (const std::string&, int);
|
||||||
|
@ -309,9 +306,6 @@ int main (int argc, char* argv[])
|
||||||
bool disable_alt_screen{true};
|
bool disable_alt_screen{true};
|
||||||
finalcut::FApplication TermApp (argc, argv, disable_alt_screen);
|
finalcut::FApplication TermApp (argc, argv, disable_alt_screen);
|
||||||
|
|
||||||
// Pointer to the global virtual terminal object
|
|
||||||
terminal = static_cast<finalcut::FVTerm*>(&TermApp);
|
|
||||||
|
|
||||||
std::cout << "--------\r\nFTermcap\r\n--------\r\n\n";
|
std::cout << "--------\r\nFTermcap\r\n--------\r\n\n";
|
||||||
std::cout << "Terminal: " << TermApp.getTermType() << "\r\n";
|
std::cout << "Terminal: " << TermApp.getTermType() << "\r\n";
|
||||||
|
|
||||||
|
|
|
@ -586,7 +586,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
for ( std::size_t z{0}
|
for ( std::size_t z{0}
|
||||||
; pos < center_offset + txtlength && z < getWidth() - 2
|
; pos < center_offset + txtlength && z + 2 < getWidth()
|
||||||
; z++, pos++)
|
; z++, pos++)
|
||||||
{
|
{
|
||||||
if ( z == hotkeypos && getFlags().active )
|
if ( z == hotkeypos && getFlags().active )
|
||||||
|
@ -615,7 +615,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( txtlength >= getWidth() - 1 )
|
if ( txtlength + 1 >= getWidth() )
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
print() << FPoint(int(getWidth() + indent) - 2, 1) << "..";
|
print() << FPoint(int(getWidth() + indent) - 2, 1) << "..";
|
||||||
|
|
|
@ -284,7 +284,7 @@ void FLineEdit::setCursorPosition (std::size_t pos)
|
||||||
|
|
||||||
if ( cursor_pos > text.getLength() )
|
if ( cursor_pos > text.getLength() )
|
||||||
keyEnd();
|
keyEnd();
|
||||||
else if ( cursor_pos >= getWidth() - 1 )
|
else if ( cursor_pos + 1 >= getWidth() )
|
||||||
text_offset = text.getLength() - getWidth() + 2;
|
text_offset = text.getLength() - getWidth() + 2;
|
||||||
else
|
else
|
||||||
text_offset = 0;
|
text_offset = 0;
|
||||||
|
@ -534,7 +534,7 @@ void FLineEdit::onTimer (FTimerEvent*)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FLineEdit::scrollRight:
|
case FLineEdit::scrollRight:
|
||||||
if ( len < getWidth() - 2
|
if ( len + 2 < getWidth()
|
||||||
|| text_offset == len - getWidth() + 2 )
|
|| text_offset == len - getWidth() + 2 )
|
||||||
{
|
{
|
||||||
drag_scroll = FLineEdit::noScroll;
|
drag_scroll = FLineEdit::noScroll;
|
||||||
|
@ -744,7 +744,7 @@ void FLineEdit::drawInputField()
|
||||||
|
|
||||||
std::size_t x = show_text.getLength();
|
std::size_t x = show_text.getLength();
|
||||||
|
|
||||||
while ( x < getWidth() - 1 )
|
while ( x + 1 < getWidth() )
|
||||||
{
|
{
|
||||||
print (' ');
|
print (' ');
|
||||||
x++;
|
x++;
|
||||||
|
@ -784,7 +784,7 @@ inline void FLineEdit::keyRight()
|
||||||
if ( cursor_pos < len )
|
if ( cursor_pos < len )
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
|
|
||||||
if ( cursor_pos - text_offset >= getWidth() - 2
|
if ( cursor_pos - text_offset + 2 >= getWidth()
|
||||||
&& text_offset <= len - getWidth() + 1 )
|
&& text_offset <= len - getWidth() + 1 )
|
||||||
text_offset++;
|
text_offset++;
|
||||||
}
|
}
|
||||||
|
@ -802,7 +802,7 @@ inline void FLineEdit::keyEnd()
|
||||||
std::size_t len = text.getLength();
|
std::size_t len = text.getLength();
|
||||||
cursor_pos = len;
|
cursor_pos = len;
|
||||||
|
|
||||||
if ( cursor_pos >= getWidth() - 1 )
|
if ( cursor_pos + 1 >= getWidth() )
|
||||||
text_offset = len - getWidth() + 2;
|
text_offset = len - getWidth() + 2;
|
||||||
else
|
else
|
||||||
text_offset = 0;
|
text_offset = 0;
|
||||||
|
@ -822,7 +822,7 @@ inline void FLineEdit::keyDel()
|
||||||
if ( cursor_pos >= len )
|
if ( cursor_pos >= len )
|
||||||
cursor_pos = len;
|
cursor_pos = len;
|
||||||
|
|
||||||
if ( text_offset > 0 && len - text_offset < getWidth() - 1 )
|
if ( text_offset > 0 && len - text_offset + 1 < getWidth() )
|
||||||
text_offset--;
|
text_offset--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,7 +888,7 @@ inline bool FLineEdit::keyInput (FKey key)
|
||||||
|
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
|
|
||||||
if ( cursor_pos >= getWidth() - 1 )
|
if ( cursor_pos + 1 >= getWidth() )
|
||||||
text_offset++;
|
text_offset++;
|
||||||
|
|
||||||
processChanged();
|
processChanged();
|
||||||
|
|
|
@ -259,7 +259,7 @@ void FListBox::remove (std::size_t item)
|
||||||
if ( hbar->isShown() && isHorizontallyScrollable() )
|
if ( hbar->isShown() && isHorizontallyScrollable() )
|
||||||
hbar->hide();
|
hbar->hide();
|
||||||
|
|
||||||
int vmax = ( element_count > getHeight() - 2 )
|
int vmax = ( element_count + 2 > getHeight() )
|
||||||
? int(element_count - getHeight()) + 2
|
? int(element_count - getHeight()) + 2
|
||||||
: 0;
|
: 0;
|
||||||
vbar->setMaximum (vmax);
|
vbar->setMaximum (vmax);
|
||||||
|
@ -721,7 +721,7 @@ void FListBox::adjustSize()
|
||||||
vbar->setHeight (height, false);
|
vbar->setHeight (height, false);
|
||||||
vbar->resize();
|
vbar->resize();
|
||||||
|
|
||||||
int hmax = ( max_line_width > width - 2 )
|
int hmax = ( max_line_width + 2 > width )
|
||||||
? int(max_line_width - width + 2)
|
? int(max_line_width - width + 2)
|
||||||
: 0;
|
: 0;
|
||||||
hbar->setMaximum (hmax);
|
hbar->setMaximum (hmax);
|
||||||
|
@ -956,7 +956,7 @@ inline void FListBox::drawListLine ( int y
|
||||||
std::size_t inc_len = inc_search.getLength();
|
std::size_t inc_len = inc_search.getLength();
|
||||||
const FWidgetColors& wc = getFWidgetColors();
|
const FWidgetColors& wc = getFWidgetColors();
|
||||||
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||||
FString element (getString(iter).mid ( std::size_t(1 + xoffset)
|
FString element (getString(iter).mid ( std::size_t(xoffset) + 1
|
||||||
, getWidth() - nf_offset - 4 ));
|
, getWidth() - nf_offset - 4 ));
|
||||||
const wchar_t* const& element_str = element.wc_str();
|
const wchar_t* const& element_str = element.wc_str();
|
||||||
std::size_t len = element.getLength();
|
std::size_t len = element.getLength();
|
||||||
|
@ -1215,7 +1215,7 @@ void FListBox::recalculateHorizontalBar (std::size_t len, bool has_brackets)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::recalculateVerticalBar (std::size_t element_count)
|
void FListBox::recalculateVerticalBar (std::size_t element_count)
|
||||||
{
|
{
|
||||||
int vmax = ( element_count > getHeight() - 2 )
|
int vmax = ( element_count + 2 > getHeight() )
|
||||||
? int(element_count - getHeight() + 2)
|
? int(element_count - getHeight() + 2)
|
||||||
: 0;
|
: 0;
|
||||||
vbar->setMaximum (vmax);
|
vbar->setMaximum (vmax);
|
||||||
|
@ -1314,7 +1314,7 @@ void FListBox::wheelUp (int pagesize)
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
{
|
{
|
||||||
current -= std::size_t(pagesize + yoffset);
|
current -= std::size_t(pagesize) + std::size_t(yoffset);
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1515,7 +1515,7 @@ void FListBox::scrollToY (int val)
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
|
|
||||||
current = std::size_t(yoffset + c);
|
current = std::size_t(yoffset) + std::size_t(c);
|
||||||
|
|
||||||
if ( current < std::size_t(yoffset) )
|
if ( current < std::size_t(yoffset) )
|
||||||
current = std::size_t(yoffset);
|
current = std::size_t(yoffset);
|
||||||
|
@ -1700,7 +1700,7 @@ inline bool FListBox::keyInsert()
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
|
||||||
if ( current - std::size_t(yoffset) >= getHeight() - 1 )
|
if ( current - std::size_t(yoffset) + 1 >= getHeight() )
|
||||||
yoffset++;
|
yoffset++;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1871,8 +1871,7 @@ void FListBox::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
if ( isShown() )
|
if ( isShown() )
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward )
|
||||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
|
||||||
{
|
{
|
||||||
vbar->setValue (yoffset);
|
vbar->setValue (yoffset);
|
||||||
|
|
||||||
|
@ -1936,8 +1935,7 @@ void FListBox::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward )
|
||||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
|
||||||
{
|
{
|
||||||
hbar->setValue (xoffset);
|
hbar->setValue (xoffset);
|
||||||
|
|
||||||
|
|
|
@ -715,7 +715,7 @@ void FListView::setColumnSortType (int column, fc::sorting_type type)
|
||||||
if ( column < 1 || header.empty() || column > int(header.size()) )
|
if ( column < 1 || header.empty() || column > int(header.size()) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::size_t size = std::size_t(column + 1);
|
std::size_t size = std::size_t(column) + 1;
|
||||||
|
|
||||||
if ( sort_type.empty() || sort_type.size() < size )
|
if ( sort_type.empty() || sort_type.size() < size )
|
||||||
sort_type.resize(size);
|
sort_type.resize(size);
|
||||||
|
@ -2010,7 +2010,7 @@ void FListView::recalculateHorizontalBar (std::size_t len)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::recalculateVerticalBar (std::size_t element_count)
|
void FListView::recalculateVerticalBar (std::size_t element_count)
|
||||||
{
|
{
|
||||||
int vmax = ( element_count > getHeight() - 2 )
|
int vmax = ( element_count + 2 > getHeight() )
|
||||||
? int(element_count - getHeight() + 2)
|
? int(element_count - getHeight() + 2)
|
||||||
: 0;
|
: 0;
|
||||||
vbar->setMaximum (vmax);
|
vbar->setMaximum (vmax);
|
||||||
|
@ -2679,8 +2679,7 @@ void FListView::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward )
|
||||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
|
||||||
{
|
{
|
||||||
hbar->setValue (xoffset);
|
hbar->setValue (xoffset);
|
||||||
|
|
||||||
|
|
|
@ -597,8 +597,6 @@ void FMenuItem::updateSuperMenuDimensions()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto menu_ptr = static_cast<FMenu*>(super_menu);
|
auto menu_ptr = static_cast<FMenu*>(super_menu);
|
||||||
|
|
||||||
if ( menu_ptr )
|
|
||||||
menu_ptr->calculateDimensions();
|
menu_ptr->calculateDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -426,7 +426,7 @@ void FMessageBox::adjustButtons()
|
||||||
btn_width += button[n]->getWidth() + gap;
|
btn_width += button[n]->getWidth() + gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( btn_width >= getWidth() - 4 )
|
if ( btn_width + 4 >= getWidth() )
|
||||||
{
|
{
|
||||||
std::size_t max_width;
|
std::size_t max_width;
|
||||||
auto root_widget = getRootWidget();
|
auto root_widget = getRootWidget();
|
||||||
|
|
|
@ -346,8 +346,8 @@ FRect operator - (const FRect& r, const FSize& s)
|
||||||
{
|
{
|
||||||
return FRect ( r.X1
|
return FRect ( r.X1
|
||||||
, r.Y1
|
, r.Y1
|
||||||
, std::size_t(r.X2 - r.X1 + 1) - s.getWidth()
|
, std::size_t(r.X2 - r.X1) + 1 - s.getWidth()
|
||||||
, std::size_t(r.Y2 - r.Y1 + 1) - s.getHeight() );
|
, std::size_t(r.Y2 - r.Y1) + 1 - s.getHeight() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -917,8 +917,7 @@ void FScrollView::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
int distance{1};
|
int distance{1};
|
||||||
int wheel_distance{4};
|
int wheel_distance{4};
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward )
|
||||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
|
||||||
{
|
{
|
||||||
update_scrollbar = true;
|
update_scrollbar = true;
|
||||||
}
|
}
|
||||||
|
@ -969,8 +968,7 @@ void FScrollView::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
int distance{1};
|
int distance{1};
|
||||||
int wheel_distance{4};
|
int wheel_distance{4};
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward )
|
||||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
|
||||||
{
|
{
|
||||||
update_scrollbar = true;
|
update_scrollbar = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -707,7 +707,7 @@ void FTextView::drawText()
|
||||||
{
|
{
|
||||||
std::size_t i{};
|
std::size_t i{};
|
||||||
std::size_t n = y + std::size_t(yoffset);
|
std::size_t n = y + std::size_t(yoffset);
|
||||||
std::size_t x = std::size_t(1 + xoffset);
|
std::size_t x = std::size_t(xoffset) + 1;
|
||||||
FString line(data[n].mid (x, getTextWidth()));
|
FString line(data[n].mid (x, getTextWidth()));
|
||||||
const auto line_str = line.wc_str();
|
const auto line_str = line.wc_str();
|
||||||
const auto len = line.getLength();
|
const auto len = line.getLength();
|
||||||
|
@ -750,15 +750,10 @@ void FTextView::cb_VBarChange (FWidget*, FDataPtr)
|
||||||
int distance{1};
|
int distance{1};
|
||||||
int wheel_distance{4};
|
int wheel_distance{4};
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward )
|
||||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
|
||||||
{
|
|
||||||
update_scrollbar = true;
|
update_scrollbar = true;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
update_scrollbar = false;
|
update_scrollbar = false;
|
||||||
}
|
|
||||||
|
|
||||||
switch ( scrollType )
|
switch ( scrollType )
|
||||||
{
|
{
|
||||||
|
@ -806,15 +801,10 @@ void FTextView::cb_HBarChange (FWidget*, FDataPtr)
|
||||||
int distance{1};
|
int distance{1};
|
||||||
int wheel_distance{4};
|
int wheel_distance{4};
|
||||||
|
|
||||||
if ( scrollType >= FScrollbar::scrollStepBackward
|
if ( scrollType >= FScrollbar::scrollStepBackward )
|
||||||
&& scrollType <= FScrollbar::scrollWheelDown )
|
|
||||||
{
|
|
||||||
update_scrollbar = true;
|
update_scrollbar = true;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
update_scrollbar = false;
|
update_scrollbar = false;
|
||||||
}
|
|
||||||
|
|
||||||
switch ( scrollType )
|
switch ( scrollType )
|
||||||
{
|
{
|
||||||
|
|
|
@ -687,15 +687,17 @@ void FVTerm::resizeArea ( const FRect& box
|
||||||
}
|
}
|
||||||
|
|
||||||
bool realloc_success{false};
|
bool realloc_success{false};
|
||||||
std::size_t area_size = std::size_t((width + rsw) * (height + bsh));
|
std::size_t full_width = std::size_t(width) + std::size_t(rsw);
|
||||||
|
std::size_t full_height = std::size_t(height) + std::size_t(bsh);
|
||||||
|
std::size_t area_size = full_width * full_height;
|
||||||
|
|
||||||
if ( area->height + area->bottom_shadow != height + bsh )
|
if ( area->height + area->bottom_shadow != int(full_height) )
|
||||||
{
|
{
|
||||||
realloc_success = reallocateTextArea ( area
|
realloc_success = reallocateTextArea ( area
|
||||||
, std::size_t(height + bsh)
|
, full_height
|
||||||
, area_size );
|
, area_size );
|
||||||
}
|
}
|
||||||
else if ( area->width + area->right_shadow != width + rsw )
|
else if ( area->width + area->right_shadow != int(full_width) )
|
||||||
{
|
{
|
||||||
realloc_success = reallocateTextArea (area, area_size);
|
realloc_success = reallocateTextArea (area, area_size);
|
||||||
}
|
}
|
||||||
|
@ -713,7 +715,7 @@ void FVTerm::resizeArea ( const FRect& box
|
||||||
area->bottom_shadow = bsh;
|
area->bottom_shadow = bsh;
|
||||||
area->has_changes = false;
|
area->has_changes = false;
|
||||||
|
|
||||||
FSize size(std::size_t(width + rsw), std::size_t(height + bsh));
|
FSize size(full_width, full_height);
|
||||||
setTextToDefault (area, size);
|
setTextToDefault (area, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,9 +829,6 @@ void FVTerm::restoreVTerm (const FRect& box)
|
||||||
if ( y < 0 )
|
if ( y < 0 )
|
||||||
y = 0;
|
y = 0;
|
||||||
|
|
||||||
if ( w < 0 || h < 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( x + w > vterm->width )
|
if ( x + w > vterm->width )
|
||||||
w = vterm->width - x;
|
w = vterm->width - x;
|
||||||
|
|
||||||
|
@ -892,8 +891,8 @@ FVTerm::covered_state FVTerm::isCovered ( const FPoint& pos
|
||||||
int win_y = win->offset_top;
|
int win_y = win->offset_top;
|
||||||
FRect geometry ( win_x
|
FRect geometry ( win_x
|
||||||
, win_y
|
, win_y
|
||||||
, std::size_t(win->width + win->right_shadow)
|
, std::size_t(win->width) + std::size_t(win->right_shadow)
|
||||||
, std::size_t(win->height + win->bottom_shadow) );
|
, std::size_t(win->height) + std::size_t(win->bottom_shadow) );
|
||||||
|
|
||||||
if ( found && geometry.contains(pos) )
|
if ( found && geometry.contains(pos) )
|
||||||
{
|
{
|
||||||
|
@ -1677,8 +1676,8 @@ charData FVTerm::generateCharacter (const FPoint& pos)
|
||||||
int win_y = win->offset_top;
|
int win_y = win->offset_top;
|
||||||
FRect geometry ( win_x
|
FRect geometry ( win_x
|
||||||
, win_y
|
, win_y
|
||||||
, std::size_t(win->width + win->right_shadow)
|
, std::size_t(win->width) + std::size_t(win->right_shadow)
|
||||||
, std::size_t(win->height + win->bottom_shadow) );
|
, std::size_t(win->height) + std::size_t(win->bottom_shadow) );
|
||||||
|
|
||||||
// Window is visible and contains current character
|
// Window is visible and contains current character
|
||||||
if ( geometry.contains(x, y) )
|
if ( geometry.contains(x, y) )
|
||||||
|
@ -1778,8 +1777,8 @@ charData FVTerm::getCharacter ( character_type char_type
|
||||||
|
|
||||||
FRect geometry ( win->offset_left
|
FRect geometry ( win->offset_left
|
||||||
, win->offset_top
|
, win->offset_top
|
||||||
, std::size_t(win->width + win->right_shadow)
|
, std::size_t(win->width) + std::size_t(win->right_shadow)
|
||||||
, std::size_t(win->height + win->bottom_shadow) );
|
, std::size_t(win->height) + std::size_t(win->bottom_shadow) );
|
||||||
|
|
||||||
// Window visible and contains current character
|
// Window visible and contains current character
|
||||||
if ( geometry.contains(x, y) )
|
if ( geometry.contains(x, y) )
|
||||||
|
|
105
src/fwidget.cpp
105
src/fwidget.cpp
|
@ -47,7 +47,7 @@ FWidget::widgetList* FWidget::window_list{nullptr};
|
||||||
FWidget::widgetList* FWidget::dialog_list{nullptr};
|
FWidget::widgetList* FWidget::dialog_list{nullptr};
|
||||||
FWidget::widgetList* FWidget::always_on_top_list{nullptr};
|
FWidget::widgetList* FWidget::always_on_top_list{nullptr};
|
||||||
FWidget::widgetList* FWidget::close_widget{nullptr};
|
FWidget::widgetList* FWidget::close_widget{nullptr};
|
||||||
FWidgetColors FWidget::wc{};
|
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{};
|
||||||
|
@ -86,7 +86,7 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flags.visible_cursor = ! hideable;
|
flags.visible_cursor = ! hideable;
|
||||||
offset = parent->client_offset;
|
woffset = parent->wclient_offset;
|
||||||
double_flatline_mask.top.resize (getWidth(), false);
|
double_flatline_mask.top.resize (getWidth(), false);
|
||||||
double_flatline_mask.right.resize (getHeight(), false);
|
double_flatline_mask.right.resize (getHeight(), false);
|
||||||
double_flatline_mask.bottom.resize (getWidth(), false);
|
double_flatline_mask.bottom.resize (getWidth(), false);
|
||||||
|
@ -109,6 +109,7 @@ FWidget::~FWidget() // destructor
|
||||||
if ( flags.focus )
|
if ( flags.focus )
|
||||||
{
|
{
|
||||||
if ( auto window = FWindow::getWindowWidget(this) )
|
if ( auto window = FWindow::getWindowWidget(this) )
|
||||||
|
if ( window != this )
|
||||||
window->setWindowFocusWidget(nullptr);
|
window->setWindowFocusWidget(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,8 +218,8 @@ FWidget* FWidget::getLastFocusableWidget (FObjectList list)
|
||||||
FPoint FWidget::getPrintPos()
|
FPoint FWidget::getPrintPos()
|
||||||
{
|
{
|
||||||
const auto cur = getPrintCursor();
|
const auto cur = getPrintCursor();
|
||||||
return FPoint ( cur.getX() - offset.getX1() - getX() + 1
|
return FPoint ( cur.getX() - woffset.getX1() - getX() + 1
|
||||||
, cur.getY() - offset.getY1() - getY() + 1 );
|
, cur.getY() - woffset.getY1() - getY() + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -466,7 +467,7 @@ void FWidget::setTopPadding (int top, bool adjust)
|
||||||
if ( isRootWidget() )
|
if ( isRootWidget() )
|
||||||
{
|
{
|
||||||
auto r = rootObject;
|
auto r = rootObject;
|
||||||
r->client_offset.setY1 (r->padding.top);
|
r->wclient_offset.setY1 (r->padding.top);
|
||||||
adjustSizeGlobal();
|
adjustSizeGlobal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -487,7 +488,7 @@ void FWidget::setLeftPadding (int left, bool adjust)
|
||||||
if ( isRootWidget() )
|
if ( isRootWidget() )
|
||||||
{
|
{
|
||||||
auto r = rootObject;
|
auto r = rootObject;
|
||||||
r->client_offset.setX1 (r->padding.left);
|
r->wclient_offset.setX1 (r->padding.left);
|
||||||
adjustSizeGlobal();
|
adjustSizeGlobal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -508,7 +509,7 @@ void FWidget::setBottomPadding (int bottom, bool adjust)
|
||||||
if ( isRootWidget() )
|
if ( isRootWidget() )
|
||||||
{
|
{
|
||||||
auto r = rootObject;
|
auto r = rootObject;
|
||||||
r->client_offset.setY2 (int(r->getHeight()) - 1 - r->padding.bottom);
|
r->wclient_offset.setY2 (int(r->getHeight()) - 1 - r->padding.bottom);
|
||||||
adjustSizeGlobal();
|
adjustSizeGlobal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -529,7 +530,7 @@ void FWidget::setRightPadding (int right, bool adjust)
|
||||||
if ( isRootWidget() )
|
if ( isRootWidget() )
|
||||||
{
|
{
|
||||||
auto r = rootObject;
|
auto r = rootObject;
|
||||||
r->client_offset.setX2 (int(r->getWidth()) - 1 - r->padding.right);
|
r->wclient_offset.setX2 (int(r->getWidth()) - 1 - r->padding.right);
|
||||||
adjustSizeGlobal();
|
adjustSizeGlobal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -543,7 +544,7 @@ void FWidget::setParentOffset()
|
||||||
auto p = getParentWidget();
|
auto p = getParentWidget();
|
||||||
|
|
||||||
if ( p )
|
if ( p )
|
||||||
offset = p->client_offset;
|
woffset = p->wclient_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -552,14 +553,14 @@ void FWidget::setTermOffset()
|
||||||
auto r = getRootWidget();
|
auto r = getRootWidget();
|
||||||
int w = int(r->getWidth());
|
int w = int(r->getWidth());
|
||||||
int h = int(r->getHeight());
|
int h = int(r->getHeight());
|
||||||
offset.setCoordinates (0, 0, w - 1, h - 1);
|
woffset.setCoordinates (0, 0, w - 1, h - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::setTermOffsetWithPadding()
|
void FWidget::setTermOffsetWithPadding()
|
||||||
{
|
{
|
||||||
auto r = getRootWidget();
|
auto r = getRootWidget();
|
||||||
offset.setCoordinates ( r->getLeftPadding()
|
woffset.setCoordinates ( r->getLeftPadding()
|
||||||
, r->getTopPadding()
|
, r->getTopPadding()
|
||||||
, int(r->getWidth()) - 1 - r->getRightPadding()
|
, int(r->getWidth()) - 1 - r->getRightPadding()
|
||||||
, int(r->getHeight()) - 1 - r->getBottomPadding() );
|
, int(r->getHeight()) - 1 - r->getBottomPadding() );
|
||||||
|
@ -614,7 +615,7 @@ void FWidget::setGeometry (const FPoint& p, const FSize& s, bool adjust)
|
||||||
int term_x = getTermX();
|
int term_x = getTermX();
|
||||||
int term_y = getTermY();
|
int term_y = getTermY();
|
||||||
|
|
||||||
client_offset.setCoordinates ( term_x - 1 + padding.left
|
wclient_offset.setCoordinates ( term_x - 1 + padding.left
|
||||||
, term_y - 1 + padding.top
|
, term_y - 1 + padding.top
|
||||||
, term_x - 2 + int(getWidth()) - padding.right
|
, term_x - 2 + int(getWidth()) - padding.right
|
||||||
, term_y - 2 + int(getHeight()) - padding.bottom );
|
, term_y - 2 + int(getHeight()) - padding.bottom );
|
||||||
|
@ -645,17 +646,17 @@ bool FWidget::setCursorPos (const FPoint& pos)
|
||||||
|
|
||||||
if ( area->widget )
|
if ( area->widget )
|
||||||
{
|
{
|
||||||
int widget_offsetX = getTermX() - area->widget->getTermX();
|
int woffsetX = getTermX() - area->widget->getTermX();
|
||||||
int widget_offsetY = getTermY() - area->widget->getTermY();
|
int woffsetY = getTermY() - area->widget->getTermY();
|
||||||
|
|
||||||
if ( isChildPrintArea() )
|
if ( isChildPrintArea() )
|
||||||
{
|
{
|
||||||
widget_offsetX += (1 - area->widget->getLeftPadding());
|
woffsetX += (1 - area->widget->getLeftPadding());
|
||||||
widget_offsetY += (1 - area->widget->getTopPadding());
|
woffsetY += (1 - area->widget->getTopPadding());
|
||||||
}
|
}
|
||||||
|
|
||||||
setAreaCursor ( FPoint ( widget_offsetX + pos.getX()
|
setAreaCursor ( FPoint ( woffsetX + pos.getX()
|
||||||
, widget_offsetY + pos.getY() )
|
, woffsetY + pos.getY() )
|
||||||
, flags.visible_cursor
|
, flags.visible_cursor
|
||||||
, area );
|
, area );
|
||||||
return true;
|
return true;
|
||||||
|
@ -667,8 +668,8 @@ bool FWidget::setCursorPos (const FPoint& pos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::setPrintPos (const FPoint& pos)
|
void FWidget::setPrintPos (const FPoint& pos)
|
||||||
{
|
{
|
||||||
FPoint p{ offset.getX1() + getX() + pos.getX() - 1,
|
FPoint p{ woffset.getX1() + getX() + pos.getX() - 1,
|
||||||
offset.getY1() + getY() + pos.getY() - 1 };
|
woffset.getY1() + getY() + pos.getY() - 1 };
|
||||||
setPrintCursor(p);
|
setPrintCursor(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,7 +1000,7 @@ void FWidget::redraw()
|
||||||
{
|
{
|
||||||
startTerminalUpdate();
|
startTerminalUpdate();
|
||||||
// clean desktop
|
// clean desktop
|
||||||
setColor (wc.term_fg, wc.term_bg);
|
setColor (wcolors.term_fg, wcolors.term_bg);
|
||||||
clearArea (getVirtualDesktop());
|
clearArea (getVirtualDesktop());
|
||||||
}
|
}
|
||||||
else if ( ! isShown() )
|
else if ( ! isShown() )
|
||||||
|
@ -1219,8 +1220,8 @@ void FWidget::detectTermSize()
|
||||||
auto r = rootObject;
|
auto r = rootObject;
|
||||||
FTerm::detectTermSize();
|
FTerm::detectTermSize();
|
||||||
r->adjust_wsize.setRect (1, 1, getDesktopWidth(), getDesktopHeight());
|
r->adjust_wsize.setRect (1, 1, getDesktopWidth(), getDesktopHeight());
|
||||||
r->offset.setRect (0, 0, getDesktopWidth(), getDesktopHeight());
|
r->woffset.setRect (0, 0, getDesktopWidth(), getDesktopHeight());
|
||||||
r->client_offset.setCoordinates
|
r->wclient_offset.setCoordinates
|
||||||
(
|
(
|
||||||
r->padding.left,
|
r->padding.left,
|
||||||
r->padding.top,
|
r->padding.top,
|
||||||
|
@ -1277,13 +1278,13 @@ void FWidget::clearShadow()
|
||||||
|
|
||||||
if ( isWindowWidget() )
|
if ( isWindowWidget() )
|
||||||
{
|
{
|
||||||
setColor (wc.shadow_fg, wc.shadow_bg);
|
setColor (wcolors.shadow_fg, wcolors.shadow_bg);
|
||||||
setInheritBackground(); // current background color will be ignored
|
setInheritBackground(); // current background color will be ignored
|
||||||
}
|
}
|
||||||
else if ( auto p = getParentWidget() )
|
else if ( auto p = getParentWidget() )
|
||||||
setColor (wc.shadow_fg, p->getBackgroundColor());
|
setColor (wcolors.shadow_fg, p->getBackgroundColor());
|
||||||
|
|
||||||
if ( w <= offset.getX2() )
|
if ( w <= woffset.getX2() )
|
||||||
{
|
{
|
||||||
for (std::size_t y{1}; y <= getHeight(); y++)
|
for (std::size_t y{1}; y <= getHeight(); y++)
|
||||||
{
|
{
|
||||||
|
@ -1291,7 +1292,7 @@ void FWidget::clearShadow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( h <= offset.getY2() )
|
if ( h <= woffset.getY2() )
|
||||||
{
|
{
|
||||||
print() << FPoint(2, h + 1);
|
print() << FPoint(2, h + 1);
|
||||||
|
|
||||||
|
@ -1315,9 +1316,9 @@ void FWidget::drawFlatBorder()
|
||||||
, y2 = int(getHeight()) + 1;
|
, y2 = int(getHeight()) + 1;
|
||||||
|
|
||||||
if ( auto p = getParentWidget() )
|
if ( auto p = getParentWidget() )
|
||||||
setColor (wc.dialog_fg, p->getBackgroundColor());
|
setColor (wcolors.dialog_fg, p->getBackgroundColor());
|
||||||
else
|
else
|
||||||
setColor (wc.dialog_fg, wc.dialog_bg);
|
setColor (wcolors.dialog_fg, wcolors.dialog_bg);
|
||||||
|
|
||||||
for (std::size_t y{0}; y < getHeight(); y++)
|
for (std::size_t y{0}; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
|
@ -1382,9 +1383,9 @@ void FWidget::clearFlatBorder()
|
||||||
, y2 = int(getHeight()) + 1;
|
, y2 = int(getHeight()) + 1;
|
||||||
|
|
||||||
if ( auto p = getParentWidget() )
|
if ( auto p = getParentWidget() )
|
||||||
setColor (wc.dialog_fg, p->getBackgroundColor());
|
setColor (wcolors.dialog_fg, p->getBackgroundColor());
|
||||||
else
|
else
|
||||||
setColor (wc.dialog_fg, wc.dialog_bg);
|
setColor (wcolors.dialog_fg, wcolors.dialog_bg);
|
||||||
|
|
||||||
// clear on left side
|
// clear on left side
|
||||||
for (std::size_t y{0}; y < getHeight(); y++)
|
for (std::size_t y{0}; y < getHeight(); y++)
|
||||||
|
@ -1542,17 +1543,17 @@ void FWidget::adjustSize()
|
||||||
if ( ignore_padding && ! isDialogWidget() )
|
if ( ignore_padding && ! isDialogWidget() )
|
||||||
setTermOffset();
|
setTermOffset();
|
||||||
else
|
else
|
||||||
offset = rootObject->client_offset;
|
woffset = rootObject->wclient_offset;
|
||||||
}
|
}
|
||||||
else if ( ignore_padding && p )
|
else if ( ignore_padding && p )
|
||||||
{
|
{
|
||||||
offset.setCoordinates ( p->getTermX() - 1
|
woffset.setCoordinates ( p->getTermX() - 1
|
||||||
, p->getTermY() - 1
|
, p->getTermY() - 1
|
||||||
, p->getTermX() + int(p->getWidth()) - 2
|
, p->getTermX() + int(p->getWidth()) - 2
|
||||||
, p->getTermY() + int(p->getHeight()) - 2 );
|
, p->getTermY() + int(p->getHeight()) - 2 );
|
||||||
}
|
}
|
||||||
else if ( p )
|
else if ( p )
|
||||||
offset = p->client_offset;
|
woffset = p->wclient_offset;
|
||||||
|
|
||||||
adjust_wsize = wsize;
|
adjust_wsize = wsize;
|
||||||
}
|
}
|
||||||
|
@ -1561,7 +1562,7 @@ void FWidget::adjustSize()
|
||||||
if ( ! hasChildPrintArea() )
|
if ( ! hasChildPrintArea() )
|
||||||
insufficientSpaceAdjust();
|
insufficientSpaceAdjust();
|
||||||
|
|
||||||
client_offset.setCoordinates
|
wclient_offset.setCoordinates
|
||||||
(
|
(
|
||||||
getTermX() - 1 + padding.left,
|
getTermX() - 1 + padding.left,
|
||||||
getTermY() - 1 + padding.top,
|
getTermY() - 1 + padding.top,
|
||||||
|
@ -1620,8 +1621,8 @@ void FWidget::hideArea (const FSize& size)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fg = wc.dialog_fg;
|
fg = wcolors.dialog_fg;
|
||||||
bg = wc.dialog_bg;
|
bg = wcolors.dialog_bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
|
@ -1965,8 +1966,8 @@ void FWidget::init()
|
||||||
detectTermSize();
|
detectTermSize();
|
||||||
wsize.setRect(1, 1, getDesktopWidth(), getDesktopHeight());
|
wsize.setRect(1, 1, getDesktopWidth(), getDesktopHeight());
|
||||||
adjust_wsize = wsize;
|
adjust_wsize = wsize;
|
||||||
offset.setRect(0, 0, getDesktopWidth(), getDesktopHeight());
|
woffset.setRect(0, 0, getDesktopWidth(), getDesktopHeight());
|
||||||
client_offset = offset;
|
wclient_offset = woffset;
|
||||||
|
|
||||||
double_flatline_mask.top.resize (getWidth(), false);
|
double_flatline_mask.top.resize (getWidth(), false);
|
||||||
double_flatline_mask.right.resize (getHeight(), false);
|
double_flatline_mask.right.resize (getHeight(), false);
|
||||||
|
@ -1977,8 +1978,8 @@ void FWidget::init()
|
||||||
setColorTheme();
|
setColorTheme();
|
||||||
|
|
||||||
// Default foreground and background color of the desktop/terminal
|
// Default foreground and background color of the desktop/terminal
|
||||||
foreground_color = wc.term_fg;
|
foreground_color = wcolors.term_fg;
|
||||||
background_color = wc.term_bg;
|
background_color = wcolors.term_bg;
|
||||||
init_desktop = false;
|
init_desktop = false;
|
||||||
|
|
||||||
// Create the root object accelerator list
|
// Create the root object accelerator list
|
||||||
|
@ -2022,7 +2023,7 @@ inline void FWidget::insufficientSpaceAdjust()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// move left if not enough space
|
// move left if not enough space
|
||||||
while ( getTermX() + int(getWidth()) - padding.right > offset.getX2() + 2 )
|
while ( getTermX() + int(getWidth()) - padding.right > woffset.getX2() + 2 )
|
||||||
{
|
{
|
||||||
adjust_wsize.x1_ref()--;
|
adjust_wsize.x1_ref()--;
|
||||||
adjust_wsize.x2_ref()--;
|
adjust_wsize.x2_ref()--;
|
||||||
|
@ -2032,7 +2033,7 @@ inline void FWidget::insufficientSpaceAdjust()
|
||||||
}
|
}
|
||||||
|
|
||||||
// move up if not enough space
|
// move up if not enough space
|
||||||
while ( getTermY() + int(getHeight()) - padding.bottom > offset.getY2() + 2 )
|
while ( getTermY() + int(getHeight()) - padding.bottom > woffset.getY2() + 2 )
|
||||||
{
|
{
|
||||||
adjust_wsize.y1_ref()--;
|
adjust_wsize.y1_ref()--;
|
||||||
adjust_wsize.y2_ref()--;
|
adjust_wsize.y2_ref()--;
|
||||||
|
@ -2042,7 +2043,7 @@ inline void FWidget::insufficientSpaceAdjust()
|
||||||
}
|
}
|
||||||
|
|
||||||
// reduce the width if not enough space
|
// reduce the width if not enough space
|
||||||
while ( offset.getX1() + int(getWidth()) - 1 > offset.getX2() )
|
while ( woffset.getX1() + int(getWidth()) - 1 > woffset.getX2() )
|
||||||
adjust_wsize.x2_ref()--;
|
adjust_wsize.x2_ref()--;
|
||||||
|
|
||||||
if ( getWidth() < size_hints.min_width )
|
if ( getWidth() < size_hints.min_width )
|
||||||
|
@ -2052,7 +2053,7 @@ inline void FWidget::insufficientSpaceAdjust()
|
||||||
adjust_wsize.setWidth(1);
|
adjust_wsize.setWidth(1);
|
||||||
|
|
||||||
// reduce the height if not enough space
|
// reduce the height if not enough space
|
||||||
while ( offset.getY1() + int(getHeight()) - 1 > offset.getY2() )
|
while ( woffset.getY1() + int(getHeight()) - 1 > woffset.getY2() )
|
||||||
adjust_wsize.y2_ref()--;
|
adjust_wsize.y2_ref()--;
|
||||||
|
|
||||||
if ( getHeight() < size_hints.min_height )
|
if ( getHeight() < size_hints.min_height )
|
||||||
|
@ -2228,7 +2229,7 @@ void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
|
||||||
print() << FPoint(x2 + 1, y1) << " ";
|
print() << FPoint(x2 + 1, y1) << " ";
|
||||||
unsetTransparent();
|
unsetTransparent();
|
||||||
|
|
||||||
setColor (wc.shadow_bg, wc.shadow_fg);
|
setColor (wcolors.shadow_bg, wcolors.shadow_fg);
|
||||||
setTransShadow();
|
setTransShadow();
|
||||||
|
|
||||||
for (std::size_t y{1}; y < getHeight(); y++)
|
for (std::size_t y{1}; y < getHeight(); y++)
|
||||||
|
@ -2241,7 +2242,7 @@ void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
|
||||||
print() << FPoint(x1, y2 + 1) << " ";
|
print() << FPoint(x1, y2 + 1) << " ";
|
||||||
unsetTransparent();
|
unsetTransparent();
|
||||||
|
|
||||||
setColor (wc.shadow_bg, wc.shadow_fg);
|
setColor (wcolors.shadow_bg, wcolors.shadow_fg);
|
||||||
setTransShadow();
|
setTransShadow();
|
||||||
|
|
||||||
for (std::size_t x{2}; x <= getWidth() + 1; x++)
|
for (std::size_t x{2}; x <= getWidth() + 1; x++)
|
||||||
|
@ -2266,11 +2267,11 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
||||||
|
|
||||||
if ( isWindowWidget() )
|
if ( isWindowWidget() )
|
||||||
{
|
{
|
||||||
setColor (wc.shadow_fg, wc.shadow_bg);
|
setColor (wcolors.shadow_fg, wcolors.shadow_bg);
|
||||||
setInheritBackground(); // current background color will be ignored
|
setInheritBackground(); // current background color will be ignored
|
||||||
}
|
}
|
||||||
else if ( auto p = getParentWidget() )
|
else if ( auto p = getParentWidget() )
|
||||||
setColor (wc.shadow_fg, p->getBackgroundColor());
|
setColor (wcolors.shadow_fg, p->getBackgroundColor());
|
||||||
|
|
||||||
block = fc::FullBlock; // █
|
block = fc::FullBlock; // █
|
||||||
print (fc::LowerHalfBlock); // ▄
|
print (fc::LowerHalfBlock); // ▄
|
||||||
|
@ -2301,9 +2302,9 @@ void FWidget::setColorTheme()
|
||||||
// Sets the default color theme
|
// Sets the default color theme
|
||||||
|
|
||||||
if ( getMaxColor() < 16 ) // for 8 color mode
|
if ( getMaxColor() < 16 ) // for 8 color mode
|
||||||
wc.set8ColorTheme();
|
wcolors.set8ColorTheme();
|
||||||
else
|
else
|
||||||
wc.set16ColorTheme();
|
wcolors.set16ColorTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2371,7 +2372,7 @@ std::size_t getHotkeyPos (wchar_t src[], wchar_t dest[], std::size_t length)
|
||||||
|
|
||||||
for (std::size_t i{0}; i < length; i++)
|
for (std::size_t i{0}; i < length; i++)
|
||||||
{
|
{
|
||||||
if ( i < length && txt[i] == L'&' && hotkeypos == NOT_SET )
|
if ( txt[i] == L'&' && hotkeypos == NOT_SET )
|
||||||
{
|
{
|
||||||
hotkeypos = i;
|
hotkeypos = i;
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -533,7 +533,7 @@ void FListBox::insert ( const ItemT& item
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListBox::isHorizontallyScrollable()
|
inline bool FListBox::isHorizontallyScrollable()
|
||||||
{ return bool( max_line_width >= getClientWidth() - 1 ); }
|
{ return bool( max_line_width + 1 >= getClientWidth() ); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListBox::isVerticallyScrollable()
|
inline bool FListBox::isVerticallyScrollable()
|
||||||
|
|
|
@ -138,7 +138,8 @@ typedef struct
|
||||||
// Attribute byte #2
|
// Attribute byte #2
|
||||||
uInt8 no_changes : 1; // no changes required
|
uInt8 no_changes : 1; // no changes required
|
||||||
uInt8 printed : 1; // is printed to VTerm
|
uInt8 printed : 1; // is printed to VTerm
|
||||||
uInt8 : 6; // padding bits
|
uInt8 char_with : 2; // Number of character cells on screen
|
||||||
|
uInt8 : 4; // padding bits
|
||||||
// Attribute byte #3
|
// Attribute byte #3
|
||||||
uInt8 : 8; // padding byte
|
uInt8 : 8; // padding byte
|
||||||
} bit;
|
} bit;
|
||||||
|
|
|
@ -484,9 +484,9 @@ class FWidget : public FVTerm, public FObject
|
||||||
FRect adjust_wsize_shadow{};
|
FRect adjust_wsize_shadow{};
|
||||||
FRect adjust_wsize_term_shadow{};
|
FRect adjust_wsize_term_shadow{};
|
||||||
// widget offset
|
// widget offset
|
||||||
FRect offset{};
|
FRect woffset{};
|
||||||
// offset of the widget client area
|
// offset of the widget client area
|
||||||
FRect client_offset{};
|
FRect wclient_offset{};
|
||||||
// widget shadow size (on the right and bottom side)
|
// widget shadow size (on the right and bottom side)
|
||||||
FSize wshadow{0, 0};
|
FSize wshadow{0, 0};
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ class FWidget : public FVTerm, public FObject
|
||||||
static widgetList* dialog_list;
|
static widgetList* dialog_list;
|
||||||
static widgetList* always_on_top_list;
|
static widgetList* always_on_top_list;
|
||||||
static widgetList* close_widget;
|
static widgetList* close_widget;
|
||||||
static FWidgetColors wc;
|
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;
|
||||||
|
@ -602,11 +602,11 @@ inline const FPoint FWidget::getPos() const // position relative to the widget
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getTermX() const // x-position on terminal
|
inline int FWidget::getTermX() const // x-position on terminal
|
||||||
{ return offset.getX1() + adjust_wsize.getX(); }
|
{ return woffset.getX1() + adjust_wsize.getX(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getTermY() const // y-position on terminal
|
inline int FWidget::getTermY() const // y-position on terminal
|
||||||
{ return offset.getY1() + adjust_wsize.getY(); }
|
{ return woffset.getY1() + adjust_wsize.getY(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FPoint FWidget::getTermPos() const // position on terminal
|
inline const FPoint FWidget::getTermPos() const // position on terminal
|
||||||
|
@ -642,19 +642,19 @@ inline int FWidget::getRightPadding() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline std::size_t FWidget::getClientWidth() const
|
inline std::size_t FWidget::getClientWidth() const
|
||||||
{ return client_offset.getWidth(); }
|
{ return wclient_offset.getWidth(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline std::size_t FWidget::getClientHeight() const
|
inline std::size_t FWidget::getClientHeight() const
|
||||||
{ return client_offset.getHeight(); }
|
{ return wclient_offset.getHeight(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline std::size_t FWidget::getMaxWidth() const
|
inline std::size_t FWidget::getMaxWidth() const
|
||||||
{ return offset.getWidth(); }
|
{ return woffset.getWidth(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline std::size_t FWidget::getMaxHeight() const
|
inline std::size_t FWidget::getMaxHeight() const
|
||||||
{ return offset.getHeight(); }
|
{ return woffset.getHeight(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FSize& FWidget::getShadow() const
|
inline const FSize& FWidget::getShadow() const
|
||||||
|
@ -683,10 +683,10 @@ inline const FRect& FWidget::getTermGeometry()
|
||||||
{
|
{
|
||||||
adjust_wsize_term.setCoordinates
|
adjust_wsize_term.setCoordinates
|
||||||
(
|
(
|
||||||
adjust_wsize.x1_ref() + offset.x1_ref(),
|
adjust_wsize.x1_ref() + woffset.x1_ref(),
|
||||||
adjust_wsize.y1_ref() + offset.y1_ref(),
|
adjust_wsize.y1_ref() + woffset.y1_ref(),
|
||||||
adjust_wsize.x2_ref() + offset.x1_ref(),
|
adjust_wsize.x2_ref() + woffset.x1_ref(),
|
||||||
adjust_wsize.y2_ref() + offset.y1_ref()
|
adjust_wsize.y2_ref() + woffset.y1_ref()
|
||||||
);
|
);
|
||||||
|
|
||||||
return adjust_wsize_term;
|
return adjust_wsize_term;
|
||||||
|
@ -697,10 +697,10 @@ inline const FRect& FWidget::getTermGeometryWithShadow()
|
||||||
{
|
{
|
||||||
adjust_wsize_term_shadow.setCoordinates
|
adjust_wsize_term_shadow.setCoordinates
|
||||||
(
|
(
|
||||||
adjust_wsize.x1_ref() + offset.x1_ref(),
|
adjust_wsize.x1_ref() + woffset.x1_ref(),
|
||||||
adjust_wsize.y1_ref() + offset.y1_ref(),
|
adjust_wsize.y1_ref() + woffset.y1_ref(),
|
||||||
adjust_wsize.x2_ref() + offset.x1_ref() + int(wshadow.width_ref()),
|
adjust_wsize.x2_ref() + woffset.x1_ref() + int(wshadow.width_ref()),
|
||||||
adjust_wsize.y2_ref() + offset.y1_ref() + int(wshadow.height_ref())
|
adjust_wsize.y2_ref() + woffset.y1_ref() + int(wshadow.height_ref())
|
||||||
);
|
);
|
||||||
|
|
||||||
return adjust_wsize_term_shadow;
|
return adjust_wsize_term_shadow;
|
||||||
|
@ -945,8 +945,8 @@ inline void FWidget::delAccelerator()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FPoint FWidget::termToWidgetPos (const FPoint& tPos)
|
inline FPoint FWidget::termToWidgetPos (const FPoint& tPos)
|
||||||
{
|
{
|
||||||
return FPoint ( tPos.getX() + 1 - offset.getX1() - adjust_wsize.getX()
|
return FPoint ( tPos.getX() + 1 - woffset.getX1() - adjust_wsize.getX()
|
||||||
, tPos.getY() + 1 - offset.getY1() - adjust_wsize.getY() );
|
, tPos.getY() + 1 - woffset.getY1() - adjust_wsize.getY() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -963,7 +963,7 @@ inline void FWidget::drawBorder()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FWidgetColors& FWidget::getFWidgetColors() const
|
inline const FWidgetColors& FWidget::getFWidgetColors() const
|
||||||
{ return wc; }
|
{ return wcolors; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline uInt FWidget::getModalDialogCounter()
|
inline uInt FWidget::getModalDialogCounter()
|
||||||
|
@ -983,7 +983,7 @@ inline FWidget::widgetList*& FWidget::getWidgetCloseList()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FWidgetColors& FWidget::setFWidgetColors()
|
inline FWidgetColors& FWidget::setFWidgetColors()
|
||||||
{ return wc; }
|
{ return wcolors; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline uInt& FWidget::setModalDialogCounter()
|
inline uInt& FWidget::setModalDialogCounter()
|
||||||
|
|
Loading…
Reference in New Issue