change from int to std::size_t for width or height
This commit is contained in:
parent
b6ffa0f190
commit
cfc1c4ef25
|
@ -1,3 +1,7 @@
|
|||
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.
|
||||
|
||||
2018-10-13 Markus Gans <guru.mail@muenster.de>
|
||||
* Avoid using dynamic_cast so that you can compile Final Cut
|
||||
without Run-Time Type Information (RTTI).
|
||||
|
|
2
build.sh
2
build.sh
|
@ -43,7 +43,7 @@ fi
|
|||
# Build commands
|
||||
case "$1" in
|
||||
"--release"|"release")
|
||||
if ! ./configure --prefix="$PREFIX"
|
||||
if ! ./configure --prefix="$PREFIX" CXXFLAGS="-O3 -fno-rtti"
|
||||
then
|
||||
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
||||
exit -1
|
||||
|
|
|
@ -29,7 +29,7 @@ endif
|
|||
all: $(OBJS)
|
||||
|
||||
debug:
|
||||
$(MAKE) $(MAKEFILE) DEBUG="-g -D DEBUG -Wall -Wextra -Wpedantic -Weverything -Wpadded"
|
||||
$(MAKE) $(MAKEFILE) DEBUG="-g -D DEBUG -Wall -Wextra -Wpedantic -Weverything -Wpadded -Wno-reserved-id-macro"
|
||||
|
||||
profile:
|
||||
$(MAKE) $(MAKEFILE) PROFILE="-pg"
|
||||
|
|
|
@ -1100,10 +1100,10 @@ void Calc::cb_buttonClicked (finalcut::FWidget*, data_ptr data)
|
|||
//----------------------------------------------------------------------
|
||||
void Calc::adjustSize()
|
||||
{
|
||||
int pw = getParentWidget()->getWidth();
|
||||
int ph = getParentWidget()->getHeight();
|
||||
setX (1 + (pw - getWidth()) / 2, false);
|
||||
setY (1 + (ph - getHeight()) / 2, false);
|
||||
std::size_t pw = getParentWidget()->getWidth();
|
||||
std::size_t ph = getParentWidget()->getHeight();
|
||||
setX (1 + int(pw - getWidth()) / 2, false);
|
||||
setY (1 + int(ph - getHeight()) / 2, false);
|
||||
finalcut::FDialog::adjustSize();
|
||||
}
|
||||
|
||||
|
|
|
@ -99,10 +99,10 @@ int main (int argc, char* argv[])
|
|||
finalcut::FDialog dgl(&app);
|
||||
dgl.setModal();
|
||||
dgl.setText ("UNIX select");
|
||||
int w = 20;
|
||||
int h = 13;
|
||||
int x = (app.getDesktopWidth() - w) / 2;
|
||||
int y = (app.getDesktopHeight() - h) / 2;
|
||||
std::size_t w = 20;
|
||||
std::size_t h = 13;
|
||||
int x = int(app.getDesktopWidth() - w) / 2;
|
||||
int y = int(app.getDesktopHeight() - h) / 2;
|
||||
dgl.setGeometry (x, y, w, h);
|
||||
|
||||
// Create a button group
|
||||
|
|
|
@ -56,7 +56,7 @@ void Keyboard::onKeyPress (finalcut::FKeyEvent* ev)
|
|||
int key_id = ev->key();
|
||||
bool is_last_line = false;
|
||||
|
||||
if ( getPrintPos().getY() == getDesktopHeight() )
|
||||
if ( getPrintPos().getY() == int(getDesktopHeight()) )
|
||||
is_last_line = true;
|
||||
|
||||
print() << "Key " << getKeyName(key_id).c_str()
|
||||
|
|
|
@ -80,8 +80,8 @@ void Mandelbrot::draw()
|
|||
xoffset = 2;
|
||||
yoffset = 2;
|
||||
current_line = 0;
|
||||
Cols = getClientWidth();
|
||||
Lines = getClientHeight();
|
||||
Cols = int(getClientWidth());
|
||||
Lines = int(getClientHeight());
|
||||
|
||||
dX = (x_max - x_min) / (Cols - 1);
|
||||
dY = (y_max - y_min) / Lines;
|
||||
|
@ -131,8 +131,8 @@ void Mandelbrot::onClose (finalcut::FCloseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void Mandelbrot::adjustSize()
|
||||
{
|
||||
int h = getParentWidget()->getHeight() - 1;
|
||||
int w = getParentWidget()->getWidth() - 10;
|
||||
std::size_t h = getParentWidget()->getHeight() - 1;
|
||||
std::size_t w = getParentWidget()->getWidth() - 10;
|
||||
setGeometry(6, 1, w, h, false);
|
||||
finalcut::FDialog::adjustSize();
|
||||
}
|
||||
|
|
|
@ -337,10 +337,10 @@ void Menu::defaultCallback (finalcut::FMenuList* mb)
|
|||
//----------------------------------------------------------------------
|
||||
void Menu::adjustSize()
|
||||
{
|
||||
int pw = getParentWidget()->getWidth();
|
||||
int ph = getParentWidget()->getHeight();
|
||||
setX (1 + (pw - getWidth()) / 2, false);
|
||||
setY (1 + (ph - getHeight()) / 4, false);
|
||||
int pw = int(getParentWidget()->getWidth());
|
||||
int ph = int(getParentWidget()->getHeight());
|
||||
setX (1 + (pw - int(getWidth())) / 2, false);
|
||||
setY (1 + (ph - int(getHeight())) / 4, false);
|
||||
finalcut::FDialog::adjustSize();
|
||||
}
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ class MouseDraw : public finalcut::FDialog
|
|||
~MouseDraw();
|
||||
|
||||
// Methods
|
||||
void setGeometry (int, int, int, int, bool = true);
|
||||
void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
|
||||
// Event handlers
|
||||
virtual void onAccel (finalcut::FAccelEvent*);
|
||||
|
@ -382,7 +382,7 @@ MouseDraw::~MouseDraw()
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MouseDraw::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||
void MouseDraw::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
|
||||
{
|
||||
int old_w, old_h;
|
||||
finalcut::FDialog::setGeometry (x, y, w, h, adjust);
|
||||
|
@ -416,7 +416,7 @@ void MouseDraw::onClose (finalcut::FCloseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void MouseDraw::draw()
|
||||
{
|
||||
int y_max = getHeight();
|
||||
int y_max = int(getHeight());
|
||||
finalcut::FDialog::draw();
|
||||
setColor();
|
||||
|
||||
|
@ -452,8 +452,8 @@ void MouseDraw::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void MouseDraw::drawBrush (int x, int y, bool swap_color)
|
||||
{
|
||||
int Cols = getWidth();
|
||||
int Lines = getHeight();
|
||||
int Cols = int(getWidth());
|
||||
int Lines = int(getHeight());
|
||||
|
||||
if ( x > 10 && x < Cols && y > 2 && y < Lines )
|
||||
{
|
||||
|
@ -508,10 +508,9 @@ void MouseDraw::drawCanvas()
|
|||
//----------------------------------------------------------------------
|
||||
void MouseDraw::adjustSize()
|
||||
{
|
||||
int w = 60
|
||||
, h = 18
|
||||
, x = 1 + (getParentWidget()->getWidth() - w) / 2
|
||||
, y = 1 + (getParentWidget()->getHeight() - h) / 2;
|
||||
std::size_t w = 60, h = 18;
|
||||
int x = 1 + int((getParentWidget()->getWidth() - w) / 2);
|
||||
int y = 1 + int((getParentWidget()->getHeight() - h) / 2);
|
||||
setGeometry (x, y, w, h, false);
|
||||
finalcut::FDialog::adjustSize();
|
||||
}
|
||||
|
|
|
@ -66,8 +66,8 @@ bool keyPressed()
|
|||
void term_boundaries (int& x, int& y)
|
||||
{
|
||||
// checks and corrects the terminal boundaries
|
||||
int term_width = app->getDesktopWidth();
|
||||
int term_height = app->getDesktopHeight();
|
||||
int term_width = int(app->getDesktopWidth());
|
||||
int term_height = int(app->getDesktopHeight());
|
||||
|
||||
if ( x < 0 )
|
||||
x = 0;
|
||||
|
@ -152,9 +152,9 @@ int main (int argc, char* argv[])
|
|||
app = &TermApp;
|
||||
|
||||
// Get screen dimension
|
||||
xmax = TermApp.getDesktopWidth() - 1;
|
||||
ymax = TermApp.getDesktopHeight() - 1;
|
||||
finalcut::FString line(xmax + 1, '-');
|
||||
xmax = int(TermApp.getDesktopWidth() - 1);
|
||||
ymax = int(TermApp.getDesktopHeight() - 1);
|
||||
finalcut::FString line(std::size_t(xmax) + 1, '-');
|
||||
|
||||
// Place the cursor in the upper left corner
|
||||
TermApp.setTermXY(0,0);
|
||||
|
|
|
@ -40,7 +40,7 @@ class Scrollview : public finalcut::FScrollView
|
|||
~Scrollview ();
|
||||
|
||||
// Mutator
|
||||
void setScrollSize (int, int);
|
||||
void setScrollSize (std::size_t, std::size_t);
|
||||
|
||||
private:
|
||||
// Disable copy constructor
|
||||
|
@ -83,9 +83,9 @@ Scrollview::Scrollview (finalcut::FWidget* parent)
|
|||
{
|
||||
// Sets the navigation button geometry
|
||||
go_east.setGeometry (1, 1, 5, 1);
|
||||
go_south.setGeometry (getScrollWidth() - 5, 1, 5, 1);
|
||||
go_west.setGeometry (getScrollWidth() - 5, getScrollHeight() - 2, 5, 1);
|
||||
go_north.setGeometry (1, getScrollHeight() - 2, 5, 1);
|
||||
go_south.setGeometry (int(getScrollWidth()) - 5, 1, 5, 1);
|
||||
go_west.setGeometry (int(getScrollWidth()) - 5, int(getScrollHeight()) - 2, 5, 1);
|
||||
go_north.setGeometry (1, int(getScrollHeight()) - 2, 5, 1);
|
||||
|
||||
// Add scroll function callbacks to the buttons
|
||||
go_east.addCallback
|
||||
|
@ -118,12 +118,12 @@ Scrollview::~Scrollview()
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void Scrollview::setScrollSize (int width, int height)
|
||||
void Scrollview::setScrollSize (std::size_t width, std::size_t height)
|
||||
{
|
||||
FScrollView::setScrollSize (width, height);
|
||||
go_south.setPos (width - 5, 1);
|
||||
go_west.setPos (width - 5, height - 1);
|
||||
go_north.setPos (1, height - 1);
|
||||
go_south.setPos (int(width) - 5, 1);
|
||||
go_west.setPos (int(width) - 5, int(height) - 1);
|
||||
go_north.setPos (1, int(height) - 1);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -135,11 +135,11 @@ void Scrollview::draw()
|
|||
setColor (wc.label_inactive_fg, wc.dialog_bg);
|
||||
clearArea();
|
||||
|
||||
for (int y = 0; y < getScrollHeight(); y++)
|
||||
for (int y = 0; y < int(getScrollHeight()); y++)
|
||||
{
|
||||
setPrintPos (1, 1 + y);
|
||||
|
||||
for (int x = 0; x < getScrollWidth(); x++)
|
||||
for (int x = 0; x < int(getScrollWidth()); x++)
|
||||
print (32 + ((x + y) % 0x5f));
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ void Scrollview::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void Scrollview::cb_go_east (finalcut::FWidget*, data_ptr)
|
||||
{
|
||||
scrollToX (getScrollWidth() - getViewportWidth() + 1);
|
||||
scrollToX (int(getScrollWidth() - getViewportWidth()) + 1);
|
||||
go_south.setFocus();
|
||||
go_east.redraw();
|
||||
go_south.redraw();
|
||||
|
@ -161,7 +161,7 @@ void Scrollview::cb_go_east (finalcut::FWidget*, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void Scrollview::cb_go_south (finalcut::FWidget*, data_ptr)
|
||||
{
|
||||
scrollToY (getScrollHeight() - getViewportHeight() + 1);
|
||||
scrollToY (int(getScrollHeight() - getViewportHeight()) + 1);
|
||||
go_west.setFocus();
|
||||
go_south.redraw();
|
||||
go_west.redraw();
|
||||
|
|
|
@ -77,9 +77,9 @@ AttribDlg::AttribDlg (finalcut::FWidget* parent)
|
|||
+ finalcut::FString(getTermType())
|
||||
+ ")");
|
||||
|
||||
next_button.setGeometry(getWidth() - 13, getHeight() - 4, 10, 1);
|
||||
next_button.setGeometry(int(getWidth()) - 13, int(getHeight()) - 4, 10, 1);
|
||||
next_button.addAccelerator(finalcut::fc::Fkey_right);
|
||||
back_button.setGeometry(getWidth() - 25, getHeight() - 4, 10, 1);
|
||||
back_button.setGeometry(int(getWidth()) - 25, int(getHeight()) - 4, 10, 1);
|
||||
back_button.addAccelerator(finalcut::fc::Fkey_left);
|
||||
|
||||
// Add function callbacks
|
||||
|
@ -155,8 +155,8 @@ void AttribDlg::cb_back (finalcut::FWidget*, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void AttribDlg::adjustSize()
|
||||
{
|
||||
int x = ((getParentWidget()->getWidth() - getWidth()) / 2);
|
||||
int y = ((getParentWidget()->getHeight() - getHeight()) / 2) + 1;
|
||||
int x = int((getParentWidget()->getWidth() - getWidth()) / 2);
|
||||
int y = int((getParentWidget()->getHeight() - getHeight()) / 2) + 1;
|
||||
|
||||
if ( x < 1 )
|
||||
x = 1;
|
||||
|
@ -165,8 +165,8 @@ void AttribDlg::adjustSize()
|
|||
y = 1;
|
||||
|
||||
setGeometry(x, y, 69, 21, false);
|
||||
next_button.setGeometry(getWidth() - 13, getHeight() - 4, 10, 1, false);
|
||||
back_button.setGeometry(getWidth() - 25, getHeight() - 4, 10, 1, false);
|
||||
next_button.setGeometry(int(getWidth()) - 13, int(getHeight()) - 4, 10, 1, false);
|
||||
back_button.setGeometry(int(getWidth()) - 25, int(getHeight()) - 4, 10, 1, false);
|
||||
finalcut::FDialog::adjustSize();
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@ void AttribDemo::draw()
|
|||
// test alternate character set
|
||||
printAltCharset();
|
||||
|
||||
for (int y = 0; y < getParentWidget()->getHeight() - 7; y++)
|
||||
for (int y = 0; y < int(getParentWidget()->getHeight()) - 7; y++)
|
||||
{
|
||||
setPrintPos (1, 2 + y);
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ void Timer::onTimer (finalcut::FTimerEvent* ev)
|
|||
bool is_last_line = false;
|
||||
int timer_id = ev->timerId();
|
||||
|
||||
if ( getPrintPos().getY() == getDesktopHeight() )
|
||||
if ( getPrintPos().getY() == int(getDesktopHeight()) )
|
||||
is_last_line = true;
|
||||
|
||||
setColor (short(1 + timer_id), finalcut::fc::Default);
|
||||
|
|
|
@ -105,7 +105,7 @@ void Transparent::draw()
|
|||
|
||||
finalcut::FString line(getClientWidth(), wchar_t('.'));
|
||||
|
||||
for (int n = 1; n <= getClientHeight(); n++)
|
||||
for (int n = 1; n <= int(getClientHeight()); n++)
|
||||
{
|
||||
setPrintPos (2, 2 + n);
|
||||
print(line);
|
||||
|
@ -264,7 +264,7 @@ void MainWindow::onShow (finalcut::FShowEvent*)
|
|||
void MainWindow::onTimer (finalcut::FTimerEvent*)
|
||||
{
|
||||
wchar_t first_Char[2];
|
||||
uInt length = line1.getLength();
|
||||
std::size_t length = line1.getLength();
|
||||
first_Char[0] = line1[0];
|
||||
first_Char[1] = line2[0];
|
||||
line1 = line1.right(length - 1) + first_Char[0];
|
||||
|
|
|
@ -297,7 +297,7 @@ Treeview::~Treeview() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
void Treeview::adjustSize()
|
||||
{
|
||||
int h = getParentWidget()->getHeight() - 4;
|
||||
std::size_t h = getParentWidget()->getHeight() - 4;
|
||||
setHeight (h, false);
|
||||
int X = int((getParentWidget()->getWidth() - getWidth()) / 2);
|
||||
|
||||
|
@ -309,7 +309,7 @@ void Treeview::adjustSize()
|
|||
if ( initialized )
|
||||
{
|
||||
listView.setHeight (getHeight() - 6, false);
|
||||
Quit.setY(getHeight() - 4);
|
||||
Quit.setY(int(getHeight()) - 4);
|
||||
}
|
||||
|
||||
finalcut::FDialog::adjustSize();
|
||||
|
|
|
@ -780,7 +780,7 @@ void MyDialog::initWidgetsCallbacks()
|
|||
//----------------------------------------------------------------------
|
||||
void MyDialog::adjustSize()
|
||||
{
|
||||
int h = getParentWidget()->getHeight() - 4;
|
||||
std::size_t h = getParentWidget()->getHeight() - 4;
|
||||
setHeight (h, false);
|
||||
int X = int((getParentWidget()->getWidth() - getWidth()) / 2);
|
||||
|
||||
|
@ -830,8 +830,8 @@ void MyDialog::cb_about (finalcut::FWidget*, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void MyDialog::cb_terminfo (finalcut::FWidget*, data_ptr)
|
||||
{
|
||||
int x = getDesktopWidth();
|
||||
int y = getDesktopHeight();
|
||||
std::size_t x = getDesktopWidth();
|
||||
std::size_t y = getDesktopHeight();
|
||||
finalcut::FMessageBox info1 \
|
||||
(
|
||||
"Environment"
|
||||
|
@ -961,10 +961,10 @@ void MyDialog::cb_updateNumber (finalcut::FWidget* widget, data_ptr data)
|
|||
finalcut::FListBox* list = static_cast<finalcut::FListBox*>(widget);
|
||||
finalcut::FLabel* num = static_cast<finalcut::FLabel*>(data);
|
||||
int select_num = 0;
|
||||
uInt count = list->getCount();
|
||||
std::size_t count = list->getCount();
|
||||
|
||||
for (uInt n = 1; n <= count; n++)
|
||||
if ( list->isSelected(int(n)) )
|
||||
for (std::size_t n = 1; n <= count; n++)
|
||||
if ( list->isSelected(n) )
|
||||
select_num++;
|
||||
|
||||
num->clear();
|
||||
|
@ -1006,7 +1006,7 @@ void MyDialog::cb_view (finalcut::FWidget*, data_ptr data)
|
|||
view->setGeometry ( 1 + int((getRootWidget()->getWidth() - 60) / 2),
|
||||
int(getRootWidget()->getHeight() / 6),
|
||||
60,
|
||||
int(getRootWidget()->getHeight() * 3 / 4) );
|
||||
getRootWidget()->getHeight() * 3 / 4 );
|
||||
view->setResizeable();
|
||||
|
||||
std::string line = "";
|
||||
|
|
|
@ -83,7 +83,7 @@ Watch::Watch (FWidget* parent)
|
|||
, quit_btn(L"&Quit", this)
|
||||
{
|
||||
setText ("Watch");
|
||||
int pw = getParentWidget()->getWidth();
|
||||
int pw = int(getParentWidget()->getWidth());
|
||||
setGeometry (1 + (pw - 22) / 2, 3, 22, 13);
|
||||
|
||||
// Labels
|
||||
|
@ -198,7 +198,7 @@ void Watch::cb_seconds (finalcut::FWidget*, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void Watch::adjustSize()
|
||||
{
|
||||
int pw = getParentWidget()->getWidth();
|
||||
int pw = int(getParentWidget()->getWidth());
|
||||
setX (1 + (pw - 22) / 2, false);
|
||||
finalcut::FDialog::adjustSize();
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
|||
right_arrow.setForegroundColor (wc.label_inactive_fg);
|
||||
right_arrow.setEmphasis();
|
||||
right_arrow.ignorePadding();
|
||||
right_arrow.setGeometry (getWidth() - 1, 2, 1, 1);
|
||||
right_arrow.setGeometry (int(getWidth()) - 1, 2, 1, 1);
|
||||
|
||||
top_left_label = "menu";
|
||||
top_left_label.setForegroundColor (wc.label_inactive_fg);
|
||||
|
@ -97,7 +97,7 @@ SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
|||
top_right_label.setAlignment (finalcut::fc::alignRight);
|
||||
top_right_label.setForegroundColor (wc.label_inactive_fg);
|
||||
top_right_label.setEmphasis();
|
||||
top_right_label.setGeometry (getClientWidth() - 5, 1, 6, 1);
|
||||
top_right_label.setGeometry (int(getClientWidth()) - 5, 1, 6, 1);
|
||||
|
||||
finalcut::FString bottom_label_text = "resize\n"
|
||||
"corner\n";
|
||||
|
@ -131,9 +131,9 @@ void SmallWindow::adjustSize()
|
|||
}
|
||||
|
||||
finalcut::FDialog::adjustSize();
|
||||
right_arrow.setGeometry (getWidth() - 1, 2, 1, 1);
|
||||
top_right_label.setGeometry (getClientWidth() - 5, 1, 6, 1);
|
||||
bottom_label.setGeometry (1, getClientHeight() - 2, getClientWidth(), 3);
|
||||
right_arrow.setGeometry (int(getWidth()) - 1, 2, 1, 1);
|
||||
top_right_label.setGeometry (int(getClientWidth()) - 5, 1, 6, 1);
|
||||
bottom_label.setGeometry (1, int(getClientHeight()) - 2, getClientWidth(), 3);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -368,12 +368,12 @@ void Window::activateWindow (finalcut::FDialog* win)
|
|||
void Window::adjustSize()
|
||||
{
|
||||
std::vector<win_data*>::const_iterator iter, first;
|
||||
int w = getRootWidget()->getWidth()
|
||||
, h = getRootWidget()->getHeight()
|
||||
, X = int(1 + (w - 40) / 2)
|
||||
std::size_t w = getRootWidget()->getWidth();
|
||||
std::size_t h = getRootWidget()->getHeight();
|
||||
int X = int(1 + (w - 40) / 2)
|
||||
, Y = int(1 + (h - 22) / 2)
|
||||
, dx = ( w > 80 ) ? (w - 80) / 2 : 0
|
||||
, dy = ( h > 24 ) ? (h - 24) / 2 : 0;
|
||||
, dx = ( w > 80 ) ? int(w - 80) / 2 : 0
|
||||
, dy = ( h > 24 ) ? int(h - 24) / 2 : 0;
|
||||
|
||||
if ( Y < 2 )
|
||||
Y = 2;
|
||||
|
@ -436,10 +436,10 @@ void Window::cb_createWindows (finalcut::FWidget*, data_ptr)
|
|||
{
|
||||
std::vector<win_data*>::const_iterator iter, first;
|
||||
iter = first = windows.begin();
|
||||
int w = getRootWidget()->getWidth()
|
||||
, h = getRootWidget()->getHeight()
|
||||
, dx = ( w > 80 ) ? (w - 80) / 2 : 0
|
||||
, dy = ( h > 24 ) ? (h - 24) / 2 : 0;
|
||||
std::size_t w = getRootWidget()->getWidth();
|
||||
std::size_t h = getRootWidget()->getHeight();
|
||||
int dx = ( w > 80 ) ? int(w - 80) / 2 : 0;
|
||||
int dy = ( h > 24 ) ? int(h - 24) / 2 : 0;
|
||||
|
||||
while ( iter != windows.end() )
|
||||
{
|
||||
|
|
|
@ -247,12 +247,12 @@
|
|||
y="93.333893"
|
||||
transform="scale(0.95126779,1.0512287)"
|
||||
id="text37-5"
|
||||
style="font-size:96px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0;word-spacing:0;writing-mode:lr-tb;text-anchor:start;fill:#9f9f9f;fill-opacity:0.6206896;fill-rule:evenodd;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans Semi-Bold">
|
||||
style="font-size:96px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0;word-spacing:0;writing-mode:lr-tb;text-anchor:start;fill:#9f9f9f;fill-opacity:0.6206896;fill-rule:evenodd;stroke:none;font-family:FreeSans, Arial, Bitstream Vera Sans, DejaVu Sans, Open Sans, sans-serif">
|
||||
<tspan
|
||||
x="160.94762"
|
||||
y="93.333893"
|
||||
id="tspan3006-1"
|
||||
style="font-size:96px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#9f9f9f;fill-opacity:0.6206896;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans Semi-Bold">FINAL CUT</tspan>
|
||||
style="font-size:96px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#9f9f9f;fill-opacity:0.6206896;stroke:none;font-family:FreeSans, Arial, Bitstream Vera Sans, DejaVu Sans, Open Sans, sans-serif">FINAL CUT</tspan>
|
||||
</text>
|
||||
<g
|
||||
id="g23"
|
||||
|
@ -293,11 +293,11 @@
|
|||
y="91.775856"
|
||||
transform="scale(0.95126779,1.0512287)"
|
||||
id="text37"
|
||||
style="font-size:96px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0;word-spacing:0;writing-mode:lr-tb;text-anchor:start;fill:#083c99;fill-opacity:0.88747732;fill-rule:evenodd;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans Semi-Bold">
|
||||
style="font-size:96px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0;word-spacing:0;writing-mode:lr-tb;text-anchor:start;fill:#083c99;fill-opacity:0.88747732;fill-rule:evenodd;stroke:none;font-family:FreeSans, Arial, Bitstream Vera Sans, DejaVu Sans, Open Sans, sans-serif">
|
||||
<tspan
|
||||
x="158.56929"
|
||||
y="91.775856"
|
||||
id="tspan3006"
|
||||
style="font-size:96px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#083c99;fill-opacity:0.88747732;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans Semi-Bold">FINAL CUT</tspan>
|
||||
style="font-size:96px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#083c99;fill-opacity:0.88747732;stroke:none;font-family:FreeSans, Arial, Bitstream Vera Sans, DejaVu Sans, Open Sans, sans-serif">FINAL CUT</tspan>
|
||||
</text>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
|
@ -62,7 +62,7 @@ INCLUDE_HEADERS = \
|
|||
|
||||
# compiler parameter
|
||||
CXX = clang++
|
||||
CCXFLAGS = $(OPTIMIZE) $(PROFILE) -DCOMPILE_FINAL_CUT $(DEBUG) $(VER) $(GPM) -march=x86-64 -frtti -fexceptions
|
||||
CCXFLAGS = $(OPTIMIZE) $(PROFILE) -DCOMPILE_FINAL_CUT $(DEBUG) $(VER) $(GPM) -fexceptions
|
||||
MAKEFILE = -f Makefile.clang
|
||||
LDFLAGS = $(TERMCAP) -lgpm
|
||||
INCLUDES = -Iinclude
|
||||
|
@ -148,7 +148,7 @@ all: dep $(OBJS)
|
|||
$(LIB): all
|
||||
|
||||
debug:
|
||||
$(MAKE) $(MAKEFILE) DEBUG="-g -D DEBUG -Wall -Wextra -Wpedantic -Weverything -Wpadded"
|
||||
$(MAKE) $(MAKEFILE) DEBUG="-g -D DEBUG -Wall -Wextra -Wpedantic -Weverything -Wpadded -Wno-reserved-id-macro"
|
||||
|
||||
profile:
|
||||
$(MAKE) $(MAKEFILE) PROFILE="-pg"
|
||||
|
|
|
@ -62,7 +62,7 @@ INCLUDE_HEADERS = \
|
|||
|
||||
# compiler parameter
|
||||
CXX = g++
|
||||
CCXFLAGS = $(OPTIMIZE) $(PROFILE) -DCOMPILE_FINAL_CUT $(DEBUG) $(VER) $(GPM) -march=x86-64 -frtti -fexceptions
|
||||
CCXFLAGS = $(OPTIMIZE) $(PROFILE) -DCOMPILE_FINAL_CUT $(DEBUG) $(VER) $(GPM) -fexceptions
|
||||
MAKEFILE = -f Makefile.gcc
|
||||
LDFLAGS = $(TERMCAP) -lgpm
|
||||
INCLUDES = -Iinclude
|
||||
|
|
|
@ -263,7 +263,7 @@ void FButton::setText (const FString& txt)
|
|||
//----------------------------------------------------------------------
|
||||
void FButton::hide()
|
||||
{
|
||||
int s, f, size;
|
||||
std::size_t s, f, size;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
@ -285,12 +285,12 @@ void FButton::hide()
|
|||
f = isFlat() ? 1 : 0;
|
||||
size = getWidth() + s + (f << 1);
|
||||
|
||||
if ( size < 0 )
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
blank = new char[std::size_t(size) + 1];
|
||||
blank = new char[size + 1];
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -298,12 +298,12 @@ void FButton::hide()
|
|||
return;
|
||||
}
|
||||
|
||||
std::memset(blank, ' ', std::size_t(size));
|
||||
std::memset(blank, ' ', size);
|
||||
blank[size] = '\0';
|
||||
|
||||
for (int y = 0; y < getHeight() + s + (f << 1); y++)
|
||||
for (std::size_t y = 0; y < getHeight() + s + (f << 1); y++)
|
||||
{
|
||||
setPrintPos (1 - f, 1 + y - f);
|
||||
setPrintPos (1 - int(f), 1 + int(y - f));
|
||||
print (blank);
|
||||
}
|
||||
|
||||
|
@ -489,14 +489,12 @@ void FButton::getButtonState()
|
|||
//----------------------------------------------------------------------
|
||||
uChar FButton::getHotkey()
|
||||
{
|
||||
uInt length;
|
||||
|
||||
if ( text.isEmpty() )
|
||||
return 0;
|
||||
|
||||
length = text.getLength();
|
||||
std::size_t length = text.getLength();
|
||||
|
||||
for (uInt i = 0; i < length; i++)
|
||||
for (std::size_t i = 0; i < length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -544,14 +542,16 @@ inline void FButton::detectHotkey()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FButton::getHotkeyPos (wchar_t src[], wchar_t dest[], uInt length)
|
||||
int 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;
|
||||
|
||||
for (uInt i = 0; i < length; i++)
|
||||
for (std::size_t i = 0; i < length; i++)
|
||||
{
|
||||
if ( i < length && txt[i] == L'&' && pos == -1 )
|
||||
{
|
||||
|
@ -582,7 +582,7 @@ inline int FButton::clickAnimationIndent (FWidget* parent_widget)
|
|||
setColor ( parent_widget->getForegroundColor()
|
||||
, parent_widget->getBackgroundColor() );
|
||||
|
||||
for (int y = 1; y <= getHeight(); y++)
|
||||
for (int y = 1; y <= int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (1, y);
|
||||
print (' '); // clear one left █
|
||||
|
@ -602,12 +602,12 @@ inline void FButton::clearRightMargin (FWidget* parent_widget)
|
|||
setColor ( parent_widget->getForegroundColor()
|
||||
, parent_widget->getBackgroundColor() );
|
||||
|
||||
for (int y = 1; y <= getHeight(); y++)
|
||||
for (int y = 1; y <= int(getHeight()); y++)
|
||||
{
|
||||
if ( isMonochron() )
|
||||
setReverse(true); // Light background
|
||||
|
||||
setPrintPos (1 + getWidth(), y);
|
||||
setPrintPos (1 + int(getWidth()), y);
|
||||
print (' '); // clear right
|
||||
|
||||
if ( is.active && isMonochron() )
|
||||
|
@ -622,7 +622,7 @@ inline void FButton::drawMarginLeft()
|
|||
|
||||
setColor (getForegroundColor(), button_bg);
|
||||
|
||||
for (int y = 0; y < getHeight(); y++)
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (1 + indent, 1 + y);
|
||||
|
||||
|
@ -638,9 +638,9 @@ inline void FButton::drawMarginRight()
|
|||
{
|
||||
// Print right margin
|
||||
|
||||
for (int y = 0; y < getHeight(); y++)
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (getWidth() + indent, 1 + y);
|
||||
setPrintPos (int(getWidth()) + indent, 1 + y);
|
||||
|
||||
if ( isMonochron() && is.active_focus && y == vcenter_offset )
|
||||
print (fc::BlackLeftPointingPointer); // ◄
|
||||
|
@ -661,15 +661,15 @@ inline void FButton::drawTopBottomBackground()
|
|||
{
|
||||
setPrintPos (2 + indent, 1 + y);
|
||||
|
||||
for (int x = 1; x < getWidth() - 1; x++)
|
||||
for (std::size_t x = 1; x < getWidth() - 1; x++)
|
||||
print (space); // █
|
||||
}
|
||||
|
||||
for (int y = vcenter_offset + 1; y < getHeight(); y++)
|
||||
for (int y = vcenter_offset + 1; y < int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (2 + indent, 1 + y);
|
||||
|
||||
for (int x = 1; x < getWidth() - 1; x++)
|
||||
for (std::size_t x = 1; x < getWidth() - 1; x++)
|
||||
print (space); // █
|
||||
}
|
||||
}
|
||||
|
@ -678,7 +678,7 @@ inline void FButton::drawTopBottomBackground()
|
|||
inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||
{
|
||||
int pos;
|
||||
center_offset = int((getWidth() - txtlength - 1) / 2);
|
||||
center_offset = int((int(getWidth()) - txtlength - 1) / 2);
|
||||
setPrintPos (2 + indent, 1 + vcenter_offset);
|
||||
setColor (button_fg, button_bg);
|
||||
|
||||
|
@ -700,7 +700,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
|||
setBold();
|
||||
|
||||
for ( int z = 0
|
||||
; pos < center_offset + txtlength && z < getWidth() - 2
|
||||
; pos < center_offset + txtlength && z < int(getWidth()) - 2
|
||||
; z++, pos++)
|
||||
{
|
||||
if ( (z == hotkeypos) && is.active )
|
||||
|
@ -729,17 +729,17 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
|||
}
|
||||
}
|
||||
|
||||
if ( txtlength >= getWidth() - 1 )
|
||||
if ( txtlength >= int(getWidth()) - 1 )
|
||||
{
|
||||
// Print ellipsis
|
||||
setPrintPos (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 < getWidth() - 2; pos++)
|
||||
for (pos = center_offset + txtlength; pos < int(getWidth()) - 2; pos++)
|
||||
print (space); // █
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ bool FButtonGroup::hasCheckedButton() const
|
|||
//----------------------------------------------------------------------
|
||||
void FButtonGroup::hide()
|
||||
{
|
||||
int size;
|
||||
std::size_t size;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget::hide();
|
||||
|
@ -223,12 +223,12 @@ void FButtonGroup::hide()
|
|||
setColor (fg, bg);
|
||||
size = getWidth();
|
||||
|
||||
if ( size < 0 )
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
blank = new char[std::size_t(size) + 1];
|
||||
blank = new char[size + 1];
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -236,10 +236,10 @@ void FButtonGroup::hide()
|
|||
return;
|
||||
}
|
||||
|
||||
std::memset(blank, ' ', std::size_t(size));
|
||||
std::memset(blank, ' ', size);
|
||||
blank[size] = '\0';
|
||||
|
||||
for (int y = 0; y < getHeight(); y++)
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
{
|
||||
FWidget::setPrintPos (1, 1 + y);
|
||||
print (blank);
|
||||
|
@ -443,14 +443,12 @@ void FButtonGroup::cb_buttonToggled (FWidget* widget, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
uChar FButtonGroup::getHotkey()
|
||||
{
|
||||
uInt length;
|
||||
|
||||
if ( text.isEmpty() )
|
||||
return 0;
|
||||
|
||||
length = text.getLength();
|
||||
std::size_t length = text.getLength();
|
||||
|
||||
for (uInt i = 0; i < length; i++)
|
||||
for (std::size_t i = 0; i < length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -512,7 +510,7 @@ void FButtonGroup::drawLabel()
|
|||
return;
|
||||
|
||||
FString txt = " " + text + " ";
|
||||
uInt length = txt.getLength();
|
||||
std::size_t length = txt.getLength();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -527,7 +525,7 @@ void FButtonGroup::drawLabel()
|
|||
wchar_t* src = const_cast<wchar_t*>(txt.wc_str());
|
||||
wchar_t* dest = const_cast<wchar_t*>(LabelText);
|
||||
unsetViewportPrint();
|
||||
hotkeypos = getHotkeyPos(src, dest, uInt(length));
|
||||
hotkeypos = getHotkeyPos(src, dest, length);
|
||||
|
||||
if ( hotkeypos != -1 )
|
||||
length--;
|
||||
|
@ -567,7 +565,9 @@ void FButtonGroup::init()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FButtonGroup::getHotkeyPos (wchar_t src[], wchar_t dest[], uInt length)
|
||||
int FButtonGroup::getHotkeyPos ( wchar_t src[]
|
||||
, wchar_t dest[]
|
||||
, std::size_t length )
|
||||
{
|
||||
// find hotkey position in string
|
||||
// + generate a new string without the '&'-sign
|
||||
|
@ -590,7 +590,9 @@ int FButtonGroup::getHotkeyPos (wchar_t src[], wchar_t dest[], uInt length)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FButtonGroup::drawText (wchar_t LabelText[], int hotkeypos, uInt length)
|
||||
void FButtonGroup::drawText ( wchar_t LabelText[]
|
||||
, int hotkeypos
|
||||
, std::size_t length )
|
||||
{
|
||||
bool isActive = ((flags & fc::active) != 0);
|
||||
bool isNoUnderline = ((flags & fc::no_underline) != 0);
|
||||
|
|
103
src/fdialog.cpp
103
src/fdialog.cpp
|
@ -213,11 +213,14 @@ void FDialog::setPos (int x, int y, bool)
|
|||
return;
|
||||
}
|
||||
|
||||
width = getWidth();
|
||||
height = getHeight();
|
||||
width = int(getWidth());
|
||||
height = int(getHeight());
|
||||
|
||||
// Avoid to move widget completely outside the terminal
|
||||
if ( x + width <= 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() )
|
||||
if ( x + width <= 1
|
||||
|| x > int(getMaxWidth())
|
||||
|| y < 1
|
||||
|| y > int(getMaxHeight()) )
|
||||
{
|
||||
setPos_error = true;
|
||||
return;
|
||||
|
@ -256,7 +259,7 @@ void FDialog::setPos (int x, int y, bool)
|
|||
{
|
||||
if ( dy > 0 )
|
||||
restoreVTerm ( old_x + width + rsw - dx, old_y
|
||||
, dx, getHeight() + bsh - dy );
|
||||
, dx, height + bsh - dy );
|
||||
else
|
||||
restoreVTerm ( old_x + width + rsw - dx, old_y + std::abs(dy)
|
||||
, dx, height + bsh - std::abs(dy));
|
||||
|
@ -321,7 +324,7 @@ inline bool FDialog::moveRight (int n)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FDialog::setSize (int w, int h, bool adjust)
|
||||
void FDialog::setSize (std::size_t w, std::size_t h, bool adjust)
|
||||
{
|
||||
setSize_error = false;
|
||||
|
||||
|
@ -339,10 +342,10 @@ void FDialog::setSize (int w, int h, bool adjust)
|
|||
|
||||
int x = getTermX()
|
||||
, y = getTermY()
|
||||
, old_width = getWidth()
|
||||
, old_height = getHeight()
|
||||
, dw = old_width - w
|
||||
, dh = old_height - h;
|
||||
, old_width = int(getWidth())
|
||||
, old_height = int(getHeight())
|
||||
, dw = old_width - int(w)
|
||||
, dh = old_height - int(h);
|
||||
const FPoint& shadow = getShadow();
|
||||
int rsw = shadow.getX(); // right shadow width;
|
||||
int bsh = shadow.getY(); // bottom shadow height
|
||||
|
@ -362,10 +365,10 @@ void FDialog::setSize (int w, int h, bool adjust)
|
|||
|
||||
// restoring the non-covered terminal areas
|
||||
if ( dw > 0 )
|
||||
restoreVTerm (x + w + rsw, y, dw, h + bsh + dh); // restore right
|
||||
restoreVTerm (x + int(w) + rsw, y, dw, int(h) + bsh + dh); // restore right
|
||||
|
||||
if ( dh > 0 )
|
||||
restoreVTerm (x, y + h + bsh, w + rsw + dw, dh); // restore bottom
|
||||
restoreVTerm (x, y + int(h) + bsh, int(w) + rsw + dw, dh); // restore bottom
|
||||
|
||||
redraw();
|
||||
|
||||
|
@ -406,17 +409,17 @@ bool FDialog::reduceHeight (int n)
|
|||
if ( ! isResizeable() )
|
||||
return false;
|
||||
|
||||
setSize (getWidth(), getHeight() - n);
|
||||
setSize (getWidth(), getHeight() - std::size_t(n));
|
||||
return ! setSize_error;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FDialog::expandHeight (int n)
|
||||
{
|
||||
if ( ! isResizeable() || getHeight() + getY() > getMaxHeight() )
|
||||
if ( ! isResizeable() || getHeight() + std::size_t(getY()) > getMaxHeight() )
|
||||
return false;
|
||||
|
||||
setSize (getWidth(), getHeight() + n);
|
||||
setSize (getWidth(), getHeight() + std::size_t(n));
|
||||
return ! setSize_error;
|
||||
}
|
||||
|
||||
|
@ -426,17 +429,17 @@ bool FDialog::reduceWidth (int n)
|
|||
if ( ! isResizeable() )
|
||||
return false;
|
||||
|
||||
setSize (getWidth() - n, getHeight());
|
||||
setSize (getWidth() - std::size_t(n), getHeight());
|
||||
return ! setSize_error;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FDialog::expandWidth (int n)
|
||||
{
|
||||
if ( ! isResizeable() || getWidth() + getX() > getMaxWidth() )
|
||||
if ( ! isResizeable() || getWidth() + std::size_t(getX()) > getMaxWidth() )
|
||||
return false;
|
||||
|
||||
setSize (getWidth() + n, getHeight());
|
||||
setSize (getWidth() + std::size_t(n), getHeight());
|
||||
return ! setSize_error;
|
||||
}
|
||||
|
||||
|
@ -515,6 +518,8 @@ void FDialog::onKeyPress (FKeyEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FDialog::onMouseDown (FMouseEvent* ev)
|
||||
{
|
||||
int width = int(getWidth());
|
||||
|
||||
mouseStates ms =
|
||||
{
|
||||
ev->getX(),
|
||||
|
@ -532,7 +537,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
|||
raiseActivateDialog();
|
||||
|
||||
if ( ms.mouse_x >= 4
|
||||
&& ms.mouse_x <= getWidth() - ms.zoom_btn
|
||||
&& ms.mouse_x <= width - int(ms.zoom_btn)
|
||||
&& ms.mouse_y == 1 )
|
||||
titlebar_click_pos.setPoint (ev->getTermX(), ev->getTermY());
|
||||
else
|
||||
|
@ -560,13 +565,13 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
|||
// Click on titlebar: just activate
|
||||
if ( ev->getButton() == fc::RightButton
|
||||
&& ms.mouse_x >= 4
|
||||
&& ms.mouse_x <= getWidth()
|
||||
&& ms.mouse_x <= width
|
||||
&& ms.mouse_y == 1 )
|
||||
activateDialog();
|
||||
|
||||
// Click on titlebar: lower + activate
|
||||
if ( ev->getButton() == fc::MiddleButton
|
||||
&& ms.mouse_x >= 4 && ms.mouse_x <= getWidth()
|
||||
&& ms.mouse_x >= 4 && ms.mouse_x <= width
|
||||
&& ms.mouse_y == 1 )
|
||||
lowerActivateDialog();
|
||||
}
|
||||
|
@ -589,9 +594,9 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
|||
, titlebar_y = titlebar_click_pos.getY();
|
||||
|
||||
if ( ! titlebar_click_pos.isNull()
|
||||
&& titlebar_x > getTermX() + 3
|
||||
&& titlebar_x < getTermX() + getWidth()
|
||||
&& titlebar_y == getTermY() )
|
||||
&& titlebar_x > int(getTermX()) + 3
|
||||
&& titlebar_x < getTermX() + int(getWidth())
|
||||
&& titlebar_y == int(getTermY()) )
|
||||
{
|
||||
FPoint deltaPos = ms.termPos - titlebar_click_pos;
|
||||
move (deltaPos);
|
||||
|
@ -693,7 +698,7 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
|||
}
|
||||
else if ( isResizeable()
|
||||
&& ms.mouse_x >= 4
|
||||
&& ms.mouse_x <= getWidth() - ms.zoom_btn
|
||||
&& ms.mouse_x <= int(getWidth() - ms.zoom_btn)
|
||||
&& ms.mouse_y == 1 )
|
||||
{
|
||||
// Double click on titlebar
|
||||
|
@ -828,7 +833,7 @@ void FDialog::draw()
|
|||
clearArea();
|
||||
drawBorder();
|
||||
drawTitleBar();
|
||||
setCursorPos(2, getHeight() - 1);
|
||||
setCursorPos(2, int(getHeight()) - 1);
|
||||
|
||||
if ( (flags & fc::shadow) != 0 )
|
||||
drawDialogShadow();
|
||||
|
@ -1009,9 +1014,9 @@ void FDialog::initCloseMenuItem (FMenu* menu)
|
|||
void FDialog::drawBorder()
|
||||
{
|
||||
int x1 = 1
|
||||
, x2 = 1 + getWidth() - 1
|
||||
, x2 = 1 + int(getWidth()) - 1
|
||||
, y1 = 2
|
||||
, y2 = 1 + getHeight() - 1;
|
||||
, y2 = 1 + int(getHeight()) - 1;
|
||||
|
||||
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isNull() )
|
||||
&& ! isZoomed() )
|
||||
|
@ -1035,7 +1040,7 @@ void FDialog::drawBorder()
|
|||
// Lower left corner border ⎣
|
||||
print (fc::NF_border_corner_lower_left);
|
||||
|
||||
for (int x = 1; x < getWidth() - 1; x++) // low line _
|
||||
for (std::size_t x = 1; x < getWidth() - 1; x++) // low line _
|
||||
print (fc::NF_border_line_bottom);
|
||||
|
||||
setPrintPos (x2, y2);
|
||||
|
@ -1193,7 +1198,8 @@ inline void FDialog::drawZoomedButton()
|
|||
void FDialog::drawTextBar()
|
||||
{
|
||||
// Fill with spaces (left of the title)
|
||||
int center_offset
|
||||
std::size_t center_offset
|
||||
, width
|
||||
, zoom_btn
|
||||
, length
|
||||
, x;
|
||||
|
@ -1206,9 +1212,10 @@ void FDialog::drawTextBar()
|
|||
else
|
||||
setColor (wc.titlebar_inactive_fg, wc.titlebar_inactive_bg);
|
||||
|
||||
width = std::size_t(getWidth());
|
||||
zoom_btn = getZoomButtonWidth();
|
||||
length = int(tb_text.getLength());
|
||||
center_offset = int((getWidth() - length - MENU_BTN - zoom_btn) / 2);
|
||||
length = tb_text.getLength();
|
||||
center_offset = (width - length - MENU_BTN - zoom_btn) / 2;
|
||||
|
||||
for (x = 1; x <= center_offset; x++)
|
||||
print (' ');
|
||||
|
@ -1216,18 +1223,18 @@ void FDialog::drawTextBar()
|
|||
// Print title bar text
|
||||
if ( ! tb_text.isEmpty() )
|
||||
{
|
||||
if ( length <= getWidth() - MENU_BTN - zoom_btn )
|
||||
if ( length <= width - MENU_BTN - zoom_btn )
|
||||
print (tb_text);
|
||||
else
|
||||
{
|
||||
// Print ellipsis
|
||||
print (tb_text.left(getWidth() - MENU_BTN - zoom_btn - 2));
|
||||
print (tb_text.left(width - MENU_BTN - zoom_btn - 2));
|
||||
print ("..");
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the rest of the bar
|
||||
for ( ; x + 1 + length < getWidth() - zoom_btn - 1; x++)
|
||||
for ( ; x + 1 + length < width - zoom_btn - 1; x++)
|
||||
print (' ');
|
||||
|
||||
if ( getMaxColor() < 16 )
|
||||
|
@ -1358,7 +1365,7 @@ void FDialog::setZoomItem()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FDialog::getZoomButtonWidth()
|
||||
inline std::size_t FDialog::getZoomButtonWidth()
|
||||
{
|
||||
if ( ! isResizeable() )
|
||||
return 0;
|
||||
|
@ -1382,7 +1389,7 @@ inline void FDialog::deactivateZoomButton()
|
|||
//----------------------------------------------------------------------
|
||||
inline void FDialog::activateZoomButton (mouseStates& ms)
|
||||
{
|
||||
if ( ms.mouse_x <= getWidth() - ms.zoom_btn
|
||||
if ( ms.mouse_x <= int(getWidth() - ms.zoom_btn)
|
||||
|| ms.mouse_y != 1 )
|
||||
return;
|
||||
|
||||
|
@ -1396,8 +1403,8 @@ inline void FDialog::leaveZoomButton (mouseStates& ms)
|
|||
{
|
||||
bool zoom_button_pressed_before = zoom_button_pressed;
|
||||
|
||||
if ( ms.mouse_x > getWidth() - ms.zoom_btn
|
||||
&& ms.mouse_x <= getWidth()
|
||||
if ( ms.mouse_x > int(getWidth() - ms.zoom_btn)
|
||||
&& ms.mouse_x <= int(getWidth())
|
||||
&& ms.mouse_y == 1
|
||||
&& zoom_button_active )
|
||||
zoom_button_pressed = true;
|
||||
|
@ -1411,7 +1418,7 @@ inline void FDialog::leaveZoomButton (mouseStates& ms)
|
|||
//----------------------------------------------------------------------
|
||||
void FDialog::pressZoomButton (mouseStates& ms)
|
||||
{
|
||||
if ( ms.mouse_x <= getWidth() - ms.zoom_btn
|
||||
if ( ms.mouse_x <= int(getWidth() - ms.zoom_btn)
|
||||
|| ms.mouse_y != 1
|
||||
|| ! zoom_button_pressed )
|
||||
return;
|
||||
|
@ -1555,9 +1562,9 @@ bool FDialog::isLowerRightResizeCorner (mouseStates& ms)
|
|||
// x
|
||||
// -----xx
|
||||
|
||||
if ( (ms.mouse_x == getWidth() && ms.mouse_y == getHeight() - 1)
|
||||
|| ( ( ms.mouse_x == getWidth() - 1
|
||||
|| ms.mouse_x == getWidth() ) && ms.mouse_y == getHeight() ) )
|
||||
if ( (ms.mouse_x == int(getWidth()) && ms.mouse_y == int(getHeight()) - 1)
|
||||
|| ( ( ms.mouse_x == int(getWidth()) - 1
|
||||
|| ms.mouse_x == int(getWidth()) ) && ms.mouse_y == int(getHeight()) ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -1582,7 +1589,7 @@ void FDialog::resizeMouseDown (mouseStates& ms)
|
|||
FPoint deltaPos = ms.termPos - lower_right_pos;
|
||||
int w = lower_right_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
||||
int h = lower_right_pos.getY() + deltaPos.getY() - getTermY() + 1;
|
||||
setSize (w, h);
|
||||
setSize (std::size_t(w), std::size_t(h));
|
||||
}
|
||||
else
|
||||
drawBorder();
|
||||
|
@ -1615,17 +1622,17 @@ void FDialog::resizeMouseUpMove (mouseStates& ms, bool mouse_up)
|
|||
int w, h;
|
||||
FPoint deltaPos = ms.termPos - resize_click_pos;
|
||||
|
||||
if ( x2 - x2_offset <= getMaxWidth() )
|
||||
if ( x2 - x2_offset <= int(getMaxWidth()) )
|
||||
w = resize_click_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
||||
else
|
||||
w = getMaxWidth() - getTermX() + x2_offset + 1;
|
||||
w = int(getMaxWidth()) - getTermX() + x2_offset + 1;
|
||||
|
||||
if ( y2 - y2_offset <= getMaxHeight() )
|
||||
if ( y2 - y2_offset <= int(getMaxHeight()) )
|
||||
h = resize_click_pos.getY() + deltaPos.getY() - getTermY() + 1;
|
||||
else
|
||||
h = getMaxHeight() - getTermY() + y2_offset + 1;
|
||||
h = int(getMaxHeight()) - getTermY() + y2_offset + 1;
|
||||
|
||||
setSize (w, h);
|
||||
setSize (std::size_t(w), std::size_t(h));
|
||||
}
|
||||
|
||||
if ( mouse_up )
|
||||
|
|
|
@ -337,11 +337,10 @@ const FString FFileDialog::fileSaveChooser ( FWidget* parent
|
|||
//----------------------------------------------------------------------
|
||||
void FFileDialog::adjustSize()
|
||||
{
|
||||
int h
|
||||
, X
|
||||
, Y
|
||||
, max_width
|
||||
, max_height;
|
||||
int X, Y;
|
||||
std::size_t max_width;
|
||||
std::size_t max_height;
|
||||
std::size_t h;
|
||||
FWidget* root_widget = getRootWidget();
|
||||
|
||||
if ( root_widget )
|
||||
|
@ -369,9 +368,9 @@ void FFileDialog::adjustSize()
|
|||
Y = 1 + int((max_height - getHeight()) / 3);
|
||||
setPos(X, Y, false);
|
||||
filebrowser.setHeight (h - 8, false);
|
||||
hidden.setY (h - 4, false);
|
||||
cancel.setY (h - 4, false);
|
||||
open.setY (h - 4, false);
|
||||
hidden.setY (int(h) - 4, false);
|
||||
cancel.setY (int(h) - 4, false);
|
||||
open.setY (int(h) - 4, false);
|
||||
FDialog::adjustSize();
|
||||
printPath(directory);
|
||||
}
|
||||
|
@ -381,8 +380,8 @@ void FFileDialog::adjustSize()
|
|||
//----------------------------------------------------------------------
|
||||
void FFileDialog::init()
|
||||
{
|
||||
static const int w = 42;
|
||||
static const int h = 15;
|
||||
static const std::size_t w = 42;
|
||||
static const std::size_t h = 15;
|
||||
int x, y;
|
||||
FWidget* parent_widget;
|
||||
|
||||
|
@ -751,7 +750,7 @@ int FFileDialog::changeDir (const FString& dirname)
|
|||
filename.setText('/');
|
||||
else if ( ! dir_entries.empty() )
|
||||
{
|
||||
int i = 1;
|
||||
std::size_t i = 1;
|
||||
std::vector<dir_entry>::const_iterator iter, last;
|
||||
const char* const baseName = \
|
||||
basename(C_STR(lastdir.c_str()));
|
||||
|
@ -872,14 +871,14 @@ void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
|||
//----------------------------------------------------------------------
|
||||
void FFileDialog::cb_processRowChanged (FWidget*, data_ptr)
|
||||
{
|
||||
const int n = filebrowser.currentItem();
|
||||
const std::size_t n = filebrowser.currentItem();
|
||||
|
||||
if ( n == 0 )
|
||||
return;
|
||||
|
||||
const FString& name = dir_entries[uLong(n - 1)].name;
|
||||
const FString& name = dir_entries[n - 1].name;
|
||||
|
||||
if ( dir_entries[uLong(n - 1)].directory )
|
||||
if ( dir_entries[n - 1].directory )
|
||||
filename.setText( name + '/' );
|
||||
else
|
||||
filename.setText( name );
|
||||
|
|
|
@ -238,9 +238,9 @@ inline int FKeyboard::getTermcapKey()
|
|||
for (int i = 0; keymap[i].tname[0] != 0; i++)
|
||||
{
|
||||
char* k = keymap[i].string;
|
||||
int len = ( k ) ? int(std::strlen(k)) : 0;
|
||||
std::size_t len = ( k ) ? std::strlen(k) : 0;
|
||||
|
||||
if ( k && std::strncmp(k, fifo_buf, uInt(len)) == 0 ) // found
|
||||
if ( k && std::strncmp(k, fifo_buf, len) == 0 ) // found
|
||||
{
|
||||
std::size_t n;
|
||||
|
||||
|
@ -268,9 +268,9 @@ inline int FKeyboard::getMetaKey()
|
|||
for (int i = 0; fc::Fmetakey[i].string[0] != 0; i++)
|
||||
{
|
||||
char* kmeta = fc::Fmetakey[i].string; // The string is never null
|
||||
int len = int(std::strlen(kmeta));
|
||||
std::size_t len = std::strlen(kmeta);
|
||||
|
||||
if ( std::strncmp(kmeta, fifo_buf, uInt(len)) == 0 ) // found
|
||||
if ( std::strncmp(kmeta, fifo_buf, len) == 0 ) // found
|
||||
{
|
||||
std::size_t n;
|
||||
|
||||
|
@ -303,8 +303,8 @@ inline int FKeyboard::getSingleKey()
|
|||
|
||||
uChar firstchar = uChar(fifo_buf[0]);
|
||||
std::size_t n;
|
||||
int keycode, len;
|
||||
len = 1;
|
||||
std::size_t len = 1;
|
||||
int keycode;
|
||||
|
||||
// Look for a utf-8 character
|
||||
if ( utf8_input && (firstchar & 0xc0) == 0xc0 )
|
||||
|
@ -318,7 +318,7 @@ inline int FKeyboard::getSingleKey()
|
|||
else if ( (firstchar & 0xf8) == 0xf0 )
|
||||
len = 4;
|
||||
|
||||
for (int i = 0; i < len ; i++)
|
||||
for (std::size_t i = 0; i < len ; i++)
|
||||
utf8char[i] = char(fifo_buf[i] & 0xff);
|
||||
|
||||
keycode = UTF8decode(utf8char);
|
||||
|
|
|
@ -242,7 +242,7 @@ void FLabel::setText (const FString& txt)
|
|||
void FLabel::hide()
|
||||
{
|
||||
short fg, bg;
|
||||
int size;
|
||||
std::size_t size;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
|
@ -262,12 +262,12 @@ void FLabel::hide()
|
|||
setColor (fg, bg);
|
||||
size = getWidth();
|
||||
|
||||
if ( size < 0 )
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
blank = new char[std::size_t(size) + 1];
|
||||
blank = new char[size + 1];
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -275,9 +275,9 @@ void FLabel::hide()
|
|||
return;
|
||||
}
|
||||
|
||||
std::memset(blank, ' ', std::size_t(size));
|
||||
std::memset(blank, ' ', size);
|
||||
blank[getWidth()] = '\0';
|
||||
setPrintPos (1,1);
|
||||
setPrintPos (1, 1);
|
||||
print (blank);
|
||||
delete[] blank;
|
||||
}
|
||||
|
@ -397,14 +397,12 @@ void FLabel::init()
|
|||
//----------------------------------------------------------------------
|
||||
uChar FLabel::getHotkey()
|
||||
{
|
||||
uInt length;
|
||||
|
||||
if ( text.isEmpty() )
|
||||
return 0;
|
||||
|
||||
length = text.getLength();
|
||||
std::size_t length = text.getLength();
|
||||
|
||||
for (uInt i = 0; i < length; i++)
|
||||
for (std::size_t i = 0; i < length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -421,14 +419,16 @@ uChar FLabel::getHotkey()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FLabel::getHotkeyPos (wchar_t src[], wchar_t dest[], uInt length)
|
||||
int 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;
|
||||
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'&' && hotkeypos == -1 )
|
||||
{
|
||||
|
@ -465,22 +465,24 @@ void FLabel::setHotkeyAccelerator()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FLabel::getAlignOffset (int length)
|
||||
std::size_t FLabel::getAlignOffset (std::size_t length)
|
||||
{
|
||||
std::size_t width = std::size_t(getWidth());
|
||||
|
||||
switch ( alignment )
|
||||
{
|
||||
case fc::alignLeft:
|
||||
return 0;
|
||||
|
||||
case fc::alignCenter:
|
||||
if ( length < getWidth() )
|
||||
return int((getWidth() - length) / 2);
|
||||
if ( length < width )
|
||||
return std::size_t((width - length) / 2);
|
||||
else
|
||||
return 0;
|
||||
|
||||
case fc::alignRight:
|
||||
if ( length < getWidth() )
|
||||
return getWidth() - length;
|
||||
if ( length < width )
|
||||
return width - length;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
@ -522,15 +524,16 @@ void FLabel::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void FLabel::drawMultiLine()
|
||||
{
|
||||
uInt y = 0;
|
||||
uInt text_lines = uInt(multiline_text.size());
|
||||
std::size_t y = 0;
|
||||
std::size_t text_lines = multiline_text.size();
|
||||
bool hotkey_printed = false;
|
||||
|
||||
while ( y < text_lines && y < uInt(getHeight()) )
|
||||
while ( y < text_lines && y < std::size_t(getHeight()) )
|
||||
{
|
||||
wchar_t* label_text;
|
||||
int align_offset, hotkeypos = -1;
|
||||
uInt length = multiline_text[y].getLength();
|
||||
int hotkeypos = -1;
|
||||
std::size_t align_offset;
|
||||
std::size_t length = multiline_text[y].getLength();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -554,13 +557,13 @@ void FLabel::drawMultiLine()
|
|||
|
||||
if ( hotkeypos != -1 )
|
||||
{
|
||||
align_offset = getAlignOffset (int(length - 1));
|
||||
align_offset = getAlignOffset(length - 1);
|
||||
printLine (label_text, length - 1, hotkeypos, align_offset);
|
||||
hotkey_printed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
align_offset = getAlignOffset (int(length));
|
||||
align_offset = getAlignOffset(length);
|
||||
printLine (label_text, length, -1, align_offset);
|
||||
}
|
||||
|
||||
|
@ -573,8 +576,9 @@ void FLabel::drawMultiLine()
|
|||
void FLabel::drawSingleLine()
|
||||
{
|
||||
wchar_t* label_text;
|
||||
int hotkeypos = -1, align_offset;
|
||||
uInt length = text.getLength();
|
||||
int hotkeypos = -1;
|
||||
std::size_t align_offset;
|
||||
std::size_t length = text.getLength();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -592,18 +596,19 @@ void FLabel::drawSingleLine()
|
|||
length--;
|
||||
|
||||
setPrintPos (1,1);
|
||||
align_offset = getAlignOffset (int(length));
|
||||
align_offset = getAlignOffset(length);
|
||||
printLine (label_text, length, hotkeypos, align_offset);
|
||||
delete[] label_text;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FLabel::printLine ( wchar_t line[]
|
||||
, uInt length
|
||||
, std::size_t length
|
||||
, int hotkeypos
|
||||
, int align_offset )
|
||||
, std::size_t align_offset )
|
||||
{
|
||||
int to_char;
|
||||
std::size_t to_char;
|
||||
std::size_t width = std::size_t(getWidth());
|
||||
bool isActive, isNoUnderline;
|
||||
isActive = ((flags & fc::active) != 0);
|
||||
isNoUnderline = ((flags & fc::no_underline) != 0);
|
||||
|
@ -611,15 +616,15 @@ void FLabel::printLine ( wchar_t line[]
|
|||
if ( align_offset > 0 )
|
||||
print (FString(align_offset, ' ')); // leading spaces
|
||||
|
||||
if ( length <= uInt(getWidth()) )
|
||||
to_char = int(length);
|
||||
if ( length <= width )
|
||||
to_char = length;
|
||||
else
|
||||
to_char = getWidth() - 2;
|
||||
to_char = width - 2;
|
||||
|
||||
if ( hasReverseMode() )
|
||||
setReverse(true);
|
||||
|
||||
for (int z = 0; z < to_char; z++)
|
||||
for (std::size_t z = 0; z < to_char; z++)
|
||||
{
|
||||
if ( ! std::iswprint(wint_t(line[z])) )
|
||||
{
|
||||
|
@ -630,7 +635,7 @@ void FLabel::printLine ( wchar_t line[]
|
|||
}
|
||||
}
|
||||
|
||||
if ( (z == hotkeypos) && isActive )
|
||||
if ( (int(z) == hotkeypos) && isActive )
|
||||
{
|
||||
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
|
||||
|
||||
|
@ -651,17 +656,17 @@ void FLabel::printLine ( wchar_t line[]
|
|||
print ( line[z] );
|
||||
}
|
||||
|
||||
if ( length > uInt(getWidth()) )
|
||||
if ( length > width )
|
||||
{
|
||||
// Print ellipsis
|
||||
setColor (ellipsis_color, getBackgroundColor());
|
||||
print ("..");
|
||||
setColor();
|
||||
}
|
||||
else if ( align_offset + to_char < getWidth() )
|
||||
else if ( align_offset + to_char < width )
|
||||
{
|
||||
// Print trailing spaces
|
||||
int len = getWidth() - align_offset - to_char;
|
||||
std::size_t len = width - align_offset - to_char;
|
||||
print (FString(len, ' '));
|
||||
}
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ void FLineEdit::setLabelOrientation(const label_o o)
|
|||
//----------------------------------------------------------------------
|
||||
void FLineEdit::hide()
|
||||
{
|
||||
int s, size;
|
||||
std::size_t s, size;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
@ -303,7 +303,7 @@ void FLineEdit::hide()
|
|||
s = hasShadow() ? 1 : 0;
|
||||
size = getWidth() + s;
|
||||
|
||||
if ( size < 0 )
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
try
|
||||
|
@ -319,7 +319,7 @@ void FLineEdit::hide()
|
|||
std::memset(blank, ' ', std::size_t(size));
|
||||
blank[size] = '\0';
|
||||
|
||||
for (int y = 0; y < getHeight() + s; y++)
|
||||
for (int y = 0; y < int(getHeight() + s); y++)
|
||||
{
|
||||
setPrintPos (1, 1 + y);
|
||||
print (blank);
|
||||
|
@ -434,10 +434,10 @@ void FLineEdit::onMouseDown (FMouseEvent* ev)
|
|||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
|
||||
if ( mouse_x >= 2 && mouse_x <= getWidth() && mouse_y == 1 )
|
||||
if ( mouse_x >= 2 && mouse_x <= int(getWidth()) && mouse_y == 1 )
|
||||
{
|
||||
int len = int(text.getLength());
|
||||
cursor_pos = text_offset + mouse_x - 2;
|
||||
cursor_pos = int(text_offset) + mouse_x - 2;
|
||||
|
||||
if ( cursor_pos >= len )
|
||||
cursor_pos = len;
|
||||
|
@ -470,9 +470,9 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
|
|||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
|
||||
if ( mouse_x >= 2 && mouse_x <= getWidth() && mouse_y == 1 )
|
||||
if ( mouse_x >= 2 && mouse_x <= int(getWidth()) && mouse_y == 1 )
|
||||
{
|
||||
cursor_pos = text_offset + mouse_x - 2;
|
||||
cursor_pos = int(text_offset) + mouse_x - 2;
|
||||
|
||||
if ( cursor_pos >= len )
|
||||
cursor_pos = len;
|
||||
|
@ -498,17 +498,17 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
|
|||
drag_scroll = FLineEdit::noScroll;
|
||||
}
|
||||
}
|
||||
else if ( mouse_x >= getWidth() )
|
||||
else if ( mouse_x >= int(getWidth()) )
|
||||
{
|
||||
// drag right
|
||||
if ( ! scroll_timer && text_offset <= len - getWidth() + 1 )
|
||||
if ( ! scroll_timer && int(text_offset) <= len - int(getWidth()) + 1 )
|
||||
{
|
||||
scroll_timer = true;
|
||||
addTimer(scroll_repeat);
|
||||
drag_scroll = FLineEdit::scrollRight;
|
||||
}
|
||||
|
||||
if ( text_offset == len - getWidth() + 2 )
|
||||
if ( int(text_offset) == len - int(getWidth()) + 2 )
|
||||
{
|
||||
delOwnTimer();
|
||||
drag_scroll = FLineEdit::noScroll;
|
||||
|
@ -549,13 +549,13 @@ void FLineEdit::onTimer (FTimerEvent*)
|
|||
break;
|
||||
|
||||
case FLineEdit::scrollRight:
|
||||
if ( text_offset == len - getWidth() + 2 )
|
||||
if ( int(text_offset) == len - int(getWidth()) + 2 )
|
||||
{
|
||||
drag_scroll = FLineEdit::noScroll;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( text_offset <= len - getWidth() + 1 )
|
||||
if ( int(text_offset) <= len - int(getWidth()) + 1 )
|
||||
text_offset++;
|
||||
|
||||
if ( cursor_pos < len )
|
||||
|
@ -642,7 +642,7 @@ void FLineEdit::onFocusOut (FFocusEvent*)
|
|||
//----------------------------------------------------------------------
|
||||
void FLineEdit::adjustLabel()
|
||||
{
|
||||
int label_length = int(label_text.getLength());
|
||||
std::size_t label_length = label_text.getLength();
|
||||
|
||||
if ( hasHotkey() )
|
||||
label_length--;
|
||||
|
@ -657,7 +657,7 @@ void FLineEdit::adjustLabel()
|
|||
break;
|
||||
|
||||
case label_left:
|
||||
label->setGeometry(getX() - label_length - 1, getY(), label_length, 1);
|
||||
label->setGeometry(getX() - int(label_length) - 1, getY(), label_length, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -757,7 +757,8 @@ void FLineEdit::drawInputField()
|
|||
if ( isActiveFocus && getMaxColor() < 16 )
|
||||
setBold();
|
||||
|
||||
show_text = text.mid(uInt(1 + text_offset), uInt(getWidth() - 2));
|
||||
show_text = text.mid( std::size_t(1 + text_offset)
|
||||
, std::size_t(getWidth() - 2) );
|
||||
|
||||
if ( isLinuxTerm() && hasUTF8() )
|
||||
{
|
||||
|
@ -773,7 +774,7 @@ void FLineEdit::drawInputField()
|
|||
|
||||
x = int(show_text.getLength());
|
||||
|
||||
while ( x < getWidth() - 1 )
|
||||
while ( x < int(getWidth()) - 1 )
|
||||
{
|
||||
print (' ');
|
||||
x++;
|
||||
|
@ -792,7 +793,7 @@ void FLineEdit::drawInputField()
|
|||
drawShadow ();
|
||||
|
||||
// set the cursor to the first pos.
|
||||
setCursorPos (2 + cursor_pos - text_offset, 1);
|
||||
setCursorPos (2 + cursor_pos - int(text_offset), 1);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -801,7 +802,7 @@ inline void FLineEdit::keyLeft()
|
|||
if ( cursor_pos > 0 )
|
||||
cursor_pos--;
|
||||
|
||||
if ( cursor_pos < text_offset )
|
||||
if ( cursor_pos < int(text_offset) )
|
||||
text_offset--;
|
||||
}
|
||||
|
||||
|
@ -813,8 +814,8 @@ inline void FLineEdit::keyRight()
|
|||
if ( cursor_pos < len )
|
||||
cursor_pos++;
|
||||
|
||||
if ( cursor_pos - text_offset >= getWidth() - 2
|
||||
&& text_offset <= len - getWidth() + 1 )
|
||||
if ( cursor_pos - int(text_offset) >= int(getWidth()) - 2
|
||||
&& int(text_offset) <= len - int(getWidth()) + 1 )
|
||||
text_offset++;
|
||||
}
|
||||
|
||||
|
@ -828,31 +829,32 @@ inline void FLineEdit::keyHome()
|
|||
//----------------------------------------------------------------------
|
||||
inline void FLineEdit::keyEnd()
|
||||
{
|
||||
int len = int(text.getLength());
|
||||
cursor_pos = len;
|
||||
std::size_t len = text.getLength();
|
||||
cursor_pos = int(len);
|
||||
|
||||
if ( cursor_pos >= getWidth() - 1 )
|
||||
if ( cursor_pos >= int(getWidth()) - 1 )
|
||||
text_offset = len - getWidth() + 2;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FLineEdit::keyDel()
|
||||
{
|
||||
int len = int(text.getLength());
|
||||
std::size_t len = text.getLength();
|
||||
|
||||
if ( len > 0 && cursor_pos < len )
|
||||
if ( len > 0 && std::size_t(cursor_pos) < len )
|
||||
{
|
||||
text.remove(cursor_pos, 1);
|
||||
text.remove(std::size_t(cursor_pos), 1);
|
||||
processChanged();
|
||||
}
|
||||
|
||||
if ( cursor_pos >= len )
|
||||
cursor_pos = len;
|
||||
if ( cursor_pos >= int(len) )
|
||||
cursor_pos = int(len);
|
||||
|
||||
if ( cursor_pos < 0 )
|
||||
cursor_pos = 0;
|
||||
|
||||
if ( text_offset > 0 && len - text_offset < getWidth() - 1 )
|
||||
if ( text_offset > 0
|
||||
&& len - std::size_t(text_offset) < std::size_t(getWidth()) - 1 )
|
||||
text_offset--;
|
||||
}
|
||||
|
||||
|
@ -861,7 +863,7 @@ inline void FLineEdit::keyBackspace()
|
|||
{
|
||||
if ( text.getLength() > 0 && cursor_pos > 0 )
|
||||
{
|
||||
text.remove(cursor_pos - 1, 1);
|
||||
text.remove(std::size_t(cursor_pos) - 1, 1);
|
||||
processChanged();
|
||||
cursor_pos--;
|
||||
|
||||
|
@ -892,9 +894,9 @@ inline bool FLineEdit::keyInput (int key)
|
|||
{
|
||||
if ( key >= 0x20 && key <= 0x10fff )
|
||||
{
|
||||
int len = int(text.getLength());
|
||||
std::size_t len = text.getLength();
|
||||
|
||||
if ( cursor_pos == len )
|
||||
if ( std::size_t(cursor_pos) == len )
|
||||
{
|
||||
text += wchar_t(key);
|
||||
processChanged();
|
||||
|
@ -902,9 +904,9 @@ inline bool FLineEdit::keyInput (int key)
|
|||
else if ( len > 0 )
|
||||
{
|
||||
if ( insert_mode )
|
||||
text.insert(wchar_t(key), uInt(cursor_pos));
|
||||
text.insert(wchar_t(key), std::size_t(cursor_pos));
|
||||
else
|
||||
text.overwrite(wchar_t(key), uInt(cursor_pos));
|
||||
text.overwrite(wchar_t(key), std::size_t(cursor_pos));
|
||||
|
||||
processChanged();
|
||||
}
|
||||
|
@ -915,7 +917,7 @@ inline bool FLineEdit::keyInput (int key)
|
|||
}
|
||||
cursor_pos++;
|
||||
|
||||
if ( cursor_pos >= getWidth() - 1 )
|
||||
if ( cursor_pos >= int(getWidth()) - 1 )
|
||||
text_offset++;
|
||||
|
||||
return true;
|
||||
|
|
316
src/flistbox.cpp
316
src/flistbox.cpp
|
@ -127,14 +127,14 @@ FListBox::~FListBox() // destructor
|
|||
|
||||
// public methods of FListBox
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::setCurrentItem (int index)
|
||||
void FListBox::setCurrentItem (std::size_t index)
|
||||
{
|
||||
int element_count;
|
||||
std::size_t element_count;
|
||||
|
||||
if ( index == current )
|
||||
return;
|
||||
|
||||
element_count = int(getCount());
|
||||
element_count = getCount();
|
||||
|
||||
if ( index > element_count )
|
||||
current = element_count;
|
||||
|
@ -155,12 +155,12 @@ void FListBox::setCurrentItem (int index)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::setCurrentItem (listBoxItems::iterator iter)
|
||||
{
|
||||
int index = int(std::distance(itemlist.begin(), iter) + 1);
|
||||
std::size_t index = std::size_t(std::distance(itemlist.begin(), iter)) + 1;
|
||||
setCurrentItem(index);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::showInsideBrackets ( int index
|
||||
void FListBox::showInsideBrackets ( std::size_t index
|
||||
, fc::brackets_type b )
|
||||
{
|
||||
listBoxItems::iterator iter = index2iterator(index - 1);
|
||||
|
@ -175,10 +175,10 @@ void FListBox::showInsideBrackets ( int index
|
|||
{
|
||||
max_line_width = len;
|
||||
|
||||
if ( len >= getWidth() - nf_offset - 3 )
|
||||
if ( len >= int(getWidth()) - nf_offset - 3 )
|
||||
{
|
||||
hbar->setMaximum (max_line_width - getWidth() + nf_offset + 4);
|
||||
hbar->setPageSize (max_line_width, getWidth() - nf_offset - 4);
|
||||
hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
|
||||
hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4);
|
||||
hbar->setValue (xoffset);
|
||||
|
||||
if ( ! hbar->isVisible() )
|
||||
|
@ -188,7 +188,7 @@ void FListBox::showInsideBrackets ( int index
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||
void FListBox::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
|
||||
{
|
||||
// Set the widget geometry
|
||||
|
||||
|
@ -196,13 +196,13 @@ void FListBox::setGeometry (int x, int y, int w, int h, bool adjust)
|
|||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
vbar->setGeometry (getWidth(), 2, 2, getHeight() - 2);
|
||||
hbar->setGeometry (1, getHeight(), getWidth() - 2 - nf_offset, 1);
|
||||
vbar->setGeometry (int(getWidth()), 2, 2, getHeight() - 2);
|
||||
hbar->setGeometry (1, int(getHeight()), getWidth() - 2 - std::size_t(nf_offset), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
vbar->setGeometry (getWidth(), 2, 1, getHeight() - 2);
|
||||
hbar->setGeometry (2, getHeight(), getWidth() - 2, 1);
|
||||
vbar->setGeometry (int(getWidth()), 2, 1, getHeight() - 2);
|
||||
hbar->setGeometry (2, int(getHeight()), getWidth() - 2, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ void FListBox::setText (const FString& txt)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::hide()
|
||||
{
|
||||
int n, size;
|
||||
std::size_t n, size;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
@ -262,12 +262,12 @@ void FListBox::hide()
|
|||
n = isNewFont() ? 1 : 0;
|
||||
size = getWidth() + n;
|
||||
|
||||
if ( size < 0 )
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
blank = new char[std::size_t(size) + 1];
|
||||
blank = new char[size + 1];
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -275,10 +275,10 @@ void FListBox::hide()
|
|||
return;
|
||||
}
|
||||
|
||||
std::memset (blank, ' ', std::size_t(size));
|
||||
std::memset (blank, ' ', size);
|
||||
blank[size] = '\0';
|
||||
|
||||
for (int y = 0; y < getHeight(); y++)
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (1, 1 + y);
|
||||
print (blank);
|
||||
|
@ -322,15 +322,15 @@ void FListBox::insert ( long item
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::remove (int item)
|
||||
void FListBox::remove (std::size_t item)
|
||||
{
|
||||
int element_count;
|
||||
std::size_t element_count;
|
||||
|
||||
if ( int(getCount()) < item )
|
||||
if ( item > getCount() )
|
||||
return;
|
||||
|
||||
itemlist.erase (itemlist.begin() + item - 1);
|
||||
element_count = int(getCount());
|
||||
itemlist.erase (itemlist.begin() + int(item) - 1);
|
||||
element_count = getCount();
|
||||
max_line_width = 0;
|
||||
|
||||
listBoxItems::iterator iter = itemlist.begin();
|
||||
|
@ -345,14 +345,14 @@ void FListBox::remove (int item)
|
|||
++iter;
|
||||
}
|
||||
|
||||
hbar->setMaximum (max_line_width - getWidth() + nf_offset + 4);
|
||||
hbar->setPageSize (max_line_width, getWidth() - nf_offset - 4);
|
||||
hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
|
||||
hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4);
|
||||
|
||||
if ( hbar->isVisible() && max_line_width < getWidth() - nf_offset - 3 )
|
||||
if ( hbar->isVisible() && max_line_width < int(getWidth()) - nf_offset - 3 )
|
||||
hbar->hide();
|
||||
|
||||
vbar->setMaximum (element_count - getHeight() + 2);
|
||||
vbar->setPageSize (element_count, getHeight() - 2);
|
||||
vbar->setMaximum (int(element_count - getHeight()) + 2);
|
||||
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
|
||||
|
||||
if ( vbar->isVisible() && element_count < getHeight() - 1 )
|
||||
vbar->hide();
|
||||
|
@ -363,8 +363,8 @@ void FListBox::remove (int item)
|
|||
if ( current > element_count )
|
||||
current = element_count;
|
||||
|
||||
if ( yoffset > element_count - getHeight() + 2 )
|
||||
yoffset = element_count - getHeight() + 2;
|
||||
if ( yoffset > int(element_count - getHeight()) + 2 )
|
||||
yoffset = int(element_count - getHeight()) + 2;
|
||||
|
||||
if ( yoffset < 0 )
|
||||
yoffset = 0;
|
||||
|
@ -373,7 +373,7 @@ void FListBox::remove (int item)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::clear()
|
||||
{
|
||||
int size;
|
||||
std::size_t size;
|
||||
char* blank;
|
||||
|
||||
itemlist.clear();
|
||||
|
@ -397,12 +397,12 @@ void FListBox::clear()
|
|||
setColor (wc.list_fg, wc.list_bg);
|
||||
size = getWidth() - 2;
|
||||
|
||||
if ( size < 0 )
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
blank = new char[std::size_t(size) + 1];
|
||||
blank = new char[size + 1];
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -410,10 +410,10 @@ void FListBox::clear()
|
|||
return;
|
||||
}
|
||||
|
||||
std::memset (blank, ' ', std::size_t(size));
|
||||
std::memset (blank, ' ', size);
|
||||
blank[size] = '\0';
|
||||
|
||||
for (int y = 0; y < getHeight() - 2; y++)
|
||||
for (int y = 0; y < int(getHeight()) - 2; y++)
|
||||
{
|
||||
setPrintPos (2, 2 + y);
|
||||
print (blank);
|
||||
|
@ -425,8 +425,8 @@ void FListBox::clear()
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::onKeyPress (FKeyEvent* ev)
|
||||
{
|
||||
int current_before = current
|
||||
, xoffset_before = xoffset
|
||||
std::size_t current_before = current;
|
||||
int xoffset_before = xoffset
|
||||
, yoffset_before = yoffset
|
||||
, key = ev->key();
|
||||
|
||||
|
@ -543,11 +543,11 @@ void FListBox::onMouseDown (FMouseEvent* ev)
|
|||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
|
||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
||||
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||
{
|
||||
int element_count = int(getCount());
|
||||
current = yoffset + mouse_y - 1;
|
||||
std::size_t element_count = getCount();
|
||||
current = std::size_t(yoffset + mouse_y - 1);
|
||||
|
||||
if ( current > element_count )
|
||||
current = element_count;
|
||||
|
@ -581,8 +581,8 @@ void FListBox::onMouseUp (FMouseEvent* ev)
|
|||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
|
||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
||||
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||
{
|
||||
processChanged();
|
||||
|
||||
|
@ -602,16 +602,16 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
|||
if ( ev->getButton() == fc::RightButton && ! isMultiSelection() )
|
||||
return;
|
||||
|
||||
int current_before = current;
|
||||
std::size_t current_before = current;
|
||||
int yoffset_before = yoffset;
|
||||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
|
||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
||||
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||
{
|
||||
int element_count = int(getCount());
|
||||
current = yoffset + mouse_y - 1;
|
||||
std::size_t element_count = getCount();
|
||||
current = std::size_t(yoffset + mouse_y - 1);
|
||||
|
||||
if ( current > element_count )
|
||||
current = element_count;
|
||||
|
@ -640,7 +640,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
|||
// Auto-scrolling when dragging mouse outside the widget
|
||||
if ( mouse_y < 2 )
|
||||
dragUp (ev->getButton());
|
||||
else if ( mouse_y >= getHeight() )
|
||||
else if ( mouse_y >= int(getHeight()) )
|
||||
dragDown (ev->getButton());
|
||||
else
|
||||
stopDragScroll();
|
||||
|
@ -657,8 +657,8 @@ void FListBox::onMouseDoubleClick (FMouseEvent* ev)
|
|||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
|
||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
||||
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||
{
|
||||
if ( yoffset + mouse_y - 1 > int(getCount()) )
|
||||
return;
|
||||
|
@ -670,7 +670,7 @@ void FListBox::onMouseDoubleClick (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::onTimer (FTimerEvent*)
|
||||
{
|
||||
int current_before = current;
|
||||
std::size_t current_before = current;
|
||||
int yoffset_before = yoffset;
|
||||
|
||||
switch ( int(drag_scroll) )
|
||||
|
@ -719,8 +719,8 @@ void FListBox::onTimer (FTimerEvent*)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::onWheel (FWheelEvent* ev)
|
||||
{
|
||||
std::size_t current_before = current;
|
||||
int wheel
|
||||
, current_before = current
|
||||
, yoffset_before = yoffset
|
||||
, pagesize = 4;
|
||||
|
||||
|
@ -791,45 +791,42 @@ void FListBox::onFocusOut (FFocusEvent*)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::adjustYOffset()
|
||||
{
|
||||
int element_count = int(getCount());
|
||||
std::size_t element_count = getCount();
|
||||
|
||||
if ( getClientHeight() < 0 )
|
||||
if ( element_count == 0 || getClientHeight() == 0 )
|
||||
return;
|
||||
|
||||
if ( element_count == 0 || getClientHeight() <= 0 )
|
||||
return;
|
||||
|
||||
if ( yoffset > element_count - getClientHeight() )
|
||||
yoffset = element_count - getClientHeight();
|
||||
if ( yoffset > int(element_count - getClientHeight()) )
|
||||
yoffset = int(element_count - getClientHeight());
|
||||
|
||||
if ( yoffset < 0 )
|
||||
yoffset = 0;
|
||||
|
||||
if ( current < yoffset )
|
||||
current = yoffset;
|
||||
if ( current < std::size_t(yoffset) )
|
||||
current = std::size_t(yoffset);
|
||||
|
||||
if ( yoffset < current - getClientHeight() )
|
||||
yoffset = current - getClientHeight();
|
||||
if ( yoffset < int(current - getClientHeight()) )
|
||||
yoffset = int(current - getClientHeight());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::adjustSize()
|
||||
{
|
||||
int element_count;
|
||||
std::size_t element_count;
|
||||
FWidget::adjustSize();
|
||||
adjustYOffset();
|
||||
|
||||
element_count = int(getCount());
|
||||
vbar->setMaximum (element_count - getClientHeight());
|
||||
vbar->setPageSize (element_count, getClientHeight());
|
||||
vbar->setX (getWidth());
|
||||
element_count = getCount();
|
||||
vbar->setMaximum (int(element_count - getClientHeight()));
|
||||
vbar->setPageSize (int(element_count), int(getClientHeight()));
|
||||
vbar->setX (int(getWidth()));
|
||||
vbar->setHeight (getClientHeight(), false);
|
||||
vbar->resize();
|
||||
|
||||
hbar->setMaximum (max_line_width - getClientWidth() + 2);
|
||||
hbar->setPageSize (max_line_width, getClientWidth() - 2);
|
||||
hbar->setY (getHeight());
|
||||
hbar->setWidth (getClientWidth() + nf_offset, false);
|
||||
hbar->setMaximum (max_line_width - int(getClientWidth()) + 2);
|
||||
hbar->setPageSize (max_line_width, int(getClientWidth()) - 2);
|
||||
hbar->setY (int(getHeight()));
|
||||
hbar->setWidth (getClientWidth() + std::size_t(nf_offset), false);
|
||||
hbar->resize();
|
||||
|
||||
if ( element_count <= getClientHeight() )
|
||||
|
@ -837,7 +834,7 @@ void FListBox::adjustSize()
|
|||
else
|
||||
vbar->setVisible();
|
||||
|
||||
if ( max_line_width < getClientWidth() - 1 )
|
||||
if ( max_line_width < int(getClientWidth()) - 1 )
|
||||
hbar->hide();
|
||||
else
|
||||
hbar->setVisible();
|
||||
|
@ -910,7 +907,7 @@ void FListBox::draw()
|
|||
setReverse(true);
|
||||
|
||||
if ( isNewFont() )
|
||||
drawBorder (1, 1, getWidth() - 1, getHeight());
|
||||
drawBorder (1, 1, int(getWidth()) - 1, int(getHeight()));
|
||||
else
|
||||
drawBorder();
|
||||
|
||||
|
@ -918,9 +915,9 @@ void FListBox::draw()
|
|||
{
|
||||
setColor();
|
||||
|
||||
for (int y = 2; y < getHeight(); y++)
|
||||
for (int y = 2; y < int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (getWidth(), y);
|
||||
setPrintPos (int(getWidth()), y);
|
||||
print (' '); // clear right side of the scrollbar
|
||||
}
|
||||
}
|
||||
|
@ -955,14 +952,11 @@ void FListBox::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::drawLabel()
|
||||
{
|
||||
FString txt;
|
||||
uInt length;
|
||||
|
||||
if ( text.isNull() || text.isEmpty() )
|
||||
return;
|
||||
|
||||
txt = " " + text + " ";
|
||||
length = txt.getLength();
|
||||
FString txt = " " + text + " ";
|
||||
std::size_t length = txt.getLength();
|
||||
setPrintPos (2, 1);
|
||||
|
||||
if ( isEnabled() )
|
||||
|
@ -984,7 +978,7 @@ void FListBox::drawLabel()
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::drawList()
|
||||
{
|
||||
uInt start, num;
|
||||
std::size_t start, num;
|
||||
listBoxItems::iterator iter;
|
||||
|
||||
if ( itemlist.empty() || getHeight() <= 2 || getWidth() <= 4 )
|
||||
|
@ -998,18 +992,18 @@ void FListBox::drawList()
|
|||
|
||||
if ( last_yoffset >= 0
|
||||
&& last_yoffset == yoffset
|
||||
&& last_current != current )
|
||||
&& last_current != int(current) )
|
||||
{
|
||||
// speed up: redraw only the changed rows
|
||||
uInt last_pos = uInt(current - yoffset) - 1;
|
||||
uInt current_pos = uInt(last_current - yoffset) - 1;
|
||||
std::size_t last_pos = current - std::size_t(yoffset) - 1;
|
||||
std::size_t current_pos = std::size_t(last_current - yoffset) - 1;
|
||||
start = std::min(last_pos, current_pos);
|
||||
num = std::max(last_pos, current_pos) + 1;
|
||||
}
|
||||
|
||||
iter = index2iterator(int(start) + yoffset);
|
||||
iter = index2iterator(start + std::size_t(yoffset));
|
||||
|
||||
for (uInt y = start; y < num && iter != itemlist.end() ; y++)
|
||||
for (std::size_t y = start; y < num && iter != itemlist.end() ; y++)
|
||||
{
|
||||
bool serach_mark = false;
|
||||
bool lineHasBrackets = hasBrackets(iter);
|
||||
|
@ -1036,7 +1030,7 @@ void FListBox::drawList()
|
|||
|
||||
unsetAttributes();
|
||||
last_yoffset = yoffset;
|
||||
last_current = current;
|
||||
last_current = int(current);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1044,13 +1038,13 @@ inline void FListBox::drawListLine ( int y
|
|||
, listBoxItems::iterator iter
|
||||
, bool serach_mark )
|
||||
{
|
||||
uInt i, len;
|
||||
uInt inc_len = inc_search.getLength();
|
||||
bool isCurrentLine = bool(y + yoffset + 1 == current);
|
||||
std::size_t i, len;
|
||||
std::size_t inc_len = inc_search.getLength();
|
||||
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||
bool isFocus = ((flags & fc::focus) != 0);
|
||||
FString element;
|
||||
element = getString(iter).mid ( uInt(1 + xoffset)
|
||||
, uInt(getWidth() - nf_offset - 4) );
|
||||
, uInt(getWidth() - std::size_t(nf_offset) - 4) );
|
||||
const wchar_t* const& element_str = element.wc_str();
|
||||
len = element.getLength();
|
||||
|
||||
|
@ -1078,7 +1072,7 @@ inline void FListBox::drawListLine ( int y
|
|||
i++;
|
||||
}
|
||||
|
||||
for (; i < uInt(getWidth() - nf_offset - 3); i++)
|
||||
for (; i < getWidth() - std::size_t(nf_offset) - 3; i++)
|
||||
print (' ');
|
||||
}
|
||||
|
||||
|
@ -1139,13 +1133,13 @@ inline void FListBox::drawListBracketsLine ( int y
|
|||
, listBoxItems::iterator iter
|
||||
, bool serach_mark )
|
||||
{
|
||||
int full_length;
|
||||
FString element;
|
||||
uInt len
|
||||
std::size_t len
|
||||
, full_length
|
||||
, inc_len = inc_search.getLength()
|
||||
, i = 0
|
||||
, b = 0;
|
||||
bool isCurrentLine = bool(y + yoffset + 1 == current);
|
||||
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||
bool isFocus = ((flags & fc::focus) != 0);
|
||||
|
||||
if ( isMonochron() && isCurrentLine && isFocus )
|
||||
|
@ -1158,12 +1152,12 @@ inline void FListBox::drawListBracketsLine ( int y
|
|||
b = 1;
|
||||
printLeftBracket (iter->brackets);
|
||||
|
||||
element = getString(iter).mid ( uInt(1 + xoffset)
|
||||
, uInt(getWidth() - nf_offset - 5) );
|
||||
element = getString(iter).mid ( std::size_t(xoffset) + 1
|
||||
, getWidth() - std::size_t(nf_offset) - 5 );
|
||||
}
|
||||
else
|
||||
element = getString(iter).mid ( uInt(xoffset)
|
||||
, uInt(getWidth() - nf_offset - 4) );
|
||||
element = getString(iter).mid ( std::size_t(xoffset)
|
||||
, getWidth() - std::size_t(nf_offset) - 4 );
|
||||
|
||||
const wchar_t* const& element_str = element.wc_str();
|
||||
len = element.getLength();
|
||||
|
@ -1181,10 +1175,10 @@ inline void FListBox::drawListBracketsLine ( int y
|
|||
print (element_str[i]);
|
||||
}
|
||||
|
||||
full_length = int(getString(iter).getLength());
|
||||
full_length = getString(iter).getLength();
|
||||
|
||||
if ( b + i < uInt(getWidth() - nf_offset - 4 )
|
||||
&& xoffset <= full_length + 1 )
|
||||
if ( b + i < getWidth() - std::size_t(nf_offset) - 4
|
||||
&& std::size_t(xoffset) <= full_length + 1 )
|
||||
{
|
||||
if ( serach_mark && i == inc_len )
|
||||
setColor ( wc.current_element_focus_fg
|
||||
|
@ -1200,7 +1194,7 @@ inline void FListBox::drawListBracketsLine ( int y
|
|||
i++;
|
||||
}
|
||||
|
||||
for (; b + i < uInt(getWidth() - nf_offset - 3); i++)
|
||||
for (; b + i < getWidth() - std::size_t(nf_offset) - 3; i++)
|
||||
print (' ');
|
||||
}
|
||||
|
||||
|
@ -1211,8 +1205,8 @@ inline void FListBox::setLineAttributes ( int y
|
|||
, bool& serach_mark )
|
||||
{
|
||||
bool isFocus = ((flags & fc::focus) != 0)
|
||||
, isCurrentLine = bool(y + yoffset + 1 == current);
|
||||
uInt inc_len = inc_search.getLength();
|
||||
, isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||
std::size_t inc_len = inc_search.getLength();
|
||||
|
||||
setPrintPos (2, 2 + int(y));
|
||||
|
||||
|
@ -1326,10 +1320,10 @@ void FListBox::recalculateHorizontalBar (int len, bool has_brackets)
|
|||
|
||||
max_line_width = len;
|
||||
|
||||
if ( len >= getWidth() - nf_offset - 3 )
|
||||
if ( len >= int(getWidth()) - nf_offset - 3 )
|
||||
{
|
||||
hbar->setMaximum (max_line_width - getWidth() + nf_offset + 4);
|
||||
hbar->setPageSize (max_line_width, getWidth() - nf_offset - 4);
|
||||
hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
|
||||
hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4);
|
||||
hbar->calculateSliderValues();
|
||||
|
||||
if ( ! hbar->isVisible() )
|
||||
|
@ -1340,11 +1334,11 @@ void FListBox::recalculateHorizontalBar (int len, bool has_brackets)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::recalculateVerticalBar (int element_count)
|
||||
{
|
||||
vbar->setMaximum (element_count - getHeight() + 2);
|
||||
vbar->setPageSize (element_count, getHeight() - 2);
|
||||
vbar->setMaximum (element_count - int(getHeight()) + 2);
|
||||
vbar->setPageSize (element_count, int(getHeight()) - 2);
|
||||
vbar->calculateSliderValues();
|
||||
|
||||
if ( ! vbar->isVisible() && element_count >= getHeight() - 1 )
|
||||
if ( ! vbar->isVisible() && element_count >= int(getHeight()) - 1 )
|
||||
vbar->setVisible();
|
||||
}
|
||||
|
||||
|
@ -1367,7 +1361,7 @@ inline void FListBox::getWidgetFocus()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::multiSelection (int pos)
|
||||
void FListBox::multiSelection (std::size_t pos)
|
||||
{
|
||||
if ( ! isMultiSelection() )
|
||||
return;
|
||||
|
@ -1384,29 +1378,29 @@ void FListBox::multiSelection (int pos)
|
|||
}
|
||||
|
||||
processSelect();
|
||||
secect_from_item = pos;
|
||||
secect_from_item = int(pos);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::multiSelectionUpTo (int pos)
|
||||
void FListBox::multiSelectionUpTo (std::size_t pos)
|
||||
{
|
||||
int from, to;
|
||||
std::size_t from, to;
|
||||
|
||||
if ( ! isMultiSelection() )
|
||||
return;
|
||||
|
||||
if ( secect_from_item > pos )
|
||||
if ( std::size_t(secect_from_item) > pos )
|
||||
{
|
||||
from = pos;
|
||||
to = secect_from_item - 1;
|
||||
to = std::size_t(secect_from_item) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
from = secect_from_item + 1;
|
||||
from = std::size_t(secect_from_item) + 1;
|
||||
to = pos;
|
||||
}
|
||||
|
||||
for (int i = from; i <= to; i++)
|
||||
for (std::size_t i = from; i <= to; i++)
|
||||
{
|
||||
if ( mouse_select )
|
||||
{
|
||||
|
@ -1420,7 +1414,7 @@ void FListBox::multiSelectionUpTo (int pos)
|
|||
}
|
||||
}
|
||||
|
||||
secect_from_item = pos;
|
||||
secect_from_item = int(pos);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1433,11 +1427,11 @@ void FListBox::wheelUp (int pagesize)
|
|||
|
||||
if ( yoffset < 0 )
|
||||
{
|
||||
current -= pagesize + yoffset;
|
||||
current -= std::size_t(pagesize + yoffset);
|
||||
yoffset = 0;
|
||||
}
|
||||
else
|
||||
current -= pagesize;
|
||||
current -= std::size_t(pagesize);
|
||||
|
||||
if ( current < 1 )
|
||||
current = 1;
|
||||
|
@ -1446,8 +1440,8 @@ void FListBox::wheelUp (int pagesize)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::wheelDown (int pagesize)
|
||||
{
|
||||
int element_count = int(getCount());
|
||||
int yoffset_end = element_count - getClientHeight();
|
||||
std::size_t element_count = getCount();
|
||||
int yoffset_end = int(element_count - getClientHeight());
|
||||
|
||||
if ( yoffset_end < 0 )
|
||||
yoffset_end = 0;
|
||||
|
@ -1459,11 +1453,11 @@ void FListBox::wheelDown (int pagesize)
|
|||
|
||||
if ( yoffset > yoffset_end )
|
||||
{
|
||||
current += pagesize - (yoffset - yoffset_end);
|
||||
current += std::size_t(pagesize - (yoffset - yoffset_end));
|
||||
yoffset = yoffset_end;
|
||||
}
|
||||
else
|
||||
current += pagesize;
|
||||
current += std::size_t(pagesize);
|
||||
|
||||
if ( current > element_count )
|
||||
current = element_count;
|
||||
|
@ -1485,7 +1479,7 @@ bool FListBox::dragScrollUp()
|
|||
//----------------------------------------------------------------------
|
||||
bool FListBox::dragScrollDown()
|
||||
{
|
||||
int element_count = int(getCount());
|
||||
std::size_t element_count = getCount();
|
||||
|
||||
if ( current == element_count )
|
||||
{
|
||||
|
@ -1501,7 +1495,7 @@ bool FListBox::dragScrollDown()
|
|||
void FListBox::dragUp (int mouse_button)
|
||||
{
|
||||
if ( drag_scroll != fc::noScroll
|
||||
&& scroll_distance < getClientHeight() )
|
||||
&& scroll_distance < int(getClientHeight()) )
|
||||
scroll_distance++;
|
||||
|
||||
if ( ! scroll_timer && current > 1 )
|
||||
|
@ -1526,10 +1520,10 @@ void FListBox::dragUp (int mouse_button)
|
|||
void FListBox::dragDown (int mouse_button)
|
||||
{
|
||||
if ( drag_scroll != fc::noScroll
|
||||
&& scroll_distance < getClientHeight() )
|
||||
&& scroll_distance < int(getClientHeight()) )
|
||||
scroll_distance++;
|
||||
|
||||
if ( ! scroll_timer && current < int(getCount()) )
|
||||
if ( ! scroll_timer && current < getCount() )
|
||||
{
|
||||
scroll_timer = true;
|
||||
addTimer(scroll_repeat);
|
||||
|
@ -1540,7 +1534,7 @@ void FListBox::dragDown (int mouse_button)
|
|||
drag_scroll = fc::scrollDown;
|
||||
}
|
||||
|
||||
if ( current == int(getCount()) )
|
||||
if ( current == getCount() )
|
||||
{
|
||||
delOwnTimer();
|
||||
drag_scroll = fc::noScroll;
|
||||
|
@ -1562,12 +1556,12 @@ void FListBox::prevListItem (int distance)
|
|||
if ( current == 1 )
|
||||
return;
|
||||
|
||||
current -= distance;
|
||||
current -= std::size_t(distance);
|
||||
|
||||
if ( current < 1 )
|
||||
current = 1;
|
||||
|
||||
if ( current <= yoffset )
|
||||
if ( current <= std::size_t(yoffset) )
|
||||
{
|
||||
yoffset -= distance;
|
||||
|
||||
|
@ -1579,18 +1573,18 @@ void FListBox::prevListItem (int distance)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::nextListItem (int distance)
|
||||
{
|
||||
int element_count = int(getCount());
|
||||
int yoffset_end = element_count - getClientHeight();
|
||||
std::size_t element_count = getCount();
|
||||
int yoffset_end = int(element_count - getClientHeight());
|
||||
|
||||
if ( current == element_count )
|
||||
return;
|
||||
|
||||
current += distance;
|
||||
current += std::size_t(distance);
|
||||
|
||||
if ( current > element_count )
|
||||
current = element_count;
|
||||
|
||||
if ( current - yoffset > getClientHeight() )
|
||||
if ( current - std::size_t(yoffset) > getClientHeight() )
|
||||
{
|
||||
yoffset += distance;
|
||||
|
||||
|
@ -1602,7 +1596,7 @@ void FListBox::nextListItem (int distance)
|
|||
void FListBox::scrollToX (int val)
|
||||
{
|
||||
static const int padding_space = 2; // 1 leading space + 1 trailing space
|
||||
int xoffset_end = max_line_width - getClientWidth() + padding_space;
|
||||
int xoffset_end = max_line_width - int(getClientWidth()) + padding_space;
|
||||
|
||||
if ( xoffset == val )
|
||||
return;
|
||||
|
@ -1619,13 +1613,13 @@ void FListBox::scrollToX (int val)
|
|||
//----------------------------------------------------------------------
|
||||
void FListBox::scrollToY (int val)
|
||||
{
|
||||
int element_count = int(getCount());
|
||||
int yoffset_end = element_count - getClientHeight();
|
||||
std::size_t element_count = getCount();
|
||||
int yoffset_end = int(element_count - getClientHeight());
|
||||
|
||||
if ( yoffset == val )
|
||||
return;
|
||||
|
||||
int c = current - yoffset;
|
||||
int c = int(current) - yoffset;
|
||||
yoffset = val;
|
||||
|
||||
if ( yoffset > yoffset_end )
|
||||
|
@ -1634,10 +1628,10 @@ void FListBox::scrollToY (int val)
|
|||
if ( yoffset < 0 )
|
||||
yoffset = 0;
|
||||
|
||||
current = yoffset + c;
|
||||
current = std::size_t(yoffset + c);
|
||||
|
||||
if ( current < yoffset )
|
||||
current = yoffset;
|
||||
if ( current < std::size_t(yoffset) )
|
||||
current = std::size_t(yoffset);
|
||||
|
||||
if ( current > element_count )
|
||||
current = element_count;
|
||||
|
@ -1659,7 +1653,7 @@ void FListBox::scrollLeft (int distance)
|
|||
void FListBox::scrollRight (int distance)
|
||||
{
|
||||
static const int padding_space = 2; // 1 leading space + 1 trailing space
|
||||
int xoffset_end = max_line_width - getClientWidth() + padding_space;
|
||||
int xoffset_end = max_line_width - int(getClientWidth()) + padding_space;
|
||||
xoffset += distance;
|
||||
|
||||
if ( xoffset == xoffset_end )
|
||||
|
@ -1703,7 +1697,7 @@ inline void FListBox::keyRight()
|
|||
//----------------------------------------------------------------------
|
||||
inline void FListBox::keyPgUp()
|
||||
{
|
||||
int pagesize = getClientHeight() - 1;
|
||||
int pagesize = int(getClientHeight()) - 1;
|
||||
prevListItem (pagesize);
|
||||
inc_search.clear();
|
||||
}
|
||||
|
@ -1711,7 +1705,7 @@ inline void FListBox::keyPgUp()
|
|||
//----------------------------------------------------------------------
|
||||
inline void FListBox::keyPgDn()
|
||||
{
|
||||
int pagesize = getClientHeight() - 1;
|
||||
int pagesize = int(getClientHeight()) - 1;
|
||||
nextListItem (pagesize);
|
||||
inc_search.clear();
|
||||
}
|
||||
|
@ -1727,8 +1721,8 @@ inline void FListBox::keyHome()
|
|||
//----------------------------------------------------------------------
|
||||
inline void FListBox::keyEnd()
|
||||
{
|
||||
int element_count = int(getCount());
|
||||
int yoffset_end = element_count - getClientHeight();
|
||||
std::size_t element_count = getCount();
|
||||
int yoffset_end = int(element_count - getClientHeight());
|
||||
current = element_count;
|
||||
|
||||
if ( current > getClientHeight() )
|
||||
|
@ -1759,7 +1753,7 @@ inline void FListBox::keyEnter()
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FListBox::keySpace()
|
||||
{
|
||||
uInt inc_len = inc_search.getLength();
|
||||
std::size_t inc_len = inc_search.getLength();
|
||||
|
||||
if ( inc_len > 0 )
|
||||
{
|
||||
|
@ -1806,7 +1800,7 @@ inline bool FListBox::keyInsert()
|
|||
{
|
||||
if ( isMultiSelection() )
|
||||
{
|
||||
int element_count = int(getCount());
|
||||
std::size_t element_count = getCount();
|
||||
|
||||
if ( isSelected(current) )
|
||||
unselectItem(current);
|
||||
|
@ -1819,7 +1813,7 @@ inline bool FListBox::keyInsert()
|
|||
if ( current > element_count )
|
||||
current = element_count;
|
||||
|
||||
if ( current - yoffset >= getHeight() - 1 )
|
||||
if ( current - std::size_t(yoffset) >= getHeight() - 1 )
|
||||
yoffset++;
|
||||
|
||||
return true;
|
||||
|
@ -1832,7 +1826,7 @@ inline bool FListBox::keyInsert()
|
|||
//----------------------------------------------------------------------
|
||||
inline bool FListBox::keyBackspace()
|
||||
{
|
||||
uInt inc_len = inc_search.getLength();
|
||||
std::size_t inc_len = inc_search.getLength();
|
||||
|
||||
if ( inc_len > 0 )
|
||||
{
|
||||
|
@ -1873,7 +1867,7 @@ inline bool FListBox::keyIncSearchInput (int key)
|
|||
else
|
||||
inc_search += wchar_t(key);
|
||||
|
||||
uInt inc_len = inc_search.getLength();
|
||||
std::size_t inc_len = inc_search.getLength();
|
||||
bool inc_found = false;
|
||||
listBoxItems::iterator iter = itemlist.begin();
|
||||
|
||||
|
@ -1940,9 +1934,9 @@ void FListBox::lazyConvert(listBoxItems::iterator iter, int y)
|
|||
void FListBox::cb_VBarChange (FWidget*, data_ptr)
|
||||
{
|
||||
FScrollbar::sType scrollType;
|
||||
std::size_t current_before = current;
|
||||
int distance = 1
|
||||
, pagesize = 4
|
||||
, current_before = current
|
||||
, yoffset_before = yoffset;
|
||||
scrollType = vbar->getScrollType();
|
||||
|
||||
|
@ -1952,14 +1946,14 @@ void FListBox::cb_VBarChange (FWidget*, data_ptr)
|
|||
break;
|
||||
|
||||
case FScrollbar::scrollPageBackward:
|
||||
distance = getClientHeight();
|
||||
distance = int(getClientHeight());
|
||||
// fall through
|
||||
case FScrollbar::scrollStepBackward:
|
||||
prevListItem (distance);
|
||||
break;
|
||||
|
||||
case FScrollbar::scrollPageForward:
|
||||
distance = getClientHeight();
|
||||
distance = int(getClientHeight());
|
||||
// fall through
|
||||
case FScrollbar::scrollStepForward:
|
||||
nextListItem (distance);
|
||||
|
@ -2019,14 +2013,14 @@ void FListBox::cb_HBarChange (FWidget*, data_ptr)
|
|||
break;
|
||||
|
||||
case FScrollbar::scrollPageBackward:
|
||||
distance = getClientWidth() - padding_space;
|
||||
distance = int(getClientWidth()) - padding_space;
|
||||
// fall through
|
||||
case FScrollbar::scrollStepBackward:
|
||||
scrollLeft (distance);
|
||||
break;
|
||||
|
||||
case FScrollbar::scrollPageForward:
|
||||
distance = getClientWidth() - padding_space;
|
||||
distance = int(getClientWidth()) - padding_space;
|
||||
// fall through
|
||||
case FScrollbar::scrollStepForward:
|
||||
scrollRight (distance);
|
||||
|
|
|
@ -49,6 +49,8 @@ long firstNumberFromString (const FString& str)
|
|||
FString::iterator iter = str.begin();
|
||||
FString::iterator first_pos;
|
||||
FString::iterator last_pos;
|
||||
std::size_t pos;
|
||||
std::size_t length;
|
||||
long number;
|
||||
|
||||
while ( iter != last )
|
||||
|
@ -82,8 +84,8 @@ long firstNumberFromString (const FString& str)
|
|||
if ( last_pos == last )
|
||||
return 0;
|
||||
|
||||
uInt pos = uInt(std::distance(str.begin(), first_pos)) + 1;
|
||||
uInt length = uInt(std::distance(first_pos, last_pos));
|
||||
pos = std::size_t(std::distance(str.begin(), first_pos)) + 1;
|
||||
length = std::size_t(std::distance(first_pos, last_pos));
|
||||
const FString num_str = str.mid(pos, length);
|
||||
|
||||
try
|
||||
|
@ -631,7 +633,7 @@ FListView::~FListView() // destructor
|
|||
|
||||
// public methods of FListView
|
||||
//----------------------------------------------------------------------
|
||||
uInt FListView::getCount()
|
||||
std::size_t FListView::getCount()
|
||||
{
|
||||
int n = 0;
|
||||
FObjectIterator iter = itemlist.begin();
|
||||
|
@ -643,7 +645,7 @@ uInt FListView::getCount()
|
|||
++iter;
|
||||
}
|
||||
|
||||
return uInt(n);
|
||||
return std::size_t(n);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -691,7 +693,7 @@ fc::sorting_type FListView::getColumnSortType (int column) const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FListView::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||
void FListView::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
|
||||
{
|
||||
// Set the widget geometry
|
||||
|
||||
|
@ -699,13 +701,13 @@ void FListView::setGeometry (int x, int y, int w, int h, bool adjust)
|
|||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
vbar->setGeometry (getWidth(), 2, 2, getHeight() - 2);
|
||||
hbar->setGeometry (1, getHeight(), getWidth() - 2, 1);
|
||||
vbar->setGeometry (int(getWidth()), 2, 2, getHeight() - 2);
|
||||
hbar->setGeometry (1, int(getHeight()), getWidth() - 2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
vbar->setGeometry (getWidth(), 2, 1, getHeight() - 2);
|
||||
hbar->setGeometry (2, getHeight(), getWidth() - 2, 1);
|
||||
vbar->setGeometry (int(getWidth()), 2, 1, getHeight() - 2);
|
||||
hbar->setGeometry (2, int(getHeight()), getWidth() - 2, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -946,7 +948,7 @@ void FListView::onKeyPress (FKeyEvent* ev)
|
|||
int position_before = current_iter.getPosition()
|
||||
, xoffset_before = xoffset
|
||||
, first_line_position_before = first_visible_line.getPosition()
|
||||
, pagesize = getClientHeight() - 1
|
||||
, pagesize = int(getClientHeight()) - 1
|
||||
, key = ev->key();
|
||||
clicked_expander_pos.setPoint(-1, -1);
|
||||
|
||||
|
@ -1051,8 +1053,8 @@ void FListView::onMouseDown (FMouseEvent* ev)
|
|||
, mouse_x = ev->getX()
|
||||
, mouse_y = ev->getY();
|
||||
|
||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
||||
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||
{
|
||||
int new_pos = first_visible_line.getPosition() + mouse_y - 2;
|
||||
|
||||
|
@ -1093,8 +1095,8 @@ void FListView::onMouseUp (FMouseEvent* ev)
|
|||
int mouse_x = ev->getX();
|
||||
int mouse_y = ev->getY();
|
||||
|
||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
||||
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||
{
|
||||
if ( tree_view )
|
||||
{
|
||||
|
@ -1134,8 +1136,8 @@ void FListView::onMouseMove (FMouseEvent* ev)
|
|||
, mouse_x = ev->getX()
|
||||
, mouse_y = ev->getY();
|
||||
|
||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
||||
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||
{
|
||||
int new_pos = first_visible_line.getPosition() + mouse_y - 2;
|
||||
|
||||
|
@ -1158,7 +1160,7 @@ void FListView::onMouseMove (FMouseEvent* ev)
|
|||
// auto-scrolling when dragging mouse outside the widget
|
||||
if ( mouse_y < 2 )
|
||||
dragUp (ev->getButton());
|
||||
else if ( mouse_y >= getHeight() )
|
||||
else if ( mouse_y >= int(getHeight()) )
|
||||
dragDown (ev->getButton());
|
||||
else
|
||||
stopDragScroll();
|
||||
|
@ -1175,8 +1177,8 @@ void FListView::onMouseDoubleClick (FMouseEvent* ev)
|
|||
mouse_x = ev->getX();
|
||||
mouse_y = ev->getY();
|
||||
|
||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
||||
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||
{
|
||||
if ( first_visible_line.getPosition() + mouse_y - 1 > int(getCount()) )
|
||||
return;
|
||||
|
@ -1307,7 +1309,7 @@ void FListView::onFocusOut (FFocusEvent*)
|
|||
void FListView::adjustViewport()
|
||||
{
|
||||
int element_count = int(getCount());
|
||||
int height = getClientHeight();
|
||||
int height = int(getClientHeight());
|
||||
|
||||
if ( element_count == 0 || height <= 0 )
|
||||
return;
|
||||
|
@ -1347,20 +1349,20 @@ void FListView::adjustViewport()
|
|||
//----------------------------------------------------------------------
|
||||
void FListView::adjustSize()
|
||||
{
|
||||
int element_count;
|
||||
std::size_t element_count;
|
||||
FWidget::adjustSize();
|
||||
adjustViewport();
|
||||
|
||||
element_count = int(getCount());
|
||||
vbar->setMaximum (element_count - getClientHeight());
|
||||
vbar->setPageSize (element_count, getClientHeight());
|
||||
vbar->setX (getWidth());
|
||||
element_count = getCount();
|
||||
vbar->setMaximum (int(element_count - getClientHeight()));
|
||||
vbar->setPageSize (int(element_count), int(getClientHeight()));
|
||||
vbar->setX (int(getWidth()));
|
||||
vbar->setHeight (getClientHeight(), false);
|
||||
vbar->resize();
|
||||
|
||||
hbar->setMaximum (max_line_width - getClientWidth());
|
||||
hbar->setPageSize (max_line_width, getClientWidth());
|
||||
hbar->setY (getHeight() );
|
||||
hbar->setMaximum (max_line_width - int(getClientWidth()));
|
||||
hbar->setPageSize (max_line_width, int(getClientWidth()));
|
||||
hbar->setY (int(getHeight()));
|
||||
hbar->setWidth (getClientWidth(), false);
|
||||
hbar->resize();
|
||||
|
||||
|
@ -1369,7 +1371,7 @@ void FListView::adjustSize()
|
|||
else
|
||||
vbar->setVisible();
|
||||
|
||||
if ( max_line_width <= getClientWidth() )
|
||||
if ( max_line_width <= int(getClientWidth()) )
|
||||
hbar->hide();
|
||||
else
|
||||
hbar->setVisible();
|
||||
|
@ -1449,9 +1451,9 @@ void FListView::sort (Compare cmp)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
uInt FListView::getAlignOffset ( fc::text_alignment align
|
||||
, uInt txt_length
|
||||
, uInt width )
|
||||
std::size_t FListView::getAlignOffset ( fc::text_alignment align
|
||||
, std::size_t txt_length
|
||||
, std::size_t width )
|
||||
{
|
||||
switch ( align )
|
||||
{
|
||||
|
@ -1460,7 +1462,7 @@ uInt FListView::getAlignOffset ( fc::text_alignment align
|
|||
|
||||
case fc::alignCenter:
|
||||
if ( txt_length < width )
|
||||
return uInt((width - txt_length) / 2);
|
||||
return std::size_t((width - txt_length) / 2);
|
||||
else
|
||||
return 0;
|
||||
|
||||
|
@ -1488,7 +1490,7 @@ void FListView::draw()
|
|||
setReverse(true);
|
||||
|
||||
if ( isNewFont() )
|
||||
drawBorder (1, 1, getWidth() - 1, getHeight());
|
||||
drawBorder (1, 1, int(getWidth()) - 1, int(getHeight()));
|
||||
else
|
||||
drawBorder();
|
||||
|
||||
|
@ -1496,9 +1498,9 @@ void FListView::draw()
|
|||
{
|
||||
setColor();
|
||||
|
||||
for (int y = 2; y < getHeight(); y++)
|
||||
for (int y = 2; y < int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (getWidth(), y);
|
||||
setPrintPos (int(getWidth()), y);
|
||||
print (' '); // clear right side of the scrollbar
|
||||
}
|
||||
}
|
||||
|
@ -1563,11 +1565,11 @@ void FListView::drawColumnLabels()
|
|||
h << headerline;
|
||||
first = h.begin() + xoffset;
|
||||
|
||||
if ( int(h.size()) <= getClientWidth() )
|
||||
if ( h.size() <= getClientWidth() )
|
||||
last = h.end();
|
||||
else
|
||||
{
|
||||
int len = getClientWidth() + xoffset - 1;
|
||||
int len = int(getClientWidth()) + xoffset - 1;
|
||||
|
||||
if ( len > int(h.size()) )
|
||||
len = int(h.size());
|
||||
|
@ -1618,7 +1620,7 @@ void FListView::drawList()
|
|||
while ( y < uInt(getClientHeight()) )
|
||||
{
|
||||
setPrintPos (2, 2 + int(y));
|
||||
print (FString(getClientWidth(), ' '));
|
||||
print (FString(std::size_t(getClientWidth()), ' '));
|
||||
y++;
|
||||
}
|
||||
}
|
||||
|
@ -1628,7 +1630,7 @@ void FListView::drawListLine ( const FListViewItem* item
|
|||
, bool is_focus
|
||||
, bool is_current )
|
||||
{
|
||||
uInt indent = item->getDepth() << 1; // indent = 2 * depth
|
||||
std::size_t indent = item->getDepth() << 1; // indent = 2 * depth
|
||||
|
||||
// Set line color and attributes
|
||||
setLineAttributes (is_current, is_focus);
|
||||
|
@ -1639,19 +1641,19 @@ void FListView::drawListLine ( const FListViewItem* item
|
|||
// Print columns
|
||||
if ( ! item->column_list.empty() )
|
||||
{
|
||||
for (uInt i = 0; i < item->column_list.size(); )
|
||||
for (std::size_t i = 0; i < item->column_list.size(); )
|
||||
{
|
||||
static const int leading_space = 1;
|
||||
static const int ellipsis_length = 2;
|
||||
static const std::size_t leading_space = 1;
|
||||
static const std::size_t ellipsis_length = 2;
|
||||
|
||||
const FString& text = item->column_list[i];
|
||||
int width = header[i].width;
|
||||
uInt txt_length = text.getLength();
|
||||
std::size_t width = std::size_t(header[i].width);
|
||||
std::size_t txt_length = text.getLength();
|
||||
// Increment the value of i for the column position
|
||||
// and the next iteration
|
||||
i++;
|
||||
fc::text_alignment align = getColumnAlignment(int(i));
|
||||
uInt align_offset = getAlignOffset (align, txt_length, uInt(width));
|
||||
std::size_t align_offset = getAlignOffset (align, txt_length, width);
|
||||
|
||||
if ( tree_view && i == 1 )
|
||||
{
|
||||
|
@ -1663,12 +1665,12 @@ void FListView::drawListLine ( const FListViewItem* item
|
|||
if ( align_offset > 0 )
|
||||
line += FString(align_offset, L' ');
|
||||
|
||||
if ( align_offset + txt_length <= uInt(width) )
|
||||
if ( align_offset + txt_length <= width )
|
||||
{
|
||||
// Insert text and trailing space
|
||||
line += text.left(width);
|
||||
line += FString ( leading_space + width
|
||||
- int(align_offset + txt_length), L' ');
|
||||
- align_offset + txt_length, L' ');
|
||||
}
|
||||
else if ( align == fc::alignRight )
|
||||
{
|
||||
|
@ -1686,16 +1688,16 @@ void FListView::drawListLine ( const FListViewItem* item
|
|||
}
|
||||
}
|
||||
|
||||
line = line.mid ( uInt(1 + xoffset)
|
||||
, uInt(getWidth() - nf_offset - 2) );
|
||||
line = line.mid ( std::size_t(xoffset) + 1
|
||||
, getWidth() - std::size_t(nf_offset) - 2);
|
||||
const wchar_t* const& element_str = line.wc_str();
|
||||
uInt len = line.getLength();
|
||||
uInt i;
|
||||
std::size_t len = line.getLength();
|
||||
std::size_t i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
*this << element_str[i];
|
||||
|
||||
for (; i < uInt(getWidth() - nf_offset - 2); i++)
|
||||
for (; i < getWidth() - std::size_t(nf_offset) - 2; i++)
|
||||
print (' ');
|
||||
}
|
||||
|
||||
|
@ -1736,7 +1738,7 @@ inline void FListView::setLineAttributes ( bool is_current
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline FString FListView::getLinePrefix ( const FListViewItem* item
|
||||
, uInt indent )
|
||||
, std::size_t indent )
|
||||
{
|
||||
FString line = "";
|
||||
|
||||
|
@ -1771,30 +1773,30 @@ inline FString FListView::getLinePrefix ( const FListViewItem* item
|
|||
void FListView::drawColumnText (headerItems::const_iterator& iter)
|
||||
{
|
||||
// Print lable text
|
||||
static const int leading_space = 1;
|
||||
static const int trailing_space = 1;
|
||||
static const std::size_t leading_space = 1;
|
||||
static const std::size_t trailing_space = 1;
|
||||
const FString& text = iter->name;
|
||||
int width = iter->width;
|
||||
std::size_t width = std::size_t(iter->width);
|
||||
FString txt = " " + text;
|
||||
uInt txt_length = txt.getLength();
|
||||
int column_width = leading_space + width;
|
||||
std::size_t txt_length = txt.getLength();
|
||||
std::size_t column_width = leading_space + width;
|
||||
|
||||
if ( isEnabled() )
|
||||
setColor (wc.label_emphasis_fg, wc.label_bg);
|
||||
else
|
||||
setColor (wc.label_inactive_fg, wc.label_inactive_bg);
|
||||
|
||||
if ( txt_length <= uInt(column_width) )
|
||||
if ( txt_length <= column_width )
|
||||
{
|
||||
headerline << txt;
|
||||
|
||||
if ( txt_length < uInt(column_width) )
|
||||
if ( txt_length < column_width )
|
||||
headerline << ' '; // trailing space
|
||||
|
||||
if ( txt_length + trailing_space < uInt(column_width) )
|
||||
if ( txt_length + trailing_space < column_width )
|
||||
{
|
||||
setColor();
|
||||
const FString line ( uInt(column_width) - trailing_space - txt_length
|
||||
const FString line ( column_width - trailing_space - txt_length
|
||||
, wchar_t(fc::BoxDrawingsHorizontal) );
|
||||
headerline << line; // horizontal line
|
||||
}
|
||||
|
@ -1884,10 +1886,10 @@ void FListView::recalculateHorizontalBar (int len)
|
|||
|
||||
max_line_width = len;
|
||||
|
||||
if ( len >= getWidth() - nf_offset - 3 )
|
||||
if ( len >= int(getWidth()) - nf_offset - 3 )
|
||||
{
|
||||
hbar->setMaximum (max_line_width - getWidth() + nf_offset + 4);
|
||||
hbar->setPageSize (max_line_width, getWidth() - nf_offset - 4);
|
||||
hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
|
||||
hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4);
|
||||
hbar->calculateSliderValues();
|
||||
|
||||
if ( ! hbar->isVisible() )
|
||||
|
@ -1898,11 +1900,11 @@ void FListView::recalculateHorizontalBar (int len)
|
|||
//----------------------------------------------------------------------
|
||||
void FListView::recalculateVerticalBar (int element_count)
|
||||
{
|
||||
vbar->setMaximum (element_count - getHeight() + 2);
|
||||
vbar->setPageSize (element_count, getHeight() - 2);
|
||||
vbar->setMaximum (element_count - int(getHeight()) + 2);
|
||||
vbar->setPageSize (element_count, int(getHeight()) - 2);
|
||||
vbar->calculateSliderValues();
|
||||
|
||||
if ( ! vbar->isVisible() && element_count >= getHeight() - 1 )
|
||||
if ( ! vbar->isVisible() && element_count >= int(getHeight()) - 1 )
|
||||
vbar->setVisible();
|
||||
}
|
||||
|
||||
|
@ -1988,7 +1990,7 @@ bool FListView::dragScrollDown (int position_before)
|
|||
void FListView::dragUp (int mouse_button)
|
||||
{
|
||||
if ( drag_scroll != fc::noScroll
|
||||
&& scroll_distance < getClientHeight() )
|
||||
&& scroll_distance < int(getClientHeight()) )
|
||||
scroll_distance++;
|
||||
|
||||
if ( ! scroll_timer && current_iter.getPosition() > 0 )
|
||||
|
@ -2013,7 +2015,7 @@ void FListView::dragUp (int mouse_button)
|
|||
void FListView::dragDown (int mouse_button)
|
||||
{
|
||||
if ( drag_scroll != fc::noScroll
|
||||
&& scroll_distance < getClientHeight() )
|
||||
&& scroll_distance < int(getClientHeight()) )
|
||||
scroll_distance++;
|
||||
|
||||
if ( ! scroll_timer && current_iter.getPosition() <= int(getCount()) )
|
||||
|
@ -2121,7 +2123,7 @@ inline void FListView::keyLeft (int& first_line_position_before)
|
|||
//----------------------------------------------------------------------
|
||||
inline void FListView::keyRight (int& first_line_position_before)
|
||||
{
|
||||
int xoffset_end = max_line_width - getClientWidth();
|
||||
int xoffset_end = max_line_width - int(getClientWidth());
|
||||
FListViewItem* item = getCurrentItem();
|
||||
|
||||
if ( tree_view && item->isExpandable() && ! item->isExpand() )
|
||||
|
@ -2299,7 +2301,7 @@ void FListView::stepBackward (int distance)
|
|||
//----------------------------------------------------------------------
|
||||
void FListView::scrollToX (int x)
|
||||
{
|
||||
int xoffset_end = max_line_width - getClientWidth();
|
||||
int xoffset_end = max_line_width - int(getClientWidth());
|
||||
|
||||
if ( xoffset == x )
|
||||
return;
|
||||
|
@ -2316,7 +2318,7 @@ void FListView::scrollToX (int x)
|
|||
//----------------------------------------------------------------------
|
||||
void FListView::scrollToY (int y)
|
||||
{
|
||||
int pagesize = getClientHeight() - 1;
|
||||
int pagesize = int(getClientHeight()) - 1;
|
||||
int element_count = int(getCount());
|
||||
|
||||
if ( first_visible_line.getPosition() == y )
|
||||
|
@ -2375,14 +2377,14 @@ void FListView::cb_VBarChange (FWidget*, data_ptr)
|
|||
break;
|
||||
|
||||
case FScrollbar::scrollPageBackward:
|
||||
distance = getClientHeight();
|
||||
distance = int(getClientHeight());
|
||||
// fall through
|
||||
case FScrollbar::scrollStepBackward:
|
||||
stepBackward(distance);
|
||||
break;
|
||||
|
||||
case FScrollbar::scrollPageForward:
|
||||
distance = getClientHeight();
|
||||
distance = int(getClientHeight());
|
||||
// fall through
|
||||
case FScrollbar::scrollStepForward:
|
||||
stepForward(distance);
|
||||
|
@ -2435,14 +2437,14 @@ void FListView::cb_HBarChange (FWidget*, data_ptr)
|
|||
break;
|
||||
|
||||
case FScrollbar::scrollPageBackward:
|
||||
distance = getClientWidth();
|
||||
distance = int(getClientWidth());
|
||||
// fall through
|
||||
case FScrollbar::scrollStepBackward:
|
||||
scrollBy (-distance, 0);
|
||||
break;
|
||||
|
||||
case FScrollbar::scrollPageForward:
|
||||
distance = getClientWidth();
|
||||
distance = int(getClientWidth());
|
||||
// fall through
|
||||
case FScrollbar::scrollStepForward:
|
||||
scrollBy (distance, 0);
|
||||
|
|
|
@ -495,7 +495,7 @@ void FMenu::calculateDimensions()
|
|||
// find the maximum item width
|
||||
while ( iter != last )
|
||||
{
|
||||
uInt item_width = (*iter)->getTextLength() + 2;
|
||||
std::size_t item_width = (*iter)->getTextLength() + 2;
|
||||
int accel_key = (*iter)->accel_key;
|
||||
bool has_menu = (*iter)->hasMenu();
|
||||
|
||||
|
@ -505,7 +505,7 @@ void FMenu::calculateDimensions()
|
|||
}
|
||||
else if ( accel_key )
|
||||
{
|
||||
uInt accel_len = getKeyName(accel_key).getLength();
|
||||
std::size_t accel_len = getKeyName(accel_key).getLength();
|
||||
item_width += accel_len + 2;
|
||||
}
|
||||
|
||||
|
@ -521,7 +521,7 @@ void FMenu::calculateDimensions()
|
|||
adjust_X = adjustX(getX());
|
||||
|
||||
// set widget geometry
|
||||
setGeometry (adjust_X, getY(), int(max_item_width + 2), int(getCount() + 2));
|
||||
setGeometry (adjust_X, getY(), max_item_width + 2, getCount() + 2);
|
||||
|
||||
// set geometry of all items
|
||||
iter = item_list.begin();
|
||||
|
@ -530,7 +530,7 @@ void FMenu::calculateDimensions()
|
|||
|
||||
while ( iter != last )
|
||||
{
|
||||
(*iter)->setGeometry (item_X, item_Y, int(max_item_width), 1);
|
||||
(*iter)->setGeometry (item_X, item_Y, max_item_width, 1);
|
||||
|
||||
if ( (*iter)->hasMenu() )
|
||||
{
|
||||
|
@ -579,9 +579,9 @@ void FMenu::adjustItems()
|
|||
int FMenu::adjustX (int x_pos)
|
||||
{
|
||||
// Is menu outside on the right of the screen?
|
||||
if ( x_pos + int(max_item_width) >= getDesktopWidth() - 1 )
|
||||
if ( x_pos + int(max_item_width) >= int(getDesktopWidth() - 1) )
|
||||
{
|
||||
x_pos = getDesktopWidth() - int(max_item_width + 1);
|
||||
x_pos = int(getDesktopWidth() - max_item_width + 1);
|
||||
// Menu to large for the screen
|
||||
if ( x_pos < 1 )
|
||||
x_pos = 1;
|
||||
|
@ -689,7 +689,7 @@ bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
|||
while ( iter != last )
|
||||
{
|
||||
int x1 = (*iter)->getX()
|
||||
, x2 = (*iter)->getX() + (*iter)->getWidth()
|
||||
, x2 = (*iter)->getX() + int((*iter)->getWidth())
|
||||
, y = (*iter)->getY()
|
||||
, mouse_x = mouse_pos.getX()
|
||||
, mouse_y = mouse_pos.getY();
|
||||
|
@ -780,7 +780,7 @@ bool FMenu::mouseUpOverList (FPoint mouse_pos)
|
|||
while ( iter != last )
|
||||
{
|
||||
int x1 = (*iter)->getX()
|
||||
, x2 = (*iter)->getX() + (*iter)->getWidth()
|
||||
, x2 = (*iter)->getX() + int((*iter)->getWidth())
|
||||
, y = (*iter)->getY()
|
||||
, mouse_x = mouse_pos.getX()
|
||||
, mouse_y = mouse_pos.getY();
|
||||
|
@ -840,7 +840,7 @@ void FMenu::mouseMoveOverList (FPoint mouse_pos, mouseStates& ms)
|
|||
while ( iter != last )
|
||||
{
|
||||
int x1 = (*iter)->getX()
|
||||
, x2 = (*iter)->getX() + (*iter)->getWidth()
|
||||
, x2 = (*iter)->getX() + int((*iter)->getWidth())
|
||||
, y = (*iter)->getY()
|
||||
, mouse_x = mouse_pos.getX()
|
||||
, mouse_y = mouse_pos.getY();
|
||||
|
@ -1222,14 +1222,16 @@ bool FMenu::hotkeyMenu (FKeyEvent* ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FMenu::getHotkeyPos (wchar_t src[], wchar_t dest[], uInt length)
|
||||
int FMenu::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;
|
||||
|
||||
for (uInt i = 0; i < length; i++)
|
||||
for (std::size_t i = 0; i < length; i++)
|
||||
{
|
||||
if ( i < length && txt[i] == L'&' && pos == -1 )
|
||||
{
|
||||
|
@ -1294,14 +1296,16 @@ inline void FMenu::drawSeparator (int y)
|
|||
if ( isNewFont() )
|
||||
{
|
||||
print (fc::NF_border_line_vertical_right);
|
||||
FString line(getWidth() - 2, wchar_t(fc::BoxDrawingsHorizontal));
|
||||
FString line ( std::size_t(getWidth()) - 2
|
||||
, wchar_t(fc::BoxDrawingsHorizontal) );
|
||||
print (line);
|
||||
print (fc::NF_rev_border_line_vertical_left);
|
||||
}
|
||||
else
|
||||
{
|
||||
print (fc::BoxDrawingsVerticalAndRight);
|
||||
FString line(getWidth() - 2, wchar_t(fc::BoxDrawingsHorizontal));
|
||||
FString line ( std::size_t(getWidth()) - 2
|
||||
, wchar_t(fc::BoxDrawingsHorizontal));
|
||||
print (line);
|
||||
print (fc::BoxDrawingsVerticalAndLeft);
|
||||
}
|
||||
|
@ -1315,8 +1319,8 @@ inline void FMenu::drawMenuLine (FMenuItem* menuitem, int y)
|
|||
{
|
||||
FString txt = menuitem->getText();
|
||||
menuText txtdata;
|
||||
uInt txt_length = uInt(txt.getLength());
|
||||
int to_char = int(txt_length);
|
||||
std::size_t txt_length = txt.getLength();
|
||||
std::size_t to_char = txt_length;
|
||||
int accel_key = menuitem->accel_key;
|
||||
bool is_enabled = menuitem->isEnabled();
|
||||
bool is_selected = menuitem->isSelected();
|
||||
|
@ -1421,7 +1425,7 @@ inline void FMenu::drawMenuText (menuText& data)
|
|||
{
|
||||
// Print menu text
|
||||
|
||||
for (int z = 0; z < data.length; z++)
|
||||
for (std::size_t z = 0; z < data.length; z++)
|
||||
{
|
||||
if ( ! std::iswprint(wint_t(data.text[z])) )
|
||||
{
|
||||
|
@ -1434,7 +1438,7 @@ inline void FMenu::drawMenuText (menuText& data)
|
|||
}
|
||||
}
|
||||
|
||||
if ( z == data.hotkeypos )
|
||||
if ( int(z) == data.hotkeypos )
|
||||
{
|
||||
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
||||
|
||||
|
@ -1454,10 +1458,10 @@ inline void FMenu::drawMenuText (menuText& data)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMenu::drawSubMenuIndicator (int& startpos)
|
||||
inline void FMenu::drawSubMenuIndicator (std::size_t& startpos)
|
||||
{
|
||||
int c = ( has_checkable_items ) ? 1 : 0;
|
||||
int len = int(max_item_width) - (startpos + c + 3);
|
||||
std::size_t c = ( has_checkable_items ) ? 1 : 0;
|
||||
std::size_t len = max_item_width - (startpos + c + 3);
|
||||
|
||||
if ( len > 0 )
|
||||
{
|
||||
|
@ -1465,33 +1469,34 @@ inline void FMenu::drawSubMenuIndicator (int& startpos)
|
|||
print (FString(len, wchar_t(' ')));
|
||||
// Print BlackRightPointingPointer ►
|
||||
print (wchar_t(fc::BlackRightPointingPointer));
|
||||
startpos = int(max_item_width) - (c + 2);
|
||||
startpos = max_item_width - (c + 2);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMenu::drawAcceleratorKey (int& startpos, int accel_key)
|
||||
inline void FMenu::drawAcceleratorKey (std::size_t& startpos, int accel_key)
|
||||
{
|
||||
FString accel_name (getKeyName(accel_key));
|
||||
int c = ( has_checkable_items ) ? 1 : 0;
|
||||
int accel_len = int(accel_name.getLength());
|
||||
int len = int(max_item_width) - (startpos + accel_len + c + 2);
|
||||
std::size_t c = ( has_checkable_items ) ? 1 : 0;
|
||||
std::size_t accel_len = accel_name.getLength();
|
||||
std::size_t len = max_item_width - (startpos + accel_len + c + 2);
|
||||
|
||||
if ( len > 0 )
|
||||
{
|
||||
// Print filling blank spaces + accelerator key name
|
||||
FString spaces (len, wchar_t(' '));
|
||||
print (spaces + accel_name);
|
||||
startpos = int(max_item_width) - (c + 2);
|
||||
startpos = max_item_width - (c + 2);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FMenu::drawTrailingSpaces (int startpos)
|
||||
inline void FMenu::drawTrailingSpaces (std::size_t startpos)
|
||||
{
|
||||
int c = ( has_checkable_items ) ? 1 : 0;
|
||||
std::size_t c = ( has_checkable_items ) ? 1 : 0;
|
||||
|
||||
// Print trailing blank space
|
||||
for (uInt i = uInt(startpos + c); i < max_item_width - 1; i++)
|
||||
for (std::size_t i = startpos + c; i < max_item_width - 1; i++)
|
||||
print (' ');
|
||||
}
|
||||
|
||||
|
|
|
@ -72,12 +72,9 @@ void FMenuBar::hide()
|
|||
setColor (fg, bg);
|
||||
screenWidth = getDesktopWidth();
|
||||
|
||||
if ( screenWidth < 0 )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
blank = new char[std::size_t(screenWidth) + 1];
|
||||
blank = new char[screenWidth + 1];
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -85,9 +82,9 @@ void FMenuBar::hide()
|
|||
return;
|
||||
}
|
||||
|
||||
std::memset(blank, ' ', std::size_t(screenWidth));
|
||||
std::memset(blank, ' ', screenWidth);
|
||||
blank[screenWidth] = '\0';
|
||||
setPrintPos (1,1);
|
||||
setPrintPos (1, 1);
|
||||
print (blank);
|
||||
delete[] blank;
|
||||
}
|
||||
|
@ -256,7 +253,7 @@ void FMenuBar::cb_item_deactivated (FWidget* widget, data_ptr)
|
|||
void FMenuBar::init()
|
||||
{
|
||||
FWidget* r = getRootWidget();
|
||||
int w = r->getWidth();
|
||||
std::size_t w = r->getWidth();
|
||||
// initialize geometry values
|
||||
setGeometry (1, 1, w, 1, false);
|
||||
setAlwaysOnTop();
|
||||
|
@ -285,11 +282,11 @@ void FMenuBar::calculateDimensions()
|
|||
// find the maximum item width
|
||||
while ( iter != last )
|
||||
{
|
||||
uInt len = (*iter)->getTextLength();
|
||||
int item_width = int(len + 2);
|
||||
std::size_t len = (*iter)->getTextLength();
|
||||
int item_width = int(len) + 2;
|
||||
|
||||
// set item geometry
|
||||
(*iter)->setGeometry (item_X, item_Y, item_width, 1, false);
|
||||
(*iter)->setGeometry (item_X, item_Y, std::size_t(item_width), 1, false);
|
||||
|
||||
// set menu position
|
||||
if ( (*iter)->hasMenu() )
|
||||
|
@ -497,14 +494,16 @@ bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FMenuBar::getHotkeyPos (wchar_t src[], wchar_t dest[], uInt length)
|
||||
int FMenuBar::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;
|
||||
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'&' && hotkeypos == -1 )
|
||||
{
|
||||
|
@ -550,7 +549,7 @@ void FMenuBar::drawItems()
|
|||
}
|
||||
|
||||
// Print spaces to end of line
|
||||
for (; x <= screenWidth; x++)
|
||||
for (; x <= int(screenWidth); x++)
|
||||
print (' ');
|
||||
|
||||
if ( isMonochron() )
|
||||
|
@ -562,13 +561,13 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, int& x)
|
|||
{
|
||||
FString txt = menuitem->getText();
|
||||
menuText txtdata;
|
||||
uInt txt_length = txt.getLength();
|
||||
std::size_t txt_length = txt.getLength();
|
||||
std::size_t to_char;
|
||||
int hotkeypos;
|
||||
int to_char;
|
||||
bool is_enabled = menuitem->isEnabled();
|
||||
bool is_selected = menuitem->isSelected();
|
||||
|
||||
txtdata.startpos = x + 1;
|
||||
txtdata.startpos = std::size_t(x) + 1;
|
||||
txtdata.no_underline = ((menuitem->getFlags() & fc::no_underline) != 0);
|
||||
|
||||
// Set screen attributes
|
||||
|
@ -585,10 +584,10 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, int& x)
|
|||
return;
|
||||
}
|
||||
|
||||
if ( x - 1 <= screenWidth )
|
||||
to_char = int(txt_length);
|
||||
if ( x - 1 <= int(screenWidth) )
|
||||
to_char = txt_length;
|
||||
else
|
||||
to_char = int(txt_length) - (screenWidth - x - 1);
|
||||
to_char = txt_length - screenWidth - std::size_t(x) - 1;
|
||||
|
||||
hotkeypos = getHotkeyPos (txt.wc_str(), txtdata.text, txt_length);
|
||||
|
||||
|
@ -654,9 +653,9 @@ inline void FMenuBar::drawMenuText (menuText& data)
|
|||
{
|
||||
// Print menu text
|
||||
|
||||
for (int z = 0; z < data.length; z++)
|
||||
for (std::size_t z = 0; z < data.length; z++)
|
||||
{
|
||||
if ( data.startpos > screenWidth - z )
|
||||
if ( data.startpos > std::size_t(screenWidth) - z )
|
||||
break;
|
||||
|
||||
if ( ! std::iswprint(wint_t(data.text[z])) )
|
||||
|
@ -669,7 +668,7 @@ inline void FMenuBar::drawMenuText (menuText& data)
|
|||
}
|
||||
}
|
||||
|
||||
if ( z == data.hotkeypos )
|
||||
if ( int(z) == data.hotkeypos )
|
||||
{
|
||||
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
|
||||
|
||||
|
@ -691,18 +690,18 @@ inline void FMenuBar::drawMenuText (menuText& data)
|
|||
//----------------------------------------------------------------------
|
||||
inline void FMenuBar::drawEllipsis (menuText& txtdata, int x)
|
||||
{
|
||||
if ( x > screenWidth + 1 )
|
||||
if ( x > int(screenWidth) + 1 )
|
||||
{
|
||||
if ( txtdata.startpos < screenWidth )
|
||||
{
|
||||
// Print ellipsis
|
||||
setPrintPos (screenWidth - 1, 1);
|
||||
setPrintPos (int(screenWidth) - 1, 1);
|
||||
print ("..");
|
||||
}
|
||||
else if ( txtdata.startpos - 1 <= screenWidth )
|
||||
{
|
||||
// Hide first character from text
|
||||
setPrintPos (screenWidth, 1);
|
||||
setPrintPos (int(screenWidth), 1);
|
||||
print (' ');
|
||||
}
|
||||
}
|
||||
|
@ -713,7 +712,7 @@ inline void FMenuBar::drawLeadingSpace (int& x)
|
|||
{
|
||||
// Print a leading blank space
|
||||
|
||||
if ( x < screenWidth )
|
||||
if ( x < int(screenWidth) )
|
||||
{
|
||||
x++;
|
||||
print (' ');
|
||||
|
@ -725,7 +724,7 @@ inline void FMenuBar::drawTrailingSpace (int& x)
|
|||
{
|
||||
// Print a trailing blank space
|
||||
|
||||
if ( x < screenWidth )
|
||||
if ( x < int(screenWidth) )
|
||||
{
|
||||
x++;
|
||||
print (' ');
|
||||
|
@ -744,7 +743,7 @@ void FMenuBar::adjustItems()
|
|||
while ( iter != last )
|
||||
{
|
||||
// get item width
|
||||
int item_width = (*iter)->getWidth();
|
||||
int item_width = int((*iter)->getWidth());
|
||||
|
||||
if ( (*iter)->hasMenu() )
|
||||
{
|
||||
|
@ -874,7 +873,7 @@ void FMenuBar::mouseDownOverList (FMouseEvent* ev)
|
|||
{
|
||||
int x1, x2;
|
||||
x1 = (*iter)->getX();
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth();
|
||||
x2 = (*iter)->getX() + int((*iter)->getWidth());
|
||||
|
||||
if ( mouse_y == 1 )
|
||||
{
|
||||
|
@ -924,7 +923,7 @@ void FMenuBar::mouseUpOverList (FMouseEvent* ev)
|
|||
{
|
||||
int x1, x2;
|
||||
x1 = (*iter)->getX();
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth();
|
||||
x2 = (*iter)->getX() + int((*iter)->getWidth());
|
||||
|
||||
if ( mouse_y == 1
|
||||
&& mouse_x >= x1
|
||||
|
@ -974,7 +973,7 @@ void FMenuBar::mouseMoveOverList (FMouseEvent* ev)
|
|||
{
|
||||
int x1, x2;
|
||||
x1 = (*iter)->getX();
|
||||
x2 = (*iter)->getX() + (*iter)->getWidth();
|
||||
x2 = (*iter)->getX() + int((*iter)->getWidth());
|
||||
|
||||
if ( mouse_x >= x1
|
||||
&& mouse_x < x2
|
||||
|
|
|
@ -227,7 +227,7 @@ void FMenuItem::setText (const FString& txt)
|
|||
if ( hotkey )
|
||||
text_length--;
|
||||
|
||||
setWidth(int(text_length));
|
||||
setWidth(text_length);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -566,13 +566,13 @@ FMenuList* FMenuItem::getFMenuList (FWidget& widget)
|
|||
|
||||
if ( isMenu(&widget) )
|
||||
{
|
||||
FMenu* menu = static_cast<FMenu*>(&widget);
|
||||
menu_list = static_cast<FMenuList*>(menu);
|
||||
FMenu* Menu = static_cast<FMenu*>(&widget);
|
||||
menu_list = static_cast<FMenuList*>(Menu);
|
||||
}
|
||||
else if ( isMenuBar(&widget) )
|
||||
{
|
||||
FMenuBar* menubar = static_cast<FMenuBar*>(&widget);
|
||||
menu_list = static_cast<FMenuList*>(menubar);
|
||||
FMenuBar* Menubar = static_cast<FMenuBar*>(&widget);
|
||||
menu_list = static_cast<FMenuList*>(Menubar);
|
||||
}
|
||||
else
|
||||
menu_list = 0;
|
||||
|
@ -589,7 +589,7 @@ void FMenuItem::init (FWidget* parent)
|
|||
if ( hotkey )
|
||||
text_length--;
|
||||
|
||||
setGeometry (1, 1, int(text_length + 2), 1, false);
|
||||
setGeometry (1, 1, text_length + 2, 1, false);
|
||||
|
||||
if ( ! parent )
|
||||
return;
|
||||
|
@ -629,14 +629,14 @@ void FMenuItem::init (FWidget* parent)
|
|||
//----------------------------------------------------------------------
|
||||
uChar FMenuItem::hotKey()
|
||||
{
|
||||
uInt length;
|
||||
std::size_t length;
|
||||
|
||||
if ( text.isEmpty() )
|
||||
return 0;
|
||||
|
||||
length = text.getLength();
|
||||
|
||||
for (uInt i = 0; i < length; i++)
|
||||
for (std::size_t i = 0; i < length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -159,9 +159,9 @@ void FMessageBox::setHeadline (const FString& headline)
|
|||
setHeight(getHeight() + 2, true);
|
||||
|
||||
for (uInt n = 0; n < num_buttons; n++)
|
||||
button[n]->setY (getHeight() - 4, false);
|
||||
button[n]->setY (int(getHeight()) - 4, false);
|
||||
|
||||
uInt len = headline_text.getLength();
|
||||
std::size_t len = headline_text.getLength();
|
||||
|
||||
if ( len > max_line_width )
|
||||
max_line_width = len;
|
||||
|
@ -172,13 +172,13 @@ void FMessageBox::setText (const FString& txt)
|
|||
{
|
||||
text = txt;
|
||||
calculateDimensions();
|
||||
button[0]->setY (getHeight() - 4, false);
|
||||
button[0]->setY (int(getHeight()) - 4, false);
|
||||
|
||||
if ( button_digit[1] != 0 )
|
||||
button[1]->setY (getHeight() - 4, false);
|
||||
button[1]->setY (int(getHeight()) - 4, false);
|
||||
|
||||
if ( button_digit[2] != 0 )
|
||||
button[2]->setY (getHeight() - 4, false);
|
||||
button[2]->setY (int(getHeight()) - 4, false);
|
||||
|
||||
adjustButtons();
|
||||
}
|
||||
|
@ -279,10 +279,9 @@ int FMessageBox::error ( FWidget* parent
|
|||
//----------------------------------------------------------------------
|
||||
void FMessageBox::adjustSize()
|
||||
{
|
||||
int X
|
||||
, Y
|
||||
, max_width
|
||||
, max_height;
|
||||
int X, Y;
|
||||
std::size_t max_width;
|
||||
std::size_t max_height;
|
||||
FWidget* root_widget = getRootWidget();
|
||||
|
||||
if ( root_widget )
|
||||
|
@ -350,7 +349,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
|
|||
{
|
||||
button[0] = new FButton (this);
|
||||
button[0]->setText(button_text[button0]);
|
||||
button[0]->setPos(3, getHeight() - 4, false);
|
||||
button[0]->setPos(3, int(getHeight()) - 4, false);
|
||||
button[0]->setWidth(1, false);
|
||||
button[0]->setHeight(1, false);
|
||||
button[0]->setFocus();
|
||||
|
@ -359,7 +358,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
|
|||
{
|
||||
button[1] = new FButton(this);
|
||||
button[1]->setText(button_text[button1]);
|
||||
button[1]->setPos(17, getHeight() - 4, false);
|
||||
button[1]->setPos(17, int(getHeight()) - 4, false);
|
||||
button[1]->setWidth(0, false);
|
||||
button[1]->setHeight(1, false);
|
||||
}
|
||||
|
@ -368,7 +367,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
|
|||
{
|
||||
button[2] = new FButton(this);
|
||||
button[2]->setText(button_text[button2]);
|
||||
button[2]->setPos(32, getHeight() - 4, false);
|
||||
button[2]->setPos(32, int(getHeight()) - 4, false);
|
||||
button[2]->setWidth(0, false);
|
||||
button[2]->setHeight(1, false);
|
||||
}
|
||||
|
@ -424,8 +423,9 @@ inline void FMessageBox::initCallbacks()
|
|||
//----------------------------------------------------------------------
|
||||
void FMessageBox::calculateDimensions()
|
||||
{
|
||||
int x, y, w, h;
|
||||
int headline_height = 0;
|
||||
int x, y;
|
||||
std::size_t w, h;
|
||||
std::size_t headline_height = 0;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
text_split = text.split("\n");
|
||||
text_num_lines = uInt(text_split.size());
|
||||
|
@ -437,14 +437,14 @@ void FMessageBox::calculateDimensions()
|
|||
|
||||
for (uInt i = 0; i < text_num_lines; i++)
|
||||
{
|
||||
uInt len = text_components[i].getLength();
|
||||
std::size_t len = text_components[i].getLength();
|
||||
|
||||
if ( len > max_line_width )
|
||||
max_line_width = len;
|
||||
}
|
||||
|
||||
h = int(text_num_lines) + 8 + headline_height;
|
||||
w = int(max_line_width + 4);
|
||||
h = text_num_lines + 8 + headline_height;
|
||||
w = max_line_width + 4;
|
||||
|
||||
if ( w < 20 )
|
||||
w = 20;
|
||||
|
@ -468,7 +468,7 @@ void FMessageBox::draw()
|
|||
int head_offset = 0;
|
||||
int center_x = 0;
|
||||
// center the whole block
|
||||
int msg_x = int((getWidth() - int(max_line_width)) / 2);
|
||||
int msg_x = int((getWidth() - max_line_width) / 2);
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
@ -476,7 +476,7 @@ void FMessageBox::draw()
|
|||
if ( ! headline_text.isNull() )
|
||||
{
|
||||
setColor(emphasis_color, getBackgroundColor());
|
||||
uInt headline_length = headline_text.getLength();
|
||||
std::size_t headline_length = headline_text.getLength();
|
||||
|
||||
if ( center_text ) // center one line
|
||||
center_x = int((max_line_width - headline_length) / 2);
|
||||
|
@ -490,7 +490,7 @@ void FMessageBox::draw()
|
|||
|
||||
for (int i = 0; i < int(text_num_lines); i++)
|
||||
{
|
||||
uInt line_length = text_components[i].getLength();
|
||||
std::size_t line_length = text_components[i].getLength();
|
||||
|
||||
if ( center_text ) // center one line
|
||||
center_x = int((max_line_width - line_length) / 2);
|
||||
|
@ -506,9 +506,9 @@ void FMessageBox::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void FMessageBox::resizeButtons()
|
||||
{
|
||||
uInt len[3], max_size;
|
||||
std::size_t len[3], max_size;
|
||||
|
||||
for (uInt n = 0; n < num_buttons; n++)
|
||||
for (std::size_t n = 0; n < num_buttons; n++)
|
||||
{
|
||||
len[n] = button[n]->getText().getLength();
|
||||
|
||||
|
@ -530,17 +530,17 @@ void FMessageBox::resizeButtons()
|
|||
if ( max_size < 7 )
|
||||
max_size = 7;
|
||||
|
||||
for (uInt n = 0; n < num_buttons; n++)
|
||||
button[n]->setWidth(int(max_size + 3), false);
|
||||
for (std::size_t n = 0; n < num_buttons; n++)
|
||||
button[n]->setWidth(max_size + 3, false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FMessageBox::adjustButtons()
|
||||
{
|
||||
static const int gap = 4;
|
||||
int btn_width = 0;
|
||||
static const std::size_t gap = 4;
|
||||
std::size_t btn_width = 0;
|
||||
|
||||
for (uInt n = 0; n < num_buttons; n++)
|
||||
for (std::size_t n = 0; n < num_buttons; n++)
|
||||
{
|
||||
if ( n == num_buttons - 1 )
|
||||
btn_width += button[n]->getWidth();
|
||||
|
@ -550,7 +550,7 @@ void FMessageBox::adjustButtons()
|
|||
|
||||
if ( btn_width >= getWidth() - 4 )
|
||||
{
|
||||
int max_width;
|
||||
std::size_t max_width;
|
||||
FWidget* root_widget = getRootWidget();
|
||||
setWidth(btn_width + 5);
|
||||
max_width = ( root_widget ) ? root_widget->getClientWidth() : 80;
|
||||
|
@ -559,14 +559,14 @@ void FMessageBox::adjustButtons()
|
|||
|
||||
int btn_x = int((getWidth() - btn_width) / 2);
|
||||
|
||||
for (uInt n = 0; n < num_buttons; n++)
|
||||
for (std::size_t n = 0; n < num_buttons; n++)
|
||||
{
|
||||
if ( n == 0 )
|
||||
button[n]->setX(btn_x);
|
||||
else
|
||||
{
|
||||
int btn_size = button[n]->getWidth();
|
||||
button[n]->setX( btn_x + int(n) * (btn_size + gap) );
|
||||
int btn_size = int(button[n]->getWidth());
|
||||
button[n]->setX(btn_x + int(n) * (btn_size + int(gap)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -700,7 +700,7 @@ void FMouseSGR::setRawData (FKeyboard::keybuffer& fifo_buf)
|
|||
std::size_t len = std::strlen(fifo_buf);
|
||||
std::size_t n = 3;
|
||||
|
||||
while ( n < len && n < MOUSE_BUF_SIZE + 3 )
|
||||
while ( n < len && n <= MOUSE_BUF_SIZE + 1 )
|
||||
{
|
||||
sgr_mouse[n - 3] = fifo_buf[n];
|
||||
n++;
|
||||
|
@ -954,7 +954,7 @@ void FMouseUrxvt::setRawData (FKeyboard::keybuffer& fifo_buf)
|
|||
std::size_t len = std::strlen(fifo_buf);
|
||||
std::size_t n = 2;
|
||||
|
||||
while ( n < len && n < MOUSE_BUF_SIZE + 2 )
|
||||
while ( n < len && n <= MOUSE_BUF_SIZE )
|
||||
{
|
||||
urxvt_mouse[n - 2] = fifo_buf[n];
|
||||
n++;
|
||||
|
|
|
@ -102,7 +102,7 @@ void FOptiMove::setTabStop (int t)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FOptiMove::setTermSize (int w, int h)
|
||||
void FOptiMove::setTermSize (std::size_t w, std::size_t h)
|
||||
{
|
||||
assert ( w > 0 );
|
||||
assert ( h > 0 );
|
||||
|
@ -493,10 +493,10 @@ void FOptiMove::set_clr_eol (char cap[])
|
|||
void FOptiMove::check_boundaries ( int& xold, int& yold
|
||||
, int& xnew, int& ynew )
|
||||
{
|
||||
if ( xold < 0 || xold >= screen_width )
|
||||
if ( xold < 0 || xold >= int(screen_width) )
|
||||
xold = -1;
|
||||
|
||||
if ( yold < 0 || yold >= screen_height )
|
||||
if ( yold < 0 || yold >= int(screen_height) )
|
||||
yold = -1;
|
||||
|
||||
if ( xnew < 0 )
|
||||
|
@ -505,11 +505,11 @@ void FOptiMove::check_boundaries ( int& xold, int& yold
|
|||
if ( ynew < 0 )
|
||||
ynew = 0;
|
||||
|
||||
if ( xnew >= screen_width )
|
||||
xnew = screen_width - 1;
|
||||
if ( xnew >= int(screen_width) )
|
||||
xnew = int(screen_width) - 1;
|
||||
|
||||
if ( ynew >= screen_height )
|
||||
ynew = screen_height - 1;
|
||||
if ( ynew >= int(screen_height) )
|
||||
ynew = int(screen_height) - 1;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -962,7 +962,7 @@ inline bool FOptiMove::isWideMove ( int xold, int yold
|
|||
, int xnew, int ynew )
|
||||
{
|
||||
return bool ( xnew > MOVE_LIMIT
|
||||
&& xnew < screen_width - 1 - MOVE_LIMIT
|
||||
&& xnew < int(screen_width) - 1 - MOVE_LIMIT
|
||||
&& std::abs(xnew - xold) + std::abs(ynew - yold)
|
||||
> MOVE_LIMIT );
|
||||
}
|
||||
|
@ -1066,7 +1066,7 @@ inline bool FOptiMove::isMethod4Faster ( int& move_time
|
|||
char null_result[BUF_SIZE];
|
||||
char* null_ptr = null_result;
|
||||
int new_time = relativeMove ( null_ptr
|
||||
, 0, screen_height - 1
|
||||
, 0, int(screen_height) - 1
|
||||
, xnew, ynew );
|
||||
|
||||
if ( new_time < LONG_DURATION
|
||||
|
@ -1094,7 +1094,7 @@ inline bool FOptiMove::isMethod5Faster ( int& move_time
|
|||
char null_result[BUF_SIZE];
|
||||
char* null_ptr = null_result;
|
||||
int new_time = relativeMove ( null_ptr
|
||||
, screen_width - 1, yold - 1
|
||||
, int(screen_width) - 1, yold - 1
|
||||
, xnew, ynew );
|
||||
|
||||
if ( new_time < LONG_DURATION
|
||||
|
@ -1145,7 +1145,7 @@ void FOptiMove::moveByMethod ( int method
|
|||
std::strncpy (move_ptr, F_cursor_to_ll.cap, BUF_SIZE - 1);
|
||||
move_ptr[BUF_SIZE - 1] ='\0';
|
||||
move_ptr += F_cursor_to_ll.length;
|
||||
relativeMove (move_ptr, 0, screen_height - 1, xnew, ynew);
|
||||
relativeMove (move_ptr, 0, int(screen_height) - 1, xnew, ynew);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
|
@ -1161,7 +1161,7 @@ void FOptiMove::moveByMethod ( int method
|
|||
, BUF_SIZE - std::strlen(move_ptr) );
|
||||
move_ptr[BUF_SIZE - 1] ='\0';
|
||||
move_ptr += std::strlen(move_buf);
|
||||
relativeMove (move_ptr, screen_width - 1, yold - 1, xnew, ynew);
|
||||
relativeMove (move_ptr, int(screen_width) - 1, yold - 1, xnew, ynew);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -69,7 +69,7 @@ void FProgressbar::setPercentage (int percentage_value)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FProgressbar::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||
void FProgressbar::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
|
||||
{
|
||||
// Set the progress bar geometry
|
||||
|
||||
|
@ -99,7 +99,7 @@ bool FProgressbar::setShadow (bool on)
|
|||
//----------------------------------------------------------------------
|
||||
void FProgressbar::hide()
|
||||
{
|
||||
int s, size;
|
||||
std::size_t s, size;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
@ -121,7 +121,7 @@ void FProgressbar::hide()
|
|||
s = hasShadow() ? 1 : 0;
|
||||
size = getWidth() + s;
|
||||
|
||||
if ( size < 0 )
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
try
|
||||
|
@ -137,14 +137,14 @@ void FProgressbar::hide()
|
|||
std::memset(blank, ' ', std::size_t(size));
|
||||
blank[size] = '\0';
|
||||
|
||||
for (int y = 0; y < getHeight() + s; y++)
|
||||
for (int y = 0; y < int(getHeight() + s); y++)
|
||||
{
|
||||
setPrintPos (1, 1 + y);
|
||||
print (blank);
|
||||
}
|
||||
|
||||
delete[] blank;
|
||||
setPrintPos (getWidth() - 4, 0);
|
||||
setPrintPos (int(getWidth()) - 4, 0);
|
||||
print (" "); // hide percentage
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ void FProgressbar::drawPercentage()
|
|||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
||||
setPrintPos (getWidth() - 3, 0);
|
||||
setPrintPos (int(getWidth()) - 3, 0);
|
||||
|
||||
if ( percentage < 0 || percentage > 100 )
|
||||
print ("--- %");
|
||||
|
@ -204,8 +204,8 @@ void FProgressbar::drawPercentage()
|
|||
//----------------------------------------------------------------------
|
||||
void FProgressbar::drawBar()
|
||||
{
|
||||
int i = 0;
|
||||
double length = double(bar_length * percentage) / 100;
|
||||
std::size_t i = 0;
|
||||
double length = double(int(bar_length) * percentage) / 100;
|
||||
setPrintPos (1,1);
|
||||
setColor ( wc.progressbar_bg
|
||||
, wc.progressbar_fg );
|
||||
|
|
|
@ -115,37 +115,40 @@ void FRect::setPos (const FPoint& p)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FRect::setWidth (int w)
|
||||
void FRect::setWidth (std::size_t w)
|
||||
{
|
||||
X2 = short(X1 + w - 1);
|
||||
X2 = short(X1 + short(w) - 1);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FRect::setHeight (int h)
|
||||
void FRect::setHeight (std::size_t h)
|
||||
{
|
||||
Y2 = short(Y1 + h - 1);
|
||||
Y2 = short(Y1 + short(h) - 1);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FRect::setSize (int w, int h)
|
||||
void FRect::setSize (std::size_t w, std::size_t h)
|
||||
{
|
||||
X2 = short(X1 + w - 1);
|
||||
Y2 = short(Y1 + h - 1);
|
||||
X2 = short(X1 + short(w) - 1);
|
||||
Y2 = short(Y1 + short(h) - 1);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FRect::setRect (const FRect& r)
|
||||
{
|
||||
setRect (r.X1, r.Y1, r.X2 - r.X1 + 1, r.Y2 - r.Y1 + 1);
|
||||
setRect ( r.X1
|
||||
, r.Y1
|
||||
, std::size_t(r.X2 - r.X1 + 1)
|
||||
, std::size_t(r.Y2 - r.Y1 + 1) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FRect::setRect (int x, int y, int width, int height)
|
||||
void FRect::setRect (int x, int y, std::size_t width, std::size_t height)
|
||||
{
|
||||
X1 = short(x);
|
||||
Y1 = short(y);
|
||||
X2 = short(x + width - 1);
|
||||
Y2 = short(y + height - 1);
|
||||
X2 = short(x + int(width) - 1);
|
||||
Y2 = short(y + int(height) - 1);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -248,8 +251,8 @@ FRect operator + (const FRect& r, const FPoint& p)
|
|||
{
|
||||
return FRect ( r.X1
|
||||
, r.Y1
|
||||
, r.X2 - r.X1 + 1 + p.getX()
|
||||
, r.Y2 - r.Y1 + 1 + p.getY() );
|
||||
, std::size_t(r.X2 - r.X1 + 1 + p.getX())
|
||||
, std::size_t(r.Y2 - r.Y1 + 1 + p.getY()) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -257,8 +260,8 @@ FRect operator - (const FRect& r, const FPoint& p)
|
|||
{
|
||||
return FRect ( r.X1
|
||||
, r.Y1
|
||||
, r.X2 - r.X1 + 1 - p.getX()
|
||||
, r.Y2 - r.Y1 + 1 - p.getY() );
|
||||
, std::size_t(r.X2 - r.X1 + 1 - p.getX())
|
||||
, std::size_t(r.Y2 - r.Y1 + 1 - p.getY()) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -152,7 +152,7 @@ void FScrollbar::setPageSize (int document_size, int page_size)
|
|||
//----------------------------------------------------------------------
|
||||
void FScrollbar::setOrientation (int o)
|
||||
{
|
||||
int nf = 0;
|
||||
std::size_t nf = 0;
|
||||
length = ( getHeight() > getWidth() ) ? getHeight() : getWidth();
|
||||
|
||||
if ( o == fc::vertical && bar_orientation == fc::horizontal )
|
||||
|
@ -174,13 +174,13 @@ void FScrollbar::setOrientation (int o)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollbar::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||
void FScrollbar::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
|
||||
{
|
||||
// Set the scrollbar geometry
|
||||
|
||||
FWidget::setGeometry (x, y, w, h, adjust);
|
||||
|
||||
int nf = 0;
|
||||
std::size_t nf = 0;
|
||||
length = ( h > w ) ? h : w;
|
||||
|
||||
if ( bar_orientation == fc::vertical )
|
||||
|
@ -223,7 +223,7 @@ void FScrollbar::calculateSliderValues()
|
|||
else
|
||||
bar_length = length - 2;
|
||||
|
||||
slider_length = int(double(bar_length) / steps);
|
||||
slider_length = std::size_t(double(bar_length) / steps);
|
||||
|
||||
if ( slider_length < 1 )
|
||||
slider_length = 1;
|
||||
|
@ -238,17 +238,18 @@ void FScrollbar::calculateSliderValues()
|
|||
|
||||
if ( val == max )
|
||||
{
|
||||
slider_pos = bar_length - slider_length;
|
||||
slider_pos = int(bar_length - slider_length);
|
||||
return;
|
||||
}
|
||||
|
||||
slider_pos = int( round ( double((bar_length - slider_length) * val)
|
||||
std::size_t v = std::size_t(val);
|
||||
slider_pos = int( round ( double((bar_length - slider_length) * v)
|
||||
/ double(max - min) ) );
|
||||
|
||||
if ( slider_pos < 0 )
|
||||
slider_pos = 0;
|
||||
else if ( slider_pos > bar_length - slider_length )
|
||||
slider_pos = bar_length - slider_length;
|
||||
else if ( slider_pos > int(bar_length - slider_length) )
|
||||
slider_pos = int(bar_length - slider_length);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -280,7 +281,7 @@ void FScrollbar::drawVerticalBar()
|
|||
if ( isMonochron() )
|
||||
setReverse(false);
|
||||
|
||||
for (z = 1; z <= slider_length; z++)
|
||||
for (z = 1; z <= int(slider_length); z++)
|
||||
{
|
||||
setPrintPos (1, 1 + slider_pos + z);
|
||||
|
||||
|
@ -295,7 +296,7 @@ void FScrollbar::drawVerticalBar()
|
|||
|
||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||
|
||||
for (z = slider_pos + slider_length + 1; z <= bar_length; z++)
|
||||
for (z = slider_pos + int(slider_length) + 1; z <= int(bar_length); z++)
|
||||
{
|
||||
setPrintPos (1, 1 + z);
|
||||
|
||||
|
@ -343,16 +344,16 @@ void FScrollbar::drawHorizontalBar()
|
|||
if ( isMonochron() )
|
||||
setReverse(false);
|
||||
|
||||
for (z = 0; z < slider_length; z++)
|
||||
for (z = 0; z < int(slider_length); z++)
|
||||
print (' ');
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||
z = slider_pos + slider_length + 1;
|
||||
z = slider_pos + int(slider_length) + 1;
|
||||
|
||||
for (; z <= bar_length; z++)
|
||||
for (; z <= int(bar_length); z++)
|
||||
{
|
||||
if ( isNewFont() && max_color > 8 )
|
||||
print (fc::NF_border_line_upper); // ¯
|
||||
|
@ -500,8 +501,8 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
|
|||
}
|
||||
}
|
||||
|
||||
if ( mouse_x < 1 || mouse_x > getWidth()
|
||||
|| mouse_y < 1 || mouse_y > getHeight() )
|
||||
if ( mouse_x < 1 || mouse_x > int(getWidth())
|
||||
|| mouse_y < 1 || mouse_y > int(getHeight()) )
|
||||
{
|
||||
delOwnTimer();
|
||||
}
|
||||
|
@ -554,7 +555,7 @@ void FScrollbar::onTimer (FTimerEvent*)
|
|||
|| ( scroll_type == FScrollbar::scrollPageForward
|
||||
&& slider_pos == slider_click_stop_pos ) )
|
||||
{
|
||||
int max_slider_pos = bar_length - slider_length;
|
||||
int max_slider_pos = int(bar_length - slider_length);
|
||||
|
||||
if ( scroll_type == FScrollbar::scrollPageBackward
|
||||
&& slider_pos == 0 )
|
||||
|
@ -610,7 +611,7 @@ void FScrollbar::drawButtons()
|
|||
{
|
||||
print (fc::NF_rev_up_arrow1);
|
||||
print (fc::NF_rev_up_arrow2);
|
||||
setPrintPos (1, length);
|
||||
setPrintPos (1, int(length));
|
||||
print (fc::NF_rev_down_arrow1);
|
||||
print (fc::NF_rev_down_arrow2);
|
||||
}
|
||||
|
@ -618,7 +619,7 @@ void FScrollbar::drawButtons()
|
|||
{
|
||||
print (fc::NF_rev_left_arrow1);
|
||||
print (fc::NF_rev_left_arrow2);
|
||||
setPrintPos (length - 1, 1);
|
||||
setPrintPos (int(length) - 1, 1);
|
||||
print (fc::NF_rev_right_arrow1);
|
||||
print (fc::NF_rev_right_arrow2);
|
||||
}
|
||||
|
@ -633,13 +634,13 @@ void FScrollbar::drawButtons()
|
|||
if ( bar_orientation == fc::vertical )
|
||||
{
|
||||
print (fc::BlackUpPointingTriangle); // ▲
|
||||
setPrintPos (1, length);
|
||||
setPrintPos (1, int(length));
|
||||
print (fc::BlackDownPointingTriangle); // ▼
|
||||
}
|
||||
else // horizontal
|
||||
{
|
||||
print (fc::BlackLeftPointingPointer); // ◄
|
||||
setPrintPos (length, 1);
|
||||
setPrintPos (int(length), 1);
|
||||
print (fc::BlackRightPointingPointer); // ►
|
||||
}
|
||||
|
||||
|
@ -672,11 +673,11 @@ FScrollbar::sType FScrollbar::getVerticalClickedScrollType (int y)
|
|||
{
|
||||
return FScrollbar::scrollPageBackward; // before slider
|
||||
}
|
||||
else if ( y > slider_pos + slider_length + 1 && y < getHeight() )
|
||||
else if ( y > slider_pos + int(slider_length) + 1 && y < int(getHeight()) )
|
||||
{
|
||||
return FScrollbar::scrollPageForward; // after slider
|
||||
}
|
||||
else if ( y == getHeight() )
|
||||
else if ( y == int(getHeight()) )
|
||||
{
|
||||
return FScrollbar::scrollStepForward; // increment button
|
||||
}
|
||||
|
@ -697,11 +698,11 @@ FScrollbar::sType FScrollbar::getHorizontalClickedScrollType (int x)
|
|||
{
|
||||
return FScrollbar::scrollPageBackward; // before slider
|
||||
}
|
||||
else if ( x > slider_pos + slider_length + 2 && x < getWidth() - 1 )
|
||||
else if ( x > slider_pos + int(slider_length) + 2 && x < int(getWidth()) - 1 )
|
||||
{
|
||||
return FScrollbar::scrollPageForward; // after slider
|
||||
}
|
||||
else if ( x == getWidth() - 1 || x == getWidth() )
|
||||
else if ( x == int(getWidth()) - 1 || x == int(getWidth()) )
|
||||
{
|
||||
return FScrollbar::scrollStepForward; // increment button
|
||||
}
|
||||
|
@ -718,11 +719,11 @@ FScrollbar::sType FScrollbar::getHorizontalClickedScrollType (int x)
|
|||
{
|
||||
return FScrollbar::scrollPageBackward; // before slider
|
||||
}
|
||||
else if ( x > slider_pos + slider_length + 1 && x < getWidth() )
|
||||
else if ( x > slider_pos + int(slider_length) + 1 && x < int(getWidth()) )
|
||||
{
|
||||
return FScrollbar::scrollPageForward; // after slider
|
||||
}
|
||||
else if ( x == getWidth() )
|
||||
else if ( x == int(getWidth()) )
|
||||
{
|
||||
return FScrollbar::scrollStepForward; // increment button
|
||||
}
|
||||
|
@ -739,7 +740,7 @@ int FScrollbar::getSliderClickPos (int mouse_x, int mouse_y)
|
|||
if ( bar_orientation == fc::vertical )
|
||||
{
|
||||
if ( mouse_y > slider_pos + 1
|
||||
&& mouse_y <= slider_pos + slider_length + 1 )
|
||||
&& mouse_y <= slider_pos + int(slider_length) + 1 )
|
||||
return mouse_y; // on slider
|
||||
}
|
||||
else // horizontal bar orientation
|
||||
|
@ -747,13 +748,13 @@ int FScrollbar::getSliderClickPos (int mouse_x, int mouse_y)
|
|||
if ( isNewFont() )
|
||||
{
|
||||
if ( mouse_x > slider_pos + 2
|
||||
&& mouse_x <= slider_pos + slider_length + 2 )
|
||||
&& mouse_x <= slider_pos + int(slider_length) + 2 )
|
||||
return mouse_x; // on slider
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mouse_x > slider_pos + 1
|
||||
&& mouse_x <= slider_pos + slider_length + 1 )
|
||||
&& mouse_x <= slider_pos + int(slider_length) + 1 )
|
||||
return mouse_x; // on slider
|
||||
}
|
||||
}
|
||||
|
@ -768,7 +769,7 @@ void FScrollbar::jumpToClickPos (int x, int y)
|
|||
|
||||
if ( bar_orientation == fc::vertical )
|
||||
{
|
||||
if ( y >1 && y < getHeight() )
|
||||
if ( y >1 && y < int(getHeight()) )
|
||||
{
|
||||
new_val = int( round ( double(max - min) * (y - 2.0 - (slider_length/2))
|
||||
/ double(bar_length - slider_length) ) );
|
||||
|
@ -780,7 +781,7 @@ void FScrollbar::jumpToClickPos (int x, int y)
|
|||
{
|
||||
int nf = isNewFont() ? 1 : 0;
|
||||
|
||||
if ( x > 1 + nf && x < getWidth() - nf )
|
||||
if ( x > 1 + nf && x < int(getWidth()) - nf )
|
||||
{
|
||||
new_val = int( round ( double(max - min) * (x - 2.0 - nf - (slider_length/2))
|
||||
/ double(bar_length - slider_length) ) );
|
||||
|
|
|
@ -62,7 +62,7 @@ FScrollView::~FScrollView() // destructor
|
|||
|
||||
// public methods of FScrollView
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setScrollWidth (int width)
|
||||
void FScrollView::setScrollWidth (std::size_t width)
|
||||
{
|
||||
if ( width < getViewportWidth() )
|
||||
width = getViewportWidth();
|
||||
|
@ -83,14 +83,14 @@ void FScrollView::setScrollWidth (int width)
|
|||
child_print_area = viewport;
|
||||
}
|
||||
|
||||
hbar->setMaximum (width - getViewportWidth());
|
||||
hbar->setPageSize (width, getViewportWidth());
|
||||
hbar->setMaximum (int(width - getViewportWidth()));
|
||||
hbar->setPageSize (int(width), int(getViewportWidth()));
|
||||
hbar->calculateSliderValues();
|
||||
setHorizontalScrollBarVisibility();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setScrollHeight (int height)
|
||||
void FScrollView::setScrollHeight (std::size_t height)
|
||||
{
|
||||
if ( height < getViewportHeight() )
|
||||
height = getViewportHeight();
|
||||
|
@ -110,14 +110,14 @@ void FScrollView::setScrollHeight (int height)
|
|||
child_print_area = viewport;
|
||||
}
|
||||
|
||||
vbar->setMaximum (height - getViewportHeight());
|
||||
vbar->setPageSize (height, getViewportHeight());
|
||||
vbar->setMaximum (int(height - getViewportHeight()));
|
||||
vbar->setPageSize (int(height), int(getViewportHeight()));
|
||||
vbar->calculateSliderValues();
|
||||
setVerticalScrollBarVisibility();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setScrollSize (int width, int height)
|
||||
void FScrollView::setScrollSize (std::size_t width, std::size_t height)
|
||||
{
|
||||
int xoffset_end
|
||||
, yoffset_end;
|
||||
|
@ -143,20 +143,20 @@ void FScrollView::setScrollSize (int width, int height)
|
|||
child_print_area = viewport;
|
||||
}
|
||||
|
||||
xoffset_end = getScrollWidth() - getViewportWidth();
|
||||
yoffset_end = getScrollHeight() - getViewportHeight();
|
||||
xoffset_end = int(getScrollWidth() - getViewportWidth());
|
||||
yoffset_end = int(getScrollHeight() - getViewportHeight());
|
||||
setTopPadding (1 - getScrollY());
|
||||
setLeftPadding (1 - getScrollX());
|
||||
setBottomPadding (1 - (yoffset_end - getScrollY()));
|
||||
setRightPadding (1 - (xoffset_end - getScrollX()) + nf_offset);
|
||||
|
||||
hbar->setMaximum (width - getViewportWidth());
|
||||
hbar->setPageSize (width, getViewportWidth());
|
||||
hbar->setMaximum (int(width - getViewportWidth()));
|
||||
hbar->setPageSize (int(width), int(getViewportWidth()));
|
||||
hbar->calculateSliderValues();
|
||||
setHorizontalScrollBarVisibility();
|
||||
|
||||
vbar->setMaximum (height - getViewportHeight());
|
||||
vbar->setPageSize (height, getViewportHeight());
|
||||
vbar->setMaximum (int(height - getViewportHeight()));
|
||||
vbar->setPageSize (int(height), int(getViewportHeight()));
|
||||
vbar->calculateSliderValues();
|
||||
setVerticalScrollBarVisibility();
|
||||
}
|
||||
|
@ -213,10 +213,10 @@ void FScrollView::setPos (int x, int y, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setWidth (int w, bool adjust)
|
||||
void FScrollView::setWidth (std::size_t w, bool adjust)
|
||||
{
|
||||
FWidget::setWidth (w, adjust);
|
||||
viewport_geometry.setWidth(w - vertical_border_spacing - nf_offset);
|
||||
viewport_geometry.setWidth(w - vertical_border_spacing - std::size_t(nf_offset));
|
||||
calculateScrollbarPos();
|
||||
|
||||
if ( getScrollWidth() < getViewportWidth() )
|
||||
|
@ -224,7 +224,7 @@ void FScrollView::setWidth (int w, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setHeight (int h, bool adjust)
|
||||
void FScrollView::setHeight (std::size_t h, bool adjust)
|
||||
{
|
||||
FWidget::setHeight (h, adjust);
|
||||
viewport_geometry.setHeight(h - horizontal_border_spacing);
|
||||
|
@ -235,10 +235,10 @@ void FScrollView::setHeight (int h, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setSize (int w, int 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 - nf_offset
|
||||
viewport_geometry.setSize ( w - vertical_border_spacing - std::size_t(nf_offset)
|
||||
, h - horizontal_border_spacing );
|
||||
calculateScrollbarPos();
|
||||
|
||||
|
@ -248,14 +248,14 @@ void FScrollView::setSize (int w, int h, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FScrollView::setGeometry (int x, int y, int w, int 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 - nf_offset
|
||||
viewport_geometry.setSize ( w - vertical_border_spacing - std::size_t(nf_offset)
|
||||
, h - horizontal_border_spacing );
|
||||
calculateScrollbarPos();
|
||||
|
||||
|
@ -337,8 +337,8 @@ void FScrollView::scrollTo (int x, int y)
|
|||
short yoffset_before = yoffset;
|
||||
short xoffset_end = short(getScrollWidth() - getViewportWidth());
|
||||
short yoffset_end = short(getScrollHeight() - getViewportHeight());
|
||||
int save_width = viewport_geometry.getWidth();
|
||||
int save_height = viewport_geometry.getHeight();
|
||||
std::size_t save_width = viewport_geometry.getWidth();
|
||||
std::size_t save_height = viewport_geometry.getHeight();
|
||||
bool changeX = false;
|
||||
bool changeY = false;
|
||||
x--;
|
||||
|
@ -421,7 +421,7 @@ void FScrollView::draw()
|
|||
if ( border )
|
||||
{
|
||||
if ( isNewFont() )
|
||||
drawBorder (1, 1, getWidth() - 1, getHeight());
|
||||
drawBorder (1, 1, int(getWidth()) - 1, int(getHeight()));
|
||||
else
|
||||
drawBorder();
|
||||
}
|
||||
|
@ -463,12 +463,12 @@ void FScrollView::onKeyPress (FKeyEvent* ev)
|
|||
break;
|
||||
|
||||
case fc::Fkey_ppage:
|
||||
scrollBy (0, -getViewportHeight());
|
||||
scrollBy (0, int(-getViewportHeight()));
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_npage:
|
||||
scrollBy (0, getViewportHeight());
|
||||
scrollBy (0, int(getViewportHeight()));
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
|
@ -558,12 +558,12 @@ void FScrollView::onChildFocusIn (FFocusEvent*)
|
|||
, wy = widget_geometry.getY();
|
||||
|
||||
if ( wx > vx )
|
||||
x = widget_geometry.getX2() - vp_geometry.getWidth() + 1;
|
||||
x = widget_geometry.getX2() - int(vp_geometry.getWidth()) + 1;
|
||||
else
|
||||
x = wx;
|
||||
|
||||
if ( wy > vy )
|
||||
y = widget_geometry.getY2() - vp_geometry.getHeight() + 1;
|
||||
y = widget_geometry.getY2() - int(vp_geometry.getHeight()) + 1;
|
||||
else
|
||||
y = wy;
|
||||
|
||||
|
@ -622,10 +622,10 @@ FVTerm::term_area* FScrollView::getPrintArea()
|
|||
void FScrollView::adjustSize()
|
||||
{
|
||||
FWidget::adjustSize();
|
||||
int width = getWidth()
|
||||
, height = getHeight()
|
||||
, xoffset = viewport_geometry.getX()
|
||||
, yoffset = viewport_geometry.getY();
|
||||
std::size_t width = getWidth();
|
||||
std::size_t height = getHeight();
|
||||
int xoffset = viewport_geometry.getX();
|
||||
int yoffset = viewport_geometry.getY();
|
||||
|
||||
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
||||
, getTermY() + getTopPadding() - 1 );
|
||||
|
@ -636,17 +636,17 @@ void FScrollView::adjustSize()
|
|||
viewport->offset_top = scroll_geometry.getY();
|
||||
}
|
||||
|
||||
hbar->setMaximum (getScrollWidth() - getViewportWidth());
|
||||
hbar->setPageSize (getScrollWidth(), getViewportWidth());
|
||||
hbar->setY (height);
|
||||
hbar->setMaximum (int(getScrollWidth() - getViewportWidth()));
|
||||
hbar->setPageSize (int(getScrollWidth()), int(getViewportWidth()));
|
||||
hbar->setY (int(height));
|
||||
hbar->setWidth (width - 2, false);
|
||||
hbar->setValue (xoffset);
|
||||
hbar->resize();
|
||||
setHorizontalScrollBarVisibility();
|
||||
|
||||
vbar->setMaximum (getScrollHeight() - getViewportHeight());
|
||||
vbar->setPageSize (getScrollHeight(), getViewportHeight());
|
||||
vbar->setX (width);
|
||||
vbar->setMaximum (int(getScrollHeight() - getViewportHeight()));
|
||||
vbar->setPageSize (int(getScrollHeight()), int(getViewportHeight()));
|
||||
vbar->setX (int(width));
|
||||
vbar->setHeight (height - 2, false);
|
||||
vbar->setValue (yoffset);
|
||||
vbar->resize();
|
||||
|
@ -671,8 +671,8 @@ void FScrollView::copy2area()
|
|||
, ay = getTermY() - print_area->offset_top
|
||||
, dx = viewport_geometry.getX()
|
||||
, dy = viewport_geometry.getY()
|
||||
, y_end = getViewportHeight()
|
||||
, x_end = getViewportWidth();
|
||||
, y_end = int(getViewportHeight())
|
||||
, x_end = int(getViewportWidth());
|
||||
|
||||
// viewport width does not fit into the print_area
|
||||
if ( print_area->width <= ax + x_end )
|
||||
|
@ -737,8 +737,10 @@ void FScrollView::init (FWidget* parent)
|
|||
setForegroundColor (wc.dialog_fg);
|
||||
setBackgroundColor (wc.dialog_bg);
|
||||
init_scrollbar();
|
||||
xoffset_end = getScrollWidth() - getViewportWidth();
|
||||
yoffset_end = getScrollHeight() - getViewportHeight();
|
||||
setGeometry (1, 1, 4, 4);
|
||||
setMinimumSize (4, 4);
|
||||
xoffset_end = int(getScrollWidth() - getViewportWidth());
|
||||
yoffset_end = int(getScrollHeight() - getViewportHeight());
|
||||
nf_offset = isNewFont() ? 1 : 0;
|
||||
setTopPadding (1 - getScrollY());
|
||||
setLeftPadding (1 - getScrollX());
|
||||
|
@ -746,8 +748,8 @@ void FScrollView::init (FWidget* parent)
|
|||
setRightPadding (1 - (xoffset_end - getScrollX()) + nf_offset);
|
||||
|
||||
FPoint no_shadow(0,0);
|
||||
int w = getViewportWidth();
|
||||
int h = getViewportHeight();
|
||||
std::size_t w = getViewportWidth();
|
||||
std::size_t h = getViewportHeight();
|
||||
|
||||
if ( w < 1 )
|
||||
w = 1;
|
||||
|
@ -803,18 +805,18 @@ void FScrollView::init_scrollbar()
|
|||
//----------------------------------------------------------------------
|
||||
void FScrollView::calculateScrollbarPos()
|
||||
{
|
||||
int width = getWidth();
|
||||
int height = getHeight();
|
||||
std::size_t width = getWidth();
|
||||
std::size_t height = getHeight();
|
||||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
vbar->setGeometry (width, 2, 2, height - 2);
|
||||
hbar->setGeometry (1, height, width - 2, 1);
|
||||
vbar->setGeometry (int(width), 2, 2, height - 2);
|
||||
hbar->setGeometry (1, int(height), width - 2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
vbar->setGeometry (width, 2, 1, height - 2);
|
||||
hbar->setGeometry (2, height, width - 2, 1);
|
||||
vbar->setGeometry (int(width), 2, 1, height - 2);
|
||||
hbar->setGeometry (2, int(height), width - 2, 1);
|
||||
}
|
||||
|
||||
vbar->resize();
|
||||
|
|
|
@ -205,12 +205,9 @@ void FStatusBar::hide()
|
|||
setColor (fg, bg);
|
||||
screenWidth = getDesktopWidth();
|
||||
|
||||
if ( screenWidth < 0 )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
blank = new char[std::size_t(screenWidth) + 1];
|
||||
blank = new char[screenWidth + 1];
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -218,7 +215,7 @@ void FStatusBar::hide()
|
|||
return;
|
||||
}
|
||||
|
||||
std::memset(blank, ' ', std::size_t(screenWidth));
|
||||
std::memset(blank, ' ', screenWidth);
|
||||
blank[screenWidth] = '\0';
|
||||
setPrintPos (1, 1);
|
||||
print (blank);
|
||||
|
@ -228,7 +225,8 @@ void FStatusBar::hide()
|
|||
//----------------------------------------------------------------------
|
||||
void FStatusBar::drawMessage()
|
||||
{
|
||||
int termWidth, space_offset;
|
||||
std::size_t termWidth;
|
||||
int space_offset;
|
||||
bool isLastActiveFocus, hasKeys;
|
||||
|
||||
if ( ! (isVisible() ) )
|
||||
|
@ -260,7 +258,7 @@ void FStatusBar::drawMessage()
|
|||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
||||
if ( x + space_offset + 3 < termWidth )
|
||||
if ( x + space_offset + 3 < int(termWidth) )
|
||||
{
|
||||
if ( text )
|
||||
{
|
||||
|
@ -277,21 +275,21 @@ void FStatusBar::drawMessage()
|
|||
print (' ');
|
||||
}
|
||||
|
||||
int msg_length = int(getMessage().getLength());
|
||||
x += msg_length;
|
||||
std::size_t msg_length = getMessage().getLength();
|
||||
x += int(msg_length);
|
||||
|
||||
if ( x - 1 <= termWidth )
|
||||
if ( x - 1 <= int(termWidth) )
|
||||
print (getMessage());
|
||||
else
|
||||
{
|
||||
// Print ellipsis
|
||||
print ( getMessage().left(uInt(msg_length + termWidth - x - 1)) );
|
||||
print ( getMessage().left(msg_length + termWidth - uInt(x) - 1) );
|
||||
print ("..");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = x; i <= termWidth; i++)
|
||||
for (int i = x; i <= int(termWidth); i++)
|
||||
print (' ');
|
||||
|
||||
if ( isMonochron() )
|
||||
|
@ -355,7 +353,7 @@ void FStatusBar::clear()
|
|||
//----------------------------------------------------------------------
|
||||
void FStatusBar::adjustSize()
|
||||
{
|
||||
setGeometry (1, getDesktopHeight(), getDesktopWidth(), 1, false);
|
||||
setGeometry (1, int(getDesktopHeight()), getDesktopWidth(), 1, false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -554,8 +552,8 @@ void FStatusBar::cb_statuskey_activated (FWidget* widget, data_ptr)
|
|||
void FStatusBar::init()
|
||||
{
|
||||
FWidget* r = getRootWidget();
|
||||
int w = r->getWidth();
|
||||
int h = r->getHeight();
|
||||
std::size_t w = r->getWidth();
|
||||
int h = int(r->getHeight());
|
||||
// initialize geometry values
|
||||
setGeometry (1, h, w, 1, false);
|
||||
setAlwaysOnTop();
|
||||
|
@ -604,7 +602,7 @@ void FStatusBar::drawKeys()
|
|||
{
|
||||
keyname_len = int(getKeyName((*iter)->getKey()).getLength());
|
||||
|
||||
if ( x + keyname_len + 2 < screenWidth )
|
||||
if ( x + keyname_len + 2 < int(screenWidth) )
|
||||
{
|
||||
if ( (*iter)->isActivated() || (*iter)->hasMouseFocus() )
|
||||
drawActiveKey (iter);
|
||||
|
@ -615,7 +613,7 @@ void FStatusBar::drawKeys()
|
|||
{
|
||||
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
||||
|
||||
for (; x <= screenWidth; x++)
|
||||
for (; x <= int(screenWidth); x++)
|
||||
print (' ');
|
||||
}
|
||||
|
||||
|
@ -633,7 +631,7 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
|||
{
|
||||
// Draw not active key
|
||||
|
||||
int txt_length;
|
||||
std::size_t txt_length;
|
||||
FStatusKey* item = *iter;
|
||||
|
||||
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
|
||||
|
@ -644,23 +642,23 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
|||
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
||||
x++;
|
||||
print ('-');
|
||||
txt_length = int(item->getText().getLength());
|
||||
x += txt_length;
|
||||
txt_length = item->getText().getLength();
|
||||
x += int(txt_length);
|
||||
|
||||
if ( x - 1 <= screenWidth )
|
||||
if ( x - 1 <= int(screenWidth) )
|
||||
print (item->getText());
|
||||
else
|
||||
{
|
||||
// Print ellipsis
|
||||
print ( item->getText()
|
||||
.left(uInt(txt_length + screenWidth - x - 1)) );
|
||||
.left(txt_length + screenWidth - std::size_t(x) - 1) );
|
||||
print ("..");
|
||||
}
|
||||
|
||||
if ( iter + 1 != key_list.end()
|
||||
&& ( (*(iter + 1))->isActivated() || (*(iter + 1))->hasMouseFocus() )
|
||||
&& x + int(getKeyName((*(iter + 1))->getKey()).getLength()) + 3
|
||||
< screenWidth )
|
||||
< int(screenWidth) )
|
||||
{
|
||||
// Next element is active
|
||||
if ( isMonochron() )
|
||||
|
@ -679,7 +677,7 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
|||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
}
|
||||
else if ( iter + 1 != key_list.end() && x < screenWidth )
|
||||
else if ( iter + 1 != key_list.end() && x < int(screenWidth) )
|
||||
{
|
||||
// Not the last element
|
||||
setColor (wc.statusbar_separator_fg, wc.statusbar_bg);
|
||||
|
@ -693,7 +691,7 @@ void FStatusBar::drawActiveKey (keyList::const_iterator iter)
|
|||
{
|
||||
// Draw active key
|
||||
|
||||
int txt_length;
|
||||
std::size_t txt_length;
|
||||
FStatusKey* item = *iter;
|
||||
|
||||
if ( isMonochron() )
|
||||
|
@ -708,10 +706,10 @@ void FStatusBar::drawActiveKey (keyList::const_iterator iter)
|
|||
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
|
||||
x++;
|
||||
print ('-');
|
||||
txt_length = int(item->getText().getLength());
|
||||
x += txt_length;
|
||||
txt_length = item->getText().getLength();
|
||||
x += int(txt_length);
|
||||
|
||||
if ( x <= screenWidth )
|
||||
if ( x <= int(screenWidth) )
|
||||
{
|
||||
print (item->getText());
|
||||
x++;
|
||||
|
@ -721,7 +719,7 @@ void FStatusBar::drawActiveKey (keyList::const_iterator iter)
|
|||
{
|
||||
// Print ellipsis
|
||||
print ( item->getText()
|
||||
.left(uInt(txt_length + screenWidth - x - 1)) );
|
||||
.left(txt_length + screenWidth - std::size_t(x) - 1) );
|
||||
print ("..");
|
||||
}
|
||||
|
||||
|
|
139
src/fstring.cpp
139
src/fstring.cpp
|
@ -53,13 +53,13 @@ FString::FString (int len)
|
|||
, c_string(0)
|
||||
{
|
||||
if ( len > 0 )
|
||||
initLength(uInt(len));
|
||||
initLength(std::size_t(len));
|
||||
else
|
||||
initLength(0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString::FString (uInt len)
|
||||
FString::FString (std::size_t len)
|
||||
: string(0)
|
||||
, length(0)
|
||||
, bufsize(0)
|
||||
|
@ -69,20 +69,7 @@ FString::FString (uInt len)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString::FString (int len, wchar_t c)
|
||||
: string(0)
|
||||
, length(0)
|
||||
, bufsize(0)
|
||||
, c_string(0)
|
||||
{
|
||||
if ( len > 0 )
|
||||
_assign ( FString(uInt(len), c).string );
|
||||
else
|
||||
initLength(0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString::FString (uInt len, wchar_t c)
|
||||
FString::FString (std::size_t len, wchar_t c)
|
||||
: string(0)
|
||||
, length(0)
|
||||
, bufsize(0)
|
||||
|
@ -100,25 +87,7 @@ FString::FString (uInt len, wchar_t c)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString::FString (int len, char c)
|
||||
: string(0)
|
||||
, length(0)
|
||||
, bufsize(0)
|
||||
, c_string(0)
|
||||
{
|
||||
string = 0;
|
||||
length = 0;
|
||||
bufsize = 0;
|
||||
c_string = 0;
|
||||
|
||||
if ( len > 0 )
|
||||
_assign ( FString(uInt(len), c).string );
|
||||
else
|
||||
initLength(0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString::FString (uInt len, char c)
|
||||
FString::FString (std::size_t len, char c)
|
||||
: string(0)
|
||||
, length(0)
|
||||
, bufsize(0)
|
||||
|
@ -475,17 +444,7 @@ const FString& FString::operator >> (float& num)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
wchar_t& FString::operator [] (int pos)
|
||||
{
|
||||
if ( pos < 0 )
|
||||
throw std::out_of_range(""); // Invalid index position
|
||||
|
||||
FString& s = *this;
|
||||
return s[uInt(pos)];
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
wchar_t& FString::operator [] (uInt pos)
|
||||
wchar_t& FString::operator [] (std::size_t pos)
|
||||
{
|
||||
if ( pos >= length )
|
||||
throw std::out_of_range(""); // Invalid index position
|
||||
|
@ -502,9 +461,9 @@ const FString& FString::operator () ()
|
|||
|
||||
// public methods of FString
|
||||
//----------------------------------------------------------------------
|
||||
uInt FString::getUTF8length() const
|
||||
std::size_t FString::getUTF8length() const
|
||||
{
|
||||
uInt len;
|
||||
std::size_t len;
|
||||
const char* s;
|
||||
|
||||
if ( ! string )
|
||||
|
@ -514,7 +473,7 @@ uInt FString::getUTF8length() const
|
|||
s = c_str();
|
||||
|
||||
while ( *s )
|
||||
len += uInt((*s++ & 0xc0) != 0x80);
|
||||
len += std::size_t((*s++ & 0xc0) != 0x80);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
@ -902,16 +861,7 @@ FString FString::trim() const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString FString::left (int len) const
|
||||
{
|
||||
if ( len > 0 )
|
||||
return left (uInt(len));
|
||||
else
|
||||
return left (uInt(0));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString FString::left (uInt len) const
|
||||
FString FString::left (std::size_t len) const
|
||||
{
|
||||
wchar_t* p;
|
||||
FString s(string);
|
||||
|
@ -930,16 +880,7 @@ FString FString::left (uInt len) const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString FString::right (int len) const
|
||||
{
|
||||
if ( len > 0 )
|
||||
return right (uInt(len));
|
||||
else
|
||||
return right (uInt(0));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString FString::right (uInt len) const
|
||||
FString FString::right (std::size_t len) const
|
||||
{
|
||||
wchar_t* p;
|
||||
FString s(string);
|
||||
|
@ -957,21 +898,7 @@ FString FString::right (uInt len) const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString FString::mid (int pos, int len) const
|
||||
{
|
||||
if ( pos > 0 )
|
||||
{
|
||||
if ( len > 0 )
|
||||
return mid (uInt(pos), uInt(len));
|
||||
else
|
||||
return mid (uInt(pos), uInt(0));
|
||||
}
|
||||
else
|
||||
return mid (uInt(0), uInt(0));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FString FString::mid (uInt pos, uInt len) const
|
||||
FString FString::mid (std::size_t pos, std::size_t len) const
|
||||
{
|
||||
wchar_t* p;
|
||||
wchar_t* first;
|
||||
|
@ -1282,7 +1209,7 @@ const FString& FString::insert (const FString& s, int pos)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
const FString& FString::insert (const FString& s, uInt pos)
|
||||
const FString& FString::insert (const FString& s, std::size_t pos)
|
||||
{
|
||||
if ( pos > length )
|
||||
throw std::out_of_range("");
|
||||
|
@ -1295,7 +1222,7 @@ const FString& FString::insert (const FString& s, uInt pos)
|
|||
FString FString::replace (const FString& from, const FString& to)
|
||||
{
|
||||
wchar_t* p;
|
||||
uInt from_length, to_length, pos;
|
||||
std::size_t from_length, to_length, pos;
|
||||
FString s(string);
|
||||
|
||||
// handle NULL and empty string
|
||||
|
@ -1380,10 +1307,11 @@ FString FString::expandTabs (int tabstop) const
|
|||
tab_split = instr.split("\t");
|
||||
last = tab_split.size();
|
||||
|
||||
for (uInt i = 0; i < last; i++)
|
||||
for (std::size_t i = 0; i < last; i++)
|
||||
{
|
||||
uInt len = tab_split[i].getLength();
|
||||
uInt tab_len = uInt(tabstop);
|
||||
std::size_t len = tab_split[i].getLength();
|
||||
std::size_t tab_len = std::size_t(tabstop);
|
||||
|
||||
if ( i == last - 1 )
|
||||
outstr += tab_split[i];
|
||||
else
|
||||
|
@ -1471,11 +1399,11 @@ const FString& FString::overwrite (const FString& s, int pos)
|
|||
if ( pos < 0 )
|
||||
return overwrite (s, 0);
|
||||
|
||||
return overwrite (s, uInt(pos));
|
||||
return overwrite (s, std::size_t(pos));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
const FString& FString::overwrite (const FString& s, uInt pos)
|
||||
const FString& FString::overwrite (const FString& s, std::size_t pos)
|
||||
{
|
||||
if ( pos > length )
|
||||
pos = length;
|
||||
|
@ -1494,16 +1422,7 @@ const FString& FString::overwrite (const FString& s, uInt pos)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
const FString& FString::remove (int pos, uInt len)
|
||||
{
|
||||
if ( pos < 0 || len < 1 )
|
||||
return *this;
|
||||
|
||||
return remove (uInt(pos), len);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
const FString& FString::remove (uInt pos, uInt len)
|
||||
const FString& FString::remove (std::size_t pos, std::size_t len)
|
||||
{
|
||||
if ( pos > length )
|
||||
return *this;
|
||||
|
@ -1531,7 +1450,7 @@ bool FString::includes (const FString& s) const
|
|||
|
||||
// private methods of FString
|
||||
//----------------------------------------------------------------------
|
||||
inline void FString::initLength (uInt len)
|
||||
inline void FString::initLength (std::size_t len)
|
||||
{
|
||||
if ( len == 0 )
|
||||
return;
|
||||
|
@ -1588,7 +1507,7 @@ inline void FString::_assign (const wchar_t s[])
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FString::_insert (uInt len, const wchar_t s[])
|
||||
inline void FString::_insert (std::size_t len, const wchar_t s[])
|
||||
{
|
||||
if ( len == 0 ) // String s is a null or a empty string
|
||||
return;
|
||||
|
@ -1614,7 +1533,9 @@ inline void FString::_insert (uInt len, const wchar_t s[])
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FString::_insert (uInt pos, uInt len, const wchar_t s[])
|
||||
inline void FString::_insert ( std::size_t pos
|
||||
, std::size_t len
|
||||
, const wchar_t s[] )
|
||||
{
|
||||
if ( len == 0 ) // String s is a null or a empty string
|
||||
return;
|
||||
|
@ -1625,7 +1546,7 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t s[])
|
|||
}
|
||||
else
|
||||
{
|
||||
uInt x;
|
||||
std::size_t x;
|
||||
|
||||
if ( (length + len + 1) <= bufsize )
|
||||
{
|
||||
|
@ -1654,7 +1575,7 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t s[])
|
|||
return;
|
||||
}
|
||||
|
||||
uInt y = 0;
|
||||
std::size_t y = 0;
|
||||
|
||||
for (x = 0; x < pos; x++) // left side
|
||||
sptr[y++] = string[x];
|
||||
|
@ -1673,12 +1594,12 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t s[])
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FString::_remove (uInt pos, uInt len)
|
||||
inline void FString::_remove (std::size_t pos, std::size_t len)
|
||||
{
|
||||
if ( (bufsize - length - 1 + len) <= FWDBUFFER )
|
||||
{
|
||||
// shifting left side to pos
|
||||
for (uInt i = pos; i + len < length + 1; i++)
|
||||
for (std::size_t i = pos; i + len < length + 1; i++)
|
||||
string[i] = string[i + len];
|
||||
|
||||
length -= len;
|
||||
|
@ -1698,7 +1619,7 @@ inline void FString::_remove (uInt pos, uInt len)
|
|||
return;
|
||||
}
|
||||
|
||||
uInt x, y = 0;
|
||||
std::size_t x, y = 0;
|
||||
|
||||
for (x = 0; x < pos; x++) // left side
|
||||
sptr[y++] = string[x];
|
||||
|
|
|
@ -82,7 +82,7 @@ FTerm::~FTerm() // destructor
|
|||
|
||||
// public methods of FTerm
|
||||
//----------------------------------------------------------------------
|
||||
int FTerm::getLineNumber()
|
||||
std::size_t FTerm::getLineNumber()
|
||||
{
|
||||
FRect& term_geometry = data->getTermGeometry();
|
||||
|
||||
|
@ -93,7 +93,7 @@ int FTerm::getLineNumber()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FTerm::getColumnNumber()
|
||||
std::size_t FTerm::getColumnNumber()
|
||||
{
|
||||
FRect& term_geometry = data->getTermGeometry();
|
||||
|
||||
|
@ -474,10 +474,10 @@ void FTerm::detectTermSize()
|
|||
term_geometry.setPos(1,1);
|
||||
// Use COLUMNS or fallback to the xterm default width of 80 characters
|
||||
str = std::getenv("COLUMNS");
|
||||
term_geometry.setWidth(str ? std::atoi(str) : 80);
|
||||
term_geometry.setWidth(str ? std::size_t(std::atoi(str)) : 80);
|
||||
// Use LINES or fallback to the xterm default height of 24 characters
|
||||
str = std::getenv("LINES");
|
||||
term_geometry.setHeight(str ? std::atoi(str) : 24);
|
||||
term_geometry.setHeight(str ? std::size_t(std::atoi(str)) : 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -492,7 +492,7 @@ void FTerm::detectTermSize()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTerm::setTermSize (int width, int height)
|
||||
void FTerm::setTermSize (std::size_t width, std::size_t height)
|
||||
{
|
||||
// Set xterm size to {width} x {height}
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ namespace finalcut
|
|||
bool FTermXTerminal::mouse_support;
|
||||
bool FTermXTerminal::meta_sends_esc;
|
||||
bool FTermXTerminal::xterm_default_colors;
|
||||
int FTermXTerminal::term_width = 80;
|
||||
int FTermXTerminal::term_height = 24;
|
||||
std::size_t FTermXTerminal::term_width = 80;
|
||||
std::size_t FTermXTerminal::term_height = 24;
|
||||
const FString* FTermXTerminal::xterm_font = 0;
|
||||
const FString* FTermXTerminal::xterm_title = 0;
|
||||
const FString* FTermXTerminal::foreground_color = 0;
|
||||
|
@ -126,7 +126,7 @@ void FTermXTerminal::setTitle (const FString& title)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTermXTerminal::setTermSize (int width, int height)
|
||||
void FTermXTerminal::setTermSize (std::size_t width, std::size_t height)
|
||||
{
|
||||
// Set xterm size to {term_width} x {term_height}
|
||||
|
||||
|
@ -417,7 +417,7 @@ void FTermXTerminal::setXTermSize()
|
|||
{
|
||||
if ( term_detection->isXTerminal() )
|
||||
{
|
||||
FTerm::putstringf (CSI "8;%d;%dt", term_height, term_width);
|
||||
FTerm::putstringf (CSI "8;%lu;%lut", term_height, term_width);
|
||||
std::fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ FTextView::~FTextView() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
const FString FTextView::getText() const
|
||||
{
|
||||
uInt len, rows, idx;
|
||||
std::size_t len, rows, idx;
|
||||
|
||||
if ( data.empty() )
|
||||
return FString("");
|
||||
|
@ -67,13 +67,13 @@ const FString FTextView::getText() const
|
|||
len = 0;
|
||||
rows = getRows();
|
||||
|
||||
for (uInt i = 0 ; i < rows; i++)
|
||||
for (std::size_t i = 0 ; i < rows; i++)
|
||||
len += data[i].getLength() + 1;
|
||||
|
||||
FString s(len + 1);
|
||||
idx = 0;
|
||||
|
||||
for (uInt i = 0 ; i < rows; i++)
|
||||
for (std::size_t i = 0 ; i < rows; i++)
|
||||
{
|
||||
const wchar_t* p = data[i].wc_str();
|
||||
|
||||
|
@ -93,23 +93,23 @@ const FString FTextView::getText() const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FTextView::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||
void FTextView::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
|
||||
{
|
||||
// Set the text view geometry
|
||||
|
||||
FWidget::setGeometry(x, y, w, h, adjust);
|
||||
int width = getWidth();
|
||||
int height = getHeight();
|
||||
std::size_t width = getWidth();
|
||||
std::size_t height = getHeight();
|
||||
|
||||
if ( isNewFont() )
|
||||
{
|
||||
vbar->setGeometry (width, 1, 2, height - 1);
|
||||
hbar->setGeometry (1, height, width - 2, 1);
|
||||
vbar->setGeometry (int(width), 1, 2, height - 1);
|
||||
hbar->setGeometry (1, int(height), width - 2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
vbar->setGeometry (width, 2, 1, height - 2);
|
||||
hbar->setGeometry (2, height, width - 2, 1);
|
||||
vbar->setGeometry (int(width), 2, 1, height - 2);
|
||||
hbar->setGeometry (2, int(height), width - 2, 1);
|
||||
}
|
||||
|
||||
vbar->resize();
|
||||
|
@ -152,7 +152,7 @@ void FTextView::scrollTo (int x, int y)
|
|||
|
||||
if ( xoffset != x )
|
||||
{
|
||||
int xoffset_end = int(maxLineWidth) - getTextWidth();
|
||||
int xoffset_end = int(maxLineWidth - getTextWidth());
|
||||
xoffset = x;
|
||||
|
||||
if ( xoffset < 0 )
|
||||
|
@ -170,7 +170,7 @@ void FTextView::scrollTo (int x, int y)
|
|||
|
||||
if ( yoffset != y )
|
||||
{
|
||||
int yoffset_end = int(getRows()) - getTextHeight();
|
||||
int yoffset_end = int(getRows() - getTextHeight());
|
||||
yoffset = y;
|
||||
|
||||
if ( yoffset < 0 )
|
||||
|
@ -193,7 +193,7 @@ void FTextView::scrollTo (int x, int y)
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::hide()
|
||||
{
|
||||
int n, size;
|
||||
std::size_t n, size;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
@ -215,12 +215,12 @@ void FTextView::hide()
|
|||
n = isNewFont() ? 1 : 0;
|
||||
size = getWidth() + n;
|
||||
|
||||
if ( size < 0 )
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
blank = new char[std::size_t(size) + 1];
|
||||
blank = new char[size + 1];
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -228,10 +228,10 @@ void FTextView::hide()
|
|||
return;
|
||||
}
|
||||
|
||||
std::memset(blank, ' ', std::size_t(size));
|
||||
std::memset(blank, ' ', size);
|
||||
blank[size] = '\0';
|
||||
|
||||
for (int y = 0; y < getHeight(); y++)
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (1, 1 + y);
|
||||
print (blank);
|
||||
|
@ -267,9 +267,9 @@ void FTextView::insert (const FString& str, int pos)
|
|||
text_split = s.split("\r\n");
|
||||
num = text_split.size();
|
||||
|
||||
for (uInt i = 0; i < num; i++)
|
||||
for (std::size_t i = 0; i < num; i++)
|
||||
{
|
||||
uInt len;
|
||||
std::size_t len;
|
||||
text_split[i] = text_split[i].removeBackspaces()
|
||||
.removeDel()
|
||||
.replaceControlCodes()
|
||||
|
@ -280,10 +280,10 @@ void FTextView::insert (const FString& str, int pos)
|
|||
{
|
||||
maxLineWidth = len;
|
||||
|
||||
if ( len > uInt(getTextWidth()) )
|
||||
if ( len > getTextWidth() )
|
||||
{
|
||||
hbar->setMaximum (int(maxLineWidth) - getTextWidth());
|
||||
hbar->setPageSize (int(maxLineWidth), getTextWidth());
|
||||
hbar->setMaximum (int(maxLineWidth) - int(getTextWidth()));
|
||||
hbar->setPageSize (int(maxLineWidth), int(getTextWidth()));
|
||||
hbar->calculateSliderValues();
|
||||
|
||||
if ( ! hbar->isVisible() )
|
||||
|
@ -293,14 +293,14 @@ void FTextView::insert (const FString& str, int pos)
|
|||
}
|
||||
|
||||
data.insert (iter + pos, text_split.begin(), text_split.end());
|
||||
vbar->setMaximum (int(getRows()) - getTextHeight());
|
||||
vbar->setPageSize (int(getRows()), getTextHeight());
|
||||
vbar->setMaximum (int(getRows()) - int(getTextHeight()));
|
||||
vbar->setPageSize (int(getRows()), int(getTextHeight()));
|
||||
vbar->calculateSliderValues();
|
||||
|
||||
if ( ! vbar->isVisible() && int(getRows()) > getTextHeight() )
|
||||
if ( ! vbar->isVisible() && int(getRows()) > int(getTextHeight()) )
|
||||
vbar->setVisible();
|
||||
|
||||
if ( vbar->isVisible() && int(getRows()) <= getTextHeight() )
|
||||
if ( vbar->isVisible() && int(getRows()) <= int(getTextHeight()) )
|
||||
vbar->hide();
|
||||
|
||||
processChanged();
|
||||
|
@ -330,7 +330,7 @@ void FTextView::replaceRange (const FString& str, int from, int to)
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::clear()
|
||||
{
|
||||
int size;
|
||||
std::size_t size;
|
||||
char* blank;
|
||||
|
||||
data.clear();
|
||||
|
@ -350,12 +350,12 @@ void FTextView::clear()
|
|||
setColor();
|
||||
size = getWidth() - 2;
|
||||
|
||||
if ( size < 0 )
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
blank = new char[std::size_t(size) + 1];
|
||||
blank = new char[size + 1];
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -363,10 +363,10 @@ void FTextView::clear()
|
|||
return;
|
||||
}
|
||||
|
||||
std::memset(blank, ' ', std::size_t(size));
|
||||
std::memset(blank, ' ', size);
|
||||
blank[size] = '\0';
|
||||
|
||||
for (int y = 0; y < getTextHeight(); y++)
|
||||
for (int y = 0; y < int(getTextHeight()); y++)
|
||||
{
|
||||
setPrintPos (2, 2 - nf_offset + y);
|
||||
print (blank);
|
||||
|
@ -402,12 +402,12 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
|||
break;
|
||||
|
||||
case fc::Fkey_ppage:
|
||||
scrollBy (0, -getTextHeight());
|
||||
scrollBy (0, int(-getTextHeight()));
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
case fc::Fkey_npage:
|
||||
scrollBy (0, getTextHeight());
|
||||
scrollBy (0, int(getTextHeight()));
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
|
@ -417,7 +417,7 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
|||
break;
|
||||
|
||||
case fc::Fkey_end:
|
||||
scrollToY (int(getRows()) - getTextHeight());
|
||||
scrollToY (int(getRows() - getTextHeight()));
|
||||
ev->accept();
|
||||
break;
|
||||
|
||||
|
@ -592,43 +592,43 @@ void FTextView::onFocusOut (FFocusEvent*)
|
|||
void FTextView::adjustSize()
|
||||
{
|
||||
FWidget::adjustSize();
|
||||
int width = getWidth()
|
||||
, height = getHeight()
|
||||
, last_line = int(getRows())
|
||||
, max_width = int(maxLineWidth);
|
||||
std::size_t width = getWidth();
|
||||
std::size_t height = getHeight();
|
||||
int last_line = int(getRows());
|
||||
int max_width = int(maxLineWidth);
|
||||
|
||||
if ( xoffset >= max_width - width - nf_offset )
|
||||
xoffset = max_width - width - nf_offset - 1;
|
||||
if ( xoffset >= max_width - int(width) - nf_offset )
|
||||
xoffset = max_width - int(width) - nf_offset - 1;
|
||||
|
||||
if ( xoffset < 0 )
|
||||
xoffset = 0;
|
||||
|
||||
if ( yoffset > last_line - height - nf_offset + 2 )
|
||||
yoffset = last_line - height - nf_offset + 2;
|
||||
if ( yoffset > last_line - int(height) - nf_offset + 2 )
|
||||
yoffset = last_line - int(height) - nf_offset + 2;
|
||||
|
||||
if ( yoffset < 0 )
|
||||
yoffset = 0;
|
||||
|
||||
vbar->setMaximum (last_line - height + 2 - nf_offset);
|
||||
vbar->setPageSize (last_line, height - 2 + nf_offset);
|
||||
vbar->setX (width);
|
||||
vbar->setHeight (height - 2 + nf_offset, false);
|
||||
vbar->setMaximum (last_line - int(height) + 2 - nf_offset);
|
||||
vbar->setPageSize (last_line, int(height) - 2 + nf_offset);
|
||||
vbar->setX (int(width));
|
||||
vbar->setHeight (height - 2 + std::size_t(nf_offset), false);
|
||||
vbar->setValue (yoffset);
|
||||
vbar->resize();
|
||||
|
||||
hbar->setMaximum (max_width - width + nf_offset + 2);
|
||||
hbar->setPageSize (max_width, width - nf_offset - 2);
|
||||
hbar->setY (height);
|
||||
hbar->setMaximum (max_width - int(width) + nf_offset + 2);
|
||||
hbar->setPageSize (max_width, int(width) - nf_offset - 2);
|
||||
hbar->setY (int(height));
|
||||
hbar->setWidth (width - 2, false);
|
||||
hbar->setValue (xoffset);
|
||||
hbar->resize();
|
||||
|
||||
if ( last_line < height + nf_offset - 1 )
|
||||
if ( last_line < int(height) + nf_offset - 1 )
|
||||
vbar->hide();
|
||||
else
|
||||
vbar->setVisible();
|
||||
|
||||
if ( max_width < width - nf_offset - 1 )
|
||||
if ( max_width < int(width) - nf_offset - 1 )
|
||||
hbar->hide();
|
||||
else
|
||||
hbar->setVisible();
|
||||
|
@ -637,15 +637,15 @@ void FTextView::adjustSize()
|
|||
|
||||
// private methods of FTextView
|
||||
//----------------------------------------------------------------------
|
||||
int FTextView::getTextHeight()
|
||||
std::size_t FTextView::getTextHeight()
|
||||
{
|
||||
return getHeight() - 2 + nf_offset;
|
||||
return getHeight() - 2 + std::size_t(nf_offset);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FTextView::getTextWidth()
|
||||
std::size_t FTextView::getTextWidth()
|
||||
{
|
||||
return getWidth() - 2 - nf_offset;
|
||||
return getWidth() - 2 - std::size_t(nf_offset);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -740,7 +740,7 @@ void FTextView::draw()
|
|||
}
|
||||
}
|
||||
|
||||
setCursorPos (getWidth(), getHeight());
|
||||
setCursorPos (int(getWidth()), int(getHeight()));
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
}
|
||||
|
@ -748,12 +748,10 @@ void FTextView::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::drawText()
|
||||
{
|
||||
uInt num;
|
||||
|
||||
if ( data.empty() || getHeight() <= 2 || getWidth() <= 2 )
|
||||
return;
|
||||
|
||||
num = uInt(getTextHeight());
|
||||
std::size_t num = getTextHeight();
|
||||
|
||||
if ( num > getRows() )
|
||||
num = getRows();
|
||||
|
@ -763,14 +761,14 @@ void FTextView::drawText()
|
|||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
||||
for (uInt y = 0; y < num; y++)
|
||||
for (std::size_t y = 0; y < num; y++)
|
||||
{
|
||||
uInt i, len;
|
||||
std::size_t i, len;
|
||||
FString line;
|
||||
const wchar_t* line_str;
|
||||
setPrintPos (2, 2 - nf_offset + int(y));
|
||||
line = data[y + uInt(yoffset)].mid ( uInt(1 + xoffset)
|
||||
, uInt(getTextWidth()) );
|
||||
line = data[y + std::size_t(yoffset)].mid ( std::size_t(1 + xoffset)
|
||||
, getTextWidth() );
|
||||
line_str = line.wc_str();
|
||||
len = line.getLength();
|
||||
|
||||
|
@ -790,7 +788,7 @@ void FTextView::drawText()
|
|||
print ('.');
|
||||
}
|
||||
|
||||
for (; i < uInt(getTextWidth()); i++)
|
||||
for (; i < getTextWidth(); i++)
|
||||
print (' ');
|
||||
}
|
||||
|
||||
|
@ -841,14 +839,14 @@ void FTextView::cb_VBarChange (FWidget*, data_ptr)
|
|||
break;
|
||||
|
||||
case FScrollbar::scrollPageBackward:
|
||||
distance = getClientHeight();
|
||||
distance = int(getClientHeight());
|
||||
// fall through
|
||||
case FScrollbar::scrollStepBackward:
|
||||
scrollBy (0, -distance);
|
||||
break;
|
||||
|
||||
case FScrollbar::scrollPageForward:
|
||||
distance = getClientHeight();
|
||||
distance = int(getClientHeight());
|
||||
// fall through
|
||||
case FScrollbar::scrollStepForward:
|
||||
scrollBy (0, distance);
|
||||
|
@ -897,14 +895,14 @@ void FTextView::cb_HBarChange (FWidget*, data_ptr)
|
|||
break;
|
||||
|
||||
case FScrollbar::scrollPageBackward:
|
||||
distance = getClientWidth();
|
||||
distance = int(getClientWidth());
|
||||
// fall through
|
||||
case FScrollbar::scrollStepBackward:
|
||||
scrollBy (-distance, 0);
|
||||
break;
|
||||
|
||||
case FScrollbar::scrollPageForward:
|
||||
distance = getClientWidth();
|
||||
distance = int(getClientWidth());
|
||||
// fall through
|
||||
case FScrollbar::scrollStepForward:
|
||||
scrollBy (distance, 0);
|
||||
|
|
|
@ -88,12 +88,12 @@ FToggleButton::~FToggleButton() // destructor
|
|||
|
||||
// public methods of FToggleButton
|
||||
//----------------------------------------------------------------------
|
||||
void FToggleButton::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||
void FToggleButton::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
|
||||
{
|
||||
// Set the toggle button geometry
|
||||
|
||||
int hotkey_mark = ( getHotkey() ) ? 1 : 0;
|
||||
int min_width = button_width + int(text.getLength()) - hotkey_mark;
|
||||
std::size_t hotkey_mark = ( getHotkey() ) ? 1 : 0;
|
||||
std::size_t min_width = button_width + text.getLength() - hotkey_mark;
|
||||
|
||||
if ( w < min_width )
|
||||
w = min_width;
|
||||
|
@ -203,9 +203,9 @@ bool FToggleButton::setChecked (bool on)
|
|||
void FToggleButton::setText (const FString& txt)
|
||||
{
|
||||
text = txt;
|
||||
int hotkey_mark = ( getHotkey() ) ? 1 : 0;
|
||||
std::size_t hotkey_mark = ( getHotkey() ) ? 1 : 0;
|
||||
|
||||
setWidth(button_width + int(text.getLength()) - hotkey_mark);
|
||||
setWidth(button_width + text.getLength() - hotkey_mark);
|
||||
|
||||
if ( isEnabled() )
|
||||
{
|
||||
|
@ -217,7 +217,7 @@ void FToggleButton::setText (const FString& txt)
|
|||
//----------------------------------------------------------------------
|
||||
void FToggleButton::hide()
|
||||
{
|
||||
int size;
|
||||
std::size_t size;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
@ -238,12 +238,12 @@ void FToggleButton::hide()
|
|||
setColor (fg, bg);
|
||||
size = getWidth();
|
||||
|
||||
if ( size < 0 )
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
blank = new char[std::size_t(size) + 1];
|
||||
blank = new char[size + 1];
|
||||
}
|
||||
catch (const std::bad_alloc& ex)
|
||||
{
|
||||
|
@ -251,7 +251,7 @@ void FToggleButton::hide()
|
|||
return;
|
||||
}
|
||||
|
||||
std::memset(blank, ' ', std::size_t(size));
|
||||
std::memset(blank, ' ', size);
|
||||
blank[size] = '\0';
|
||||
setPrintPos (1, 1);
|
||||
print (blank);
|
||||
|
@ -420,14 +420,12 @@ void FToggleButton::onFocusOut (FFocusEvent* out_ev)
|
|||
//----------------------------------------------------------------------
|
||||
uChar FToggleButton::getHotkey()
|
||||
{
|
||||
uInt length;
|
||||
|
||||
if ( text.isEmpty() )
|
||||
return 0;
|
||||
|
||||
length = text.getLength();
|
||||
std::size_t length = text.getLength();
|
||||
|
||||
for (uInt i = 0; i < length; i++)
|
||||
for (std::size_t i = 0; i < length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -510,7 +508,7 @@ void FToggleButton::drawLabel()
|
|||
if ( text.isNull() || text.isEmpty() )
|
||||
return;
|
||||
|
||||
uInt length = text.getLength();
|
||||
std::size_t length = text.getLength();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -525,12 +523,12 @@ void FToggleButton::drawLabel()
|
|||
FString txt = text;
|
||||
wchar_t* src = const_cast<wchar_t*>(txt.wc_str());
|
||||
wchar_t* dest = const_cast<wchar_t*>(LabelText);
|
||||
hotkeypos = getHotkeyPos(src, dest, uInt(length));
|
||||
hotkeypos = getHotkeyPos(src, dest, length);
|
||||
|
||||
if ( hotkeypos != -1 )
|
||||
length--;
|
||||
|
||||
setPrintPos (1 + label_offset_pos, 1);
|
||||
setPrintPos (1 + int(label_offset_pos), 1);
|
||||
drawText (LabelText, hotkeypos, length);
|
||||
delete[] LabelText;
|
||||
}
|
||||
|
@ -638,14 +636,16 @@ void FToggleButton::init()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int FToggleButton::getHotkeyPos (wchar_t src[], wchar_t dest[], uInt length)
|
||||
int 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;
|
||||
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 )
|
||||
{
|
||||
|
@ -661,7 +661,9 @@ int FToggleButton::getHotkeyPos (wchar_t src[], wchar_t dest[], uInt length)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FToggleButton::drawText (wchar_t LabelText[], int hotkeypos, uInt length)
|
||||
void FToggleButton::drawText ( wchar_t LabelText[]
|
||||
, int hotkeypos
|
||||
, std::size_t length )
|
||||
{
|
||||
bool isActive = ((flags & fc::active) != 0);
|
||||
bool isNoUnderline = ((flags & fc::no_underline) != 0);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2016-2017 Markus Gans *
|
||||
* Copyright 2016-2018 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -143,23 +143,24 @@ void FToolTip::init()
|
|||
//----------------------------------------------------------------------
|
||||
void FToolTip::calculateDimensions()
|
||||
{
|
||||
int x, y, w, h;
|
||||
int x, y;
|
||||
std::size_t w, h;
|
||||
FWidget* r = getRootWidget();
|
||||
text_split = text.split("\n");
|
||||
text_num_lines = uInt(text_split.size());
|
||||
text_components = &text_split[0];
|
||||
max_line_width = 0;
|
||||
|
||||
for (uInt i = 0; i < text_num_lines; i++)
|
||||
for (std::size_t i = 0; i < text_num_lines; i++)
|
||||
{
|
||||
uInt len = text_components[i].getLength();
|
||||
std::size_t len = text_components[i].getLength();
|
||||
|
||||
if ( len > max_line_width )
|
||||
max_line_width = len;
|
||||
}
|
||||
|
||||
h = int(text_num_lines) + 2;
|
||||
w = int(max_line_width + 4);
|
||||
h = text_num_lines + 2;
|
||||
w = max_line_width + 4;
|
||||
|
||||
if ( r )
|
||||
{
|
||||
|
|
|
@ -110,8 +110,8 @@ void FVTerm::setTermXY (int x, int y)
|
|||
if ( term_pos->getX() == x && term_pos->getY() == y )
|
||||
return;
|
||||
|
||||
term_width = getColumnNumber();
|
||||
term_height = getLineNumber();
|
||||
term_width = int(getColumnNumber());
|
||||
term_height = int(getLineNumber());
|
||||
|
||||
if ( x >= term_width )
|
||||
{
|
||||
|
@ -597,8 +597,8 @@ void FVTerm::createArea ( const FRect& r
|
|||
{
|
||||
createArea ( r.getX()
|
||||
, r.getY()
|
||||
, r.getWidth()
|
||||
, r.getHeight()
|
||||
, int(r.getWidth())
|
||||
, int(r.getHeight())
|
||||
, p.getX()
|
||||
, p.getY()
|
||||
, area );
|
||||
|
@ -633,8 +633,8 @@ void FVTerm::resizeArea ( const FRect& r
|
|||
{
|
||||
resizeArea ( r.getX()
|
||||
, r.getY()
|
||||
, r.getWidth()
|
||||
, r.getHeight()
|
||||
, int(r.getWidth())
|
||||
, int(r.getHeight())
|
||||
, p.getX()
|
||||
, p.getY()
|
||||
, area );
|
||||
|
@ -800,8 +800,8 @@ void FVTerm::restoreVTerm (const FRect& box)
|
|||
{
|
||||
restoreVTerm ( box.getX()
|
||||
, box.getY()
|
||||
, box.getWidth()
|
||||
, box.getHeight() );
|
||||
, int(box.getWidth())
|
||||
, int(box.getHeight()) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -901,8 +901,8 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
|
|||
int win_y = win->offset_top;
|
||||
FRect geometry ( win_x
|
||||
, win_y
|
||||
, win->width + win->right_shadow
|
||||
, win->height + win->bottom_shadow );
|
||||
, std::size_t(win->width + win->right_shadow)
|
||||
, std::size_t(win->height + win->bottom_shadow) );
|
||||
|
||||
if ( found && geometry.contains(x, y) )
|
||||
{
|
||||
|
@ -1306,10 +1306,9 @@ bool FVTerm::isInsideArea (int x, int y, term_area* area)
|
|||
{
|
||||
// Check whether the coordinates are within the area
|
||||
|
||||
int ax = 0
|
||||
, ay = 0
|
||||
, aw = area->width
|
||||
, ah = area->height;
|
||||
int ax = 0, ay = 0;
|
||||
std::size_t aw = std::size_t(area->width);
|
||||
std::size_t ah = std::size_t(area->height);
|
||||
FRect area_geometry(ax, ay, aw, ah);
|
||||
|
||||
if ( area_geometry.contains(x, y) )
|
||||
|
@ -1389,8 +1388,8 @@ void FVTerm::getArea (const FRect& box, term_area* area)
|
|||
{
|
||||
getArea ( box.getX()
|
||||
, box.getY()
|
||||
, box.getWidth()
|
||||
, box.getHeight()
|
||||
, int(box.getWidth())
|
||||
, int(box.getHeight())
|
||||
, area );
|
||||
}
|
||||
|
||||
|
@ -1741,8 +1740,8 @@ FVTerm::charData FVTerm::generateCharacter (int x, int y)
|
|||
int win_y = win->offset_top;
|
||||
FRect geometry ( win_x
|
||||
, win_y
|
||||
, win->width + win->right_shadow
|
||||
, win->height + win->bottom_shadow );
|
||||
, std::size_t(win->width + win->right_shadow)
|
||||
, std::size_t(win->height + win->bottom_shadow) );
|
||||
|
||||
// Window is visible and contains current character
|
||||
if ( geometry.contains(x, y) )
|
||||
|
@ -1857,8 +1856,8 @@ FVTerm::charData FVTerm::getCharacter ( character_type char_type
|
|||
|
||||
FRect geometry ( win->offset_left
|
||||
, win->offset_top
|
||||
, win->width + win->right_shadow
|
||||
, win->height + win->bottom_shadow );
|
||||
, std::size_t(win->width + win->right_shadow)
|
||||
, std::size_t(win->height + win->bottom_shadow) );
|
||||
|
||||
// Window visible and contains current character
|
||||
if ( geometry.contains(x, y) )
|
||||
|
@ -2188,7 +2187,7 @@ bool FVTerm::clearTerm (int fillchar)
|
|||
{
|
||||
term_pos->setPoint(-1, -1);
|
||||
|
||||
for (int i = 0; i < getLineNumber(); i++)
|
||||
for (int i = 0; i < int(getLineNumber()); i++)
|
||||
{
|
||||
setTermXY (0, i);
|
||||
appendOutputBuffer (cb);
|
||||
|
@ -2875,8 +2874,8 @@ int FVTerm::appendLowerRight (charData*& screen_char)
|
|||
char* ip = TCAP(fc::t_insert_padding);
|
||||
char* ic = TCAP(fc::t_insert_character);
|
||||
|
||||
x = getColumnNumber() - 2;
|
||||
y = getLineNumber() - 1;
|
||||
x = int(getColumnNumber()) - 2;
|
||||
y = int(getLineNumber()) - 1;
|
||||
setTermXY (x, y);
|
||||
appendChar (screen_char);
|
||||
term_pos->x_ref()++;
|
||||
|
|
152
src/fwidget.cpp
152
src/fwidget.cpp
|
@ -106,10 +106,10 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
|
|||
{
|
||||
visible_cursor = ! hideable;
|
||||
offset = parent->client_offset;
|
||||
double_flatline_mask.top.resize (uLong(getWidth()), false);
|
||||
double_flatline_mask.right.resize (uLong(getHeight()), false);
|
||||
double_flatline_mask.bottom.resize (uLong(getWidth()), false);
|
||||
double_flatline_mask.left.resize (uLong(getHeight()), false);
|
||||
double_flatline_mask.top.resize (getWidth(), false);
|
||||
double_flatline_mask.right.resize (getHeight(), false);
|
||||
double_flatline_mask.bottom.resize (getWidth(), false);
|
||||
double_flatline_mask.left.resize (getHeight(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,7 @@ void FWidget::setPos (int x, int y, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setWidth (int width, bool adjust)
|
||||
void FWidget::setWidth (std::size_t width, bool adjust)
|
||||
{
|
||||
width = std::min (width, size_hints.max_width);
|
||||
width = std::max (width, size_hints.min_width);
|
||||
|
@ -499,12 +499,12 @@ void FWidget::setWidth (int width, bool adjust)
|
|||
if ( adjust )
|
||||
adjustSize();
|
||||
|
||||
double_flatline_mask.top.resize (uLong(getWidth()), false);
|
||||
double_flatline_mask.bottom.resize (uLong(getWidth()), false);
|
||||
double_flatline_mask.top.resize (getWidth(), false);
|
||||
double_flatline_mask.bottom.resize (getWidth(), false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setHeight (int height, bool adjust)
|
||||
void FWidget::setHeight (std::size_t height, bool adjust)
|
||||
{
|
||||
height = std::min (height, size_hints.max_height);
|
||||
height = std::max (height, size_hints.min_height);
|
||||
|
@ -521,12 +521,12 @@ void FWidget::setHeight (int height, bool adjust)
|
|||
if ( adjust )
|
||||
adjustSize();
|
||||
|
||||
double_flatline_mask.right.resize (uLong(getHeight()), false);
|
||||
double_flatline_mask.left.resize (uLong(getHeight()), false);
|
||||
double_flatline_mask.right.resize (getHeight(), false);
|
||||
double_flatline_mask.left.resize (getHeight(), false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setSize (int width, int height, bool adjust)
|
||||
void FWidget::setSize (std::size_t width, std::size_t height, bool adjust)
|
||||
{
|
||||
width = std::min (width, size_hints.max_width);
|
||||
width = std::max (width, size_hints.min_width);
|
||||
|
@ -551,10 +551,10 @@ void FWidget::setSize (int width, int height, bool adjust)
|
|||
if ( adjust )
|
||||
adjustSize();
|
||||
|
||||
double_flatline_mask.top.resize (uLong(getWidth()), false);
|
||||
double_flatline_mask.right.resize (uLong(getHeight()), false);
|
||||
double_flatline_mask.bottom.resize (uLong(getWidth()), false);
|
||||
double_flatline_mask.left.resize (uLong(getHeight()), false);
|
||||
double_flatline_mask.top.resize (getWidth(), false);
|
||||
double_flatline_mask.right.resize (getHeight(), false);
|
||||
double_flatline_mask.bottom.resize (getWidth(), false);
|
||||
double_flatline_mask.left.resize (getHeight(), false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -612,7 +612,7 @@ void FWidget::setBottomPadding (int bottom, bool adjust)
|
|||
if ( isRootWidget() )
|
||||
{
|
||||
FWidget* r = rootObject;
|
||||
r->client_offset.setY2 (r->getHeight() - 1 - r->padding.bottom);
|
||||
r->client_offset.setY2 (int(r->getHeight()) - 1 - r->padding.bottom);
|
||||
adjustSizeGlobal();
|
||||
}
|
||||
else
|
||||
|
@ -633,7 +633,7 @@ void FWidget::setRightPadding (int right, bool adjust)
|
|||
if ( isRootWidget() )
|
||||
{
|
||||
FWidget* r = rootObject;
|
||||
r->client_offset.setX2 (r->getWidth() - 1 - r->padding.right);
|
||||
r->client_offset.setX2 (int(r->getWidth()) - 1 - r->padding.right);
|
||||
adjustSizeGlobal();
|
||||
}
|
||||
else
|
||||
|
@ -654,8 +654,8 @@ void FWidget::setParentOffset()
|
|||
void FWidget::setTermOffset()
|
||||
{
|
||||
FWidget* r = getRootWidget();
|
||||
int w = r->getWidth();
|
||||
int h = r->getHeight();
|
||||
int w = int(r->getWidth());
|
||||
int h = int(r->getHeight());
|
||||
offset.setCoordinates (0, 0, w - 1, h - 1);
|
||||
}
|
||||
|
||||
|
@ -665,14 +665,15 @@ void FWidget::setTermOffsetWithPadding()
|
|||
FWidget* r = getRootWidget();
|
||||
offset.setCoordinates ( r->getLeftPadding()
|
||||
, r->getTopPadding()
|
||||
, r->getWidth() - 1 - r->getRightPadding()
|
||||
, r->getHeight() - 1 - r->getBottomPadding() );
|
||||
, int(r->getWidth()) - 1 - r->getRightPadding()
|
||||
, int(r->getHeight()) - 1 - r->getBottomPadding() );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setTermSize (int w, int h)
|
||||
void FWidget::setTermSize (std::size_t w, std::size_t h)
|
||||
{
|
||||
// Set xterm size to w x h
|
||||
|
||||
if ( isXTerminal() )
|
||||
{
|
||||
rootObject->wsize.setRect(1, 1, w, h);
|
||||
|
@ -683,12 +684,11 @@ void FWidget::setTermSize (int w, int h)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||
void FWidget::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
|
||||
{
|
||||
// Sets the geometry of the widget relative to its parent
|
||||
|
||||
int term_x
|
||||
, term_y;
|
||||
int term_x, term_y;
|
||||
|
||||
w = std::min (w, size_hints.max_width);
|
||||
w = std::max (w, size_hints.min_width);
|
||||
|
@ -718,13 +718,13 @@ void FWidget::setGeometry (int x, int y, int w, int h, bool adjust)
|
|||
|
||||
client_offset.setCoordinates ( term_x - 1 + padding.left
|
||||
, term_y - 1 + padding.top
|
||||
, term_x - 2 + getWidth() - padding.right
|
||||
, term_y - 2 + getHeight() - padding.bottom );
|
||||
, term_x - 2 + int(getWidth()) - padding.right
|
||||
, term_y - 2 + int(getHeight()) - padding.bottom );
|
||||
|
||||
double_flatline_mask.top.resize (uLong(getWidth()), false);
|
||||
double_flatline_mask.right.resize (uLong(getHeight()), false);
|
||||
double_flatline_mask.bottom.resize (uLong(getWidth()), false);
|
||||
double_flatline_mask.left.resize (uLong(getHeight()), false);
|
||||
double_flatline_mask.top.resize (getWidth(), false);
|
||||
double_flatline_mask.right.resize (getHeight(), false);
|
||||
double_flatline_mask.bottom.resize (getWidth(), false);
|
||||
double_flatline_mask.left.resize (getHeight(), false);
|
||||
|
||||
if ( adjust )
|
||||
adjustSize();
|
||||
|
@ -1148,10 +1148,10 @@ void FWidget::resize()
|
|||
adjustSize();
|
||||
|
||||
// resize the four double-flatline-masks
|
||||
double_flatline_mask.top.resize (uLong(getWidth()), false);
|
||||
double_flatline_mask.right.resize (uLong(getHeight()), false);
|
||||
double_flatline_mask.bottom.resize (uLong(getWidth()), false);
|
||||
double_flatline_mask.left.resize (uLong(getHeight()), false);
|
||||
double_flatline_mask.top.resize (getWidth(), false);
|
||||
double_flatline_mask.right.resize (getHeight(), false);
|
||||
double_flatline_mask.bottom.resize (getWidth(), false);
|
||||
double_flatline_mask.left.resize (getHeight(), false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1329,8 +1329,8 @@ void FWidget::detectTermSize()
|
|||
(
|
||||
r->padding.left,
|
||||
r->padding.top,
|
||||
getDesktopWidth() - 1 - r->padding.right,
|
||||
getDesktopHeight() - 1 - r->padding.bottom
|
||||
int(getDesktopWidth()) - 1 - r->padding.right,
|
||||
int(getDesktopHeight()) - 1 - r->padding.bottom
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1357,9 +1357,9 @@ void FWidget::drawShadow()
|
|||
}
|
||||
|
||||
int x1 = 1
|
||||
, x2 = getWidth()
|
||||
, x2 = int(getWidth())
|
||||
, y1 = 1
|
||||
, y2 = getHeight();
|
||||
, y2 = int(getHeight());
|
||||
|
||||
if ( trans_shadow )
|
||||
{
|
||||
|
@ -1379,8 +1379,8 @@ void FWidget::clearShadow()
|
|||
if ( isMonochron() )
|
||||
return;
|
||||
|
||||
int w = getWidth()
|
||||
, h = getHeight();
|
||||
int w = int(getWidth());
|
||||
int h = int(getHeight());
|
||||
|
||||
if ( isWindowWidget() )
|
||||
{
|
||||
|
@ -1392,7 +1392,7 @@ void FWidget::clearShadow()
|
|||
|
||||
if ( w <= offset.getX2() )
|
||||
{
|
||||
for (int i = 1; i <= getHeight(); i++)
|
||||
for (int i = 1; i <= int(getHeight()); i++)
|
||||
{
|
||||
setPrintPos (w + 1, i);
|
||||
print (' '); // clear █
|
||||
|
@ -1403,7 +1403,7 @@ void FWidget::clearShadow()
|
|||
{
|
||||
setPrintPos (2, h + 1);
|
||||
|
||||
for (int i = 1; i <= getWidth(); i++)
|
||||
for (std::size_t i = 1; i <= getWidth(); i++)
|
||||
print (' '); // clear ▀
|
||||
}
|
||||
|
||||
|
@ -1418,16 +1418,16 @@ void FWidget::drawFlatBorder()
|
|||
return;
|
||||
|
||||
int x1 = 1
|
||||
, x2 = getWidth() + 1
|
||||
, x2 = int(getWidth()) + 1
|
||||
, y1 = 0
|
||||
, y2 = getHeight() + 1;
|
||||
, y2 = int(getHeight()) + 1;
|
||||
|
||||
if ( FWidget* p = getParentWidget() )
|
||||
setColor (wc.dialog_fg, p->getBackgroundColor());
|
||||
else
|
||||
setColor (wc.dialog_fg, wc.dialog_bg);
|
||||
|
||||
for (int y = 0; y < getHeight(); y++)
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (x1 - 1, y1 + y + 1);
|
||||
|
||||
|
@ -1441,7 +1441,7 @@ void FWidget::drawFlatBorder()
|
|||
|
||||
setPrintPos (x2, y1 + 1);
|
||||
|
||||
for (int y = 0; y < getHeight(); y++)
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
{
|
||||
if ( double_flatline_mask.right[uLong(y)] )
|
||||
// left+right line (on right side)
|
||||
|
@ -1455,7 +1455,7 @@ void FWidget::drawFlatBorder()
|
|||
|
||||
setPrintPos (x1, y1);
|
||||
|
||||
for (int x = 0; x < getWidth(); x++)
|
||||
for (int x = 0; x < int(getWidth()); x++)
|
||||
{
|
||||
if ( double_flatline_mask.top[uLong(x)] )
|
||||
// top+bottom line (at top)
|
||||
|
@ -1467,7 +1467,7 @@ void FWidget::drawFlatBorder()
|
|||
|
||||
setPrintPos (x1, y2);
|
||||
|
||||
for (int x = 0; x < getWidth(); x++)
|
||||
for (int x = 0; x < int(getWidth()); x++)
|
||||
{
|
||||
if ( double_flatline_mask.bottom[uLong(x)] )
|
||||
// top+bottom line (at bottom)
|
||||
|
@ -1485,9 +1485,9 @@ void FWidget::clearFlatBorder()
|
|||
return;
|
||||
|
||||
int x1 = 1
|
||||
, x2 = getWidth() + 1
|
||||
, x2 = int(getWidth()) + 1
|
||||
, y1 = 0
|
||||
, y2 = getHeight() + 1;
|
||||
, y2 = int(getHeight()) + 1;
|
||||
|
||||
if ( FWidget* p = getParentWidget() )
|
||||
setColor (wc.dialog_fg, p->getBackgroundColor());
|
||||
|
@ -1495,7 +1495,7 @@ void FWidget::clearFlatBorder()
|
|||
setColor (wc.dialog_fg, wc.dialog_bg);
|
||||
|
||||
// clear on left side
|
||||
for (int y = 0; y < getHeight(); y++)
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (x1 - 1, y1 + y + 1);
|
||||
|
||||
|
@ -1506,7 +1506,7 @@ void FWidget::clearFlatBorder()
|
|||
}
|
||||
|
||||
// clear on right side
|
||||
for (int y = 0; y < getHeight(); y++)
|
||||
for (int y = 0; y < int(getHeight()); y++)
|
||||
{
|
||||
setPrintPos (x2, y1 + y + 1);
|
||||
|
||||
|
@ -1519,7 +1519,7 @@ void FWidget::clearFlatBorder()
|
|||
// clear at top
|
||||
setPrintPos (x1, y1);
|
||||
|
||||
for (int x = 0; x < getWidth(); x++)
|
||||
for (int x = 0; x < int(getWidth()); x++)
|
||||
{
|
||||
if ( double_flatline_mask.top[uLong(x)] )
|
||||
print (fc::NF_border_line_upper);
|
||||
|
@ -1530,7 +1530,7 @@ void FWidget::clearFlatBorder()
|
|||
// clear at bottom
|
||||
setPrintPos (x1, y2);
|
||||
|
||||
for (int x = 0; x < getWidth(); x++)
|
||||
for (int x = 0; x < int(getWidth()); x++)
|
||||
{
|
||||
if ( double_flatline_mask.bottom[uLong(x)] )
|
||||
print (fc::NF_border_line_bottom);
|
||||
|
@ -1554,11 +1554,11 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
|
|||
if ( y1 < 1 )
|
||||
y1 = 1;
|
||||
|
||||
if ( x2 > getWidth() )
|
||||
x2 = getWidth();
|
||||
if ( x2 > int(getWidth()) )
|
||||
x2 = int(getWidth());
|
||||
|
||||
if ( y2 > getHeight() )
|
||||
y2 = getHeight();
|
||||
if ( y2 > int(getHeight()) )
|
||||
y2 = int(getHeight());
|
||||
|
||||
if ( isNewFont() )
|
||||
drawNewFontBox (x1, y1, x2, y2);
|
||||
|
@ -1683,8 +1683,8 @@ void FWidget::adjustSize()
|
|||
{
|
||||
offset.setCoordinates ( p->getTermX() - 1
|
||||
, p->getTermY() - 1
|
||||
, p->getTermX() + p->getWidth() - 2
|
||||
, p->getTermY() + p->getHeight() - 2 );
|
||||
, p->getTermX() + int(p->getWidth()) - 2
|
||||
, p->getTermY() + int(p->getHeight()) - 2 );
|
||||
}
|
||||
else if ( p )
|
||||
offset = p->client_offset;
|
||||
|
@ -1700,8 +1700,8 @@ void FWidget::adjustSize()
|
|||
(
|
||||
getTermX() - 1 + padding.left,
|
||||
getTermY() - 1 + padding.top,
|
||||
getTermX() - 2 + getWidth() - padding.right,
|
||||
getTermY() - 2 + getHeight() - padding.bottom
|
||||
getTermX() - 2 + int(getWidth()) - padding.right,
|
||||
getTermY() - 2 + int(getHeight()) - padding.bottom
|
||||
);
|
||||
|
||||
if ( hasChildren() )
|
||||
|
@ -2069,10 +2069,10 @@ void FWidget::init()
|
|||
offset.setRect(0, 0, getDesktopWidth(), getDesktopHeight());
|
||||
client_offset = offset;
|
||||
|
||||
double_flatline_mask.top.resize (uLong(getWidth()), false);
|
||||
double_flatline_mask.right.resize (uLong(getHeight()), false);
|
||||
double_flatline_mask.bottom.resize (uLong(getWidth()), false);
|
||||
double_flatline_mask.left.resize (uLong(getHeight()), false);
|
||||
double_flatline_mask.top.resize (getWidth(), false);
|
||||
double_flatline_mask.right.resize (getHeight(), false);
|
||||
double_flatline_mask.bottom.resize (getWidth(), false);
|
||||
double_flatline_mask.left.resize (getHeight(), false);
|
||||
|
||||
// Initialize default widget colors
|
||||
setColorTheme();
|
||||
|
@ -2132,7 +2132,7 @@ inline void FWidget::insufficientSpaceAdjust()
|
|||
return;
|
||||
|
||||
// move left if not enough space
|
||||
while ( getTermX() + getWidth() - padding.right > offset.getX2() + 2 )
|
||||
while ( getTermX() + int(getWidth()) - padding.right > offset.getX2() + 2 )
|
||||
{
|
||||
adjust_wsize.x1_ref()--;
|
||||
adjust_wsize.x2_ref()--;
|
||||
|
@ -2142,7 +2142,7 @@ inline void FWidget::insufficientSpaceAdjust()
|
|||
}
|
||||
|
||||
// move up if not enough space
|
||||
while ( getTermY() + getHeight() - padding.bottom > offset.getY2() + 2 )
|
||||
while ( getTermY() + int(getHeight()) - padding.bottom > offset.getY2() + 2 )
|
||||
{
|
||||
adjust_wsize.y1_ref()--;
|
||||
adjust_wsize.y2_ref()--;
|
||||
|
@ -2152,17 +2152,17 @@ inline void FWidget::insufficientSpaceAdjust()
|
|||
}
|
||||
|
||||
// reduce the width if not enough space
|
||||
while ( offset.getX1() + getWidth() - 1 > offset.getX2() )
|
||||
while ( offset.getX1() + int(getWidth()) - 1 > offset.getX2() )
|
||||
adjust_wsize.x2_ref()--;
|
||||
|
||||
if ( getWidth() < size_hints.min_width )
|
||||
adjust_wsize.setWidth(size_hints.min_width);
|
||||
|
||||
if ( getWidth() <= 0 )
|
||||
if ( getWidth() == 0 )
|
||||
adjust_wsize.setWidth(1);
|
||||
|
||||
// reduce the height if not enough space
|
||||
while ( offset.getY1() + getHeight() - 1 > offset.getY2() )
|
||||
while ( offset.getY1() + int(getHeight()) - 1 > offset.getY2() )
|
||||
adjust_wsize.y2_ref()--;
|
||||
|
||||
if ( getHeight() < size_hints.min_height )
|
||||
|
@ -2343,7 +2343,7 @@ void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
|
|||
setColor (wc.shadow_bg, wc.shadow_fg);
|
||||
setTransShadow();
|
||||
|
||||
for (int i = 1; i < getHeight(); i++)
|
||||
for (int i = 1; i < int(getHeight()); i++)
|
||||
{
|
||||
setPrintPos (x2 + 1, y1 + i);
|
||||
print (" ");
|
||||
|
@ -2358,7 +2358,7 @@ void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
|
|||
setColor (wc.shadow_bg, wc.shadow_fg);
|
||||
setTransShadow();
|
||||
|
||||
for (int i = 2; i <= getWidth() + 1; i++)
|
||||
for (std::size_t i = 2; i <= getWidth() + 1; i++)
|
||||
print (' ');
|
||||
|
||||
unsetTransShadow();
|
||||
|
@ -2392,7 +2392,7 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
|||
if ( isWindowWidget() )
|
||||
unsetInheritBackground();
|
||||
|
||||
for (int i = 1; i < getHeight(); i++)
|
||||
for (int i = 1; i < int(getHeight()); i++)
|
||||
{
|
||||
setPrintPos (x2 + 1, y1 + i);
|
||||
print (block); // █
|
||||
|
@ -2403,7 +2403,7 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
|||
if ( isWindowWidget() )
|
||||
setInheritBackground();
|
||||
|
||||
for (int i = 1; i <= getWidth(); i++)
|
||||
for (std::size_t i = 1; i <= getWidth(); i++)
|
||||
print (fc::UpperHalfBlock); // ▀
|
||||
|
||||
if ( isWindowWidget() )
|
||||
|
|
|
@ -278,9 +278,9 @@ void FWindow::drawBorder()
|
|||
if ( isNewFont() )
|
||||
{
|
||||
int x1 = 1
|
||||
, x2 = 1 + getWidth() - 1
|
||||
, x2 = 1 + int(getWidth()) - 1
|
||||
, y1 = 1
|
||||
, y2 = 1 + getHeight() - 1;
|
||||
, y2 = 1 + int(getHeight()) - 1;
|
||||
|
||||
setPrintPos (x1, y1);
|
||||
print (fc::NF_border_corner_upper_left); // ⎡
|
||||
|
@ -304,7 +304,7 @@ void FWindow::drawBorder()
|
|||
// lower left corner border ⎣
|
||||
print (fc::NF_border_corner_lower_left);
|
||||
|
||||
for (int x = 2; x < getWidth(); x++) // low line _
|
||||
for (std::size_t x = 2; x < getWidth(); x++) // low line _
|
||||
print (fc::NF_border_line_bottom);
|
||||
|
||||
setPrintPos (x2, y2);
|
||||
|
@ -372,9 +372,9 @@ void FWindow::setPos (int x, int y, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::setWidth (int w, bool adjust)
|
||||
void FWindow::setWidth (std::size_t w, bool adjust)
|
||||
{
|
||||
int old_width = getWidth();
|
||||
std::size_t old_width = getWidth();
|
||||
FWidget::setWidth (w, adjust);
|
||||
|
||||
if ( isVirtualWindow() && getWidth() != old_width )
|
||||
|
@ -386,9 +386,9 @@ void FWindow::setWidth (int w, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::setHeight (int h, bool adjust)
|
||||
void FWindow::setHeight (std::size_t h, bool adjust)
|
||||
{
|
||||
int old_height = getHeight();
|
||||
std::size_t old_height = getHeight();
|
||||
FWidget::setHeight (h, adjust);
|
||||
|
||||
if ( isVirtualWindow() && getHeight() != old_height )
|
||||
|
@ -400,10 +400,10 @@ void FWindow::setHeight (int h, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::setSize (int w, int h, bool adjust)
|
||||
void FWindow::setSize (std::size_t w, std::size_t h, bool adjust)
|
||||
{
|
||||
int old_width = getWidth();
|
||||
int old_height = getHeight();
|
||||
std::size_t old_width = getWidth();
|
||||
std::size_t old_height = getHeight();
|
||||
FWidget::setSize (w, h, adjust);
|
||||
|
||||
if ( isVirtualWindow()
|
||||
|
@ -416,14 +416,14 @@ void FWindow::setSize (int w, int h, bool adjust)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWindow::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||
void FWindow::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adjust)
|
||||
{
|
||||
// Sets the geometry of the widget
|
||||
|
||||
int old_x = getX()
|
||||
, old_y = getY()
|
||||
, old_width = getWidth()
|
||||
, old_height = getHeight();
|
||||
int old_x = getX();
|
||||
int old_y = getY();
|
||||
std::size_t old_width = getWidth();
|
||||
std::size_t old_height = getHeight();
|
||||
|
||||
if ( y < 1 )
|
||||
y = 1;
|
||||
|
|
|
@ -142,7 +142,7 @@ class FButton : public FWidget
|
|||
uChar getHotkey();
|
||||
void setHotkeyAccelerator();
|
||||
void detectHotkey();
|
||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
||||
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||
int clickAnimationIndent (FWidget*);
|
||||
void clearRightMargin (FWidget*);
|
||||
void drawMarginLeft();
|
||||
|
|
|
@ -83,7 +83,7 @@ class FButtonGroup : public FScrollView
|
|||
FToggleButton* getFirstButton();
|
||||
FToggleButton* getLastButton();
|
||||
FToggleButton* getButton (int) const;
|
||||
uInt getCount() const;
|
||||
std::size_t getCount() const;
|
||||
FString& getText();
|
||||
|
||||
// Mutator
|
||||
|
@ -136,8 +136,8 @@ class FButtonGroup : public FScrollView
|
|||
|
||||
// Methods
|
||||
void init();
|
||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
||||
void drawText (wchar_t[], int, uInt);
|
||||
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||
void drawText (wchar_t[], int, std::size_t);
|
||||
void directFocus();
|
||||
|
||||
// Data Members
|
||||
|
@ -165,8 +165,8 @@ inline bool FButtonGroup::setDisable()
|
|||
{ return setEnable(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline uInt FButtonGroup::getCount() const
|
||||
{ return uInt(buttonlist.size()); }
|
||||
inline std::size_t FButtonGroup::getCount() const
|
||||
{ return buttonlist.size(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FString& FButtonGroup::getText()
|
||||
|
|
|
@ -124,7 +124,7 @@ class FDialog : public FWindow
|
|||
bool moveDown (int);
|
||||
bool moveLeft (int);
|
||||
bool moveRight (int);
|
||||
virtual void setSize (int, int, bool = true);
|
||||
virtual void setSize (std::size_t, std::size_t, bool = true);
|
||||
bool reduceHeight (int);
|
||||
bool expandHeight (int);
|
||||
bool reduceWidth (int);
|
||||
|
@ -161,12 +161,12 @@ class FDialog : public FWindow
|
|||
int mouse_x;
|
||||
int mouse_y;
|
||||
FPoint termPos;
|
||||
int zoom_btn;
|
||||
std::size_t zoom_btn;
|
||||
bool mouse_over_menu;
|
||||
} mouseStates;
|
||||
|
||||
// Constant
|
||||
static const int MENU_BTN = 3;
|
||||
static const std::size_t MENU_BTN = 3;
|
||||
static const bool PRINT_WIN_NUMBER = false; // Only for debug
|
||||
|
||||
// Using-declaration
|
||||
|
@ -197,7 +197,7 @@ class FDialog : public FWindow
|
|||
void openMenu();
|
||||
void selectFirstMenuItem();
|
||||
void setZoomItem();
|
||||
int getZoomButtonWidth();
|
||||
std::size_t getZoomButtonWidth();
|
||||
void activateZoomButton (mouseStates&);
|
||||
void deactivateZoomButton();
|
||||
void leaveZoomButton (mouseStates&);
|
||||
|
|
|
@ -140,13 +140,13 @@ class FLabel : public FWidget
|
|||
// Methods
|
||||
void init();
|
||||
uChar getHotkey();
|
||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
||||
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||
void setHotkeyAccelerator();
|
||||
int getAlignOffset (int);
|
||||
std::size_t getAlignOffset (std::size_t);
|
||||
virtual void draw();
|
||||
void drawMultiLine();
|
||||
void drawSingleLine();
|
||||
void printLine (wchar_t[], uInt, int, int = 0);
|
||||
void printLine (wchar_t[], std::size_t, int, std::size_t = 0);
|
||||
|
||||
// Data Members
|
||||
FStringList multiline_text;
|
||||
|
|
|
@ -179,7 +179,7 @@ class FLineEdit : public FWidget
|
|||
int scroll_repeat;
|
||||
bool insert_mode;
|
||||
int cursor_pos;
|
||||
int text_offset;
|
||||
std::size_t text_offset;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
@ -157,23 +157,23 @@ class FListBox : public FWidget
|
|||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
uInt getCount() const;
|
||||
FListBoxItem getItem (int);
|
||||
std::size_t getCount() const;
|
||||
FListBoxItem getItem (std::size_t);
|
||||
FListBoxItem getItem (listBoxItems::iterator) const;
|
||||
int currentItem() const;
|
||||
std::size_t currentItem() const;
|
||||
FString& getText();
|
||||
|
||||
// Mutators
|
||||
void setCurrentItem (int);
|
||||
void setCurrentItem (std::size_t);
|
||||
void setCurrentItem (listBoxItems::iterator);
|
||||
void selectItem (int);
|
||||
void selectItem (std::size_t);
|
||||
void selectItem (listBoxItems::iterator);
|
||||
void unselectItem (int);
|
||||
void unselectItem (std::size_t);
|
||||
void unselectItem (listBoxItems::iterator);
|
||||
void showInsideBrackets (int, fc::brackets_type);
|
||||
void showNoBrackets (int);
|
||||
void showInsideBrackets (std::size_t, fc::brackets_type);
|
||||
void showNoBrackets (std::size_t);
|
||||
void showNoBrackets (listBoxItems::iterator);
|
||||
virtual void setGeometry (int, int, int, int, bool = true);
|
||||
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
void setMultiSelection (bool);
|
||||
void setMultiSelection ();
|
||||
void unsetMultiSelection ();
|
||||
|
@ -184,10 +184,10 @@ class FListBox : public FWidget
|
|||
void setText (const FString&);
|
||||
|
||||
// Inquiries
|
||||
bool isSelected (int);
|
||||
bool isSelected (std::size_t);
|
||||
bool isSelected (listBoxItems::iterator) const;
|
||||
bool isMultiSelection() const;
|
||||
bool hasBrackets (int);
|
||||
bool hasBrackets (std::size_t);
|
||||
bool hasBrackets (listBoxItems::iterator) const;
|
||||
|
||||
// Methods
|
||||
|
@ -205,7 +205,7 @@ class FListBox : public FWidget
|
|||
, fc::brackets_type = fc::NoBrackets
|
||||
, bool = false
|
||||
, data_ptr = 0 );
|
||||
void remove (int);
|
||||
void remove (std::size_t);
|
||||
void clear();
|
||||
|
||||
// Event handlers
|
||||
|
@ -257,8 +257,8 @@ class FListBox : public FWidget
|
|||
void recalculateHorizontalBar (int, bool);
|
||||
void recalculateVerticalBar (int);
|
||||
void getWidgetFocus();
|
||||
void multiSelection (int);
|
||||
void multiSelectionUpTo (int);
|
||||
void multiSelection (std::size_t);
|
||||
void multiSelectionUpTo (std::size_t);
|
||||
void wheelUp (int);
|
||||
void wheelDown (int);
|
||||
bool dragScrollUp();
|
||||
|
@ -290,7 +290,7 @@ class FListBox : public FWidget
|
|||
void processSelect();
|
||||
void processChanged();
|
||||
void lazyConvert (listBoxItems::iterator, int);
|
||||
listBoxItems::iterator index2iterator (int);
|
||||
listBoxItems::iterator index2iterator (std::size_t);
|
||||
|
||||
// Callback methods
|
||||
void cb_VBarChange (FWidget*, data_ptr);
|
||||
|
@ -315,7 +315,7 @@ class FListBox : public FWidget
|
|||
bool scroll_timer;
|
||||
int scroll_repeat;
|
||||
int scroll_distance;
|
||||
int current;
|
||||
std::size_t current;
|
||||
int last_current;
|
||||
int secect_from_item;
|
||||
int xoffset;
|
||||
|
@ -405,11 +405,11 @@ inline const char* FListBox::getClassName() const
|
|||
{ return "FListBox"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline uInt FListBox::getCount() const
|
||||
{ return uInt(itemlist.size()); }
|
||||
inline std::size_t FListBox::getCount() const
|
||||
{ return itemlist.size(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FListBoxItem FListBox::getItem (int index)
|
||||
inline FListBoxItem FListBox::getItem (std::size_t index)
|
||||
{
|
||||
listBoxItems::iterator iter = index2iterator(index - 1);
|
||||
return *iter;
|
||||
|
@ -420,7 +420,7 @@ inline FListBoxItem FListBox::getItem (listBoxItems::iterator iter) const
|
|||
{ return *iter; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FListBox::currentItem() const
|
||||
inline std::size_t FListBox::currentItem() const
|
||||
{ return current; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -428,7 +428,7 @@ inline FString& FListBox::getText()
|
|||
{ return text; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListBox::selectItem (int index)
|
||||
inline void FListBox::selectItem (std::size_t index)
|
||||
{ index2iterator(index - 1)->selected = true; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -436,7 +436,7 @@ inline void FListBox::selectItem (listBoxItems::iterator iter)
|
|||
{ iter->selected = true; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListBox::unselectItem (int index)
|
||||
inline void FListBox::unselectItem (std::size_t index)
|
||||
{ index2iterator(index - 1)->selected = false; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -444,7 +444,7 @@ inline void FListBox::unselectItem (listBoxItems::iterator iter)
|
|||
{ iter->selected = false; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FListBox::showNoBrackets (int index)
|
||||
inline void FListBox::showNoBrackets (std::size_t index)
|
||||
{ index2iterator(index - 1)->brackets = fc::NoBrackets; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -476,7 +476,7 @@ inline bool FListBox::unsetFocus()
|
|||
{ return setFocus(false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListBox::isSelected (int index)
|
||||
inline bool FListBox::isSelected (std::size_t index)
|
||||
{ return index2iterator(index - 1)->selected; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -488,7 +488,7 @@ inline bool FListBox::isMultiSelection() const
|
|||
{ return multi_select; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListBox::hasBrackets(int index)
|
||||
inline bool FListBox::hasBrackets(std::size_t index)
|
||||
{ return bool(index2iterator(index - 1)->brackets > 0); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -526,7 +526,7 @@ void FListBox::insert (Container container, LazyConverter convert)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FListBox::listBoxItems::iterator FListBox::index2iterator (int index)
|
||||
inline FListBox::listBoxItems::iterator FListBox::index2iterator (std::size_t index)
|
||||
{
|
||||
listBoxItems::iterator iter = itemlist.begin();
|
||||
std::advance (iter, index);
|
||||
|
|
|
@ -260,7 +260,7 @@ class FListView : public FWidget
|
|||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
uInt getCount();
|
||||
std::size_t getCount();
|
||||
fc::text_alignment getColumnAlignment (int) const;
|
||||
FString getColumnText (int) const;
|
||||
fc::sorting_type getColumnSortType (int) const;
|
||||
|
@ -269,7 +269,7 @@ class FListView : public FWidget
|
|||
FListViewItem* getCurrentItem();
|
||||
|
||||
// Mutators
|
||||
virtual void setGeometry (int, int, int, int, bool = true);
|
||||
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
void setColumnAlignment (int, fc::text_alignment);
|
||||
void setColumnText (int, const FString&);
|
||||
void setColumnSortType (int,fc::sorting_type \
|
||||
|
@ -344,13 +344,15 @@ class FListView : public FWidget
|
|||
void init();
|
||||
template<typename Compare>
|
||||
void sort (Compare);
|
||||
uInt getAlignOffset (fc::text_alignment, uInt, uInt);
|
||||
std::size_t getAlignOffset ( fc::text_alignment
|
||||
, std::size_t
|
||||
, std::size_t );
|
||||
virtual void draw();
|
||||
void drawColumnLabels();
|
||||
void drawList();
|
||||
void drawListLine (const FListViewItem*, bool, bool);
|
||||
void setLineAttributes (bool, bool);
|
||||
FString getLinePrefix (const FListViewItem*, uInt);
|
||||
FString getLinePrefix (const FListViewItem*, std::size_t);
|
||||
void drawColumnText (headerItems::const_iterator&);
|
||||
void drawColumnEllipsis ( headerItems::const_iterator&
|
||||
, const FString& );
|
||||
|
|
|
@ -139,7 +139,7 @@ class FMenu : public FWindow, public FMenuList
|
|||
typedef struct
|
||||
{
|
||||
wchar_t* text;
|
||||
int length;
|
||||
std::size_t length;
|
||||
int hotkeypos;
|
||||
bool no_underline;
|
||||
} menuText;
|
||||
|
@ -199,16 +199,16 @@ class FMenu : public FWindow, public FMenuList
|
|||
bool selectPrevItem();
|
||||
void keypressMenuBar (FKeyEvent*);
|
||||
bool hotkeyMenu (FKeyEvent*);
|
||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
||||
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||
virtual void draw();
|
||||
void drawItems();
|
||||
void drawSeparator (int);
|
||||
void drawMenuLine (FMenuItem*, int);
|
||||
void drawCheckMarkPrefix (FMenuItem*);
|
||||
void drawMenuText (menuText&);
|
||||
void drawSubMenuIndicator (int&);
|
||||
void drawAcceleratorKey (int&, int);
|
||||
void drawTrailingSpaces (int);
|
||||
void drawSubMenuIndicator (std::size_t&);
|
||||
void drawAcceleratorKey (std::size_t&, int);
|
||||
void drawTrailingSpaces (std::size_t);
|
||||
void setLineAttributes (FMenuItem*, int);
|
||||
void setCursorToHotkeyPosition (FMenuItem*);
|
||||
void keyUp();
|
||||
|
@ -232,7 +232,7 @@ class FMenu : public FWindow, public FMenuList
|
|||
FWidget* super_menu;
|
||||
FMenu* opened_sub_menu;
|
||||
FMenu* shown_sub_menu;
|
||||
uInt max_item_width;
|
||||
std::size_t max_item_width;
|
||||
int hotkeypos;
|
||||
bool mouse_down;
|
||||
bool has_checkable_items;
|
||||
|
|
|
@ -105,8 +105,8 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
typedef struct
|
||||
{
|
||||
wchar_t* text;
|
||||
int length;
|
||||
int startpos;
|
||||
std::size_t length;
|
||||
std::size_t startpos;
|
||||
int hotkeypos;
|
||||
bool no_underline;
|
||||
} menuText;
|
||||
|
@ -126,7 +126,7 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
bool selectNextItem();
|
||||
bool selectPrevItem();
|
||||
bool hotkeyMenu (FKeyEvent*&);
|
||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
||||
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||
virtual void draw();
|
||||
void drawItems();
|
||||
void drawItem (FMenuItem*, int&);
|
||||
|
@ -154,7 +154,7 @@ class FMenuBar : public FWindow, public FMenuList
|
|||
bool mouse_down;
|
||||
bool drop_down;
|
||||
bool focus_changed;
|
||||
int screenWidth;
|
||||
std::size_t screenWidth;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ class FMenuItem : public FWidget
|
|||
const char* getClassName() const;
|
||||
int getHotkey() const;
|
||||
FMenu* getMenu() const;
|
||||
uInt getTextLength() const;
|
||||
std::size_t getTextLength() const;
|
||||
FString getText() const;
|
||||
|
||||
// Mutators
|
||||
|
@ -152,7 +152,7 @@ class FMenuItem : public FWidget
|
|||
bool checked;
|
||||
bool radio_button;
|
||||
bool dialog_index;
|
||||
uInt text_length;
|
||||
std::size_t text_length;
|
||||
int hotkey;
|
||||
int accel_key;
|
||||
FMenu* menu;
|
||||
|
@ -207,7 +207,7 @@ inline FMenu* FMenuItem::getMenu() const
|
|||
{ return menu; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline uInt FMenuItem::getTextLength() const
|
||||
inline std::size_t FMenuItem::getTextLength() const
|
||||
{ return text_length; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -69,7 +69,7 @@ class FMenuList
|
|||
|
||||
// Accessors
|
||||
virtual const char* getClassName() const;
|
||||
uInt getCount() const;
|
||||
std::size_t getCount() const;
|
||||
FMenuItem* getItem (int) const;
|
||||
FMenuItem* getSelectedItem() const;
|
||||
|
||||
|
@ -110,8 +110,8 @@ inline const char* FMenuList::getClassName() const
|
|||
{ return "FMenuList"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline uInt FMenuList::getCount() const
|
||||
{ return uInt(item_list.size()); }
|
||||
inline std::size_t FMenuList::getCount() const
|
||||
{ return item_list.size(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FMenuItem* FMenuList::getItem (int index) const
|
||||
|
|
|
@ -163,7 +163,7 @@ class FMessageBox : public FDialog
|
|||
FString text;
|
||||
FString* text_components;
|
||||
FStringList text_split;
|
||||
uInt max_line_width;
|
||||
std::size_t max_line_width;
|
||||
bool center_text;
|
||||
short emphasis_color;
|
||||
uInt num_buttons;
|
||||
|
|
|
@ -138,7 +138,7 @@ class FOptiMove
|
|||
// Mutators
|
||||
void setBaudRate (int);
|
||||
void setTabStop (int);
|
||||
void setTermSize (int, int);
|
||||
void setTermSize (std::size_t, std::size_t);
|
||||
void setTermEnvironment (termEnv&);
|
||||
void set_cursor_home (char[]);
|
||||
void set_cursor_to_ll (char[]);
|
||||
|
@ -237,8 +237,8 @@ class FOptiMove
|
|||
int char_duration;
|
||||
int baudrate;
|
||||
int tabstop;
|
||||
int screen_width;
|
||||
int screen_height;
|
||||
std::size_t screen_width;
|
||||
std::size_t screen_height;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2014-2017 Markus Gans *
|
||||
* Copyright 2014-2018 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -82,7 +82,7 @@ class FProgressbar : public FWidget
|
|||
|
||||
// Mutators
|
||||
void setPercentage (int);
|
||||
virtual void setGeometry (int, int, int, int, bool = true);
|
||||
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
bool setShadow (bool);
|
||||
bool setShadow();
|
||||
bool unsetShadow();
|
||||
|
@ -102,7 +102,7 @@ class FProgressbar : public FWidget
|
|||
|
||||
// Data Members
|
||||
int percentage;
|
||||
int bar_length;
|
||||
std::size_t bar_length;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class FRect
|
|||
// Constructors
|
||||
FRect ();
|
||||
FRect (const FRect&); // copy constructor
|
||||
FRect (int, int, int, int);
|
||||
FRect (int, int, std::size_t, std::size_t);
|
||||
FRect (const FPoint&, const FPoint&);
|
||||
|
||||
// Destructor
|
||||
|
@ -83,8 +83,8 @@ class FRect
|
|||
FPoint getUpperRightPos() const;
|
||||
FPoint getLowerLeftPos() const;
|
||||
FPoint getLowerRightPos() const;
|
||||
int getWidth() const;
|
||||
int getHeight() const;
|
||||
std::size_t getWidth() const;
|
||||
std::size_t getHeight() const;
|
||||
|
||||
// Mutators
|
||||
void setX1 (int);
|
||||
|
@ -95,11 +95,11 @@ class FRect
|
|||
void setY (int);
|
||||
void setPos (int, int);
|
||||
void setPos (const FPoint&);
|
||||
void setWidth (int);
|
||||
void setHeight (int);
|
||||
void setSize (int, int);
|
||||
void setWidth (std::size_t);
|
||||
void setHeight (std::size_t);
|
||||
void setSize (std::size_t, std::size_t);
|
||||
void setRect (const FRect&);
|
||||
void setRect (int, int, int, int);
|
||||
void setRect (int, int, std::size_t, std::size_t);
|
||||
void setCoordinates (const FPoint&, const FPoint&);
|
||||
void setCoordinates (int, int, int, int);
|
||||
|
||||
|
@ -150,11 +150,11 @@ inline FRect::FRect (const FRect& r) // copy constructor
|
|||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FRect::FRect (int x, int y, int width, int height)
|
||||
inline FRect::FRect (int x, int y, std::size_t width, std::size_t height)
|
||||
: X1(short(x))
|
||||
, Y1(short(y))
|
||||
, X2(short(x + width - 1))
|
||||
, Y2(short(y + height - 1))
|
||||
, X2(short(x + short(width) - 1))
|
||||
, Y2(short(y + short(height) - 1))
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -206,12 +206,18 @@ inline FPoint FRect::getLowerRightPos() const
|
|||
{ return FPoint(X2, Y2); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FRect::getWidth() const
|
||||
{ return short(X2 - X1 + 1); }
|
||||
inline std::size_t FRect::getWidth() const
|
||||
{
|
||||
short w = X2 - X1 + 1;
|
||||
return ( w < 0 ) ? 0 : std::size_t(w);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FRect::getHeight() const
|
||||
{ return short(Y2 - Y1 + 1); }
|
||||
inline std::size_t FRect::getHeight() const
|
||||
{
|
||||
short h = Y2 - Y1 + 1;
|
||||
return ( h < 0 ) ? 0 : std::size_t(h);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline short& FRect::x1_ref()
|
||||
|
|
|
@ -103,7 +103,7 @@ class FScrollbar : public FWidget
|
|||
void setSteps (double);
|
||||
void setPageSize (int, int);
|
||||
void setOrientation (int);
|
||||
virtual void setGeometry (int, int, int, int, bool = true);
|
||||
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
|
||||
// Methods
|
||||
virtual void resize();
|
||||
|
@ -149,14 +149,14 @@ class FScrollbar : public FWidget
|
|||
int slider_click_stop_pos;
|
||||
int current_slider_pos;
|
||||
int slider_pos;
|
||||
int slider_length;
|
||||
int bar_length;
|
||||
std::size_t slider_length;
|
||||
std::size_t bar_length;
|
||||
int val;
|
||||
int min;
|
||||
int max;
|
||||
double steps;
|
||||
int pagesize;
|
||||
int length;
|
||||
std::size_t length;
|
||||
int bar_orientation;
|
||||
int max_color;
|
||||
};
|
||||
|
|
|
@ -82,25 +82,25 @@ class FScrollView : public FWidget
|
|||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
int getViewportWidth() const;
|
||||
int getViewportHeight() const;
|
||||
int getScrollWidth() const;
|
||||
int getScrollHeight() const;
|
||||
std::size_t getViewportWidth() const;
|
||||
std::size_t getViewportHeight() const;
|
||||
std::size_t getScrollWidth() const;
|
||||
std::size_t getScrollHeight() const;
|
||||
const FPoint getScrollPos() const;
|
||||
int getScrollX() const;
|
||||
int getScrollY() const;
|
||||
|
||||
// Mutator
|
||||
virtual void setScrollWidth (int);
|
||||
virtual void setScrollHeight (int);
|
||||
virtual void setScrollSize (int, int);
|
||||
virtual void setScrollWidth (std::size_t);
|
||||
virtual void setScrollHeight (std::size_t);
|
||||
virtual void setScrollSize (std::size_t, std::size_t);
|
||||
virtual void setX (int, bool = true);
|
||||
virtual void setY (int, bool = true);
|
||||
virtual void setPos (int, int, bool = true);
|
||||
virtual void setWidth (int, bool = true);
|
||||
virtual void setHeight (int, bool = true);
|
||||
virtual void setSize (int, int, bool = true);
|
||||
virtual void setGeometry (int, int, int, int, bool = true);
|
||||
virtual void setWidth (std::size_t, bool = true);
|
||||
virtual void setHeight (std::size_t, bool = true);
|
||||
virtual void setSize (std::size_t, std::size_t, bool = true);
|
||||
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
void setCursorPos (int, int);
|
||||
void setPrintPos (int, int);
|
||||
bool setViewportPrint (bool);
|
||||
|
@ -195,19 +195,19 @@ inline const char* FScrollView::getClassName() const
|
|||
{ return "FScrollView"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FScrollView::getViewportWidth() const
|
||||
{ return getWidth() - vertical_border_spacing - nf_offset; }
|
||||
inline std::size_t FScrollView::getViewportWidth() const
|
||||
{ return getWidth() - vertical_border_spacing - std::size_t(nf_offset); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FScrollView::getViewportHeight() const
|
||||
inline std::size_t FScrollView::getViewportHeight() const
|
||||
{ return getHeight() - horizontal_border_spacing; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FScrollView::getScrollWidth() const
|
||||
inline std::size_t FScrollView::getScrollWidth() const
|
||||
{ return scroll_geometry.getWidth(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FScrollView::getScrollHeight() const
|
||||
inline std::size_t FScrollView::getScrollHeight() const
|
||||
{ return scroll_geometry.getHeight(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -203,7 +203,7 @@ class FStatusBar : public FWindow
|
|||
virtual const char* getClassName() const;
|
||||
FStatusKey* getStatusKey (int) const;
|
||||
FString getMessage() const;
|
||||
uInt getCount() const;
|
||||
std::size_t getCount() const;
|
||||
|
||||
// Mutators
|
||||
void activateKey (int);
|
||||
|
@ -253,7 +253,7 @@ class FStatusBar : public FWindow
|
|||
keyList key_list;
|
||||
FString text;
|
||||
bool mouse_down;
|
||||
int screenWidth;
|
||||
std::size_t screenWidth;
|
||||
int keyname_len;
|
||||
int x;
|
||||
int x_msg;
|
||||
|
@ -271,8 +271,8 @@ inline FStatusKey* FStatusBar::getStatusKey (int index) const
|
|||
{ return key_list[uInt(index - 1)]; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline uInt FStatusBar::getCount() const
|
||||
{ return uInt(key_list.size()); }
|
||||
inline std::size_t FStatusBar::getCount() const
|
||||
{ return key_list.size(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FStatusBar::activateKey (int index)
|
||||
|
|
|
@ -80,11 +80,9 @@ class FString
|
|||
// Constructors
|
||||
FString ();
|
||||
explicit FString (int);
|
||||
explicit FString (uInt);
|
||||
FString (int, wchar_t);
|
||||
FString (uInt, wchar_t);
|
||||
FString (int, char);
|
||||
FString (uInt, char);
|
||||
explicit FString (std::size_t);
|
||||
FString (std::size_t, wchar_t);
|
||||
FString (std::size_t, char);
|
||||
FString (const FString&); // implicit conversion copy constructor
|
||||
FString (const std::wstring&); // implicit conversion constructor
|
||||
FString (const wchar_t[]); // implicit conversion constructor
|
||||
|
@ -132,8 +130,7 @@ class FString
|
|||
const FString& operator >> (double&);
|
||||
const FString& operator >> (float&);
|
||||
|
||||
wchar_t& operator [] (int);
|
||||
wchar_t& operator [] (uInt);
|
||||
wchar_t& operator [] (std::size_t);
|
||||
const FString& operator () ();
|
||||
|
||||
bool operator < (const FString&) const;
|
||||
|
@ -181,8 +178,8 @@ class FString
|
|||
bool isEmpty() const;
|
||||
|
||||
// Methods
|
||||
uInt getLength() const;
|
||||
uInt getUTF8length() const;
|
||||
std::size_t getLength() const;
|
||||
std::size_t getUTF8length() const;
|
||||
|
||||
iterator begin() const;
|
||||
iterator end() const;
|
||||
|
@ -214,12 +211,9 @@ class FString
|
|||
FString rtrim() const;
|
||||
FString trim() const;
|
||||
|
||||
FString left (int) const;
|
||||
FString left (uInt) const;
|
||||
FString right (int) const;
|
||||
FString right (uInt) const;
|
||||
FString mid (int, int) const;
|
||||
FString mid (uInt, uInt) const;
|
||||
FString left (std::size_t) const;
|
||||
FString right (std::size_t) const;
|
||||
FString mid (std::size_t, std::size_t) const;
|
||||
|
||||
FStringList split (const FString&);
|
||||
FString& setString (const FString&);
|
||||
|
@ -242,7 +236,7 @@ class FString
|
|||
FString& setFormatedNumber (uLong, char = nl_langinfo(THOUSEP)[0]);
|
||||
|
||||
const FString& insert (const FString&, int);
|
||||
const FString& insert (const FString&, uInt);
|
||||
const FString& insert (const FString&, std::size_t);
|
||||
|
||||
FString replace (const FString&, const FString&);
|
||||
|
||||
|
@ -252,10 +246,9 @@ class FString
|
|||
FString removeBackspaces() const;
|
||||
|
||||
const FString& overwrite (const FString&, int);
|
||||
const FString& overwrite (const FString&, uInt = 0);
|
||||
const FString& overwrite (const FString&, std::size_t = 0);
|
||||
|
||||
const FString& remove (int, uInt);
|
||||
const FString& remove (uInt, uInt);
|
||||
const FString& remove (std::size_t, std::size_t);
|
||||
bool includes (const FString&) const;
|
||||
|
||||
private:
|
||||
|
@ -266,19 +259,19 @@ class FString
|
|||
static const char* const bad_alloc_str;
|
||||
|
||||
// Methods
|
||||
void initLength (uInt);
|
||||
void initLength (std::size_t);
|
||||
void _assign (const wchar_t[]);
|
||||
void _insert (uInt, const wchar_t[]);
|
||||
void _insert (uInt, uInt, const wchar_t[]);
|
||||
void _remove (uInt, uInt);
|
||||
void _insert (std::size_t, const wchar_t[]);
|
||||
void _insert (std::size_t, std::size_t, const wchar_t[]);
|
||||
void _remove (std::size_t, std::size_t);
|
||||
char* wc_to_c_str (const wchar_t[]) const;
|
||||
wchar_t* c_to_wc_str (const char[]) const;
|
||||
wchar_t* extractToken (wchar_t*[], const wchar_t[], const wchar_t[]);
|
||||
|
||||
// Data Members
|
||||
wchar_t* string;
|
||||
uInt length;
|
||||
uInt bufsize;
|
||||
std::size_t length;
|
||||
std::size_t bufsize;
|
||||
mutable char* c_string;
|
||||
};
|
||||
|
||||
|
@ -345,7 +338,7 @@ inline bool FString::isEmpty() const
|
|||
{ return ( ! string ) || ( ! *string ); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline uInt FString::getLength() const
|
||||
inline std::size_t FString::getLength() const
|
||||
{ return length; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -166,8 +166,8 @@ class FTerm
|
|||
virtual const char* getClassName() const;
|
||||
static FKeyboard* getKeyboard();
|
||||
static FMouseControl* getMouseControl();
|
||||
static int getLineNumber();
|
||||
static int getColumnNumber();
|
||||
static std::size_t getLineNumber();
|
||||
static std::size_t getColumnNumber();
|
||||
static const FString getKeyName (int);
|
||||
|
||||
static int getTTYFileDescriptor();
|
||||
|
@ -236,7 +236,7 @@ class FTerm
|
|||
static char* enableCursor();
|
||||
static char* disableCursor();
|
||||
static void detectTermSize();
|
||||
static void setTermSize (int, int);
|
||||
static void setTermSize (std::size_t, std::size_t);
|
||||
static void setTermTitle(const FString&);
|
||||
static void setKDECursor (fc::kdeKonsoleCursorShape);
|
||||
static void saveColorMap();
|
||||
|
|
|
@ -65,7 +65,7 @@ class FTermXTerminal
|
|||
static void setCursorStyle (fc::xtermCursorStyle);
|
||||
static void setFont (const FString&);
|
||||
static void setTitle (const FString&);
|
||||
static void setTermSize (int, int);
|
||||
static void setTermSize (std::size_t, std::size_t);
|
||||
static void setForeground (const FString&);
|
||||
static void setBackground (const FString&);
|
||||
static void setCursorColor (const FString&);
|
||||
|
@ -139,8 +139,8 @@ class FTermXTerminal
|
|||
static bool mouse_support;
|
||||
static bool meta_sends_esc;
|
||||
static bool xterm_default_colors;
|
||||
static int term_width;
|
||||
static int term_height;
|
||||
static std::size_t term_width;
|
||||
static std::size_t term_height;
|
||||
static const FString* xterm_font;
|
||||
static const FString* xterm_title;
|
||||
static const FString* foreground_color;
|
||||
|
|
|
@ -84,13 +84,13 @@ class FTextView : public FWidget
|
|||
|
||||
// Accessors
|
||||
const char* getClassName() const;
|
||||
uInt getColumns() const;
|
||||
uInt getRows() const;
|
||||
std::size_t getColumns() const;
|
||||
std::size_t getRows() const;
|
||||
const FString getText() const;
|
||||
const FStringList& getLines() const;
|
||||
|
||||
// Mutators
|
||||
virtual void setGeometry (int, int, int, int, bool = true);
|
||||
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
void setText (const FString&);
|
||||
void scrollToX (int);
|
||||
void scrollToY (int);
|
||||
|
@ -128,8 +128,8 @@ class FTextView : public FWidget
|
|||
FTextView& operator = (const FTextView&);
|
||||
|
||||
// Accessors
|
||||
int getTextHeight();
|
||||
int getTextWidth();
|
||||
std::size_t getTextHeight();
|
||||
std::size_t getTextWidth();
|
||||
|
||||
// Methods
|
||||
void init();
|
||||
|
@ -151,7 +151,7 @@ class FTextView : public FWidget
|
|||
int xoffset;
|
||||
int yoffset;
|
||||
int nf_offset;
|
||||
uInt maxLineWidth;
|
||||
std::size_t maxLineWidth;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
@ -162,12 +162,12 @@ inline const char* FTextView::getClassName() const
|
|||
{ return "FTextView"; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline uInt FTextView::getColumns() const
|
||||
inline std::size_t FTextView::getColumns() const
|
||||
{ return maxLineWidth; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline uInt FTextView::getRows() const
|
||||
{ return uInt(data.size()); }
|
||||
inline std::size_t FTextView::getRows() const
|
||||
{ return std::size_t(data.size()); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const FStringList& FTextView::getLines() const
|
||||
|
|
|
@ -85,7 +85,7 @@ class FToggleButton : public FWidget
|
|||
FString& getText();
|
||||
|
||||
// Mutators
|
||||
virtual void setGeometry (int, int, int, int, bool = true);
|
||||
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
bool setNoUnderline (bool);
|
||||
bool setNoUnderline();
|
||||
bool unsetNoUnderline();
|
||||
|
@ -139,8 +139,8 @@ class FToggleButton : public FWidget
|
|||
|
||||
// Data Members
|
||||
bool checked;
|
||||
int label_offset_pos;
|
||||
int button_width; // plus margin spaces
|
||||
std::size_t label_offset_pos;
|
||||
std::size_t button_width; // plus margin spaces
|
||||
|
||||
private:
|
||||
// Disable copy constructor
|
||||
|
@ -154,8 +154,8 @@ class FToggleButton : public FWidget
|
|||
|
||||
// Methods
|
||||
void init();
|
||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
||||
void drawText (wchar_t[], int, uInt);
|
||||
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||
void drawText (wchar_t[], int, std::size_t);
|
||||
|
||||
// Friend classes
|
||||
friend class FButtonGroup;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2016-2017 Markus Gans *
|
||||
* Copyright 2016-2018 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -112,8 +112,8 @@ class FToolTip : public FWindow
|
|||
FString text;
|
||||
FString* text_components;
|
||||
FStringList text_split;
|
||||
uInt max_line_width;
|
||||
uInt text_num_lines;
|
||||
std::size_t max_line_width;
|
||||
std::size_t text_num_lines;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
@ -170,23 +170,23 @@ class FWidget : public FVTerm, public FObject
|
|||
int getTermX() const;
|
||||
int getTermY() const;
|
||||
const FPoint getTermPos() const;
|
||||
int getWidth() const;
|
||||
int getHeight() const;
|
||||
std::size_t getWidth() const;
|
||||
std::size_t getHeight() const;
|
||||
int getTopPadding() const;
|
||||
int getLeftPadding() const;
|
||||
int getBottomPadding() const;
|
||||
int getRightPadding() const;
|
||||
int getClientWidth() const;
|
||||
int getClientHeight() const;
|
||||
int getMaxWidth() const;
|
||||
int getMaxHeight() const;
|
||||
std::size_t getClientWidth() const;
|
||||
std::size_t getClientHeight() const;
|
||||
std::size_t getMaxWidth() const;
|
||||
std::size_t getMaxHeight() const;
|
||||
const FPoint& getShadow() const;
|
||||
const FRect& getGeometry() const;
|
||||
const FRect& getGeometryWithShadow();
|
||||
const FRect& getTermGeometry();
|
||||
const FRect& getTermGeometryWithShadow();
|
||||
int getDesktopWidth();
|
||||
int getDesktopHeight();
|
||||
std::size_t getDesktopWidth();
|
||||
std::size_t getDesktopHeight();
|
||||
int getFlags() const;
|
||||
FPoint getCursorPos();
|
||||
FPoint getPrintPos();
|
||||
|
@ -222,9 +222,9 @@ class FWidget : public FVTerm, public FObject
|
|||
virtual void setY (int, bool = true);
|
||||
virtual void setPos (const FPoint&, bool = true);
|
||||
virtual void setPos (int, int, bool = true);
|
||||
virtual void setWidth (int, bool = true);
|
||||
virtual void setHeight (int, bool = true);
|
||||
virtual void setSize (int, int, bool = true);
|
||||
virtual void setWidth (std::size_t, bool = true);
|
||||
virtual void setHeight (std::size_t, bool = true);
|
||||
virtual void setSize (std::size_t, std::size_t, bool = true);
|
||||
void setTopPadding (int, bool = true);
|
||||
void setLeftPadding (int, bool = true);
|
||||
void setBottomPadding (int, bool = true);
|
||||
|
@ -232,17 +232,17 @@ class FWidget : public FVTerm, public FObject
|
|||
void setParentOffset();
|
||||
void setTermOffset();
|
||||
void setTermOffsetWithPadding();
|
||||
void setTermSize (int, int);
|
||||
void setTermSize (std::size_t, std::size_t);
|
||||
virtual void setGeometry (const FRect&, bool = true);
|
||||
virtual void setGeometry (int, int, int, int, bool = true);
|
||||
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
virtual void setShadowSize (int, int);
|
||||
void setMinimumWidth (int);
|
||||
void setMinimumHeight (int);
|
||||
void setMinimumSize (int, int);
|
||||
void setMaximumWidth (int);
|
||||
void setMaximumHeight (int);
|
||||
void setMaximumSize (int, int);
|
||||
void setFixedSize (int, int);
|
||||
void setMinimumWidth (std::size_t);
|
||||
void setMinimumHeight (std::size_t);
|
||||
void setMinimumSize (std::size_t, std::size_t);
|
||||
void setMaximumWidth (std::size_t);
|
||||
void setMaximumHeight (std::size_t);
|
||||
void setMaximumSize (std::size_t, std::size_t);
|
||||
void setFixedSize (std::size_t, std::size_t);
|
||||
bool setCursorPos (const FPoint&);
|
||||
bool setCursorPos (int, int);
|
||||
void unsetCursorPos();
|
||||
|
@ -414,8 +414,8 @@ class FWidget : public FVTerm, public FObject
|
|||
struct widget_size_hints
|
||||
{
|
||||
widget_size_hints()
|
||||
: min_width (INT_MIN)
|
||||
, min_height (INT_MIN)
|
||||
: min_width (0)
|
||||
, min_height (0)
|
||||
, max_width (INT_MAX)
|
||||
, max_height (INT_MAX)
|
||||
{ }
|
||||
|
@ -423,22 +423,22 @@ class FWidget : public FVTerm, public FObject
|
|||
~widget_size_hints()
|
||||
{ }
|
||||
|
||||
void setMinimum (int w, int h)
|
||||
void setMinimum (std::size_t w, std::size_t h)
|
||||
{
|
||||
min_width = w;
|
||||
min_height = h;
|
||||
}
|
||||
|
||||
void setMaximum (int w, int h)
|
||||
void setMaximum (std::size_t w, std::size_t h)
|
||||
{
|
||||
max_width = w;
|
||||
max_height = h;
|
||||
}
|
||||
|
||||
int min_width;
|
||||
int min_height;
|
||||
int max_width;
|
||||
int max_height;
|
||||
std::size_t min_width;
|
||||
std::size_t min_height;
|
||||
std::size_t max_width;
|
||||
std::size_t max_height;
|
||||
} size_hints;
|
||||
|
||||
struct dbl_line_mask
|
||||
|
@ -545,11 +545,11 @@ inline const FPoint FWidget::getTermPos() const // position on terminal
|
|||
{ return FPoint(getTermX(), getTermY()); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FWidget::getWidth() const
|
||||
inline std::size_t FWidget::getWidth() const
|
||||
{ return adjust_wsize.getWidth(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FWidget::getHeight() const
|
||||
inline std::size_t FWidget::getHeight() const
|
||||
{ return adjust_wsize.getHeight(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -569,19 +569,19 @@ inline int FWidget::getRightPadding() const
|
|||
{ return padding.right; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FWidget::getClientWidth() const
|
||||
inline std::size_t FWidget::getClientWidth() const
|
||||
{ return client_offset.getWidth(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FWidget::getClientHeight() const
|
||||
inline std::size_t FWidget::getClientHeight() const
|
||||
{ return client_offset.getHeight(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FWidget::getMaxWidth() const
|
||||
inline std::size_t FWidget::getMaxWidth() const
|
||||
{ return offset.getWidth(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FWidget::getMaxHeight() const
|
||||
inline std::size_t FWidget::getMaxHeight() const
|
||||
{ return offset.getHeight(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -635,11 +635,11 @@ inline const FRect& FWidget::getTermGeometryWithShadow()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FWidget::getDesktopWidth()
|
||||
inline std::size_t FWidget::getDesktopWidth()
|
||||
{ return getColumnNumber(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline int FWidget::getDesktopHeight()
|
||||
inline std::size_t FWidget::getDesktopHeight()
|
||||
{ return getLineNumber(); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -731,8 +731,8 @@ inline void FWidget::setGeometry (const FRect& box, bool adjust)
|
|||
{
|
||||
setGeometry ( box.getX()
|
||||
, box.getY()
|
||||
, box.getWidth()
|
||||
, box.getHeight()
|
||||
, std::size_t(box.getWidth())
|
||||
, std::size_t(box.getHeight())
|
||||
, adjust );
|
||||
}
|
||||
|
||||
|
@ -741,31 +741,31 @@ inline void FWidget::setShadowSize (int right, int bottom)
|
|||
{ wshadow.setPoint (right, bottom); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setMinimumWidth (int min_width)
|
||||
inline void FWidget::setMinimumWidth (std::size_t min_width)
|
||||
{ size_hints.setMinimum (min_width, size_hints.min_height); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setMinimumHeight (int min_height)
|
||||
inline void FWidget::setMinimumHeight (std::size_t min_height)
|
||||
{ size_hints.setMinimum (size_hints.min_width, min_height); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setMinimumSize (int min_width, int min_height)
|
||||
inline void FWidget::setMinimumSize (std::size_t min_width, std::size_t min_height)
|
||||
{ size_hints.setMinimum (min_width, min_height); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setMaximumWidth (int max_width)
|
||||
inline void FWidget::setMaximumWidth (std::size_t max_width)
|
||||
{ size_hints.setMaximum (max_width, size_hints.max_height); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setMaximumHeight (int max_height)
|
||||
inline void FWidget::setMaximumHeight (std::size_t max_height)
|
||||
{ size_hints.setMaximum (size_hints.max_width, max_height); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setMaximumSize (int max_width, int max_height)
|
||||
inline void FWidget::setMaximumSize (std::size_t max_width, std::size_t max_height)
|
||||
{ size_hints.setMaximum (max_width, max_height); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setFixedSize (int width, int height)
|
||||
inline void FWidget::setFixedSize (std::size_t width, std::size_t height)
|
||||
{
|
||||
size_hints.setMinimum (width, height);
|
||||
size_hints.setMaximum (width, height);
|
||||
|
@ -864,7 +864,7 @@ inline void FWidget::move (const FPoint& pos)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::drawBorder()
|
||||
{ drawBorder (1, 1, getWidth(), getHeight()); }
|
||||
{ drawBorder (1, 1, int(getWidth()), int(getHeight())); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::processDestroy()
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* *
|
||||
* This file is part of the Final Cut widget toolkit *
|
||||
* *
|
||||
* Copyright 2015-2017 Markus Gans *
|
||||
* Copyright 2015-2018 Markus Gans *
|
||||
* *
|
||||
* The Final Cut is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public License *
|
||||
|
@ -133,10 +133,10 @@ class FWindow : public FWidget
|
|||
virtual void setX (int, bool = true);
|
||||
virtual void setY (int, bool = true);
|
||||
virtual void setPos (int, int, bool = true);
|
||||
virtual void setWidth (int, bool = true);
|
||||
virtual void setHeight (int, bool = true);
|
||||
virtual void setSize (int, int, bool = true);
|
||||
void setGeometry (int, int, int, int, bool = true);
|
||||
virtual void setWidth (std::size_t, bool = true);
|
||||
virtual void setHeight (std::size_t, bool = true);
|
||||
virtual void setSize (std::size_t, std::size_t, bool = true);
|
||||
void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||
virtual void move (int, int);
|
||||
static FWindow* getWindowWidgetAt (const FPoint&);
|
||||
static FWindow* getWindowWidgetAt (int, int);
|
||||
|
|
|
@ -221,7 +221,7 @@ void FStringTest::initLengthTest()
|
|||
CPPUNIT_ASSERT ( s1.isEmpty() );
|
||||
|
||||
const int x1 = 10;
|
||||
const uInt x2 = 10;
|
||||
const std::size_t x2 = 10;
|
||||
const finalcut::FString s2(x1);
|
||||
CPPUNIT_ASSERT ( s2.getLength() == 10 );
|
||||
CPPUNIT_ASSERT ( ! s2.isNull() );
|
||||
|
@ -1261,7 +1261,8 @@ void FStringTest::subStringTest()
|
|||
CPPUNIT_ASSERT ( str1.left(int(11)) == L"Look behind" );
|
||||
CPPUNIT_ASSERT ( str1.left(999)
|
||||
== L"Look behind you, a three-headed monkey!" );
|
||||
CPPUNIT_ASSERT ( str1.left(-5) == L"" );
|
||||
CPPUNIT_ASSERT ( str1.left(-5)
|
||||
== L"Look behind you, a three-headed monkey!" );
|
||||
CPPUNIT_ASSERT ( str1.left(0) == L"" );
|
||||
CPPUNIT_ASSERT ( str1.left(0).isEmpty() );
|
||||
CPPUNIT_ASSERT ( ! str1.left(0).isNull() );
|
||||
|
@ -1273,7 +1274,8 @@ void FStringTest::subStringTest()
|
|||
CPPUNIT_ASSERT ( str1.right(int(7)) == L"monkey!" );
|
||||
CPPUNIT_ASSERT ( str1.right(999)
|
||||
== L"Look behind you, a three-headed monkey!" );
|
||||
CPPUNIT_ASSERT ( str1.right(-5) == L"" );
|
||||
CPPUNIT_ASSERT ( str1.right(-5)
|
||||
== L"Look behind you, a three-headed monkey!" );
|
||||
CPPUNIT_ASSERT ( str1.right(0) == L"" );
|
||||
CPPUNIT_ASSERT ( str1.right(0).isEmpty() );
|
||||
CPPUNIT_ASSERT ( ! str1.right(0).isNull() );
|
||||
|
@ -1290,7 +1292,7 @@ void FStringTest::subStringTest()
|
|||
CPPUNIT_ASSERT ( str1.mid(5, 0) == L"" );
|
||||
CPPUNIT_ASSERT ( str1.mid(-5, 2) == L"" );
|
||||
CPPUNIT_ASSERT ( str1.mid(0, 0) == L"" );
|
||||
CPPUNIT_ASSERT ( str1.mid(0, 5) == L"" );
|
||||
CPPUNIT_ASSERT ( str1.mid(0, 5) == L"Look " );
|
||||
CPPUNIT_ASSERT ( str1.mid(0, 0).isEmpty() );
|
||||
CPPUNIT_ASSERT ( ! str1.mid(0, 0).isNull() );
|
||||
CPPUNIT_ASSERT ( finalcut::FString().mid(5, 0).isNull() );
|
||||
|
|
Loading…
Reference in New Issue