Changed more variables from int to std::size_t
This commit is contained in:
parent
4fac4627cd
commit
94e00051c5
|
@ -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>
|
2018-10-14 Markus Gans <guru.mail@muenster.de>
|
||||||
* A width or height can not be negative.
|
* 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
|
* FString fix for 32-bit architectures
|
||||||
|
|
||||||
2018-10-13 Markus Gans <guru.mail@muenster.de>
|
2018-10-13 Markus Gans <guru.mail@muenster.de>
|
||||||
|
|
|
@ -39,12 +39,12 @@ FButton::FButton(FWidget* parent)
|
||||||
, button_down(false)
|
, button_down(false)
|
||||||
, click_animation(true)
|
, click_animation(true)
|
||||||
, click_time(150)
|
, click_time(150)
|
||||||
|
, space_char(int(' '))
|
||||||
|
, hotkeypos(NOT_FOUND)
|
||||||
, indent(0)
|
, indent(0)
|
||||||
, space(int(' '))
|
|
||||||
, center_offset(0)
|
, center_offset(0)
|
||||||
, vcenter_offset(0)
|
, vcenter_offset(0)
|
||||||
, txtlength(0)
|
, txtlength(0)
|
||||||
, hotkeypos(-1)
|
|
||||||
, button_fg(wc.button_active_fg)
|
, button_fg(wc.button_active_fg)
|
||||||
, button_bg(wc.button_active_bg)
|
, button_bg(wc.button_active_bg)
|
||||||
, button_hotkey_fg(wc.button_hotkey_fg)
|
, button_hotkey_fg(wc.button_hotkey_fg)
|
||||||
|
@ -64,12 +64,12 @@ FButton::FButton (const FString& txt, FWidget* parent)
|
||||||
, button_down(false)
|
, button_down(false)
|
||||||
, click_animation(true)
|
, click_animation(true)
|
||||||
, click_time(150)
|
, click_time(150)
|
||||||
|
, space_char(int(' '))
|
||||||
|
, hotkeypos(NOT_FOUND)
|
||||||
, indent(0)
|
, indent(0)
|
||||||
, space(int(' '))
|
|
||||||
, center_offset(0)
|
, center_offset(0)
|
||||||
, vcenter_offset(0)
|
, vcenter_offset(0)
|
||||||
, txtlength(0)
|
, txtlength(0)
|
||||||
, hotkeypos(-1)
|
|
||||||
, button_fg(wc.button_active_fg)
|
, button_fg(wc.button_active_fg)
|
||||||
, button_bg(wc.button_active_bg)
|
, button_bg(wc.button_active_bg)
|
||||||
, button_hotkey_fg(wc.button_hotkey_fg)
|
, button_hotkey_fg(wc.button_hotkey_fg)
|
||||||
|
@ -542,20 +542,20 @@ inline void FButton::detectHotkey()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FButton::getHotkeyPos ( wchar_t src[]
|
std::size_t FButton::getHotkeyPos ( wchar_t src[]
|
||||||
, wchar_t dest[]
|
, wchar_t dest[]
|
||||||
, std::size_t length )
|
, std::size_t length )
|
||||||
{
|
{
|
||||||
// find hotkey position in string
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
int pos = -1;
|
|
||||||
wchar_t* txt = src;
|
wchar_t* txt = src;
|
||||||
|
std::size_t pos = NOT_FOUND;
|
||||||
|
|
||||||
for (std::size_t 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++;
|
i++;
|
||||||
src++;
|
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 )
|
if ( ! button_down || ! click_animation )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -582,9 +582,9 @@ inline int FButton::clickAnimationIndent (FWidget* parent_widget)
|
||||||
setColor ( parent_widget->getForegroundColor()
|
setColor ( parent_widget->getForegroundColor()
|
||||||
, parent_widget->getBackgroundColor() );
|
, 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 █
|
print (' '); // clear one left █
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,14 +622,14 @@ inline void FButton::drawMarginLeft()
|
||||||
|
|
||||||
setColor (getForegroundColor(), button_bg);
|
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 )
|
if ( isMonochron() && is.active_focus && y == vcenter_offset )
|
||||||
print (fc::BlackRightPointingPointer); // ►
|
print (fc::BlackRightPointingPointer); // ►
|
||||||
else
|
else
|
||||||
print (space); // full block █
|
print (space_char); // full block █
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -638,14 +638,14 @@ inline void FButton::drawMarginRight()
|
||||||
{
|
{
|
||||||
// Print right margin
|
// 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 )
|
if ( isMonochron() && is.active_focus && y == vcenter_offset )
|
||||||
print (fc::BlackLeftPointingPointer); // ◄
|
print (fc::BlackLeftPointingPointer); // ◄
|
||||||
else
|
else
|
||||||
print (space); // full block █
|
print (space_char); // full block █
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,41 +657,41 @@ inline void FButton::drawTopBottomBackground()
|
||||||
if ( getHeight() < 2 )
|
if ( getHeight() < 2 )
|
||||||
return;
|
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++)
|
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++)
|
for (std::size_t x = 1; x < getWidth() - 1; x++)
|
||||||
print (space); // █
|
print (space_char); // █
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
{
|
{
|
||||||
int pos;
|
std::size_t pos;
|
||||||
center_offset = int((int(getWidth()) - txtlength - 1) / 2);
|
center_offset = (getWidth() - txtlength - 1) / 2;
|
||||||
setPrintPos (2 + indent, 1 + vcenter_offset);
|
setPrintPos (2 + int(indent), 1 + int(vcenter_offset));
|
||||||
setColor (button_fg, button_bg);
|
setColor (button_fg, button_bg);
|
||||||
|
|
||||||
// Print button text line --------
|
// Print button text line --------
|
||||||
for (pos = 0; pos < center_offset; pos++)
|
for (pos = 0; pos < center_offset; pos++)
|
||||||
print (space); // █
|
print (space_char); // █
|
||||||
|
|
||||||
if ( hotkeypos == -1 )
|
if ( hotkeypos == NOT_FOUND )
|
||||||
setCursorPos ( 2 + center_offset
|
setCursorPos ( 2 + int(center_offset)
|
||||||
, 1 + vcenter_offset ); // first character
|
, 1 + int(vcenter_offset) ); // first character
|
||||||
else
|
else
|
||||||
setCursorPos ( 2 + center_offset + hotkeypos
|
setCursorPos ( 2 + int(center_offset) + hotkeypos
|
||||||
, 1 + vcenter_offset ); // hotkey
|
, 1 + int(vcenter_offset) ); // hotkey
|
||||||
|
|
||||||
if ( ! is.active && isMonochron() )
|
if ( ! is.active && isMonochron() )
|
||||||
setReverse(true); // Light background
|
setReverse(true); // Light background
|
||||||
|
@ -699,11 +699,11 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
if ( is.active_focus && (isMonochron() || getMaxColor() < 16) )
|
if ( is.active_focus && (isMonochron() || getMaxColor() < 16) )
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
for ( int z = 0
|
for ( std::size_t z = 0
|
||||||
; pos < center_offset + txtlength && z < int(getWidth()) - 2
|
; pos < center_offset + txtlength && z < getWidth() - 2
|
||||||
; z++, pos++)
|
; z++, pos++)
|
||||||
{
|
{
|
||||||
if ( (z == hotkeypos) && is.active )
|
if ( z == hotkeypos && is.active )
|
||||||
{
|
{
|
||||||
setColor (button_hotkey_fg, button_bg);
|
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
|
// Print ellipsis
|
||||||
setPrintPos (int(getWidth()) + indent - 2, 1);
|
setPrintPos (int(getWidth() + indent) - 2, 1);
|
||||||
print (L"..");
|
print (L"..");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is.active_focus && (isMonochron() || getMaxColor() < 16) )
|
if ( is.active_focus && (isMonochron() || getMaxColor() < 16) )
|
||||||
unsetBold();
|
unsetBold();
|
||||||
|
|
||||||
for (pos = center_offset + txtlength; pos < int(getWidth()) - 2; pos++)
|
for (pos = center_offset + txtlength; pos < getWidth() - 2; pos++)
|
||||||
print (space); // █
|
print (space_char); // █
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -748,13 +748,13 @@ void FButton::draw()
|
||||||
{
|
{
|
||||||
wchar_t* button_text;
|
wchar_t* button_text;
|
||||||
FWidget* parent_widget = getParentWidget();
|
FWidget* parent_widget = getParentWidget();
|
||||||
txtlength = int(text.getLength());
|
txtlength = text.getLength();
|
||||||
space = int(' ');
|
space_char = int(' ');
|
||||||
getButtonState();
|
getButtonState();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
button_text = new wchar_t[std::size_t(txtlength) + 1]();
|
button_text = new wchar_t[txtlength + 1]();
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -772,7 +772,7 @@ void FButton::draw()
|
||||||
clearRightMargin (parent_widget);
|
clearRightMargin (parent_widget);
|
||||||
|
|
||||||
if ( ! is.active && isMonochron() )
|
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) )
|
if ( isMonochron() && (is.active || is.focus) )
|
||||||
setReverse(false); // Dark background
|
setReverse(false); // Dark background
|
||||||
|
@ -782,11 +782,11 @@ void FButton::draw()
|
||||||
|
|
||||||
hotkeypos = getHotkeyPos(text.wc_str(), button_text, uInt(txtlength));
|
hotkeypos = getHotkeyPos(text.wc_str(), button_text, uInt(txtlength));
|
||||||
|
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != NOT_FOUND )
|
||||||
txtlength--;
|
txtlength--;
|
||||||
|
|
||||||
if ( getHeight() >= 2 )
|
if ( getHeight() >= 2 )
|
||||||
vcenter_offset = int((getHeight() - 1) / 2);
|
vcenter_offset = (getHeight() - 1) / 2;
|
||||||
else
|
else
|
||||||
vcenter_offset = 0;
|
vcenter_offset = 0;
|
||||||
|
|
||||||
|
|
|
@ -504,7 +504,7 @@ void FButtonGroup::draw()
|
||||||
void FButtonGroup::drawLabel()
|
void FButtonGroup::drawLabel()
|
||||||
{
|
{
|
||||||
wchar_t* LabelText;
|
wchar_t* LabelText;
|
||||||
int hotkeypos;
|
std::size_t hotkeypos;
|
||||||
|
|
||||||
if ( text.isNull() || text.isEmpty() )
|
if ( text.isNull() || text.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
@ -527,7 +527,7 @@ void FButtonGroup::drawLabel()
|
||||||
unsetViewportPrint();
|
unsetViewportPrint();
|
||||||
hotkeypos = getHotkeyPos(src, dest, length);
|
hotkeypos = getHotkeyPos(src, dest, length);
|
||||||
|
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != NOT_FOUND )
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
if ( hasBorder() )
|
if ( hasBorder() )
|
||||||
|
@ -565,20 +565,20 @@ void FButtonGroup::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FButtonGroup::getHotkeyPos ( wchar_t src[]
|
std::size_t FButtonGroup::getHotkeyPos ( wchar_t src[]
|
||||||
, wchar_t dest[]
|
, wchar_t dest[]
|
||||||
, std::size_t length )
|
, std::size_t length )
|
||||||
{
|
{
|
||||||
// find hotkey position in string
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
int pos = -1;
|
std::size_t pos = NOT_FOUND;
|
||||||
wchar_t* txt = src;
|
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++;
|
i++;
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
|
@ -591,7 +591,7 @@ int FButtonGroup::getHotkeyPos ( wchar_t src[]
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButtonGroup::drawText ( wchar_t LabelText[]
|
void FButtonGroup::drawText ( wchar_t LabelText[]
|
||||||
, int hotkeypos
|
, std::size_t hotkeypos
|
||||||
, std::size_t length )
|
, std::size_t length )
|
||||||
{
|
{
|
||||||
bool isActive = ((flags & fc::active) != 0);
|
bool isActive = ((flags & fc::active) != 0);
|
||||||
|
@ -605,7 +605,7 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
|
||||||
else
|
else
|
||||||
setColor(wc.label_inactive_fg, wc.label_inactive_bg);
|
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 )
|
if ( (z == hotkeypos) && isActive )
|
||||||
{
|
{
|
||||||
|
|
|
@ -193,7 +193,7 @@ void FDialog::hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FDialog::exec()
|
FDialog::DialogCode FDialog::exec()
|
||||||
{
|
{
|
||||||
result_code = FDialog::Reject;
|
result_code = FDialog::Reject;
|
||||||
show();
|
show();
|
||||||
|
@ -809,7 +809,7 @@ void FDialog::onWindowLowered (FEvent*)
|
||||||
|
|
||||||
// protected methods of FDialog
|
// protected methods of FDialog
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::done(int result)
|
void FDialog::done(DialogCode result)
|
||||||
{
|
{
|
||||||
hide();
|
hide();
|
||||||
result_code = result;
|
result_code = result;
|
||||||
|
|
|
@ -419,20 +419,20 @@ uChar FLabel::getHotkey()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FLabel::getHotkeyPos ( wchar_t src[]
|
std::size_t FLabel::getHotkeyPos ( wchar_t src[]
|
||||||
, wchar_t dest[]
|
, wchar_t dest[]
|
||||||
, std::size_t length )
|
, std::size_t length )
|
||||||
{
|
{
|
||||||
// find hotkey position in string
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
int hotkeypos = -1;
|
std::size_t hotkeypos = NOT_FOUND;
|
||||||
wchar_t* txt = src;
|
wchar_t* txt = src;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < length; i++)
|
for (std::size_t i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
if ( i < length && txt[i] == L'&' && hotkeypos == -1 )
|
if ( i < length && txt[i] == L'&' && hotkeypos == NOT_FOUND )
|
||||||
{
|
{
|
||||||
hotkeypos = int(i);
|
hotkeypos = i;
|
||||||
i++;
|
i++;
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ int FLabel::getHotkeyPos ( wchar_t src[]
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLabel::setHotkeyAccelerator()
|
void FLabel::setHotkeyAccelerator()
|
||||||
{
|
{
|
||||||
int hotkey = getHotkey();
|
std::size_t hotkey = getHotkey();
|
||||||
|
|
||||||
if ( hotkey )
|
if ( hotkey )
|
||||||
{
|
{
|
||||||
|
@ -476,7 +476,7 @@ std::size_t FLabel::getAlignOffset (std::size_t length)
|
||||||
|
|
||||||
case fc::alignCenter:
|
case fc::alignCenter:
|
||||||
if ( length < width )
|
if ( length < width )
|
||||||
return std::size_t((width - length) / 2);
|
return (width - length) / 2;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ void FLabel::drawMultiLine()
|
||||||
while ( y < text_lines && y < std::size_t(getHeight()) )
|
while ( y < text_lines && y < std::size_t(getHeight()) )
|
||||||
{
|
{
|
||||||
wchar_t* label_text;
|
wchar_t* label_text;
|
||||||
int hotkeypos = -1;
|
std::size_t hotkeypos = NOT_FOUND;
|
||||||
std::size_t align_offset;
|
std::size_t align_offset;
|
||||||
std::size_t length = multiline_text[y].getLength();
|
std::size_t length = multiline_text[y].getLength();
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ void FLabel::drawMultiLine()
|
||||||
|
|
||||||
setPrintPos (1, 1 + int(y));
|
setPrintPos (1, 1 + int(y));
|
||||||
|
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != NOT_FOUND )
|
||||||
{
|
{
|
||||||
align_offset = getAlignOffset(length - 1);
|
align_offset = getAlignOffset(length - 1);
|
||||||
printLine (label_text, length - 1, hotkeypos, align_offset);
|
printLine (label_text, length - 1, hotkeypos, align_offset);
|
||||||
|
@ -564,7 +564,7 @@ void FLabel::drawMultiLine()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
align_offset = getAlignOffset(length);
|
align_offset = getAlignOffset(length);
|
||||||
printLine (label_text, length, -1, align_offset);
|
printLine (label_text, length, NOT_FOUND, align_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
y++;
|
y++;
|
||||||
|
@ -576,7 +576,7 @@ void FLabel::drawMultiLine()
|
||||||
void FLabel::drawSingleLine()
|
void FLabel::drawSingleLine()
|
||||||
{
|
{
|
||||||
wchar_t* label_text;
|
wchar_t* label_text;
|
||||||
int hotkeypos = -1;
|
std::size_t hotkeypos = NOT_FOUND;
|
||||||
std::size_t align_offset;
|
std::size_t align_offset;
|
||||||
std::size_t length = text.getLength();
|
std::size_t length = text.getLength();
|
||||||
|
|
||||||
|
@ -592,7 +592,7 @@ void FLabel::drawSingleLine()
|
||||||
|
|
||||||
hotkeypos = getHotkeyPos (text.wc_str(), label_text, length);
|
hotkeypos = getHotkeyPos (text.wc_str(), label_text, length);
|
||||||
|
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != NOT_FOUND )
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
setPrintPos (1, 1);
|
setPrintPos (1, 1);
|
||||||
|
@ -604,7 +604,7 @@ void FLabel::drawSingleLine()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLabel::printLine ( wchar_t line[]
|
void FLabel::printLine ( wchar_t line[]
|
||||||
, std::size_t length
|
, std::size_t length
|
||||||
, int hotkeypos
|
, std::size_t hotkeypos
|
||||||
, std::size_t align_offset )
|
, std::size_t align_offset )
|
||||||
{
|
{
|
||||||
std::size_t to_char;
|
std::size_t to_char;
|
||||||
|
@ -635,7 +635,7 @@ void FLabel::printLine ( wchar_t line[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (int(z) == hotkeypos) && isActive )
|
if ( z == hotkeypos && isActive )
|
||||||
{
|
{
|
||||||
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
|
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,7 @@ void FLineEdit::hide()
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
blank = new char[std::size_t(size) + 1];
|
blank = new char[size + 1];
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -316,12 +316,12 @@ void FLineEdit::hide()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset(blank, ' ', std::size_t(size));
|
std::memset(blank, ' ', size);
|
||||||
blank[size] = '\0';
|
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);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,8 +436,8 @@ void FLineEdit::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( mouse_x >= 2 && mouse_x <= int(getWidth()) && mouse_y == 1 )
|
if ( mouse_x >= 2 && mouse_x <= int(getWidth()) && mouse_y == 1 )
|
||||||
{
|
{
|
||||||
int len = int(text.getLength());
|
std::size_t len = text.getLength();
|
||||||
cursor_pos = int(text_offset) + mouse_x - 2;
|
cursor_pos = text_offset + std::size_t(mouse_x) - 2;
|
||||||
|
|
||||||
if ( cursor_pos >= len )
|
if ( cursor_pos >= len )
|
||||||
cursor_pos = len;
|
cursor_pos = len;
|
||||||
|
@ -461,18 +461,19 @@ void FLineEdit::onMouseUp (FMouseEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::onMouseMove (FMouseEvent* ev)
|
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 )
|
if ( ev->getButton() != fc::LeftButton )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
len = int(text.getLength());
|
len = text.getLength();
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x >= 2 && mouse_x <= int(getWidth()) && mouse_y == 1 )
|
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 )
|
if ( cursor_pos >= len )
|
||||||
cursor_pos = len;
|
cursor_pos = len;
|
||||||
|
@ -501,14 +502,14 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
|
||||||
else if ( mouse_x >= int(getWidth()) )
|
else if ( mouse_x >= int(getWidth()) )
|
||||||
{
|
{
|
||||||
// drag right
|
// drag right
|
||||||
if ( ! scroll_timer && int(text_offset) <= len - int(getWidth()) + 1 )
|
if ( ! scroll_timer && text_offset <= len - getWidth() + 1 )
|
||||||
{
|
{
|
||||||
scroll_timer = true;
|
scroll_timer = true;
|
||||||
addTimer(scroll_repeat);
|
addTimer(scroll_repeat);
|
||||||
drag_scroll = FLineEdit::scrollRight;
|
drag_scroll = FLineEdit::scrollRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( int(text_offset) == len - int(getWidth()) + 2 )
|
if ( text_offset == len - getWidth() + 2 )
|
||||||
{
|
{
|
||||||
delOwnTimer();
|
delOwnTimer();
|
||||||
drag_scroll = FLineEdit::noScroll;
|
drag_scroll = FLineEdit::noScroll;
|
||||||
|
@ -526,7 +527,7 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::onTimer (FTimerEvent*)
|
void FLineEdit::onTimer (FTimerEvent*)
|
||||||
{
|
{
|
||||||
int len = int(text.getLength());
|
std::size_t len = text.getLength();
|
||||||
|
|
||||||
switch ( int(drag_scroll) )
|
switch ( int(drag_scroll) )
|
||||||
{
|
{
|
||||||
|
@ -549,13 +550,13 @@ void FLineEdit::onTimer (FTimerEvent*)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FLineEdit::scrollRight:
|
case FLineEdit::scrollRight:
|
||||||
if ( int(text_offset) == len - int(getWidth()) + 2 )
|
if ( text_offset == len - getWidth() + 2 )
|
||||||
{
|
{
|
||||||
drag_scroll = FLineEdit::noScroll;
|
drag_scroll = FLineEdit::noScroll;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( int(text_offset) <= len - int(getWidth()) + 1 )
|
if ( text_offset <= len - getWidth() + 1 )
|
||||||
text_offset++;
|
text_offset++;
|
||||||
|
|
||||||
if ( cursor_pos < len )
|
if ( cursor_pos < len )
|
||||||
|
@ -731,7 +732,7 @@ void FLineEdit::draw()
|
||||||
void FLineEdit::drawInputField()
|
void FLineEdit::drawInputField()
|
||||||
{
|
{
|
||||||
bool isActiveFocus, isShadow;
|
bool isActiveFocus, isShadow;
|
||||||
int x;
|
std::size_t x;
|
||||||
FString show_text;
|
FString show_text;
|
||||||
int active_focus = fc::active + fc::focus;
|
int active_focus = fc::active + fc::focus;
|
||||||
isActiveFocus = ((flags & active_focus) == active_focus);
|
isActiveFocus = ((flags & active_focus) == active_focus);
|
||||||
|
@ -757,8 +758,7 @@ void FLineEdit::drawInputField()
|
||||||
if ( isActiveFocus && getMaxColor() < 16 )
|
if ( isActiveFocus && getMaxColor() < 16 )
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
show_text = text.mid( std::size_t(1 + text_offset)
|
show_text = text.mid(1 + text_offset, getWidth() - 2);
|
||||||
, std::size_t(getWidth() - 2) );
|
|
||||||
|
|
||||||
if ( isLinuxTerm() && hasUTF8() )
|
if ( isLinuxTerm() && hasUTF8() )
|
||||||
{
|
{
|
||||||
|
@ -772,9 +772,9 @@ void FLineEdit::drawInputField()
|
||||||
else if ( show_text )
|
else if ( show_text )
|
||||||
print (show_text);
|
print (show_text);
|
||||||
|
|
||||||
x = int(show_text.getLength());
|
x = show_text.getLength();
|
||||||
|
|
||||||
while ( x < int(getWidth()) - 1 )
|
while ( x < getWidth() - 1 )
|
||||||
{
|
{
|
||||||
print (' ');
|
print (' ');
|
||||||
x++;
|
x++;
|
||||||
|
@ -793,7 +793,7 @@ void FLineEdit::drawInputField()
|
||||||
drawShadow ();
|
drawShadow ();
|
||||||
|
|
||||||
// set the cursor to the first pos.
|
// 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 )
|
if ( cursor_pos > 0 )
|
||||||
cursor_pos--;
|
cursor_pos--;
|
||||||
|
|
||||||
if ( cursor_pos < int(text_offset) )
|
if ( cursor_pos < text_offset )
|
||||||
text_offset--;
|
text_offset--;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FLineEdit::keyRight()
|
inline void FLineEdit::keyRight()
|
||||||
{
|
{
|
||||||
int len = int(text.getLength());
|
std::size_t len = text.getLength();
|
||||||
|
|
||||||
if ( cursor_pos < len )
|
if ( cursor_pos < len )
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
|
|
||||||
if ( cursor_pos - int(text_offset) >= int(getWidth()) - 2
|
if ( cursor_pos - text_offset >= getWidth() - 2
|
||||||
&& int(text_offset) <= len - int(getWidth()) + 1 )
|
&& text_offset <= len - getWidth() + 1 )
|
||||||
text_offset++;
|
text_offset++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,9 +830,9 @@ inline void FLineEdit::keyHome()
|
||||||
inline void FLineEdit::keyEnd()
|
inline void FLineEdit::keyEnd()
|
||||||
{
|
{
|
||||||
std::size_t len = text.getLength();
|
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;
|
text_offset = len - getWidth() + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,20 +841,16 @@ inline void FLineEdit::keyDel()
|
||||||
{
|
{
|
||||||
std::size_t len = text.getLength();
|
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();
|
processChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cursor_pos >= int(len) )
|
if ( cursor_pos >= len )
|
||||||
cursor_pos = int(len);
|
cursor_pos = len;
|
||||||
|
|
||||||
if ( cursor_pos < 0 )
|
if ( text_offset > 0 && len - text_offset < getWidth() - 1 )
|
||||||
cursor_pos = 0;
|
|
||||||
|
|
||||||
if ( text_offset > 0
|
|
||||||
&& len - std::size_t(text_offset) < std::size_t(getWidth()) - 1 )
|
|
||||||
text_offset--;
|
text_offset--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -863,7 +859,7 @@ inline void FLineEdit::keyBackspace()
|
||||||
{
|
{
|
||||||
if ( text.getLength() > 0 && cursor_pos > 0 )
|
if ( text.getLength() > 0 && cursor_pos > 0 )
|
||||||
{
|
{
|
||||||
text.remove(std::size_t(cursor_pos) - 1, 1);
|
text.remove(cursor_pos - 1, 1);
|
||||||
processChanged();
|
processChanged();
|
||||||
cursor_pos--;
|
cursor_pos--;
|
||||||
|
|
||||||
|
@ -896,7 +892,7 @@ inline bool FLineEdit::keyInput (int key)
|
||||||
{
|
{
|
||||||
std::size_t len = text.getLength();
|
std::size_t len = text.getLength();
|
||||||
|
|
||||||
if ( std::size_t(cursor_pos) == len )
|
if ( cursor_pos == len )
|
||||||
{
|
{
|
||||||
text += wchar_t(key);
|
text += wchar_t(key);
|
||||||
processChanged();
|
processChanged();
|
||||||
|
@ -904,9 +900,9 @@ inline bool FLineEdit::keyInput (int key)
|
||||||
else if ( len > 0 )
|
else if ( len > 0 )
|
||||||
{
|
{
|
||||||
if ( insert_mode )
|
if ( insert_mode )
|
||||||
text.insert(wchar_t(key), std::size_t(cursor_pos));
|
text.insert(wchar_t(key), cursor_pos);
|
||||||
else
|
else
|
||||||
text.overwrite(wchar_t(key), std::size_t(cursor_pos));
|
text.overwrite(wchar_t(key), cursor_pos);
|
||||||
|
|
||||||
processChanged();
|
processChanged();
|
||||||
}
|
}
|
||||||
|
@ -915,9 +911,10 @@ inline bool FLineEdit::keyInput (int key)
|
||||||
text = wchar_t(key);
|
text = wchar_t(key);
|
||||||
processChanged();
|
processChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
|
|
||||||
if ( cursor_pos >= int(getWidth()) - 1 )
|
if ( cursor_pos >= getWidth() - 1 )
|
||||||
text_offset++;
|
text_offset++;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -395,7 +395,7 @@ void FListViewItem::replaceControlCodes()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FListViewItem::getVisibleLines()
|
std::size_t FListViewItem::getVisibleLines()
|
||||||
{
|
{
|
||||||
if ( visible_lines > 1 )
|
if ( visible_lines > 1 )
|
||||||
return visible_lines;
|
return visible_lines;
|
||||||
|
@ -1670,7 +1670,7 @@ void FListView::drawListLine ( const FListViewItem* item
|
||||||
// Insert text and trailing space
|
// Insert text and trailing space
|
||||||
line += text.left(width);
|
line += text.left(width);
|
||||||
line += FString ( leading_space + width
|
line += FString ( leading_space + width
|
||||||
- align_offset + txt_length, L' ');
|
- align_offset - txt_length, L' ');
|
||||||
}
|
}
|
||||||
else if ( align == fc::alignRight )
|
else if ( align == fc::alignRight )
|
||||||
{
|
{
|
||||||
|
|
|
@ -305,7 +305,7 @@ void FMessageBox::adjustSize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMessageBox::cb_processClick (FWidget*, data_ptr data)
|
void FMessageBox::cb_processClick (FWidget*, data_ptr data)
|
||||||
{
|
{
|
||||||
int* reply = static_cast<int*>(data);
|
FDialog::DialogCode* reply = static_cast<FDialog::DialogCode*>(data);
|
||||||
done (*reply);
|
done (*reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ void FScrollView::setScrollSize (std::size_t width, std::size_t height)
|
||||||
setTopPadding (1 - getScrollY());
|
setTopPadding (1 - getScrollY());
|
||||||
setLeftPadding (1 - getScrollX());
|
setLeftPadding (1 - getScrollX());
|
||||||
setBottomPadding (1 - (yoffset_end - getScrollY()));
|
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->setMaximum (int(width - getViewportWidth()));
|
||||||
hbar->setPageSize (int(width), int(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)
|
void FScrollView::setWidth (std::size_t w, bool adjust)
|
||||||
{
|
{
|
||||||
FWidget::setWidth (w, 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();
|
calculateScrollbarPos();
|
||||||
|
|
||||||
if ( getScrollWidth() < getViewportWidth() )
|
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)
|
void FScrollView::setSize (std::size_t w, std::size_t h, bool adjust)
|
||||||
{
|
{
|
||||||
FWidget::setSize (w, h, 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 );
|
, h - horizontal_border_spacing );
|
||||||
calculateScrollbarPos();
|
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
|
// Set the scroll view geometry
|
||||||
|
|
||||||
FWidget::setGeometry (x, y, w, h, adjust);
|
FWidget::setGeometry (x, y, w, h, adjust);
|
||||||
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
||||||
, getTermY() + getTopPadding() - 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 );
|
, h - horizontal_border_spacing );
|
||||||
calculateScrollbarPos();
|
calculateScrollbarPos();
|
||||||
|
|
||||||
|
@ -372,7 +374,7 @@ void FScrollView::scrollTo (int x, int y)
|
||||||
{
|
{
|
||||||
viewport_geometry.setWidth(save_width);
|
viewport_geometry.setWidth(save_width);
|
||||||
setLeftPadding (1 - xoffset);
|
setLeftPadding (1 - xoffset);
|
||||||
setRightPadding (1 - (xoffset_end - xoffset) + nf_offset);
|
setRightPadding (1 - (xoffset_end - xoffset) + short(nf_offset));
|
||||||
|
|
||||||
if ( update_scrollbar )
|
if ( update_scrollbar )
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ FSwitch::FSwitch (const FString& txt, FWidget* parent)
|
||||||
, switch_offset_pos(0)
|
, switch_offset_pos(0)
|
||||||
, button_pressed(false)
|
, button_pressed(false)
|
||||||
{
|
{
|
||||||
switch_offset_pos = int(txt.getLength()) + 1;
|
switch_offset_pos = txt.getLength() + 1;
|
||||||
button_width = 11;
|
button_width = 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ FSwitch::~FSwitch() // destructor
|
||||||
void FSwitch::setText (const FString& txt)
|
void FSwitch::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
FToggleButton::setText(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() )
|
if ( ! isVisible() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setPrintPos (1 + switch_offset_pos, 1);
|
setPrintPos (1 + int(switch_offset_pos), 1);
|
||||||
|
|
||||||
if ( checked )
|
if ( checked )
|
||||||
drawChecked();
|
drawChecked();
|
||||||
|
@ -185,7 +185,7 @@ void FSwitch::drawChecked()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
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 )
|
if ( isMonochron() || getMaxColor() < 16 )
|
||||||
setBold(false);
|
setBold(false);
|
||||||
|
|
||||||
setCursorPos (7 + switch_offset_pos, 1);
|
setCursorPos (7 + int(switch_offset_pos), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace finalcut
|
} // namespace finalcut
|
||||||
|
|
|
@ -500,7 +500,7 @@ void FToggleButton::draw()
|
||||||
void FToggleButton::drawLabel()
|
void FToggleButton::drawLabel()
|
||||||
{
|
{
|
||||||
wchar_t* LabelText;
|
wchar_t* LabelText;
|
||||||
int hotkeypos;
|
std::size_t hotkeypos;
|
||||||
|
|
||||||
if ( ! isVisible() )
|
if ( ! isVisible() )
|
||||||
return;
|
return;
|
||||||
|
@ -525,7 +525,7 @@ void FToggleButton::drawLabel()
|
||||||
wchar_t* dest = const_cast<wchar_t*>(LabelText);
|
wchar_t* dest = const_cast<wchar_t*>(LabelText);
|
||||||
hotkeypos = getHotkeyPos(src, dest, length);
|
hotkeypos = getHotkeyPos(src, dest, length);
|
||||||
|
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != NOT_FOUND )
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
setPrintPos (1 + int(label_offset_pos), 1);
|
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[]
|
, wchar_t dest[]
|
||||||
, std::size_t length )
|
, std::size_t length )
|
||||||
{
|
{
|
||||||
// find hotkey position in string
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
int pos = -1;
|
std::size_t pos = NOT_FOUND;
|
||||||
wchar_t* txt = src;
|
wchar_t* txt = src;
|
||||||
|
|
||||||
for (std::size_t 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++;
|
i++;
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
|
@ -662,7 +662,7 @@ int FToggleButton::getHotkeyPos ( wchar_t src[]
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToggleButton::drawText ( wchar_t LabelText[]
|
void FToggleButton::drawText ( wchar_t LabelText[]
|
||||||
, int hotkeypos
|
, std::size_t hotkeypos
|
||||||
, std::size_t length )
|
, std::size_t length )
|
||||||
{
|
{
|
||||||
bool isActive = ((flags & fc::active) != 0);
|
bool isActive = ((flags & fc::active) != 0);
|
||||||
|
@ -676,7 +676,7 @@ void FToggleButton::drawText ( wchar_t LabelText[]
|
||||||
else
|
else
|
||||||
setColor (wc.label_inactive_fg, wc.label_inactive_bg);
|
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 )
|
if ( (z == hotkeypos) && isActive )
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,6 +130,9 @@ class FButton : public FWidget
|
||||||
virtual void onFocusOut (FFocusEvent*);
|
virtual void onFocusOut (FFocusEvent*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Constants
|
||||||
|
static const std::size_t NOT_FOUND = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FButton (const FButton&);
|
FButton (const FButton&);
|
||||||
|
|
||||||
|
@ -142,8 +145,8 @@ class FButton : public FWidget
|
||||||
uChar getHotkey();
|
uChar getHotkey();
|
||||||
void setHotkeyAccelerator();
|
void setHotkeyAccelerator();
|
||||||
void detectHotkey();
|
void detectHotkey();
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||||
int clickAnimationIndent (FWidget*);
|
std::size_t clickAnimationIndent (FWidget*);
|
||||||
void clearRightMargin (FWidget*);
|
void clearRightMargin (FWidget*);
|
||||||
void drawMarginLeft();
|
void drawMarginLeft();
|
||||||
void drawMarginRight();
|
void drawMarginRight();
|
||||||
|
@ -159,12 +162,12 @@ class FButton : public FWidget
|
||||||
bool button_down;
|
bool button_down;
|
||||||
bool click_animation;
|
bool click_animation;
|
||||||
int click_time;
|
int click_time;
|
||||||
int indent;
|
int space_char;
|
||||||
int space;
|
std::size_t hotkeypos;
|
||||||
int center_offset;
|
std::size_t indent;
|
||||||
int vcenter_offset;
|
std::size_t center_offset;
|
||||||
int txtlength;
|
std::size_t vcenter_offset;
|
||||||
int hotkeypos;
|
std::size_t txtlength;
|
||||||
short button_fg;
|
short button_fg;
|
||||||
short button_bg;
|
short button_bg;
|
||||||
short button_hotkey_fg;
|
short button_hotkey_fg;
|
||||||
|
|
|
@ -125,6 +125,9 @@ class FButtonGroup : public FScrollView
|
||||||
void drawLabel();
|
void drawLabel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Constants
|
||||||
|
static const std::size_t NOT_FOUND = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FButtonGroup (const FButtonGroup&);
|
FButtonGroup (const FButtonGroup&);
|
||||||
|
|
||||||
|
@ -136,8 +139,8 @@ class FButtonGroup : public FScrollView
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||||
void drawText (wchar_t[], int, std::size_t);
|
void drawText (wchar_t[], std::size_t, std::size_t);
|
||||||
void directFocus();
|
void directFocus();
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
|
|
|
@ -117,7 +117,7 @@ class FDialog : public FWindow
|
||||||
// Methods
|
// Methods
|
||||||
virtual void show();
|
virtual void show();
|
||||||
virtual void hide();
|
virtual void hide();
|
||||||
int exec();
|
DialogCode exec();
|
||||||
virtual void setPos (int, int, bool = true);
|
virtual void setPos (int, int, bool = true);
|
||||||
virtual void move (int, int);
|
virtual void move (int, int);
|
||||||
bool moveUp (int);
|
bool moveUp (int);
|
||||||
|
@ -145,7 +145,7 @@ class FDialog : public FWindow
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Methods
|
// Methods
|
||||||
virtual void done (int);
|
virtual void done (DialogCode);
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void drawDialogShadow();
|
void drawDialogShadow();
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ class FDialog : public FWindow
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
FString tb_text; // title bar text
|
FString tb_text; // title bar text
|
||||||
int result_code;
|
DialogCode result_code;
|
||||||
bool zoom_button_pressed;
|
bool zoom_button_pressed;
|
||||||
bool zoom_button_active;
|
bool zoom_button_active;
|
||||||
bool setPos_error;
|
bool setPos_error;
|
||||||
|
|
|
@ -131,6 +131,9 @@ class FLabel : public FWidget
|
||||||
void cb_accel_widget_destroyed (FWidget*, data_ptr);
|
void cb_accel_widget_destroyed (FWidget*, data_ptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Constants
|
||||||
|
static const std::size_t NOT_FOUND = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FLabel (const FLabel&);
|
FLabel (const FLabel&);
|
||||||
|
|
||||||
|
@ -140,13 +143,14 @@ class FLabel : public FWidget
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
uChar getHotkey();
|
uChar getHotkey();
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||||
void setHotkeyAccelerator();
|
void setHotkeyAccelerator();
|
||||||
std::size_t getAlignOffset (std::size_t);
|
std::size_t getAlignOffset (std::size_t);
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void drawMultiLine();
|
void drawMultiLine();
|
||||||
void drawSingleLine();
|
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
|
// Data Members
|
||||||
FStringList multiline_text;
|
FStringList multiline_text;
|
||||||
|
|
|
@ -178,7 +178,7 @@ class FLineEdit : public FWidget
|
||||||
bool scroll_timer;
|
bool scroll_timer;
|
||||||
int scroll_repeat;
|
int scroll_repeat;
|
||||||
bool insert_mode;
|
bool insert_mode;
|
||||||
int cursor_pos;
|
std::size_t cursor_pos;
|
||||||
std::size_t text_offset;
|
std::size_t text_offset;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
|
@ -119,14 +119,14 @@ class FListViewItem : public FObject
|
||||||
void sort (Compare);
|
void sort (Compare);
|
||||||
FObjectIterator appendItem (FListViewItem*);
|
FObjectIterator appendItem (FListViewItem*);
|
||||||
void replaceControlCodes();
|
void replaceControlCodes();
|
||||||
int getVisibleLines();
|
std::size_t getVisibleLines();
|
||||||
void resetVisibleLineCounter();
|
void resetVisibleLineCounter();
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
FStringList column_list;
|
FStringList column_list;
|
||||||
FWidget::data_ptr data_pointer;
|
FWidget::data_ptr data_pointer;
|
||||||
FObjectIterator root;
|
FObjectIterator root;
|
||||||
int visible_lines;
|
std::size_t visible_lines;
|
||||||
bool expandable;
|
bool expandable;
|
||||||
bool is_expand;
|
bool is_expand;
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ class FMessageBox : public FDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Enumeration
|
// Enumeration
|
||||||
enum
|
enum ButtonType
|
||||||
{
|
{
|
||||||
Reject = 0,
|
Reject = 0,
|
||||||
Ok = 1,
|
Ok = 1,
|
||||||
|
|
|
@ -179,7 +179,7 @@ class FScrollView : public FWidget
|
||||||
term_area* viewport; // virtual scroll content
|
term_area* viewport; // virtual scroll content
|
||||||
FScrollbar* vbar;
|
FScrollbar* vbar;
|
||||||
FScrollbar* hbar;
|
FScrollbar* hbar;
|
||||||
int nf_offset;
|
uInt8 nf_offset;
|
||||||
bool border;
|
bool border;
|
||||||
bool use_own_print_area;
|
bool use_own_print_area;
|
||||||
bool update_scrollbar;
|
bool update_scrollbar;
|
||||||
|
|
|
@ -104,7 +104,7 @@ class FSwitch : public FToggleButton
|
||||||
void drawUnchecked();
|
void drawUnchecked();
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
int switch_offset_pos;
|
std::size_t switch_offset_pos;
|
||||||
bool button_pressed;
|
bool button_pressed;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
|
@ -72,7 +72,7 @@ class FTermBuffer
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
virtual const char* getClassName() const;
|
virtual const char* getClassName() const;
|
||||||
int getLength() const;
|
std::size_t getLength() const;
|
||||||
|
|
||||||
// Inquiry
|
// Inquiry
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
@ -107,8 +107,8 @@ inline const char* FTermBuffer::getClassName() const
|
||||||
{ return "FTermBuffer"; }
|
{ return "FTermBuffer"; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FTermBuffer::getLength() const
|
inline std::size_t FTermBuffer::getLength() const
|
||||||
{ return int(data.size()); }
|
{ return data.size(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FTermBuffer::isEmpty() const
|
inline bool FTermBuffer::isEmpty() const
|
||||||
|
|
|
@ -143,6 +143,9 @@ class FToggleButton : public FWidget
|
||||||
std::size_t button_width; // plus margin spaces
|
std::size_t button_width; // plus margin spaces
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Constants
|
||||||
|
static const std::size_t NOT_FOUND = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FToggleButton (const FToggleButton&);
|
FToggleButton (const FToggleButton&);
|
||||||
|
|
||||||
|
@ -154,8 +157,8 @@ class FToggleButton : public FWidget
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||||
void drawText (wchar_t[], int, std::size_t);
|
void drawText (wchar_t[], std::size_t , std::size_t);
|
||||||
|
|
||||||
// Friend classes
|
// Friend classes
|
||||||
friend class FButtonGroup;
|
friend class FButtonGroup;
|
||||||
|
|
Loading…
Reference in New Issue