Changed more variables from int to std::size_t

This commit is contained in:
Markus Gans 2018-10-17 22:12:52 +02:00
parent 4fac4627cd
commit 94e00051c5
22 changed files with 185 additions and 170 deletions

View File

@ -1,6 +1,9 @@
2018-10-17 Markus Gans <guru.mail@muenster.de>
* Changed more variables from int to std::size_t
2018-10-14 Markus Gans <guru.mail@muenster.de>
* A width or height can not be negative.
For that reason the change from int to std::size_t.
For that reason the change from int to std::size_t
* FString fix for 32-bit architectures
2018-10-13 Markus Gans <guru.mail@muenster.de>

View File

@ -39,12 +39,12 @@ FButton::FButton(FWidget* parent)
, button_down(false)
, click_animation(true)
, click_time(150)
, space_char(int(' '))
, hotkeypos(NOT_FOUND)
, indent(0)
, space(int(' '))
, center_offset(0)
, vcenter_offset(0)
, txtlength(0)
, hotkeypos(-1)
, button_fg(wc.button_active_fg)
, button_bg(wc.button_active_bg)
, button_hotkey_fg(wc.button_hotkey_fg)
@ -64,12 +64,12 @@ FButton::FButton (const FString& txt, FWidget* parent)
, button_down(false)
, click_animation(true)
, click_time(150)
, space_char(int(' '))
, hotkeypos(NOT_FOUND)
, indent(0)
, space(int(' '))
, center_offset(0)
, vcenter_offset(0)
, txtlength(0)
, hotkeypos(-1)
, button_fg(wc.button_active_fg)
, button_bg(wc.button_active_bg)
, button_hotkey_fg(wc.button_hotkey_fg)
@ -542,20 +542,20 @@ inline void FButton::detectHotkey()
}
//----------------------------------------------------------------------
int FButton::getHotkeyPos ( wchar_t src[]
, wchar_t dest[]
, std::size_t length )
std::size_t FButton::getHotkeyPos ( wchar_t src[]
, wchar_t dest[]
, std::size_t length )
{
// find hotkey position in string
// + generate a new string without the '&'-sign
int pos = -1;
wchar_t* txt = src;
std::size_t pos = NOT_FOUND;
for (std::size_t i = 0; i < length; i++)
{
if ( i < length && txt[i] == L'&' && pos == -1 )
if ( i < length && txt[i] == L'&' && pos == NOT_FOUND )
{
pos = int(i);
pos = i;
i++;
src++;
}
@ -567,7 +567,7 @@ int FButton::getHotkeyPos ( wchar_t src[]
}
//----------------------------------------------------------------------
inline int FButton::clickAnimationIndent (FWidget* parent_widget)
inline std::size_t FButton::clickAnimationIndent (FWidget* parent_widget)
{
if ( ! button_down || ! click_animation )
return 0;
@ -582,9 +582,9 @@ inline int FButton::clickAnimationIndent (FWidget* parent_widget)
setColor ( parent_widget->getForegroundColor()
, parent_widget->getBackgroundColor() );
for (int y = 1; y <= int(getHeight()); y++)
for (std::size_t y = 1; y <= getHeight(); y++)
{
setPrintPos (1, y);
setPrintPos (1, int(y));
print (' '); // clear one left █
}
@ -622,14 +622,14 @@ inline void FButton::drawMarginLeft()
setColor (getForegroundColor(), button_bg);
for (int y = 0; y < int(getHeight()); y++)
for (std::size_t y = 0; y < getHeight(); y++)
{
setPrintPos (1 + indent, 1 + y);
setPrintPos (1 + int(indent), 1 + int(y));
if ( isMonochron() && is.active_focus && y == vcenter_offset )
print (fc::BlackRightPointingPointer); // ►
else
print (space); // full block █
print (space_char); // full block █
}
}
@ -638,14 +638,14 @@ inline void FButton::drawMarginRight()
{
// Print right margin
for (int y = 0; y < int(getHeight()); y++)
for (std::size_t y = 0; y < getHeight(); y++)
{
setPrintPos (int(getWidth()) + indent, 1 + y);
setPrintPos (int(getWidth() + indent), 1 + int(y));
if ( isMonochron() && is.active_focus && y == vcenter_offset )
print (fc::BlackLeftPointingPointer); // ◄
else
print (space); // full block █
print (space_char); // full block █
}
}
@ -657,41 +657,41 @@ inline void FButton::drawTopBottomBackground()
if ( getHeight() < 2 )
return;
for (int y = 0; y < vcenter_offset; y++)
for (std::size_t y = 0; y < vcenter_offset; y++)
{
setPrintPos (2 + indent, 1 + y);
setPrintPos (2 + int(indent), 1 + int(y));
for (std::size_t x = 1; x < getWidth() - 1; x++)
print (space); // █
print (space_char); // █
}
for (int y = vcenter_offset + 1; y < int(getHeight()); y++)
for (std::size_t y = vcenter_offset + 1; y < getHeight(); y++)
{
setPrintPos (2 + indent, 1 + y);
setPrintPos (2 + int(indent), 1 + int(y));
for (std::size_t x = 1; x < getWidth() - 1; x++)
print (space); // █
print (space_char); // █
}
}
//----------------------------------------------------------------------
inline void FButton::drawButtonTextLine (wchar_t button_text[])
{
int pos;
center_offset = int((int(getWidth()) - txtlength - 1) / 2);
setPrintPos (2 + indent, 1 + vcenter_offset);
std::size_t pos;
center_offset = (getWidth() - txtlength - 1) / 2;
setPrintPos (2 + int(indent), 1 + int(vcenter_offset));
setColor (button_fg, button_bg);
// Print button text line --------
for (pos = 0; pos < center_offset; pos++)
print (space); // █
print (space_char); // █
if ( hotkeypos == -1 )
setCursorPos ( 2 + center_offset
, 1 + vcenter_offset ); // first character
if ( hotkeypos == NOT_FOUND )
setCursorPos ( 2 + int(center_offset)
, 1 + int(vcenter_offset) ); // first character
else
setCursorPos ( 2 + center_offset + hotkeypos
, 1 + vcenter_offset ); // hotkey
setCursorPos ( 2 + int(center_offset) + hotkeypos
, 1 + int(vcenter_offset) ); // hotkey
if ( ! is.active && isMonochron() )
setReverse(true); // Light background
@ -699,11 +699,11 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
if ( is.active_focus && (isMonochron() || getMaxColor() < 16) )
setBold();
for ( int z = 0
; pos < center_offset + txtlength && z < int(getWidth()) - 2
for ( std::size_t z = 0
; pos < center_offset + txtlength && z < getWidth() - 2
; z++, pos++)
{
if ( (z == hotkeypos) && is.active )
if ( z == hotkeypos && is.active )
{
setColor (button_hotkey_fg, button_bg);
@ -729,18 +729,18 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
}
}
if ( txtlength >= int(getWidth()) - 1 )
if ( txtlength >= getWidth() - 1 )
{
// Print ellipsis
setPrintPos (int(getWidth()) + indent - 2, 1);
setPrintPos (int(getWidth() + indent) - 2, 1);
print (L"..");
}
if ( is.active_focus && (isMonochron() || getMaxColor() < 16) )
unsetBold();
for (pos = center_offset + txtlength; pos < int(getWidth()) - 2; pos++)
print (space); // █
for (pos = center_offset + txtlength; pos < getWidth() - 2; pos++)
print (space_char); // █
}
//----------------------------------------------------------------------
@ -748,13 +748,13 @@ void FButton::draw()
{
wchar_t* button_text;
FWidget* parent_widget = getParentWidget();
txtlength = int(text.getLength());
space = int(' ');
txtlength = text.getLength();
space_char = int(' ');
getButtonState();
try
{
button_text = new wchar_t[std::size_t(txtlength) + 1]();
button_text = new wchar_t[txtlength + 1]();
}
catch (const std::bad_alloc& ex)
{
@ -772,7 +772,7 @@ void FButton::draw()
clearRightMargin (parent_widget);
if ( ! is.active && isMonochron() )
space = fc::MediumShade; // ▒ simulates greyed out at Monochron
space_char = fc::MediumShade; // ▒ simulates greyed out at Monochron
if ( isMonochron() && (is.active || is.focus) )
setReverse(false); // Dark background
@ -782,11 +782,11 @@ void FButton::draw()
hotkeypos = getHotkeyPos(text.wc_str(), button_text, uInt(txtlength));
if ( hotkeypos != -1 )
if ( hotkeypos != NOT_FOUND )
txtlength--;
if ( getHeight() >= 2 )
vcenter_offset = int((getHeight() - 1) / 2);
vcenter_offset = (getHeight() - 1) / 2;
else
vcenter_offset = 0;

View File

@ -504,7 +504,7 @@ void FButtonGroup::draw()
void FButtonGroup::drawLabel()
{
wchar_t* LabelText;
int hotkeypos;
std::size_t hotkeypos;
if ( text.isNull() || text.isEmpty() )
return;
@ -527,7 +527,7 @@ void FButtonGroup::drawLabel()
unsetViewportPrint();
hotkeypos = getHotkeyPos(src, dest, length);
if ( hotkeypos != -1 )
if ( hotkeypos != NOT_FOUND )
length--;
if ( hasBorder() )
@ -565,20 +565,20 @@ void FButtonGroup::init()
}
//----------------------------------------------------------------------
int FButtonGroup::getHotkeyPos ( wchar_t src[]
, wchar_t dest[]
, std::size_t length )
std::size_t FButtonGroup::getHotkeyPos ( wchar_t src[]
, wchar_t dest[]
, std::size_t length )
{
// find hotkey position in string
// + generate a new string without the '&'-sign
int pos = -1;
std::size_t pos = NOT_FOUND;
wchar_t* txt = src;
for (uInt i = 0; i < length; i++)
for (std::size_t i = 0; i < length; i++)
{
if ( i < length && txt[i] == L'&' && pos == -1 )
if ( i < length && txt[i] == L'&' && pos == NOT_FOUND )
{
pos = int(i);
pos = i;
i++;
src++;
}
@ -591,7 +591,7 @@ int FButtonGroup::getHotkeyPos ( wchar_t src[]
//----------------------------------------------------------------------
void FButtonGroup::drawText ( wchar_t LabelText[]
, int hotkeypos
, std::size_t hotkeypos
, std::size_t length )
{
bool isActive = ((flags & fc::active) != 0);
@ -605,7 +605,7 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
else
setColor(wc.label_inactive_fg, wc.label_inactive_bg);
for (int z = 0; z < int(length); z++)
for (std::size_t z = 0; z < length; z++)
{
if ( (z == hotkeypos) && isActive )
{
@ -614,7 +614,7 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
if ( ! isNoUnderline )
setUnderline();
print ( LabelText[z] );
print (LabelText[z]);
if ( ! isNoUnderline )
unsetUnderline();
@ -622,7 +622,7 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
setColor (wc.label_emphasis_fg, wc.label_bg);
}
else
print ( LabelText[z] );
print (LabelText[z]);
}
if ( isMonochron() )

View File

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

View File

@ -419,20 +419,20 @@ uChar FLabel::getHotkey()
}
//----------------------------------------------------------------------
int FLabel::getHotkeyPos ( wchar_t src[]
, wchar_t dest[]
, std::size_t length )
std::size_t FLabel::getHotkeyPos ( wchar_t src[]
, wchar_t dest[]
, std::size_t length )
{
// find hotkey position in string
// + generate a new string without the '&'-sign
int hotkeypos = -1;
std::size_t hotkeypos = NOT_FOUND;
wchar_t* txt = src;
for (std::size_t i = 0; i < length; i++)
{
if ( i < length && txt[i] == L'&' && hotkeypos == -1 )
if ( i < length && txt[i] == L'&' && hotkeypos == NOT_FOUND )
{
hotkeypos = int(i);
hotkeypos = i;
i++;
src++;
}
@ -446,7 +446,7 @@ int FLabel::getHotkeyPos ( wchar_t src[]
//----------------------------------------------------------------------
void FLabel::setHotkeyAccelerator()
{
int hotkey = getHotkey();
std::size_t hotkey = getHotkey();
if ( hotkey )
{
@ -476,7 +476,7 @@ std::size_t FLabel::getAlignOffset (std::size_t length)
case fc::alignCenter:
if ( length < width )
return std::size_t((width - length) / 2);
return (width - length) / 2;
else
return 0;
@ -531,7 +531,7 @@ void FLabel::drawMultiLine()
while ( y < text_lines && y < std::size_t(getHeight()) )
{
wchar_t* label_text;
int hotkeypos = -1;
std::size_t hotkeypos = NOT_FOUND;
std::size_t align_offset;
std::size_t length = multiline_text[y].getLength();
@ -555,7 +555,7 @@ void FLabel::drawMultiLine()
setPrintPos (1, 1 + int(y));
if ( hotkeypos != -1 )
if ( hotkeypos != NOT_FOUND )
{
align_offset = getAlignOffset(length - 1);
printLine (label_text, length - 1, hotkeypos, align_offset);
@ -564,7 +564,7 @@ void FLabel::drawMultiLine()
else
{
align_offset = getAlignOffset(length);
printLine (label_text, length, -1, align_offset);
printLine (label_text, length, NOT_FOUND, align_offset);
}
y++;
@ -576,7 +576,7 @@ void FLabel::drawMultiLine()
void FLabel::drawSingleLine()
{
wchar_t* label_text;
int hotkeypos = -1;
std::size_t hotkeypos = NOT_FOUND;
std::size_t align_offset;
std::size_t length = text.getLength();
@ -592,10 +592,10 @@ void FLabel::drawSingleLine()
hotkeypos = getHotkeyPos (text.wc_str(), label_text, length);
if ( hotkeypos != -1 )
if ( hotkeypos != NOT_FOUND )
length--;
setPrintPos (1,1);
setPrintPos (1, 1);
align_offset = getAlignOffset(length);
printLine (label_text, length, hotkeypos, align_offset);
delete[] label_text;
@ -604,8 +604,8 @@ void FLabel::drawSingleLine()
//----------------------------------------------------------------------
void FLabel::printLine ( wchar_t line[]
, std::size_t length
, int hotkeypos
, std::size_t align_offset )
, std::size_t hotkeypos
, std::size_t align_offset )
{
std::size_t to_char;
std::size_t width = std::size_t(getWidth());
@ -635,14 +635,14 @@ void FLabel::printLine ( wchar_t line[]
}
}
if ( (int(z) == hotkeypos) && isActive )
if ( z == hotkeypos && isActive )
{
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
if ( ! isNoUnderline )
setUnderline();
print ( line[z] );
print (line[z]);
if ( ! isNoUnderline )
unsetUnderline();
@ -653,7 +653,7 @@ void FLabel::printLine ( wchar_t line[]
setColor();
}
else
print ( line[z] );
print (line[z]);
}
if ( length > width )

View File

@ -308,7 +308,7 @@ void FLineEdit::hide()
try
{
blank = new char[std::size_t(size) + 1];
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
@ -316,12 +316,12 @@ void FLineEdit::hide()
return;
}
std::memset(blank, ' ', std::size_t(size));
std::memset(blank, ' ', size);
blank[size] = '\0';
for (int y = 0; y < int(getHeight() + s); y++)
for (std::size_t y = 0; y < getHeight() + s; y++)
{
setPrintPos (1, 1 + y);
setPrintPos (1, 1 + int(y));
print (blank);
}
@ -436,8 +436,8 @@ void FLineEdit::onMouseDown (FMouseEvent* ev)
if ( mouse_x >= 2 && mouse_x <= int(getWidth()) && mouse_y == 1 )
{
int len = int(text.getLength());
cursor_pos = int(text_offset) + mouse_x - 2;
std::size_t len = text.getLength();
cursor_pos = text_offset + std::size_t(mouse_x) - 2;
if ( cursor_pos >= len )
cursor_pos = len;
@ -461,18 +461,19 @@ void FLineEdit::onMouseUp (FMouseEvent*)
//----------------------------------------------------------------------
void FLineEdit::onMouseMove (FMouseEvent* ev)
{
int len, mouse_x, mouse_y;
std::size_t len;
int mouse_x, mouse_y;
if ( ev->getButton() != fc::LeftButton )
return;
len = int(text.getLength());
len = text.getLength();
mouse_x = ev->getX();
mouse_y = ev->getY();
if ( mouse_x >= 2 && mouse_x <= int(getWidth()) && mouse_y == 1 )
{
cursor_pos = int(text_offset) + mouse_x - 2;
cursor_pos = text_offset + std::size_t(mouse_x) - 2;
if ( cursor_pos >= len )
cursor_pos = len;
@ -501,14 +502,14 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
else if ( mouse_x >= int(getWidth()) )
{
// drag right
if ( ! scroll_timer && int(text_offset) <= len - int(getWidth()) + 1 )
if ( ! scroll_timer && text_offset <= len - getWidth() + 1 )
{
scroll_timer = true;
addTimer(scroll_repeat);
drag_scroll = FLineEdit::scrollRight;
}
if ( int(text_offset) == len - int(getWidth()) + 2 )
if ( text_offset == len - getWidth() + 2 )
{
delOwnTimer();
drag_scroll = FLineEdit::noScroll;
@ -526,7 +527,7 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
//----------------------------------------------------------------------
void FLineEdit::onTimer (FTimerEvent*)
{
int len = int(text.getLength());
std::size_t len = text.getLength();
switch ( int(drag_scroll) )
{
@ -549,13 +550,13 @@ void FLineEdit::onTimer (FTimerEvent*)
break;
case FLineEdit::scrollRight:
if ( int(text_offset) == len - int(getWidth()) + 2 )
if ( text_offset == len - getWidth() + 2 )
{
drag_scroll = FLineEdit::noScroll;
return;
}
if ( int(text_offset) <= len - int(getWidth()) + 1 )
if ( text_offset <= len - getWidth() + 1 )
text_offset++;
if ( cursor_pos < len )
@ -731,7 +732,7 @@ void FLineEdit::draw()
void FLineEdit::drawInputField()
{
bool isActiveFocus, isShadow;
int x;
std::size_t x;
FString show_text;
int active_focus = fc::active + fc::focus;
isActiveFocus = ((flags & active_focus) == active_focus);
@ -757,8 +758,7 @@ void FLineEdit::drawInputField()
if ( isActiveFocus && getMaxColor() < 16 )
setBold();
show_text = text.mid( std::size_t(1 + text_offset)
, std::size_t(getWidth() - 2) );
show_text = text.mid(1 + text_offset, getWidth() - 2);
if ( isLinuxTerm() && hasUTF8() )
{
@ -772,9 +772,9 @@ void FLineEdit::drawInputField()
else if ( show_text )
print (show_text);
x = int(show_text.getLength());
x = show_text.getLength();
while ( x < int(getWidth()) - 1 )
while ( x < getWidth() - 1 )
{
print (' ');
x++;
@ -793,7 +793,7 @@ void FLineEdit::drawInputField()
drawShadow ();
// set the cursor to the first pos.
setCursorPos (2 + cursor_pos - int(text_offset), 1);
setCursorPos (int(2 + cursor_pos - text_offset), 1);
}
//----------------------------------------------------------------------
@ -802,20 +802,20 @@ inline void FLineEdit::keyLeft()
if ( cursor_pos > 0 )
cursor_pos--;
if ( cursor_pos < int(text_offset) )
if ( cursor_pos < text_offset )
text_offset--;
}
//----------------------------------------------------------------------
inline void FLineEdit::keyRight()
{
int len = int(text.getLength());
std::size_t len = text.getLength();
if ( cursor_pos < len )
cursor_pos++;
if ( cursor_pos - int(text_offset) >= int(getWidth()) - 2
&& int(text_offset) <= len - int(getWidth()) + 1 )
if ( cursor_pos - text_offset >= getWidth() - 2
&& text_offset <= len - getWidth() + 1 )
text_offset++;
}
@ -830,9 +830,9 @@ inline void FLineEdit::keyHome()
inline void FLineEdit::keyEnd()
{
std::size_t len = text.getLength();
cursor_pos = int(len);
cursor_pos = len;
if ( cursor_pos >= int(getWidth()) - 1 )
if ( cursor_pos >= getWidth() - 1 )
text_offset = len - getWidth() + 2;
}
@ -841,20 +841,16 @@ inline void FLineEdit::keyDel()
{
std::size_t len = text.getLength();
if ( len > 0 && std::size_t(cursor_pos) < len )
if ( len > 0 && cursor_pos < len )
{
text.remove(std::size_t(cursor_pos), 1);
text.remove(cursor_pos, 1);
processChanged();
}
if ( cursor_pos >= int(len) )
cursor_pos = int(len);
if ( cursor_pos >= len )
cursor_pos = len;
if ( cursor_pos < 0 )
cursor_pos = 0;
if ( text_offset > 0
&& len - std::size_t(text_offset) < std::size_t(getWidth()) - 1 )
if ( text_offset > 0 && len - text_offset < getWidth() - 1 )
text_offset--;
}
@ -863,7 +859,7 @@ inline void FLineEdit::keyBackspace()
{
if ( text.getLength() > 0 && cursor_pos > 0 )
{
text.remove(std::size_t(cursor_pos) - 1, 1);
text.remove(cursor_pos - 1, 1);
processChanged();
cursor_pos--;
@ -896,7 +892,7 @@ inline bool FLineEdit::keyInput (int key)
{
std::size_t len = text.getLength();
if ( std::size_t(cursor_pos) == len )
if ( cursor_pos == len )
{
text += wchar_t(key);
processChanged();
@ -904,9 +900,9 @@ inline bool FLineEdit::keyInput (int key)
else if ( len > 0 )
{
if ( insert_mode )
text.insert(wchar_t(key), std::size_t(cursor_pos));
text.insert(wchar_t(key), cursor_pos);
else
text.overwrite(wchar_t(key), std::size_t(cursor_pos));
text.overwrite(wchar_t(key), cursor_pos);
processChanged();
}
@ -915,9 +911,10 @@ inline bool FLineEdit::keyInput (int key)
text = wchar_t(key);
processChanged();
}
cursor_pos++;
if ( cursor_pos >= int(getWidth()) - 1 )
if ( cursor_pos >= getWidth() - 1 )
text_offset++;
return true;

View File

@ -395,7 +395,7 @@ void FListViewItem::replaceControlCodes()
}
//----------------------------------------------------------------------
int FListViewItem::getVisibleLines()
std::size_t FListViewItem::getVisibleLines()
{
if ( visible_lines > 1 )
return visible_lines;
@ -1670,7 +1670,7 @@ void FListView::drawListLine ( const FListViewItem* item
// Insert text and trailing space
line += text.left(width);
line += FString ( leading_space + width
- align_offset + txt_length, L' ');
- align_offset - txt_length, L' ');
}
else if ( align == fc::alignRight )
{

View File

@ -305,7 +305,7 @@ void FMessageBox::adjustSize()
//----------------------------------------------------------------------
void FMessageBox::cb_processClick (FWidget*, data_ptr data)
{
int* reply = static_cast<int*>(data);
FDialog::DialogCode* reply = static_cast<FDialog::DialogCode*>(data);
done (*reply);
}

View File

@ -148,7 +148,7 @@ void FScrollView::setScrollSize (std::size_t width, std::size_t height)
setTopPadding (1 - getScrollY());
setLeftPadding (1 - getScrollX());
setBottomPadding (1 - (yoffset_end - getScrollY()));
setRightPadding (1 - (xoffset_end - getScrollX()) + nf_offset);
setRightPadding (1 - (xoffset_end - getScrollX()) + int(nf_offset));
hbar->setMaximum (int(width - getViewportWidth()));
hbar->setPageSize (int(width), int(getViewportWidth()));
@ -216,7 +216,7 @@ void FScrollView::setPos (int x, int y, bool adjust)
void FScrollView::setWidth (std::size_t w, bool adjust)
{
FWidget::setWidth (w, adjust);
viewport_geometry.setWidth(w - vertical_border_spacing - std::size_t(nf_offset));
viewport_geometry.setWidth(w - vertical_border_spacing - nf_offset);
calculateScrollbarPos();
if ( getScrollWidth() < getViewportWidth() )
@ -238,7 +238,7 @@ void FScrollView::setHeight (std::size_t h, bool adjust)
void FScrollView::setSize (std::size_t w, std::size_t h, bool adjust)
{
FWidget::setSize (w, h, adjust);
viewport_geometry.setSize ( w - vertical_border_spacing - std::size_t(nf_offset)
viewport_geometry.setSize ( w - vertical_border_spacing - nf_offset
, h - horizontal_border_spacing );
calculateScrollbarPos();
@ -248,14 +248,16 @@ void FScrollView::setSize (std::size_t w, std::size_t h, bool adjust)
}
//----------------------------------------------------------------------
void FScrollView::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
void FScrollView::setGeometry ( int x, int y
, std::size_t w, std::size_t h
, bool adjust )
{
// Set the scroll view geometry
FWidget::setGeometry (x, y, w, h, adjust);
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
, getTermY() + getTopPadding() - 1 );
viewport_geometry.setSize ( w - vertical_border_spacing - std::size_t(nf_offset)
viewport_geometry.setSize ( w - vertical_border_spacing - nf_offset
, h - horizontal_border_spacing );
calculateScrollbarPos();
@ -372,7 +374,7 @@ void FScrollView::scrollTo (int x, int y)
{
viewport_geometry.setWidth(save_width);
setLeftPadding (1 - xoffset);
setRightPadding (1 - (xoffset_end - xoffset) + nf_offset);
setRightPadding (1 - (xoffset_end - xoffset) + short(nf_offset));
if ( update_scrollbar )
{

View File

@ -45,7 +45,7 @@ FSwitch::FSwitch (const FString& txt, FWidget* parent)
, switch_offset_pos(0)
, button_pressed(false)
{
switch_offset_pos = int(txt.getLength()) + 1;
switch_offset_pos = txt.getLength() + 1;
button_width = 11;
}
@ -59,7 +59,7 @@ FSwitch::~FSwitch() // destructor
void FSwitch::setText (const FString& txt)
{
FToggleButton::setText(txt);
switch_offset_pos = int(txt.getLength()) + 1;
switch_offset_pos = txt.getLength() + 1;
}
//----------------------------------------------------------------------
@ -131,7 +131,7 @@ void FSwitch::drawCheckButton()
if ( ! isVisible() )
return;
setPrintPos (1 + switch_offset_pos, 1);
setPrintPos (1 + int(switch_offset_pos), 1);
if ( checked )
drawChecked();
@ -185,7 +185,7 @@ void FSwitch::drawChecked()
if ( isMonochron() )
setReverse(false);
setCursorPos (3 + switch_offset_pos, 1);
setCursorPos (3 + int(switch_offset_pos), 1);
}
//----------------------------------------------------------------------
@ -232,7 +232,7 @@ void FSwitch::drawUnchecked()
if ( isMonochron() || getMaxColor() < 16 )
setBold(false);
setCursorPos (7 + switch_offset_pos, 1);
setCursorPos (7 + int(switch_offset_pos), 1);
}
} // namespace finalcut

View File

@ -500,7 +500,7 @@ void FToggleButton::draw()
void FToggleButton::drawLabel()
{
wchar_t* LabelText;
int hotkeypos;
std::size_t hotkeypos;
if ( ! isVisible() )
return;
@ -525,7 +525,7 @@ void FToggleButton::drawLabel()
wchar_t* dest = const_cast<wchar_t*>(LabelText);
hotkeypos = getHotkeyPos(src, dest, length);
if ( hotkeypos != -1 )
if ( hotkeypos != NOT_FOUND )
length--;
setPrintPos (1 + int(label_offset_pos), 1);
@ -636,20 +636,20 @@ void FToggleButton::init()
}
//----------------------------------------------------------------------
int FToggleButton::getHotkeyPos ( wchar_t src[]
std::size_t FToggleButton::getHotkeyPos ( wchar_t src[]
, wchar_t dest[]
, std::size_t length )
{
// find hotkey position in string
// + generate a new string without the '&'-sign
int pos = -1;
std::size_t pos = NOT_FOUND;
wchar_t* txt = src;
for (std::size_t i = 0; i < length; i++)
{
if ( i < length && txt[i] == L'&' && pos == -1 )
if ( i < length && txt[i] == L'&' && pos == NOT_FOUND )
{
pos = int(i);
pos = i;
i++;
src++;
}
@ -662,7 +662,7 @@ int FToggleButton::getHotkeyPos ( wchar_t src[]
//----------------------------------------------------------------------
void FToggleButton::drawText ( wchar_t LabelText[]
, int hotkeypos
, std::size_t hotkeypos
, std::size_t length )
{
bool isActive = ((flags & fc::active) != 0);
@ -676,7 +676,7 @@ void FToggleButton::drawText ( wchar_t LabelText[]
else
setColor (wc.label_inactive_fg, wc.label_inactive_bg);
for (int z = 0; z < int(length); z++)
for (std::size_t z = 0; z < length; z++)
{
if ( (z == hotkeypos) && isActive )
{

View File

@ -130,6 +130,9 @@ class FButton : public FWidget
virtual void onFocusOut (FFocusEvent*);
private:
// Constants
static const std::size_t NOT_FOUND = static_cast<std::size_t>(-1);
// Disable copy constructor
FButton (const FButton&);
@ -142,8 +145,8 @@ class FButton : public FWidget
uChar getHotkey();
void setHotkeyAccelerator();
void detectHotkey();
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
int clickAnimationIndent (FWidget*);
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
std::size_t clickAnimationIndent (FWidget*);
void clearRightMargin (FWidget*);
void drawMarginLeft();
void drawMarginRight();
@ -159,12 +162,12 @@ class FButton : public FWidget
bool button_down;
bool click_animation;
int click_time;
int indent;
int space;
int center_offset;
int vcenter_offset;
int txtlength;
int hotkeypos;
int space_char;
std::size_t hotkeypos;
std::size_t indent;
std::size_t center_offset;
std::size_t vcenter_offset;
std::size_t txtlength;
short button_fg;
short button_bg;
short button_hotkey_fg;

View File

@ -125,6 +125,9 @@ class FButtonGroup : public FScrollView
void drawLabel();
private:
// Constants
static const std::size_t NOT_FOUND = static_cast<std::size_t>(-1);
// Disable copy constructor
FButtonGroup (const FButtonGroup&);
@ -136,8 +139,8 @@ class FButtonGroup : public FScrollView
// Methods
void init();
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
void drawText (wchar_t[], int, std::size_t);
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
void drawText (wchar_t[], std::size_t, std::size_t);
void directFocus();
// Data Members

View File

@ -117,7 +117,7 @@ class FDialog : public FWindow
// Methods
virtual void show();
virtual void hide();
int exec();
DialogCode 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 (int);
virtual void done (DialogCode);
virtual void draw();
void drawDialogShadow();
@ -223,7 +223,7 @@ class FDialog : public FWindow
// Data Members
FString tb_text; // title bar text
int result_code;
DialogCode result_code;
bool zoom_button_pressed;
bool zoom_button_active;
bool setPos_error;

View File

@ -131,6 +131,9 @@ class FLabel : public FWidget
void cb_accel_widget_destroyed (FWidget*, data_ptr);
private:
// Constants
static const std::size_t NOT_FOUND = static_cast<std::size_t>(-1);
// Disable copy constructor
FLabel (const FLabel&);
@ -140,13 +143,14 @@ class FLabel : public FWidget
// Methods
void init();
uChar getHotkey();
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
void setHotkeyAccelerator();
std::size_t getAlignOffset (std::size_t);
virtual void draw();
void drawMultiLine();
void drawSingleLine();
void printLine (wchar_t[], std::size_t, int, std::size_t = 0);
void printLine ( wchar_t[], std::size_t
, std::size_t, std::size_t = 0 );
// Data Members
FStringList multiline_text;

View File

@ -178,7 +178,7 @@ class FLineEdit : public FWidget
bool scroll_timer;
int scroll_repeat;
bool insert_mode;
int cursor_pos;
std::size_t cursor_pos;
std::size_t text_offset;
};
#pragma pack(pop)

View File

@ -119,14 +119,14 @@ class FListViewItem : public FObject
void sort (Compare);
FObjectIterator appendItem (FListViewItem*);
void replaceControlCodes();
int getVisibleLines();
std::size_t getVisibleLines();
void resetVisibleLineCounter();
// Data Members
FStringList column_list;
FWidget::data_ptr data_pointer;
FObjectIterator root;
int visible_lines;
std::size_t visible_lines;
bool expandable;
bool is_expand;

View File

@ -82,7 +82,7 @@ class FMessageBox : public FDialog
{
public:
// Enumeration
enum
enum ButtonType
{
Reject = 0,
Ok = 1,

View File

@ -179,7 +179,7 @@ class FScrollView : public FWidget
term_area* viewport; // virtual scroll content
FScrollbar* vbar;
FScrollbar* hbar;
int nf_offset;
uInt8 nf_offset;
bool border;
bool use_own_print_area;
bool update_scrollbar;

View File

@ -104,7 +104,7 @@ class FSwitch : public FToggleButton
void drawUnchecked();
// Data Members
int switch_offset_pos;
std::size_t switch_offset_pos;
bool button_pressed;
};
#pragma pack(pop)

View File

@ -72,7 +72,7 @@ class FTermBuffer
// Accessors
virtual const char* getClassName() const;
int getLength() const;
std::size_t getLength() const;
// Inquiry
bool isEmpty() const;
@ -107,8 +107,8 @@ inline const char* FTermBuffer::getClassName() const
{ return "FTermBuffer"; }
//----------------------------------------------------------------------
inline int FTermBuffer::getLength() const
{ return int(data.size()); }
inline std::size_t FTermBuffer::getLength() const
{ return data.size(); }
//----------------------------------------------------------------------
inline bool FTermBuffer::isEmpty() const

View File

@ -143,6 +143,9 @@ class FToggleButton : public FWidget
std::size_t button_width; // plus margin spaces
private:
// Constants
static const std::size_t NOT_FOUND = static_cast<std::size_t>(-1);
// Disable copy constructor
FToggleButton (const FToggleButton&);
@ -154,8 +157,8 @@ class FToggleButton : public FWidget
// Methods
void init();
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
void drawText (wchar_t[], int, std::size_t);
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
void drawText (wchar_t[], std::size_t , std::size_t);
// Friend classes
friend class FButtonGroup;