Better handling of the scrollbar maximum

This commit is contained in:
Markus Gans 2018-12-09 18:24:31 +01:00
parent 00dc24468f
commit 7ef9b154b9
36 changed files with 4903 additions and 4867 deletions

View File

@ -1,3 +1,6 @@
2018-12-09 Markus Gans <guru.mail@muenster.de>
* Better handling of the scrollbar maximum
2018-12-06 Markus Gans <guru.mail@muenster.de>
* Easier handling of fc::SpecialCharacter

View File

@ -4,7 +4,7 @@
# Process this file with autoconf to produce a configure script.
AC_INIT([finalcut], [0.5.0])
AC_INIT([finalcut], [0.5.1])
AC_CONFIG_HEADER([config.h])
AX_PREFIX_CONFIG_H([src/include/final/fconfig.h], [F])
AC_CONFIG_SRCDIR([src/fobject.cpp])
@ -61,7 +61,7 @@ LT_OUTPUT
### This defines the version number of the installed .so files
### Update this value for every release! (A:B:C will map to foo.so.(A-C).C.B)
### using libtool's versioning system.
AC_SUBST(SO_VERSION, ["5:0:5"])
AC_SUBST(SO_VERSION, ["5:1:5"])
AC_SUBST([LIBTOOL_DEPS])

View File

@ -1 +1 @@
libfinal 0 libfinal0 (>= 0.5.0)
libfinal 0 libfinal0 (>= 0.5.1)

9320
debian/libfinal0.symbols vendored

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
#-----------------------------------------------------------------------------
# This is where make install will install the library
VERSION = "0.5.0"
VERSION = "0.5.1"
MAJOR := $(shell echo ${VERSION} | cut -d. -f1)
LIBDIR = /usr/local/lib
INCLUDEDIR1 = include/final

View File

@ -3,7 +3,7 @@
#-----------------------------------------------------------------------------
# This is where make install will install the library
VERSION = "0.5.0"
VERSION = "0.5.1"
MAJOR := $(shell echo ${VERSION} | cut -d. -f1)
LIBDIR = /usr/local/lib
INCLUDEDIR1 = include/final

View File

@ -151,7 +151,7 @@ void FDialog::hide()
}
//----------------------------------------------------------------------
FDialog::DialogCode FDialog::exec()
int FDialog::exec()
{
result_code = FDialog::Reject;
show();
@ -767,7 +767,7 @@ void FDialog::onWindowLowered (FEvent*)
// protected methods of FDialog
//----------------------------------------------------------------------
void FDialog::done(DialogCode result)
void FDialog::done(int result)
{
hide();
result_code = result;

View File

@ -31,7 +31,7 @@ namespace finalcut
// static class attributes
long FKeyboard::key_timeout = 100000; // 100 ms (default timeout for keypress)
struct timeval FKeyboard::time_keypressed;
struct timeval FKeyboard::time_keypressed{};
#if defined(__linux__)
FTermLinux* FKeyboard::linux = 0;
@ -74,10 +74,6 @@ FKeyboard::FKeyboard()
if ( stdin_status_flags == -1 )
std::abort();
// Initialize arrays with '\0'
std::fill_n (read_buf, READ_BUF_SIZE, '\0');
std::fill_n (fifo_buf, FIFO_BUF_SIZE, '\0');
}
//----------------------------------------------------------------------

View File

@ -149,7 +149,10 @@ void FListBox::showInsideBrackets ( std::size_t index
if ( len >= getWidth() - nf_offset - 3 )
{
hbar->setMaximum (int(max_line_width - getWidth() + nf_offset + 4));
int hmax = ( max_line_width > getWidth() - nf_offset - 4 )
? int(max_line_width - getWidth() + nf_offset + 4)
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
hbar->setValue (xoffset);
@ -304,13 +307,19 @@ void FListBox::remove (std::size_t item)
++iter;
}
hbar->setMaximum (int(max_line_width - getWidth() + nf_offset + 4));
int hmax = ( max_line_width > getWidth() - nf_offset - 4 )
? int(max_line_width - getWidth() + nf_offset + 4)
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
if ( hbar->isVisible() && max_line_width < getWidth() - nf_offset - 3 )
hbar->hide();
vbar->setMaximum (int(element_count - getHeight()) + 2);
int vmax = ( element_count > getHeight() - 2 )
? int(element_count - getHeight()) + 2
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
if ( vbar->isVisible() && element_count < getHeight() - 1 )
@ -737,15 +746,15 @@ void FListBox::onFocusOut (FFocusEvent*)
// protected methods of FListBox
//----------------------------------------------------------------------
void FListBox::adjustYOffset()
void FListBox::adjustYOffset (std::size_t element_count)
{
std::size_t element_count = getCount();
std::size_t height = getClientHeight();
if ( element_count == 0 || getClientHeight() == 0 )
if ( height == 0 )
return;
if ( yoffset > int(element_count - getClientHeight()) )
yoffset = int(element_count - getClientHeight());
if ( yoffset > int(element_count - height) )
yoffset = int(element_count - height);
if ( yoffset < 0 )
yoffset = 0;
@ -753,36 +762,47 @@ void FListBox::adjustYOffset()
if ( current < std::size_t(yoffset) )
current = std::size_t(yoffset);
if ( yoffset < int(current - getClientHeight()) )
yoffset = int(current - getClientHeight());
if ( yoffset < int(current - height) )
yoffset = int(current - height);
}
//----------------------------------------------------------------------
void FListBox::adjustSize()
{
std::size_t element_count;
FWidget::adjustSize();
adjustYOffset();
std::size_t element_count = getCount();
std::size_t width = getClientWidth();
std::size_t height = getClientHeight();
element_count = getCount();
vbar->setMaximum (int(element_count - getClientHeight()));
vbar->setPageSize (int(element_count), int(getClientHeight()));
if ( element_count == 0 )
return;
adjustYOffset (element_count);
int vmax = ( element_count > height )
? int(element_count - height)
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (int(element_count), int(height));
vbar->setX (int(getWidth()));
vbar->setHeight (getClientHeight(), false);
vbar->setHeight (height, false);
vbar->resize();
hbar->setMaximum (int(max_line_width - getClientWidth() + 2));
hbar->setPageSize (int(max_line_width), int(getClientWidth()) - 2);
int hmax = ( max_line_width > width - 2 )
? int(max_line_width - width + 2)
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(max_line_width), int(width) - 2);
hbar->setY (int(getHeight()));
hbar->setWidth (getClientWidth() + nf_offset, false);
hbar->setWidth (width + nf_offset, false);
hbar->resize();
if ( element_count <= getClientHeight() )
if ( element_count <= height )
vbar->hide();
else
vbar->setVisible();
if ( max_line_width < getClientWidth() - 1 )
if ( max_line_width < width - 1 )
hbar->hide();
else
hbar->setVisible();
@ -1225,7 +1245,10 @@ void FListBox::recalculateHorizontalBar (std::size_t len, bool has_brackets)
if ( len >= getWidth() - nf_offset - 3 )
{
hbar->setMaximum (int(max_line_width - getWidth() + nf_offset + 4));
int hmax = ( max_line_width > getWidth() - nf_offset - 4 )
? int(max_line_width - getWidth() + nf_offset + 4)
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
hbar->calculateSliderValues();
@ -1237,7 +1260,10 @@ void FListBox::recalculateHorizontalBar (std::size_t len, bool has_brackets)
//----------------------------------------------------------------------
void FListBox::recalculateVerticalBar (std::size_t element_count)
{
vbar->setMaximum (int(element_count - getHeight() + 2));
int vmax = ( element_count > getHeight() - 2 )
? int(element_count - getHeight() + 2)
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
vbar->calculateSliderValues();

View File

@ -1314,12 +1314,11 @@ void FListView::onFocusOut (FFocusEvent*)
// protected methods of FListView
//----------------------------------------------------------------------
void FListView::adjustViewport()
void FListView::adjustViewport (int element_count)
{
int element_count = int(getCount());
int height = int(getClientHeight());
if ( element_count == 0 || height <= 0 )
if ( height <= 0 )
return;
if ( element_count < height )
@ -1357,29 +1356,40 @@ void FListView::adjustViewport()
//----------------------------------------------------------------------
void FListView::adjustSize()
{
std::size_t element_count;
FWidget::adjustSize();
adjustViewport();
std::size_t element_count = getCount();
std::size_t width = getClientWidth();
std::size_t height = getClientHeight();
element_count = getCount();
vbar->setMaximum (int(element_count - getClientHeight()));
vbar->setPageSize (int(element_count), int(getClientHeight()));
if ( element_count == 0 )
return;
adjustViewport (int(element_count));
int vmax = ( element_count > height )
? int(element_count - height)
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (int(element_count), int(height));
vbar->setX (int(getWidth()));
vbar->setHeight (getClientHeight(), false);
vbar->setHeight (height, false);
vbar->resize();
hbar->setMaximum (max_line_width - int(getClientWidth()));
hbar->setPageSize (max_line_width, int(getClientWidth()));
int hmax = ( max_line_width > width )
? int(max_line_width - width)
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(max_line_width), int(width));
hbar->setY (int(getHeight()));
hbar->setWidth (getClientWidth(), false);
hbar->setWidth (width, false);
hbar->resize();
if ( element_count <= getClientHeight() )
if ( element_count <= height )
vbar->hide();
else
vbar->setVisible();
if ( max_line_width <= int(getClientWidth()) )
if ( max_line_width <= width )
hbar->hide();
else
hbar->setVisible();
@ -1433,7 +1443,7 @@ void FListView::init()
setTopPadding(1);
setLeftPadding(1);
setBottomPadding(1);
setRightPadding(1 + nf_offset);
setRightPadding(1 + int(nf_offset));
}
//----------------------------------------------------------------------
@ -1706,7 +1716,7 @@ void FListView::drawListLine ( const FListViewItem* item
}
line = line.mid ( std::size_t(xoffset) + 1
, getWidth() - std::size_t(nf_offset) - 2);
, getWidth() - nf_offset - 2);
const wchar_t* const& element_str = line.wc_str();
std::size_t len = line.getLength();
std::size_t i;
@ -1714,7 +1724,7 @@ void FListView::drawListLine ( const FListViewItem* item
for (i = 0; i < len; i++)
*this << element_str[i];
for (; i < getWidth() - std::size_t(nf_offset) - 2; i++)
for (; i < getWidth() - nf_offset - 2; i++)
print (' ');
}
@ -1925,10 +1935,10 @@ void FListView::updateDrawing (bool draw_vbar, bool draw_hbar)
}
//----------------------------------------------------------------------
int FListView::determineLineWidth (FListViewItem* item)
std::size_t FListView::determineLineWidth (FListViewItem* item)
{
static const int padding_space = 1;
int line_width = padding_space; // leading space
static const std::size_t padding_space = 1;
std::size_t line_width = padding_space; // leading space
uInt column_idx = 0;
uInt entries = uInt(item->column_list.size());
headerItems::iterator header_iter;
@ -1936,23 +1946,24 @@ int FListView::determineLineWidth (FListViewItem* item)
while ( header_iter != header.end() )
{
int width = header_iter->width;
std::size_t width = std::size_t(header_iter->width);
bool fixed_width = header_iter->fixed_width;
if ( ! fixed_width )
{
int len;
std::size_t len;
if ( column_idx < entries )
len = int(item->column_list[column_idx].getLength());
len = item->column_list[column_idx].getLength();
else
len = 0;
if ( len > width )
header_iter->width = len;
header_iter->width = int(len);
}
line_width += header_iter->width + padding_space; // width + trailing space
line_width += std::size_t(header_iter->width)
+ padding_space; // width + trailing space
column_idx++;
++header_iter;
}
@ -1963,7 +1974,7 @@ int FListView::determineLineWidth (FListViewItem* item)
//----------------------------------------------------------------------
inline void FListView::beforeInsertion (FListViewItem* item)
{
int line_width = determineLineWidth (item);
std::size_t line_width = determineLineWidth (item);
recalculateHorizontalBar (line_width);
}
@ -1981,22 +1992,25 @@ inline void FListView::afterInsertion()
// Sort list by a column (only if activated)
sort();
int element_count = int(getCount());
std::size_t element_count = getCount();
recalculateVerticalBar (element_count);
}
//----------------------------------------------------------------------
void FListView::recalculateHorizontalBar (int len)
void FListView::recalculateHorizontalBar (std::size_t len)
{
if ( len <= max_line_width )
return;
max_line_width = len;
if ( len >= int(getWidth()) - nf_offset - 3 )
if ( len >= getWidth() - nf_offset - 3 )
{
hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4);
int hmax = ( max_line_width > getWidth() - nf_offset - 4 )
? int(max_line_width - getWidth() + nf_offset + 4)
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset) - 4);
hbar->calculateSliderValues();
if ( ! hbar->isVisible() )
@ -2005,13 +2019,16 @@ void FListView::recalculateHorizontalBar (int len)
}
//----------------------------------------------------------------------
void FListView::recalculateVerticalBar (int element_count)
void FListView::recalculateVerticalBar (std::size_t element_count)
{
vbar->setMaximum (element_count - int(getHeight()) + 2);
vbar->setPageSize (element_count, int(getHeight()) - 2);
int vmax = ( element_count > getHeight() - 2 )
? int(element_count - getHeight() + 2)
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
vbar->calculateSliderValues();
if ( ! vbar->isVisible() && element_count >= int(getHeight()) - 1 )
if ( ! vbar->isVisible() && element_count >= getHeight() - 1 )
vbar->setVisible();
}
@ -2239,7 +2256,7 @@ inline void FListView::keyLeft (int& first_line_position_before)
// Collapse element
item->collapse();
adjustSize();
int element_count = int(getCount());
std::size_t element_count = getCount();
recalculateVerticalBar (element_count);
// Force vertical scrollbar redraw
first_line_position_before = -1;
@ -2283,7 +2300,7 @@ inline void FListView::keyLeft (int& first_line_position_before)
//----------------------------------------------------------------------
inline void FListView::keyRight (int& first_line_position_before)
{
int xoffset_end = max_line_width - int(getClientWidth());
int xoffset_end = int(max_line_width) - int(getClientWidth());
FListViewItem* item = getCurrentItem();
if ( tree_view && item->isExpandable() && ! item->isExpand() )
@ -2461,7 +2478,7 @@ void FListView::stepBackward (int distance)
//----------------------------------------------------------------------
void FListView::scrollToX (int x)
{
int xoffset_end = max_line_width - int(getClientWidth());
int xoffset_end = int(max_line_width) - int(getClientWidth());
if ( xoffset == x )
return;

View File

@ -282,8 +282,8 @@ void FMessageBox::adjustSize()
//----------------------------------------------------------------------
void FMessageBox::cb_processClick (FWidget*, data_ptr data)
{
FDialog::DialogCode* reply = static_cast<FDialog::DialogCode*>(data);
done (*reply);
int reply = *(static_cast<int*>(data));
done (reply);
}
@ -403,15 +403,18 @@ void FMessageBox::calculateDimensions()
std::size_t w, h;
std::size_t headline_height = 0;
text_split = text.split("\n");
text_num_lines = uInt(text_split.size());
text_components = &text_split[0];
max_line_width = 0;
text_num_lines = uInt(text_split.size());
if ( text_num_lines == 0 )
return;
if ( ! headline_text.isNull() )
headline_height = 2;
for (uInt i = 0; i < text_num_lines; i++)
{
text_components = &text_split[0];
std::size_t len = text_components[i].getLength();
if ( len > max_line_width )

View File

@ -479,19 +479,6 @@ int FMouseGPM::gpmEvent (bool clear)
// class FMouseX11
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FMouseX11::FMouseX11()
: FMouse()
{
x11_mouse[0] = '\0';
}
//----------------------------------------------------------------------
FMouseX11::~FMouseX11() // destructor
{ }
// public methods of FMouseX11
//----------------------------------------------------------------------
const char* FMouseX11::getClassName() const
@ -679,19 +666,6 @@ void FMouseX11::setButtonState (int btn, struct timeval* time)
// class FMouseSGR
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FMouseSGR::FMouseSGR()
: FMouse()
{
sgr_mouse[0] = '\0';
}
//----------------------------------------------------------------------
FMouseSGR::~FMouseSGR() // destructor
{ }
// public methods of FMouseSGR
//----------------------------------------------------------------------
const char* FMouseSGR::getClassName() const
@ -931,19 +905,6 @@ void FMouseSGR::setReleasedButtonState (int btn)
// class FMouseUrxvt
//----------------------------------------------------------------------
// constructors and destructor
//----------------------------------------------------------------------
FMouseUrxvt::FMouseUrxvt()
: FMouse()
{
urxvt_mouse[0] = '\0';
}
//----------------------------------------------------------------------
FMouseUrxvt::~FMouseUrxvt() // destructor
{ }
// public methods of FMouseUrxvt
//----------------------------------------------------------------------
const char* FMouseUrxvt::getClassName() const

View File

@ -35,11 +35,6 @@ namespace finalcut
//----------------------------------------------------------------------
FOptiAttr::FOptiAttr()
{
attr_buf[0] = '\0';
// Set to 0 to reset
reset_byte_mask.attr.byte[0] = 0;
reset_byte_mask.attr.byte[1] = 0;
reset_byte_mask.attr.byte[2] = 0;
// Set bits that must not be reset
reset_byte_mask.attr.bit.transparent = true;
reset_byte_mask.attr.bit.trans_shadow = true;

View File

@ -39,9 +39,6 @@ FOptiMove::FOptiMove (int baud)
{
assert ( baud >= 0 );
// Initialize arrays with '\0'
std::fill_n (move_buf, sizeof(move_buf), '\0');
calculateCharDuration();
// ANSI set cursor address preset for undefined terminals

View File

@ -82,15 +82,21 @@ void FScrollbar::setRange (int minimum, int maximum)
//----------------------------------------------------------------------
void FScrollbar::setValue (int value)
{
if ( value < min )
val = min;
else if ( value > max )
val = max;
else
val = value;
calculateSliderValues();
}
//----------------------------------------------------------------------
void FScrollbar::setSteps (double st)
{
if ( st <= 0 )
steps = 1;
if ( st <= 0.0 )
steps = 1.0;
else
steps = st;
@ -109,6 +115,10 @@ void FScrollbar::setPageSize (int document_size, int page_size)
else
{
pagesize = page_size;
if ( document_size <= 0 || page_size <= 0 )
steps = 1.0;
else
steps = double(double(document_size) / double(page_size));
}
}
@ -185,9 +195,9 @@ void FScrollbar::redraw()
void FScrollbar::calculateSliderValues()
{
if ( isNewFont() && bar_orientation == fc::horizontal )
bar_length = length - 4;
bar_length = ( length > 2 ) ? length - 4 : 1;
else
bar_length = length - 2;
bar_length = ( length > 2 ) ? length - 2 : 1;
slider_length = std::size_t(double(bar_length) / steps);
@ -208,13 +218,15 @@ void FScrollbar::calculateSliderValues()
return;
}
std::size_t v = std::size_t(val);
std::size_t v = ( min < 0 ) ? std::size_t(val - min) : std::size_t(val);
if ( slider_length >= bar_length )
slider_pos = 0;
else
slider_pos = int( round ( double((bar_length - slider_length) * v)
/ double(max - min) ) );
if ( slider_pos < 0 )
slider_pos = 0;
else if ( slider_pos > int(bar_length - slider_length) )
if ( slider_pos > int(bar_length - slider_length) )
slider_pos = int(bar_length - slider_length);
}

View File

@ -264,7 +264,10 @@ void FTextView::insert (const FString& str, int pos)
if ( len > getTextWidth() )
{
hbar->setMaximum (int(maxLineWidth) - int(getTextWidth()));
int hmax = ( maxLineWidth > getTextWidth() )
? int(maxLineWidth) - int(getTextWidth())
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (int(maxLineWidth), int(getTextWidth()));
hbar->calculateSliderValues();
@ -275,7 +278,10 @@ void FTextView::insert (const FString& str, int pos)
}
data.insert (iter + pos, text_split.begin(), text_split.end());
vbar->setMaximum (int(getRows()) - int(getTextHeight()));
int vmax = ( getRows() > getTextHeight() )
? int(getRows()) - int(getTextHeight())
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (int(getRows()), int(getTextHeight()));
vbar->calculateSliderValues();
@ -575,7 +581,10 @@ void FTextView::adjustSize()
if ( height < 3 )
return;
vbar->setMaximum (last_line - int(height) + 2 - nf_offset);
int vmax = ( last_line > int(height) - 2 + nf_offset )
? last_line - int(height) + 2 - nf_offset
: 0;
vbar->setMaximum (vmax);
vbar->setPageSize (last_line, int(height) - 2 + nf_offset);
vbar->setX (int(width));
vbar->setHeight (height - 2 + std::size_t(nf_offset), false);
@ -585,7 +594,10 @@ void FTextView::adjustSize()
if ( width < 3 )
return;
hbar->setMaximum (max_width - int(width) + nf_offset + 2);
int hmax = ( max_width > int(width) - nf_offset - 2 )
? max_width - int(width) + nf_offset + 2
: 0;
hbar->setMaximum (hmax);
hbar->setPageSize (max_width, int(width) - nf_offset - 2);
hbar->setY (int(height));
hbar->setWidth (width - 2, false);

View File

@ -137,13 +137,16 @@ void FToolTip::calculateDimensions()
int x, y;
std::size_t w, h;
FWidget* r = getRootWidget();
max_line_width = 0;
text_split = text.split("\n");
text_num_lines = uInt(text_split.size());
text_components = &text_split[0];
max_line_width = 0;
if ( text_num_lines == 0 )
return;
for (std::size_t i = 0; i < text_num_lines; i++)
{
text_components = &text_split[0];
std::size_t len = text_components[i].getLength();
if ( len > max_line_width )

View File

@ -65,7 +65,7 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
flags.visible = true; // A widget is visible by default
flags.focusable = true; // A widget is focusable by default
flags.visible_cursor = true; // A widget has a visible cursor by default
widget_object = true; // This FObject is a widget
setWidgetProperty (true); // This FObject is a widget
if ( ! parent )
{

View File

@ -691,14 +691,14 @@ bool FWindow::zoomWindow()
}
//----------------------------------------------------------------------
void FWindow::switchToPrevWindow (FWidget* widget_object)
void FWindow::switchToPrevWindow (FWidget* widget)
{
// switch to previous window
// Disable terminal updates to avoid flickering
// when redrawing the focused widget
if ( widget_object )
widget_object->updateTerminal (FVTerm::stop_refresh);
if ( widget )
widget->updateTerminal (FVTerm::stop_refresh);
bool is_activated = activatePrevWindow();
FWindow* active_win = static_cast<FWindow*>(getActiveWindow());
@ -748,8 +748,8 @@ void FWindow::switchToPrevWindow (FWidget* widget_object)
}
// Enable terminal updates again
if ( widget_object )
widget_object->updateTerminal (FVTerm::continue_refresh);
if ( widget )
widget->updateTerminal (FVTerm::continue_refresh);
}
//----------------------------------------------------------------------

View File

@ -183,7 +183,7 @@
/* Define to the full name and version of this package. */
#ifndef F_PACKAGE_STRING
#define F_PACKAGE_STRING "finalcut 0.5.0"
#define F_PACKAGE_STRING "finalcut 0.5.1"
#endif
/* Define to the one symbol short name of this package. */
@ -198,7 +198,7 @@
/* Define to the version of this package. */
#ifndef F_PACKAGE_VERSION
#define F_PACKAGE_VERSION "0.5.0"
#define F_PACKAGE_VERSION "0.5.1"
#endif
/* Define to 1 if you have the ANSI C header files. */
@ -230,7 +230,7 @@
/* Version number of package */
#ifndef F_VERSION
#define F_VERSION "0.5.0"
#define F_VERSION "0.5.1"
#endif
/* Define to 1 if on MINIX. */

View File

@ -117,7 +117,7 @@ class FDialog : public FWindow
// Methods
virtual void show();
virtual void hide();
DialogCode exec();
int exec();
virtual void setPos (int, int, bool = true);
virtual void move (int, int);
bool moveUp (int);
@ -145,7 +145,7 @@ class FDialog : public FWindow
protected:
// Methods
virtual void done (DialogCode);
virtual void done (int);
virtual void draw();
void drawDialogShadow();
@ -223,7 +223,7 @@ class FDialog : public FWindow
// Data Members
FString tb_text{}; // title bar text
DialogCode result_code{FDialog::Reject};
int result_code{FDialog::Reject};
bool zoom_button_pressed{false};
bool zoom_button_active{false};
bool setPos_error{false};

View File

@ -167,8 +167,8 @@ class FKeyboard
// Data Members
FKey key{0};
char read_buf[READ_BUF_SIZE]{};
char fifo_buf[FIFO_BUF_SIZE]{};
char read_buf[READ_BUF_SIZE]{'\0'};
char fifo_buf[FIFO_BUF_SIZE]{'\0'};
int fifo_offset{0};
bool fifo_in_use{false};
int stdin_status_flags{0};

View File

@ -221,7 +221,7 @@ class FListBox : public FWidget
protected:
// Methods
void adjustYOffset();
void adjustYOffset (std::size_t);
virtual void adjustSize();
private:

View File

@ -344,7 +344,7 @@ class FListView : public FWidget
protected:
// Methods
void adjustViewport();
void adjustViewport (int);
virtual void adjustSize();
private:
@ -382,11 +382,11 @@ class FListView : public FWidget
void drawColumnEllipsis ( headerItems::const_iterator&
, const FString& );
void updateDrawing (bool, bool);
int determineLineWidth (FListViewItem*);
std::size_t determineLineWidth (FListViewItem*);
void beforeInsertion (FListViewItem*);
void afterInsertion();
void recalculateHorizontalBar (int);
void recalculateVerticalBar (int);
void recalculateHorizontalBar (std::size_t);
void recalculateVerticalBar (std::size_t);
void mouseHeaderClicked();
void wheelUp (int);
void wheelDown (int);
@ -443,8 +443,8 @@ class FListView : public FWidget
FPoint clicked_header_pos{-1, -1};
const FListViewItem* clicked_checkbox_item{0};
int xoffset{0};
int nf_offset{0};
int max_line_width{1};
std::size_t nf_offset{0};
std::size_t max_line_width{1};
int sort_column{-1};
sortTypes sort_type{};
fc::sorting_order sort_order{fc::unsorted};
@ -466,17 +466,12 @@ class FListView : public FWidget
struct FListView::Header
{
public:
Header()
: name()
, width (0)
, fixed_width (false)
, alignment (fc::alignLeft)
{ }
Header() = default;
FString name;
int width;
bool fixed_width;
fc::text_alignment alignment;
FString name{};
int width{0};
bool fixed_width{false};
fc::text_alignment alignment{fc::alignLeft};
};
#pragma pack(pop)

View File

@ -168,7 +168,7 @@ class FMessageBox : public FDialog
FColor emphasis_color{wc.dialog_emphasis_fg};
uInt num_buttons{0};
uInt text_num_lines{0};
int button_digit[3]{};
int button_digit[3]{0};
FButton* button[3]{0};
};
#pragma pack(pop)

View File

@ -268,10 +268,10 @@ class FMouseX11 : public FMouse
{
public:
// Constructor
FMouseX11();
FMouseX11() = default;
// Destructor
virtual ~FMouseX11();
virtual ~FMouseX11() = default;
// Accessors
virtual const char* getClassName() const;
@ -314,7 +314,7 @@ class FMouseX11 : public FMouse
void setButtonState (int, struct timeval*);
// Data Member
char x11_mouse[MOUSE_BUF_SIZE]{};
char x11_mouse[MOUSE_BUF_SIZE]{'\0'};
uChar x11_button_state{all_buttons_released};
};
#pragma pack(pop)
@ -331,10 +331,10 @@ class FMouseSGR : public FMouse
{
public:
// Constructor
FMouseSGR();
FMouseSGR() = default;
// Destructor
virtual ~FMouseSGR();
virtual ~FMouseSGR() = default;
// Accessors
virtual const char* getClassName() const;
@ -377,7 +377,7 @@ class FMouseSGR : public FMouse
void setReleasedButtonState (int);
// Data Members
char sgr_mouse[MOUSE_BUF_SIZE]{};
char sgr_mouse[MOUSE_BUF_SIZE]{'\0'};
uChar sgr_button_state{0x23};
};
#pragma pack(pop)
@ -394,10 +394,10 @@ class FMouseUrxvt : public FMouse
{
public:
// Constructor
FMouseUrxvt();
FMouseUrxvt() = default;
// Destructor
virtual ~FMouseUrxvt();
virtual ~FMouseUrxvt() = default;
// Accessors
virtual const char* getClassName() const;
@ -440,7 +440,7 @@ class FMouseUrxvt : public FMouse
void setButtonState (int, struct timeval*);
// Data Members
char urxvt_mouse[MOUSE_BUF_SIZE]{};
char urxvt_mouse[MOUSE_BUF_SIZE]{'\0'};
uChar urxvt_button_state{all_buttons_released};
};
#pragma pack(pop)

View File

@ -125,6 +125,9 @@ class FObject
// Accessor
TimerList* getTimerList() const;
// Mutator
void setWidgetProperty (bool);
// Method
uInt processTimerEvent();
@ -132,9 +135,6 @@ class FObject
virtual bool event (FEvent*);
virtual void onTimer (FTimerEvent*);
// Data Member
bool widget_object{false};
private:
// Disable copy constructor
FObject (const FObject&);
@ -149,6 +149,7 @@ class FObject
FObject* parent_obj{};
FObjectList children_list{}; // no children yet
bool has_parent{false};
bool widget_object{false};
static bool timer_modify_lock;
static TimerList* timer_list;
};
@ -219,6 +220,10 @@ inline bool FObject::isTimerInUpdating() const
inline FObject::TimerList* FObject::getTimerList() const
{ return timer_list; }
//----------------------------------------------------------------------
inline void FObject::setWidgetProperty (bool property)
{ widget_object = property; }
//----------------------------------------------------------------------
// Operator functions for timeval

View File

@ -372,7 +372,7 @@ class FOptiAttr
bool alt_equal_pc_charset{false};
bool monochron{true};
bool fake_reverse{false};
char attr_buf[8192]{};
char attr_buf[8192]{'\0'};
char* attr_ptr{attr_buf};
};
#pragma pack(pop)

View File

@ -234,7 +234,7 @@ class FOptiMove
bool automatic_left_margin{false};
bool eat_nl_glitch{false};
char move_buf[BUF_SIZE]{};
char move_buf[BUF_SIZE]{'\0'};
int char_duration{1};
int baudrate{9600};
int tabstop{0};

View File

@ -173,7 +173,6 @@ class FTerm
static std::size_t getColumnNumber();
static const FString getKeyName (FKey);
static FOptiMove* getFOptiMove();
static int getTTYFileDescriptor();
static char* getTermType();
static char* getTermFileName();

View File

@ -82,7 +82,7 @@ class FTermcap
typedef struct
{
char* string;
char tname[3];
char tname[alignof(char*)];
}
tcap_map;

View File

@ -60,10 +60,10 @@ class FTermData
typedef std::map<std::string, fc::encoding> encodingMap;
// Constructors
FTermData();
FTermData() = default;
// Destructor
~FTermData();
~FTermData() = default;
// Accessors
const char* getClassName() const;
@ -146,8 +146,8 @@ class FTermData
bool vga_font{false};
bool monochron{false};
bool resize_term{false};
char termtype[256]{};
char termfilename[256]{};
char termtype[256]{'\0'};
char termfilename[256]{'\0'};
FString xterm_font{};
FString xterm_title{};
@ -158,18 +158,6 @@ class FTermData
#pragma pack(pop)
// FTermData inline functions
//----------------------------------------------------------------------
inline FTermData::FTermData()
{
// Initialize arrays with '\0'
std::fill_n (termtype, sizeof(termtype), '\0');
std::fill_n (termfilename, sizeof(termfilename), '\0');
}
//----------------------------------------------------------------------
inline FTermData::~FTermData()
{ }
//----------------------------------------------------------------------
inline const char* FTermData::getClassName() const
{ return "FTermData"; }

View File

@ -30,6 +30,7 @@
#include <stdint.h>
#include <sys/types.h>
#include <cstddef>
#include <limits>
#include <string>

View File

@ -1083,7 +1083,7 @@ inline FMouseControl* FVTerm::getMouseControl()
//----------------------------------------------------------------------
inline FTerm::initializationValues& FVTerm::getInitValues()
{ return getFTerm().getInitValues(); }
{ return FTerm::init_values; }
//----------------------------------------------------------------------
inline void FVTerm::setInsertCursor (bool on)

View File

@ -402,8 +402,8 @@ class FWidget : public FVTerm, public FObject
static widgetList* dialog_list;
static widgetList* always_on_top_list;
static widgetList* close_widget;
CallbackObjects callback_objects{};
MemberCallbackObjects member_callback_objects{};
CallbackObjects callback_objects{};
private:
// Disable copy constructor

View File

@ -60,6 +60,16 @@ class FObject_protected : public finalcut::FObject
return processTimerEvent();
}
void setWidgetProperty (bool property)
{
finalcut::FObject::setWidgetProperty (property);
}
bool isWidget()
{
return finalcut::FObject::isWidget();
}
virtual void performTimerAction (const FObject*, const finalcut::FEvent*)
{
std::cout << ".";
@ -90,6 +100,7 @@ class FObjectTest : public CPPUNIT_NS::TestFixture
void classNameTest();
void noArgumentTest();
void childObjectTest();
void widgetObjectTest();
void removeParentTest();
void addTest();
void delTest();
@ -106,6 +117,7 @@ class FObjectTest : public CPPUNIT_NS::TestFixture
CPPUNIT_TEST (classNameTest);
CPPUNIT_TEST (noArgumentTest);
CPPUNIT_TEST (childObjectTest);
CPPUNIT_TEST (widgetObjectTest);
CPPUNIT_TEST (removeParentTest);
CPPUNIT_TEST (addTest);
CPPUNIT_TEST (delTest);
@ -221,6 +233,17 @@ void FObjectTest::childObjectTest()
CPPUNIT_ASSERT ( ! c1->isTimerInUpdating() );
}
//----------------------------------------------------------------------
void FObjectTest::widgetObjectTest()
{
FObject_protected o;
CPPUNIT_ASSERT ( ! o.isWidget() );
o.setWidgetProperty (true);
CPPUNIT_ASSERT ( o.isWidget() );
o.setWidgetProperty (false);
CPPUNIT_ASSERT ( ! o.isWidget() );
}
//----------------------------------------------------------------------
void FObjectTest::removeParentTest()
{/*