Fixed a few minor bugs

This commit is contained in:
Markus Gans 2020-10-04 02:55:15 +02:00
parent c7d6af8b31
commit fb8baf8c5c
31 changed files with 118 additions and 117 deletions

View File

@ -63,7 +63,7 @@ jobs:
- name: Create configure file - name: Create configure file
run: autoreconf -v --install --force run: autoreconf -v --install --force
- name: Create makefiles - name: Create makefiles
run: ./configure --prefix=/usr CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -pedantic" run: ./configure --prefix=/usr CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -pedantic"

View File

@ -89,7 +89,7 @@ Dialog::Dialog (FWidget* parent)
void Dialog::adjustSize() void Dialog::adjustSize()
{ {
finalcut::FDialog::adjustSize(); finalcut::FDialog::adjustSize();
int x = int((getDesktopWidth() - getWidth()) / 2); auto x = int((getDesktopWidth() - getWidth()) / 2);
const int y = 5; const int y = 5;
if ( x < 1 ) if ( x < 1 )

View File

@ -428,7 +428,7 @@ void MouseDraw::onClose (finalcut::FCloseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void MouseDraw::draw() void MouseDraw::draw()
{ {
const int y_max = int(getHeight()); const auto y_max = int(getHeight());
finalcut::FDialog::draw(); finalcut::FDialog::draw();
setColor(); setColor();
@ -463,8 +463,8 @@ void MouseDraw::draw()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void MouseDraw::drawBrush (int x, int y, bool swap_color) void MouseDraw::drawBrush (int x, int y, bool swap_color)
{ {
const int Cols = int(getWidth()); const auto Cols = int(getWidth());
const int Lines = int(getHeight()); const auto Lines = int(getHeight());
if ( x > 10 && x < Cols && y > 2 && y < Lines ) if ( x > 10 && x < Cols && y > 2 && y < Lines )
{ {

View File

@ -66,8 +66,8 @@ bool keyPressed()
void term_boundaries (int& x, int& y) void term_boundaries (int& x, int& y)
{ {
// checks and corrects the terminal boundaries // checks and corrects the terminal boundaries
const int term_width = int(app->getDesktopWidth()); const auto term_width = int(app->getDesktopWidth());
const int term_height = int(app->getDesktopHeight()); const auto term_height = int(app->getDesktopHeight());
if ( x < 0 ) if ( x < 0 )
x = 0; x = 0;
@ -230,8 +230,8 @@ int main (int argc, char* argv[])
app = &term_app; app = &term_app;
// Get screen dimension // Get screen dimension
int xmax = int(term_app.getDesktopWidth() - 1); auto xmax = int(term_app.getDesktopWidth() - 1);
int ymax = int(term_app.getDesktopHeight() - 1); auto ymax = int(term_app.getDesktopHeight() - 1);
finalcut::FString line{std::size_t(xmax) + 1, '-'}; finalcut::FString line{std::size_t(xmax) + 1, '-'};
// Place the cursor in the upper left corner // Place the cursor in the upper left corner

View File

@ -129,10 +129,10 @@ void RotoZoomer::draw()
start = system_clock::now(); start = system_clock::now();
finalcut::FDialog::draw(); finalcut::FDialog::draw();
double cx = double(80.0 / 2.0 + (80.0 / 2.0 * std::sin(double(path) / 50.0))); auto cx = double(80.0 / 2.0 + (80.0 / 2.0 * std::sin(double(path) / 50.0)));
double cy = double(23.0 + (23.0 * std::cos(double(path) / 50.0))); auto cy = double(23.0 + (23.0 * std::cos(double(path) / 50.0)));
double r = double(128.0 + 96.0 * std::cos(double(path) / 10.0)); auto r = double(128.0 + 96.0 * std::cos(double(path) / 10.0));
double a = double(path) / 50.0; auto a = double(path) / 50.0;
rotozoomer (cx, cy, r, a); rotozoomer (cx, cy, r, a);
} }
@ -141,12 +141,12 @@ void RotoZoomer::rotozoomer (double cx, double cy, double r, double a)
{ {
const int Cols = int(getClientWidth()); const int Cols = int(getClientWidth());
const int Lines = int(getClientHeight()); const int Lines = int(getClientHeight());
int Ax = int(4096.0 * (cx + r * std::cos(a))); auto Ax = int(4096.0 * (cx + r * std::cos(a)));
int Ay = int(4096.0 * (cy + r * std::sin(a))); auto Ay = int(4096.0 * (cy + r * std::sin(a)));
int Bx = int(4096.0 * (cx + r * std::cos(a + 2.02358))); auto Bx = int(4096.0 * (cx + r * std::cos(a + 2.02358)));
int By = int(4096.0 * (cy + r * std::sin(a + 2.02358))); auto By = int(4096.0 * (cy + r * std::sin(a + 2.02358)));
int Cx = int(4096.0 * (cx + r * std::cos(a - 1.11701))); auto Cx = int(4096.0 * (cx + r * std::cos(a - 1.11701)));
int Cy = int(4096.0 * (cy + r * std::sin(a - 1.11701))); auto Cy = int(4096.0 * (cy + r * std::sin(a - 1.11701)));
int dxdx = (Bx - Ax) / 80; int dxdx = (Bx - Ax) / 80;
int dydx = (By - Ay) / 80; int dydx = (By - Ay) / 80;
int dxdy = (Cx - Ax) / 23; int dxdy = (Cx - Ax) / 23;

View File

@ -118,8 +118,8 @@ Scrollview::~Scrollview()
void Scrollview::setScrollSize (const FSize& size) void Scrollview::setScrollSize (const FSize& size)
{ {
FScrollView::setScrollSize (size); FScrollView::setScrollSize (size);
const int width = int(size.getWidth()); const auto width = int(size.getWidth());
const int height = int(size.getHeight()); const auto height = int(size.getHeight());
go_south.setPos (FPoint{width - 5, 1}); go_south.setPos (FPoint{width - 5, 1});
go_west.setPos (FPoint{width - 5, height - 1}); go_west.setPos (FPoint{width - 5, height - 1});
go_north.setPos (FPoint{1, height - 1}); go_north.setPos (FPoint{1, height - 1});

View File

@ -177,8 +177,8 @@ void AttribDlg::cb_back()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void AttribDlg::adjustSize() void AttribDlg::adjustSize()
{ {
int x = int((getDesktopWidth() - getWidth()) / 2); auto x = int((getDesktopWidth() - getWidth()) / 2);
int y = int((getDesktopHeight() - getHeight()) / 2) + 1; auto y = int((getDesktopHeight() - getHeight()) / 2) + 1;
if ( x < 1 ) if ( x < 1 )
x = 1; x = 1;

View File

@ -213,7 +213,7 @@ MainWindow::MainWindow (finalcut::FWidget* parent)
ibg->unsetTransparentShadow(); ibg->unsetTransparentShadow();
// Set statusbar text for this window // Set statusbar text for this window
setStatusbarMessage("Press Q to quit"); FDialog::setStatusbarMessage("Press Q to quit");
unsetTransparentShadow(); unsetTransparentShadow();
activateDialog(); activateDialog();

View File

@ -50,7 +50,7 @@ sInt64 stringToNumber (const finalcut::FString& str)
auto num_string = str.left(str.getLength() - 1); auto num_string = str.left(str.getLength() - 1);
num_string = num_string.replace(",", ""); num_string = num_string.replace(",", "");
num_string = num_string.replace('.', ""); num_string = num_string.replace('.', "");
sInt64 number = sInt64(num_string.toLong()); auto number = sInt64(num_string.toLong());
return number; return number;
} }
@ -405,7 +405,7 @@ void Treeview::adjustSize()
std::size_t h = getDesktopHeight() - 4; std::size_t h = getDesktopHeight() - 4;
setHeight (h, false); setHeight (h, false);
int x = int((getDesktopWidth() - getWidth()) / 2); auto x = int((getDesktopWidth() - getWidth()) / 2);
if ( x < 1 ) if ( x < 1 )
x = 1; x = 1;

View File

@ -192,7 +192,7 @@ void Watch::cb_seconds()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Watch::adjustSize() void Watch::adjustSize()
{ {
const int pw = int(getDesktopWidth()); const auto pw = int(getDesktopWidth());
setX (1 + (pw - 22) / 2, false); setX (1 + (pw - 22) / 2, false);
setY (3, false); setY (3, false);
finalcut::FDialog::adjustSize(); finalcut::FDialog::adjustSize();

View File

@ -243,7 +243,7 @@ class Window final : public finalcut::FDialog
Window::Window (finalcut::FWidget* parent) Window::Window (finalcut::FWidget* parent)
: finalcut::FDialog{parent} : finalcut::FDialog{parent}
{ {
setSize ({40, 6}); FDialog::setSize ({40, 6});
// Menu bar item // Menu bar item
File.setStatusbarMessage ("File management commands"); File.setStatusbarMessage ("File management commands");
@ -355,8 +355,8 @@ void Window::adjustSize()
const std::size_t w = getDesktopWidth(); const std::size_t w = getDesktopWidth();
const std::size_t h = getDesktopHeight(); const std::size_t h = getDesktopHeight();
const int X = int(1 + (w - 40) / 2); const auto X = int(1 + (w - 40) / 2);
int Y = int(1 + (h - 22) / 2); auto Y = int(1 + (h - 22) / 2);
const int dx = ( w > 80 ) ? int(w - 80) / 2 : 0; const int dx = ( w > 80 ) ? int(w - 80) / 2 : 0;
const int dy = ( h > 24 ) ? int(h - 24) / 2 : 0; const int dy = ( h > 24 ) ? int(h - 24) / 2 : 0;
@ -371,7 +371,7 @@ void Window::adjustSize()
{ {
if ( (*iter)->is_open ) if ( (*iter)->is_open )
{ {
const int n = int(std::distance(first, iter)); const auto n = int(std::distance(first, iter));
const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3; const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
const int y = dy + 11 + int(n / 3) * 3; const int y = dy + 11 + int(n / 3) * 3;
(*iter)->dgl->setPos (FPoint{x, y}); (*iter)->dgl->setPos (FPoint{x, y});
@ -469,7 +469,7 @@ void Window::cb_createWindows()
win_dat->dgl = win; win_dat->dgl = win;
win_dat->is_open = true; win_dat->is_open = true;
win->setText(win_dat->title); win->setText(win_dat->title);
const int n = int(std::distance(first, iter)); const auto n = int(std::distance(first, iter));
const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3; const int x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
const int y = dy + 11 + int(n / 3) * 3; const int y = dy + 11 + int(n / 3) * 3;
win->setGeometry (FPoint{x, y}, FSize{20, 8}); win->setGeometry (FPoint{x, y}, FSize{20, 8});

View File

@ -133,7 +133,7 @@ FWidget* FApplication::getKeyboardWidget()
FApplication::FLogPtr& FApplication::getLog() FApplication::FLogPtr& FApplication::getLog()
{ {
// Global logger object // Global logger object
static FLogPtr* logger_ptr = new FLogPtr(); static auto logger_ptr = new FLogPtr();
if ( logger_ptr && logger_ptr->get() == nullptr ) if ( logger_ptr && logger_ptr->get() == nullptr )
{ {

View File

@ -226,8 +226,8 @@ void FDialog::setPos (const FPoint& pos, bool)
if ( getTermGeometry().overlap(old_geometry) ) if ( getTermGeometry().overlap(old_geometry) )
{ {
FRect restore{}; FRect restore{};
const std::size_t d_width = std::size_t(std::abs(dx)); const auto d_width = std::size_t(std::abs(dx));
const std::size_t d_height = std::size_t(std::abs(dy)); const auto d_height = std::size_t(std::abs(dy));
// dx > 0 : move left // dx > 0 : move left
// dx = 0 : move vertical // dx = 0 : move vertical
@ -354,8 +354,8 @@ void FDialog::setSize (const FSize& size, bool adjust)
// dh = 0 : scale only width // dh = 0 : scale only width
// dh < 0 : scale up height // dh < 0 : scale up height
const std::size_t d_width = std::size_t(dw); const auto d_width = std::size_t(dw);
const std::size_t d_height = std::size_t(dh); const auto d_height = std::size_t(dh);
// restoring the non-covered terminal areas // restoring the non-covered terminal areas
if ( dw > 0 ) if ( dw > 0 )
@ -492,7 +492,7 @@ void FDialog::onKeyPress (FKeyEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FDialog::onMouseDown (FMouseEvent* ev) void FDialog::onMouseDown (FMouseEvent* ev)
{ {
const int width = int(getWidth()); const auto width = int(getWidth());
const mouseStates ms = const mouseStates ms =
{ {
@ -1500,7 +1500,7 @@ bool FDialog::isOutsideTerminal (const FPoint& pos) const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FDialog::isLeftOutside() bool FDialog::isLeftOutside() const
{ {
if ( getX() > int(getMaxWidth()) ) if ( getX() > int(getMaxWidth()) )
return true; return true;
@ -1509,7 +1509,7 @@ bool FDialog::isLeftOutside()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FDialog::isBottomOutside() bool FDialog::isBottomOutside() const
{ {
if ( getY() > int(getMaxHeight()) ) if ( getY() > int(getMaxHeight()) )
return true; return true;

View File

@ -167,7 +167,7 @@ FFileDialog& FFileDialog::operator = (const FFileDialog& fdlg)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString FFileDialog::getSelectedFile() const FString FFileDialog::getSelectedFile() const
{ {
const uLong n = uLong(filebrowser.currentItem() - 1); const auto n = uLong(filebrowser.currentItem() - 1);
if ( dir_entries[n].directory ) if ( dir_entries[n].directory )
return FString{""}; return FString{""};
@ -823,7 +823,7 @@ void FFileDialog::cb_processRowChanged()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FFileDialog::cb_processClicked() void FFileDialog::cb_processClicked()
{ {
const uLong n = uLong(filebrowser.currentItem() - 1); const auto n = uLong(filebrowser.currentItem() - 1);
if ( dir_entries[n].directory ) if ( dir_entries[n].directory )
changeDir(dir_entries[n].name); changeDir(dir_entries[n].name);

View File

@ -88,18 +88,18 @@ void FKeyboard::fetchKeyCode()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString FKeyboard::getKeyName (const FKey keynum) const FString FKeyboard::getKeyName (const FKey keynum) const
{ {
const auto& key = std::find_if const auto& found_key = std::find_if
( (
fc::fkeyname.begin(), fc::fkeyname.begin(),
fc::fkeyname.end(), fc::fkeyname.end(),
[&keynum] (fc::FKeyName kn) [&keynum] (const fc::FKeyName& kn)
{ {
return (kn.num > 0 && kn.num == keynum); return (kn.num > 0 && kn.num == keynum);
} }
); );
if ( key != fc::fkeyname.end() ) if ( found_key != fc::fkeyname.end() )
return FString{key->string}; return FString{found_key->string};
if ( keynum > 32 && keynum < 127 ) if ( keynum > 32 && keynum < 127 )
return FString{char(keynum)}; return FString{char(keynum)};
@ -296,7 +296,7 @@ inline FKey FKeyboard::getSingleKey()
std::size_t n{}; std::size_t n{};
std::size_t len{1}; std::size_t len{1};
const uChar firstchar = uChar(fifo_buf[0]); const auto firstchar = uChar(fifo_buf[0]);
FKey keycode{}; FKey keycode{};
// Look for a utf-8 character // Look for a utf-8 character
@ -385,7 +385,7 @@ FKey FKeyboard::UTF8decode (const char utf8[]) const
for (std::size_t i{0}; i < len; ++i) for (std::size_t i{0}; i < len; ++i)
{ {
const uChar ch = uChar(utf8[i]); const auto ch = uChar(utf8[i]);
if ( (ch & 0xc0) == 0x80 ) if ( (ch & 0xc0) == 0x80 )
{ {
@ -478,7 +478,7 @@ void FKeyboard::parseKeyBuffer()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FKey FKeyboard::parseKeyString() FKey FKeyboard::parseKeyString()
{ {
const uChar firstchar = uChar(fifo_buf[0]); const auto firstchar = uChar(fifo_buf[0]);
if ( firstchar == ESC[0] ) if ( firstchar == ESC[0] )
{ {

View File

@ -752,9 +752,9 @@ void FLineEdit::drawInputField()
// set the cursor to the insert pos. // set the cursor to the insert pos.
const auto cursor_pos_column = getCursorColumnPos(); const auto cursor_pos_column = getCursorColumnPos();
const int xpos = int(2 + cursor_pos_column const auto xpos = int(2 + cursor_pos_column
- text_offset_column - text_offset_column
+ char_width_offset); + char_width_offset);
setCursorPos ({xpos, 1}); setCursorPos ({xpos, 1});
} }
@ -802,7 +802,7 @@ inline std::size_t FLineEdit::getCursorColumnPos() const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FString FLineEdit::getPasswordText() const inline FString FLineEdit::getPasswordText() const
{ {
return FString{text.getLength(), fc::Bullet}; // • return FString{text.getLength(), fc::Bullet}; // •
} }

View File

@ -692,7 +692,7 @@ inline void FListBox::mapKeyFunctions()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListBox::processKeyAction (FKeyEvent* ev) void FListBox::processKeyAction (FKeyEvent* ev)
{ {
const int idx = int(ev->key()); const auto idx = int(ev->key());
if ( key_map.find(idx) != key_map.end() ) if ( key_map.find(idx) != key_map.end() )
{ {
@ -933,7 +933,7 @@ inline void FListBox::drawListBracketsLine ( int y
printLeftBracket (iter->brackets); printLeftBracket (iter->brackets);
} }
const std::size_t first = std::size_t(xoffset); const auto first = std::size_t(xoffset);
const std::size_t max_width = getWidth() - nf_offset - 4 - b; const std::size_t max_width = getWidth() - nf_offset - 4 - b;
const FString element(getColumnSubString (getString(iter), first, max_width)); const FString element(getColumnSubString (getString(iter), first, max_width));
std::size_t column_width = getColumnWidth(element); std::size_t column_width = getColumnWidth(element);
@ -1233,7 +1233,7 @@ void FListBox::wheelUp (int pagesize)
void FListBox::wheelDown (int pagesize) void FListBox::wheelDown (int pagesize)
{ {
const std::size_t element_count = getCount(); const std::size_t element_count = getCount();
int yoffset_end = int(element_count - getClientHeight()); auto yoffset_end = int(element_count - getClientHeight());
if ( yoffset_end < 0 ) if ( yoffset_end < 0 )
yoffset_end = 0; yoffset_end = 0;
@ -1366,7 +1366,7 @@ void FListBox::prevListItem (int distance)
void FListBox::nextListItem (int distance) void FListBox::nextListItem (int distance)
{ {
const std::size_t element_count = getCount(); const std::size_t element_count = getCount();
const int yoffset_end = int(element_count - getClientHeight()); const auto yoffset_end = int(element_count - getClientHeight());
if ( current == element_count ) if ( current == element_count )
return; return;
@ -1407,7 +1407,7 @@ void FListBox::scrollToX (int val)
void FListBox::scrollToY (int val) void FListBox::scrollToY (int val)
{ {
const std::size_t element_count = getCount(); const std::size_t element_count = getCount();
const int yoffset_end = int(element_count - getClientHeight()); const auto yoffset_end = int(element_count - getClientHeight());
if ( yoffset == val ) if ( yoffset == val )
return; return;
@ -1516,7 +1516,7 @@ inline void FListBox::firstPos()
inline void FListBox::lastPos() inline void FListBox::lastPos()
{ {
const std::size_t element_count = getCount(); const std::size_t element_count = getCount();
const int yoffset_end = int(element_count - getClientHeight()); const auto yoffset_end = int(element_count - getClientHeight());
current = element_count; current = element_count;
if ( current > getClientHeight() ) if ( current > getClientHeight() )

View File

@ -239,7 +239,7 @@ FString FListViewItem::getText (int column) const
return fc::emptyFString::get(); return fc::emptyFString::get();
// Convert column position to address offset (index) // Convert column position to address offset (index)
const std::size_t index = std::size_t(column - 1); const auto index = std::size_t(column - 1);
return column_list[index]; return column_list[index];
} }
@ -275,7 +275,7 @@ void FListViewItem::setText (int column, const FString& text)
if ( ! listview->header[index].fixed_width ) if ( ! listview->header[index].fixed_width )
{ {
const int column_width = int(getColumnWidth(text)); const auto column_width = int(getColumnWidth(text));
if ( column_width > listview->header[index].width ) if ( column_width > listview->header[index].width )
listview->header[index].width = column_width; listview->header[index].width = column_width;
@ -705,7 +705,7 @@ fc::text_alignment FListView::getColumnAlignment (int column) const
return fc::alignLeft; return fc::alignLeft;
// Convert column position to address offset (index) // Convert column position to address offset (index)
const std::size_t index = std::size_t(column - 1); const auto index = std::size_t(column - 1);
return header[index].alignment; return header[index].alignment;
} }
@ -718,7 +718,7 @@ FString FListView::getColumnText (int column) const
return fc::emptyFString::get(); return fc::emptyFString::get();
// Convert column position to address offset (index) // Convert column position to address offset (index)
const std::size_t index = std::size_t(column - 1); const auto index = std::size_t(column - 1);
return header[index].name; return header[index].name;
} }
@ -726,7 +726,7 @@ FString FListView::getColumnText (int column) const
fc::sorting_type FListView::getColumnSortType (int column) const fc::sorting_type FListView::getColumnSortType (int column) const
{ {
fc::sorting_type type; fc::sorting_type type;
const std::size_t col = std::size_t(column); const auto col = std::size_t(column);
try try
{ {
@ -764,7 +764,7 @@ void FListView::setColumnAlignment (int column, fc::text_alignment align)
return; return;
// Convert column position to address offset (index) // Convert column position to address offset (index)
const std::size_t index = std::size_t(column - 1); const auto index = std::size_t(column - 1);
header[index].alignment = align; header[index].alignment = align;
} }
@ -777,11 +777,11 @@ void FListView::setColumnText (int column, const FString& label)
return; return;
// Convert column position to address offset (index) // Convert column position to address offset (index)
std::size_t index = std::size_t(column - 1); auto index = std::size_t(column - 1);
if ( ! header[index].fixed_width ) if ( ! header[index].fixed_width )
{ {
const int column_width = int(getColumnWidth(label)); const auto column_width = int(getColumnWidth(label));
if ( column_width > header[index].width ) if ( column_width > header[index].width )
header[index].width = column_width; header[index].width = column_width;
@ -1375,7 +1375,7 @@ void FListView::onFocusOut (FFocusEvent*)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListView::adjustViewport (const int element_count) void FListView::adjustViewport (const int element_count)
{ {
const int height = int(getClientHeight()); const auto height = int(getClientHeight());
if ( height <= 0 || element_count == 0 ) if ( height <= 0 || element_count == 0 )
return; return;
@ -1511,7 +1511,7 @@ inline void FListView::mapKeyFunctions()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListView::processKeyAction (FKeyEvent* ev) void FListView::processKeyAction (FKeyEvent* ev)
{ {
const int idx = int(ev->key()); const auto idx = int(ev->key());
if ( key_map.find(idx) != key_map.end() ) if ( key_map.find(idx) != key_map.end() )
{ {
@ -1760,7 +1760,7 @@ void FListView::drawListLine ( const FListViewItem* item
{ {
static constexpr std::size_t ellipsis_length = 2; static constexpr std::size_t ellipsis_length = 2;
const auto& text = item->column_list[col]; const auto& text = item->column_list[col];
std::size_t width = std::size_t(header[col].width); auto width = std::size_t(header[col].width);
const std::size_t column_width = getColumnWidth(text); const std::size_t column_width = getColumnWidth(text);
// Increment the value of col for the column position // Increment the value of col for the column position
// and the next iteration // and the next iteration
@ -1989,7 +1989,7 @@ void FListView::drawHeadlineLabel (const headerItems::const_iterator& iter)
static constexpr std::size_t leading_space = 1; static constexpr std::size_t leading_space = 1;
const auto& text = iter->name; const auto& text = iter->name;
FString txt{" " + text}; FString txt{" " + text};
const std::size_t width = std::size_t(iter->width); const auto width = std::size_t(iter->width);
std::size_t column_width = getColumnWidth(txt); std::size_t column_width = getColumnWidth(txt);
const std::size_t column_max = leading_space + width; const std::size_t column_max = leading_space + width;
const headerItems::const_iterator first = header.begin(); const headerItems::const_iterator first = header.begin();
@ -2169,7 +2169,7 @@ std::size_t FListView::determineLineWidth (FListViewItem* item)
for (auto&& header_item : header) for (auto&& header_item : header)
{ {
const std::size_t width = std::size_t(header_item.width); const auto width = std::size_t(header_item.width);
const bool fixed_width = header_item.fixed_width; const bool fixed_width = header_item.fixed_width;
if ( ! fixed_width ) if ( ! fixed_width )
@ -2276,7 +2276,7 @@ void FListView::mouseHeaderClicked()
{ {
static constexpr int leading_space = 1; static constexpr int leading_space = 1;
const bool has_sort_indicator( column == sort_column ); const bool has_sort_indicator( column == sort_column );
int click_width = int(getColumnWidth(item.name)); auto click_width = int(getColumnWidth(item.name));
if ( has_sort_indicator ) if ( has_sort_indicator )
click_width += 2; click_width += 2;
@ -2335,7 +2335,7 @@ void FListView::wheelDown (int pagesize)
if ( itemlist.empty() ) if ( itemlist.empty() )
return; return;
const int element_count = int(getCount()); const auto element_count = int(getCount());
if ( current_iter.getPosition() + 1 == element_count ) if ( current_iter.getPosition() + 1 == element_count )
return; return;
@ -2374,7 +2374,7 @@ bool FListView::dragScrollUp (int position_before)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FListView::dragScrollDown (int position_before) bool FListView::dragScrollDown (int position_before)
{ {
const int element_count = int(getCount()); const auto element_count = int(getCount());
if ( position_before + 1 == element_count ) if ( position_before + 1 == element_count )
{ {
@ -2593,7 +2593,7 @@ inline void FListView::lastPos()
if ( itemlist.empty() ) if ( itemlist.empty() )
return; return;
const int element_count = int(getCount()); const auto element_count = int(getCount());
current_iter += element_count - current_iter.getPosition() - 1; current_iter += element_count - current_iter.getPosition() - 1;
const int difference = element_count - last_visible_line.getPosition() - 1; const int difference = element_count - last_visible_line.getPosition() - 1;
first_visible_line += difference; first_visible_line += difference;
@ -2688,7 +2688,7 @@ void FListView::stepForward (int distance)
if ( itemlist.empty() ) if ( itemlist.empty() )
return; return;
const int element_count = int(getCount()); const auto element_count = int(getCount());
if ( current_iter.getPosition() + 1 == element_count ) if ( current_iter.getPosition() + 1 == element_count )
return; return;
@ -2769,7 +2769,7 @@ void FListView::scrollToX (int x)
void FListView::scrollToY (int y) void FListView::scrollToY (int y)
{ {
const int pagesize = int(getClientHeight()) - 1; const int pagesize = int(getClientHeight()) - 1;
const int element_count = int(getCount()); const auto element_count = int(getCount());
if ( first_visible_line.getPosition() == y ) if ( first_visible_line.getPosition() == y )
return; return;

View File

@ -563,8 +563,8 @@ void FMouseX11::processEvent (struct timeval* time)
// Parse and interpret the X11 xterm mouse string // Parse and interpret the X11 xterm mouse string
const auto& mouse_position = getPos(); const auto& mouse_position = getPos();
const uChar x = uChar(x11_mouse[1] - 0x20); const auto x = uChar(x11_mouse[1] - 0x20);
const uChar y = uChar(x11_mouse[2] - 0x20); const auto y = uChar(x11_mouse[2] - 0x20);
const int btn = x11_mouse[0]; const int btn = x11_mouse[0];
setNewPos (x, y); setNewPos (x, y);
clearButtonState(); clearButtonState();

View File

@ -254,7 +254,7 @@ bool FObject::isTimeout (const timeval* time, uInt64 timeout)
diff.tv_usec += 1000000; diff.tv_usec += 1000000;
} }
const uInt64 diff_usec = uInt64((diff.tv_sec * 1000000) + diff.tv_usec); const auto diff_usec = uInt64((diff.tv_sec * 1000000) + diff.tv_usec);
return ( diff_usec > timeout ); return ( diff_usec > timeout );
} }

View File

@ -411,7 +411,7 @@ void FScrollbar::onTimer (FTimerEvent*)
|| ( scroll_type == FScrollbar::scrollPageForward || ( scroll_type == FScrollbar::scrollPageForward
&& slider_pos == slider_click_stop_pos ) ) && slider_pos == slider_click_stop_pos ) )
{ {
const int max_slider_pos = int(bar_length - slider_length); const auto max_slider_pos = int(bar_length - slider_length);
if ( scroll_type == FScrollbar::scrollPageBackward if ( scroll_type == FScrollbar::scrollPageBackward
&& slider_pos == 0 ) && slider_pos == 0 )

View File

@ -139,8 +139,8 @@ void FScrollView::setScrollSize (const FSize& size)
setChildPrintArea (viewport); setChildPrintArea (viewport);
} }
const int xoffset_end = int(getScrollWidth() - getViewportWidth()); const auto xoffset_end = int(getScrollWidth() - getViewportWidth());
const int yoffset_end = int(getScrollHeight() - getViewportHeight()); const auto yoffset_end = int(getScrollHeight() - getViewportHeight());
setTopPadding (1 - getScrollY()); setTopPadding (1 - getScrollY());
setLeftPadding (1 - getScrollX()); setLeftPadding (1 - getScrollX());
setBottomPadding (1 - (yoffset_end - getScrollY())); setBottomPadding (1 - (yoffset_end - getScrollY()));
@ -352,8 +352,8 @@ void FScrollView::scrollTo (int x, int y)
int& yoffset = viewport_geometry.y1_ref(); int& yoffset = viewport_geometry.y1_ref();
const int xoffset_before = xoffset; const int xoffset_before = xoffset;
const int yoffset_before = yoffset; const int yoffset_before = yoffset;
const int xoffset_end = int(getScrollWidth() - getViewportWidth()); const auto xoffset_end = int(getScrollWidth() - getViewportWidth());
const int yoffset_end = int(getScrollHeight() - getViewportHeight()); const auto yoffset_end = int(getScrollHeight() - getViewportHeight());
const std::size_t save_width = viewport_geometry.getWidth(); const std::size_t save_width = viewport_geometry.getWidth();
const std::size_t save_height = viewport_geometry.getHeight(); const std::size_t save_height = viewport_geometry.getHeight();
x--; x--;
@ -462,7 +462,7 @@ void FScrollView::drawBorder()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollView::onKeyPress (FKeyEvent* ev) void FScrollView::onKeyPress (FKeyEvent* ev)
{ {
const int idx = int(ev->key()); const auto idx = int(ev->key());
if ( key_map.find(idx) != key_map.end() ) if ( key_map.find(idx) != key_map.end() )
{ {
@ -658,8 +658,8 @@ void FScrollView::copy2area()
const int ay = getTermY() - printarea->offset_top; const int ay = getTermY() - printarea->offset_top;
const int dx = viewport_geometry.getX(); const int dx = viewport_geometry.getX();
const int dy = viewport_geometry.getY(); const int dy = viewport_geometry.getY();
int y_end = int(getViewportHeight()); auto y_end = int(getViewportHeight());
int x_end = int(getViewportWidth()); auto x_end = int(getViewportWidth());
// viewport width does not fit into the printarea // viewport width does not fit into the printarea
if ( printarea->width <= ax + x_end ) if ( printarea->width <= ax + x_end )
@ -694,7 +694,7 @@ void FScrollView::copy2area()
// private methods of FScrollView // private methods of FScrollView
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FPoint FScrollView::getViewportCursorPos() const inline FPoint FScrollView::getViewportCursorPos() const
{ {
const auto& window = FWindow::getWindowWidget(this); const auto& window = FWindow::getWindowWidget(this);
@ -726,8 +726,8 @@ void FScrollView::init()
resetColors(); resetColors();
setGeometry (FPoint{1, 1}, FSize{4, 4}); setGeometry (FPoint{1, 1}, FSize{4, 4});
setMinimumSize (FSize{4, 4}); setMinimumSize (FSize{4, 4});
const int xoffset_end = int(getScrollWidth() - getViewportWidth()); const auto xoffset_end = int(getScrollWidth() - getViewportWidth());
const int yoffset_end = int(getScrollHeight() - getViewportHeight()); const auto yoffset_end = int(getScrollHeight() - getViewportHeight());
nf_offset = FTerm::isNewFont() ? 1 : 0; nf_offset = FTerm::isNewFont() ? 1 : 0;
setTopPadding (1 - getScrollY()); setTopPadding (1 - getScrollY());
setLeftPadding (1 - getScrollX()); setLeftPadding (1 - getScrollX());
@ -767,7 +767,7 @@ inline void FScrollView::mapKeyFunctions()
key_map[fc::Fkey_end] = \ key_map[fc::Fkey_end] = \
[this] () [this] ()
{ {
int yoffset_end = int(getScrollHeight() - getViewportHeight()); auto yoffset_end = int(getScrollHeight() - getViewportHeight());
scrollToY (1 + yoffset_end); scrollToY (1 + yoffset_end);
}; };
} }

View File

@ -516,7 +516,7 @@ void FStatusBar::init()
{ {
const auto& r = getRootWidget(); const auto& r = getRootWidget();
const std::size_t w = r->getWidth(); const std::size_t w = r->getWidth();
const int h = int(r->getHeight()); const auto h = int(r->getHeight());
// initialize geometry values // initialize geometry values
setGeometry (FPoint{1, h}, FSize{w, 1}, false); setGeometry (FPoint{1, h}, FSize{w, 1}, false);
setAlwaysOnTop(); setAlwaysOnTop();

View File

@ -548,7 +548,7 @@ const char* FTermDetection::determineMaxColor (const char current_termtype[])
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const FString FTermDetection::getXTermColorName (FColor color) FString FTermDetection::getXTermColorName (FColor color)
{ {
FString color_str{""}; FString color_str{""};
fd_set ifds{}; fd_set ifds{};
@ -629,7 +629,7 @@ const char* FTermDetection::parseAnswerbackMsg (const char current_termtype[])
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const FString FTermDetection::getAnswerbackMsg() FString FTermDetection::getAnswerbackMsg()
{ {
FString answerback{""}; FString answerback{""};
fd_set ifds{}; fd_set ifds{};
@ -746,7 +746,7 @@ int FTermDetection::str2int (const FString& s)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const FString FTermDetection::getSecDA() FString FTermDetection::getSecDA()
{ {
FString sec_da_str{""}; FString sec_da_str{""};

View File

@ -200,8 +200,8 @@ class FDialog : public FWindow
void raiseActivateDialog(); void raiseActivateDialog();
void lowerActivateDialog(); void lowerActivateDialog();
bool isOutsideTerminal (const FPoint&) const; bool isOutsideTerminal (const FPoint&) const;
bool isLeftOutside(); bool isLeftOutside() const;
bool isBottomOutside(); bool isBottomOutside() const;
bool isLowerRightResizeCorner (const mouseStates&) const; bool isLowerRightResizeCorner (const mouseStates&) const;
void resizeMouseDown (const mouseStates&); void resizeMouseDown (const mouseStates&);
void resizeMouseUpMove (const mouseStates&, bool = false); void resizeMouseUpMove (const mouseStates&, bool = false);

View File

@ -185,7 +185,7 @@ class FLineEdit : public FWidget
std::size_t printTextField(); std::size_t printTextField();
std::size_t printPassword(); std::size_t printPassword();
std::size_t getCursorColumnPos() const; std::size_t getCursorColumnPos() const;
const FString getPasswordText() const; FString getPasswordText() const;
bool isPasswordField() const; bool isPasswordField() const;
offsetPair endPosToOffset (std::size_t); offsetPair endPosToOffset (std::size_t);
std::size_t clickPosToCursorPos (std::size_t); std::size_t clickPosToCursorPos (std::size_t);

View File

@ -157,7 +157,7 @@ class FScrollView : public FWidget
static constexpr int horizontal_border_spacing = 2; static constexpr int horizontal_border_spacing = 2;
// Accessors // Accessors
const FPoint getViewportCursorPos() const; FPoint getViewportCursorPos() const;
// Methods // Methods
void init(); void init();

View File

@ -55,6 +55,7 @@
#undef buttons // from term.h #undef buttons // from term.h
#endif #endif
#include <array>
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>

View File

@ -174,12 +174,12 @@ class FTermDetection final
static bool get256colorEnvString(); static bool get256colorEnvString();
static const char* termtype_256color_quirks(); static const char* termtype_256color_quirks();
static const char* determineMaxColor (const char[]); static const char* determineMaxColor (const char[]);
static const FString getXTermColorName (FColor); static FString getXTermColorName (FColor);
static const char* parseAnswerbackMsg (const char[]); static const char* parseAnswerbackMsg (const char[]);
static const FString getAnswerbackMsg(); static FString getAnswerbackMsg();
static const char* parseSecDA (const char[]); static const char* parseSecDA (const char[]);
static int str2int (const FString&); static int str2int (const FString&);
static const FString getSecDA(); static FString getSecDA();
static const char* secDA_Analysis (const char[]); static const char* secDA_Analysis (const char[]);
static const char* secDA_Analysis_0 (const char[]); static const char* secDA_Analysis_0 (const char[]);
static const char* secDA_Analysis_1 (const char[]); static const char* secDA_Analysis_1 (const char[]);

View File

@ -149,7 +149,7 @@ class FVTerm
FTermArea*& getVWin(); FTermArea*& getVWin();
const FTermArea* getVWin() const; const FTermArea* getVWin() const;
FPoint getPrintCursor(); FPoint getPrintCursor();
static const FChar getAttribute(); static FChar getAttribute();
FTerm& getFTerm() const; FTerm& getFTerm() const;
// Mutators // Mutators
@ -627,7 +627,7 @@ inline const FVTerm::FTermArea* FVTerm::getVWin() const
{ return vwin; } { return vwin; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FChar FVTerm::getAttribute() inline FChar FVTerm::getAttribute()
{ return next_attribute; } { return next_attribute; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -206,20 +206,20 @@ class FWidget : public FVTerm, public FObject
// Positioning and sizes accessors... // Positioning and sizes accessors...
int getX() const; int getX() const;
int getY() const; int getY() const;
const FPoint getPos() const; FPoint getPos() const;
int getTermX() const; int getTermX() const;
int getTermY() const; int getTermY() const;
const FPoint getTermPos() const; FPoint getTermPos() const;
std::size_t getWidth() const; std::size_t getWidth() const;
std::size_t getHeight() const; std::size_t getHeight() const;
const FSize getSize() const; FSize getSize() const;
int getTopPadding() const; int getTopPadding() const;
int getLeftPadding() const; int getLeftPadding() const;
int getBottomPadding() const; int getBottomPadding() const;
int getRightPadding() const; int getRightPadding() const;
std::size_t getClientWidth() const; std::size_t getClientWidth() const;
std::size_t getClientHeight() const; std::size_t getClientHeight() const;
const FSize getClientSize() const; FSize getClientSize() const;
std::size_t getMaxWidth() const; std::size_t getMaxWidth() const;
std::size_t getMaxHeight() const; std::size_t getMaxHeight() const;
const FSize& getShadow() const; const FSize& getShadow() const;
@ -332,7 +332,7 @@ class FWidget : public FVTerm, public FObject
virtual void hide(); virtual void hide();
virtual bool focusFirstChild(); // widget focusing virtual bool focusFirstChild(); // widget focusing
virtual bool focusLastChild(); virtual bool focusLastChild();
const FPoint termToWidgetPos (const FPoint&) const; FPoint termToWidgetPos (const FPoint&) const;
void print (const FPoint&) override; void print (const FPoint&) override;
virtual void move (const FPoint&); virtual void move (const FPoint&);
virtual void drawBorder(); virtual void drawBorder();
@ -583,7 +583,7 @@ inline FStatusBar* FWidget::getStatusBar()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline FWidget::FWidgetColorsPtr& FWidget::getColorTheme() inline FWidget::FWidgetColorsPtr& FWidget::getColorTheme()
{ {
static FWidgetColorsPtr* color_theme = new FWidgetColorsPtr(); static auto color_theme = new FWidgetColorsPtr();
return *color_theme; return *color_theme;
} }
@ -616,7 +616,7 @@ inline int FWidget::getY() const // y-position relative to the widget
{ return adjust_wsize.getY(); } { return adjust_wsize.getY(); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FPoint FWidget::getPos() const // position relative to the widget inline FPoint FWidget::getPos() const // position relative to the widget
{ {
const FPoint& pos = adjust_wsize.getPos(); // initialize pos const FPoint& pos = adjust_wsize.getPos(); // initialize pos
return pos; return pos;
@ -631,7 +631,7 @@ inline int FWidget::getTermY() const // y-position on terminal
{ return woffset.getY1() + adjust_wsize.getY(); } { return woffset.getY1() + adjust_wsize.getY(); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FPoint FWidget::getTermPos() const // position on terminal inline FPoint FWidget::getTermPos() const // position on terminal
{ return {getTermX(), getTermY()}; } { return {getTermX(), getTermY()}; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -643,7 +643,7 @@ inline std::size_t FWidget::getHeight() const
{ return adjust_wsize.getHeight(); } { return adjust_wsize.getHeight(); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FSize FWidget::getSize() const inline FSize FWidget::getSize() const
{ {
const FSize& size = adjust_wsize.getSize(); // initialize size const FSize& size = adjust_wsize.getSize(); // initialize size
return size; return size;
@ -674,7 +674,7 @@ inline std::size_t FWidget::getClientHeight() const
{ return wclient_offset.getHeight(); } { return wclient_offset.getHeight(); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FSize FWidget::getClientSize() const inline FSize FWidget::getClientSize() const
{ {
const FSize& size = wclient_offset.getSize(); // initialize size const FSize& size = wclient_offset.getSize(); // initialize size
return size; return size;
@ -1013,7 +1013,7 @@ inline void FWidget::delAccelerator()
{ delAccelerator(this); } { delAccelerator(this); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FPoint FWidget::termToWidgetPos (const FPoint& tPos) const inline FPoint FWidget::termToWidgetPos (const FPoint& tPos) const
{ {
return { tPos.getX() + 1 - woffset.getX1() - adjust_wsize.getX() return { tPos.getX() + 1 - woffset.getX1() - adjust_wsize.getX()
, tPos.getY() + 1 - woffset.getY1() - adjust_wsize.getY() }; , tPos.getY() + 1 - woffset.getY1() - adjust_wsize.getY() };