No refreshing of the terminal during resizing of a dialog
This commit is contained in:
parent
597f9e772b
commit
9df509dd3b
|
@ -1,3 +1,7 @@
|
|||
2021-03-30 Markus Gans <guru.mail@muenster.de>
|
||||
* Stops terminal refresh during dialog resizing until all
|
||||
child widgets have been redrawn
|
||||
|
||||
2021-03-28 Markus Gans <guru.mail@muenster.de>
|
||||
* Widget now have the virtual method initLayout() to set
|
||||
the widget layouts automatically before the first drawing
|
||||
|
|
|
@ -324,6 +324,9 @@ inline void Brushes::setBackground (FColor color)
|
|||
class MouseDraw final : public finalcut::FDialog
|
||||
{
|
||||
public:
|
||||
// Using-declaration
|
||||
using FWidget::setGeometry;
|
||||
|
||||
// Constructor
|
||||
explicit MouseDraw (finalcut::FWidget* = nullptr);
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ struct Treeview::TreeItem
|
|||
{ return &name; }
|
||||
|
||||
const char* const* end() const
|
||||
{ return reinterpret_cast<const char* const*>(&child_element); }
|
||||
{ return &density + 1; }
|
||||
|
||||
// Data members
|
||||
const char* name;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the FINAL CUT widget toolkit *
|
||||
* *
|
||||
* Copyright 2013-2020 Markus Gans *
|
||||
* Copyright 2013-2021 Markus Gans *
|
||||
* *
|
||||
* FINAL CUT is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
@ -168,7 +168,7 @@ void FApplication::setLog (const FLogPtr& log)
|
|||
//----------------------------------------------------------------------
|
||||
bool FApplication::isQuit()
|
||||
{
|
||||
return ( internal::var::app_object ) ? quit_now : true;
|
||||
return internal::var::app_object ? quit_now : true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -359,6 +359,7 @@ void FDialog::setSize (const FSize& size, bool adjust)
|
|||
|
||||
const auto d_width = std::size_t(dw);
|
||||
const auto d_height = std::size_t(dh);
|
||||
setTerminalUpdates (FVTerm::TerminalUpdate::Stop);
|
||||
|
||||
// restoring the non-covered terminal areas
|
||||
if ( dw > 0 )
|
||||
|
@ -377,6 +378,8 @@ void FDialog::setSize (const FSize& size, bool adjust)
|
|||
|
||||
// set the cursor to the focus widget
|
||||
setCursorToFocusWidget();
|
||||
|
||||
setTerminalUpdates (FVTerm::TerminalUpdate::Start);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -282,7 +282,7 @@ inline FKey FKeyboard::getTermcapKey()
|
|||
for (auto&& entry : *key_map)
|
||||
{
|
||||
const char* kstr = entry.string;
|
||||
const std::size_t len = ( kstr ) ? std::strlen(kstr) : 0;
|
||||
const std::size_t len = kstr ? std::strlen(kstr) : 0;
|
||||
|
||||
if ( kstr && std::strncmp(kstr, fifo_buf, len) == 0 ) // found
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the FINAL CUT widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2020 Markus Gans *
|
||||
* Copyright 2014-2021 Markus Gans *
|
||||
* *
|
||||
* FINAL CUT is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
|
@ -996,7 +996,7 @@ inline void FListBox::setLineAttributes ( int y
|
|||
{
|
||||
setColor ( wc->current_element_focus_fg
|
||||
, wc->current_element_focus_bg );
|
||||
const int b = ( lineHasBrackets ) ? 1: 0;
|
||||
const int b = lineHasBrackets ? 1 : 0;
|
||||
|
||||
if ( inc_len > 0 ) // incremental search
|
||||
{
|
||||
|
|
|
@ -1618,7 +1618,7 @@ void FListView::drawList()
|
|||
const bool is_current_line( iter == current_iter );
|
||||
const auto& item = static_cast<FListViewItem*>(*iter);
|
||||
const int tree_offset = ( tree_view ) ? int(item->getDepth() << 1) + 1 : 0;
|
||||
const int checkbox_offset = ( item->isCheckable() ) ? 1 : 0;
|
||||
const int checkbox_offset = item->isCheckable() ? 1 : 0;
|
||||
path_end = getListEnd(item);
|
||||
print() << FPoint{2, 2 + int(y)};
|
||||
|
||||
|
|
|
@ -373,7 +373,7 @@ bool FMenu::isSubMenu() const
|
|||
bool FMenu::isDialogMenu() const
|
||||
{
|
||||
const auto& super = getSuperMenu();
|
||||
return ( super ) ? super->isDialogWidget() : false;
|
||||
return super ? super->isDialogWidget() : false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1350,7 +1350,7 @@ inline void FMenu::drawMenuText (MenuText& data)
|
|||
//----------------------------------------------------------------------
|
||||
inline void FMenu::drawSubMenuIndicator (std::size_t& startpos)
|
||||
{
|
||||
const std::size_t c = ( has_checkable_items ) ? 1 : 0;
|
||||
const std::size_t c = has_checkable_items ? 1 : 0;
|
||||
const std::size_t len = max_item_width - (startpos + c + 3);
|
||||
|
||||
if ( len > 0 )
|
||||
|
@ -1367,7 +1367,7 @@ inline void FMenu::drawSubMenuIndicator (std::size_t& startpos)
|
|||
inline void FMenu::drawAcceleratorKey (std::size_t& startpos, FKey accel_key)
|
||||
{
|
||||
const FString accel_name {FTerm::getKeyName(accel_key)};
|
||||
const std::size_t c = ( has_checkable_items ) ? 1 : 0;
|
||||
const std::size_t c = has_checkable_items ? 1 : 0;
|
||||
const std::size_t accel_len = accel_name.getLength();
|
||||
const std::size_t plain_text_length = startpos + accel_len + c + 2;
|
||||
|
||||
|
@ -1384,7 +1384,7 @@ inline void FMenu::drawAcceleratorKey (std::size_t& startpos, FKey accel_key)
|
|||
//----------------------------------------------------------------------
|
||||
inline void FMenu::drawTrailingSpaces (std::size_t startpos)
|
||||
{
|
||||
const std::size_t c = ( has_checkable_items ) ? 1 : 0;
|
||||
const std::size_t c = has_checkable_items ? 1 : 0;
|
||||
|
||||
// Print trailing blank space
|
||||
for (std::size_t i = startpos + c; i < max_item_width - 1; i++)
|
||||
|
|
|
@ -451,13 +451,13 @@ void FMenuItem::onFocusOut (FFocusEvent*)
|
|||
//----------------------------------------------------------------------
|
||||
bool FMenuItem::isDialog (const FWidget* w) const
|
||||
{
|
||||
return ( w ) ? w->isDialogWidget() : false;
|
||||
return w ? w->isDialogWidget() : false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FMenuItem::isMenuBar (const FWidget* w) const
|
||||
{
|
||||
return ( w ) ? w->isInstanceOf("FMenuBar") : false;
|
||||
return w ? w->isInstanceOf("FMenuBar") : false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -580,7 +580,7 @@ void FMenuItem::updateSuperMenuDimensions()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMenuItem::updateMenubarDimensions()
|
||||
void FMenuItem::updateMenubarDimensions() const
|
||||
{
|
||||
FWidget* parent = getParentWidget();
|
||||
|
||||
|
|
|
@ -403,7 +403,7 @@ void FMessageBox::adjustButtons()
|
|||
std::size_t max_width;
|
||||
const auto& root_widget = getRootWidget();
|
||||
setWidth(btn_width + 5);
|
||||
max_width = ( root_widget ) ? root_widget->getClientWidth() : 80;
|
||||
max_width = root_widget ? root_widget->getClientWidth() : 80;
|
||||
setX (int((max_width - getWidth()) / 2));
|
||||
}
|
||||
|
||||
|
|
|
@ -914,7 +914,7 @@ inline bool FOptiMove::isMethod0Faster ( int& move_time
|
|||
|
||||
if ( ! move_xy.empty() )
|
||||
{
|
||||
std::strncpy ( reinterpret_cast<char*>(move_buf)
|
||||
std::strncpy ( static_cast<char*>(move_buf)
|
||||
, move_xy.data(), BUF_SIZE - 1 );
|
||||
move_buf[BUF_SIZE - 1] = '\0';
|
||||
move_time = F_cursor_address.duration;
|
||||
|
|
|
@ -159,10 +159,10 @@ FString::FString (const char c)
|
|||
FString::~FString() // destructor
|
||||
{
|
||||
if ( string )
|
||||
delete[](string);
|
||||
delete[] string;
|
||||
|
||||
if ( c_string )
|
||||
delete[](c_string);
|
||||
delete[] c_string;
|
||||
}
|
||||
|
||||
|
||||
|
@ -182,10 +182,10 @@ FString& FString::operator = (FString&& s) noexcept
|
|||
if ( &s != this )
|
||||
{
|
||||
if ( string )
|
||||
delete[](string);
|
||||
delete[] string;
|
||||
|
||||
if ( c_string )
|
||||
delete[](c_string);
|
||||
delete[] c_string;
|
||||
|
||||
string = s.string;
|
||||
length = s.length;
|
||||
|
@ -348,7 +348,7 @@ const FString& FString::operator () () const
|
|||
FString FString::clear()
|
||||
{
|
||||
if ( string )
|
||||
delete[](string);
|
||||
delete[] string;
|
||||
|
||||
length = 0;
|
||||
bufsize = 0;
|
||||
|
@ -1231,7 +1231,7 @@ void FString::_assign (const wchar_t s[])
|
|||
if ( ! string || new_length > capacity() )
|
||||
{
|
||||
if ( string )
|
||||
delete[](string);
|
||||
delete[] string;
|
||||
|
||||
bufsize = FWDBUFFER + new_length + 1;
|
||||
|
||||
|
@ -1258,7 +1258,7 @@ void FString::_insert (std::size_t len, const wchar_t s[])
|
|||
return;
|
||||
|
||||
if ( string )
|
||||
delete[](string);
|
||||
delete[] string;
|
||||
|
||||
length = len;
|
||||
bufsize = FWDBUFFER + length + 1;
|
||||
|
@ -1312,7 +1312,7 @@ void FString::_insert ( std::size_t pos
|
|||
|
||||
try
|
||||
{
|
||||
sptr = new wchar_t[bufsize]; // generate new string
|
||||
sptr = new wchar_t[bufsize]; // generate new string
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
|
@ -1332,7 +1332,7 @@ void FString::_insert ( std::size_t pos
|
|||
sptr[y++] = string[x];
|
||||
|
||||
length += len;
|
||||
delete[](string); // delete old string
|
||||
delete[] string; // delete old string
|
||||
string = sptr;
|
||||
}
|
||||
}
|
||||
|
@ -1356,7 +1356,7 @@ void FString::_remove (std::size_t pos, std::size_t len)
|
|||
|
||||
try
|
||||
{
|
||||
sptr = new wchar_t[bufsize]; // generate new string
|
||||
sptr = new wchar_t[bufsize]; // generate new string
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
|
@ -1367,13 +1367,13 @@ void FString::_remove (std::size_t pos, std::size_t len)
|
|||
std::size_t x{};
|
||||
std::size_t y{};
|
||||
|
||||
for (x = 0; x < pos; x++) // left side
|
||||
for (x = 0; x < pos; x++) // left side
|
||||
sptr[y++] = string[x];
|
||||
|
||||
for (x = pos + len; x < length + 1; x++) // right side + '\0'
|
||||
sptr[y++] = string[x];
|
||||
|
||||
delete[](string); // delete old string
|
||||
delete[] string; // delete old string
|
||||
string = sptr;
|
||||
length -= len;
|
||||
}
|
||||
|
@ -1425,7 +1425,7 @@ inline const char* FString::_to_cstring (const wchar_t s[]) const
|
|||
|
||||
if ( mblength == static_cast<std::size_t>(-1) && errno != EILSEQ )
|
||||
{
|
||||
delete[](c_string);
|
||||
delete[] c_string;
|
||||
c_string = nullptr;
|
||||
return "";
|
||||
}
|
||||
|
@ -1503,7 +1503,7 @@ inline const wchar_t* FString::_extractToken ( wchar_t* rest[]
|
|||
, const wchar_t s[]
|
||||
, const wchar_t delim[] ) const
|
||||
{
|
||||
wchar_t* token = ( s ) ? const_cast<wchar_t*>(s) : *rest;
|
||||
wchar_t* token = s ? const_cast<wchar_t*>(s) : *rest;
|
||||
|
||||
if ( ! token )
|
||||
return nullptr;
|
||||
|
|
|
@ -133,49 +133,49 @@ FTermcap::Status FTermcap::paddingPrint ( const std::string& string
|
|||
auto iter = string.begin();
|
||||
using iter_type = decltype(iter);
|
||||
|
||||
auto read_digits = [] (iter_type& iter, int& number)
|
||||
auto read_digits = [] (iter_type& it, int& number)
|
||||
{
|
||||
while ( std::isdigit(int(*iter)) && number < 1000 )
|
||||
while ( std::isdigit(int(*it)) && number < 1000 )
|
||||
{
|
||||
number = number * 10 + (*iter - '0');
|
||||
++iter;
|
||||
number = number * 10 + (*it - '0');
|
||||
++it;
|
||||
}
|
||||
|
||||
number *= 10;
|
||||
};
|
||||
|
||||
auto decimal_point = [] (iter_type& iter, int& number)
|
||||
auto decimal_point = [] (iter_type& it, int& number)
|
||||
{
|
||||
if ( *iter == '.' )
|
||||
if ( *it == '.' )
|
||||
{
|
||||
++iter;
|
||||
++it;
|
||||
|
||||
if ( std::isdigit(int(*iter)) )
|
||||
if ( std::isdigit(int(*it)) )
|
||||
{
|
||||
number += (*iter - '0'); // Position after decimal point
|
||||
++iter;
|
||||
number += (*it - '0'); // Position after decimal point
|
||||
++it;
|
||||
}
|
||||
|
||||
while ( std::isdigit(int(*iter)) )
|
||||
++iter;
|
||||
while ( std::isdigit(int(*it)) )
|
||||
++it;
|
||||
}
|
||||
};
|
||||
|
||||
auto asterisk_slash = [&affcnt, &has_delay] (iter_type& iter, int& number)
|
||||
auto asterisk_slash = [&affcnt, &has_delay] (iter_type& it, int& number)
|
||||
{
|
||||
while ( *iter == '*' || *iter == '/' )
|
||||
while ( *it == '*' || *it == '/' )
|
||||
{
|
||||
if ( *iter == '*' )
|
||||
if ( *it == '*' )
|
||||
{
|
||||
// Padding is proportional to the number of affected lines (suffix '*')
|
||||
number *= affcnt;
|
||||
++iter;
|
||||
++it;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Padding is mandatory (suffix '/')
|
||||
has_delay = true;
|
||||
++iter;
|
||||
++it;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -444,7 +444,7 @@ std::string FTermcap::encodeParams ( const std::string& cap
|
|||
auto str = ::tparm ( C_STR(cap.data()), params[0], params[1]
|
||||
, params[2], params[3], params[4], params[5]
|
||||
, params[6], params[7], params[8] );
|
||||
return ( str ) ? str : std::string();
|
||||
return str ? str : std::string();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -124,8 +124,8 @@ void FToolTip::init()
|
|||
void FToolTip::draw()
|
||||
{
|
||||
bool border = hasBorder();
|
||||
int y{( border ) ? 2 : 1};
|
||||
int x{( border ) ? 3 : 2};
|
||||
int y{border ? 2 : 1};
|
||||
int x{border ? 3 : 2};
|
||||
setColor();
|
||||
clearArea();
|
||||
|
||||
|
@ -160,8 +160,8 @@ void FToolTip::calculateDimensions()
|
|||
int x{};
|
||||
int y{};
|
||||
bool border = hasBorder();
|
||||
const std::size_t h = ( border ) ? text_num_lines + 2 : text_num_lines;
|
||||
const std::size_t w = ( border ) ? max_line_width + 4 : max_line_width + 2;
|
||||
const std::size_t h = border ? text_num_lines + 2 : text_num_lines;
|
||||
const std::size_t w = border ? max_line_width + 4 : max_line_width + 2;
|
||||
const auto& r = getRootWidget();
|
||||
|
||||
if ( r )
|
||||
|
|
|
@ -233,7 +233,7 @@ void FVTerm::setNonBlockingRead (bool enable)
|
|||
}
|
||||
#endif
|
||||
|
||||
uInt64 blocking_time = (enable) ? 5000 : 100000; // 5 or 100 ms
|
||||
uInt64 blocking_time = enable ? 5000 : 100000; // 5 or 100 ms
|
||||
FKeyboard::setReadBlockingTime (blocking_time);
|
||||
}
|
||||
|
||||
|
@ -1925,7 +1925,7 @@ void FVTerm::init_combined_character()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::finish()
|
||||
void FVTerm::finish() const
|
||||
{
|
||||
// Show the input cursor
|
||||
showCursor();
|
||||
|
@ -2907,7 +2907,7 @@ inline void FVTerm::flushTimeAdjustment() const
|
|||
}
|
||||
else
|
||||
{
|
||||
uInt64 usec = diff.tv_usec;
|
||||
auto usec = uInt64(diff.tv_usec);
|
||||
|
||||
if ( usec < MIN_FLUSH_WAIT )
|
||||
usec = MIN_FLUSH_WAIT;
|
||||
|
|
|
@ -159,7 +159,7 @@ class FMenuItem : public FWidget
|
|||
void init();
|
||||
void calculateTextDimensions();
|
||||
void updateSuperMenuDimensions();
|
||||
void updateMenubarDimensions();
|
||||
void updateMenubarDimensions() const;
|
||||
void processEnable() const;
|
||||
void processDisable() const;
|
||||
void processActivate() const;
|
||||
|
|
|
@ -380,7 +380,7 @@ class FVTerm
|
|||
void init();
|
||||
static void init_characterLengths();
|
||||
static void init_combined_character();
|
||||
void finish();
|
||||
void finish() const;
|
||||
static void putAreaLine (const FChar&, FChar&, std::size_t);
|
||||
static void putAreaCharacter ( const FPoint&, const FTermArea*
|
||||
, const FChar&, FChar& );
|
||||
|
|
Loading…
Reference in New Issue