Changed more variables from int to std::size_t
This commit is contained in:
parent
94e00051c5
commit
258380ae57
|
@ -132,7 +132,7 @@ void ProgressDialog::onShow (finalcut::FShowEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void ProgressDialog::onTimer (finalcut::FTimerEvent*)
|
void ProgressDialog::onTimer (finalcut::FTimerEvent*)
|
||||||
{
|
{
|
||||||
int p = progressBar.getPercentage();
|
std::size_t p = progressBar.getPercentage();
|
||||||
progressBar.setPercentage(++p);
|
progressBar.setPercentage(++p);
|
||||||
flush_out();
|
flush_out();
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ void ProgressDialog::cb_reset_bar (finalcut::FWidget*, data_ptr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void ProgressDialog::cb_more_bar (finalcut::FWidget*, data_ptr)
|
void ProgressDialog::cb_more_bar (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
int p = progressBar.getPercentage();
|
std::size_t p = progressBar.getPercentage();
|
||||||
progressBar.setPercentage(++p);
|
progressBar.setPercentage(++p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ FButton::FButton(FWidget* parent)
|
||||||
, click_animation(true)
|
, click_animation(true)
|
||||||
, click_time(150)
|
, click_time(150)
|
||||||
, space_char(int(' '))
|
, space_char(int(' '))
|
||||||
, hotkeypos(NOT_FOUND)
|
, hotkeypos(NOT_SET)
|
||||||
, indent(0)
|
, indent(0)
|
||||||
, center_offset(0)
|
, center_offset(0)
|
||||||
, vcenter_offset(0)
|
, vcenter_offset(0)
|
||||||
|
@ -65,7 +65,7 @@ FButton::FButton (const FString& txt, FWidget* parent)
|
||||||
, click_animation(true)
|
, click_animation(true)
|
||||||
, click_time(150)
|
, click_time(150)
|
||||||
, space_char(int(' '))
|
, space_char(int(' '))
|
||||||
, hotkeypos(NOT_FOUND)
|
, hotkeypos(NOT_SET)
|
||||||
, indent(0)
|
, indent(0)
|
||||||
, center_offset(0)
|
, center_offset(0)
|
||||||
, vcenter_offset(0)
|
, vcenter_offset(0)
|
||||||
|
@ -549,11 +549,11 @@ std::size_t FButton::getHotkeyPos ( wchar_t src[]
|
||||||
// find hotkey position in string
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
wchar_t* txt = src;
|
wchar_t* txt = src;
|
||||||
std::size_t pos = NOT_FOUND;
|
std::size_t pos = NOT_SET;
|
||||||
|
|
||||||
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 == NOT_FOUND )
|
if ( i < length && txt[i] == L'&' && pos == NOT_SET )
|
||||||
{
|
{
|
||||||
pos = i;
|
pos = i;
|
||||||
i++;
|
i++;
|
||||||
|
@ -686,11 +686,11 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
for (pos = 0; pos < center_offset; pos++)
|
for (pos = 0; pos < center_offset; pos++)
|
||||||
print (space_char); // █
|
print (space_char); // █
|
||||||
|
|
||||||
if ( hotkeypos == NOT_FOUND )
|
if ( hotkeypos == NOT_SET )
|
||||||
setCursorPos ( 2 + int(center_offset)
|
setCursorPos ( 2 + int(center_offset)
|
||||||
, 1 + int(vcenter_offset) ); // first character
|
, 1 + int(vcenter_offset) ); // first character
|
||||||
else
|
else
|
||||||
setCursorPos ( 2 + int(center_offset) + hotkeypos
|
setCursorPos ( 2 + int(center_offset + hotkeypos)
|
||||||
, 1 + int(vcenter_offset) ); // hotkey
|
, 1 + int(vcenter_offset) ); // hotkey
|
||||||
|
|
||||||
if ( ! is.active && isMonochron() )
|
if ( ! is.active && isMonochron() )
|
||||||
|
@ -782,7 +782,7 @@ void FButton::draw()
|
||||||
|
|
||||||
hotkeypos = getHotkeyPos(text.wc_str(), button_text, uInt(txtlength));
|
hotkeypos = getHotkeyPos(text.wc_str(), button_text, uInt(txtlength));
|
||||||
|
|
||||||
if ( hotkeypos != NOT_FOUND )
|
if ( hotkeypos != NOT_SET )
|
||||||
txtlength--;
|
txtlength--;
|
||||||
|
|
||||||
if ( getHeight() >= 2 )
|
if ( getHeight() >= 2 )
|
||||||
|
|
|
@ -527,7 +527,7 @@ void FButtonGroup::drawLabel()
|
||||||
unsetViewportPrint();
|
unsetViewportPrint();
|
||||||
hotkeypos = getHotkeyPos(src, dest, length);
|
hotkeypos = getHotkeyPos(src, dest, length);
|
||||||
|
|
||||||
if ( hotkeypos != NOT_FOUND )
|
if ( hotkeypos != NOT_SET )
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
if ( hasBorder() )
|
if ( hasBorder() )
|
||||||
|
@ -571,12 +571,12 @@ std::size_t FButtonGroup::getHotkeyPos ( wchar_t src[]
|
||||||
{
|
{
|
||||||
// find hotkey position in string
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
std::size_t pos = NOT_FOUND;
|
std::size_t pos = NOT_SET;
|
||||||
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 == NOT_FOUND )
|
if ( i < length && txt[i] == L'&' && pos == NOT_SET )
|
||||||
{
|
{
|
||||||
pos = i;
|
pos = i;
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -425,12 +425,12 @@ std::size_t FLabel::getHotkeyPos ( wchar_t src[]
|
||||||
{
|
{
|
||||||
// find hotkey position in string
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
std::size_t hotkeypos = NOT_FOUND;
|
std::size_t hotkeypos = NOT_SET;
|
||||||
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 == NOT_FOUND )
|
if ( i < length && txt[i] == L'&' && hotkeypos == NOT_SET )
|
||||||
{
|
{
|
||||||
hotkeypos = i;
|
hotkeypos = i;
|
||||||
i++;
|
i++;
|
||||||
|
@ -446,7 +446,7 @@ std::size_t FLabel::getHotkeyPos ( wchar_t src[]
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLabel::setHotkeyAccelerator()
|
void FLabel::setHotkeyAccelerator()
|
||||||
{
|
{
|
||||||
std::size_t hotkey = getHotkey();
|
uChar hotkey = getHotkey();
|
||||||
|
|
||||||
if ( hotkey )
|
if ( hotkey )
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
std::size_t hotkeypos = NOT_FOUND;
|
std::size_t hotkeypos = NOT_SET;
|
||||||
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 != NOT_FOUND )
|
if ( hotkeypos != NOT_SET )
|
||||||
{
|
{
|
||||||
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, NOT_FOUND, align_offset);
|
printLine (label_text, length, NOT_SET, 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;
|
||||||
std::size_t hotkeypos = NOT_FOUND;
|
std::size_t hotkeypos = NOT_SET;
|
||||||
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 != NOT_FOUND )
|
if ( hotkeypos != NOT_SET )
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
setPrintPos (1, 1);
|
setPrintPos (1, 1);
|
||||||
|
|
|
@ -43,7 +43,7 @@ FMenu::FMenu(FWidget* parent)
|
||||||
, opened_sub_menu(0)
|
, opened_sub_menu(0)
|
||||||
, shown_sub_menu(0)
|
, shown_sub_menu(0)
|
||||||
, max_item_width(0)
|
, max_item_width(0)
|
||||||
, hotkeypos(-1)
|
, hotkeypos(NOT_SET)
|
||||||
, mouse_down(false)
|
, mouse_down(false)
|
||||||
, has_checkable_items(false)
|
, has_checkable_items(false)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,7 @@ FMenu::FMenu (const FString& txt, FWidget* parent)
|
||||||
, opened_sub_menu(0)
|
, opened_sub_menu(0)
|
||||||
, shown_sub_menu(0)
|
, shown_sub_menu(0)
|
||||||
, max_item_width(0)
|
, max_item_width(0)
|
||||||
, hotkeypos(-1)
|
, hotkeypos(NOT_SET)
|
||||||
, mouse_down(false)
|
, mouse_down(false)
|
||||||
, has_checkable_items(false)
|
, has_checkable_items(false)
|
||||||
{
|
{
|
||||||
|
@ -1222,20 +1222,20 @@ bool FMenu::hotkeyMenu (FKeyEvent* ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FMenu::getHotkeyPos ( wchar_t src[]
|
std::size_t FMenu::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_SET;
|
||||||
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_SET )
|
||||||
{
|
{
|
||||||
pos = int(i);
|
pos = i;
|
||||||
i++;
|
i++;
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
|
@ -1346,7 +1346,7 @@ inline void FMenu::drawMenuLine (FMenuItem* menuitem, int y)
|
||||||
|
|
||||||
hotkeypos = getHotkeyPos(txt.wc_str(), txtdata.text, txt_length);
|
hotkeypos = getHotkeyPos(txt.wc_str(), txtdata.text, txt_length);
|
||||||
|
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != NOT_SET )
|
||||||
to_char--;
|
to_char--;
|
||||||
|
|
||||||
txtdata.length = to_char;
|
txtdata.length = to_char;
|
||||||
|
@ -1354,7 +1354,7 @@ inline void FMenu::drawMenuLine (FMenuItem* menuitem, int y)
|
||||||
setCursorToHotkeyPosition (menuitem);
|
setCursorToHotkeyPosition (menuitem);
|
||||||
|
|
||||||
if ( ! is_enabled || is_selected )
|
if ( ! is_enabled || is_selected )
|
||||||
txtdata.hotkeypos = -1;
|
txtdata.hotkeypos = NOT_SET;
|
||||||
else
|
else
|
||||||
txtdata.hotkeypos = hotkeypos;
|
txtdata.hotkeypos = hotkeypos;
|
||||||
|
|
||||||
|
@ -1438,7 +1438,7 @@ inline void FMenu::drawMenuText (menuText& data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( int(z) == data.hotkeypos )
|
if ( z == data.hotkeypos )
|
||||||
{
|
{
|
||||||
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
||||||
|
|
||||||
|
@ -1544,7 +1544,7 @@ inline void FMenu::setCursorToHotkeyPosition (FMenuItem* menuitem)
|
||||||
bool is_checkable = menuitem->checkable;
|
bool is_checkable = menuitem->checkable;
|
||||||
bool is_selected = menuitem->isSelected();
|
bool is_selected = menuitem->isSelected();
|
||||||
|
|
||||||
if ( hotkeypos == -1 )
|
if ( hotkeypos == NOT_SET )
|
||||||
{
|
{
|
||||||
// set cursor to the first character
|
// set cursor to the first character
|
||||||
if ( is_selected )
|
if ( is_selected )
|
||||||
|
@ -1561,9 +1561,9 @@ inline void FMenu::setCursorToHotkeyPosition (FMenuItem* menuitem)
|
||||||
{
|
{
|
||||||
// set cursor to the hotkey position
|
// set cursor to the hotkey position
|
||||||
if ( is_checkable )
|
if ( is_checkable )
|
||||||
menuitem->setCursorPos (3 + hotkeypos, 1);
|
menuitem->setCursorPos (3 + int(hotkeypos), 1);
|
||||||
else
|
else
|
||||||
menuitem->setCursorPos (2 + hotkeypos, 1);
|
menuitem->setCursorPos (2 + int(hotkeypos), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -494,20 +494,20 @@ bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FMenuBar::getHotkeyPos ( wchar_t src[]
|
std::size_t FMenuBar::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_SET;
|
||||||
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_SET )
|
||||||
{
|
{
|
||||||
hotkeypos = int(i);
|
hotkeypos = i;
|
||||||
i++;
|
i++;
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
|
@ -528,7 +528,7 @@ void FMenuBar::draw()
|
||||||
void FMenuBar::drawItems()
|
void FMenuBar::drawItems()
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
int x = 1;
|
std::size_t x = 1;
|
||||||
|
|
||||||
if ( item_list.empty() )
|
if ( item_list.empty() )
|
||||||
return;
|
return;
|
||||||
|
@ -549,7 +549,7 @@ void FMenuBar::drawItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print spaces to end of line
|
// Print spaces to end of line
|
||||||
for (; x <= int(screenWidth); x++)
|
for (; x <= screenWidth; x++)
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -557,17 +557,17 @@ void FMenuBar::drawItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenuBar::drawItem (FMenuItem* menuitem, int& x)
|
inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
|
||||||
{
|
{
|
||||||
FString txt = menuitem->getText();
|
FString txt = menuitem->getText();
|
||||||
menuText txtdata;
|
menuText txtdata;
|
||||||
std::size_t txt_length = txt.getLength();
|
std::size_t txt_length = txt.getLength();
|
||||||
std::size_t to_char;
|
std::size_t to_char;
|
||||||
int hotkeypos;
|
std::size_t hotkeypos;
|
||||||
bool is_enabled = menuitem->isEnabled();
|
bool is_enabled = menuitem->isEnabled();
|
||||||
bool is_selected = menuitem->isSelected();
|
bool is_selected = menuitem->isSelected();
|
||||||
|
|
||||||
txtdata.startpos = std::size_t(x) + 1;
|
txtdata.startpos = x + 1;
|
||||||
txtdata.no_underline = ((menuitem->getFlags() & fc::no_underline) != 0);
|
txtdata.no_underline = ((menuitem->getFlags() & fc::no_underline) != 0);
|
||||||
|
|
||||||
// Set screen attributes
|
// Set screen attributes
|
||||||
|
@ -584,24 +584,24 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, int& x)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( x - 1 <= int(screenWidth) )
|
if ( x - 1 <= screenWidth )
|
||||||
to_char = txt_length;
|
to_char = txt_length;
|
||||||
else
|
else
|
||||||
to_char = txt_length - screenWidth - std::size_t(x) - 1;
|
to_char = txt_length - screenWidth - x - 1;
|
||||||
|
|
||||||
hotkeypos = getHotkeyPos (txt.wc_str(), txtdata.text, txt_length);
|
hotkeypos = getHotkeyPos (txt.wc_str(), txtdata.text, txt_length);
|
||||||
|
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != NOT_SET )
|
||||||
{
|
{
|
||||||
txt_length--;
|
txt_length--;
|
||||||
to_char--;
|
to_char--;
|
||||||
}
|
}
|
||||||
|
|
||||||
txtdata.length = to_char;
|
txtdata.length = to_char;
|
||||||
x += int(txt_length);
|
x += txt_length;
|
||||||
|
|
||||||
if ( ! is_enabled || is_selected )
|
if ( ! is_enabled || is_selected )
|
||||||
txtdata.hotkeypos = -1;
|
txtdata.hotkeypos = NOT_SET;
|
||||||
else
|
else
|
||||||
txtdata.hotkeypos = hotkeypos;
|
txtdata.hotkeypos = hotkeypos;
|
||||||
|
|
||||||
|
@ -655,7 +655,7 @@ inline void FMenuBar::drawMenuText (menuText& data)
|
||||||
|
|
||||||
for (std::size_t z = 0; z < data.length; z++)
|
for (std::size_t z = 0; z < data.length; z++)
|
||||||
{
|
{
|
||||||
if ( data.startpos > std::size_t(screenWidth) - z )
|
if ( data.startpos > screenWidth - z )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ( ! std::iswprint(wint_t(data.text[z])) )
|
if ( ! std::iswprint(wint_t(data.text[z])) )
|
||||||
|
@ -668,7 +668,7 @@ inline void FMenuBar::drawMenuText (menuText& data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( int(z) == data.hotkeypos )
|
if ( z == data.hotkeypos )
|
||||||
{
|
{
|
||||||
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
||||||
|
|
||||||
|
@ -688,9 +688,9 @@ inline void FMenuBar::drawMenuText (menuText& data)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenuBar::drawEllipsis (menuText& txtdata, int x)
|
inline void FMenuBar::drawEllipsis (menuText& txtdata, std::size_t x)
|
||||||
{
|
{
|
||||||
if ( x > int(screenWidth) + 1 )
|
if ( x > screenWidth + 1 )
|
||||||
{
|
{
|
||||||
if ( txtdata.startpos < screenWidth )
|
if ( txtdata.startpos < screenWidth )
|
||||||
{
|
{
|
||||||
|
@ -708,11 +708,11 @@ inline void FMenuBar::drawEllipsis (menuText& txtdata, int x)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenuBar::drawLeadingSpace (int& x)
|
inline void FMenuBar::drawLeadingSpace (std::size_t& x)
|
||||||
{
|
{
|
||||||
// Print a leading blank space
|
// Print a leading blank space
|
||||||
|
|
||||||
if ( x < int(screenWidth) )
|
if ( x < screenWidth )
|
||||||
{
|
{
|
||||||
x++;
|
x++;
|
||||||
print (' ');
|
print (' ');
|
||||||
|
@ -720,11 +720,11 @@ inline void FMenuBar::drawLeadingSpace (int& x)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FMenuBar::drawTrailingSpace (int& x)
|
inline void FMenuBar::drawTrailingSpace (std::size_t& x)
|
||||||
{
|
{
|
||||||
// Print a trailing blank space
|
// Print a trailing blank space
|
||||||
|
|
||||||
if ( x < int(screenWidth) )
|
if ( x < screenWidth )
|
||||||
{
|
{
|
||||||
x++;
|
x++;
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace finalcut
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FProgressbar::FProgressbar(FWidget* parent)
|
FProgressbar::FProgressbar(FWidget* parent)
|
||||||
: FWidget(parent)
|
: FWidget(parent)
|
||||||
, percentage(-1)
|
, percentage(NOT_SET)
|
||||||
, bar_length(getWidth())
|
, bar_length(getWidth())
|
||||||
{
|
{
|
||||||
unsetFocusable();
|
unsetFocusable();
|
||||||
|
@ -47,15 +47,14 @@ FProgressbar::~FProgressbar() // destructor
|
||||||
|
|
||||||
// public methods of FProgressbar
|
// public methods of FProgressbar
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FProgressbar::setPercentage (int percentage_value)
|
void FProgressbar::setPercentage (std::size_t percentage_value)
|
||||||
{
|
{
|
||||||
if ( percentage_value <= percentage )
|
if ( percentage_value == NOT_SET )
|
||||||
return;
|
percentage = NOT_SET;
|
||||||
|
else if ( percentage_value > 100 )
|
||||||
if ( percentage_value > 100 )
|
|
||||||
percentage = 100;
|
percentage = 100;
|
||||||
else if ( percentage_value < 0 )
|
else if ( percentage_value <= percentage && percentage != NOT_SET )
|
||||||
percentage = 0;
|
return;
|
||||||
else
|
else
|
||||||
percentage = percentage_value;
|
percentage = percentage_value;
|
||||||
|
|
||||||
|
@ -126,7 +125,7 @@ void FProgressbar::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)
|
||||||
{
|
{
|
||||||
|
@ -134,12 +133,12 @@ void FProgressbar::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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +150,7 @@ void FProgressbar::hide()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FProgressbar::reset()
|
void FProgressbar::reset()
|
||||||
{
|
{
|
||||||
percentage = -1;
|
percentage = NOT_SET;
|
||||||
|
|
||||||
if ( isVisible() )
|
if ( isVisible() )
|
||||||
{
|
{
|
||||||
|
@ -192,7 +191,7 @@ void FProgressbar::drawPercentage()
|
||||||
|
|
||||||
setPrintPos (int(getWidth()) - 3, 0);
|
setPrintPos (int(getWidth()) - 3, 0);
|
||||||
|
|
||||||
if ( percentage < 0 || percentage > 100 )
|
if ( percentage > 100 )
|
||||||
print ("--- %");
|
print ("--- %");
|
||||||
else
|
else
|
||||||
printf ("%3d %%", percentage);
|
printf ("%3d %%", percentage);
|
||||||
|
@ -205,11 +204,16 @@ void FProgressbar::drawPercentage()
|
||||||
void FProgressbar::drawBar()
|
void FProgressbar::drawBar()
|
||||||
{
|
{
|
||||||
std::size_t i = 0;
|
std::size_t i = 0;
|
||||||
double length = double(int(bar_length) * percentage) / 100;
|
double length;
|
||||||
setPrintPos (1,1);
|
setPrintPos (1,1);
|
||||||
setColor ( wc.progressbar_bg
|
setColor ( wc.progressbar_bg
|
||||||
, wc.progressbar_fg );
|
, wc.progressbar_fg );
|
||||||
|
|
||||||
|
if ( percentage == NOT_SET )
|
||||||
|
length = double(-0/100);
|
||||||
|
else
|
||||||
|
length = double(bar_length * percentage) / 100;
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
|
@ -219,7 +223,7 @@ void FProgressbar::drawBar()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
if ( percentage > 0.0f && trunc(length) < bar_length )
|
if ( percentage > 0 && percentage <= 100 && trunc(length) < bar_length )
|
||||||
{
|
{
|
||||||
if ( round(length) > trunc(length) || getMaxColor() < 16 )
|
if ( round(length) > trunc(length) || getMaxColor() < 16 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -231,9 +231,9 @@ void FTextView::hide()
|
||||||
std::memset(blank, ' ', size);
|
std::memset(blank, ' ', size);
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y = 0; y < int(getHeight()); y++)
|
for (std::size_t y = 0; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
setPrintPos (1, 1 + y);
|
setPrintPos (1, 1 + int(y));
|
||||||
print (blank);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,9 +253,9 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
FStringList::iterator iter;
|
FStringList::iterator iter;
|
||||||
FStringList text_split;
|
FStringList text_split;
|
||||||
FString s;
|
FString s;
|
||||||
uLong num;
|
std::size_t num;
|
||||||
|
|
||||||
if ( pos < 0 || pos >= int(getRows()) )
|
if ( pos >= int(getRows()) )
|
||||||
pos = int(getRows());
|
pos = int(getRows());
|
||||||
|
|
||||||
if ( str.isEmpty() )
|
if ( str.isEmpty() )
|
||||||
|
@ -297,10 +297,10 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
vbar->setPageSize (int(getRows()), int(getTextHeight()));
|
vbar->setPageSize (int(getRows()), int(getTextHeight()));
|
||||||
vbar->calculateSliderValues();
|
vbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! vbar->isVisible() && int(getRows()) > int(getTextHeight()) )
|
if ( ! vbar->isVisible() && getRows() > getTextHeight() )
|
||||||
vbar->setVisible();
|
vbar->setVisible();
|
||||||
|
|
||||||
if ( vbar->isVisible() && int(getRows()) <= int(getTextHeight()) )
|
if ( vbar->isVisible() && getRows() <= getTextHeight() )
|
||||||
vbar->hide();
|
vbar->hide();
|
||||||
|
|
||||||
processChanged();
|
processChanged();
|
||||||
|
@ -311,13 +311,7 @@ void FTextView::replaceRange (const FString& str, int from, int to)
|
||||||
{
|
{
|
||||||
FStringList::iterator iter;
|
FStringList::iterator iter;
|
||||||
|
|
||||||
if ( from > to )
|
if ( from > to || from >= int(getRows()) || to >= int(getRows()) )
|
||||||
return;
|
|
||||||
|
|
||||||
if ( from < 0 || from >= int(getRows()) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( to < 0 || to >= int(getRows()) )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
iter = data.begin();
|
iter = data.begin();
|
||||||
|
|
|
@ -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 != NOT_FOUND )
|
if ( hotkeypos != NOT_SET )
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
setPrintPos (1 + int(label_offset_pos), 1);
|
setPrintPos (1 + int(label_offset_pos), 1);
|
||||||
|
@ -642,12 +642,12 @@ std::size_t FToggleButton::getHotkeyPos ( wchar_t src[]
|
||||||
{
|
{
|
||||||
// find hotkey position in string
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
std::size_t pos = NOT_FOUND;
|
std::size_t pos = NOT_SET;
|
||||||
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 == NOT_FOUND )
|
if ( i < length && txt[i] == L'&' && pos == NOT_SET )
|
||||||
{
|
{
|
||||||
pos = i;
|
pos = i;
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -131,7 +131,7 @@ class FButton : public FWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t NOT_FOUND = static_cast<std::size_t>(-1);
|
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FButton (const FButton&);
|
FButton (const FButton&);
|
||||||
|
|
|
@ -126,7 +126,7 @@ class FButtonGroup : public FScrollView
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t NOT_FOUND = static_cast<std::size_t>(-1);
|
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FButtonGroup (const FButtonGroup&);
|
FButtonGroup (const FButtonGroup&);
|
||||||
|
|
|
@ -132,7 +132,7 @@ class FLabel : public FWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t NOT_FOUND = static_cast<std::size_t>(-1);
|
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FLabel (const FLabel&);
|
FLabel (const FLabel&);
|
||||||
|
|
|
@ -124,6 +124,9 @@ class FMenu : public FWindow, public FMenuList
|
||||||
void cb_menuitem_toggled (FWidget*, data_ptr);
|
void cb_menuitem_toggled (FWidget*, data_ptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Constants
|
||||||
|
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Typedef
|
// Typedef
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -140,7 +143,7 @@ class FMenu : public FWindow, public FMenuList
|
||||||
{
|
{
|
||||||
wchar_t* text;
|
wchar_t* text;
|
||||||
std::size_t length;
|
std::size_t length;
|
||||||
int hotkeypos;
|
std::size_t hotkeypos;
|
||||||
bool no_underline;
|
bool no_underline;
|
||||||
} menuText;
|
} menuText;
|
||||||
|
|
||||||
|
@ -199,7 +202,7 @@ class FMenu : public FWindow, public FMenuList
|
||||||
bool selectPrevItem();
|
bool selectPrevItem();
|
||||||
void keypressMenuBar (FKeyEvent*);
|
void keypressMenuBar (FKeyEvent*);
|
||||||
bool hotkeyMenu (FKeyEvent*);
|
bool hotkeyMenu (FKeyEvent*);
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void drawItems();
|
void drawItems();
|
||||||
void drawSeparator (int);
|
void drawSeparator (int);
|
||||||
|
@ -233,7 +236,7 @@ class FMenu : public FWindow, public FMenuList
|
||||||
FMenu* opened_sub_menu;
|
FMenu* opened_sub_menu;
|
||||||
FMenu* shown_sub_menu;
|
FMenu* shown_sub_menu;
|
||||||
std::size_t max_item_width;
|
std::size_t max_item_width;
|
||||||
int hotkeypos;
|
std::size_t hotkeypos;
|
||||||
bool mouse_down;
|
bool mouse_down;
|
||||||
bool has_checkable_items;
|
bool has_checkable_items;
|
||||||
};
|
};
|
||||||
|
|
|
@ -101,13 +101,16 @@ class FMenuBar : public FWindow, public FMenuList
|
||||||
void cb_item_deactivated (FWidget*, data_ptr);
|
void cb_item_deactivated (FWidget*, data_ptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Constants
|
||||||
|
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Typedef
|
// Typedef
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
wchar_t* text;
|
wchar_t* text;
|
||||||
std::size_t length;
|
std::size_t length;
|
||||||
std::size_t startpos;
|
std::size_t startpos;
|
||||||
int hotkeypos;
|
std::size_t hotkeypos;
|
||||||
bool no_underline;
|
bool no_underline;
|
||||||
} menuText;
|
} menuText;
|
||||||
|
|
||||||
|
@ -126,15 +129,15 @@ class FMenuBar : public FWindow, public FMenuList
|
||||||
bool selectNextItem();
|
bool selectNextItem();
|
||||||
bool selectPrevItem();
|
bool selectPrevItem();
|
||||||
bool hotkeyMenu (FKeyEvent*&);
|
bool hotkeyMenu (FKeyEvent*&);
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
std::size_t getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void drawItems();
|
void drawItems();
|
||||||
void drawItem (FMenuItem*, int&);
|
void drawItem (FMenuItem*, std::size_t&);
|
||||||
void setLineAttributes (FMenuItem*);
|
void setLineAttributes (FMenuItem*);
|
||||||
void drawMenuText (menuText&);
|
void drawMenuText (menuText&);
|
||||||
void drawEllipsis (menuText&, int);
|
void drawEllipsis (menuText&, std::size_t);
|
||||||
void drawLeadingSpace (int&);
|
void drawLeadingSpace (std::size_t&);
|
||||||
void drawTrailingSpace (int&);
|
void drawTrailingSpace (std::size_t&);
|
||||||
void adjustItems();
|
void adjustItems();
|
||||||
bool activateMenu (FMenuItem*);
|
bool activateMenu (FMenuItem*);
|
||||||
bool clickItem (FMenuItem*);
|
bool clickItem (FMenuItem*);
|
||||||
|
|
|
@ -78,10 +78,10 @@ class FProgressbar : public FWidget
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
int getPercentage();
|
std::size_t getPercentage();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setPercentage (int);
|
void setPercentage (std::size_t);
|
||||||
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||||
bool setShadow (bool);
|
bool setShadow (bool);
|
||||||
bool setShadow();
|
bool setShadow();
|
||||||
|
@ -95,13 +95,16 @@ class FProgressbar : public FWidget
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Constants
|
||||||
|
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void drawPercentage();
|
void drawPercentage();
|
||||||
void drawBar();
|
void drawBar();
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
int percentage;
|
std::size_t percentage;
|
||||||
std::size_t bar_length;
|
std::size_t bar_length;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -113,7 +116,7 @@ inline const char* FProgressbar::getClassName() const
|
||||||
{ return "FProgressbar"; }
|
{ return "FProgressbar"; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FProgressbar::getPercentage()
|
inline std::size_t FProgressbar::getPercentage()
|
||||||
{ return percentage; }
|
{ return percentage; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -144,7 +144,7 @@ class FToggleButton : public FWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Constants
|
// Constants
|
||||||
static const std::size_t NOT_FOUND = static_cast<std::size_t>(-1);
|
static const std::size_t NOT_SET = static_cast<std::size_t>(-1);
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FToggleButton (const FToggleButton&);
|
FToggleButton (const FToggleButton&);
|
||||||
|
|
Loading…
Reference in New Issue