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>
|
2018-10-13 Markus Gans <guru.mail@muenster.de>
|
||||||
* Avoid using dynamic_cast so that you can compile Final Cut
|
* Avoid using dynamic_cast so that you can compile Final Cut
|
||||||
without Run-Time Type Information (RTTI).
|
without Run-Time Type Information (RTTI).
|
||||||
|
|
2
build.sh
2
build.sh
|
@ -43,7 +43,7 @@ fi
|
||||||
# Build commands
|
# Build commands
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"--release"|"release")
|
"--release"|"release")
|
||||||
if ! ./configure --prefix="$PREFIX"
|
if ! ./configure --prefix="$PREFIX" CXXFLAGS="-O3 -fno-rtti"
|
||||||
then
|
then
|
||||||
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
echo "${RED}Configure failed!${NORMAL}" 1>&2
|
||||||
exit -1
|
exit -1
|
||||||
|
|
|
@ -29,7 +29,7 @@ endif
|
||||||
all: $(OBJS)
|
all: $(OBJS)
|
||||||
|
|
||||||
debug:
|
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:
|
profile:
|
||||||
$(MAKE) $(MAKEFILE) PROFILE="-pg"
|
$(MAKE) $(MAKEFILE) PROFILE="-pg"
|
||||||
|
|
|
@ -1100,10 +1100,10 @@ void Calc::cb_buttonClicked (finalcut::FWidget*, data_ptr data)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Calc::adjustSize()
|
void Calc::adjustSize()
|
||||||
{
|
{
|
||||||
int pw = getParentWidget()->getWidth();
|
std::size_t pw = getParentWidget()->getWidth();
|
||||||
int ph = getParentWidget()->getHeight();
|
std::size_t ph = getParentWidget()->getHeight();
|
||||||
setX (1 + (pw - getWidth()) / 2, false);
|
setX (1 + int(pw - getWidth()) / 2, false);
|
||||||
setY (1 + (ph - getHeight()) / 2, false);
|
setY (1 + int(ph - getHeight()) / 2, false);
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,10 +99,10 @@ int main (int argc, char* argv[])
|
||||||
finalcut::FDialog dgl(&app);
|
finalcut::FDialog dgl(&app);
|
||||||
dgl.setModal();
|
dgl.setModal();
|
||||||
dgl.setText ("UNIX select");
|
dgl.setText ("UNIX select");
|
||||||
int w = 20;
|
std::size_t w = 20;
|
||||||
int h = 13;
|
std::size_t h = 13;
|
||||||
int x = (app.getDesktopWidth() - w) / 2;
|
int x = int(app.getDesktopWidth() - w) / 2;
|
||||||
int y = (app.getDesktopHeight() - h) / 2;
|
int y = int(app.getDesktopHeight() - h) / 2;
|
||||||
dgl.setGeometry (x, y, w, h);
|
dgl.setGeometry (x, y, w, h);
|
||||||
|
|
||||||
// Create a button group
|
// Create a button group
|
||||||
|
|
|
@ -56,7 +56,7 @@ void Keyboard::onKeyPress (finalcut::FKeyEvent* ev)
|
||||||
int key_id = ev->key();
|
int key_id = ev->key();
|
||||||
bool is_last_line = false;
|
bool is_last_line = false;
|
||||||
|
|
||||||
if ( getPrintPos().getY() == getDesktopHeight() )
|
if ( getPrintPos().getY() == int(getDesktopHeight()) )
|
||||||
is_last_line = true;
|
is_last_line = true;
|
||||||
|
|
||||||
print() << "Key " << getKeyName(key_id).c_str()
|
print() << "Key " << getKeyName(key_id).c_str()
|
||||||
|
|
|
@ -80,8 +80,8 @@ void Mandelbrot::draw()
|
||||||
xoffset = 2;
|
xoffset = 2;
|
||||||
yoffset = 2;
|
yoffset = 2;
|
||||||
current_line = 0;
|
current_line = 0;
|
||||||
Cols = getClientWidth();
|
Cols = int(getClientWidth());
|
||||||
Lines = getClientHeight();
|
Lines = int(getClientHeight());
|
||||||
|
|
||||||
dX = (x_max - x_min) / (Cols - 1);
|
dX = (x_max - x_min) / (Cols - 1);
|
||||||
dY = (y_max - y_min) / Lines;
|
dY = (y_max - y_min) / Lines;
|
||||||
|
@ -131,8 +131,8 @@ void Mandelbrot::onClose (finalcut::FCloseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Mandelbrot::adjustSize()
|
void Mandelbrot::adjustSize()
|
||||||
{
|
{
|
||||||
int h = getParentWidget()->getHeight() - 1;
|
std::size_t h = getParentWidget()->getHeight() - 1;
|
||||||
int w = getParentWidget()->getWidth() - 10;
|
std::size_t w = getParentWidget()->getWidth() - 10;
|
||||||
setGeometry(6, 1, w, h, false);
|
setGeometry(6, 1, w, h, false);
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,10 +337,10 @@ void Menu::defaultCallback (finalcut::FMenuList* mb)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Menu::adjustSize()
|
void Menu::adjustSize()
|
||||||
{
|
{
|
||||||
int pw = getParentWidget()->getWidth();
|
int pw = int(getParentWidget()->getWidth());
|
||||||
int ph = getParentWidget()->getHeight();
|
int ph = int(getParentWidget()->getHeight());
|
||||||
setX (1 + (pw - getWidth()) / 2, false);
|
setX (1 + (pw - int(getWidth())) / 2, false);
|
||||||
setY (1 + (ph - getHeight()) / 4, false);
|
setY (1 + (ph - int(getHeight())) / 4, false);
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,7 @@ class MouseDraw : public finalcut::FDialog
|
||||||
~MouseDraw();
|
~MouseDraw();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
virtual void onAccel (finalcut::FAccelEvent*);
|
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;
|
int old_w, old_h;
|
||||||
finalcut::FDialog::setGeometry (x, y, w, h, adjust);
|
finalcut::FDialog::setGeometry (x, y, w, h, adjust);
|
||||||
|
@ -416,7 +416,7 @@ void MouseDraw::onClose (finalcut::FCloseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MouseDraw::draw()
|
void MouseDraw::draw()
|
||||||
{
|
{
|
||||||
int y_max = getHeight();
|
int y_max = int(getHeight());
|
||||||
finalcut::FDialog::draw();
|
finalcut::FDialog::draw();
|
||||||
setColor();
|
setColor();
|
||||||
|
|
||||||
|
@ -452,8 +452,8 @@ void MouseDraw::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MouseDraw::drawBrush (int x, int y, bool swap_color)
|
void MouseDraw::drawBrush (int x, int y, bool swap_color)
|
||||||
{
|
{
|
||||||
int Cols = getWidth();
|
int Cols = int(getWidth());
|
||||||
int Lines = getHeight();
|
int Lines = int(getHeight());
|
||||||
|
|
||||||
if ( x > 10 && x < Cols && y > 2 && y < Lines )
|
if ( x > 10 && x < Cols && y > 2 && y < Lines )
|
||||||
{
|
{
|
||||||
|
@ -508,10 +508,9 @@ void MouseDraw::drawCanvas()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MouseDraw::adjustSize()
|
void MouseDraw::adjustSize()
|
||||||
{
|
{
|
||||||
int w = 60
|
std::size_t w = 60, h = 18;
|
||||||
, h = 18
|
int x = 1 + int((getParentWidget()->getWidth() - w) / 2);
|
||||||
, x = 1 + (getParentWidget()->getWidth() - w) / 2
|
int y = 1 + int((getParentWidget()->getHeight() - h) / 2);
|
||||||
, y = 1 + (getParentWidget()->getHeight() - h) / 2;
|
|
||||||
setGeometry (x, y, w, h, false);
|
setGeometry (x, y, w, h, false);
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,8 +66,8 @@ bool keyPressed()
|
||||||
void term_boundaries (int& x, int& y)
|
void term_boundaries (int& x, int& y)
|
||||||
{
|
{
|
||||||
// checks and corrects the terminal boundaries
|
// checks and corrects the terminal boundaries
|
||||||
int term_width = app->getDesktopWidth();
|
int term_width = int(app->getDesktopWidth());
|
||||||
int term_height = app->getDesktopHeight();
|
int term_height = int(app->getDesktopHeight());
|
||||||
|
|
||||||
if ( x < 0 )
|
if ( x < 0 )
|
||||||
x = 0;
|
x = 0;
|
||||||
|
@ -152,9 +152,9 @@ int main (int argc, char* argv[])
|
||||||
app = &TermApp;
|
app = &TermApp;
|
||||||
|
|
||||||
// Get screen dimension
|
// Get screen dimension
|
||||||
xmax = TermApp.getDesktopWidth() - 1;
|
xmax = int(TermApp.getDesktopWidth() - 1);
|
||||||
ymax = TermApp.getDesktopHeight() - 1;
|
ymax = int(TermApp.getDesktopHeight() - 1);
|
||||||
finalcut::FString line(xmax + 1, '-');
|
finalcut::FString line(std::size_t(xmax) + 1, '-');
|
||||||
|
|
||||||
// Place the cursor in the upper left corner
|
// Place the cursor in the upper left corner
|
||||||
TermApp.setTermXY(0,0);
|
TermApp.setTermXY(0,0);
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Scrollview : public finalcut::FScrollView
|
||||||
~Scrollview ();
|
~Scrollview ();
|
||||||
|
|
||||||
// Mutator
|
// Mutator
|
||||||
void setScrollSize (int, int);
|
void setScrollSize (std::size_t, std::size_t);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
|
@ -83,9 +83,9 @@ Scrollview::Scrollview (finalcut::FWidget* parent)
|
||||||
{
|
{
|
||||||
// Sets the navigation button geometry
|
// Sets the navigation button geometry
|
||||||
go_east.setGeometry (1, 1, 5, 1);
|
go_east.setGeometry (1, 1, 5, 1);
|
||||||
go_south.setGeometry (getScrollWidth() - 5, 1, 5, 1);
|
go_south.setGeometry (int(getScrollWidth()) - 5, 1, 5, 1);
|
||||||
go_west.setGeometry (getScrollWidth() - 5, getScrollHeight() - 2, 5, 1);
|
go_west.setGeometry (int(getScrollWidth()) - 5, int(getScrollHeight()) - 2, 5, 1);
|
||||||
go_north.setGeometry (1, getScrollHeight() - 2, 5, 1);
|
go_north.setGeometry (1, int(getScrollHeight()) - 2, 5, 1);
|
||||||
|
|
||||||
// Add scroll function callbacks to the buttons
|
// Add scroll function callbacks to the buttons
|
||||||
go_east.addCallback
|
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);
|
FScrollView::setScrollSize (width, height);
|
||||||
go_south.setPos (width - 5, 1);
|
go_south.setPos (int(width) - 5, 1);
|
||||||
go_west.setPos (width - 5, height - 1);
|
go_west.setPos (int(width) - 5, int(height) - 1);
|
||||||
go_north.setPos (1, height - 1);
|
go_north.setPos (1, int(height) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -135,11 +135,11 @@ void Scrollview::draw()
|
||||||
setColor (wc.label_inactive_fg, wc.dialog_bg);
|
setColor (wc.label_inactive_fg, wc.dialog_bg);
|
||||||
clearArea();
|
clearArea();
|
||||||
|
|
||||||
for (int y = 0; y < getScrollHeight(); y++)
|
for (int y = 0; y < int(getScrollHeight()); y++)
|
||||||
{
|
{
|
||||||
setPrintPos (1, 1 + 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));
|
print (32 + ((x + y) % 0x5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ void Scrollview::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Scrollview::cb_go_east (finalcut::FWidget*, data_ptr)
|
void Scrollview::cb_go_east (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
scrollToX (getScrollWidth() - getViewportWidth() + 1);
|
scrollToX (int(getScrollWidth() - getViewportWidth()) + 1);
|
||||||
go_south.setFocus();
|
go_south.setFocus();
|
||||||
go_east.redraw();
|
go_east.redraw();
|
||||||
go_south.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)
|
void Scrollview::cb_go_south (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
scrollToY (getScrollHeight() - getViewportHeight() + 1);
|
scrollToY (int(getScrollHeight() - getViewportHeight()) + 1);
|
||||||
go_west.setFocus();
|
go_west.setFocus();
|
||||||
go_south.redraw();
|
go_south.redraw();
|
||||||
go_west.redraw();
|
go_west.redraw();
|
||||||
|
|
|
@ -77,9 +77,9 @@ AttribDlg::AttribDlg (finalcut::FWidget* parent)
|
||||||
+ finalcut::FString(getTermType())
|
+ 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);
|
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);
|
back_button.addAccelerator(finalcut::fc::Fkey_left);
|
||||||
|
|
||||||
// Add function callbacks
|
// Add function callbacks
|
||||||
|
@ -155,8 +155,8 @@ void AttribDlg::cb_back (finalcut::FWidget*, data_ptr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void AttribDlg::adjustSize()
|
void AttribDlg::adjustSize()
|
||||||
{
|
{
|
||||||
int x = ((getParentWidget()->getWidth() - getWidth()) / 2);
|
int x = int((getParentWidget()->getWidth() - getWidth()) / 2);
|
||||||
int y = ((getParentWidget()->getHeight() - getHeight()) / 2) + 1;
|
int y = int((getParentWidget()->getHeight() - getHeight()) / 2) + 1;
|
||||||
|
|
||||||
if ( x < 1 )
|
if ( x < 1 )
|
||||||
x = 1;
|
x = 1;
|
||||||
|
@ -165,8 +165,8 @@ void AttribDlg::adjustSize()
|
||||||
y = 1;
|
y = 1;
|
||||||
|
|
||||||
setGeometry(x, y, 69, 21, false);
|
setGeometry(x, y, 69, 21, false);
|
||||||
next_button.setGeometry(getWidth() - 13, getHeight() - 4, 10, 1, false);
|
next_button.setGeometry(int(getWidth()) - 13, int(getHeight()) - 4, 10, 1, false);
|
||||||
back_button.setGeometry(getWidth() - 25, getHeight() - 4, 10, 1, false);
|
back_button.setGeometry(int(getWidth()) - 25, int(getHeight()) - 4, 10, 1, false);
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ void AttribDemo::draw()
|
||||||
// test alternate character set
|
// test alternate character set
|
||||||
printAltCharset();
|
printAltCharset();
|
||||||
|
|
||||||
for (int y = 0; y < getParentWidget()->getHeight() - 7; y++)
|
for (int y = 0; y < int(getParentWidget()->getHeight()) - 7; y++)
|
||||||
{
|
{
|
||||||
setPrintPos (1, 2 + y);
|
setPrintPos (1, 2 + y);
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ void Timer::onTimer (finalcut::FTimerEvent* ev)
|
||||||
bool is_last_line = false;
|
bool is_last_line = false;
|
||||||
int timer_id = ev->timerId();
|
int timer_id = ev->timerId();
|
||||||
|
|
||||||
if ( getPrintPos().getY() == getDesktopHeight() )
|
if ( getPrintPos().getY() == int(getDesktopHeight()) )
|
||||||
is_last_line = true;
|
is_last_line = true;
|
||||||
|
|
||||||
setColor (short(1 + timer_id), finalcut::fc::Default);
|
setColor (short(1 + timer_id), finalcut::fc::Default);
|
||||||
|
|
|
@ -105,7 +105,7 @@ void Transparent::draw()
|
||||||
|
|
||||||
finalcut::FString line(getClientWidth(), wchar_t('.'));
|
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);
|
setPrintPos (2, 2 + n);
|
||||||
print(line);
|
print(line);
|
||||||
|
@ -264,7 +264,7 @@ void MainWindow::onShow (finalcut::FShowEvent*)
|
||||||
void MainWindow::onTimer (finalcut::FTimerEvent*)
|
void MainWindow::onTimer (finalcut::FTimerEvent*)
|
||||||
{
|
{
|
||||||
wchar_t first_Char[2];
|
wchar_t first_Char[2];
|
||||||
uInt length = line1.getLength();
|
std::size_t length = line1.getLength();
|
||||||
first_Char[0] = line1[0];
|
first_Char[0] = line1[0];
|
||||||
first_Char[1] = line2[0];
|
first_Char[1] = line2[0];
|
||||||
line1 = line1.right(length - 1) + first_Char[0];
|
line1 = line1.right(length - 1) + first_Char[0];
|
||||||
|
|
|
@ -297,7 +297,7 @@ Treeview::~Treeview() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Treeview::adjustSize()
|
void Treeview::adjustSize()
|
||||||
{
|
{
|
||||||
int h = getParentWidget()->getHeight() - 4;
|
std::size_t h = getParentWidget()->getHeight() - 4;
|
||||||
setHeight (h, false);
|
setHeight (h, false);
|
||||||
int X = int((getParentWidget()->getWidth() - getWidth()) / 2);
|
int X = int((getParentWidget()->getWidth() - getWidth()) / 2);
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ void Treeview::adjustSize()
|
||||||
if ( initialized )
|
if ( initialized )
|
||||||
{
|
{
|
||||||
listView.setHeight (getHeight() - 6, false);
|
listView.setHeight (getHeight() - 6, false);
|
||||||
Quit.setY(getHeight() - 4);
|
Quit.setY(int(getHeight()) - 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
|
|
|
@ -780,7 +780,7 @@ void MyDialog::initWidgetsCallbacks()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void MyDialog::adjustSize()
|
void MyDialog::adjustSize()
|
||||||
{
|
{
|
||||||
int h = getParentWidget()->getHeight() - 4;
|
std::size_t h = getParentWidget()->getHeight() - 4;
|
||||||
setHeight (h, false);
|
setHeight (h, false);
|
||||||
int X = int((getParentWidget()->getWidth() - getWidth()) / 2);
|
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)
|
void MyDialog::cb_terminfo (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
int x = getDesktopWidth();
|
std::size_t x = getDesktopWidth();
|
||||||
int y = getDesktopHeight();
|
std::size_t y = getDesktopHeight();
|
||||||
finalcut::FMessageBox info1 \
|
finalcut::FMessageBox info1 \
|
||||||
(
|
(
|
||||||
"Environment"
|
"Environment"
|
||||||
|
@ -961,10 +961,10 @@ void MyDialog::cb_updateNumber (finalcut::FWidget* widget, data_ptr data)
|
||||||
finalcut::FListBox* list = static_cast<finalcut::FListBox*>(widget);
|
finalcut::FListBox* list = static_cast<finalcut::FListBox*>(widget);
|
||||||
finalcut::FLabel* num = static_cast<finalcut::FLabel*>(data);
|
finalcut::FLabel* num = static_cast<finalcut::FLabel*>(data);
|
||||||
int select_num = 0;
|
int select_num = 0;
|
||||||
uInt count = list->getCount();
|
std::size_t count = list->getCount();
|
||||||
|
|
||||||
for (uInt n = 1; n <= count; n++)
|
for (std::size_t n = 1; n <= count; n++)
|
||||||
if ( list->isSelected(int(n)) )
|
if ( list->isSelected(n) )
|
||||||
select_num++;
|
select_num++;
|
||||||
|
|
||||||
num->clear();
|
num->clear();
|
||||||
|
@ -1006,7 +1006,7 @@ void MyDialog::cb_view (finalcut::FWidget*, data_ptr data)
|
||||||
view->setGeometry ( 1 + int((getRootWidget()->getWidth() - 60) / 2),
|
view->setGeometry ( 1 + int((getRootWidget()->getWidth() - 60) / 2),
|
||||||
int(getRootWidget()->getHeight() / 6),
|
int(getRootWidget()->getHeight() / 6),
|
||||||
60,
|
60,
|
||||||
int(getRootWidget()->getHeight() * 3 / 4) );
|
getRootWidget()->getHeight() * 3 / 4 );
|
||||||
view->setResizeable();
|
view->setResizeable();
|
||||||
|
|
||||||
std::string line = "";
|
std::string line = "";
|
||||||
|
|
|
@ -83,7 +83,7 @@ Watch::Watch (FWidget* parent)
|
||||||
, quit_btn(L"&Quit", this)
|
, quit_btn(L"&Quit", this)
|
||||||
{
|
{
|
||||||
setText ("Watch");
|
setText ("Watch");
|
||||||
int pw = getParentWidget()->getWidth();
|
int pw = int(getParentWidget()->getWidth());
|
||||||
setGeometry (1 + (pw - 22) / 2, 3, 22, 13);
|
setGeometry (1 + (pw - 22) / 2, 3, 22, 13);
|
||||||
|
|
||||||
// Labels
|
// Labels
|
||||||
|
@ -198,7 +198,7 @@ void Watch::cb_seconds (finalcut::FWidget*, data_ptr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void Watch::adjustSize()
|
void Watch::adjustSize()
|
||||||
{
|
{
|
||||||
int pw = getParentWidget()->getWidth();
|
int pw = int(getParentWidget()->getWidth());
|
||||||
setX (1 + (pw - 22) / 2, false);
|
setX (1 + (pw - 22) / 2, false);
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ SmallWindow::SmallWindow (finalcut::FWidget* parent)
|
||||||
right_arrow.setForegroundColor (wc.label_inactive_fg);
|
right_arrow.setForegroundColor (wc.label_inactive_fg);
|
||||||
right_arrow.setEmphasis();
|
right_arrow.setEmphasis();
|
||||||
right_arrow.ignorePadding();
|
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 = "menu";
|
||||||
top_left_label.setForegroundColor (wc.label_inactive_fg);
|
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.setAlignment (finalcut::fc::alignRight);
|
||||||
top_right_label.setForegroundColor (wc.label_inactive_fg);
|
top_right_label.setForegroundColor (wc.label_inactive_fg);
|
||||||
top_right_label.setEmphasis();
|
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"
|
finalcut::FString bottom_label_text = "resize\n"
|
||||||
"corner\n";
|
"corner\n";
|
||||||
|
@ -131,9 +131,9 @@ void SmallWindow::adjustSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
finalcut::FDialog::adjustSize();
|
finalcut::FDialog::adjustSize();
|
||||||
right_arrow.setGeometry (getWidth() - 1, 2, 1, 1);
|
right_arrow.setGeometry (int(getWidth()) - 1, 2, 1, 1);
|
||||||
top_right_label.setGeometry (getClientWidth() - 5, 1, 6, 1);
|
top_right_label.setGeometry (int(getClientWidth()) - 5, 1, 6, 1);
|
||||||
bottom_label.setGeometry (1, getClientHeight() - 2, getClientWidth(), 3);
|
bottom_label.setGeometry (1, int(getClientHeight()) - 2, getClientWidth(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -368,12 +368,12 @@ void Window::activateWindow (finalcut::FDialog* win)
|
||||||
void Window::adjustSize()
|
void Window::adjustSize()
|
||||||
{
|
{
|
||||||
std::vector<win_data*>::const_iterator iter, first;
|
std::vector<win_data*>::const_iterator iter, first;
|
||||||
int w = getRootWidget()->getWidth()
|
std::size_t w = getRootWidget()->getWidth();
|
||||||
, h = getRootWidget()->getHeight()
|
std::size_t h = getRootWidget()->getHeight();
|
||||||
, X = int(1 + (w - 40) / 2)
|
int X = int(1 + (w - 40) / 2)
|
||||||
, Y = int(1 + (h - 22) / 2)
|
, Y = int(1 + (h - 22) / 2)
|
||||||
, dx = ( w > 80 ) ? (w - 80) / 2 : 0
|
, dx = ( w > 80 ) ? int(w - 80) / 2 : 0
|
||||||
, dy = ( h > 24 ) ? (h - 24) / 2 : 0;
|
, dy = ( h > 24 ) ? int(h - 24) / 2 : 0;
|
||||||
|
|
||||||
if ( Y < 2 )
|
if ( Y < 2 )
|
||||||
Y = 2;
|
Y = 2;
|
||||||
|
@ -436,10 +436,10 @@ void Window::cb_createWindows (finalcut::FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
std::vector<win_data*>::const_iterator iter, first;
|
std::vector<win_data*>::const_iterator iter, first;
|
||||||
iter = first = windows.begin();
|
iter = first = windows.begin();
|
||||||
int w = getRootWidget()->getWidth()
|
std::size_t w = getRootWidget()->getWidth();
|
||||||
, h = getRootWidget()->getHeight()
|
std::size_t h = getRootWidget()->getHeight();
|
||||||
, dx = ( w > 80 ) ? (w - 80) / 2 : 0
|
int dx = ( w > 80 ) ? int(w - 80) / 2 : 0;
|
||||||
, dy = ( h > 24 ) ? (h - 24) / 2 : 0;
|
int dy = ( h > 24 ) ? int(h - 24) / 2 : 0;
|
||||||
|
|
||||||
while ( iter != windows.end() )
|
while ( iter != windows.end() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -247,12 +247,12 @@
|
||||||
y="93.333893"
|
y="93.333893"
|
||||||
transform="scale(0.95126779,1.0512287)"
|
transform="scale(0.95126779,1.0512287)"
|
||||||
id="text37-5"
|
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
|
<tspan
|
||||||
x="160.94762"
|
x="160.94762"
|
||||||
y="93.333893"
|
y="93.333893"
|
||||||
id="tspan3006-1"
|
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>
|
</text>
|
||||||
<g
|
<g
|
||||||
id="g23"
|
id="g23"
|
||||||
|
@ -293,11 +293,11 @@
|
||||||
y="91.775856"
|
y="91.775856"
|
||||||
transform="scale(0.95126779,1.0512287)"
|
transform="scale(0.95126779,1.0512287)"
|
||||||
id="text37"
|
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
|
<tspan
|
||||||
x="158.56929"
|
x="158.56929"
|
||||||
y="91.775856"
|
y="91.775856"
|
||||||
id="tspan3006"
|
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>
|
</text>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
|
@ -62,7 +62,7 @@ INCLUDE_HEADERS = \
|
||||||
|
|
||||||
# compiler parameter
|
# compiler parameter
|
||||||
CXX = clang++
|
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
|
MAKEFILE = -f Makefile.clang
|
||||||
LDFLAGS = $(TERMCAP) -lgpm
|
LDFLAGS = $(TERMCAP) -lgpm
|
||||||
INCLUDES = -Iinclude
|
INCLUDES = -Iinclude
|
||||||
|
@ -148,7 +148,7 @@ all: dep $(OBJS)
|
||||||
$(LIB): all
|
$(LIB): all
|
||||||
|
|
||||||
debug:
|
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:
|
profile:
|
||||||
$(MAKE) $(MAKEFILE) PROFILE="-pg"
|
$(MAKE) $(MAKEFILE) PROFILE="-pg"
|
||||||
|
|
|
@ -62,7 +62,7 @@ INCLUDE_HEADERS = \
|
||||||
|
|
||||||
# compiler parameter
|
# compiler parameter
|
||||||
CXX = g++
|
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
|
MAKEFILE = -f Makefile.gcc
|
||||||
LDFLAGS = $(TERMCAP) -lgpm
|
LDFLAGS = $(TERMCAP) -lgpm
|
||||||
INCLUDES = -Iinclude
|
INCLUDES = -Iinclude
|
||||||
|
|
|
@ -263,7 +263,7 @@ void FButton::setText (const FString& txt)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButton::hide()
|
void FButton::hide()
|
||||||
{
|
{
|
||||||
int s, f, size;
|
std::size_t s, f, size;
|
||||||
short fg, bg;
|
short fg, bg;
|
||||||
char* blank;
|
char* blank;
|
||||||
FWidget* parent_widget = getParentWidget();
|
FWidget* parent_widget = getParentWidget();
|
||||||
|
@ -285,12 +285,12 @@ void FButton::hide()
|
||||||
f = isFlat() ? 1 : 0;
|
f = isFlat() ? 1 : 0;
|
||||||
size = getWidth() + s + (f << 1);
|
size = getWidth() + s + (f << 1);
|
||||||
|
|
||||||
if ( size < 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
blank = new char[std::size_t(size) + 1];
|
blank = new char[size + 1];
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -298,12 +298,12 @@ void FButton::hide()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset(blank, ' ', std::size_t(size));
|
std::memset(blank, ' ', size);
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y = 0; y < 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);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,14 +489,12 @@ void FButton::getButtonState()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uChar FButton::getHotkey()
|
uChar FButton::getHotkey()
|
||||||
{
|
{
|
||||||
uInt length;
|
|
||||||
|
|
||||||
if ( text.isEmpty() )
|
if ( text.isEmpty() )
|
||||||
return 0;
|
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
|
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
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
wchar_t* txt = src;
|
wchar_t* txt = src;
|
||||||
|
|
||||||
for (uInt i = 0; i < length; i++)
|
for (std::size_t i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
if ( i < length && txt[i] == L'&' && pos == -1 )
|
if ( i < length && txt[i] == L'&' && pos == -1 )
|
||||||
{
|
{
|
||||||
|
@ -582,7 +582,7 @@ inline int FButton::clickAnimationIndent (FWidget* parent_widget)
|
||||||
setColor ( parent_widget->getForegroundColor()
|
setColor ( parent_widget->getForegroundColor()
|
||||||
, parent_widget->getBackgroundColor() );
|
, parent_widget->getBackgroundColor() );
|
||||||
|
|
||||||
for (int y = 1; y <= getHeight(); y++)
|
for (int y = 1; y <= int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
setPrintPos (1, y);
|
setPrintPos (1, y);
|
||||||
print (' '); // clear one left █
|
print (' '); // clear one left █
|
||||||
|
@ -602,12 +602,12 @@ inline void FButton::clearRightMargin (FWidget* parent_widget)
|
||||||
setColor ( parent_widget->getForegroundColor()
|
setColor ( parent_widget->getForegroundColor()
|
||||||
, parent_widget->getBackgroundColor() );
|
, parent_widget->getBackgroundColor() );
|
||||||
|
|
||||||
for (int y = 1; y <= getHeight(); y++)
|
for (int y = 1; y <= int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true); // Light background
|
setReverse(true); // Light background
|
||||||
|
|
||||||
setPrintPos (1 + getWidth(), y);
|
setPrintPos (1 + int(getWidth()), y);
|
||||||
print (' '); // clear right
|
print (' '); // clear right
|
||||||
|
|
||||||
if ( is.active && isMonochron() )
|
if ( is.active && isMonochron() )
|
||||||
|
@ -622,7 +622,7 @@ inline void FButton::drawMarginLeft()
|
||||||
|
|
||||||
setColor (getForegroundColor(), button_bg);
|
setColor (getForegroundColor(), button_bg);
|
||||||
|
|
||||||
for (int y = 0; y < getHeight(); y++)
|
for (int y = 0; y < int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
setPrintPos (1 + indent, 1 + y);
|
setPrintPos (1 + indent, 1 + y);
|
||||||
|
|
||||||
|
@ -638,9 +638,9 @@ inline void FButton::drawMarginRight()
|
||||||
{
|
{
|
||||||
// Print right margin
|
// 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 )
|
if ( isMonochron() && is.active_focus && y == vcenter_offset )
|
||||||
print (fc::BlackLeftPointingPointer); // ◄
|
print (fc::BlackLeftPointingPointer); // ◄
|
||||||
|
@ -661,15 +661,15 @@ inline void FButton::drawTopBottomBackground()
|
||||||
{
|
{
|
||||||
setPrintPos (2 + indent, 1 + 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); // █
|
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);
|
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); // █
|
print (space); // █
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -678,7 +678,7 @@ inline void FButton::drawTopBottomBackground()
|
||||||
inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
center_offset = int((getWidth() - txtlength - 1) / 2);
|
center_offset = int((int(getWidth()) - txtlength - 1) / 2);
|
||||||
setPrintPos (2 + indent, 1 + vcenter_offset);
|
setPrintPos (2 + indent, 1 + vcenter_offset);
|
||||||
setColor (button_fg, button_bg);
|
setColor (button_fg, button_bg);
|
||||||
|
|
||||||
|
@ -700,7 +700,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
||||||
setBold();
|
setBold();
|
||||||
|
|
||||||
for ( int z = 0
|
for ( int z = 0
|
||||||
; pos < center_offset + txtlength && z < getWidth() - 2
|
; pos < center_offset + txtlength && z < int(getWidth()) - 2
|
||||||
; z++, pos++)
|
; z++, pos++)
|
||||||
{
|
{
|
||||||
if ( (z == hotkeypos) && is.active )
|
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
|
// Print ellipsis
|
||||||
setPrintPos (getWidth() + indent - 2, 1);
|
setPrintPos (int(getWidth()) + indent - 2, 1);
|
||||||
print (L"..");
|
print (L"..");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is.active_focus && (isMonochron() || getMaxColor() < 16) )
|
if ( is.active_focus && (isMonochron() || getMaxColor() < 16) )
|
||||||
unsetBold();
|
unsetBold();
|
||||||
|
|
||||||
for (pos = center_offset + txtlength; pos < getWidth() - 2; pos++)
|
for (pos = center_offset + txtlength; pos < int(getWidth()) - 2; pos++)
|
||||||
print (space); // █
|
print (space); // █
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ bool FButtonGroup::hasCheckedButton() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButtonGroup::hide()
|
void FButtonGroup::hide()
|
||||||
{
|
{
|
||||||
int size;
|
std::size_t size;
|
||||||
short fg, bg;
|
short fg, bg;
|
||||||
char* blank;
|
char* blank;
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
|
@ -223,12 +223,12 @@ void FButtonGroup::hide()
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
size = getWidth();
|
size = getWidth();
|
||||||
|
|
||||||
if ( size < 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
blank = new char[std::size_t(size) + 1];
|
blank = new char[size + 1];
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -236,10 +236,10 @@ void FButtonGroup::hide()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset(blank, ' ', std::size_t(size));
|
std::memset(blank, ' ', size);
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y = 0; y < getHeight(); y++)
|
for (int y = 0; y < int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
FWidget::setPrintPos (1, 1 + y);
|
FWidget::setPrintPos (1, 1 + y);
|
||||||
print (blank);
|
print (blank);
|
||||||
|
@ -443,14 +443,12 @@ void FButtonGroup::cb_buttonToggled (FWidget* widget, data_ptr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uChar FButtonGroup::getHotkey()
|
uChar FButtonGroup::getHotkey()
|
||||||
{
|
{
|
||||||
uInt length;
|
|
||||||
|
|
||||||
if ( text.isEmpty() )
|
if ( text.isEmpty() )
|
||||||
return 0;
|
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
|
try
|
||||||
{
|
{
|
||||||
|
@ -512,7 +510,7 @@ void FButtonGroup::drawLabel()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FString txt = " " + text + " ";
|
FString txt = " " + text + " ";
|
||||||
uInt length = txt.getLength();
|
std::size_t length = txt.getLength();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -527,7 +525,7 @@ void FButtonGroup::drawLabel()
|
||||||
wchar_t* src = const_cast<wchar_t*>(txt.wc_str());
|
wchar_t* src = const_cast<wchar_t*>(txt.wc_str());
|
||||||
wchar_t* dest = const_cast<wchar_t*>(LabelText);
|
wchar_t* dest = const_cast<wchar_t*>(LabelText);
|
||||||
unsetViewportPrint();
|
unsetViewportPrint();
|
||||||
hotkeypos = getHotkeyPos(src, dest, uInt(length));
|
hotkeypos = getHotkeyPos(src, dest, length);
|
||||||
|
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != -1 )
|
||||||
length--;
|
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
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + 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 isActive = ((flags & fc::active) != 0);
|
||||||
bool isNoUnderline = ((flags & fc::no_underline) != 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = getWidth();
|
width = int(getWidth());
|
||||||
height = getHeight();
|
height = int(getHeight());
|
||||||
|
|
||||||
// Avoid to move widget completely outside the terminal
|
// 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;
|
setPos_error = true;
|
||||||
return;
|
return;
|
||||||
|
@ -256,7 +259,7 @@ void FDialog::setPos (int x, int y, bool)
|
||||||
{
|
{
|
||||||
if ( dy > 0 )
|
if ( dy > 0 )
|
||||||
restoreVTerm ( old_x + width + rsw - dx, old_y
|
restoreVTerm ( old_x + width + rsw - dx, old_y
|
||||||
, dx, getHeight() + bsh - dy );
|
, dx, height + bsh - dy );
|
||||||
else
|
else
|
||||||
restoreVTerm ( old_x + width + rsw - dx, old_y + std::abs(dy)
|
restoreVTerm ( old_x + width + rsw - dx, old_y + std::abs(dy)
|
||||||
, dx, height + bsh - 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;
|
setSize_error = false;
|
||||||
|
|
||||||
|
@ -339,10 +342,10 @@ void FDialog::setSize (int w, int h, bool adjust)
|
||||||
|
|
||||||
int x = getTermX()
|
int x = getTermX()
|
||||||
, y = getTermY()
|
, y = getTermY()
|
||||||
, old_width = getWidth()
|
, old_width = int(getWidth())
|
||||||
, old_height = getHeight()
|
, old_height = int(getHeight())
|
||||||
, dw = old_width - w
|
, dw = old_width - int(w)
|
||||||
, dh = old_height - h;
|
, dh = old_height - int(h);
|
||||||
const FPoint& shadow = getShadow();
|
const FPoint& shadow = getShadow();
|
||||||
int rsw = shadow.getX(); // right shadow width;
|
int rsw = shadow.getX(); // right shadow width;
|
||||||
int bsh = shadow.getY(); // bottom shadow height
|
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
|
// restoring the non-covered terminal areas
|
||||||
if ( dw > 0 )
|
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 )
|
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();
|
redraw();
|
||||||
|
|
||||||
|
@ -406,17 +409,17 @@ bool FDialog::reduceHeight (int n)
|
||||||
if ( ! isResizeable() )
|
if ( ! isResizeable() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setSize (getWidth(), getHeight() - n);
|
setSize (getWidth(), getHeight() - std::size_t(n));
|
||||||
return ! setSize_error;
|
return ! setSize_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FDialog::expandHeight (int n)
|
bool FDialog::expandHeight (int n)
|
||||||
{
|
{
|
||||||
if ( ! isResizeable() || getHeight() + getY() > getMaxHeight() )
|
if ( ! isResizeable() || getHeight() + std::size_t(getY()) > getMaxHeight() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setSize (getWidth(), getHeight() + n);
|
setSize (getWidth(), getHeight() + std::size_t(n));
|
||||||
return ! setSize_error;
|
return ! setSize_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,17 +429,17 @@ bool FDialog::reduceWidth (int n)
|
||||||
if ( ! isResizeable() )
|
if ( ! isResizeable() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setSize (getWidth() - n, getHeight());
|
setSize (getWidth() - std::size_t(n), getHeight());
|
||||||
return ! setSize_error;
|
return ! setSize_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FDialog::expandWidth (int n)
|
bool FDialog::expandWidth (int n)
|
||||||
{
|
{
|
||||||
if ( ! isResizeable() || getWidth() + getX() > getMaxWidth() )
|
if ( ! isResizeable() || getWidth() + std::size_t(getX()) > getMaxWidth() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setSize (getWidth() + n, getHeight());
|
setSize (getWidth() + std::size_t(n), getHeight());
|
||||||
return ! setSize_error;
|
return ! setSize_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,6 +518,8 @@ void FDialog::onKeyPress (FKeyEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::onMouseDown (FMouseEvent* ev)
|
void FDialog::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
|
int width = int(getWidth());
|
||||||
|
|
||||||
mouseStates ms =
|
mouseStates ms =
|
||||||
{
|
{
|
||||||
ev->getX(),
|
ev->getX(),
|
||||||
|
@ -532,7 +537,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
||||||
raiseActivateDialog();
|
raiseActivateDialog();
|
||||||
|
|
||||||
if ( ms.mouse_x >= 4
|
if ( ms.mouse_x >= 4
|
||||||
&& ms.mouse_x <= getWidth() - ms.zoom_btn
|
&& ms.mouse_x <= width - int(ms.zoom_btn)
|
||||||
&& ms.mouse_y == 1 )
|
&& ms.mouse_y == 1 )
|
||||||
titlebar_click_pos.setPoint (ev->getTermX(), ev->getTermY());
|
titlebar_click_pos.setPoint (ev->getTermX(), ev->getTermY());
|
||||||
else
|
else
|
||||||
|
@ -560,13 +565,13 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
||||||
// Click on titlebar: just activate
|
// Click on titlebar: just activate
|
||||||
if ( ev->getButton() == fc::RightButton
|
if ( ev->getButton() == fc::RightButton
|
||||||
&& ms.mouse_x >= 4
|
&& ms.mouse_x >= 4
|
||||||
&& ms.mouse_x <= getWidth()
|
&& ms.mouse_x <= width
|
||||||
&& ms.mouse_y == 1 )
|
&& ms.mouse_y == 1 )
|
||||||
activateDialog();
|
activateDialog();
|
||||||
|
|
||||||
// Click on titlebar: lower + activate
|
// Click on titlebar: lower + activate
|
||||||
if ( ev->getButton() == fc::MiddleButton
|
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 )
|
&& ms.mouse_y == 1 )
|
||||||
lowerActivateDialog();
|
lowerActivateDialog();
|
||||||
}
|
}
|
||||||
|
@ -589,9 +594,9 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
||||||
, titlebar_y = titlebar_click_pos.getY();
|
, titlebar_y = titlebar_click_pos.getY();
|
||||||
|
|
||||||
if ( ! titlebar_click_pos.isNull()
|
if ( ! titlebar_click_pos.isNull()
|
||||||
&& titlebar_x > getTermX() + 3
|
&& titlebar_x > int(getTermX()) + 3
|
||||||
&& titlebar_x < getTermX() + getWidth()
|
&& titlebar_x < getTermX() + int(getWidth())
|
||||||
&& titlebar_y == getTermY() )
|
&& titlebar_y == int(getTermY()) )
|
||||||
{
|
{
|
||||||
FPoint deltaPos = ms.termPos - titlebar_click_pos;
|
FPoint deltaPos = ms.termPos - titlebar_click_pos;
|
||||||
move (deltaPos);
|
move (deltaPos);
|
||||||
|
@ -693,7 +698,7 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
}
|
}
|
||||||
else if ( isResizeable()
|
else if ( isResizeable()
|
||||||
&& ms.mouse_x >= 4
|
&& ms.mouse_x >= 4
|
||||||
&& ms.mouse_x <= getWidth() - ms.zoom_btn
|
&& ms.mouse_x <= int(getWidth() - ms.zoom_btn)
|
||||||
&& ms.mouse_y == 1 )
|
&& ms.mouse_y == 1 )
|
||||||
{
|
{
|
||||||
// Double click on titlebar
|
// Double click on titlebar
|
||||||
|
@ -828,7 +833,7 @@ void FDialog::draw()
|
||||||
clearArea();
|
clearArea();
|
||||||
drawBorder();
|
drawBorder();
|
||||||
drawTitleBar();
|
drawTitleBar();
|
||||||
setCursorPos(2, getHeight() - 1);
|
setCursorPos(2, int(getHeight()) - 1);
|
||||||
|
|
||||||
if ( (flags & fc::shadow) != 0 )
|
if ( (flags & fc::shadow) != 0 )
|
||||||
drawDialogShadow();
|
drawDialogShadow();
|
||||||
|
@ -1009,9 +1014,9 @@ void FDialog::initCloseMenuItem (FMenu* menu)
|
||||||
void FDialog::drawBorder()
|
void FDialog::drawBorder()
|
||||||
{
|
{
|
||||||
int x1 = 1
|
int x1 = 1
|
||||||
, x2 = 1 + getWidth() - 1
|
, x2 = 1 + int(getWidth()) - 1
|
||||||
, y1 = 2
|
, y1 = 2
|
||||||
, y2 = 1 + getHeight() - 1;
|
, y2 = 1 + int(getHeight()) - 1;
|
||||||
|
|
||||||
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isNull() )
|
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isNull() )
|
||||||
&& ! isZoomed() )
|
&& ! isZoomed() )
|
||||||
|
@ -1035,7 +1040,7 @@ void FDialog::drawBorder()
|
||||||
// Lower left corner border ⎣
|
// Lower left corner border ⎣
|
||||||
print (fc::NF_border_corner_lower_left);
|
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);
|
print (fc::NF_border_line_bottom);
|
||||||
|
|
||||||
setPrintPos (x2, y2);
|
setPrintPos (x2, y2);
|
||||||
|
@ -1193,7 +1198,8 @@ inline void FDialog::drawZoomedButton()
|
||||||
void FDialog::drawTextBar()
|
void FDialog::drawTextBar()
|
||||||
{
|
{
|
||||||
// Fill with spaces (left of the title)
|
// Fill with spaces (left of the title)
|
||||||
int center_offset
|
std::size_t center_offset
|
||||||
|
, width
|
||||||
, zoom_btn
|
, zoom_btn
|
||||||
, length
|
, length
|
||||||
, x;
|
, x;
|
||||||
|
@ -1206,9 +1212,10 @@ void FDialog::drawTextBar()
|
||||||
else
|
else
|
||||||
setColor (wc.titlebar_inactive_fg, wc.titlebar_inactive_bg);
|
setColor (wc.titlebar_inactive_fg, wc.titlebar_inactive_bg);
|
||||||
|
|
||||||
|
width = std::size_t(getWidth());
|
||||||
zoom_btn = getZoomButtonWidth();
|
zoom_btn = getZoomButtonWidth();
|
||||||
length = int(tb_text.getLength());
|
length = tb_text.getLength();
|
||||||
center_offset = int((getWidth() - length - MENU_BTN - zoom_btn) / 2);
|
center_offset = (width - length - MENU_BTN - zoom_btn) / 2;
|
||||||
|
|
||||||
for (x = 1; x <= center_offset; x++)
|
for (x = 1; x <= center_offset; x++)
|
||||||
print (' ');
|
print (' ');
|
||||||
|
@ -1216,18 +1223,18 @@ void FDialog::drawTextBar()
|
||||||
// Print title bar text
|
// Print title bar text
|
||||||
if ( ! tb_text.isEmpty() )
|
if ( ! tb_text.isEmpty() )
|
||||||
{
|
{
|
||||||
if ( length <= getWidth() - MENU_BTN - zoom_btn )
|
if ( length <= width - MENU_BTN - zoom_btn )
|
||||||
print (tb_text);
|
print (tb_text);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
print (tb_text.left(getWidth() - MENU_BTN - zoom_btn - 2));
|
print (tb_text.left(width - MENU_BTN - zoom_btn - 2));
|
||||||
print ("..");
|
print ("..");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill the rest of the bar
|
// 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 (' ');
|
print (' ');
|
||||||
|
|
||||||
if ( getMaxColor() < 16 )
|
if ( getMaxColor() < 16 )
|
||||||
|
@ -1358,7 +1365,7 @@ void FDialog::setZoomItem()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FDialog::getZoomButtonWidth()
|
inline std::size_t FDialog::getZoomButtonWidth()
|
||||||
{
|
{
|
||||||
if ( ! isResizeable() )
|
if ( ! isResizeable() )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1382,7 +1389,7 @@ inline void FDialog::deactivateZoomButton()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FDialog::activateZoomButton (mouseStates& ms)
|
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 )
|
|| ms.mouse_y != 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1396,8 +1403,8 @@ inline void FDialog::leaveZoomButton (mouseStates& ms)
|
||||||
{
|
{
|
||||||
bool zoom_button_pressed_before = zoom_button_pressed;
|
bool zoom_button_pressed_before = zoom_button_pressed;
|
||||||
|
|
||||||
if ( ms.mouse_x > getWidth() - ms.zoom_btn
|
if ( ms.mouse_x > int(getWidth() - ms.zoom_btn)
|
||||||
&& ms.mouse_x <= getWidth()
|
&& ms.mouse_x <= int(getWidth())
|
||||||
&& ms.mouse_y == 1
|
&& ms.mouse_y == 1
|
||||||
&& zoom_button_active )
|
&& zoom_button_active )
|
||||||
zoom_button_pressed = true;
|
zoom_button_pressed = true;
|
||||||
|
@ -1411,7 +1418,7 @@ inline void FDialog::leaveZoomButton (mouseStates& ms)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::pressZoomButton (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
|
|| ms.mouse_y != 1
|
||||||
|| ! zoom_button_pressed )
|
|| ! zoom_button_pressed )
|
||||||
return;
|
return;
|
||||||
|
@ -1555,9 +1562,9 @@ bool FDialog::isLowerRightResizeCorner (mouseStates& ms)
|
||||||
// x
|
// x
|
||||||
// -----xx
|
// -----xx
|
||||||
|
|
||||||
if ( (ms.mouse_x == getWidth() && ms.mouse_y == getHeight() - 1)
|
if ( (ms.mouse_x == int(getWidth()) && ms.mouse_y == int(getHeight()) - 1)
|
||||||
|| ( ( ms.mouse_x == getWidth() - 1
|
|| ( ( ms.mouse_x == int(getWidth()) - 1
|
||||||
|| ms.mouse_x == getWidth() ) && ms.mouse_y == getHeight() ) )
|
|| ms.mouse_x == int(getWidth()) ) && ms.mouse_y == int(getHeight()) ) )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1582,7 +1589,7 @@ void FDialog::resizeMouseDown (mouseStates& ms)
|
||||||
FPoint deltaPos = ms.termPos - lower_right_pos;
|
FPoint deltaPos = ms.termPos - lower_right_pos;
|
||||||
int w = lower_right_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
int w = lower_right_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
||||||
int h = lower_right_pos.getY() + deltaPos.getY() - getTermY() + 1;
|
int h = lower_right_pos.getY() + deltaPos.getY() - getTermY() + 1;
|
||||||
setSize (w, h);
|
setSize (std::size_t(w), std::size_t(h));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
drawBorder();
|
drawBorder();
|
||||||
|
@ -1615,17 +1622,17 @@ void FDialog::resizeMouseUpMove (mouseStates& ms, bool mouse_up)
|
||||||
int w, h;
|
int w, h;
|
||||||
FPoint deltaPos = ms.termPos - resize_click_pos;
|
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;
|
w = resize_click_pos.getX() + deltaPos.getX() - getTermX() + 1;
|
||||||
else
|
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;
|
h = resize_click_pos.getY() + deltaPos.getY() - getTermY() + 1;
|
||||||
else
|
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 )
|
if ( mouse_up )
|
||||||
|
|
|
@ -337,11 +337,10 @@ const FString FFileDialog::fileSaveChooser ( FWidget* parent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::adjustSize()
|
void FFileDialog::adjustSize()
|
||||||
{
|
{
|
||||||
int h
|
int X, Y;
|
||||||
, X
|
std::size_t max_width;
|
||||||
, Y
|
std::size_t max_height;
|
||||||
, max_width
|
std::size_t h;
|
||||||
, max_height;
|
|
||||||
FWidget* root_widget = getRootWidget();
|
FWidget* root_widget = getRootWidget();
|
||||||
|
|
||||||
if ( root_widget )
|
if ( root_widget )
|
||||||
|
@ -369,9 +368,9 @@ void FFileDialog::adjustSize()
|
||||||
Y = 1 + int((max_height - getHeight()) / 3);
|
Y = 1 + int((max_height - getHeight()) / 3);
|
||||||
setPos(X, Y, false);
|
setPos(X, Y, false);
|
||||||
filebrowser.setHeight (h - 8, false);
|
filebrowser.setHeight (h - 8, false);
|
||||||
hidden.setY (h - 4, false);
|
hidden.setY (int(h) - 4, false);
|
||||||
cancel.setY (h - 4, false);
|
cancel.setY (int(h) - 4, false);
|
||||||
open.setY (h - 4, false);
|
open.setY (int(h) - 4, false);
|
||||||
FDialog::adjustSize();
|
FDialog::adjustSize();
|
||||||
printPath(directory);
|
printPath(directory);
|
||||||
}
|
}
|
||||||
|
@ -381,8 +380,8 @@ void FFileDialog::adjustSize()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::init()
|
void FFileDialog::init()
|
||||||
{
|
{
|
||||||
static const int w = 42;
|
static const std::size_t w = 42;
|
||||||
static const int h = 15;
|
static const std::size_t h = 15;
|
||||||
int x, y;
|
int x, y;
|
||||||
FWidget* parent_widget;
|
FWidget* parent_widget;
|
||||||
|
|
||||||
|
@ -751,7 +750,7 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
filename.setText('/');
|
filename.setText('/');
|
||||||
else if ( ! dir_entries.empty() )
|
else if ( ! dir_entries.empty() )
|
||||||
{
|
{
|
||||||
int i = 1;
|
std::size_t i = 1;
|
||||||
std::vector<dir_entry>::const_iterator iter, last;
|
std::vector<dir_entry>::const_iterator iter, last;
|
||||||
const char* const baseName = \
|
const char* const baseName = \
|
||||||
basename(C_STR(lastdir.c_str()));
|
basename(C_STR(lastdir.c_str()));
|
||||||
|
@ -872,14 +871,14 @@ void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FFileDialog::cb_processRowChanged (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 )
|
if ( n == 0 )
|
||||||
return;
|
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 + '/' );
|
filename.setText( name + '/' );
|
||||||
else
|
else
|
||||||
filename.setText( name );
|
filename.setText( name );
|
||||||
|
|
|
@ -238,9 +238,9 @@ inline int FKeyboard::getTermcapKey()
|
||||||
for (int i = 0; keymap[i].tname[0] != 0; i++)
|
for (int i = 0; keymap[i].tname[0] != 0; i++)
|
||||||
{
|
{
|
||||||
char* k = keymap[i].string;
|
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;
|
std::size_t n;
|
||||||
|
|
||||||
|
@ -268,9 +268,9 @@ inline int FKeyboard::getMetaKey()
|
||||||
for (int i = 0; fc::Fmetakey[i].string[0] != 0; i++)
|
for (int i = 0; fc::Fmetakey[i].string[0] != 0; i++)
|
||||||
{
|
{
|
||||||
char* kmeta = fc::Fmetakey[i].string; // The string is never null
|
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;
|
std::size_t n;
|
||||||
|
|
||||||
|
@ -303,8 +303,8 @@ inline int FKeyboard::getSingleKey()
|
||||||
|
|
||||||
uChar firstchar = uChar(fifo_buf[0]);
|
uChar firstchar = uChar(fifo_buf[0]);
|
||||||
std::size_t n;
|
std::size_t n;
|
||||||
int keycode, len;
|
std::size_t len = 1;
|
||||||
len = 1;
|
int keycode;
|
||||||
|
|
||||||
// Look for a utf-8 character
|
// Look for a utf-8 character
|
||||||
if ( utf8_input && (firstchar & 0xc0) == 0xc0 )
|
if ( utf8_input && (firstchar & 0xc0) == 0xc0 )
|
||||||
|
@ -318,7 +318,7 @@ inline int FKeyboard::getSingleKey()
|
||||||
else if ( (firstchar & 0xf8) == 0xf0 )
|
else if ( (firstchar & 0xf8) == 0xf0 )
|
||||||
len = 4;
|
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);
|
utf8char[i] = char(fifo_buf[i] & 0xff);
|
||||||
|
|
||||||
keycode = UTF8decode(utf8char);
|
keycode = UTF8decode(utf8char);
|
||||||
|
|
|
@ -242,7 +242,7 @@ void FLabel::setText (const FString& txt)
|
||||||
void FLabel::hide()
|
void FLabel::hide()
|
||||||
{
|
{
|
||||||
short fg, bg;
|
short fg, bg;
|
||||||
int size;
|
std::size_t size;
|
||||||
char* blank;
|
char* blank;
|
||||||
FWidget* parent_widget = getParentWidget();
|
FWidget* parent_widget = getParentWidget();
|
||||||
|
|
||||||
|
@ -262,12 +262,12 @@ void FLabel::hide()
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
size = getWidth();
|
size = getWidth();
|
||||||
|
|
||||||
if ( size < 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
blank = new char[std::size_t(size) + 1];
|
blank = new char[size + 1];
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -275,9 +275,9 @@ void FLabel::hide()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset(blank, ' ', std::size_t(size));
|
std::memset(blank, ' ', size);
|
||||||
blank[getWidth()] = '\0';
|
blank[getWidth()] = '\0';
|
||||||
setPrintPos (1,1);
|
setPrintPos (1, 1);
|
||||||
print (blank);
|
print (blank);
|
||||||
delete[] blank;
|
delete[] blank;
|
||||||
}
|
}
|
||||||
|
@ -397,14 +397,12 @@ void FLabel::init()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uChar FLabel::getHotkey()
|
uChar FLabel::getHotkey()
|
||||||
{
|
{
|
||||||
uInt length;
|
|
||||||
|
|
||||||
if ( text.isEmpty() )
|
if ( text.isEmpty() )
|
||||||
return 0;
|
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
|
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
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
int hotkeypos = -1;
|
int hotkeypos = -1;
|
||||||
wchar_t* txt = src;
|
wchar_t* txt = src;
|
||||||
|
|
||||||
for (uInt i = 0; i < length; i++)
|
for (std::size_t i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
if ( i < length && txt[i] == L'&' && hotkeypos == -1 )
|
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 )
|
switch ( alignment )
|
||||||
{
|
{
|
||||||
case fc::alignLeft:
|
case fc::alignLeft:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case fc::alignCenter:
|
case fc::alignCenter:
|
||||||
if ( length < getWidth() )
|
if ( length < width )
|
||||||
return int((getWidth() - length) / 2);
|
return std::size_t((width - length) / 2);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case fc::alignRight:
|
case fc::alignRight:
|
||||||
if ( length < getWidth() )
|
if ( length < width )
|
||||||
return getWidth() - length;
|
return width - length;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -522,15 +524,16 @@ void FLabel::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLabel::drawMultiLine()
|
void FLabel::drawMultiLine()
|
||||||
{
|
{
|
||||||
uInt y = 0;
|
std::size_t y = 0;
|
||||||
uInt text_lines = uInt(multiline_text.size());
|
std::size_t text_lines = multiline_text.size();
|
||||||
bool hotkey_printed = false;
|
bool hotkey_printed = false;
|
||||||
|
|
||||||
while ( y < text_lines && y < uInt(getHeight()) )
|
while ( y < text_lines && y < std::size_t(getHeight()) )
|
||||||
{
|
{
|
||||||
wchar_t* label_text;
|
wchar_t* label_text;
|
||||||
int align_offset, hotkeypos = -1;
|
int hotkeypos = -1;
|
||||||
uInt length = multiline_text[y].getLength();
|
std::size_t align_offset;
|
||||||
|
std::size_t length = multiline_text[y].getLength();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -554,13 +557,13 @@ void FLabel::drawMultiLine()
|
||||||
|
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != -1 )
|
||||||
{
|
{
|
||||||
align_offset = getAlignOffset (int(length - 1));
|
align_offset = getAlignOffset(length - 1);
|
||||||
printLine (label_text, length - 1, hotkeypos, align_offset);
|
printLine (label_text, length - 1, hotkeypos, align_offset);
|
||||||
hotkey_printed = true;
|
hotkey_printed = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
align_offset = getAlignOffset (int(length));
|
align_offset = getAlignOffset(length);
|
||||||
printLine (label_text, length, -1, align_offset);
|
printLine (label_text, length, -1, align_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,8 +576,9 @@ void FLabel::drawMultiLine()
|
||||||
void FLabel::drawSingleLine()
|
void FLabel::drawSingleLine()
|
||||||
{
|
{
|
||||||
wchar_t* label_text;
|
wchar_t* label_text;
|
||||||
int hotkeypos = -1, align_offset;
|
int hotkeypos = -1;
|
||||||
uInt length = text.getLength();
|
std::size_t align_offset;
|
||||||
|
std::size_t length = text.getLength();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -592,18 +596,19 @@ void FLabel::drawSingleLine()
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
setPrintPos (1,1);
|
setPrintPos (1,1);
|
||||||
align_offset = getAlignOffset (int(length));
|
align_offset = getAlignOffset(length);
|
||||||
printLine (label_text, length, hotkeypos, align_offset);
|
printLine (label_text, length, hotkeypos, align_offset);
|
||||||
delete[] label_text;
|
delete[] label_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLabel::printLine ( wchar_t line[]
|
void FLabel::printLine ( wchar_t line[]
|
||||||
, uInt length
|
, std::size_t length
|
||||||
, int hotkeypos
|
, 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;
|
bool isActive, isNoUnderline;
|
||||||
isActive = ((flags & fc::active) != 0);
|
isActive = ((flags & fc::active) != 0);
|
||||||
isNoUnderline = ((flags & fc::no_underline) != 0);
|
isNoUnderline = ((flags & fc::no_underline) != 0);
|
||||||
|
@ -611,15 +616,15 @@ void FLabel::printLine ( wchar_t line[]
|
||||||
if ( align_offset > 0 )
|
if ( align_offset > 0 )
|
||||||
print (FString(align_offset, ' ')); // leading spaces
|
print (FString(align_offset, ' ')); // leading spaces
|
||||||
|
|
||||||
if ( length <= uInt(getWidth()) )
|
if ( length <= width )
|
||||||
to_char = int(length);
|
to_char = length;
|
||||||
else
|
else
|
||||||
to_char = getWidth() - 2;
|
to_char = width - 2;
|
||||||
|
|
||||||
if ( hasReverseMode() )
|
if ( hasReverseMode() )
|
||||||
setReverse(true);
|
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])) )
|
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);
|
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
|
||||||
|
|
||||||
|
@ -651,17 +656,17 @@ void FLabel::printLine ( wchar_t line[]
|
||||||
print ( line[z] );
|
print ( line[z] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( length > uInt(getWidth()) )
|
if ( length > width )
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
setColor (ellipsis_color, getBackgroundColor());
|
setColor (ellipsis_color, getBackgroundColor());
|
||||||
print ("..");
|
print ("..");
|
||||||
setColor();
|
setColor();
|
||||||
}
|
}
|
||||||
else if ( align_offset + to_char < getWidth() )
|
else if ( align_offset + to_char < width )
|
||||||
{
|
{
|
||||||
// Print trailing spaces
|
// Print trailing spaces
|
||||||
int len = getWidth() - align_offset - to_char;
|
std::size_t len = width - align_offset - to_char;
|
||||||
print (FString(len, ' '));
|
print (FString(len, ' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ void FLineEdit::setLabelOrientation(const label_o o)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::hide()
|
void FLineEdit::hide()
|
||||||
{
|
{
|
||||||
int s, size;
|
std::size_t s, size;
|
||||||
short fg, bg;
|
short fg, bg;
|
||||||
char* blank;
|
char* blank;
|
||||||
FWidget* parent_widget = getParentWidget();
|
FWidget* parent_widget = getParentWidget();
|
||||||
|
@ -303,7 +303,7 @@ void FLineEdit::hide()
|
||||||
s = hasShadow() ? 1 : 0;
|
s = hasShadow() ? 1 : 0;
|
||||||
size = getWidth() + s;
|
size = getWidth() + s;
|
||||||
|
|
||||||
if ( size < 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -319,7 +319,7 @@ void FLineEdit::hide()
|
||||||
std::memset(blank, ' ', std::size_t(size));
|
std::memset(blank, ' ', std::size_t(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y = 0; y < getHeight() + s; y++)
|
for (int y = 0; y < int(getHeight() + s); y++)
|
||||||
{
|
{
|
||||||
setPrintPos (1, 1 + y);
|
setPrintPos (1, 1 + y);
|
||||||
print (blank);
|
print (blank);
|
||||||
|
@ -434,10 +434,10 @@ void FLineEdit::onMouseDown (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
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());
|
int len = int(text.getLength());
|
||||||
cursor_pos = text_offset + mouse_x - 2;
|
cursor_pos = int(text_offset) + mouse_x - 2;
|
||||||
|
|
||||||
if ( cursor_pos >= len )
|
if ( cursor_pos >= len )
|
||||||
cursor_pos = len;
|
cursor_pos = len;
|
||||||
|
@ -470,9 +470,9 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
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 )
|
if ( cursor_pos >= len )
|
||||||
cursor_pos = len;
|
cursor_pos = len;
|
||||||
|
@ -498,17 +498,17 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
|
||||||
drag_scroll = FLineEdit::noScroll;
|
drag_scroll = FLineEdit::noScroll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( mouse_x >= getWidth() )
|
else if ( mouse_x >= int(getWidth()) )
|
||||||
{
|
{
|
||||||
// drag right
|
// drag right
|
||||||
if ( ! scroll_timer && text_offset <= len - getWidth() + 1 )
|
if ( ! scroll_timer && int(text_offset) <= len - int(getWidth()) + 1 )
|
||||||
{
|
{
|
||||||
scroll_timer = true;
|
scroll_timer = true;
|
||||||
addTimer(scroll_repeat);
|
addTimer(scroll_repeat);
|
||||||
drag_scroll = FLineEdit::scrollRight;
|
drag_scroll = FLineEdit::scrollRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( text_offset == len - getWidth() + 2 )
|
if ( int(text_offset) == len - int(getWidth()) + 2 )
|
||||||
{
|
{
|
||||||
delOwnTimer();
|
delOwnTimer();
|
||||||
drag_scroll = FLineEdit::noScroll;
|
drag_scroll = FLineEdit::noScroll;
|
||||||
|
@ -549,13 +549,13 @@ void FLineEdit::onTimer (FTimerEvent*)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FLineEdit::scrollRight:
|
case FLineEdit::scrollRight:
|
||||||
if ( text_offset == len - getWidth() + 2 )
|
if ( int(text_offset) == len - int(getWidth()) + 2 )
|
||||||
{
|
{
|
||||||
drag_scroll = FLineEdit::noScroll;
|
drag_scroll = FLineEdit::noScroll;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( text_offset <= len - getWidth() + 1 )
|
if ( int(text_offset) <= len - int(getWidth()) + 1 )
|
||||||
text_offset++;
|
text_offset++;
|
||||||
|
|
||||||
if ( cursor_pos < len )
|
if ( cursor_pos < len )
|
||||||
|
@ -642,7 +642,7 @@ void FLineEdit::onFocusOut (FFocusEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::adjustLabel()
|
void FLineEdit::adjustLabel()
|
||||||
{
|
{
|
||||||
int label_length = int(label_text.getLength());
|
std::size_t label_length = label_text.getLength();
|
||||||
|
|
||||||
if ( hasHotkey() )
|
if ( hasHotkey() )
|
||||||
label_length--;
|
label_length--;
|
||||||
|
@ -657,7 +657,7 @@ void FLineEdit::adjustLabel()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case label_left:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -757,7 +757,8 @@ void FLineEdit::drawInputField()
|
||||||
if ( isActiveFocus && getMaxColor() < 16 )
|
if ( isActiveFocus && getMaxColor() < 16 )
|
||||||
setBold();
|
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() )
|
if ( isLinuxTerm() && hasUTF8() )
|
||||||
{
|
{
|
||||||
|
@ -773,7 +774,7 @@ void FLineEdit::drawInputField()
|
||||||
|
|
||||||
x = int(show_text.getLength());
|
x = int(show_text.getLength());
|
||||||
|
|
||||||
while ( x < getWidth() - 1 )
|
while ( x < int(getWidth()) - 1 )
|
||||||
{
|
{
|
||||||
print (' ');
|
print (' ');
|
||||||
x++;
|
x++;
|
||||||
|
@ -792,7 +793,7 @@ void FLineEdit::drawInputField()
|
||||||
drawShadow ();
|
drawShadow ();
|
||||||
|
|
||||||
// set the cursor to the first pos.
|
// set the cursor to the first pos.
|
||||||
setCursorPos (2 + cursor_pos - text_offset, 1);
|
setCursorPos (2 + cursor_pos - int(text_offset), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -801,7 +802,7 @@ inline void FLineEdit::keyLeft()
|
||||||
if ( cursor_pos > 0 )
|
if ( cursor_pos > 0 )
|
||||||
cursor_pos--;
|
cursor_pos--;
|
||||||
|
|
||||||
if ( cursor_pos < text_offset )
|
if ( cursor_pos < int(text_offset) )
|
||||||
text_offset--;
|
text_offset--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,8 +814,8 @@ inline void FLineEdit::keyRight()
|
||||||
if ( cursor_pos < len )
|
if ( cursor_pos < len )
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
|
|
||||||
if ( cursor_pos - text_offset >= getWidth() - 2
|
if ( cursor_pos - int(text_offset) >= int(getWidth()) - 2
|
||||||
&& text_offset <= len - getWidth() + 1 )
|
&& int(text_offset) <= len - int(getWidth()) + 1 )
|
||||||
text_offset++;
|
text_offset++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -828,31 +829,32 @@ inline void FLineEdit::keyHome()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FLineEdit::keyEnd()
|
inline void FLineEdit::keyEnd()
|
||||||
{
|
{
|
||||||
int len = int(text.getLength());
|
std::size_t len = text.getLength();
|
||||||
cursor_pos = len;
|
cursor_pos = int(len);
|
||||||
|
|
||||||
if ( cursor_pos >= getWidth() - 1 )
|
if ( cursor_pos >= int(getWidth()) - 1 )
|
||||||
text_offset = len - getWidth() + 2;
|
text_offset = len - getWidth() + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FLineEdit::keyDel()
|
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();
|
processChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cursor_pos >= len )
|
if ( cursor_pos >= int(len) )
|
||||||
cursor_pos = len;
|
cursor_pos = int(len);
|
||||||
|
|
||||||
if ( cursor_pos < 0 )
|
if ( cursor_pos < 0 )
|
||||||
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--;
|
text_offset--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,7 +863,7 @@ inline void FLineEdit::keyBackspace()
|
||||||
{
|
{
|
||||||
if ( text.getLength() > 0 && cursor_pos > 0 )
|
if ( text.getLength() > 0 && cursor_pos > 0 )
|
||||||
{
|
{
|
||||||
text.remove(cursor_pos - 1, 1);
|
text.remove(std::size_t(cursor_pos) - 1, 1);
|
||||||
processChanged();
|
processChanged();
|
||||||
cursor_pos--;
|
cursor_pos--;
|
||||||
|
|
||||||
|
@ -892,9 +894,9 @@ inline bool FLineEdit::keyInput (int key)
|
||||||
{
|
{
|
||||||
if ( key >= 0x20 && key <= 0x10fff )
|
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);
|
text += wchar_t(key);
|
||||||
processChanged();
|
processChanged();
|
||||||
|
@ -902,9 +904,9 @@ inline bool FLineEdit::keyInput (int key)
|
||||||
else if ( len > 0 )
|
else if ( len > 0 )
|
||||||
{
|
{
|
||||||
if ( insert_mode )
|
if ( insert_mode )
|
||||||
text.insert(wchar_t(key), uInt(cursor_pos));
|
text.insert(wchar_t(key), std::size_t(cursor_pos));
|
||||||
else
|
else
|
||||||
text.overwrite(wchar_t(key), uInt(cursor_pos));
|
text.overwrite(wchar_t(key), std::size_t(cursor_pos));
|
||||||
|
|
||||||
processChanged();
|
processChanged();
|
||||||
}
|
}
|
||||||
|
@ -915,7 +917,7 @@ inline bool FLineEdit::keyInput (int key)
|
||||||
}
|
}
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
|
|
||||||
if ( cursor_pos >= getWidth() - 1 )
|
if ( cursor_pos >= int(getWidth()) - 1 )
|
||||||
text_offset++;
|
text_offset++;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
316
src/flistbox.cpp
316
src/flistbox.cpp
|
@ -127,14 +127,14 @@ FListBox::~FListBox() // destructor
|
||||||
|
|
||||||
// public methods of FListBox
|
// 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 )
|
if ( index == current )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
element_count = int(getCount());
|
element_count = getCount();
|
||||||
|
|
||||||
if ( index > element_count )
|
if ( index > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
@ -155,12 +155,12 @@ void FListBox::setCurrentItem (int index)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::setCurrentItem (listBoxItems::iterator iter)
|
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);
|
setCurrentItem(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::showInsideBrackets ( int index
|
void FListBox::showInsideBrackets ( std::size_t index
|
||||||
, fc::brackets_type b )
|
, fc::brackets_type b )
|
||||||
{
|
{
|
||||||
listBoxItems::iterator iter = index2iterator(index - 1);
|
listBoxItems::iterator iter = index2iterator(index - 1);
|
||||||
|
@ -175,10 +175,10 @@ void FListBox::showInsideBrackets ( int index
|
||||||
{
|
{
|
||||||
max_line_width = 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->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
|
||||||
hbar->setPageSize (max_line_width, getWidth() - nf_offset - 4);
|
hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4);
|
||||||
hbar->setValue (xoffset);
|
hbar->setValue (xoffset);
|
||||||
|
|
||||||
if ( ! hbar->isVisible() )
|
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
|
// Set the widget geometry
|
||||||
|
|
||||||
|
@ -196,13 +196,13 @@ void FListBox::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
vbar->setGeometry (getWidth(), 2, 2, getHeight() - 2);
|
vbar->setGeometry (int(getWidth()), 2, 2, getHeight() - 2);
|
||||||
hbar->setGeometry (1, getHeight(), getWidth() - 2 - nf_offset, 1);
|
hbar->setGeometry (1, int(getHeight()), getWidth() - 2 - std::size_t(nf_offset), 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vbar->setGeometry (getWidth(), 2, 1, getHeight() - 2);
|
vbar->setGeometry (int(getWidth()), 2, 1, getHeight() - 2);
|
||||||
hbar->setGeometry (2, getHeight(), getWidth() - 2, 1);
|
hbar->setGeometry (2, int(getHeight()), getWidth() - 2, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ void FListBox::setText (const FString& txt)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::hide()
|
void FListBox::hide()
|
||||||
{
|
{
|
||||||
int n, size;
|
std::size_t n, size;
|
||||||
short fg, bg;
|
short fg, bg;
|
||||||
char* blank;
|
char* blank;
|
||||||
FWidget* parent_widget = getParentWidget();
|
FWidget* parent_widget = getParentWidget();
|
||||||
|
@ -262,12 +262,12 @@ void FListBox::hide()
|
||||||
n = isNewFont() ? 1 : 0;
|
n = isNewFont() ? 1 : 0;
|
||||||
size = getWidth() + n;
|
size = getWidth() + n;
|
||||||
|
|
||||||
if ( size < 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
blank = new char[std::size_t(size) + 1];
|
blank = new char[size + 1];
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -275,10 +275,10 @@ void FListBox::hide()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset (blank, ' ', std::size_t(size));
|
std::memset (blank, ' ', size);
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y = 0; y < getHeight(); y++)
|
for (int y = 0; y < int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
setPrintPos (1, 1 + y);
|
setPrintPos (1, 1 + y);
|
||||||
print (blank);
|
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;
|
return;
|
||||||
|
|
||||||
itemlist.erase (itemlist.begin() + item - 1);
|
itemlist.erase (itemlist.begin() + int(item) - 1);
|
||||||
element_count = int(getCount());
|
element_count = getCount();
|
||||||
max_line_width = 0;
|
max_line_width = 0;
|
||||||
|
|
||||||
listBoxItems::iterator iter = itemlist.begin();
|
listBoxItems::iterator iter = itemlist.begin();
|
||||||
|
@ -345,14 +345,14 @@ void FListBox::remove (int item)
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
hbar->setMaximum (max_line_width - getWidth() + nf_offset + 4);
|
hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
|
||||||
hbar->setPageSize (max_line_width, 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();
|
hbar->hide();
|
||||||
|
|
||||||
vbar->setMaximum (element_count - getHeight() + 2);
|
vbar->setMaximum (int(element_count - getHeight()) + 2);
|
||||||
vbar->setPageSize (element_count, getHeight() - 2);
|
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
|
||||||
|
|
||||||
if ( vbar->isVisible() && element_count < getHeight() - 1 )
|
if ( vbar->isVisible() && element_count < getHeight() - 1 )
|
||||||
vbar->hide();
|
vbar->hide();
|
||||||
|
@ -363,8 +363,8 @@ void FListBox::remove (int item)
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
|
||||||
if ( yoffset > element_count - getHeight() + 2 )
|
if ( yoffset > int(element_count - getHeight()) + 2 )
|
||||||
yoffset = element_count - getHeight() + 2;
|
yoffset = int(element_count - getHeight()) + 2;
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
|
@ -373,7 +373,7 @@ void FListBox::remove (int item)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::clear()
|
void FListBox::clear()
|
||||||
{
|
{
|
||||||
int size;
|
std::size_t size;
|
||||||
char* blank;
|
char* blank;
|
||||||
|
|
||||||
itemlist.clear();
|
itemlist.clear();
|
||||||
|
@ -397,12 +397,12 @@ void FListBox::clear()
|
||||||
setColor (wc.list_fg, wc.list_bg);
|
setColor (wc.list_fg, wc.list_bg);
|
||||||
size = getWidth() - 2;
|
size = getWidth() - 2;
|
||||||
|
|
||||||
if ( size < 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
blank = new char[std::size_t(size) + 1];
|
blank = new char[size + 1];
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -410,10 +410,10 @@ void FListBox::clear()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset (blank, ' ', std::size_t(size));
|
std::memset (blank, ' ', size);
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y = 0; y < getHeight() - 2; y++)
|
for (int y = 0; y < int(getHeight()) - 2; y++)
|
||||||
{
|
{
|
||||||
setPrintPos (2, 2 + y);
|
setPrintPos (2, 2 + y);
|
||||||
print (blank);
|
print (blank);
|
||||||
|
@ -425,8 +425,8 @@ void FListBox::clear()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::onKeyPress (FKeyEvent* ev)
|
void FListBox::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
int current_before = current
|
std::size_t current_before = current;
|
||||||
, xoffset_before = xoffset
|
int xoffset_before = xoffset
|
||||||
, yoffset_before = yoffset
|
, yoffset_before = yoffset
|
||||||
, key = ev->key();
|
, key = ev->key();
|
||||||
|
|
||||||
|
@ -543,11 +543,11 @@ void FListBox::onMouseDown (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||||
{
|
{
|
||||||
int element_count = int(getCount());
|
std::size_t element_count = getCount();
|
||||||
current = yoffset + mouse_y - 1;
|
current = std::size_t(yoffset + mouse_y - 1);
|
||||||
|
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
@ -581,8 +581,8 @@ void FListBox::onMouseUp (FMouseEvent* ev)
|
||||||
int mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||||
{
|
{
|
||||||
processChanged();
|
processChanged();
|
||||||
|
|
||||||
|
@ -602,16 +602,16 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
||||||
if ( ev->getButton() == fc::RightButton && ! isMultiSelection() )
|
if ( ev->getButton() == fc::RightButton && ! isMultiSelection() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int current_before = current;
|
std::size_t current_before = current;
|
||||||
int yoffset_before = yoffset;
|
int yoffset_before = yoffset;
|
||||||
int mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||||
{
|
{
|
||||||
int element_count = int(getCount());
|
std::size_t element_count = getCount();
|
||||||
current = yoffset + mouse_y - 1;
|
current = std::size_t(yoffset + mouse_y - 1);
|
||||||
|
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
@ -640,7 +640,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
|
||||||
// Auto-scrolling when dragging mouse outside the widget
|
// Auto-scrolling when dragging mouse outside the widget
|
||||||
if ( mouse_y < 2 )
|
if ( mouse_y < 2 )
|
||||||
dragUp (ev->getButton());
|
dragUp (ev->getButton());
|
||||||
else if ( mouse_y >= getHeight() )
|
else if ( mouse_y >= int(getHeight()) )
|
||||||
dragDown (ev->getButton());
|
dragDown (ev->getButton());
|
||||||
else
|
else
|
||||||
stopDragScroll();
|
stopDragScroll();
|
||||||
|
@ -657,8 +657,8 @@ void FListBox::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||||
{
|
{
|
||||||
if ( yoffset + mouse_y - 1 > int(getCount()) )
|
if ( yoffset + mouse_y - 1 > int(getCount()) )
|
||||||
return;
|
return;
|
||||||
|
@ -670,7 +670,7 @@ void FListBox::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::onTimer (FTimerEvent*)
|
void FListBox::onTimer (FTimerEvent*)
|
||||||
{
|
{
|
||||||
int current_before = current;
|
std::size_t current_before = current;
|
||||||
int yoffset_before = yoffset;
|
int yoffset_before = yoffset;
|
||||||
|
|
||||||
switch ( int(drag_scroll) )
|
switch ( int(drag_scroll) )
|
||||||
|
@ -719,8 +719,8 @@ void FListBox::onTimer (FTimerEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::onWheel (FWheelEvent* ev)
|
void FListBox::onWheel (FWheelEvent* ev)
|
||||||
{
|
{
|
||||||
|
std::size_t current_before = current;
|
||||||
int wheel
|
int wheel
|
||||||
, current_before = current
|
|
||||||
, yoffset_before = yoffset
|
, yoffset_before = yoffset
|
||||||
, pagesize = 4;
|
, pagesize = 4;
|
||||||
|
|
||||||
|
@ -791,45 +791,42 @@ void FListBox::onFocusOut (FFocusEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::adjustYOffset()
|
void FListBox::adjustYOffset()
|
||||||
{
|
{
|
||||||
int element_count = int(getCount());
|
std::size_t element_count = getCount();
|
||||||
|
|
||||||
if ( getClientHeight() < 0 )
|
if ( element_count == 0 || getClientHeight() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( element_count == 0 || getClientHeight() <= 0 )
|
if ( yoffset > int(element_count - getClientHeight()) )
|
||||||
return;
|
yoffset = int(element_count - getClientHeight());
|
||||||
|
|
||||||
if ( yoffset > element_count - getClientHeight() )
|
|
||||||
yoffset = element_count - getClientHeight();
|
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
|
|
||||||
if ( current < yoffset )
|
if ( current < std::size_t(yoffset) )
|
||||||
current = yoffset;
|
current = std::size_t(yoffset);
|
||||||
|
|
||||||
if ( yoffset < current - getClientHeight() )
|
if ( yoffset < int(current - getClientHeight()) )
|
||||||
yoffset = current - getClientHeight();
|
yoffset = int(current - getClientHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::adjustSize()
|
void FListBox::adjustSize()
|
||||||
{
|
{
|
||||||
int element_count;
|
std::size_t element_count;
|
||||||
FWidget::adjustSize();
|
FWidget::adjustSize();
|
||||||
adjustYOffset();
|
adjustYOffset();
|
||||||
|
|
||||||
element_count = int(getCount());
|
element_count = getCount();
|
||||||
vbar->setMaximum (element_count - getClientHeight());
|
vbar->setMaximum (int(element_count - getClientHeight()));
|
||||||
vbar->setPageSize (element_count, getClientHeight());
|
vbar->setPageSize (int(element_count), int(getClientHeight()));
|
||||||
vbar->setX (getWidth());
|
vbar->setX (int(getWidth()));
|
||||||
vbar->setHeight (getClientHeight(), false);
|
vbar->setHeight (getClientHeight(), false);
|
||||||
vbar->resize();
|
vbar->resize();
|
||||||
|
|
||||||
hbar->setMaximum (max_line_width - getClientWidth() + 2);
|
hbar->setMaximum (max_line_width - int(getClientWidth()) + 2);
|
||||||
hbar->setPageSize (max_line_width, getClientWidth() - 2);
|
hbar->setPageSize (max_line_width, int(getClientWidth()) - 2);
|
||||||
hbar->setY (getHeight());
|
hbar->setY (int(getHeight()));
|
||||||
hbar->setWidth (getClientWidth() + nf_offset, false);
|
hbar->setWidth (getClientWidth() + std::size_t(nf_offset), false);
|
||||||
hbar->resize();
|
hbar->resize();
|
||||||
|
|
||||||
if ( element_count <= getClientHeight() )
|
if ( element_count <= getClientHeight() )
|
||||||
|
@ -837,7 +834,7 @@ void FListBox::adjustSize()
|
||||||
else
|
else
|
||||||
vbar->setVisible();
|
vbar->setVisible();
|
||||||
|
|
||||||
if ( max_line_width < getClientWidth() - 1 )
|
if ( max_line_width < int(getClientWidth()) - 1 )
|
||||||
hbar->hide();
|
hbar->hide();
|
||||||
else
|
else
|
||||||
hbar->setVisible();
|
hbar->setVisible();
|
||||||
|
@ -910,7 +907,7 @@ void FListBox::draw()
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
drawBorder (1, 1, getWidth() - 1, getHeight());
|
drawBorder (1, 1, int(getWidth()) - 1, int(getHeight()));
|
||||||
else
|
else
|
||||||
drawBorder();
|
drawBorder();
|
||||||
|
|
||||||
|
@ -918,9 +915,9 @@ void FListBox::draw()
|
||||||
{
|
{
|
||||||
setColor();
|
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
|
print (' '); // clear right side of the scrollbar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -955,14 +952,11 @@ void FListBox::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::drawLabel()
|
void FListBox::drawLabel()
|
||||||
{
|
{
|
||||||
FString txt;
|
|
||||||
uInt length;
|
|
||||||
|
|
||||||
if ( text.isNull() || text.isEmpty() )
|
if ( text.isNull() || text.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
txt = " " + text + " ";
|
FString txt = " " + text + " ";
|
||||||
length = txt.getLength();
|
std::size_t length = txt.getLength();
|
||||||
setPrintPos (2, 1);
|
setPrintPos (2, 1);
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
|
@ -984,7 +978,7 @@ void FListBox::drawLabel()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::drawList()
|
void FListBox::drawList()
|
||||||
{
|
{
|
||||||
uInt start, num;
|
std::size_t start, num;
|
||||||
listBoxItems::iterator iter;
|
listBoxItems::iterator iter;
|
||||||
|
|
||||||
if ( itemlist.empty() || getHeight() <= 2 || getWidth() <= 4 )
|
if ( itemlist.empty() || getHeight() <= 2 || getWidth() <= 4 )
|
||||||
|
@ -998,18 +992,18 @@ void FListBox::drawList()
|
||||||
|
|
||||||
if ( last_yoffset >= 0
|
if ( last_yoffset >= 0
|
||||||
&& last_yoffset == yoffset
|
&& last_yoffset == yoffset
|
||||||
&& last_current != current )
|
&& last_current != int(current) )
|
||||||
{
|
{
|
||||||
// speed up: redraw only the changed rows
|
// speed up: redraw only the changed rows
|
||||||
uInt last_pos = uInt(current - yoffset) - 1;
|
std::size_t last_pos = current - std::size_t(yoffset) - 1;
|
||||||
uInt current_pos = uInt(last_current - yoffset) - 1;
|
std::size_t current_pos = std::size_t(last_current - yoffset) - 1;
|
||||||
start = std::min(last_pos, current_pos);
|
start = std::min(last_pos, current_pos);
|
||||||
num = std::max(last_pos, current_pos) + 1;
|
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 serach_mark = false;
|
||||||
bool lineHasBrackets = hasBrackets(iter);
|
bool lineHasBrackets = hasBrackets(iter);
|
||||||
|
@ -1036,7 +1030,7 @@ void FListBox::drawList()
|
||||||
|
|
||||||
unsetAttributes();
|
unsetAttributes();
|
||||||
last_yoffset = yoffset;
|
last_yoffset = yoffset;
|
||||||
last_current = current;
|
last_current = int(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1044,13 +1038,13 @@ inline void FListBox::drawListLine ( int y
|
||||||
, listBoxItems::iterator iter
|
, listBoxItems::iterator iter
|
||||||
, bool serach_mark )
|
, bool serach_mark )
|
||||||
{
|
{
|
||||||
uInt i, len;
|
std::size_t i, len;
|
||||||
uInt inc_len = inc_search.getLength();
|
std::size_t inc_len = inc_search.getLength();
|
||||||
bool isCurrentLine = bool(y + yoffset + 1 == current);
|
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||||
bool isFocus = ((flags & fc::focus) != 0);
|
bool isFocus = ((flags & fc::focus) != 0);
|
||||||
FString element;
|
FString element;
|
||||||
element = getString(iter).mid ( uInt(1 + xoffset)
|
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();
|
const wchar_t* const& element_str = element.wc_str();
|
||||||
len = element.getLength();
|
len = element.getLength();
|
||||||
|
|
||||||
|
@ -1078,7 +1072,7 @@ inline void FListBox::drawListLine ( int y
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < uInt(getWidth() - nf_offset - 3); i++)
|
for (; i < getWidth() - std::size_t(nf_offset) - 3; i++)
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1139,13 +1133,13 @@ inline void FListBox::drawListBracketsLine ( int y
|
||||||
, listBoxItems::iterator iter
|
, listBoxItems::iterator iter
|
||||||
, bool serach_mark )
|
, bool serach_mark )
|
||||||
{
|
{
|
||||||
int full_length;
|
|
||||||
FString element;
|
FString element;
|
||||||
uInt len
|
std::size_t len
|
||||||
|
, full_length
|
||||||
, inc_len = inc_search.getLength()
|
, inc_len = inc_search.getLength()
|
||||||
, i = 0
|
, i = 0
|
||||||
, b = 0;
|
, b = 0;
|
||||||
bool isCurrentLine = bool(y + yoffset + 1 == current);
|
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||||
bool isFocus = ((flags & fc::focus) != 0);
|
bool isFocus = ((flags & fc::focus) != 0);
|
||||||
|
|
||||||
if ( isMonochron() && isCurrentLine && isFocus )
|
if ( isMonochron() && isCurrentLine && isFocus )
|
||||||
|
@ -1158,12 +1152,12 @@ inline void FListBox::drawListBracketsLine ( int y
|
||||||
b = 1;
|
b = 1;
|
||||||
printLeftBracket (iter->brackets);
|
printLeftBracket (iter->brackets);
|
||||||
|
|
||||||
element = getString(iter).mid ( uInt(1 + xoffset)
|
element = getString(iter).mid ( std::size_t(xoffset) + 1
|
||||||
, uInt(getWidth() - nf_offset - 5) );
|
, getWidth() - std::size_t(nf_offset) - 5 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
element = getString(iter).mid ( uInt(xoffset)
|
element = getString(iter).mid ( std::size_t(xoffset)
|
||||||
, uInt(getWidth() - nf_offset - 4) );
|
, getWidth() - std::size_t(nf_offset) - 4 );
|
||||||
|
|
||||||
const wchar_t* const& element_str = element.wc_str();
|
const wchar_t* const& element_str = element.wc_str();
|
||||||
len = element.getLength();
|
len = element.getLength();
|
||||||
|
@ -1181,10 +1175,10 @@ inline void FListBox::drawListBracketsLine ( int y
|
||||||
print (element_str[i]);
|
print (element_str[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
full_length = int(getString(iter).getLength());
|
full_length = getString(iter).getLength();
|
||||||
|
|
||||||
if ( b + i < uInt(getWidth() - nf_offset - 4 )
|
if ( b + i < getWidth() - std::size_t(nf_offset) - 4
|
||||||
&& xoffset <= full_length + 1 )
|
&& std::size_t(xoffset) <= full_length + 1 )
|
||||||
{
|
{
|
||||||
if ( serach_mark && i == inc_len )
|
if ( serach_mark && i == inc_len )
|
||||||
setColor ( wc.current_element_focus_fg
|
setColor ( wc.current_element_focus_fg
|
||||||
|
@ -1200,7 +1194,7 @@ inline void FListBox::drawListBracketsLine ( int y
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; b + i < uInt(getWidth() - nf_offset - 3); i++)
|
for (; b + i < getWidth() - std::size_t(nf_offset) - 3; i++)
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1211,8 +1205,8 @@ inline void FListBox::setLineAttributes ( int y
|
||||||
, bool& serach_mark )
|
, bool& serach_mark )
|
||||||
{
|
{
|
||||||
bool isFocus = ((flags & fc::focus) != 0)
|
bool isFocus = ((flags & fc::focus) != 0)
|
||||||
, isCurrentLine = bool(y + yoffset + 1 == current);
|
, isCurrentLine = bool(y + yoffset + 1 == int(current));
|
||||||
uInt inc_len = inc_search.getLength();
|
std::size_t inc_len = inc_search.getLength();
|
||||||
|
|
||||||
setPrintPos (2, 2 + int(y));
|
setPrintPos (2, 2 + int(y));
|
||||||
|
|
||||||
|
@ -1326,10 +1320,10 @@ void FListBox::recalculateHorizontalBar (int len, bool has_brackets)
|
||||||
|
|
||||||
max_line_width = 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->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
|
||||||
hbar->setPageSize (max_line_width, getWidth() - nf_offset - 4);
|
hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4);
|
||||||
hbar->calculateSliderValues();
|
hbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! hbar->isVisible() )
|
if ( ! hbar->isVisible() )
|
||||||
|
@ -1340,11 +1334,11 @@ void FListBox::recalculateHorizontalBar (int len, bool has_brackets)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::recalculateVerticalBar (int element_count)
|
void FListBox::recalculateVerticalBar (int element_count)
|
||||||
{
|
{
|
||||||
vbar->setMaximum (element_count - getHeight() + 2);
|
vbar->setMaximum (element_count - int(getHeight()) + 2);
|
||||||
vbar->setPageSize (element_count, getHeight() - 2);
|
vbar->setPageSize (element_count, int(getHeight()) - 2);
|
||||||
vbar->calculateSliderValues();
|
vbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! vbar->isVisible() && element_count >= getHeight() - 1 )
|
if ( ! vbar->isVisible() && element_count >= int(getHeight()) - 1 )
|
||||||
vbar->setVisible();
|
vbar->setVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1367,7 +1361,7 @@ inline void FListBox::getWidgetFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::multiSelection (int pos)
|
void FListBox::multiSelection (std::size_t pos)
|
||||||
{
|
{
|
||||||
if ( ! isMultiSelection() )
|
if ( ! isMultiSelection() )
|
||||||
return;
|
return;
|
||||||
|
@ -1384,29 +1378,29 @@ void FListBox::multiSelection (int pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
processSelect();
|
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() )
|
if ( ! isMultiSelection() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( secect_from_item > pos )
|
if ( std::size_t(secect_from_item) > pos )
|
||||||
{
|
{
|
||||||
from = pos;
|
from = pos;
|
||||||
to = secect_from_item - 1;
|
to = std::size_t(secect_from_item) - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
from = secect_from_item + 1;
|
from = std::size_t(secect_from_item) + 1;
|
||||||
to = pos;
|
to = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = from; i <= to; i++)
|
for (std::size_t i = from; i <= to; i++)
|
||||||
{
|
{
|
||||||
if ( mouse_select )
|
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 )
|
if ( yoffset < 0 )
|
||||||
{
|
{
|
||||||
current -= pagesize + yoffset;
|
current -= std::size_t(pagesize + yoffset);
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
current -= pagesize;
|
current -= std::size_t(pagesize);
|
||||||
|
|
||||||
if ( current < 1 )
|
if ( current < 1 )
|
||||||
current = 1;
|
current = 1;
|
||||||
|
@ -1446,8 +1440,8 @@ void FListBox::wheelUp (int pagesize)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::wheelDown (int pagesize)
|
void FListBox::wheelDown (int pagesize)
|
||||||
{
|
{
|
||||||
int element_count = int(getCount());
|
std::size_t element_count = getCount();
|
||||||
int yoffset_end = element_count - getClientHeight();
|
int yoffset_end = int(element_count - getClientHeight());
|
||||||
|
|
||||||
if ( yoffset_end < 0 )
|
if ( yoffset_end < 0 )
|
||||||
yoffset_end = 0;
|
yoffset_end = 0;
|
||||||
|
@ -1459,11 +1453,11 @@ void FListBox::wheelDown (int pagesize)
|
||||||
|
|
||||||
if ( yoffset > yoffset_end )
|
if ( yoffset > yoffset_end )
|
||||||
{
|
{
|
||||||
current += pagesize - (yoffset - yoffset_end);
|
current += std::size_t(pagesize - (yoffset - yoffset_end));
|
||||||
yoffset = yoffset_end;
|
yoffset = yoffset_end;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
current += pagesize;
|
current += std::size_t(pagesize);
|
||||||
|
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
@ -1485,7 +1479,7 @@ bool FListBox::dragScrollUp()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FListBox::dragScrollDown()
|
bool FListBox::dragScrollDown()
|
||||||
{
|
{
|
||||||
int element_count = int(getCount());
|
std::size_t element_count = getCount();
|
||||||
|
|
||||||
if ( current == element_count )
|
if ( current == element_count )
|
||||||
{
|
{
|
||||||
|
@ -1501,7 +1495,7 @@ bool FListBox::dragScrollDown()
|
||||||
void FListBox::dragUp (int mouse_button)
|
void FListBox::dragUp (int mouse_button)
|
||||||
{
|
{
|
||||||
if ( drag_scroll != fc::noScroll
|
if ( drag_scroll != fc::noScroll
|
||||||
&& scroll_distance < getClientHeight() )
|
&& scroll_distance < int(getClientHeight()) )
|
||||||
scroll_distance++;
|
scroll_distance++;
|
||||||
|
|
||||||
if ( ! scroll_timer && current > 1 )
|
if ( ! scroll_timer && current > 1 )
|
||||||
|
@ -1526,10 +1520,10 @@ void FListBox::dragUp (int mouse_button)
|
||||||
void FListBox::dragDown (int mouse_button)
|
void FListBox::dragDown (int mouse_button)
|
||||||
{
|
{
|
||||||
if ( drag_scroll != fc::noScroll
|
if ( drag_scroll != fc::noScroll
|
||||||
&& scroll_distance < getClientHeight() )
|
&& scroll_distance < int(getClientHeight()) )
|
||||||
scroll_distance++;
|
scroll_distance++;
|
||||||
|
|
||||||
if ( ! scroll_timer && current < int(getCount()) )
|
if ( ! scroll_timer && current < getCount() )
|
||||||
{
|
{
|
||||||
scroll_timer = true;
|
scroll_timer = true;
|
||||||
addTimer(scroll_repeat);
|
addTimer(scroll_repeat);
|
||||||
|
@ -1540,7 +1534,7 @@ void FListBox::dragDown (int mouse_button)
|
||||||
drag_scroll = fc::scrollDown;
|
drag_scroll = fc::scrollDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current == int(getCount()) )
|
if ( current == getCount() )
|
||||||
{
|
{
|
||||||
delOwnTimer();
|
delOwnTimer();
|
||||||
drag_scroll = fc::noScroll;
|
drag_scroll = fc::noScroll;
|
||||||
|
@ -1562,12 +1556,12 @@ void FListBox::prevListItem (int distance)
|
||||||
if ( current == 1 )
|
if ( current == 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
current -= distance;
|
current -= std::size_t(distance);
|
||||||
|
|
||||||
if ( current < 1 )
|
if ( current < 1 )
|
||||||
current = 1;
|
current = 1;
|
||||||
|
|
||||||
if ( current <= yoffset )
|
if ( current <= std::size_t(yoffset) )
|
||||||
{
|
{
|
||||||
yoffset -= distance;
|
yoffset -= distance;
|
||||||
|
|
||||||
|
@ -1579,18 +1573,18 @@ void FListBox::prevListItem (int distance)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::nextListItem (int distance)
|
void FListBox::nextListItem (int distance)
|
||||||
{
|
{
|
||||||
int element_count = int(getCount());
|
std::size_t element_count = getCount();
|
||||||
int yoffset_end = element_count - getClientHeight();
|
int yoffset_end = int(element_count - getClientHeight());
|
||||||
|
|
||||||
if ( current == element_count )
|
if ( current == element_count )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
current += distance;
|
current += std::size_t(distance);
|
||||||
|
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
|
||||||
if ( current - yoffset > getClientHeight() )
|
if ( current - std::size_t(yoffset) > getClientHeight() )
|
||||||
{
|
{
|
||||||
yoffset += distance;
|
yoffset += distance;
|
||||||
|
|
||||||
|
@ -1602,7 +1596,7 @@ void FListBox::nextListItem (int distance)
|
||||||
void FListBox::scrollToX (int val)
|
void FListBox::scrollToX (int val)
|
||||||
{
|
{
|
||||||
static const int padding_space = 2; // 1 leading space + 1 trailing space
|
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 )
|
if ( xoffset == val )
|
||||||
return;
|
return;
|
||||||
|
@ -1619,13 +1613,13 @@ void FListBox::scrollToX (int val)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListBox::scrollToY (int val)
|
void FListBox::scrollToY (int val)
|
||||||
{
|
{
|
||||||
int element_count = int(getCount());
|
std::size_t element_count = getCount();
|
||||||
int yoffset_end = element_count - getClientHeight();
|
int yoffset_end = int(element_count - getClientHeight());
|
||||||
|
|
||||||
if ( yoffset == val )
|
if ( yoffset == val )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int c = current - yoffset;
|
int c = int(current) - yoffset;
|
||||||
yoffset = val;
|
yoffset = val;
|
||||||
|
|
||||||
if ( yoffset > yoffset_end )
|
if ( yoffset > yoffset_end )
|
||||||
|
@ -1634,10 +1628,10 @@ void FListBox::scrollToY (int val)
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
|
|
||||||
current = yoffset + c;
|
current = std::size_t(yoffset + c);
|
||||||
|
|
||||||
if ( current < yoffset )
|
if ( current < std::size_t(yoffset) )
|
||||||
current = yoffset;
|
current = std::size_t(yoffset);
|
||||||
|
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
@ -1659,7 +1653,7 @@ void FListBox::scrollLeft (int distance)
|
||||||
void FListBox::scrollRight (int distance)
|
void FListBox::scrollRight (int distance)
|
||||||
{
|
{
|
||||||
static const int padding_space = 2; // 1 leading space + 1 trailing space
|
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;
|
xoffset += distance;
|
||||||
|
|
||||||
if ( xoffset == xoffset_end )
|
if ( xoffset == xoffset_end )
|
||||||
|
@ -1703,7 +1697,7 @@ inline void FListBox::keyRight()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBox::keyPgUp()
|
inline void FListBox::keyPgUp()
|
||||||
{
|
{
|
||||||
int pagesize = getClientHeight() - 1;
|
int pagesize = int(getClientHeight()) - 1;
|
||||||
prevListItem (pagesize);
|
prevListItem (pagesize);
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
}
|
}
|
||||||
|
@ -1711,7 +1705,7 @@ inline void FListBox::keyPgUp()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBox::keyPgDn()
|
inline void FListBox::keyPgDn()
|
||||||
{
|
{
|
||||||
int pagesize = getClientHeight() - 1;
|
int pagesize = int(getClientHeight()) - 1;
|
||||||
nextListItem (pagesize);
|
nextListItem (pagesize);
|
||||||
inc_search.clear();
|
inc_search.clear();
|
||||||
}
|
}
|
||||||
|
@ -1727,8 +1721,8 @@ inline void FListBox::keyHome()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBox::keyEnd()
|
inline void FListBox::keyEnd()
|
||||||
{
|
{
|
||||||
int element_count = int(getCount());
|
std::size_t element_count = getCount();
|
||||||
int yoffset_end = element_count - getClientHeight();
|
int yoffset_end = int(element_count - getClientHeight());
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
|
||||||
if ( current > getClientHeight() )
|
if ( current > getClientHeight() )
|
||||||
|
@ -1759,7 +1753,7 @@ inline void FListBox::keyEnter()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListBox::keySpace()
|
inline bool FListBox::keySpace()
|
||||||
{
|
{
|
||||||
uInt inc_len = inc_search.getLength();
|
std::size_t inc_len = inc_search.getLength();
|
||||||
|
|
||||||
if ( inc_len > 0 )
|
if ( inc_len > 0 )
|
||||||
{
|
{
|
||||||
|
@ -1806,7 +1800,7 @@ inline bool FListBox::keyInsert()
|
||||||
{
|
{
|
||||||
if ( isMultiSelection() )
|
if ( isMultiSelection() )
|
||||||
{
|
{
|
||||||
int element_count = int(getCount());
|
std::size_t element_count = getCount();
|
||||||
|
|
||||||
if ( isSelected(current) )
|
if ( isSelected(current) )
|
||||||
unselectItem(current);
|
unselectItem(current);
|
||||||
|
@ -1819,7 +1813,7 @@ inline bool FListBox::keyInsert()
|
||||||
if ( current > element_count )
|
if ( current > element_count )
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
|
||||||
if ( current - yoffset >= getHeight() - 1 )
|
if ( current - std::size_t(yoffset) >= getHeight() - 1 )
|
||||||
yoffset++;
|
yoffset++;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1832,7 +1826,7 @@ inline bool FListBox::keyInsert()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListBox::keyBackspace()
|
inline bool FListBox::keyBackspace()
|
||||||
{
|
{
|
||||||
uInt inc_len = inc_search.getLength();
|
std::size_t inc_len = inc_search.getLength();
|
||||||
|
|
||||||
if ( inc_len > 0 )
|
if ( inc_len > 0 )
|
||||||
{
|
{
|
||||||
|
@ -1873,7 +1867,7 @@ inline bool FListBox::keyIncSearchInput (int key)
|
||||||
else
|
else
|
||||||
inc_search += wchar_t(key);
|
inc_search += wchar_t(key);
|
||||||
|
|
||||||
uInt inc_len = inc_search.getLength();
|
std::size_t inc_len = inc_search.getLength();
|
||||||
bool inc_found = false;
|
bool inc_found = false;
|
||||||
listBoxItems::iterator iter = itemlist.begin();
|
listBoxItems::iterator iter = itemlist.begin();
|
||||||
|
|
||||||
|
@ -1940,9 +1934,9 @@ void FListBox::lazyConvert(listBoxItems::iterator iter, int y)
|
||||||
void FListBox::cb_VBarChange (FWidget*, data_ptr)
|
void FListBox::cb_VBarChange (FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
FScrollbar::sType scrollType;
|
FScrollbar::sType scrollType;
|
||||||
|
std::size_t current_before = current;
|
||||||
int distance = 1
|
int distance = 1
|
||||||
, pagesize = 4
|
, pagesize = 4
|
||||||
, current_before = current
|
|
||||||
, yoffset_before = yoffset;
|
, yoffset_before = yoffset;
|
||||||
scrollType = vbar->getScrollType();
|
scrollType = vbar->getScrollType();
|
||||||
|
|
||||||
|
@ -1952,14 +1946,14 @@ void FListBox::cb_VBarChange (FWidget*, data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageBackward:
|
case FScrollbar::scrollPageBackward:
|
||||||
distance = getClientHeight();
|
distance = int(getClientHeight());
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepBackward:
|
case FScrollbar::scrollStepBackward:
|
||||||
prevListItem (distance);
|
prevListItem (distance);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageForward:
|
case FScrollbar::scrollPageForward:
|
||||||
distance = getClientHeight();
|
distance = int(getClientHeight());
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepForward:
|
case FScrollbar::scrollStepForward:
|
||||||
nextListItem (distance);
|
nextListItem (distance);
|
||||||
|
@ -2019,14 +2013,14 @@ void FListBox::cb_HBarChange (FWidget*, data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageBackward:
|
case FScrollbar::scrollPageBackward:
|
||||||
distance = getClientWidth() - padding_space;
|
distance = int(getClientWidth()) - padding_space;
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepBackward:
|
case FScrollbar::scrollStepBackward:
|
||||||
scrollLeft (distance);
|
scrollLeft (distance);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageForward:
|
case FScrollbar::scrollPageForward:
|
||||||
distance = getClientWidth() - padding_space;
|
distance = int(getClientWidth()) - padding_space;
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepForward:
|
case FScrollbar::scrollStepForward:
|
||||||
scrollRight (distance);
|
scrollRight (distance);
|
||||||
|
|
|
@ -49,6 +49,8 @@ long firstNumberFromString (const FString& str)
|
||||||
FString::iterator iter = str.begin();
|
FString::iterator iter = str.begin();
|
||||||
FString::iterator first_pos;
|
FString::iterator first_pos;
|
||||||
FString::iterator last_pos;
|
FString::iterator last_pos;
|
||||||
|
std::size_t pos;
|
||||||
|
std::size_t length;
|
||||||
long number;
|
long number;
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
|
@ -82,8 +84,8 @@ long firstNumberFromString (const FString& str)
|
||||||
if ( last_pos == last )
|
if ( last_pos == last )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
uInt pos = uInt(std::distance(str.begin(), first_pos)) + 1;
|
pos = std::size_t(std::distance(str.begin(), first_pos)) + 1;
|
||||||
uInt length = uInt(std::distance(first_pos, last_pos));
|
length = std::size_t(std::distance(first_pos, last_pos));
|
||||||
const FString num_str = str.mid(pos, length);
|
const FString num_str = str.mid(pos, length);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -631,7 +633,7 @@ FListView::~FListView() // destructor
|
||||||
|
|
||||||
// public methods of FListView
|
// public methods of FListView
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uInt FListView::getCount()
|
std::size_t FListView::getCount()
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
FObjectIterator iter = itemlist.begin();
|
FObjectIterator iter = itemlist.begin();
|
||||||
|
@ -643,7 +645,7 @@ uInt FListView::getCount()
|
||||||
++iter;
|
++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
|
// Set the widget geometry
|
||||||
|
|
||||||
|
@ -699,13 +701,13 @@ void FListView::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
vbar->setGeometry (getWidth(), 2, 2, getHeight() - 2);
|
vbar->setGeometry (int(getWidth()), 2, 2, getHeight() - 2);
|
||||||
hbar->setGeometry (1, getHeight(), getWidth() - 2, 1);
|
hbar->setGeometry (1, int(getHeight()), getWidth() - 2, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vbar->setGeometry (getWidth(), 2, 1, getHeight() - 2);
|
vbar->setGeometry (int(getWidth()), 2, 1, getHeight() - 2);
|
||||||
hbar->setGeometry (2, getHeight(), getWidth() - 2, 1);
|
hbar->setGeometry (2, int(getHeight()), getWidth() - 2, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -946,7 +948,7 @@ void FListView::onKeyPress (FKeyEvent* ev)
|
||||||
int position_before = current_iter.getPosition()
|
int position_before = current_iter.getPosition()
|
||||||
, xoffset_before = xoffset
|
, xoffset_before = xoffset
|
||||||
, first_line_position_before = first_visible_line.getPosition()
|
, first_line_position_before = first_visible_line.getPosition()
|
||||||
, pagesize = getClientHeight() - 1
|
, pagesize = int(getClientHeight()) - 1
|
||||||
, key = ev->key();
|
, key = ev->key();
|
||||||
clicked_expander_pos.setPoint(-1, -1);
|
clicked_expander_pos.setPoint(-1, -1);
|
||||||
|
|
||||||
|
@ -1051,8 +1053,8 @@ void FListView::onMouseDown (FMouseEvent* ev)
|
||||||
, mouse_x = ev->getX()
|
, mouse_x = ev->getX()
|
||||||
, mouse_y = ev->getY();
|
, mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||||
{
|
{
|
||||||
int new_pos = first_visible_line.getPosition() + mouse_y - 2;
|
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_x = ev->getX();
|
||||||
int mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||||
{
|
{
|
||||||
if ( tree_view )
|
if ( tree_view )
|
||||||
{
|
{
|
||||||
|
@ -1134,8 +1136,8 @@ void FListView::onMouseMove (FMouseEvent* ev)
|
||||||
, mouse_x = ev->getX()
|
, mouse_x = ev->getX()
|
||||||
, mouse_y = ev->getY();
|
, mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||||
{
|
{
|
||||||
int new_pos = first_visible_line.getPosition() + mouse_y - 2;
|
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
|
// auto-scrolling when dragging mouse outside the widget
|
||||||
if ( mouse_y < 2 )
|
if ( mouse_y < 2 )
|
||||||
dragUp (ev->getButton());
|
dragUp (ev->getButton());
|
||||||
else if ( mouse_y >= getHeight() )
|
else if ( mouse_y >= int(getHeight()) )
|
||||||
dragDown (ev->getButton());
|
dragDown (ev->getButton());
|
||||||
else
|
else
|
||||||
stopDragScroll();
|
stopDragScroll();
|
||||||
|
@ -1175,8 +1177,8 @@ void FListView::onMouseDoubleClick (FMouseEvent* ev)
|
||||||
mouse_x = ev->getX();
|
mouse_x = ev->getX();
|
||||||
mouse_y = ev->getY();
|
mouse_y = ev->getY();
|
||||||
|
|
||||||
if ( mouse_x > 1 && mouse_x < getWidth()
|
if ( mouse_x > 1 && mouse_x < int(getWidth())
|
||||||
&& mouse_y > 1 && mouse_y < getHeight() )
|
&& mouse_y > 1 && mouse_y < int(getHeight()) )
|
||||||
{
|
{
|
||||||
if ( first_visible_line.getPosition() + mouse_y - 1 > int(getCount()) )
|
if ( first_visible_line.getPosition() + mouse_y - 1 > int(getCount()) )
|
||||||
return;
|
return;
|
||||||
|
@ -1307,7 +1309,7 @@ void FListView::onFocusOut (FFocusEvent*)
|
||||||
void FListView::adjustViewport()
|
void FListView::adjustViewport()
|
||||||
{
|
{
|
||||||
int element_count = int(getCount());
|
int element_count = int(getCount());
|
||||||
int height = getClientHeight();
|
int height = int(getClientHeight());
|
||||||
|
|
||||||
if ( element_count == 0 || height <= 0 )
|
if ( element_count == 0 || height <= 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -1347,20 +1349,20 @@ void FListView::adjustViewport()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::adjustSize()
|
void FListView::adjustSize()
|
||||||
{
|
{
|
||||||
int element_count;
|
std::size_t element_count;
|
||||||
FWidget::adjustSize();
|
FWidget::adjustSize();
|
||||||
adjustViewport();
|
adjustViewport();
|
||||||
|
|
||||||
element_count = int(getCount());
|
element_count = getCount();
|
||||||
vbar->setMaximum (element_count - getClientHeight());
|
vbar->setMaximum (int(element_count - getClientHeight()));
|
||||||
vbar->setPageSize (element_count, getClientHeight());
|
vbar->setPageSize (int(element_count), int(getClientHeight()));
|
||||||
vbar->setX (getWidth());
|
vbar->setX (int(getWidth()));
|
||||||
vbar->setHeight (getClientHeight(), false);
|
vbar->setHeight (getClientHeight(), false);
|
||||||
vbar->resize();
|
vbar->resize();
|
||||||
|
|
||||||
hbar->setMaximum (max_line_width - getClientWidth());
|
hbar->setMaximum (max_line_width - int(getClientWidth()));
|
||||||
hbar->setPageSize (max_line_width, getClientWidth());
|
hbar->setPageSize (max_line_width, int(getClientWidth()));
|
||||||
hbar->setY (getHeight() );
|
hbar->setY (int(getHeight()));
|
||||||
hbar->setWidth (getClientWidth(), false);
|
hbar->setWidth (getClientWidth(), false);
|
||||||
hbar->resize();
|
hbar->resize();
|
||||||
|
|
||||||
|
@ -1369,7 +1371,7 @@ void FListView::adjustSize()
|
||||||
else
|
else
|
||||||
vbar->setVisible();
|
vbar->setVisible();
|
||||||
|
|
||||||
if ( max_line_width <= getClientWidth() )
|
if ( max_line_width <= int(getClientWidth()) )
|
||||||
hbar->hide();
|
hbar->hide();
|
||||||
else
|
else
|
||||||
hbar->setVisible();
|
hbar->setVisible();
|
||||||
|
@ -1449,9 +1451,9 @@ void FListView::sort (Compare cmp)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uInt FListView::getAlignOffset ( fc::text_alignment align
|
std::size_t FListView::getAlignOffset ( fc::text_alignment align
|
||||||
, uInt txt_length
|
, std::size_t txt_length
|
||||||
, uInt width )
|
, std::size_t width )
|
||||||
{
|
{
|
||||||
switch ( align )
|
switch ( align )
|
||||||
{
|
{
|
||||||
|
@ -1460,7 +1462,7 @@ uInt FListView::getAlignOffset ( fc::text_alignment align
|
||||||
|
|
||||||
case fc::alignCenter:
|
case fc::alignCenter:
|
||||||
if ( txt_length < width )
|
if ( txt_length < width )
|
||||||
return uInt((width - txt_length) / 2);
|
return std::size_t((width - txt_length) / 2);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1488,7 +1490,7 @@ void FListView::draw()
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
drawBorder (1, 1, getWidth() - 1, getHeight());
|
drawBorder (1, 1, int(getWidth()) - 1, int(getHeight()));
|
||||||
else
|
else
|
||||||
drawBorder();
|
drawBorder();
|
||||||
|
|
||||||
|
@ -1496,9 +1498,9 @@ void FListView::draw()
|
||||||
{
|
{
|
||||||
setColor();
|
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
|
print (' '); // clear right side of the scrollbar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1563,11 +1565,11 @@ void FListView::drawColumnLabels()
|
||||||
h << headerline;
|
h << headerline;
|
||||||
first = h.begin() + xoffset;
|
first = h.begin() + xoffset;
|
||||||
|
|
||||||
if ( int(h.size()) <= getClientWidth() )
|
if ( h.size() <= getClientWidth() )
|
||||||
last = h.end();
|
last = h.end();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int len = getClientWidth() + xoffset - 1;
|
int len = int(getClientWidth()) + xoffset - 1;
|
||||||
|
|
||||||
if ( len > int(h.size()) )
|
if ( len > int(h.size()) )
|
||||||
len = int(h.size());
|
len = int(h.size());
|
||||||
|
@ -1618,7 +1620,7 @@ void FListView::drawList()
|
||||||
while ( y < uInt(getClientHeight()) )
|
while ( y < uInt(getClientHeight()) )
|
||||||
{
|
{
|
||||||
setPrintPos (2, 2 + int(y));
|
setPrintPos (2, 2 + int(y));
|
||||||
print (FString(getClientWidth(), ' '));
|
print (FString(std::size_t(getClientWidth()), ' '));
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1628,7 +1630,7 @@ void FListView::drawListLine ( const FListViewItem* item
|
||||||
, bool is_focus
|
, bool is_focus
|
||||||
, bool is_current )
|
, 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
|
// Set line color and attributes
|
||||||
setLineAttributes (is_current, is_focus);
|
setLineAttributes (is_current, is_focus);
|
||||||
|
@ -1639,19 +1641,19 @@ void FListView::drawListLine ( const FListViewItem* item
|
||||||
// Print columns
|
// Print columns
|
||||||
if ( ! item->column_list.empty() )
|
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 std::size_t leading_space = 1;
|
||||||
static const int ellipsis_length = 2;
|
static const std::size_t ellipsis_length = 2;
|
||||||
|
|
||||||
const FString& text = item->column_list[i];
|
const FString& text = item->column_list[i];
|
||||||
int width = header[i].width;
|
std::size_t width = std::size_t(header[i].width);
|
||||||
uInt txt_length = text.getLength();
|
std::size_t txt_length = text.getLength();
|
||||||
// Increment the value of i for the column position
|
// Increment the value of i for the column position
|
||||||
// and the next iteration
|
// and the next iteration
|
||||||
i++;
|
i++;
|
||||||
fc::text_alignment align = getColumnAlignment(int(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 )
|
if ( tree_view && i == 1 )
|
||||||
{
|
{
|
||||||
|
@ -1663,12 +1665,12 @@ void FListView::drawListLine ( const FListViewItem* item
|
||||||
if ( align_offset > 0 )
|
if ( align_offset > 0 )
|
||||||
line += FString(align_offset, L' ');
|
line += FString(align_offset, L' ');
|
||||||
|
|
||||||
if ( align_offset + txt_length <= uInt(width) )
|
if ( align_offset + txt_length <= width )
|
||||||
{
|
{
|
||||||
// Insert text and trailing space
|
// Insert text and trailing space
|
||||||
line += text.left(width);
|
line += text.left(width);
|
||||||
line += FString ( leading_space + width
|
line += FString ( leading_space + width
|
||||||
- int(align_offset + txt_length), L' ');
|
- align_offset + txt_length, L' ');
|
||||||
}
|
}
|
||||||
else if ( align == fc::alignRight )
|
else if ( align == fc::alignRight )
|
||||||
{
|
{
|
||||||
|
@ -1686,16 +1688,16 @@ void FListView::drawListLine ( const FListViewItem* item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
line = line.mid ( uInt(1 + xoffset)
|
line = line.mid ( std::size_t(xoffset) + 1
|
||||||
, uInt(getWidth() - nf_offset - 2) );
|
, getWidth() - std::size_t(nf_offset) - 2);
|
||||||
const wchar_t* const& element_str = line.wc_str();
|
const wchar_t* const& element_str = line.wc_str();
|
||||||
uInt len = line.getLength();
|
std::size_t len = line.getLength();
|
||||||
uInt i;
|
std::size_t i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
*this << element_str[i];
|
*this << element_str[i];
|
||||||
|
|
||||||
for (; i < uInt(getWidth() - nf_offset - 2); i++)
|
for (; i < getWidth() - std::size_t(nf_offset) - 2; i++)
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1736,7 +1738,7 @@ inline void FListView::setLineAttributes ( bool is_current
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FString FListView::getLinePrefix ( const FListViewItem* item
|
inline FString FListView::getLinePrefix ( const FListViewItem* item
|
||||||
, uInt indent )
|
, std::size_t indent )
|
||||||
{
|
{
|
||||||
FString line = "";
|
FString line = "";
|
||||||
|
|
||||||
|
@ -1771,30 +1773,30 @@ inline FString FListView::getLinePrefix ( const FListViewItem* item
|
||||||
void FListView::drawColumnText (headerItems::const_iterator& iter)
|
void FListView::drawColumnText (headerItems::const_iterator& iter)
|
||||||
{
|
{
|
||||||
// Print lable text
|
// Print lable text
|
||||||
static const int leading_space = 1;
|
static const std::size_t leading_space = 1;
|
||||||
static const int trailing_space = 1;
|
static const std::size_t trailing_space = 1;
|
||||||
const FString& text = iter->name;
|
const FString& text = iter->name;
|
||||||
int width = iter->width;
|
std::size_t width = std::size_t(iter->width);
|
||||||
FString txt = " " + text;
|
FString txt = " " + text;
|
||||||
uInt txt_length = txt.getLength();
|
std::size_t txt_length = txt.getLength();
|
||||||
int column_width = leading_space + width;
|
std::size_t column_width = leading_space + width;
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
setColor (wc.label_emphasis_fg, wc.label_bg);
|
setColor (wc.label_emphasis_fg, wc.label_bg);
|
||||||
else
|
else
|
||||||
setColor (wc.label_inactive_fg, wc.label_inactive_bg);
|
setColor (wc.label_inactive_fg, wc.label_inactive_bg);
|
||||||
|
|
||||||
if ( txt_length <= uInt(column_width) )
|
if ( txt_length <= column_width )
|
||||||
{
|
{
|
||||||
headerline << txt;
|
headerline << txt;
|
||||||
|
|
||||||
if ( txt_length < uInt(column_width) )
|
if ( txt_length < column_width )
|
||||||
headerline << ' '; // trailing space
|
headerline << ' '; // trailing space
|
||||||
|
|
||||||
if ( txt_length + trailing_space < uInt(column_width) )
|
if ( txt_length + trailing_space < column_width )
|
||||||
{
|
{
|
||||||
setColor();
|
setColor();
|
||||||
const FString line ( uInt(column_width) - trailing_space - txt_length
|
const FString line ( column_width - trailing_space - txt_length
|
||||||
, wchar_t(fc::BoxDrawingsHorizontal) );
|
, wchar_t(fc::BoxDrawingsHorizontal) );
|
||||||
headerline << line; // horizontal line
|
headerline << line; // horizontal line
|
||||||
}
|
}
|
||||||
|
@ -1884,10 +1886,10 @@ void FListView::recalculateHorizontalBar (int len)
|
||||||
|
|
||||||
max_line_width = 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->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
|
||||||
hbar->setPageSize (max_line_width, getWidth() - nf_offset - 4);
|
hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4);
|
||||||
hbar->calculateSliderValues();
|
hbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! hbar->isVisible() )
|
if ( ! hbar->isVisible() )
|
||||||
|
@ -1898,11 +1900,11 @@ void FListView::recalculateHorizontalBar (int len)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::recalculateVerticalBar (int element_count)
|
void FListView::recalculateVerticalBar (int element_count)
|
||||||
{
|
{
|
||||||
vbar->setMaximum (element_count - getHeight() + 2);
|
vbar->setMaximum (element_count - int(getHeight()) + 2);
|
||||||
vbar->setPageSize (element_count, getHeight() - 2);
|
vbar->setPageSize (element_count, int(getHeight()) - 2);
|
||||||
vbar->calculateSliderValues();
|
vbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! vbar->isVisible() && element_count >= getHeight() - 1 )
|
if ( ! vbar->isVisible() && element_count >= int(getHeight()) - 1 )
|
||||||
vbar->setVisible();
|
vbar->setVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1988,7 +1990,7 @@ bool FListView::dragScrollDown (int position_before)
|
||||||
void FListView::dragUp (int mouse_button)
|
void FListView::dragUp (int mouse_button)
|
||||||
{
|
{
|
||||||
if ( drag_scroll != fc::noScroll
|
if ( drag_scroll != fc::noScroll
|
||||||
&& scroll_distance < getClientHeight() )
|
&& scroll_distance < int(getClientHeight()) )
|
||||||
scroll_distance++;
|
scroll_distance++;
|
||||||
|
|
||||||
if ( ! scroll_timer && current_iter.getPosition() > 0 )
|
if ( ! scroll_timer && current_iter.getPosition() > 0 )
|
||||||
|
@ -2013,7 +2015,7 @@ void FListView::dragUp (int mouse_button)
|
||||||
void FListView::dragDown (int mouse_button)
|
void FListView::dragDown (int mouse_button)
|
||||||
{
|
{
|
||||||
if ( drag_scroll != fc::noScroll
|
if ( drag_scroll != fc::noScroll
|
||||||
&& scroll_distance < getClientHeight() )
|
&& scroll_distance < int(getClientHeight()) )
|
||||||
scroll_distance++;
|
scroll_distance++;
|
||||||
|
|
||||||
if ( ! scroll_timer && current_iter.getPosition() <= int(getCount()) )
|
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)
|
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();
|
FListViewItem* item = getCurrentItem();
|
||||||
|
|
||||||
if ( tree_view && item->isExpandable() && ! item->isExpand() )
|
if ( tree_view && item->isExpandable() && ! item->isExpand() )
|
||||||
|
@ -2299,7 +2301,7 @@ void FListView::stepBackward (int distance)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::scrollToX (int x)
|
void FListView::scrollToX (int x)
|
||||||
{
|
{
|
||||||
int xoffset_end = max_line_width - getClientWidth();
|
int xoffset_end = max_line_width - int(getClientWidth());
|
||||||
|
|
||||||
if ( xoffset == x )
|
if ( xoffset == x )
|
||||||
return;
|
return;
|
||||||
|
@ -2316,7 +2318,7 @@ void FListView::scrollToX (int x)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::scrollToY (int y)
|
void FListView::scrollToY (int y)
|
||||||
{
|
{
|
||||||
int pagesize = getClientHeight() - 1;
|
int pagesize = int(getClientHeight()) - 1;
|
||||||
int element_count = int(getCount());
|
int element_count = int(getCount());
|
||||||
|
|
||||||
if ( first_visible_line.getPosition() == y )
|
if ( first_visible_line.getPosition() == y )
|
||||||
|
@ -2375,14 +2377,14 @@ void FListView::cb_VBarChange (FWidget*, data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageBackward:
|
case FScrollbar::scrollPageBackward:
|
||||||
distance = getClientHeight();
|
distance = int(getClientHeight());
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepBackward:
|
case FScrollbar::scrollStepBackward:
|
||||||
stepBackward(distance);
|
stepBackward(distance);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageForward:
|
case FScrollbar::scrollPageForward:
|
||||||
distance = getClientHeight();
|
distance = int(getClientHeight());
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepForward:
|
case FScrollbar::scrollStepForward:
|
||||||
stepForward(distance);
|
stepForward(distance);
|
||||||
|
@ -2435,14 +2437,14 @@ void FListView::cb_HBarChange (FWidget*, data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageBackward:
|
case FScrollbar::scrollPageBackward:
|
||||||
distance = getClientWidth();
|
distance = int(getClientWidth());
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepBackward:
|
case FScrollbar::scrollStepBackward:
|
||||||
scrollBy (-distance, 0);
|
scrollBy (-distance, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageForward:
|
case FScrollbar::scrollPageForward:
|
||||||
distance = getClientWidth();
|
distance = int(getClientWidth());
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepForward:
|
case FScrollbar::scrollStepForward:
|
||||||
scrollBy (distance, 0);
|
scrollBy (distance, 0);
|
||||||
|
|
|
@ -495,7 +495,7 @@ void FMenu::calculateDimensions()
|
||||||
// find the maximum item width
|
// find the maximum item width
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
uInt item_width = (*iter)->getTextLength() + 2;
|
std::size_t item_width = (*iter)->getTextLength() + 2;
|
||||||
int accel_key = (*iter)->accel_key;
|
int accel_key = (*iter)->accel_key;
|
||||||
bool has_menu = (*iter)->hasMenu();
|
bool has_menu = (*iter)->hasMenu();
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ void FMenu::calculateDimensions()
|
||||||
}
|
}
|
||||||
else if ( accel_key )
|
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;
|
item_width += accel_len + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ void FMenu::calculateDimensions()
|
||||||
adjust_X = adjustX(getX());
|
adjust_X = adjustX(getX());
|
||||||
|
|
||||||
// set widget geometry
|
// 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
|
// set geometry of all items
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
|
@ -530,7 +530,7 @@ void FMenu::calculateDimensions()
|
||||||
|
|
||||||
while ( iter != last )
|
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() )
|
if ( (*iter)->hasMenu() )
|
||||||
{
|
{
|
||||||
|
@ -579,9 +579,9 @@ void FMenu::adjustItems()
|
||||||
int FMenu::adjustX (int x_pos)
|
int FMenu::adjustX (int x_pos)
|
||||||
{
|
{
|
||||||
// Is menu outside on the right of the screen?
|
// 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
|
// Menu to large for the screen
|
||||||
if ( x_pos < 1 )
|
if ( x_pos < 1 )
|
||||||
x_pos = 1;
|
x_pos = 1;
|
||||||
|
@ -689,7 +689,7 @@ bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int x1 = (*iter)->getX()
|
int x1 = (*iter)->getX()
|
||||||
, x2 = (*iter)->getX() + (*iter)->getWidth()
|
, x2 = (*iter)->getX() + int((*iter)->getWidth())
|
||||||
, y = (*iter)->getY()
|
, y = (*iter)->getY()
|
||||||
, mouse_x = mouse_pos.getX()
|
, mouse_x = mouse_pos.getX()
|
||||||
, mouse_y = mouse_pos.getY();
|
, mouse_y = mouse_pos.getY();
|
||||||
|
@ -780,7 +780,7 @@ bool FMenu::mouseUpOverList (FPoint mouse_pos)
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int x1 = (*iter)->getX()
|
int x1 = (*iter)->getX()
|
||||||
, x2 = (*iter)->getX() + (*iter)->getWidth()
|
, x2 = (*iter)->getX() + int((*iter)->getWidth())
|
||||||
, y = (*iter)->getY()
|
, y = (*iter)->getY()
|
||||||
, mouse_x = mouse_pos.getX()
|
, mouse_x = mouse_pos.getX()
|
||||||
, mouse_y = mouse_pos.getY();
|
, mouse_y = mouse_pos.getY();
|
||||||
|
@ -840,7 +840,7 @@ void FMenu::mouseMoveOverList (FPoint mouse_pos, mouseStates& ms)
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
int x1 = (*iter)->getX()
|
int x1 = (*iter)->getX()
|
||||||
, x2 = (*iter)->getX() + (*iter)->getWidth()
|
, x2 = (*iter)->getX() + int((*iter)->getWidth())
|
||||||
, y = (*iter)->getY()
|
, y = (*iter)->getY()
|
||||||
, mouse_x = mouse_pos.getX()
|
, mouse_x = mouse_pos.getX()
|
||||||
, mouse_y = mouse_pos.getY();
|
, 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
|
// Find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
wchar_t* txt = src;
|
wchar_t* txt = src;
|
||||||
|
|
||||||
for (uInt i = 0; i < length; i++)
|
for (std::size_t i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
if ( i < length && txt[i] == L'&' && pos == -1 )
|
if ( i < length && txt[i] == L'&' && pos == -1 )
|
||||||
{
|
{
|
||||||
|
@ -1294,14 +1296,16 @@ inline void FMenu::drawSeparator (int y)
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
print (fc::NF_border_line_vertical_right);
|
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 (line);
|
||||||
print (fc::NF_rev_border_line_vertical_left);
|
print (fc::NF_rev_border_line_vertical_left);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print (fc::BoxDrawingsVerticalAndRight);
|
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 (line);
|
||||||
print (fc::BoxDrawingsVerticalAndLeft);
|
print (fc::BoxDrawingsVerticalAndLeft);
|
||||||
}
|
}
|
||||||
|
@ -1315,8 +1319,8 @@ inline void FMenu::drawMenuLine (FMenuItem* menuitem, int y)
|
||||||
{
|
{
|
||||||
FString txt = menuitem->getText();
|
FString txt = menuitem->getText();
|
||||||
menuText txtdata;
|
menuText txtdata;
|
||||||
uInt txt_length = uInt(txt.getLength());
|
std::size_t txt_length = txt.getLength();
|
||||||
int to_char = int(txt_length);
|
std::size_t to_char = txt_length;
|
||||||
int accel_key = menuitem->accel_key;
|
int accel_key = menuitem->accel_key;
|
||||||
bool is_enabled = menuitem->isEnabled();
|
bool is_enabled = menuitem->isEnabled();
|
||||||
bool is_selected = menuitem->isSelected();
|
bool is_selected = menuitem->isSelected();
|
||||||
|
@ -1421,7 +1425,7 @@ inline void FMenu::drawMenuText (menuText& data)
|
||||||
{
|
{
|
||||||
// Print menu text
|
// 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])) )
|
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);
|
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;
|
std::size_t c = ( has_checkable_items ) ? 1 : 0;
|
||||||
int len = int(max_item_width) - (startpos + c + 3);
|
std::size_t len = max_item_width - (startpos + c + 3);
|
||||||
|
|
||||||
if ( len > 0 )
|
if ( len > 0 )
|
||||||
{
|
{
|
||||||
|
@ -1465,33 +1469,34 @@ inline void FMenu::drawSubMenuIndicator (int& startpos)
|
||||||
print (FString(len, wchar_t(' ')));
|
print (FString(len, wchar_t(' ')));
|
||||||
// Print BlackRightPointingPointer ►
|
// Print BlackRightPointingPointer ►
|
||||||
print (wchar_t(fc::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));
|
FString accel_name (getKeyName(accel_key));
|
||||||
int c = ( has_checkable_items ) ? 1 : 0;
|
std::size_t c = ( has_checkable_items ) ? 1 : 0;
|
||||||
int accel_len = int(accel_name.getLength());
|
std::size_t accel_len = accel_name.getLength();
|
||||||
int len = int(max_item_width) - (startpos + accel_len + c + 2);
|
std::size_t len = max_item_width - (startpos + accel_len + c + 2);
|
||||||
|
|
||||||
if ( len > 0 )
|
if ( len > 0 )
|
||||||
{
|
{
|
||||||
// Print filling blank spaces + accelerator key name
|
// Print filling blank spaces + accelerator key name
|
||||||
FString spaces (len, wchar_t(' '));
|
FString spaces (len, wchar_t(' '));
|
||||||
print (spaces + accel_name);
|
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
|
// 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 (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,12 +72,9 @@ void FMenuBar::hide()
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
screenWidth = getDesktopWidth();
|
screenWidth = getDesktopWidth();
|
||||||
|
|
||||||
if ( screenWidth < 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
blank = new char[std::size_t(screenWidth) + 1];
|
blank = new char[screenWidth + 1];
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -85,9 +82,9 @@ void FMenuBar::hide()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset(blank, ' ', std::size_t(screenWidth));
|
std::memset(blank, ' ', screenWidth);
|
||||||
blank[screenWidth] = '\0';
|
blank[screenWidth] = '\0';
|
||||||
setPrintPos (1,1);
|
setPrintPos (1, 1);
|
||||||
print (blank);
|
print (blank);
|
||||||
delete[] blank;
|
delete[] blank;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +253,7 @@ void FMenuBar::cb_item_deactivated (FWidget* widget, data_ptr)
|
||||||
void FMenuBar::init()
|
void FMenuBar::init()
|
||||||
{
|
{
|
||||||
FWidget* r = getRootWidget();
|
FWidget* r = getRootWidget();
|
||||||
int w = r->getWidth();
|
std::size_t w = r->getWidth();
|
||||||
// initialize geometry values
|
// initialize geometry values
|
||||||
setGeometry (1, 1, w, 1, false);
|
setGeometry (1, 1, w, 1, false);
|
||||||
setAlwaysOnTop();
|
setAlwaysOnTop();
|
||||||
|
@ -285,11 +282,11 @@ void FMenuBar::calculateDimensions()
|
||||||
// find the maximum item width
|
// find the maximum item width
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
uInt len = (*iter)->getTextLength();
|
std::size_t len = (*iter)->getTextLength();
|
||||||
int item_width = int(len + 2);
|
int item_width = int(len) + 2;
|
||||||
|
|
||||||
// set item geometry
|
// 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
|
// set menu position
|
||||||
if ( (*iter)->hasMenu() )
|
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
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
int hotkeypos = -1;
|
int hotkeypos = -1;
|
||||||
wchar_t* txt = src;
|
wchar_t* txt = src;
|
||||||
|
|
||||||
for (uInt i = 0; i < length; i++)
|
for (std::size_t i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
if ( i < length && txt[i] == L'&' && hotkeypos == -1 )
|
if ( i < length && txt[i] == L'&' && hotkeypos == -1 )
|
||||||
{
|
{
|
||||||
|
@ -550,7 +549,7 @@ void FMenuBar::drawItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print spaces to end of line
|
// Print spaces to end of line
|
||||||
for (; x <= screenWidth; x++)
|
for (; x <= int(screenWidth); x++)
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -562,13 +561,13 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, int& x)
|
||||||
{
|
{
|
||||||
FString txt = menuitem->getText();
|
FString txt = menuitem->getText();
|
||||||
menuText txtdata;
|
menuText txtdata;
|
||||||
uInt txt_length = txt.getLength();
|
std::size_t txt_length = txt.getLength();
|
||||||
|
std::size_t to_char;
|
||||||
int hotkeypos;
|
int hotkeypos;
|
||||||
int to_char;
|
|
||||||
bool is_enabled = menuitem->isEnabled();
|
bool is_enabled = menuitem->isEnabled();
|
||||||
bool is_selected = menuitem->isSelected();
|
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);
|
txtdata.no_underline = ((menuitem->getFlags() & fc::no_underline) != 0);
|
||||||
|
|
||||||
// Set screen attributes
|
// Set screen attributes
|
||||||
|
@ -585,10 +584,10 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, int& x)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( x - 1 <= screenWidth )
|
if ( x - 1 <= int(screenWidth) )
|
||||||
to_char = int(txt_length);
|
to_char = txt_length;
|
||||||
else
|
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);
|
hotkeypos = getHotkeyPos (txt.wc_str(), txtdata.text, txt_length);
|
||||||
|
|
||||||
|
@ -654,9 +653,9 @@ inline void FMenuBar::drawMenuText (menuText& data)
|
||||||
{
|
{
|
||||||
// Print menu text
|
// 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;
|
break;
|
||||||
|
|
||||||
if ( ! std::iswprint(wint_t(data.text[z])) )
|
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);
|
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)
|
inline void FMenuBar::drawEllipsis (menuText& txtdata, int x)
|
||||||
{
|
{
|
||||||
if ( x > screenWidth + 1 )
|
if ( x > int(screenWidth) + 1 )
|
||||||
{
|
{
|
||||||
if ( txtdata.startpos < screenWidth )
|
if ( txtdata.startpos < screenWidth )
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
setPrintPos (screenWidth - 1, 1);
|
setPrintPos (int(screenWidth) - 1, 1);
|
||||||
print ("..");
|
print ("..");
|
||||||
}
|
}
|
||||||
else if ( txtdata.startpos - 1 <= screenWidth )
|
else if ( txtdata.startpos - 1 <= screenWidth )
|
||||||
{
|
{
|
||||||
// Hide first character from text
|
// Hide first character from text
|
||||||
setPrintPos (screenWidth, 1);
|
setPrintPos (int(screenWidth), 1);
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -713,7 +712,7 @@ inline void FMenuBar::drawLeadingSpace (int& x)
|
||||||
{
|
{
|
||||||
// Print a leading blank space
|
// Print a leading blank space
|
||||||
|
|
||||||
if ( x < screenWidth )
|
if ( x < int(screenWidth) )
|
||||||
{
|
{
|
||||||
x++;
|
x++;
|
||||||
print (' ');
|
print (' ');
|
||||||
|
@ -725,7 +724,7 @@ inline void FMenuBar::drawTrailingSpace (int& x)
|
||||||
{
|
{
|
||||||
// Print a trailing blank space
|
// Print a trailing blank space
|
||||||
|
|
||||||
if ( x < screenWidth )
|
if ( x < int(screenWidth) )
|
||||||
{
|
{
|
||||||
x++;
|
x++;
|
||||||
print (' ');
|
print (' ');
|
||||||
|
@ -744,7 +743,7 @@ void FMenuBar::adjustItems()
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
// get item width
|
// get item width
|
||||||
int item_width = (*iter)->getWidth();
|
int item_width = int((*iter)->getWidth());
|
||||||
|
|
||||||
if ( (*iter)->hasMenu() )
|
if ( (*iter)->hasMenu() )
|
||||||
{
|
{
|
||||||
|
@ -874,7 +873,7 @@ void FMenuBar::mouseDownOverList (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int x1, x2;
|
int x1, x2;
|
||||||
x1 = (*iter)->getX();
|
x1 = (*iter)->getX();
|
||||||
x2 = (*iter)->getX() + (*iter)->getWidth();
|
x2 = (*iter)->getX() + int((*iter)->getWidth());
|
||||||
|
|
||||||
if ( mouse_y == 1 )
|
if ( mouse_y == 1 )
|
||||||
{
|
{
|
||||||
|
@ -924,7 +923,7 @@ void FMenuBar::mouseUpOverList (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int x1, x2;
|
int x1, x2;
|
||||||
x1 = (*iter)->getX();
|
x1 = (*iter)->getX();
|
||||||
x2 = (*iter)->getX() + (*iter)->getWidth();
|
x2 = (*iter)->getX() + int((*iter)->getWidth());
|
||||||
|
|
||||||
if ( mouse_y == 1
|
if ( mouse_y == 1
|
||||||
&& mouse_x >= x1
|
&& mouse_x >= x1
|
||||||
|
@ -974,7 +973,7 @@ void FMenuBar::mouseMoveOverList (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int x1, x2;
|
int x1, x2;
|
||||||
x1 = (*iter)->getX();
|
x1 = (*iter)->getX();
|
||||||
x2 = (*iter)->getX() + (*iter)->getWidth();
|
x2 = (*iter)->getX() + int((*iter)->getWidth());
|
||||||
|
|
||||||
if ( mouse_x >= x1
|
if ( mouse_x >= x1
|
||||||
&& mouse_x < x2
|
&& mouse_x < x2
|
||||||
|
|
|
@ -227,7 +227,7 @@ void FMenuItem::setText (const FString& txt)
|
||||||
if ( hotkey )
|
if ( hotkey )
|
||||||
text_length--;
|
text_length--;
|
||||||
|
|
||||||
setWidth(int(text_length));
|
setWidth(text_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -566,13 +566,13 @@ FMenuList* FMenuItem::getFMenuList (FWidget& widget)
|
||||||
|
|
||||||
if ( isMenu(&widget) )
|
if ( isMenu(&widget) )
|
||||||
{
|
{
|
||||||
FMenu* menu = static_cast<FMenu*>(&widget);
|
FMenu* Menu = static_cast<FMenu*>(&widget);
|
||||||
menu_list = static_cast<FMenuList*>(menu);
|
menu_list = static_cast<FMenuList*>(Menu);
|
||||||
}
|
}
|
||||||
else if ( isMenuBar(&widget) )
|
else if ( isMenuBar(&widget) )
|
||||||
{
|
{
|
||||||
FMenuBar* menubar = static_cast<FMenuBar*>(&widget);
|
FMenuBar* Menubar = static_cast<FMenuBar*>(&widget);
|
||||||
menu_list = static_cast<FMenuList*>(menubar);
|
menu_list = static_cast<FMenuList*>(Menubar);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
menu_list = 0;
|
menu_list = 0;
|
||||||
|
@ -589,7 +589,7 @@ void FMenuItem::init (FWidget* parent)
|
||||||
if ( hotkey )
|
if ( hotkey )
|
||||||
text_length--;
|
text_length--;
|
||||||
|
|
||||||
setGeometry (1, 1, int(text_length + 2), 1, false);
|
setGeometry (1, 1, text_length + 2, 1, false);
|
||||||
|
|
||||||
if ( ! parent )
|
if ( ! parent )
|
||||||
return;
|
return;
|
||||||
|
@ -629,14 +629,14 @@ void FMenuItem::init (FWidget* parent)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uChar FMenuItem::hotKey()
|
uChar FMenuItem::hotKey()
|
||||||
{
|
{
|
||||||
uInt length;
|
std::size_t length;
|
||||||
|
|
||||||
if ( text.isEmpty() )
|
if ( text.isEmpty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
length = text.getLength();
|
length = text.getLength();
|
||||||
|
|
||||||
for (uInt i = 0; i < length; i++)
|
for (std::size_t i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -159,9 +159,9 @@ void FMessageBox::setHeadline (const FString& headline)
|
||||||
setHeight(getHeight() + 2, true);
|
setHeight(getHeight() + 2, true);
|
||||||
|
|
||||||
for (uInt n = 0; n < num_buttons; n++)
|
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 )
|
if ( len > max_line_width )
|
||||||
max_line_width = len;
|
max_line_width = len;
|
||||||
|
@ -172,13 +172,13 @@ void FMessageBox::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
text = txt;
|
text = txt;
|
||||||
calculateDimensions();
|
calculateDimensions();
|
||||||
button[0]->setY (getHeight() - 4, false);
|
button[0]->setY (int(getHeight()) - 4, false);
|
||||||
|
|
||||||
if ( button_digit[1] != 0 )
|
if ( button_digit[1] != 0 )
|
||||||
button[1]->setY (getHeight() - 4, false);
|
button[1]->setY (int(getHeight()) - 4, false);
|
||||||
|
|
||||||
if ( button_digit[2] != 0 )
|
if ( button_digit[2] != 0 )
|
||||||
button[2]->setY (getHeight() - 4, false);
|
button[2]->setY (int(getHeight()) - 4, false);
|
||||||
|
|
||||||
adjustButtons();
|
adjustButtons();
|
||||||
}
|
}
|
||||||
|
@ -279,10 +279,9 @@ int FMessageBox::error ( FWidget* parent
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMessageBox::adjustSize()
|
void FMessageBox::adjustSize()
|
||||||
{
|
{
|
||||||
int X
|
int X, Y;
|
||||||
, Y
|
std::size_t max_width;
|
||||||
, max_width
|
std::size_t max_height;
|
||||||
, max_height;
|
|
||||||
FWidget* root_widget = getRootWidget();
|
FWidget* root_widget = getRootWidget();
|
||||||
|
|
||||||
if ( root_widget )
|
if ( root_widget )
|
||||||
|
@ -350,7 +349,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
|
||||||
{
|
{
|
||||||
button[0] = new FButton (this);
|
button[0] = new FButton (this);
|
||||||
button[0]->setText(button_text[button0]);
|
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]->setWidth(1, false);
|
||||||
button[0]->setHeight(1, false);
|
button[0]->setHeight(1, false);
|
||||||
button[0]->setFocus();
|
button[0]->setFocus();
|
||||||
|
@ -359,7 +358,7 @@ inline void FMessageBox::allocation (int button0, int button1, int button2)
|
||||||
{
|
{
|
||||||
button[1] = new FButton(this);
|
button[1] = new FButton(this);
|
||||||
button[1]->setText(button_text[button1]);
|
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]->setWidth(0, false);
|
||||||
button[1]->setHeight(1, 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] = new FButton(this);
|
||||||
button[2]->setText(button_text[button2]);
|
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]->setWidth(0, false);
|
||||||
button[2]->setHeight(1, false);
|
button[2]->setHeight(1, false);
|
||||||
}
|
}
|
||||||
|
@ -424,8 +423,9 @@ inline void FMessageBox::initCallbacks()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMessageBox::calculateDimensions()
|
void FMessageBox::calculateDimensions()
|
||||||
{
|
{
|
||||||
int x, y, w, h;
|
int x, y;
|
||||||
int headline_height = 0;
|
std::size_t w, h;
|
||||||
|
std::size_t headline_height = 0;
|
||||||
FWidget* parent_widget = getParentWidget();
|
FWidget* parent_widget = getParentWidget();
|
||||||
text_split = text.split("\n");
|
text_split = text.split("\n");
|
||||||
text_num_lines = uInt(text_split.size());
|
text_num_lines = uInt(text_split.size());
|
||||||
|
@ -437,14 +437,14 @@ void FMessageBox::calculateDimensions()
|
||||||
|
|
||||||
for (uInt i = 0; i < text_num_lines; i++)
|
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 )
|
if ( len > max_line_width )
|
||||||
max_line_width = len;
|
max_line_width = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
h = int(text_num_lines) + 8 + headline_height;
|
h = text_num_lines + 8 + headline_height;
|
||||||
w = int(max_line_width + 4);
|
w = max_line_width + 4;
|
||||||
|
|
||||||
if ( w < 20 )
|
if ( w < 20 )
|
||||||
w = 20;
|
w = 20;
|
||||||
|
@ -468,7 +468,7 @@ void FMessageBox::draw()
|
||||||
int head_offset = 0;
|
int head_offset = 0;
|
||||||
int center_x = 0;
|
int center_x = 0;
|
||||||
// center the whole block
|
// 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() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
@ -476,7 +476,7 @@ void FMessageBox::draw()
|
||||||
if ( ! headline_text.isNull() )
|
if ( ! headline_text.isNull() )
|
||||||
{
|
{
|
||||||
setColor(emphasis_color, getBackgroundColor());
|
setColor(emphasis_color, getBackgroundColor());
|
||||||
uInt headline_length = headline_text.getLength();
|
std::size_t headline_length = headline_text.getLength();
|
||||||
|
|
||||||
if ( center_text ) // center one line
|
if ( center_text ) // center one line
|
||||||
center_x = int((max_line_width - headline_length) / 2);
|
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++)
|
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
|
if ( center_text ) // center one line
|
||||||
center_x = int((max_line_width - line_length) / 2);
|
center_x = int((max_line_width - line_length) / 2);
|
||||||
|
@ -506,9 +506,9 @@ void FMessageBox::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMessageBox::resizeButtons()
|
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();
|
len[n] = button[n]->getText().getLength();
|
||||||
|
|
||||||
|
@ -530,17 +530,17 @@ void FMessageBox::resizeButtons()
|
||||||
if ( max_size < 7 )
|
if ( max_size < 7 )
|
||||||
max_size = 7;
|
max_size = 7;
|
||||||
|
|
||||||
for (uInt n = 0; n < num_buttons; n++)
|
for (std::size_t n = 0; n < num_buttons; n++)
|
||||||
button[n]->setWidth(int(max_size + 3), false);
|
button[n]->setWidth(max_size + 3, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMessageBox::adjustButtons()
|
void FMessageBox::adjustButtons()
|
||||||
{
|
{
|
||||||
static const int gap = 4;
|
static const std::size_t gap = 4;
|
||||||
int btn_width = 0;
|
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 )
|
if ( n == num_buttons - 1 )
|
||||||
btn_width += button[n]->getWidth();
|
btn_width += button[n]->getWidth();
|
||||||
|
@ -550,7 +550,7 @@ void FMessageBox::adjustButtons()
|
||||||
|
|
||||||
if ( btn_width >= getWidth() - 4 )
|
if ( btn_width >= getWidth() - 4 )
|
||||||
{
|
{
|
||||||
int max_width;
|
std::size_t max_width;
|
||||||
FWidget* root_widget = getRootWidget();
|
FWidget* root_widget = getRootWidget();
|
||||||
setWidth(btn_width + 5);
|
setWidth(btn_width + 5);
|
||||||
max_width = ( root_widget ) ? root_widget->getClientWidth() : 80;
|
max_width = ( root_widget ) ? root_widget->getClientWidth() : 80;
|
||||||
|
@ -559,14 +559,14 @@ void FMessageBox::adjustButtons()
|
||||||
|
|
||||||
int btn_x = int((getWidth() - btn_width) / 2);
|
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 )
|
if ( n == 0 )
|
||||||
button[n]->setX(btn_x);
|
button[n]->setX(btn_x);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int btn_size = button[n]->getWidth();
|
int btn_size = int(button[n]->getWidth());
|
||||||
button[n]->setX( btn_x + int(n) * (btn_size + gap) );
|
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 len = std::strlen(fifo_buf);
|
||||||
std::size_t n = 3;
|
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];
|
sgr_mouse[n - 3] = fifo_buf[n];
|
||||||
n++;
|
n++;
|
||||||
|
@ -954,7 +954,7 @@ void FMouseUrxvt::setRawData (FKeyboard::keybuffer& fifo_buf)
|
||||||
std::size_t len = std::strlen(fifo_buf);
|
std::size_t len = std::strlen(fifo_buf);
|
||||||
std::size_t n = 2;
|
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];
|
urxvt_mouse[n - 2] = fifo_buf[n];
|
||||||
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 ( w > 0 );
|
||||||
assert ( h > 0 );
|
assert ( h > 0 );
|
||||||
|
@ -493,10 +493,10 @@ void FOptiMove::set_clr_eol (char cap[])
|
||||||
void FOptiMove::check_boundaries ( int& xold, int& yold
|
void FOptiMove::check_boundaries ( int& xold, int& yold
|
||||||
, int& xnew, int& ynew )
|
, int& xnew, int& ynew )
|
||||||
{
|
{
|
||||||
if ( xold < 0 || xold >= screen_width )
|
if ( xold < 0 || xold >= int(screen_width) )
|
||||||
xold = -1;
|
xold = -1;
|
||||||
|
|
||||||
if ( yold < 0 || yold >= screen_height )
|
if ( yold < 0 || yold >= int(screen_height) )
|
||||||
yold = -1;
|
yold = -1;
|
||||||
|
|
||||||
if ( xnew < 0 )
|
if ( xnew < 0 )
|
||||||
|
@ -505,11 +505,11 @@ void FOptiMove::check_boundaries ( int& xold, int& yold
|
||||||
if ( ynew < 0 )
|
if ( ynew < 0 )
|
||||||
ynew = 0;
|
ynew = 0;
|
||||||
|
|
||||||
if ( xnew >= screen_width )
|
if ( xnew >= int(screen_width) )
|
||||||
xnew = screen_width - 1;
|
xnew = int(screen_width) - 1;
|
||||||
|
|
||||||
if ( ynew >= screen_height )
|
if ( ynew >= int(screen_height) )
|
||||||
ynew = screen_height - 1;
|
ynew = int(screen_height) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -962,7 +962,7 @@ inline bool FOptiMove::isWideMove ( int xold, int yold
|
||||||
, int xnew, int ynew )
|
, int xnew, int ynew )
|
||||||
{
|
{
|
||||||
return bool ( xnew > MOVE_LIMIT
|
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)
|
&& std::abs(xnew - xold) + std::abs(ynew - yold)
|
||||||
> MOVE_LIMIT );
|
> MOVE_LIMIT );
|
||||||
}
|
}
|
||||||
|
@ -1066,7 +1066,7 @@ inline bool FOptiMove::isMethod4Faster ( int& move_time
|
||||||
char null_result[BUF_SIZE];
|
char null_result[BUF_SIZE];
|
||||||
char* null_ptr = null_result;
|
char* null_ptr = null_result;
|
||||||
int new_time = relativeMove ( null_ptr
|
int new_time = relativeMove ( null_ptr
|
||||||
, 0, screen_height - 1
|
, 0, int(screen_height) - 1
|
||||||
, xnew, ynew );
|
, xnew, ynew );
|
||||||
|
|
||||||
if ( new_time < LONG_DURATION
|
if ( new_time < LONG_DURATION
|
||||||
|
@ -1094,7 +1094,7 @@ inline bool FOptiMove::isMethod5Faster ( int& move_time
|
||||||
char null_result[BUF_SIZE];
|
char null_result[BUF_SIZE];
|
||||||
char* null_ptr = null_result;
|
char* null_ptr = null_result;
|
||||||
int new_time = relativeMove ( null_ptr
|
int new_time = relativeMove ( null_ptr
|
||||||
, screen_width - 1, yold - 1
|
, int(screen_width) - 1, yold - 1
|
||||||
, xnew, ynew );
|
, xnew, ynew );
|
||||||
|
|
||||||
if ( new_time < LONG_DURATION
|
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);
|
std::strncpy (move_ptr, F_cursor_to_ll.cap, BUF_SIZE - 1);
|
||||||
move_ptr[BUF_SIZE - 1] ='\0';
|
move_ptr[BUF_SIZE - 1] ='\0';
|
||||||
move_ptr += F_cursor_to_ll.length;
|
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;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
|
@ -1161,7 +1161,7 @@ void FOptiMove::moveByMethod ( int method
|
||||||
, BUF_SIZE - std::strlen(move_ptr) );
|
, BUF_SIZE - std::strlen(move_ptr) );
|
||||||
move_ptr[BUF_SIZE - 1] ='\0';
|
move_ptr[BUF_SIZE - 1] ='\0';
|
||||||
move_ptr += std::strlen(move_buf);
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
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
|
// Set the progress bar geometry
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ bool FProgressbar::setShadow (bool on)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FProgressbar::hide()
|
void FProgressbar::hide()
|
||||||
{
|
{
|
||||||
int s, size;
|
std::size_t s, size;
|
||||||
short fg, bg;
|
short fg, bg;
|
||||||
char* blank;
|
char* blank;
|
||||||
FWidget* parent_widget = getParentWidget();
|
FWidget* parent_widget = getParentWidget();
|
||||||
|
@ -121,7 +121,7 @@ void FProgressbar::hide()
|
||||||
s = hasShadow() ? 1 : 0;
|
s = hasShadow() ? 1 : 0;
|
||||||
size = getWidth() + s;
|
size = getWidth() + s;
|
||||||
|
|
||||||
if ( size < 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -137,14 +137,14 @@ void FProgressbar::hide()
|
||||||
std::memset(blank, ' ', std::size_t(size));
|
std::memset(blank, ' ', std::size_t(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y = 0; y < getHeight() + s; y++)
|
for (int y = 0; y < int(getHeight() + s); y++)
|
||||||
{
|
{
|
||||||
setPrintPos (1, 1 + y);
|
setPrintPos (1, 1 + y);
|
||||||
print (blank);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] blank;
|
delete[] blank;
|
||||||
setPrintPos (getWidth() - 4, 0);
|
setPrintPos (int(getWidth()) - 4, 0);
|
||||||
print (" "); // hide percentage
|
print (" "); // hide percentage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ void FProgressbar::drawPercentage()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
setPrintPos (getWidth() - 3, 0);
|
setPrintPos (int(getWidth()) - 3, 0);
|
||||||
|
|
||||||
if ( percentage < 0 || percentage > 100 )
|
if ( percentage < 0 || percentage > 100 )
|
||||||
print ("--- %");
|
print ("--- %");
|
||||||
|
@ -204,8 +204,8 @@ void FProgressbar::drawPercentage()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FProgressbar::drawBar()
|
void FProgressbar::drawBar()
|
||||||
{
|
{
|
||||||
int i = 0;
|
std::size_t i = 0;
|
||||||
double length = double(bar_length * percentage) / 100;
|
double length = double(int(bar_length) * percentage) / 100;
|
||||||
setPrintPos (1,1);
|
setPrintPos (1,1);
|
||||||
setColor ( wc.progressbar_bg
|
setColor ( wc.progressbar_bg
|
||||||
, wc.progressbar_fg );
|
, 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);
|
X2 = short(X1 + short(w) - 1);
|
||||||
Y2 = short(Y1 + h - 1);
|
Y2 = short(Y1 + short(h) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FRect::setRect (const FRect& r)
|
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);
|
X1 = short(x);
|
||||||
Y1 = short(y);
|
Y1 = short(y);
|
||||||
X2 = short(x + width - 1);
|
X2 = short(x + int(width) - 1);
|
||||||
Y2 = short(y + height - 1);
|
Y2 = short(y + int(height) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -248,8 +251,8 @@ FRect operator + (const FRect& r, const FPoint& p)
|
||||||
{
|
{
|
||||||
return FRect ( r.X1
|
return FRect ( r.X1
|
||||||
, r.Y1
|
, r.Y1
|
||||||
, r.X2 - r.X1 + 1 + p.getX()
|
, std::size_t(r.X2 - r.X1 + 1 + p.getX())
|
||||||
, r.Y2 - r.Y1 + 1 + p.getY() );
|
, 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
|
return FRect ( r.X1
|
||||||
, r.Y1
|
, r.Y1
|
||||||
, r.X2 - r.X1 + 1 - p.getX()
|
, std::size_t(r.X2 - r.X1 + 1 - p.getX())
|
||||||
, r.Y2 - r.Y1 + 1 - p.getY() );
|
, 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)
|
void FScrollbar::setOrientation (int o)
|
||||||
{
|
{
|
||||||
int nf = 0;
|
std::size_t nf = 0;
|
||||||
length = ( getHeight() > getWidth() ) ? getHeight() : getWidth();
|
length = ( getHeight() > getWidth() ) ? getHeight() : getWidth();
|
||||||
|
|
||||||
if ( o == fc::vertical && bar_orientation == fc::horizontal )
|
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
|
// Set the scrollbar geometry
|
||||||
|
|
||||||
FWidget::setGeometry (x, y, w, h, adjust);
|
FWidget::setGeometry (x, y, w, h, adjust);
|
||||||
|
|
||||||
int nf = 0;
|
std::size_t nf = 0;
|
||||||
length = ( h > w ) ? h : w;
|
length = ( h > w ) ? h : w;
|
||||||
|
|
||||||
if ( bar_orientation == fc::vertical )
|
if ( bar_orientation == fc::vertical )
|
||||||
|
@ -223,7 +223,7 @@ void FScrollbar::calculateSliderValues()
|
||||||
else
|
else
|
||||||
bar_length = length - 2;
|
bar_length = length - 2;
|
||||||
|
|
||||||
slider_length = int(double(bar_length) / steps);
|
slider_length = std::size_t(double(bar_length) / steps);
|
||||||
|
|
||||||
if ( slider_length < 1 )
|
if ( slider_length < 1 )
|
||||||
slider_length = 1;
|
slider_length = 1;
|
||||||
|
@ -238,17 +238,18 @@ void FScrollbar::calculateSliderValues()
|
||||||
|
|
||||||
if ( val == max )
|
if ( val == max )
|
||||||
{
|
{
|
||||||
slider_pos = bar_length - slider_length;
|
slider_pos = int(bar_length - slider_length);
|
||||||
return;
|
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) ) );
|
/ double(max - min) ) );
|
||||||
|
|
||||||
if ( slider_pos < 0 )
|
if ( slider_pos < 0 )
|
||||||
slider_pos = 0;
|
slider_pos = 0;
|
||||||
else if ( slider_pos > bar_length - slider_length )
|
else if ( slider_pos > int(bar_length - slider_length) )
|
||||||
slider_pos = bar_length - slider_length;
|
slider_pos = int(bar_length - slider_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -280,7 +281,7 @@ void FScrollbar::drawVerticalBar()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
for (z = 1; z <= slider_length; z++)
|
for (z = 1; z <= int(slider_length); z++)
|
||||||
{
|
{
|
||||||
setPrintPos (1, 1 + slider_pos + z);
|
setPrintPos (1, 1 + slider_pos + z);
|
||||||
|
|
||||||
|
@ -295,7 +296,7 @@ void FScrollbar::drawVerticalBar()
|
||||||
|
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
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);
|
setPrintPos (1, 1 + z);
|
||||||
|
|
||||||
|
@ -343,16 +344,16 @@ void FScrollbar::drawHorizontalBar()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
for (z = 0; z < slider_length; z++)
|
for (z = 0; z < int(slider_length); z++)
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
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 )
|
if ( isNewFont() && max_color > 8 )
|
||||||
print (fc::NF_border_line_upper); // ¯
|
print (fc::NF_border_line_upper); // ¯
|
||||||
|
@ -500,8 +501,8 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mouse_x < 1 || mouse_x > getWidth()
|
if ( mouse_x < 1 || mouse_x > int(getWidth())
|
||||||
|| mouse_y < 1 || mouse_y > getHeight() )
|
|| mouse_y < 1 || mouse_y > int(getHeight()) )
|
||||||
{
|
{
|
||||||
delOwnTimer();
|
delOwnTimer();
|
||||||
}
|
}
|
||||||
|
@ -554,7 +555,7 @@ void FScrollbar::onTimer (FTimerEvent*)
|
||||||
|| ( scroll_type == FScrollbar::scrollPageForward
|
|| ( scroll_type == FScrollbar::scrollPageForward
|
||||||
&& slider_pos == slider_click_stop_pos ) )
|
&& 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
|
if ( scroll_type == FScrollbar::scrollPageBackward
|
||||||
&& slider_pos == 0 )
|
&& slider_pos == 0 )
|
||||||
|
@ -610,7 +611,7 @@ void FScrollbar::drawButtons()
|
||||||
{
|
{
|
||||||
print (fc::NF_rev_up_arrow1);
|
print (fc::NF_rev_up_arrow1);
|
||||||
print (fc::NF_rev_up_arrow2);
|
print (fc::NF_rev_up_arrow2);
|
||||||
setPrintPos (1, length);
|
setPrintPos (1, int(length));
|
||||||
print (fc::NF_rev_down_arrow1);
|
print (fc::NF_rev_down_arrow1);
|
||||||
print (fc::NF_rev_down_arrow2);
|
print (fc::NF_rev_down_arrow2);
|
||||||
}
|
}
|
||||||
|
@ -618,7 +619,7 @@ void FScrollbar::drawButtons()
|
||||||
{
|
{
|
||||||
print (fc::NF_rev_left_arrow1);
|
print (fc::NF_rev_left_arrow1);
|
||||||
print (fc::NF_rev_left_arrow2);
|
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_arrow1);
|
||||||
print (fc::NF_rev_right_arrow2);
|
print (fc::NF_rev_right_arrow2);
|
||||||
}
|
}
|
||||||
|
@ -633,13 +634,13 @@ void FScrollbar::drawButtons()
|
||||||
if ( bar_orientation == fc::vertical )
|
if ( bar_orientation == fc::vertical )
|
||||||
{
|
{
|
||||||
print (fc::BlackUpPointingTriangle); // ▲
|
print (fc::BlackUpPointingTriangle); // ▲
|
||||||
setPrintPos (1, length);
|
setPrintPos (1, int(length));
|
||||||
print (fc::BlackDownPointingTriangle); // ▼
|
print (fc::BlackDownPointingTriangle); // ▼
|
||||||
}
|
}
|
||||||
else // horizontal
|
else // horizontal
|
||||||
{
|
{
|
||||||
print (fc::BlackLeftPointingPointer); // ◄
|
print (fc::BlackLeftPointingPointer); // ◄
|
||||||
setPrintPos (length, 1);
|
setPrintPos (int(length), 1);
|
||||||
print (fc::BlackRightPointingPointer); // ►
|
print (fc::BlackRightPointingPointer); // ►
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,11 +673,11 @@ FScrollbar::sType FScrollbar::getVerticalClickedScrollType (int y)
|
||||||
{
|
{
|
||||||
return FScrollbar::scrollPageBackward; // before slider
|
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
|
return FScrollbar::scrollPageForward; // after slider
|
||||||
}
|
}
|
||||||
else if ( y == getHeight() )
|
else if ( y == int(getHeight()) )
|
||||||
{
|
{
|
||||||
return FScrollbar::scrollStepForward; // increment button
|
return FScrollbar::scrollStepForward; // increment button
|
||||||
}
|
}
|
||||||
|
@ -697,11 +698,11 @@ FScrollbar::sType FScrollbar::getHorizontalClickedScrollType (int x)
|
||||||
{
|
{
|
||||||
return FScrollbar::scrollPageBackward; // before slider
|
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
|
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
|
return FScrollbar::scrollStepForward; // increment button
|
||||||
}
|
}
|
||||||
|
@ -718,11 +719,11 @@ FScrollbar::sType FScrollbar::getHorizontalClickedScrollType (int x)
|
||||||
{
|
{
|
||||||
return FScrollbar::scrollPageBackward; // before slider
|
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
|
return FScrollbar::scrollPageForward; // after slider
|
||||||
}
|
}
|
||||||
else if ( x == getWidth() )
|
else if ( x == int(getWidth()) )
|
||||||
{
|
{
|
||||||
return FScrollbar::scrollStepForward; // increment button
|
return FScrollbar::scrollStepForward; // increment button
|
||||||
}
|
}
|
||||||
|
@ -739,7 +740,7 @@ int FScrollbar::getSliderClickPos (int mouse_x, int mouse_y)
|
||||||
if ( bar_orientation == fc::vertical )
|
if ( bar_orientation == fc::vertical )
|
||||||
{
|
{
|
||||||
if ( mouse_y > slider_pos + 1
|
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
|
return mouse_y; // on slider
|
||||||
}
|
}
|
||||||
else // horizontal bar orientation
|
else // horizontal bar orientation
|
||||||
|
@ -747,13 +748,13 @@ int FScrollbar::getSliderClickPos (int mouse_x, int mouse_y)
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
if ( mouse_x > slider_pos + 2
|
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
|
return mouse_x; // on slider
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( mouse_x > slider_pos + 1
|
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
|
return mouse_x; // on slider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -768,7 +769,7 @@ void FScrollbar::jumpToClickPos (int x, int y)
|
||||||
|
|
||||||
if ( bar_orientation == fc::vertical )
|
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))
|
new_val = int( round ( double(max - min) * (y - 2.0 - (slider_length/2))
|
||||||
/ double(bar_length - slider_length) ) );
|
/ double(bar_length - slider_length) ) );
|
||||||
|
@ -780,7 +781,7 @@ void FScrollbar::jumpToClickPos (int x, int y)
|
||||||
{
|
{
|
||||||
int nf = isNewFont() ? 1 : 0;
|
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))
|
new_val = int( round ( double(max - min) * (x - 2.0 - nf - (slider_length/2))
|
||||||
/ double(bar_length - slider_length) ) );
|
/ double(bar_length - slider_length) ) );
|
||||||
|
|
|
@ -62,7 +62,7 @@ FScrollView::~FScrollView() // destructor
|
||||||
|
|
||||||
// public methods of FScrollView
|
// public methods of FScrollView
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollView::setScrollWidth (int width)
|
void FScrollView::setScrollWidth (std::size_t width)
|
||||||
{
|
{
|
||||||
if ( width < getViewportWidth() )
|
if ( width < getViewportWidth() )
|
||||||
width = getViewportWidth();
|
width = getViewportWidth();
|
||||||
|
@ -83,14 +83,14 @@ void FScrollView::setScrollWidth (int width)
|
||||||
child_print_area = viewport;
|
child_print_area = viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
hbar->setMaximum (width - getViewportWidth());
|
hbar->setMaximum (int(width - getViewportWidth()));
|
||||||
hbar->setPageSize (width, getViewportWidth());
|
hbar->setPageSize (int(width), int(getViewportWidth()));
|
||||||
hbar->calculateSliderValues();
|
hbar->calculateSliderValues();
|
||||||
setHorizontalScrollBarVisibility();
|
setHorizontalScrollBarVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollView::setScrollHeight (int height)
|
void FScrollView::setScrollHeight (std::size_t height)
|
||||||
{
|
{
|
||||||
if ( height < getViewportHeight() )
|
if ( height < getViewportHeight() )
|
||||||
height = getViewportHeight();
|
height = getViewportHeight();
|
||||||
|
@ -110,14 +110,14 @@ void FScrollView::setScrollHeight (int height)
|
||||||
child_print_area = viewport;
|
child_print_area = viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
vbar->setMaximum (height - getViewportHeight());
|
vbar->setMaximum (int(height - getViewportHeight()));
|
||||||
vbar->setPageSize (height, getViewportHeight());
|
vbar->setPageSize (int(height), int(getViewportHeight()));
|
||||||
vbar->calculateSliderValues();
|
vbar->calculateSliderValues();
|
||||||
setVerticalScrollBarVisibility();
|
setVerticalScrollBarVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollView::setScrollSize (int width, int height)
|
void FScrollView::setScrollSize (std::size_t width, std::size_t height)
|
||||||
{
|
{
|
||||||
int xoffset_end
|
int xoffset_end
|
||||||
, yoffset_end;
|
, yoffset_end;
|
||||||
|
@ -143,20 +143,20 @@ void FScrollView::setScrollSize (int width, int height)
|
||||||
child_print_area = viewport;
|
child_print_area = viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
xoffset_end = getScrollWidth() - getViewportWidth();
|
xoffset_end = int(getScrollWidth() - getViewportWidth());
|
||||||
yoffset_end = getScrollHeight() - getViewportHeight();
|
yoffset_end = int(getScrollHeight() - getViewportHeight());
|
||||||
setTopPadding (1 - getScrollY());
|
setTopPadding (1 - getScrollY());
|
||||||
setLeftPadding (1 - getScrollX());
|
setLeftPadding (1 - getScrollX());
|
||||||
setBottomPadding (1 - (yoffset_end - getScrollY()));
|
setBottomPadding (1 - (yoffset_end - getScrollY()));
|
||||||
setRightPadding (1 - (xoffset_end - getScrollX()) + nf_offset);
|
setRightPadding (1 - (xoffset_end - getScrollX()) + nf_offset);
|
||||||
|
|
||||||
hbar->setMaximum (width - getViewportWidth());
|
hbar->setMaximum (int(width - getViewportWidth()));
|
||||||
hbar->setPageSize (width, getViewportWidth());
|
hbar->setPageSize (int(width), int(getViewportWidth()));
|
||||||
hbar->calculateSliderValues();
|
hbar->calculateSliderValues();
|
||||||
setHorizontalScrollBarVisibility();
|
setHorizontalScrollBarVisibility();
|
||||||
|
|
||||||
vbar->setMaximum (height - getViewportHeight());
|
vbar->setMaximum (int(height - getViewportHeight()));
|
||||||
vbar->setPageSize (height, getViewportHeight());
|
vbar->setPageSize (int(height), int(getViewportHeight()));
|
||||||
vbar->calculateSliderValues();
|
vbar->calculateSliderValues();
|
||||||
setVerticalScrollBarVisibility();
|
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);
|
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();
|
calculateScrollbarPos();
|
||||||
|
|
||||||
if ( getScrollWidth() < getViewportWidth() )
|
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);
|
FWidget::setHeight (h, adjust);
|
||||||
viewport_geometry.setHeight(h - horizontal_border_spacing);
|
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);
|
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 );
|
, h - horizontal_border_spacing );
|
||||||
calculateScrollbarPos();
|
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
|
// Set the scroll view geometry
|
||||||
|
|
||||||
FWidget::setGeometry (x, y, w, h, adjust);
|
FWidget::setGeometry (x, y, w, h, adjust);
|
||||||
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
||||||
, getTermY() + getTopPadding() - 1 );
|
, getTermY() + getTopPadding() - 1 );
|
||||||
viewport_geometry.setSize ( w - vertical_border_spacing - nf_offset
|
viewport_geometry.setSize ( w - vertical_border_spacing - std::size_t(nf_offset)
|
||||||
, h - horizontal_border_spacing );
|
, h - horizontal_border_spacing );
|
||||||
calculateScrollbarPos();
|
calculateScrollbarPos();
|
||||||
|
|
||||||
|
@ -337,8 +337,8 @@ void FScrollView::scrollTo (int x, int y)
|
||||||
short yoffset_before = yoffset;
|
short yoffset_before = yoffset;
|
||||||
short xoffset_end = short(getScrollWidth() - getViewportWidth());
|
short xoffset_end = short(getScrollWidth() - getViewportWidth());
|
||||||
short yoffset_end = short(getScrollHeight() - getViewportHeight());
|
short yoffset_end = short(getScrollHeight() - getViewportHeight());
|
||||||
int save_width = viewport_geometry.getWidth();
|
std::size_t save_width = viewport_geometry.getWidth();
|
||||||
int save_height = viewport_geometry.getHeight();
|
std::size_t save_height = viewport_geometry.getHeight();
|
||||||
bool changeX = false;
|
bool changeX = false;
|
||||||
bool changeY = false;
|
bool changeY = false;
|
||||||
x--;
|
x--;
|
||||||
|
@ -421,7 +421,7 @@ void FScrollView::draw()
|
||||||
if ( border )
|
if ( border )
|
||||||
{
|
{
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
drawBorder (1, 1, getWidth() - 1, getHeight());
|
drawBorder (1, 1, int(getWidth()) - 1, int(getHeight()));
|
||||||
else
|
else
|
||||||
drawBorder();
|
drawBorder();
|
||||||
}
|
}
|
||||||
|
@ -463,12 +463,12 @@ void FScrollView::onKeyPress (FKeyEvent* ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_ppage:
|
case fc::Fkey_ppage:
|
||||||
scrollBy (0, -getViewportHeight());
|
scrollBy (0, int(-getViewportHeight()));
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_npage:
|
case fc::Fkey_npage:
|
||||||
scrollBy (0, getViewportHeight());
|
scrollBy (0, int(getViewportHeight()));
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -558,12 +558,12 @@ void FScrollView::onChildFocusIn (FFocusEvent*)
|
||||||
, wy = widget_geometry.getY();
|
, wy = widget_geometry.getY();
|
||||||
|
|
||||||
if ( wx > vx )
|
if ( wx > vx )
|
||||||
x = widget_geometry.getX2() - vp_geometry.getWidth() + 1;
|
x = widget_geometry.getX2() - int(vp_geometry.getWidth()) + 1;
|
||||||
else
|
else
|
||||||
x = wx;
|
x = wx;
|
||||||
|
|
||||||
if ( wy > vy )
|
if ( wy > vy )
|
||||||
y = widget_geometry.getY2() - vp_geometry.getHeight() + 1;
|
y = widget_geometry.getY2() - int(vp_geometry.getHeight()) + 1;
|
||||||
else
|
else
|
||||||
y = wy;
|
y = wy;
|
||||||
|
|
||||||
|
@ -622,10 +622,10 @@ FVTerm::term_area* FScrollView::getPrintArea()
|
||||||
void FScrollView::adjustSize()
|
void FScrollView::adjustSize()
|
||||||
{
|
{
|
||||||
FWidget::adjustSize();
|
FWidget::adjustSize();
|
||||||
int width = getWidth()
|
std::size_t width = getWidth();
|
||||||
, height = getHeight()
|
std::size_t height = getHeight();
|
||||||
, xoffset = viewport_geometry.getX()
|
int xoffset = viewport_geometry.getX();
|
||||||
, yoffset = viewport_geometry.getY();
|
int yoffset = viewport_geometry.getY();
|
||||||
|
|
||||||
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
||||||
, getTermY() + getTopPadding() - 1 );
|
, getTermY() + getTopPadding() - 1 );
|
||||||
|
@ -636,17 +636,17 @@ void FScrollView::adjustSize()
|
||||||
viewport->offset_top = scroll_geometry.getY();
|
viewport->offset_top = scroll_geometry.getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
hbar->setMaximum (getScrollWidth() - getViewportWidth());
|
hbar->setMaximum (int(getScrollWidth() - getViewportWidth()));
|
||||||
hbar->setPageSize (getScrollWidth(), getViewportWidth());
|
hbar->setPageSize (int(getScrollWidth()), int(getViewportWidth()));
|
||||||
hbar->setY (height);
|
hbar->setY (int(height));
|
||||||
hbar->setWidth (width - 2, false);
|
hbar->setWidth (width - 2, false);
|
||||||
hbar->setValue (xoffset);
|
hbar->setValue (xoffset);
|
||||||
hbar->resize();
|
hbar->resize();
|
||||||
setHorizontalScrollBarVisibility();
|
setHorizontalScrollBarVisibility();
|
||||||
|
|
||||||
vbar->setMaximum (getScrollHeight() - getViewportHeight());
|
vbar->setMaximum (int(getScrollHeight() - getViewportHeight()));
|
||||||
vbar->setPageSize (getScrollHeight(), getViewportHeight());
|
vbar->setPageSize (int(getScrollHeight()), int(getViewportHeight()));
|
||||||
vbar->setX (width);
|
vbar->setX (int(width));
|
||||||
vbar->setHeight (height - 2, false);
|
vbar->setHeight (height - 2, false);
|
||||||
vbar->setValue (yoffset);
|
vbar->setValue (yoffset);
|
||||||
vbar->resize();
|
vbar->resize();
|
||||||
|
@ -671,8 +671,8 @@ void FScrollView::copy2area()
|
||||||
, ay = getTermY() - print_area->offset_top
|
, ay = getTermY() - print_area->offset_top
|
||||||
, dx = viewport_geometry.getX()
|
, dx = viewport_geometry.getX()
|
||||||
, dy = viewport_geometry.getY()
|
, dy = viewport_geometry.getY()
|
||||||
, y_end = getViewportHeight()
|
, y_end = int(getViewportHeight())
|
||||||
, x_end = getViewportWidth();
|
, x_end = int(getViewportWidth());
|
||||||
|
|
||||||
// viewport width does not fit into the print_area
|
// viewport width does not fit into the print_area
|
||||||
if ( print_area->width <= ax + x_end )
|
if ( print_area->width <= ax + x_end )
|
||||||
|
@ -737,8 +737,10 @@ void FScrollView::init (FWidget* parent)
|
||||||
setForegroundColor (wc.dialog_fg);
|
setForegroundColor (wc.dialog_fg);
|
||||||
setBackgroundColor (wc.dialog_bg);
|
setBackgroundColor (wc.dialog_bg);
|
||||||
init_scrollbar();
|
init_scrollbar();
|
||||||
xoffset_end = getScrollWidth() - getViewportWidth();
|
setGeometry (1, 1, 4, 4);
|
||||||
yoffset_end = getScrollHeight() - getViewportHeight();
|
setMinimumSize (4, 4);
|
||||||
|
xoffset_end = int(getScrollWidth() - getViewportWidth());
|
||||||
|
yoffset_end = int(getScrollHeight() - getViewportHeight());
|
||||||
nf_offset = isNewFont() ? 1 : 0;
|
nf_offset = isNewFont() ? 1 : 0;
|
||||||
setTopPadding (1 - getScrollY());
|
setTopPadding (1 - getScrollY());
|
||||||
setLeftPadding (1 - getScrollX());
|
setLeftPadding (1 - getScrollX());
|
||||||
|
@ -746,8 +748,8 @@ void FScrollView::init (FWidget* parent)
|
||||||
setRightPadding (1 - (xoffset_end - getScrollX()) + nf_offset);
|
setRightPadding (1 - (xoffset_end - getScrollX()) + nf_offset);
|
||||||
|
|
||||||
FPoint no_shadow(0,0);
|
FPoint no_shadow(0,0);
|
||||||
int w = getViewportWidth();
|
std::size_t w = getViewportWidth();
|
||||||
int h = getViewportHeight();
|
std::size_t h = getViewportHeight();
|
||||||
|
|
||||||
if ( w < 1 )
|
if ( w < 1 )
|
||||||
w = 1;
|
w = 1;
|
||||||
|
@ -803,18 +805,18 @@ void FScrollView::init_scrollbar()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollView::calculateScrollbarPos()
|
void FScrollView::calculateScrollbarPos()
|
||||||
{
|
{
|
||||||
int width = getWidth();
|
std::size_t width = getWidth();
|
||||||
int height = getHeight();
|
std::size_t height = getHeight();
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
vbar->setGeometry (width, 2, 2, height - 2);
|
vbar->setGeometry (int(width), 2, 2, height - 2);
|
||||||
hbar->setGeometry (1, height, width - 2, 1);
|
hbar->setGeometry (1, int(height), width - 2, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vbar->setGeometry (width, 2, 1, height - 2);
|
vbar->setGeometry (int(width), 2, 1, height - 2);
|
||||||
hbar->setGeometry (2, height, width - 2, 1);
|
hbar->setGeometry (2, int(height), width - 2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
vbar->resize();
|
vbar->resize();
|
||||||
|
|
|
@ -205,12 +205,9 @@ void FStatusBar::hide()
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
screenWidth = getDesktopWidth();
|
screenWidth = getDesktopWidth();
|
||||||
|
|
||||||
if ( screenWidth < 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
blank = new char[std::size_t(screenWidth) + 1];
|
blank = new char[screenWidth + 1];
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -218,7 +215,7 @@ void FStatusBar::hide()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset(blank, ' ', std::size_t(screenWidth));
|
std::memset(blank, ' ', screenWidth);
|
||||||
blank[screenWidth] = '\0';
|
blank[screenWidth] = '\0';
|
||||||
setPrintPos (1, 1);
|
setPrintPos (1, 1);
|
||||||
print (blank);
|
print (blank);
|
||||||
|
@ -228,7 +225,8 @@ void FStatusBar::hide()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::drawMessage()
|
void FStatusBar::drawMessage()
|
||||||
{
|
{
|
||||||
int termWidth, space_offset;
|
std::size_t termWidth;
|
||||||
|
int space_offset;
|
||||||
bool isLastActiveFocus, hasKeys;
|
bool isLastActiveFocus, hasKeys;
|
||||||
|
|
||||||
if ( ! (isVisible() ) )
|
if ( ! (isVisible() ) )
|
||||||
|
@ -260,7 +258,7 @@ void FStatusBar::drawMessage()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
if ( x + space_offset + 3 < termWidth )
|
if ( x + space_offset + 3 < int(termWidth) )
|
||||||
{
|
{
|
||||||
if ( text )
|
if ( text )
|
||||||
{
|
{
|
||||||
|
@ -277,21 +275,21 @@ void FStatusBar::drawMessage()
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
int msg_length = int(getMessage().getLength());
|
std::size_t msg_length = getMessage().getLength();
|
||||||
x += msg_length;
|
x += int(msg_length);
|
||||||
|
|
||||||
if ( x - 1 <= termWidth )
|
if ( x - 1 <= int(termWidth) )
|
||||||
print (getMessage());
|
print (getMessage());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
print ( getMessage().left(uInt(msg_length + termWidth - x - 1)) );
|
print ( getMessage().left(msg_length + termWidth - uInt(x) - 1) );
|
||||||
print ("..");
|
print ("..");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = x; i <= termWidth; i++)
|
for (int i = x; i <= int(termWidth); i++)
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -355,7 +353,7 @@ void FStatusBar::clear()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FStatusBar::adjustSize()
|
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()
|
void FStatusBar::init()
|
||||||
{
|
{
|
||||||
FWidget* r = getRootWidget();
|
FWidget* r = getRootWidget();
|
||||||
int w = r->getWidth();
|
std::size_t w = r->getWidth();
|
||||||
int h = r->getHeight();
|
int h = int(r->getHeight());
|
||||||
// initialize geometry values
|
// initialize geometry values
|
||||||
setGeometry (1, h, w, 1, false);
|
setGeometry (1, h, w, 1, false);
|
||||||
setAlwaysOnTop();
|
setAlwaysOnTop();
|
||||||
|
@ -604,7 +602,7 @@ void FStatusBar::drawKeys()
|
||||||
{
|
{
|
||||||
keyname_len = int(getKeyName((*iter)->getKey()).getLength());
|
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() )
|
if ( (*iter)->isActivated() || (*iter)->hasMouseFocus() )
|
||||||
drawActiveKey (iter);
|
drawActiveKey (iter);
|
||||||
|
@ -615,7 +613,7 @@ void FStatusBar::drawKeys()
|
||||||
{
|
{
|
||||||
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
||||||
|
|
||||||
for (; x <= screenWidth; x++)
|
for (; x <= int(screenWidth); x++)
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,7 +631,7 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
||||||
{
|
{
|
||||||
// Draw not active key
|
// Draw not active key
|
||||||
|
|
||||||
int txt_length;
|
std::size_t txt_length;
|
||||||
FStatusKey* item = *iter;
|
FStatusKey* item = *iter;
|
||||||
|
|
||||||
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
|
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);
|
setColor (wc.statusbar_fg, wc.statusbar_bg);
|
||||||
x++;
|
x++;
|
||||||
print ('-');
|
print ('-');
|
||||||
txt_length = int(item->getText().getLength());
|
txt_length = item->getText().getLength();
|
||||||
x += txt_length;
|
x += int(txt_length);
|
||||||
|
|
||||||
if ( x - 1 <= screenWidth )
|
if ( x - 1 <= int(screenWidth) )
|
||||||
print (item->getText());
|
print (item->getText());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
print ( item->getText()
|
print ( item->getText()
|
||||||
.left(uInt(txt_length + screenWidth - x - 1)) );
|
.left(txt_length + screenWidth - std::size_t(x) - 1) );
|
||||||
print ("..");
|
print ("..");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( iter + 1 != key_list.end()
|
if ( iter + 1 != key_list.end()
|
||||||
&& ( (*(iter + 1))->isActivated() || (*(iter + 1))->hasMouseFocus() )
|
&& ( (*(iter + 1))->isActivated() || (*(iter + 1))->hasMouseFocus() )
|
||||||
&& x + int(getKeyName((*(iter + 1))->getKey()).getLength()) + 3
|
&& x + int(getKeyName((*(iter + 1))->getKey()).getLength()) + 3
|
||||||
< screenWidth )
|
< int(screenWidth) )
|
||||||
{
|
{
|
||||||
// Next element is active
|
// Next element is active
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -679,7 +677,7 @@ void FStatusBar::drawKey (keyList::const_iterator iter)
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
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
|
// Not the last element
|
||||||
setColor (wc.statusbar_separator_fg, wc.statusbar_bg);
|
setColor (wc.statusbar_separator_fg, wc.statusbar_bg);
|
||||||
|
@ -693,7 +691,7 @@ void FStatusBar::drawActiveKey (keyList::const_iterator iter)
|
||||||
{
|
{
|
||||||
// Draw active key
|
// Draw active key
|
||||||
|
|
||||||
int txt_length;
|
std::size_t txt_length;
|
||||||
FStatusKey* item = *iter;
|
FStatusKey* item = *iter;
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
|
@ -708,10 +706,10 @@ void FStatusBar::drawActiveKey (keyList::const_iterator iter)
|
||||||
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
|
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
|
||||||
x++;
|
x++;
|
||||||
print ('-');
|
print ('-');
|
||||||
txt_length = int(item->getText().getLength());
|
txt_length = item->getText().getLength();
|
||||||
x += txt_length;
|
x += int(txt_length);
|
||||||
|
|
||||||
if ( x <= screenWidth )
|
if ( x <= int(screenWidth) )
|
||||||
{
|
{
|
||||||
print (item->getText());
|
print (item->getText());
|
||||||
x++;
|
x++;
|
||||||
|
@ -721,7 +719,7 @@ void FStatusBar::drawActiveKey (keyList::const_iterator iter)
|
||||||
{
|
{
|
||||||
// Print ellipsis
|
// Print ellipsis
|
||||||
print ( item->getText()
|
print ( item->getText()
|
||||||
.left(uInt(txt_length + screenWidth - x - 1)) );
|
.left(txt_length + screenWidth - std::size_t(x) - 1) );
|
||||||
print ("..");
|
print ("..");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
139
src/fstring.cpp
139
src/fstring.cpp
|
@ -53,13 +53,13 @@ FString::FString (int len)
|
||||||
, c_string(0)
|
, c_string(0)
|
||||||
{
|
{
|
||||||
if ( len > 0 )
|
if ( len > 0 )
|
||||||
initLength(uInt(len));
|
initLength(std::size_t(len));
|
||||||
else
|
else
|
||||||
initLength(0);
|
initLength(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (uInt len)
|
FString::FString (std::size_t len)
|
||||||
: string(0)
|
: string(0)
|
||||||
, length(0)
|
, length(0)
|
||||||
, bufsize(0)
|
, bufsize(0)
|
||||||
|
@ -69,20 +69,7 @@ FString::FString (uInt len)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (int len, wchar_t c)
|
FString::FString (std::size_t 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)
|
|
||||||
: string(0)
|
: string(0)
|
||||||
, length(0)
|
, length(0)
|
||||||
, bufsize(0)
|
, bufsize(0)
|
||||||
|
@ -100,25 +87,7 @@ FString::FString (uInt len, wchar_t c)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString::FString (int len, char c)
|
FString::FString (std::size_t 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)
|
|
||||||
: string(0)
|
: string(0)
|
||||||
, length(0)
|
, length(0)
|
||||||
, bufsize(0)
|
, bufsize(0)
|
||||||
|
@ -475,17 +444,7 @@ const FString& FString::operator >> (float& num)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
wchar_t& FString::operator [] (int pos)
|
wchar_t& FString::operator [] (std::size_t 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)
|
|
||||||
{
|
{
|
||||||
if ( pos >= length )
|
if ( pos >= length )
|
||||||
throw std::out_of_range(""); // Invalid index position
|
throw std::out_of_range(""); // Invalid index position
|
||||||
|
@ -502,9 +461,9 @@ const FString& FString::operator () ()
|
||||||
|
|
||||||
// public methods of FString
|
// public methods of FString
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uInt FString::getUTF8length() const
|
std::size_t FString::getUTF8length() const
|
||||||
{
|
{
|
||||||
uInt len;
|
std::size_t len;
|
||||||
const char* s;
|
const char* s;
|
||||||
|
|
||||||
if ( ! string )
|
if ( ! string )
|
||||||
|
@ -514,7 +473,7 @@ uInt FString::getUTF8length() const
|
||||||
s = c_str();
|
s = c_str();
|
||||||
|
|
||||||
while ( *s )
|
while ( *s )
|
||||||
len += uInt((*s++ & 0xc0) != 0x80);
|
len += std::size_t((*s++ & 0xc0) != 0x80);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
@ -902,16 +861,7 @@ FString FString::trim() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::left (int len) const
|
FString FString::left (std::size_t len) const
|
||||||
{
|
|
||||||
if ( len > 0 )
|
|
||||||
return left (uInt(len));
|
|
||||||
else
|
|
||||||
return left (uInt(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
FString FString::left (uInt len) const
|
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
wchar_t* p;
|
||||||
FString s(string);
|
FString s(string);
|
||||||
|
@ -930,16 +880,7 @@ FString FString::left (uInt len) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::right (int len) const
|
FString FString::right (std::size_t len) const
|
||||||
{
|
|
||||||
if ( len > 0 )
|
|
||||||
return right (uInt(len));
|
|
||||||
else
|
|
||||||
return right (uInt(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
FString FString::right (uInt len) const
|
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
wchar_t* p;
|
||||||
FString s(string);
|
FString s(string);
|
||||||
|
@ -957,21 +898,7 @@ FString FString::right (uInt len) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FString FString::mid (int pos, int len) const
|
FString FString::mid (std::size_t pos, std::size_t 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
|
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
wchar_t* p;
|
||||||
wchar_t* first;
|
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 )
|
if ( pos > length )
|
||||||
throw std::out_of_range("");
|
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)
|
FString FString::replace (const FString& from, const FString& to)
|
||||||
{
|
{
|
||||||
wchar_t* p;
|
wchar_t* p;
|
||||||
uInt from_length, to_length, pos;
|
std::size_t from_length, to_length, pos;
|
||||||
FString s(string);
|
FString s(string);
|
||||||
|
|
||||||
// handle NULL and empty string
|
// handle NULL and empty string
|
||||||
|
@ -1380,10 +1307,11 @@ FString FString::expandTabs (int tabstop) const
|
||||||
tab_split = instr.split("\t");
|
tab_split = instr.split("\t");
|
||||||
last = tab_split.size();
|
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();
|
std::size_t len = tab_split[i].getLength();
|
||||||
uInt tab_len = uInt(tabstop);
|
std::size_t tab_len = std::size_t(tabstop);
|
||||||
|
|
||||||
if ( i == last - 1 )
|
if ( i == last - 1 )
|
||||||
outstr += tab_split[i];
|
outstr += tab_split[i];
|
||||||
else
|
else
|
||||||
|
@ -1471,11 +1399,11 @@ const FString& FString::overwrite (const FString& s, int pos)
|
||||||
if ( pos < 0 )
|
if ( pos < 0 )
|
||||||
return overwrite (s, 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 )
|
if ( pos > length )
|
||||||
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)
|
const FString& FString::remove (std::size_t pos, std::size_t len)
|
||||||
{
|
|
||||||
if ( pos < 0 || len < 1 )
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
return remove (uInt(pos), len);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
const FString& FString::remove (uInt pos, uInt len)
|
|
||||||
{
|
{
|
||||||
if ( pos > length )
|
if ( pos > length )
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -1531,7 +1450,7 @@ bool FString::includes (const FString& s) const
|
||||||
|
|
||||||
// private methods of FString
|
// private methods of FString
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FString::initLength (uInt len)
|
inline void FString::initLength (std::size_t len)
|
||||||
{
|
{
|
||||||
if ( len == 0 )
|
if ( len == 0 )
|
||||||
return;
|
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
|
if ( len == 0 ) // String s is a null or a empty string
|
||||||
return;
|
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
|
if ( len == 0 ) // String s is a null or a empty string
|
||||||
return;
|
return;
|
||||||
|
@ -1625,7 +1546,7 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t s[])
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uInt x;
|
std::size_t x;
|
||||||
|
|
||||||
if ( (length + len + 1) <= bufsize )
|
if ( (length + len + 1) <= bufsize )
|
||||||
{
|
{
|
||||||
|
@ -1654,7 +1575,7 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t s[])
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uInt y = 0;
|
std::size_t y = 0;
|
||||||
|
|
||||||
for (x = 0; x < pos; x++) // left side
|
for (x = 0; x < pos; x++) // left side
|
||||||
sptr[y++] = string[x];
|
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 )
|
if ( (bufsize - length - 1 + len) <= FWDBUFFER )
|
||||||
{
|
{
|
||||||
// shifting left side to pos
|
// 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];
|
string[i] = string[i + len];
|
||||||
|
|
||||||
length -= len;
|
length -= len;
|
||||||
|
@ -1698,7 +1619,7 @@ inline void FString::_remove (uInt pos, uInt len)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uInt x, y = 0;
|
std::size_t x, y = 0;
|
||||||
|
|
||||||
for (x = 0; x < pos; x++) // left side
|
for (x = 0; x < pos; x++) // left side
|
||||||
sptr[y++] = string[x];
|
sptr[y++] = string[x];
|
||||||
|
|
|
@ -82,7 +82,7 @@ FTerm::~FTerm() // destructor
|
||||||
|
|
||||||
// public methods of FTerm
|
// public methods of FTerm
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FTerm::getLineNumber()
|
std::size_t FTerm::getLineNumber()
|
||||||
{
|
{
|
||||||
FRect& term_geometry = data->getTermGeometry();
|
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();
|
FRect& term_geometry = data->getTermGeometry();
|
||||||
|
|
||||||
|
@ -474,10 +474,10 @@ void FTerm::detectTermSize()
|
||||||
term_geometry.setPos(1,1);
|
term_geometry.setPos(1,1);
|
||||||
// Use COLUMNS or fallback to the xterm default width of 80 characters
|
// Use COLUMNS or fallback to the xterm default width of 80 characters
|
||||||
str = std::getenv("COLUMNS");
|
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
|
// Use LINES or fallback to the xterm default height of 24 characters
|
||||||
str = std::getenv("LINES");
|
str = std::getenv("LINES");
|
||||||
term_geometry.setHeight(str ? std::atoi(str) : 24);
|
term_geometry.setHeight(str ? std::size_t(std::atoi(str)) : 24);
|
||||||
}
|
}
|
||||||
else
|
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}
|
// Set xterm size to {width} x {height}
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ namespace finalcut
|
||||||
bool FTermXTerminal::mouse_support;
|
bool FTermXTerminal::mouse_support;
|
||||||
bool FTermXTerminal::meta_sends_esc;
|
bool FTermXTerminal::meta_sends_esc;
|
||||||
bool FTermXTerminal::xterm_default_colors;
|
bool FTermXTerminal::xterm_default_colors;
|
||||||
int FTermXTerminal::term_width = 80;
|
std::size_t FTermXTerminal::term_width = 80;
|
||||||
int FTermXTerminal::term_height = 24;
|
std::size_t FTermXTerminal::term_height = 24;
|
||||||
const FString* FTermXTerminal::xterm_font = 0;
|
const FString* FTermXTerminal::xterm_font = 0;
|
||||||
const FString* FTermXTerminal::xterm_title = 0;
|
const FString* FTermXTerminal::xterm_title = 0;
|
||||||
const FString* FTermXTerminal::foreground_color = 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}
|
// Set xterm size to {term_width} x {term_height}
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ void FTermXTerminal::setXTermSize()
|
||||||
{
|
{
|
||||||
if ( term_detection->isXTerminal() )
|
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);
|
std::fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ FTextView::~FTextView() // destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString FTextView::getText() const
|
const FString FTextView::getText() const
|
||||||
{
|
{
|
||||||
uInt len, rows, idx;
|
std::size_t len, rows, idx;
|
||||||
|
|
||||||
if ( data.empty() )
|
if ( data.empty() )
|
||||||
return FString("");
|
return FString("");
|
||||||
|
@ -67,13 +67,13 @@ const FString FTextView::getText() const
|
||||||
len = 0;
|
len = 0;
|
||||||
rows = getRows();
|
rows = getRows();
|
||||||
|
|
||||||
for (uInt i = 0 ; i < rows; i++)
|
for (std::size_t i = 0 ; i < rows; i++)
|
||||||
len += data[i].getLength() + 1;
|
len += data[i].getLength() + 1;
|
||||||
|
|
||||||
FString s(len + 1);
|
FString s(len + 1);
|
||||||
idx = 0;
|
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();
|
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
|
// Set the text view geometry
|
||||||
|
|
||||||
FWidget::setGeometry(x, y, w, h, adjust);
|
FWidget::setGeometry(x, y, w, h, adjust);
|
||||||
int width = getWidth();
|
std::size_t width = getWidth();
|
||||||
int height = getHeight();
|
std::size_t height = getHeight();
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
vbar->setGeometry (width, 1, 2, height - 1);
|
vbar->setGeometry (int(width), 1, 2, height - 1);
|
||||||
hbar->setGeometry (1, height, width - 2, 1);
|
hbar->setGeometry (1, int(height), width - 2, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vbar->setGeometry (width, 2, 1, height - 2);
|
vbar->setGeometry (int(width), 2, 1, height - 2);
|
||||||
hbar->setGeometry (2, height, width - 2, 1);
|
hbar->setGeometry (2, int(height), width - 2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
vbar->resize();
|
vbar->resize();
|
||||||
|
@ -152,7 +152,7 @@ void FTextView::scrollTo (int x, int y)
|
||||||
|
|
||||||
if ( xoffset != x )
|
if ( xoffset != x )
|
||||||
{
|
{
|
||||||
int xoffset_end = int(maxLineWidth) - getTextWidth();
|
int xoffset_end = int(maxLineWidth - getTextWidth());
|
||||||
xoffset = x;
|
xoffset = x;
|
||||||
|
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
|
@ -170,7 +170,7 @@ void FTextView::scrollTo (int x, int y)
|
||||||
|
|
||||||
if ( yoffset != y )
|
if ( yoffset != y )
|
||||||
{
|
{
|
||||||
int yoffset_end = int(getRows()) - getTextHeight();
|
int yoffset_end = int(getRows() - getTextHeight());
|
||||||
yoffset = y;
|
yoffset = y;
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
|
@ -193,7 +193,7 @@ void FTextView::scrollTo (int x, int y)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::hide()
|
void FTextView::hide()
|
||||||
{
|
{
|
||||||
int n, size;
|
std::size_t n, size;
|
||||||
short fg, bg;
|
short fg, bg;
|
||||||
char* blank;
|
char* blank;
|
||||||
FWidget* parent_widget = getParentWidget();
|
FWidget* parent_widget = getParentWidget();
|
||||||
|
@ -215,12 +215,12 @@ void FTextView::hide()
|
||||||
n = isNewFont() ? 1 : 0;
|
n = isNewFont() ? 1 : 0;
|
||||||
size = getWidth() + n;
|
size = getWidth() + n;
|
||||||
|
|
||||||
if ( size < 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
blank = new char[std::size_t(size) + 1];
|
blank = new char[size + 1];
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -228,10 +228,10 @@ void FTextView::hide()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset(blank, ' ', std::size_t(size));
|
std::memset(blank, ' ', size);
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y = 0; y < getHeight(); y++)
|
for (int y = 0; y < int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
setPrintPos (1, 1 + y);
|
setPrintPos (1, 1 + y);
|
||||||
print (blank);
|
print (blank);
|
||||||
|
@ -267,9 +267,9 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
text_split = s.split("\r\n");
|
text_split = s.split("\r\n");
|
||||||
num = text_split.size();
|
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()
|
text_split[i] = text_split[i].removeBackspaces()
|
||||||
.removeDel()
|
.removeDel()
|
||||||
.replaceControlCodes()
|
.replaceControlCodes()
|
||||||
|
@ -280,10 +280,10 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
{
|
{
|
||||||
maxLineWidth = len;
|
maxLineWidth = len;
|
||||||
|
|
||||||
if ( len > uInt(getTextWidth()) )
|
if ( len > getTextWidth() )
|
||||||
{
|
{
|
||||||
hbar->setMaximum (int(maxLineWidth) - getTextWidth());
|
hbar->setMaximum (int(maxLineWidth) - int(getTextWidth()));
|
||||||
hbar->setPageSize (int(maxLineWidth), getTextWidth());
|
hbar->setPageSize (int(maxLineWidth), int(getTextWidth()));
|
||||||
hbar->calculateSliderValues();
|
hbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! hbar->isVisible() )
|
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());
|
data.insert (iter + pos, text_split.begin(), text_split.end());
|
||||||
vbar->setMaximum (int(getRows()) - getTextHeight());
|
vbar->setMaximum (int(getRows()) - int(getTextHeight()));
|
||||||
vbar->setPageSize (int(getRows()), getTextHeight());
|
vbar->setPageSize (int(getRows()), int(getTextHeight()));
|
||||||
vbar->calculateSliderValues();
|
vbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! vbar->isVisible() && int(getRows()) > getTextHeight() )
|
if ( ! vbar->isVisible() && int(getRows()) > int(getTextHeight()) )
|
||||||
vbar->setVisible();
|
vbar->setVisible();
|
||||||
|
|
||||||
if ( vbar->isVisible() && int(getRows()) <= getTextHeight() )
|
if ( vbar->isVisible() && int(getRows()) <= int(getTextHeight()) )
|
||||||
vbar->hide();
|
vbar->hide();
|
||||||
|
|
||||||
processChanged();
|
processChanged();
|
||||||
|
@ -330,7 +330,7 @@ void FTextView::replaceRange (const FString& str, int from, int to)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::clear()
|
void FTextView::clear()
|
||||||
{
|
{
|
||||||
int size;
|
std::size_t size;
|
||||||
char* blank;
|
char* blank;
|
||||||
|
|
||||||
data.clear();
|
data.clear();
|
||||||
|
@ -350,12 +350,12 @@ void FTextView::clear()
|
||||||
setColor();
|
setColor();
|
||||||
size = getWidth() - 2;
|
size = getWidth() - 2;
|
||||||
|
|
||||||
if ( size < 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
blank = new char[std::size_t(size) + 1];
|
blank = new char[size + 1];
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -363,10 +363,10 @@ void FTextView::clear()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset(blank, ' ', std::size_t(size));
|
std::memset(blank, ' ', size);
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y = 0; y < getTextHeight(); y++)
|
for (int y = 0; y < int(getTextHeight()); y++)
|
||||||
{
|
{
|
||||||
setPrintPos (2, 2 - nf_offset + y);
|
setPrintPos (2, 2 - nf_offset + y);
|
||||||
print (blank);
|
print (blank);
|
||||||
|
@ -402,12 +402,12 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_ppage:
|
case fc::Fkey_ppage:
|
||||||
scrollBy (0, -getTextHeight());
|
scrollBy (0, int(-getTextHeight()));
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_npage:
|
case fc::Fkey_npage:
|
||||||
scrollBy (0, getTextHeight());
|
scrollBy (0, int(getTextHeight()));
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ void FTextView::onKeyPress (FKeyEvent* ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_end:
|
case fc::Fkey_end:
|
||||||
scrollToY (int(getRows()) - getTextHeight());
|
scrollToY (int(getRows() - getTextHeight()));
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -592,43 +592,43 @@ void FTextView::onFocusOut (FFocusEvent*)
|
||||||
void FTextView::adjustSize()
|
void FTextView::adjustSize()
|
||||||
{
|
{
|
||||||
FWidget::adjustSize();
|
FWidget::adjustSize();
|
||||||
int width = getWidth()
|
std::size_t width = getWidth();
|
||||||
, height = getHeight()
|
std::size_t height = getHeight();
|
||||||
, last_line = int(getRows())
|
int last_line = int(getRows());
|
||||||
, max_width = int(maxLineWidth);
|
int max_width = int(maxLineWidth);
|
||||||
|
|
||||||
if ( xoffset >= max_width - width - nf_offset )
|
if ( xoffset >= max_width - int(width) - nf_offset )
|
||||||
xoffset = max_width - width - nf_offset - 1;
|
xoffset = max_width - int(width) - nf_offset - 1;
|
||||||
|
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
|
|
||||||
if ( yoffset > last_line - height - nf_offset + 2 )
|
if ( yoffset > last_line - int(height) - nf_offset + 2 )
|
||||||
yoffset = last_line - height - nf_offset + 2;
|
yoffset = last_line - int(height) - nf_offset + 2;
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
if ( yoffset < 0 )
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
|
|
||||||
vbar->setMaximum (last_line - height + 2 - nf_offset);
|
vbar->setMaximum (last_line - int(height) + 2 - nf_offset);
|
||||||
vbar->setPageSize (last_line, height - 2 + nf_offset);
|
vbar->setPageSize (last_line, int(height) - 2 + nf_offset);
|
||||||
vbar->setX (width);
|
vbar->setX (int(width));
|
||||||
vbar->setHeight (height - 2 + nf_offset, false);
|
vbar->setHeight (height - 2 + std::size_t(nf_offset), false);
|
||||||
vbar->setValue (yoffset);
|
vbar->setValue (yoffset);
|
||||||
vbar->resize();
|
vbar->resize();
|
||||||
|
|
||||||
hbar->setMaximum (max_width - width + nf_offset + 2);
|
hbar->setMaximum (max_width - int(width) + nf_offset + 2);
|
||||||
hbar->setPageSize (max_width, width - nf_offset - 2);
|
hbar->setPageSize (max_width, int(width) - nf_offset - 2);
|
||||||
hbar->setY (height);
|
hbar->setY (int(height));
|
||||||
hbar->setWidth (width - 2, false);
|
hbar->setWidth (width - 2, false);
|
||||||
hbar->setValue (xoffset);
|
hbar->setValue (xoffset);
|
||||||
hbar->resize();
|
hbar->resize();
|
||||||
|
|
||||||
if ( last_line < height + nf_offset - 1 )
|
if ( last_line < int(height) + nf_offset - 1 )
|
||||||
vbar->hide();
|
vbar->hide();
|
||||||
else
|
else
|
||||||
vbar->setVisible();
|
vbar->setVisible();
|
||||||
|
|
||||||
if ( max_width < width - nf_offset - 1 )
|
if ( max_width < int(width) - nf_offset - 1 )
|
||||||
hbar->hide();
|
hbar->hide();
|
||||||
else
|
else
|
||||||
hbar->setVisible();
|
hbar->setVisible();
|
||||||
|
@ -637,15 +637,15 @@ void FTextView::adjustSize()
|
||||||
|
|
||||||
// private methods of FTextView
|
// 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();
|
updateTerminal();
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
|
@ -748,12 +748,10 @@ void FTextView::draw()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FTextView::drawText()
|
void FTextView::drawText()
|
||||||
{
|
{
|
||||||
uInt num;
|
|
||||||
|
|
||||||
if ( data.empty() || getHeight() <= 2 || getWidth() <= 2 )
|
if ( data.empty() || getHeight() <= 2 || getWidth() <= 2 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
num = uInt(getTextHeight());
|
std::size_t num = getTextHeight();
|
||||||
|
|
||||||
if ( num > getRows() )
|
if ( num > getRows() )
|
||||||
num = getRows();
|
num = getRows();
|
||||||
|
@ -763,14 +761,14 @@ void FTextView::drawText()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(true);
|
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;
|
FString line;
|
||||||
const wchar_t* line_str;
|
const wchar_t* line_str;
|
||||||
setPrintPos (2, 2 - nf_offset + int(y));
|
setPrintPos (2, 2 - nf_offset + int(y));
|
||||||
line = data[y + uInt(yoffset)].mid ( uInt(1 + xoffset)
|
line = data[y + std::size_t(yoffset)].mid ( std::size_t(1 + xoffset)
|
||||||
, uInt(getTextWidth()) );
|
, getTextWidth() );
|
||||||
line_str = line.wc_str();
|
line_str = line.wc_str();
|
||||||
len = line.getLength();
|
len = line.getLength();
|
||||||
|
|
||||||
|
@ -790,7 +788,7 @@ void FTextView::drawText()
|
||||||
print ('.');
|
print ('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < uInt(getTextWidth()); i++)
|
for (; i < getTextWidth(); i++)
|
||||||
print (' ');
|
print (' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,14 +839,14 @@ void FTextView::cb_VBarChange (FWidget*, data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageBackward:
|
case FScrollbar::scrollPageBackward:
|
||||||
distance = getClientHeight();
|
distance = int(getClientHeight());
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepBackward:
|
case FScrollbar::scrollStepBackward:
|
||||||
scrollBy (0, -distance);
|
scrollBy (0, -distance);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageForward:
|
case FScrollbar::scrollPageForward:
|
||||||
distance = getClientHeight();
|
distance = int(getClientHeight());
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepForward:
|
case FScrollbar::scrollStepForward:
|
||||||
scrollBy (0, distance);
|
scrollBy (0, distance);
|
||||||
|
@ -897,14 +895,14 @@ void FTextView::cb_HBarChange (FWidget*, data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageBackward:
|
case FScrollbar::scrollPageBackward:
|
||||||
distance = getClientWidth();
|
distance = int(getClientWidth());
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepBackward:
|
case FScrollbar::scrollStepBackward:
|
||||||
scrollBy (-distance, 0);
|
scrollBy (-distance, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FScrollbar::scrollPageForward:
|
case FScrollbar::scrollPageForward:
|
||||||
distance = getClientWidth();
|
distance = int(getClientWidth());
|
||||||
// fall through
|
// fall through
|
||||||
case FScrollbar::scrollStepForward:
|
case FScrollbar::scrollStepForward:
|
||||||
scrollBy (distance, 0);
|
scrollBy (distance, 0);
|
||||||
|
|
|
@ -88,12 +88,12 @@ FToggleButton::~FToggleButton() // destructor
|
||||||
|
|
||||||
// public methods of FToggleButton
|
// 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
|
// Set the toggle button geometry
|
||||||
|
|
||||||
int hotkey_mark = ( getHotkey() ) ? 1 : 0;
|
std::size_t hotkey_mark = ( getHotkey() ) ? 1 : 0;
|
||||||
int min_width = button_width + int(text.getLength()) - hotkey_mark;
|
std::size_t min_width = button_width + text.getLength() - hotkey_mark;
|
||||||
|
|
||||||
if ( w < min_width )
|
if ( w < min_width )
|
||||||
w = min_width;
|
w = min_width;
|
||||||
|
@ -203,9 +203,9 @@ bool FToggleButton::setChecked (bool on)
|
||||||
void FToggleButton::setText (const FString& txt)
|
void FToggleButton::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
text = 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() )
|
if ( isEnabled() )
|
||||||
{
|
{
|
||||||
|
@ -217,7 +217,7 @@ void FToggleButton::setText (const FString& txt)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToggleButton::hide()
|
void FToggleButton::hide()
|
||||||
{
|
{
|
||||||
int size;
|
std::size_t size;
|
||||||
short fg, bg;
|
short fg, bg;
|
||||||
char* blank;
|
char* blank;
|
||||||
FWidget* parent_widget = getParentWidget();
|
FWidget* parent_widget = getParentWidget();
|
||||||
|
@ -238,12 +238,12 @@ void FToggleButton::hide()
|
||||||
setColor (fg, bg);
|
setColor (fg, bg);
|
||||||
size = getWidth();
|
size = getWidth();
|
||||||
|
|
||||||
if ( size < 0 )
|
if ( size == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
blank = new char[std::size_t(size) + 1];
|
blank = new char[size + 1];
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -251,7 +251,7 @@ void FToggleButton::hide()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memset(blank, ' ', std::size_t(size));
|
std::memset(blank, ' ', size);
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
setPrintPos (1, 1);
|
setPrintPos (1, 1);
|
||||||
print (blank);
|
print (blank);
|
||||||
|
@ -420,14 +420,12 @@ void FToggleButton::onFocusOut (FFocusEvent* out_ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
uChar FToggleButton::getHotkey()
|
uChar FToggleButton::getHotkey()
|
||||||
{
|
{
|
||||||
uInt length;
|
|
||||||
|
|
||||||
if ( text.isEmpty() )
|
if ( text.isEmpty() )
|
||||||
return 0;
|
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
|
try
|
||||||
{
|
{
|
||||||
|
@ -510,7 +508,7 @@ void FToggleButton::drawLabel()
|
||||||
if ( text.isNull() || text.isEmpty() )
|
if ( text.isNull() || text.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uInt length = text.getLength();
|
std::size_t length = text.getLength();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -525,12 +523,12 @@ void FToggleButton::drawLabel()
|
||||||
FString txt = text;
|
FString txt = text;
|
||||||
wchar_t* src = const_cast<wchar_t*>(txt.wc_str());
|
wchar_t* src = const_cast<wchar_t*>(txt.wc_str());
|
||||||
wchar_t* dest = const_cast<wchar_t*>(LabelText);
|
wchar_t* dest = const_cast<wchar_t*>(LabelText);
|
||||||
hotkeypos = getHotkeyPos(src, dest, uInt(length));
|
hotkeypos = getHotkeyPos(src, dest, length);
|
||||||
|
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != -1 )
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
setPrintPos (1 + label_offset_pos, 1);
|
setPrintPos (1 + int(label_offset_pos), 1);
|
||||||
drawText (LabelText, hotkeypos, length);
|
drawText (LabelText, hotkeypos, length);
|
||||||
delete[] LabelText;
|
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
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
wchar_t* txt = src;
|
wchar_t* txt = src;
|
||||||
|
|
||||||
for (uInt i = 0; i < length; i++)
|
for (std::size_t i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
if ( i < length && txt[i] == L'&' && pos == -1 )
|
if ( i < length && txt[i] == L'&' && pos == -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 isActive = ((flags & fc::active) != 0);
|
||||||
bool isNoUnderline = ((flags & fc::no_underline) != 0);
|
bool isNoUnderline = ((flags & fc::no_underline) != 0);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* 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 *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -143,23 +143,24 @@ void FToolTip::init()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToolTip::calculateDimensions()
|
void FToolTip::calculateDimensions()
|
||||||
{
|
{
|
||||||
int x, y, w, h;
|
int x, y;
|
||||||
|
std::size_t w, h;
|
||||||
FWidget* r = getRootWidget();
|
FWidget* r = getRootWidget();
|
||||||
text_split = text.split("\n");
|
text_split = text.split("\n");
|
||||||
text_num_lines = uInt(text_split.size());
|
text_num_lines = uInt(text_split.size());
|
||||||
text_components = &text_split[0];
|
text_components = &text_split[0];
|
||||||
max_line_width = 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 )
|
if ( len > max_line_width )
|
||||||
max_line_width = len;
|
max_line_width = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
h = int(text_num_lines) + 2;
|
h = text_num_lines + 2;
|
||||||
w = int(max_line_width + 4);
|
w = max_line_width + 4;
|
||||||
|
|
||||||
if ( r )
|
if ( r )
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,8 +110,8 @@ void FVTerm::setTermXY (int x, int y)
|
||||||
if ( term_pos->getX() == x && term_pos->getY() == y )
|
if ( term_pos->getX() == x && term_pos->getY() == y )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
term_width = getColumnNumber();
|
term_width = int(getColumnNumber());
|
||||||
term_height = getLineNumber();
|
term_height = int(getLineNumber());
|
||||||
|
|
||||||
if ( x >= term_width )
|
if ( x >= term_width )
|
||||||
{
|
{
|
||||||
|
@ -597,8 +597,8 @@ void FVTerm::createArea ( const FRect& r
|
||||||
{
|
{
|
||||||
createArea ( r.getX()
|
createArea ( r.getX()
|
||||||
, r.getY()
|
, r.getY()
|
||||||
, r.getWidth()
|
, int(r.getWidth())
|
||||||
, r.getHeight()
|
, int(r.getHeight())
|
||||||
, p.getX()
|
, p.getX()
|
||||||
, p.getY()
|
, p.getY()
|
||||||
, area );
|
, area );
|
||||||
|
@ -633,8 +633,8 @@ void FVTerm::resizeArea ( const FRect& r
|
||||||
{
|
{
|
||||||
resizeArea ( r.getX()
|
resizeArea ( r.getX()
|
||||||
, r.getY()
|
, r.getY()
|
||||||
, r.getWidth()
|
, int(r.getWidth())
|
||||||
, r.getHeight()
|
, int(r.getHeight())
|
||||||
, p.getX()
|
, p.getX()
|
||||||
, p.getY()
|
, p.getY()
|
||||||
, area );
|
, area );
|
||||||
|
@ -800,8 +800,8 @@ void FVTerm::restoreVTerm (const FRect& box)
|
||||||
{
|
{
|
||||||
restoreVTerm ( box.getX()
|
restoreVTerm ( box.getX()
|
||||||
, box.getY()
|
, box.getY()
|
||||||
, box.getWidth()
|
, int(box.getWidth())
|
||||||
, box.getHeight() );
|
, int(box.getHeight()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -901,8 +901,8 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
|
||||||
int win_y = win->offset_top;
|
int win_y = win->offset_top;
|
||||||
FRect geometry ( win_x
|
FRect geometry ( win_x
|
||||||
, win_y
|
, win_y
|
||||||
, win->width + win->right_shadow
|
, std::size_t(win->width + win->right_shadow)
|
||||||
, win->height + win->bottom_shadow );
|
, std::size_t(win->height + win->bottom_shadow) );
|
||||||
|
|
||||||
if ( found && geometry.contains(x, y) )
|
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
|
// Check whether the coordinates are within the area
|
||||||
|
|
||||||
int ax = 0
|
int ax = 0, ay = 0;
|
||||||
, ay = 0
|
std::size_t aw = std::size_t(area->width);
|
||||||
, aw = area->width
|
std::size_t ah = std::size_t(area->height);
|
||||||
, ah = area->height;
|
|
||||||
FRect area_geometry(ax, ay, aw, ah);
|
FRect area_geometry(ax, ay, aw, ah);
|
||||||
|
|
||||||
if ( area_geometry.contains(x, y) )
|
if ( area_geometry.contains(x, y) )
|
||||||
|
@ -1389,8 +1388,8 @@ void FVTerm::getArea (const FRect& box, term_area* area)
|
||||||
{
|
{
|
||||||
getArea ( box.getX()
|
getArea ( box.getX()
|
||||||
, box.getY()
|
, box.getY()
|
||||||
, box.getWidth()
|
, int(box.getWidth())
|
||||||
, box.getHeight()
|
, int(box.getHeight())
|
||||||
, area );
|
, area );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1741,8 +1740,8 @@ FVTerm::charData FVTerm::generateCharacter (int x, int y)
|
||||||
int win_y = win->offset_top;
|
int win_y = win->offset_top;
|
||||||
FRect geometry ( win_x
|
FRect geometry ( win_x
|
||||||
, win_y
|
, win_y
|
||||||
, win->width + win->right_shadow
|
, std::size_t(win->width + win->right_shadow)
|
||||||
, win->height + win->bottom_shadow );
|
, std::size_t(win->height + win->bottom_shadow) );
|
||||||
|
|
||||||
// Window is visible and contains current character
|
// Window is visible and contains current character
|
||||||
if ( geometry.contains(x, y) )
|
if ( geometry.contains(x, y) )
|
||||||
|
@ -1857,8 +1856,8 @@ FVTerm::charData FVTerm::getCharacter ( character_type char_type
|
||||||
|
|
||||||
FRect geometry ( win->offset_left
|
FRect geometry ( win->offset_left
|
||||||
, win->offset_top
|
, win->offset_top
|
||||||
, win->width + win->right_shadow
|
, std::size_t(win->width + win->right_shadow)
|
||||||
, win->height + win->bottom_shadow );
|
, std::size_t(win->height + win->bottom_shadow) );
|
||||||
|
|
||||||
// Window visible and contains current character
|
// Window visible and contains current character
|
||||||
if ( geometry.contains(x, y) )
|
if ( geometry.contains(x, y) )
|
||||||
|
@ -2188,7 +2187,7 @@ bool FVTerm::clearTerm (int fillchar)
|
||||||
{
|
{
|
||||||
term_pos->setPoint(-1, -1);
|
term_pos->setPoint(-1, -1);
|
||||||
|
|
||||||
for (int i = 0; i < getLineNumber(); i++)
|
for (int i = 0; i < int(getLineNumber()); i++)
|
||||||
{
|
{
|
||||||
setTermXY (0, i);
|
setTermXY (0, i);
|
||||||
appendOutputBuffer (cb);
|
appendOutputBuffer (cb);
|
||||||
|
@ -2875,8 +2874,8 @@ int FVTerm::appendLowerRight (charData*& screen_char)
|
||||||
char* ip = TCAP(fc::t_insert_padding);
|
char* ip = TCAP(fc::t_insert_padding);
|
||||||
char* ic = TCAP(fc::t_insert_character);
|
char* ic = TCAP(fc::t_insert_character);
|
||||||
|
|
||||||
x = getColumnNumber() - 2;
|
x = int(getColumnNumber()) - 2;
|
||||||
y = getLineNumber() - 1;
|
y = int(getLineNumber()) - 1;
|
||||||
setTermXY (x, y);
|
setTermXY (x, y);
|
||||||
appendChar (screen_char);
|
appendChar (screen_char);
|
||||||
term_pos->x_ref()++;
|
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;
|
visible_cursor = ! hideable;
|
||||||
offset = parent->client_offset;
|
offset = parent->client_offset;
|
||||||
double_flatline_mask.top.resize (uLong(getWidth()), false);
|
double_flatline_mask.top.resize (getWidth(), false);
|
||||||
double_flatline_mask.right.resize (uLong(getHeight()), false);
|
double_flatline_mask.right.resize (getHeight(), false);
|
||||||
double_flatline_mask.bottom.resize (uLong(getWidth()), false);
|
double_flatline_mask.bottom.resize (getWidth(), false);
|
||||||
double_flatline_mask.left.resize (uLong(getHeight()), 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::min (width, size_hints.max_width);
|
||||||
width = std::max (width, size_hints.min_width);
|
width = std::max (width, size_hints.min_width);
|
||||||
|
@ -499,12 +499,12 @@ void FWidget::setWidth (int width, bool adjust)
|
||||||
if ( adjust )
|
if ( adjust )
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
||||||
double_flatline_mask.top.resize (uLong(getWidth()), false);
|
double_flatline_mask.top.resize (getWidth(), false);
|
||||||
double_flatline_mask.bottom.resize (uLong(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::min (height, size_hints.max_height);
|
||||||
height = std::max (height, size_hints.min_height);
|
height = std::max (height, size_hints.min_height);
|
||||||
|
@ -521,12 +521,12 @@ void FWidget::setHeight (int height, bool adjust)
|
||||||
if ( adjust )
|
if ( adjust )
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
||||||
double_flatline_mask.right.resize (uLong(getHeight()), false);
|
double_flatline_mask.right.resize (getHeight(), false);
|
||||||
double_flatline_mask.left.resize (uLong(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::min (width, size_hints.max_width);
|
||||||
width = std::max (width, size_hints.min_width);
|
width = std::max (width, size_hints.min_width);
|
||||||
|
@ -551,10 +551,10 @@ void FWidget::setSize (int width, int height, bool adjust)
|
||||||
if ( adjust )
|
if ( adjust )
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
||||||
double_flatline_mask.top.resize (uLong(getWidth()), false);
|
double_flatline_mask.top.resize (getWidth(), false);
|
||||||
double_flatline_mask.right.resize (uLong(getHeight()), false);
|
double_flatline_mask.right.resize (getHeight(), false);
|
||||||
double_flatline_mask.bottom.resize (uLong(getWidth()), false);
|
double_flatline_mask.bottom.resize (getWidth(), false);
|
||||||
double_flatline_mask.left.resize (uLong(getHeight()), false);
|
double_flatline_mask.left.resize (getHeight(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -612,7 +612,7 @@ void FWidget::setBottomPadding (int bottom, bool adjust)
|
||||||
if ( isRootWidget() )
|
if ( isRootWidget() )
|
||||||
{
|
{
|
||||||
FWidget* r = rootObject;
|
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();
|
adjustSizeGlobal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -633,7 +633,7 @@ void FWidget::setRightPadding (int right, bool adjust)
|
||||||
if ( isRootWidget() )
|
if ( isRootWidget() )
|
||||||
{
|
{
|
||||||
FWidget* r = rootObject;
|
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();
|
adjustSizeGlobal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -654,8 +654,8 @@ void FWidget::setParentOffset()
|
||||||
void FWidget::setTermOffset()
|
void FWidget::setTermOffset()
|
||||||
{
|
{
|
||||||
FWidget* r = getRootWidget();
|
FWidget* r = getRootWidget();
|
||||||
int w = r->getWidth();
|
int w = int(r->getWidth());
|
||||||
int h = r->getHeight();
|
int h = int(r->getHeight());
|
||||||
offset.setCoordinates (0, 0, w - 1, h - 1);
|
offset.setCoordinates (0, 0, w - 1, h - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,14 +665,15 @@ void FWidget::setTermOffsetWithPadding()
|
||||||
FWidget* r = getRootWidget();
|
FWidget* r = getRootWidget();
|
||||||
offset.setCoordinates ( r->getLeftPadding()
|
offset.setCoordinates ( r->getLeftPadding()
|
||||||
, r->getTopPadding()
|
, r->getTopPadding()
|
||||||
, r->getWidth() - 1 - r->getRightPadding()
|
, int(r->getWidth()) - 1 - r->getRightPadding()
|
||||||
, r->getHeight() - 1 - r->getBottomPadding() );
|
, 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
|
// Set xterm size to w x h
|
||||||
|
|
||||||
if ( isXTerminal() )
|
if ( isXTerminal() )
|
||||||
{
|
{
|
||||||
rootObject->wsize.setRect(1, 1, w, h);
|
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
|
// Sets the geometry of the widget relative to its parent
|
||||||
|
|
||||||
int term_x
|
int term_x, term_y;
|
||||||
, term_y;
|
|
||||||
|
|
||||||
w = std::min (w, size_hints.max_width);
|
w = std::min (w, size_hints.max_width);
|
||||||
w = std::max (w, size_hints.min_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
|
client_offset.setCoordinates ( term_x - 1 + padding.left
|
||||||
, term_y - 1 + padding.top
|
, term_y - 1 + padding.top
|
||||||
, term_x - 2 + getWidth() - padding.right
|
, term_x - 2 + int(getWidth()) - padding.right
|
||||||
, term_y - 2 + getHeight() - padding.bottom );
|
, term_y - 2 + int(getHeight()) - padding.bottom );
|
||||||
|
|
||||||
double_flatline_mask.top.resize (uLong(getWidth()), false);
|
double_flatline_mask.top.resize (getWidth(), false);
|
||||||
double_flatline_mask.right.resize (uLong(getHeight()), false);
|
double_flatline_mask.right.resize (getHeight(), false);
|
||||||
double_flatline_mask.bottom.resize (uLong(getWidth()), false);
|
double_flatline_mask.bottom.resize (getWidth(), false);
|
||||||
double_flatline_mask.left.resize (uLong(getHeight()), false);
|
double_flatline_mask.left.resize (getHeight(), false);
|
||||||
|
|
||||||
if ( adjust )
|
if ( adjust )
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
@ -1148,10 +1148,10 @@ void FWidget::resize()
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
||||||
// resize the four double-flatline-masks
|
// resize the four double-flatline-masks
|
||||||
double_flatline_mask.top.resize (uLong(getWidth()), false);
|
double_flatline_mask.top.resize (getWidth(), false);
|
||||||
double_flatline_mask.right.resize (uLong(getHeight()), false);
|
double_flatline_mask.right.resize (getHeight(), false);
|
||||||
double_flatline_mask.bottom.resize (uLong(getWidth()), false);
|
double_flatline_mask.bottom.resize (getWidth(), false);
|
||||||
double_flatline_mask.left.resize (uLong(getHeight()), false);
|
double_flatline_mask.left.resize (getHeight(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1329,8 +1329,8 @@ void FWidget::detectTermSize()
|
||||||
(
|
(
|
||||||
r->padding.left,
|
r->padding.left,
|
||||||
r->padding.top,
|
r->padding.top,
|
||||||
getDesktopWidth() - 1 - r->padding.right,
|
int(getDesktopWidth()) - 1 - r->padding.right,
|
||||||
getDesktopHeight() - 1 - r->padding.bottom
|
int(getDesktopHeight()) - 1 - r->padding.bottom
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1357,9 +1357,9 @@ void FWidget::drawShadow()
|
||||||
}
|
}
|
||||||
|
|
||||||
int x1 = 1
|
int x1 = 1
|
||||||
, x2 = getWidth()
|
, x2 = int(getWidth())
|
||||||
, y1 = 1
|
, y1 = 1
|
||||||
, y2 = getHeight();
|
, y2 = int(getHeight());
|
||||||
|
|
||||||
if ( trans_shadow )
|
if ( trans_shadow )
|
||||||
{
|
{
|
||||||
|
@ -1379,8 +1379,8 @@ void FWidget::clearShadow()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int w = getWidth()
|
int w = int(getWidth());
|
||||||
, h = getHeight();
|
int h = int(getHeight());
|
||||||
|
|
||||||
if ( isWindowWidget() )
|
if ( isWindowWidget() )
|
||||||
{
|
{
|
||||||
|
@ -1392,7 +1392,7 @@ void FWidget::clearShadow()
|
||||||
|
|
||||||
if ( w <= offset.getX2() )
|
if ( w <= offset.getX2() )
|
||||||
{
|
{
|
||||||
for (int i = 1; i <= getHeight(); i++)
|
for (int i = 1; i <= int(getHeight()); i++)
|
||||||
{
|
{
|
||||||
setPrintPos (w + 1, i);
|
setPrintPos (w + 1, i);
|
||||||
print (' '); // clear █
|
print (' '); // clear █
|
||||||
|
@ -1403,7 +1403,7 @@ void FWidget::clearShadow()
|
||||||
{
|
{
|
||||||
setPrintPos (2, h + 1);
|
setPrintPos (2, h + 1);
|
||||||
|
|
||||||
for (int i = 1; i <= getWidth(); i++)
|
for (std::size_t i = 1; i <= getWidth(); i++)
|
||||||
print (' '); // clear ▀
|
print (' '); // clear ▀
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1418,16 +1418,16 @@ void FWidget::drawFlatBorder()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int x1 = 1
|
int x1 = 1
|
||||||
, x2 = getWidth() + 1
|
, x2 = int(getWidth()) + 1
|
||||||
, y1 = 0
|
, y1 = 0
|
||||||
, y2 = getHeight() + 1;
|
, y2 = int(getHeight()) + 1;
|
||||||
|
|
||||||
if ( FWidget* p = getParentWidget() )
|
if ( FWidget* p = getParentWidget() )
|
||||||
setColor (wc.dialog_fg, p->getBackgroundColor());
|
setColor (wc.dialog_fg, p->getBackgroundColor());
|
||||||
else
|
else
|
||||||
setColor (wc.dialog_fg, wc.dialog_bg);
|
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);
|
setPrintPos (x1 - 1, y1 + y + 1);
|
||||||
|
|
||||||
|
@ -1441,7 +1441,7 @@ void FWidget::drawFlatBorder()
|
||||||
|
|
||||||
setPrintPos (x2, y1 + 1);
|
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)] )
|
if ( double_flatline_mask.right[uLong(y)] )
|
||||||
// left+right line (on right side)
|
// left+right line (on right side)
|
||||||
|
@ -1455,7 +1455,7 @@ void FWidget::drawFlatBorder()
|
||||||
|
|
||||||
setPrintPos (x1, y1);
|
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)] )
|
if ( double_flatline_mask.top[uLong(x)] )
|
||||||
// top+bottom line (at top)
|
// top+bottom line (at top)
|
||||||
|
@ -1467,7 +1467,7 @@ void FWidget::drawFlatBorder()
|
||||||
|
|
||||||
setPrintPos (x1, y2);
|
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)] )
|
if ( double_flatline_mask.bottom[uLong(x)] )
|
||||||
// top+bottom line (at bottom)
|
// top+bottom line (at bottom)
|
||||||
|
@ -1485,9 +1485,9 @@ void FWidget::clearFlatBorder()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int x1 = 1
|
int x1 = 1
|
||||||
, x2 = getWidth() + 1
|
, x2 = int(getWidth()) + 1
|
||||||
, y1 = 0
|
, y1 = 0
|
||||||
, y2 = getHeight() + 1;
|
, y2 = int(getHeight()) + 1;
|
||||||
|
|
||||||
if ( FWidget* p = getParentWidget() )
|
if ( FWidget* p = getParentWidget() )
|
||||||
setColor (wc.dialog_fg, p->getBackgroundColor());
|
setColor (wc.dialog_fg, p->getBackgroundColor());
|
||||||
|
@ -1495,7 +1495,7 @@ void FWidget::clearFlatBorder()
|
||||||
setColor (wc.dialog_fg, wc.dialog_bg);
|
setColor (wc.dialog_fg, wc.dialog_bg);
|
||||||
|
|
||||||
// clear on left side
|
// 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);
|
setPrintPos (x1 - 1, y1 + y + 1);
|
||||||
|
|
||||||
|
@ -1506,7 +1506,7 @@ void FWidget::clearFlatBorder()
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear on right side
|
// clear on right side
|
||||||
for (int y = 0; y < getHeight(); y++)
|
for (int y = 0; y < int(getHeight()); y++)
|
||||||
{
|
{
|
||||||
setPrintPos (x2, y1 + y + 1);
|
setPrintPos (x2, y1 + y + 1);
|
||||||
|
|
||||||
|
@ -1519,7 +1519,7 @@ void FWidget::clearFlatBorder()
|
||||||
// clear at top
|
// clear at top
|
||||||
setPrintPos (x1, y1);
|
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)] )
|
if ( double_flatline_mask.top[uLong(x)] )
|
||||||
print (fc::NF_border_line_upper);
|
print (fc::NF_border_line_upper);
|
||||||
|
@ -1530,7 +1530,7 @@ void FWidget::clearFlatBorder()
|
||||||
// clear at bottom
|
// clear at bottom
|
||||||
setPrintPos (x1, y2);
|
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)] )
|
if ( double_flatline_mask.bottom[uLong(x)] )
|
||||||
print (fc::NF_border_line_bottom);
|
print (fc::NF_border_line_bottom);
|
||||||
|
@ -1554,11 +1554,11 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
|
||||||
if ( y1 < 1 )
|
if ( y1 < 1 )
|
||||||
y1 = 1;
|
y1 = 1;
|
||||||
|
|
||||||
if ( x2 > getWidth() )
|
if ( x2 > int(getWidth()) )
|
||||||
x2 = getWidth();
|
x2 = int(getWidth());
|
||||||
|
|
||||||
if ( y2 > getHeight() )
|
if ( y2 > int(getHeight()) )
|
||||||
y2 = getHeight();
|
y2 = int(getHeight());
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
drawNewFontBox (x1, y1, x2, y2);
|
drawNewFontBox (x1, y1, x2, y2);
|
||||||
|
@ -1683,8 +1683,8 @@ void FWidget::adjustSize()
|
||||||
{
|
{
|
||||||
offset.setCoordinates ( p->getTermX() - 1
|
offset.setCoordinates ( p->getTermX() - 1
|
||||||
, p->getTermY() - 1
|
, p->getTermY() - 1
|
||||||
, p->getTermX() + p->getWidth() - 2
|
, p->getTermX() + int(p->getWidth()) - 2
|
||||||
, p->getTermY() + p->getHeight() - 2 );
|
, p->getTermY() + int(p->getHeight()) - 2 );
|
||||||
}
|
}
|
||||||
else if ( p )
|
else if ( p )
|
||||||
offset = p->client_offset;
|
offset = p->client_offset;
|
||||||
|
@ -1700,8 +1700,8 @@ void FWidget::adjustSize()
|
||||||
(
|
(
|
||||||
getTermX() - 1 + padding.left,
|
getTermX() - 1 + padding.left,
|
||||||
getTermY() - 1 + padding.top,
|
getTermY() - 1 + padding.top,
|
||||||
getTermX() - 2 + getWidth() - padding.right,
|
getTermX() - 2 + int(getWidth()) - padding.right,
|
||||||
getTermY() - 2 + getHeight() - padding.bottom
|
getTermY() - 2 + int(getHeight()) - padding.bottom
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( hasChildren() )
|
if ( hasChildren() )
|
||||||
|
@ -2069,10 +2069,10 @@ void FWidget::init()
|
||||||
offset.setRect(0, 0, getDesktopWidth(), getDesktopHeight());
|
offset.setRect(0, 0, getDesktopWidth(), getDesktopHeight());
|
||||||
client_offset = offset;
|
client_offset = offset;
|
||||||
|
|
||||||
double_flatline_mask.top.resize (uLong(getWidth()), false);
|
double_flatline_mask.top.resize (getWidth(), false);
|
||||||
double_flatline_mask.right.resize (uLong(getHeight()), false);
|
double_flatline_mask.right.resize (getHeight(), false);
|
||||||
double_flatline_mask.bottom.resize (uLong(getWidth()), false);
|
double_flatline_mask.bottom.resize (getWidth(), false);
|
||||||
double_flatline_mask.left.resize (uLong(getHeight()), false);
|
double_flatline_mask.left.resize (getHeight(), false);
|
||||||
|
|
||||||
// Initialize default widget colors
|
// Initialize default widget colors
|
||||||
setColorTheme();
|
setColorTheme();
|
||||||
|
@ -2132,7 +2132,7 @@ inline void FWidget::insufficientSpaceAdjust()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// move left if not enough space
|
// 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.x1_ref()--;
|
||||||
adjust_wsize.x2_ref()--;
|
adjust_wsize.x2_ref()--;
|
||||||
|
@ -2142,7 +2142,7 @@ inline void FWidget::insufficientSpaceAdjust()
|
||||||
}
|
}
|
||||||
|
|
||||||
// move up if not enough space
|
// 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.y1_ref()--;
|
||||||
adjust_wsize.y2_ref()--;
|
adjust_wsize.y2_ref()--;
|
||||||
|
@ -2152,17 +2152,17 @@ inline void FWidget::insufficientSpaceAdjust()
|
||||||
}
|
}
|
||||||
|
|
||||||
// reduce the width if not enough space
|
// 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()--;
|
adjust_wsize.x2_ref()--;
|
||||||
|
|
||||||
if ( getWidth() < size_hints.min_width )
|
if ( getWidth() < size_hints.min_width )
|
||||||
adjust_wsize.setWidth(size_hints.min_width);
|
adjust_wsize.setWidth(size_hints.min_width);
|
||||||
|
|
||||||
if ( getWidth() <= 0 )
|
if ( getWidth() == 0 )
|
||||||
adjust_wsize.setWidth(1);
|
adjust_wsize.setWidth(1);
|
||||||
|
|
||||||
// reduce the height if not enough space
|
// 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()--;
|
adjust_wsize.y2_ref()--;
|
||||||
|
|
||||||
if ( getHeight() < size_hints.min_height )
|
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);
|
setColor (wc.shadow_bg, wc.shadow_fg);
|
||||||
setTransShadow();
|
setTransShadow();
|
||||||
|
|
||||||
for (int i = 1; i < getHeight(); i++)
|
for (int i = 1; i < int(getHeight()); i++)
|
||||||
{
|
{
|
||||||
setPrintPos (x2 + 1, y1 + i);
|
setPrintPos (x2 + 1, y1 + i);
|
||||||
print (" ");
|
print (" ");
|
||||||
|
@ -2358,7 +2358,7 @@ void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
|
||||||
setColor (wc.shadow_bg, wc.shadow_fg);
|
setColor (wc.shadow_bg, wc.shadow_fg);
|
||||||
setTransShadow();
|
setTransShadow();
|
||||||
|
|
||||||
for (int i = 2; i <= getWidth() + 1; i++)
|
for (std::size_t i = 2; i <= getWidth() + 1; i++)
|
||||||
print (' ');
|
print (' ');
|
||||||
|
|
||||||
unsetTransShadow();
|
unsetTransShadow();
|
||||||
|
@ -2392,7 +2392,7 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
||||||
if ( isWindowWidget() )
|
if ( isWindowWidget() )
|
||||||
unsetInheritBackground();
|
unsetInheritBackground();
|
||||||
|
|
||||||
for (int i = 1; i < getHeight(); i++)
|
for (int i = 1; i < int(getHeight()); i++)
|
||||||
{
|
{
|
||||||
setPrintPos (x2 + 1, y1 + i);
|
setPrintPos (x2 + 1, y1 + i);
|
||||||
print (block); // █
|
print (block); // █
|
||||||
|
@ -2403,7 +2403,7 @@ void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
|
||||||
if ( isWindowWidget() )
|
if ( isWindowWidget() )
|
||||||
setInheritBackground();
|
setInheritBackground();
|
||||||
|
|
||||||
for (int i = 1; i <= getWidth(); i++)
|
for (std::size_t i = 1; i <= getWidth(); i++)
|
||||||
print (fc::UpperHalfBlock); // ▀
|
print (fc::UpperHalfBlock); // ▀
|
||||||
|
|
||||||
if ( isWindowWidget() )
|
if ( isWindowWidget() )
|
||||||
|
|
|
@ -278,9 +278,9 @@ void FWindow::drawBorder()
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
int x1 = 1
|
int x1 = 1
|
||||||
, x2 = 1 + getWidth() - 1
|
, x2 = 1 + int(getWidth()) - 1
|
||||||
, y1 = 1
|
, y1 = 1
|
||||||
, y2 = 1 + getHeight() - 1;
|
, y2 = 1 + int(getHeight()) - 1;
|
||||||
|
|
||||||
setPrintPos (x1, y1);
|
setPrintPos (x1, y1);
|
||||||
print (fc::NF_border_corner_upper_left); // ⎡
|
print (fc::NF_border_corner_upper_left); // ⎡
|
||||||
|
@ -304,7 +304,7 @@ void FWindow::drawBorder()
|
||||||
// lower left corner border ⎣
|
// lower left corner border ⎣
|
||||||
print (fc::NF_border_corner_lower_left);
|
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);
|
print (fc::NF_border_line_bottom);
|
||||||
|
|
||||||
setPrintPos (x2, y2);
|
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);
|
FWidget::setWidth (w, adjust);
|
||||||
|
|
||||||
if ( isVirtualWindow() && getWidth() != old_width )
|
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);
|
FWidget::setHeight (h, adjust);
|
||||||
|
|
||||||
if ( isVirtualWindow() && getHeight() != old_height )
|
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();
|
std::size_t old_width = getWidth();
|
||||||
int old_height = getHeight();
|
std::size_t old_height = getHeight();
|
||||||
FWidget::setSize (w, h, adjust);
|
FWidget::setSize (w, h, adjust);
|
||||||
|
|
||||||
if ( isVirtualWindow()
|
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
|
// Sets the geometry of the widget
|
||||||
|
|
||||||
int old_x = getX()
|
int old_x = getX();
|
||||||
, old_y = getY()
|
int old_y = getY();
|
||||||
, old_width = getWidth()
|
std::size_t old_width = getWidth();
|
||||||
, old_height = getHeight();
|
std::size_t old_height = getHeight();
|
||||||
|
|
||||||
if ( y < 1 )
|
if ( y < 1 )
|
||||||
y = 1;
|
y = 1;
|
||||||
|
|
|
@ -142,7 +142,7 @@ class FButton : public FWidget
|
||||||
uChar getHotkey();
|
uChar getHotkey();
|
||||||
void setHotkeyAccelerator();
|
void setHotkeyAccelerator();
|
||||||
void detectHotkey();
|
void detectHotkey();
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||||
int clickAnimationIndent (FWidget*);
|
int clickAnimationIndent (FWidget*);
|
||||||
void clearRightMargin (FWidget*);
|
void clearRightMargin (FWidget*);
|
||||||
void drawMarginLeft();
|
void drawMarginLeft();
|
||||||
|
|
|
@ -83,7 +83,7 @@ class FButtonGroup : public FScrollView
|
||||||
FToggleButton* getFirstButton();
|
FToggleButton* getFirstButton();
|
||||||
FToggleButton* getLastButton();
|
FToggleButton* getLastButton();
|
||||||
FToggleButton* getButton (int) const;
|
FToggleButton* getButton (int) const;
|
||||||
uInt getCount() const;
|
std::size_t getCount() const;
|
||||||
FString& getText();
|
FString& getText();
|
||||||
|
|
||||||
// Mutator
|
// Mutator
|
||||||
|
@ -136,8 +136,8 @@ class FButtonGroup : public FScrollView
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||||
void drawText (wchar_t[], int, uInt);
|
void drawText (wchar_t[], int, std::size_t);
|
||||||
void directFocus();
|
void directFocus();
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
|
@ -165,8 +165,8 @@ inline bool FButtonGroup::setDisable()
|
||||||
{ return setEnable(false); }
|
{ return setEnable(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline uInt FButtonGroup::getCount() const
|
inline std::size_t FButtonGroup::getCount() const
|
||||||
{ return uInt(buttonlist.size()); }
|
{ return buttonlist.size(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FString& FButtonGroup::getText()
|
inline FString& FButtonGroup::getText()
|
||||||
|
|
|
@ -124,7 +124,7 @@ class FDialog : public FWindow
|
||||||
bool moveDown (int);
|
bool moveDown (int);
|
||||||
bool moveLeft (int);
|
bool moveLeft (int);
|
||||||
bool moveRight (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 reduceHeight (int);
|
||||||
bool expandHeight (int);
|
bool expandHeight (int);
|
||||||
bool reduceWidth (int);
|
bool reduceWidth (int);
|
||||||
|
@ -161,12 +161,12 @@ class FDialog : public FWindow
|
||||||
int mouse_x;
|
int mouse_x;
|
||||||
int mouse_y;
|
int mouse_y;
|
||||||
FPoint termPos;
|
FPoint termPos;
|
||||||
int zoom_btn;
|
std::size_t zoom_btn;
|
||||||
bool mouse_over_menu;
|
bool mouse_over_menu;
|
||||||
} mouseStates;
|
} mouseStates;
|
||||||
|
|
||||||
// Constant
|
// 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
|
static const bool PRINT_WIN_NUMBER = false; // Only for debug
|
||||||
|
|
||||||
// Using-declaration
|
// Using-declaration
|
||||||
|
@ -197,7 +197,7 @@ class FDialog : public FWindow
|
||||||
void openMenu();
|
void openMenu();
|
||||||
void selectFirstMenuItem();
|
void selectFirstMenuItem();
|
||||||
void setZoomItem();
|
void setZoomItem();
|
||||||
int getZoomButtonWidth();
|
std::size_t getZoomButtonWidth();
|
||||||
void activateZoomButton (mouseStates&);
|
void activateZoomButton (mouseStates&);
|
||||||
void deactivateZoomButton();
|
void deactivateZoomButton();
|
||||||
void leaveZoomButton (mouseStates&);
|
void leaveZoomButton (mouseStates&);
|
||||||
|
|
|
@ -140,13 +140,13 @@ class FLabel : public FWidget
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
uChar getHotkey();
|
uChar getHotkey();
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||||
void setHotkeyAccelerator();
|
void setHotkeyAccelerator();
|
||||||
int getAlignOffset (int);
|
std::size_t getAlignOffset (std::size_t);
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void drawMultiLine();
|
void drawMultiLine();
|
||||||
void drawSingleLine();
|
void drawSingleLine();
|
||||||
void printLine (wchar_t[], uInt, int, int = 0);
|
void printLine (wchar_t[], std::size_t, int, std::size_t = 0);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
FStringList multiline_text;
|
FStringList multiline_text;
|
||||||
|
|
|
@ -179,7 +179,7 @@ class FLineEdit : public FWidget
|
||||||
int scroll_repeat;
|
int scroll_repeat;
|
||||||
bool insert_mode;
|
bool insert_mode;
|
||||||
int cursor_pos;
|
int cursor_pos;
|
||||||
int text_offset;
|
std::size_t text_offset;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
|
@ -157,23 +157,23 @@ class FListBox : public FWidget
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
uInt getCount() const;
|
std::size_t getCount() const;
|
||||||
FListBoxItem getItem (int);
|
FListBoxItem getItem (std::size_t);
|
||||||
FListBoxItem getItem (listBoxItems::iterator) const;
|
FListBoxItem getItem (listBoxItems::iterator) const;
|
||||||
int currentItem() const;
|
std::size_t currentItem() const;
|
||||||
FString& getText();
|
FString& getText();
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setCurrentItem (int);
|
void setCurrentItem (std::size_t);
|
||||||
void setCurrentItem (listBoxItems::iterator);
|
void setCurrentItem (listBoxItems::iterator);
|
||||||
void selectItem (int);
|
void selectItem (std::size_t);
|
||||||
void selectItem (listBoxItems::iterator);
|
void selectItem (listBoxItems::iterator);
|
||||||
void unselectItem (int);
|
void unselectItem (std::size_t);
|
||||||
void unselectItem (listBoxItems::iterator);
|
void unselectItem (listBoxItems::iterator);
|
||||||
void showInsideBrackets (int, fc::brackets_type);
|
void showInsideBrackets (std::size_t, fc::brackets_type);
|
||||||
void showNoBrackets (int);
|
void showNoBrackets (std::size_t);
|
||||||
void showNoBrackets (listBoxItems::iterator);
|
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 (bool);
|
||||||
void setMultiSelection ();
|
void setMultiSelection ();
|
||||||
void unsetMultiSelection ();
|
void unsetMultiSelection ();
|
||||||
|
@ -184,10 +184,10 @@ class FListBox : public FWidget
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
bool isSelected (int);
|
bool isSelected (std::size_t);
|
||||||
bool isSelected (listBoxItems::iterator) const;
|
bool isSelected (listBoxItems::iterator) const;
|
||||||
bool isMultiSelection() const;
|
bool isMultiSelection() const;
|
||||||
bool hasBrackets (int);
|
bool hasBrackets (std::size_t);
|
||||||
bool hasBrackets (listBoxItems::iterator) const;
|
bool hasBrackets (listBoxItems::iterator) const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
@ -205,7 +205,7 @@ class FListBox : public FWidget
|
||||||
, fc::brackets_type = fc::NoBrackets
|
, fc::brackets_type = fc::NoBrackets
|
||||||
, bool = false
|
, bool = false
|
||||||
, data_ptr = 0 );
|
, data_ptr = 0 );
|
||||||
void remove (int);
|
void remove (std::size_t);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
|
@ -257,8 +257,8 @@ class FListBox : public FWidget
|
||||||
void recalculateHorizontalBar (int, bool);
|
void recalculateHorizontalBar (int, bool);
|
||||||
void recalculateVerticalBar (int);
|
void recalculateVerticalBar (int);
|
||||||
void getWidgetFocus();
|
void getWidgetFocus();
|
||||||
void multiSelection (int);
|
void multiSelection (std::size_t);
|
||||||
void multiSelectionUpTo (int);
|
void multiSelectionUpTo (std::size_t);
|
||||||
void wheelUp (int);
|
void wheelUp (int);
|
||||||
void wheelDown (int);
|
void wheelDown (int);
|
||||||
bool dragScrollUp();
|
bool dragScrollUp();
|
||||||
|
@ -290,7 +290,7 @@ class FListBox : public FWidget
|
||||||
void processSelect();
|
void processSelect();
|
||||||
void processChanged();
|
void processChanged();
|
||||||
void lazyConvert (listBoxItems::iterator, int);
|
void lazyConvert (listBoxItems::iterator, int);
|
||||||
listBoxItems::iterator index2iterator (int);
|
listBoxItems::iterator index2iterator (std::size_t);
|
||||||
|
|
||||||
// Callback methods
|
// Callback methods
|
||||||
void cb_VBarChange (FWidget*, data_ptr);
|
void cb_VBarChange (FWidget*, data_ptr);
|
||||||
|
@ -315,7 +315,7 @@ class FListBox : public FWidget
|
||||||
bool scroll_timer;
|
bool scroll_timer;
|
||||||
int scroll_repeat;
|
int scroll_repeat;
|
||||||
int scroll_distance;
|
int scroll_distance;
|
||||||
int current;
|
std::size_t current;
|
||||||
int last_current;
|
int last_current;
|
||||||
int secect_from_item;
|
int secect_from_item;
|
||||||
int xoffset;
|
int xoffset;
|
||||||
|
@ -405,11 +405,11 @@ inline const char* FListBox::getClassName() const
|
||||||
{ return "FListBox"; }
|
{ return "FListBox"; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline uInt FListBox::getCount() const
|
inline std::size_t FListBox::getCount() const
|
||||||
{ return uInt(itemlist.size()); }
|
{ return itemlist.size(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FListBoxItem FListBox::getItem (int index)
|
inline FListBoxItem FListBox::getItem (std::size_t index)
|
||||||
{
|
{
|
||||||
listBoxItems::iterator iter = index2iterator(index - 1);
|
listBoxItems::iterator iter = index2iterator(index - 1);
|
||||||
return *iter;
|
return *iter;
|
||||||
|
@ -420,7 +420,7 @@ inline FListBoxItem FListBox::getItem (listBoxItems::iterator iter) const
|
||||||
{ return *iter; }
|
{ return *iter; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FListBox::currentItem() const
|
inline std::size_t FListBox::currentItem() const
|
||||||
{ return current; }
|
{ return current; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -428,7 +428,7 @@ inline FString& FListBox::getText()
|
||||||
{ return text; }
|
{ return text; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBox::selectItem (int index)
|
inline void FListBox::selectItem (std::size_t index)
|
||||||
{ index2iterator(index - 1)->selected = true; }
|
{ index2iterator(index - 1)->selected = true; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -436,7 +436,7 @@ inline void FListBox::selectItem (listBoxItems::iterator iter)
|
||||||
{ iter->selected = true; }
|
{ iter->selected = true; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBox::unselectItem (int index)
|
inline void FListBox::unselectItem (std::size_t index)
|
||||||
{ index2iterator(index - 1)->selected = false; }
|
{ index2iterator(index - 1)->selected = false; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -444,7 +444,7 @@ inline void FListBox::unselectItem (listBoxItems::iterator iter)
|
||||||
{ iter->selected = false; }
|
{ iter->selected = false; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FListBox::showNoBrackets (int index)
|
inline void FListBox::showNoBrackets (std::size_t index)
|
||||||
{ index2iterator(index - 1)->brackets = fc::NoBrackets; }
|
{ index2iterator(index - 1)->brackets = fc::NoBrackets; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -476,7 +476,7 @@ inline bool FListBox::unsetFocus()
|
||||||
{ return setFocus(false); }
|
{ return setFocus(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListBox::isSelected (int index)
|
inline bool FListBox::isSelected (std::size_t index)
|
||||||
{ return index2iterator(index - 1)->selected; }
|
{ return index2iterator(index - 1)->selected; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -488,7 +488,7 @@ inline bool FListBox::isMultiSelection() const
|
||||||
{ return multi_select; }
|
{ return multi_select; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FListBox::hasBrackets(int index)
|
inline bool FListBox::hasBrackets(std::size_t index)
|
||||||
{ return bool(index2iterator(index - 1)->brackets > 0); }
|
{ 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();
|
listBoxItems::iterator iter = itemlist.begin();
|
||||||
std::advance (iter, index);
|
std::advance (iter, index);
|
||||||
|
|
|
@ -260,7 +260,7 @@ class FListView : public FWidget
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
uInt getCount();
|
std::size_t getCount();
|
||||||
fc::text_alignment getColumnAlignment (int) const;
|
fc::text_alignment getColumnAlignment (int) const;
|
||||||
FString getColumnText (int) const;
|
FString getColumnText (int) const;
|
||||||
fc::sorting_type getColumnSortType (int) const;
|
fc::sorting_type getColumnSortType (int) const;
|
||||||
|
@ -269,7 +269,7 @@ class FListView : public FWidget
|
||||||
FListViewItem* getCurrentItem();
|
FListViewItem* getCurrentItem();
|
||||||
|
|
||||||
// Mutators
|
// 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 setColumnAlignment (int, fc::text_alignment);
|
||||||
void setColumnText (int, const FString&);
|
void setColumnText (int, const FString&);
|
||||||
void setColumnSortType (int,fc::sorting_type \
|
void setColumnSortType (int,fc::sorting_type \
|
||||||
|
@ -344,13 +344,15 @@ class FListView : public FWidget
|
||||||
void init();
|
void init();
|
||||||
template<typename Compare>
|
template<typename Compare>
|
||||||
void sort (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();
|
virtual void draw();
|
||||||
void drawColumnLabels();
|
void drawColumnLabels();
|
||||||
void drawList();
|
void drawList();
|
||||||
void drawListLine (const FListViewItem*, bool, bool);
|
void drawListLine (const FListViewItem*, bool, bool);
|
||||||
void setLineAttributes (bool, bool);
|
void setLineAttributes (bool, bool);
|
||||||
FString getLinePrefix (const FListViewItem*, uInt);
|
FString getLinePrefix (const FListViewItem*, std::size_t);
|
||||||
void drawColumnText (headerItems::const_iterator&);
|
void drawColumnText (headerItems::const_iterator&);
|
||||||
void drawColumnEllipsis ( headerItems::const_iterator&
|
void drawColumnEllipsis ( headerItems::const_iterator&
|
||||||
, const FString& );
|
, const FString& );
|
||||||
|
|
|
@ -139,7 +139,7 @@ class FMenu : public FWindow, public FMenuList
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
wchar_t* text;
|
wchar_t* text;
|
||||||
int length;
|
std::size_t length;
|
||||||
int hotkeypos;
|
int hotkeypos;
|
||||||
bool no_underline;
|
bool no_underline;
|
||||||
} menuText;
|
} menuText;
|
||||||
|
@ -199,16 +199,16 @@ class FMenu : public FWindow, public FMenuList
|
||||||
bool selectPrevItem();
|
bool selectPrevItem();
|
||||||
void keypressMenuBar (FKeyEvent*);
|
void keypressMenuBar (FKeyEvent*);
|
||||||
bool hotkeyMenu (FKeyEvent*);
|
bool hotkeyMenu (FKeyEvent*);
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void drawItems();
|
void drawItems();
|
||||||
void drawSeparator (int);
|
void drawSeparator (int);
|
||||||
void drawMenuLine (FMenuItem*, int);
|
void drawMenuLine (FMenuItem*, int);
|
||||||
void drawCheckMarkPrefix (FMenuItem*);
|
void drawCheckMarkPrefix (FMenuItem*);
|
||||||
void drawMenuText (menuText&);
|
void drawMenuText (menuText&);
|
||||||
void drawSubMenuIndicator (int&);
|
void drawSubMenuIndicator (std::size_t&);
|
||||||
void drawAcceleratorKey (int&, int);
|
void drawAcceleratorKey (std::size_t&, int);
|
||||||
void drawTrailingSpaces (int);
|
void drawTrailingSpaces (std::size_t);
|
||||||
void setLineAttributes (FMenuItem*, int);
|
void setLineAttributes (FMenuItem*, int);
|
||||||
void setCursorToHotkeyPosition (FMenuItem*);
|
void setCursorToHotkeyPosition (FMenuItem*);
|
||||||
void keyUp();
|
void keyUp();
|
||||||
|
@ -232,7 +232,7 @@ class FMenu : public FWindow, public FMenuList
|
||||||
FWidget* super_menu;
|
FWidget* super_menu;
|
||||||
FMenu* opened_sub_menu;
|
FMenu* opened_sub_menu;
|
||||||
FMenu* shown_sub_menu;
|
FMenu* shown_sub_menu;
|
||||||
uInt max_item_width;
|
std::size_t max_item_width;
|
||||||
int hotkeypos;
|
int hotkeypos;
|
||||||
bool mouse_down;
|
bool mouse_down;
|
||||||
bool has_checkable_items;
|
bool has_checkable_items;
|
||||||
|
|
|
@ -105,8 +105,8 @@ class FMenuBar : public FWindow, public FMenuList
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
wchar_t* text;
|
wchar_t* text;
|
||||||
int length;
|
std::size_t length;
|
||||||
int startpos;
|
std::size_t startpos;
|
||||||
int hotkeypos;
|
int hotkeypos;
|
||||||
bool no_underline;
|
bool no_underline;
|
||||||
} menuText;
|
} menuText;
|
||||||
|
@ -126,7 +126,7 @@ class FMenuBar : public FWindow, public FMenuList
|
||||||
bool selectNextItem();
|
bool selectNextItem();
|
||||||
bool selectPrevItem();
|
bool selectPrevItem();
|
||||||
bool hotkeyMenu (FKeyEvent*&);
|
bool hotkeyMenu (FKeyEvent*&);
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void drawItems();
|
void drawItems();
|
||||||
void drawItem (FMenuItem*, int&);
|
void drawItem (FMenuItem*, int&);
|
||||||
|
@ -154,7 +154,7 @@ class FMenuBar : public FWindow, public FMenuList
|
||||||
bool mouse_down;
|
bool mouse_down;
|
||||||
bool drop_down;
|
bool drop_down;
|
||||||
bool focus_changed;
|
bool focus_changed;
|
||||||
int screenWidth;
|
std::size_t screenWidth;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ class FMenuItem : public FWidget
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
int getHotkey() const;
|
int getHotkey() const;
|
||||||
FMenu* getMenu() const;
|
FMenu* getMenu() const;
|
||||||
uInt getTextLength() const;
|
std::size_t getTextLength() const;
|
||||||
FString getText() const;
|
FString getText() const;
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
|
@ -152,7 +152,7 @@ class FMenuItem : public FWidget
|
||||||
bool checked;
|
bool checked;
|
||||||
bool radio_button;
|
bool radio_button;
|
||||||
bool dialog_index;
|
bool dialog_index;
|
||||||
uInt text_length;
|
std::size_t text_length;
|
||||||
int hotkey;
|
int hotkey;
|
||||||
int accel_key;
|
int accel_key;
|
||||||
FMenu* menu;
|
FMenu* menu;
|
||||||
|
@ -207,7 +207,7 @@ inline FMenu* FMenuItem::getMenu() const
|
||||||
{ return menu; }
|
{ return menu; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline uInt FMenuItem::getTextLength() const
|
inline std::size_t FMenuItem::getTextLength() const
|
||||||
{ return text_length; }
|
{ return text_length; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -69,7 +69,7 @@ class FMenuList
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
virtual const char* getClassName() const;
|
virtual const char* getClassName() const;
|
||||||
uInt getCount() const;
|
std::size_t getCount() const;
|
||||||
FMenuItem* getItem (int) const;
|
FMenuItem* getItem (int) const;
|
||||||
FMenuItem* getSelectedItem() const;
|
FMenuItem* getSelectedItem() const;
|
||||||
|
|
||||||
|
@ -110,8 +110,8 @@ inline const char* FMenuList::getClassName() const
|
||||||
{ return "FMenuList"; }
|
{ return "FMenuList"; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline uInt FMenuList::getCount() const
|
inline std::size_t FMenuList::getCount() const
|
||||||
{ return uInt(item_list.size()); }
|
{ return item_list.size(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FMenuItem* FMenuList::getItem (int index) const
|
inline FMenuItem* FMenuList::getItem (int index) const
|
||||||
|
|
|
@ -163,7 +163,7 @@ class FMessageBox : public FDialog
|
||||||
FString text;
|
FString text;
|
||||||
FString* text_components;
|
FString* text_components;
|
||||||
FStringList text_split;
|
FStringList text_split;
|
||||||
uInt max_line_width;
|
std::size_t max_line_width;
|
||||||
bool center_text;
|
bool center_text;
|
||||||
short emphasis_color;
|
short emphasis_color;
|
||||||
uInt num_buttons;
|
uInt num_buttons;
|
||||||
|
|
|
@ -138,7 +138,7 @@ class FOptiMove
|
||||||
// Mutators
|
// Mutators
|
||||||
void setBaudRate (int);
|
void setBaudRate (int);
|
||||||
void setTabStop (int);
|
void setTabStop (int);
|
||||||
void setTermSize (int, int);
|
void setTermSize (std::size_t, std::size_t);
|
||||||
void setTermEnvironment (termEnv&);
|
void setTermEnvironment (termEnv&);
|
||||||
void set_cursor_home (char[]);
|
void set_cursor_home (char[]);
|
||||||
void set_cursor_to_ll (char[]);
|
void set_cursor_to_ll (char[]);
|
||||||
|
@ -237,8 +237,8 @@ class FOptiMove
|
||||||
int char_duration;
|
int char_duration;
|
||||||
int baudrate;
|
int baudrate;
|
||||||
int tabstop;
|
int tabstop;
|
||||||
int screen_width;
|
std::size_t screen_width;
|
||||||
int screen_height;
|
std::size_t screen_height;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* 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 *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -82,7 +82,7 @@ class FProgressbar : public FWidget
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setPercentage (int);
|
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);
|
||||||
bool setShadow();
|
bool setShadow();
|
||||||
bool unsetShadow();
|
bool unsetShadow();
|
||||||
|
@ -102,7 +102,7 @@ class FProgressbar : public FWidget
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
int percentage;
|
int percentage;
|
||||||
int bar_length;
|
std::size_t bar_length;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ class FRect
|
||||||
// Constructors
|
// Constructors
|
||||||
FRect ();
|
FRect ();
|
||||||
FRect (const FRect&); // copy constructor
|
FRect (const FRect&); // copy constructor
|
||||||
FRect (int, int, int, int);
|
FRect (int, int, std::size_t, std::size_t);
|
||||||
FRect (const FPoint&, const FPoint&);
|
FRect (const FPoint&, const FPoint&);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
@ -83,8 +83,8 @@ class FRect
|
||||||
FPoint getUpperRightPos() const;
|
FPoint getUpperRightPos() const;
|
||||||
FPoint getLowerLeftPos() const;
|
FPoint getLowerLeftPos() const;
|
||||||
FPoint getLowerRightPos() const;
|
FPoint getLowerRightPos() const;
|
||||||
int getWidth() const;
|
std::size_t getWidth() const;
|
||||||
int getHeight() const;
|
std::size_t getHeight() const;
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void setX1 (int);
|
void setX1 (int);
|
||||||
|
@ -95,11 +95,11 @@ class FRect
|
||||||
void setY (int);
|
void setY (int);
|
||||||
void setPos (int, int);
|
void setPos (int, int);
|
||||||
void setPos (const FPoint&);
|
void setPos (const FPoint&);
|
||||||
void setWidth (int);
|
void setWidth (std::size_t);
|
||||||
void setHeight (int);
|
void setHeight (std::size_t);
|
||||||
void setSize (int, int);
|
void setSize (std::size_t, std::size_t);
|
||||||
void setRect (const FRect&);
|
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 (const FPoint&, const FPoint&);
|
||||||
void setCoordinates (int, int, int, int);
|
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))
|
: X1(short(x))
|
||||||
, Y1(short(y))
|
, Y1(short(y))
|
||||||
, X2(short(x + width - 1))
|
, X2(short(x + short(width) - 1))
|
||||||
, Y2(short(y + height - 1))
|
, Y2(short(y + short(height) - 1))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -206,12 +206,18 @@ inline FPoint FRect::getLowerRightPos() const
|
||||||
{ return FPoint(X2, Y2); }
|
{ return FPoint(X2, Y2); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FRect::getWidth() const
|
inline std::size_t FRect::getWidth() const
|
||||||
{ return short(X2 - X1 + 1); }
|
{
|
||||||
|
short w = X2 - X1 + 1;
|
||||||
|
return ( w < 0 ) ? 0 : std::size_t(w);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FRect::getHeight() const
|
inline std::size_t FRect::getHeight() const
|
||||||
{ return short(Y2 - Y1 + 1); }
|
{
|
||||||
|
short h = Y2 - Y1 + 1;
|
||||||
|
return ( h < 0 ) ? 0 : std::size_t(h);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline short& FRect::x1_ref()
|
inline short& FRect::x1_ref()
|
||||||
|
|
|
@ -103,7 +103,7 @@ class FScrollbar : public FWidget
|
||||||
void setSteps (double);
|
void setSteps (double);
|
||||||
void setPageSize (int, int);
|
void setPageSize (int, int);
|
||||||
void setOrientation (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
|
// Methods
|
||||||
virtual void resize();
|
virtual void resize();
|
||||||
|
@ -149,14 +149,14 @@ class FScrollbar : public FWidget
|
||||||
int slider_click_stop_pos;
|
int slider_click_stop_pos;
|
||||||
int current_slider_pos;
|
int current_slider_pos;
|
||||||
int slider_pos;
|
int slider_pos;
|
||||||
int slider_length;
|
std::size_t slider_length;
|
||||||
int bar_length;
|
std::size_t bar_length;
|
||||||
int val;
|
int val;
|
||||||
int min;
|
int min;
|
||||||
int max;
|
int max;
|
||||||
double steps;
|
double steps;
|
||||||
int pagesize;
|
int pagesize;
|
||||||
int length;
|
std::size_t length;
|
||||||
int bar_orientation;
|
int bar_orientation;
|
||||||
int max_color;
|
int max_color;
|
||||||
};
|
};
|
||||||
|
|
|
@ -82,25 +82,25 @@ class FScrollView : public FWidget
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
int getViewportWidth() const;
|
std::size_t getViewportWidth() const;
|
||||||
int getViewportHeight() const;
|
std::size_t getViewportHeight() const;
|
||||||
int getScrollWidth() const;
|
std::size_t getScrollWidth() const;
|
||||||
int getScrollHeight() const;
|
std::size_t getScrollHeight() const;
|
||||||
const FPoint getScrollPos() const;
|
const FPoint getScrollPos() const;
|
||||||
int getScrollX() const;
|
int getScrollX() const;
|
||||||
int getScrollY() const;
|
int getScrollY() const;
|
||||||
|
|
||||||
// Mutator
|
// Mutator
|
||||||
virtual void setScrollWidth (int);
|
virtual void setScrollWidth (std::size_t);
|
||||||
virtual void setScrollHeight (int);
|
virtual void setScrollHeight (std::size_t);
|
||||||
virtual void setScrollSize (int, int);
|
virtual void setScrollSize (std::size_t, std::size_t);
|
||||||
virtual void setX (int, bool = true);
|
virtual void setX (int, bool = true);
|
||||||
virtual void setY (int, bool = true);
|
virtual void setY (int, bool = true);
|
||||||
virtual void setPos (int, int, bool = true);
|
virtual void setPos (int, int, bool = true);
|
||||||
virtual void setWidth (int, bool = true);
|
virtual void setWidth (std::size_t, bool = true);
|
||||||
virtual void setHeight (int, bool = true);
|
virtual void setHeight (std::size_t, bool = true);
|
||||||
virtual void setSize (int, int, bool = true);
|
virtual void setSize (std::size_t, std::size_t, bool = true);
|
||||||
virtual void setGeometry (int, int, int, int, bool = true);
|
virtual void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||||
void setCursorPos (int, int);
|
void setCursorPos (int, int);
|
||||||
void setPrintPos (int, int);
|
void setPrintPos (int, int);
|
||||||
bool setViewportPrint (bool);
|
bool setViewportPrint (bool);
|
||||||
|
@ -195,19 +195,19 @@ inline const char* FScrollView::getClassName() const
|
||||||
{ return "FScrollView"; }
|
{ return "FScrollView"; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FScrollView::getViewportWidth() const
|
inline std::size_t FScrollView::getViewportWidth() const
|
||||||
{ return getWidth() - vertical_border_spacing - nf_offset; }
|
{ 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; }
|
{ return getHeight() - horizontal_border_spacing; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FScrollView::getScrollWidth() const
|
inline std::size_t FScrollView::getScrollWidth() const
|
||||||
{ return scroll_geometry.getWidth(); }
|
{ return scroll_geometry.getWidth(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FScrollView::getScrollHeight() const
|
inline std::size_t FScrollView::getScrollHeight() const
|
||||||
{ return scroll_geometry.getHeight(); }
|
{ return scroll_geometry.getHeight(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -203,7 +203,7 @@ class FStatusBar : public FWindow
|
||||||
virtual const char* getClassName() const;
|
virtual const char* getClassName() const;
|
||||||
FStatusKey* getStatusKey (int) const;
|
FStatusKey* getStatusKey (int) const;
|
||||||
FString getMessage() const;
|
FString getMessage() const;
|
||||||
uInt getCount() const;
|
std::size_t getCount() const;
|
||||||
|
|
||||||
// Mutators
|
// Mutators
|
||||||
void activateKey (int);
|
void activateKey (int);
|
||||||
|
@ -253,7 +253,7 @@ class FStatusBar : public FWindow
|
||||||
keyList key_list;
|
keyList key_list;
|
||||||
FString text;
|
FString text;
|
||||||
bool mouse_down;
|
bool mouse_down;
|
||||||
int screenWidth;
|
std::size_t screenWidth;
|
||||||
int keyname_len;
|
int keyname_len;
|
||||||
int x;
|
int x;
|
||||||
int x_msg;
|
int x_msg;
|
||||||
|
@ -271,8 +271,8 @@ inline FStatusKey* FStatusBar::getStatusKey (int index) const
|
||||||
{ return key_list[uInt(index - 1)]; }
|
{ return key_list[uInt(index - 1)]; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline uInt FStatusBar::getCount() const
|
inline std::size_t FStatusBar::getCount() const
|
||||||
{ return uInt(key_list.size()); }
|
{ return key_list.size(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FStatusBar::activateKey (int index)
|
inline void FStatusBar::activateKey (int index)
|
||||||
|
|
|
@ -80,11 +80,9 @@ class FString
|
||||||
// Constructors
|
// Constructors
|
||||||
FString ();
|
FString ();
|
||||||
explicit FString (int);
|
explicit FString (int);
|
||||||
explicit FString (uInt);
|
explicit FString (std::size_t);
|
||||||
FString (int, wchar_t);
|
FString (std::size_t, wchar_t);
|
||||||
FString (uInt, wchar_t);
|
FString (std::size_t, char);
|
||||||
FString (int, char);
|
|
||||||
FString (uInt, char);
|
|
||||||
FString (const FString&); // implicit conversion copy constructor
|
FString (const FString&); // implicit conversion copy constructor
|
||||||
FString (const std::wstring&); // implicit conversion constructor
|
FString (const std::wstring&); // implicit conversion constructor
|
||||||
FString (const wchar_t[]); // implicit conversion constructor
|
FString (const wchar_t[]); // implicit conversion constructor
|
||||||
|
@ -132,8 +130,7 @@ class FString
|
||||||
const FString& operator >> (double&);
|
const FString& operator >> (double&);
|
||||||
const FString& operator >> (float&);
|
const FString& operator >> (float&);
|
||||||
|
|
||||||
wchar_t& operator [] (int);
|
wchar_t& operator [] (std::size_t);
|
||||||
wchar_t& operator [] (uInt);
|
|
||||||
const FString& operator () ();
|
const FString& operator () ();
|
||||||
|
|
||||||
bool operator < (const FString&) const;
|
bool operator < (const FString&) const;
|
||||||
|
@ -181,8 +178,8 @@ class FString
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
uInt getLength() const;
|
std::size_t getLength() const;
|
||||||
uInt getUTF8length() const;
|
std::size_t getUTF8length() const;
|
||||||
|
|
||||||
iterator begin() const;
|
iterator begin() const;
|
||||||
iterator end() const;
|
iterator end() const;
|
||||||
|
@ -214,12 +211,9 @@ class FString
|
||||||
FString rtrim() const;
|
FString rtrim() const;
|
||||||
FString trim() const;
|
FString trim() const;
|
||||||
|
|
||||||
FString left (int) const;
|
FString left (std::size_t) const;
|
||||||
FString left (uInt) const;
|
FString right (std::size_t) const;
|
||||||
FString right (int) const;
|
FString mid (std::size_t, std::size_t) const;
|
||||||
FString right (uInt) const;
|
|
||||||
FString mid (int, int) const;
|
|
||||||
FString mid (uInt, uInt) const;
|
|
||||||
|
|
||||||
FStringList split (const FString&);
|
FStringList split (const FString&);
|
||||||
FString& setString (const FString&);
|
FString& setString (const FString&);
|
||||||
|
@ -242,7 +236,7 @@ class FString
|
||||||
FString& setFormatedNumber (uLong, char = nl_langinfo(THOUSEP)[0]);
|
FString& setFormatedNumber (uLong, char = nl_langinfo(THOUSEP)[0]);
|
||||||
|
|
||||||
const FString& insert (const FString&, int);
|
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&);
|
FString replace (const FString&, const FString&);
|
||||||
|
|
||||||
|
@ -252,10 +246,9 @@ class FString
|
||||||
FString removeBackspaces() const;
|
FString removeBackspaces() const;
|
||||||
|
|
||||||
const FString& overwrite (const FString&, int);
|
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 (std::size_t, std::size_t);
|
||||||
const FString& remove (uInt, uInt);
|
|
||||||
bool includes (const FString&) const;
|
bool includes (const FString&) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -266,19 +259,19 @@ class FString
|
||||||
static const char* const bad_alloc_str;
|
static const char* const bad_alloc_str;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void initLength (uInt);
|
void initLength (std::size_t);
|
||||||
void _assign (const wchar_t[]);
|
void _assign (const wchar_t[]);
|
||||||
void _insert (uInt, const wchar_t[]);
|
void _insert (std::size_t, const wchar_t[]);
|
||||||
void _insert (uInt, uInt, const wchar_t[]);
|
void _insert (std::size_t, std::size_t, const wchar_t[]);
|
||||||
void _remove (uInt, uInt);
|
void _remove (std::size_t, std::size_t);
|
||||||
char* wc_to_c_str (const wchar_t[]) const;
|
char* wc_to_c_str (const wchar_t[]) const;
|
||||||
wchar_t* c_to_wc_str (const char[]) const;
|
wchar_t* c_to_wc_str (const char[]) const;
|
||||||
wchar_t* extractToken (wchar_t*[], const wchar_t[], const wchar_t[]);
|
wchar_t* extractToken (wchar_t*[], const wchar_t[], const wchar_t[]);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
wchar_t* string;
|
wchar_t* string;
|
||||||
uInt length;
|
std::size_t length;
|
||||||
uInt bufsize;
|
std::size_t bufsize;
|
||||||
mutable char* c_string;
|
mutable char* c_string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -345,7 +338,7 @@ inline bool FString::isEmpty() const
|
||||||
{ return ( ! string ) || ( ! *string ); }
|
{ return ( ! string ) || ( ! *string ); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline uInt FString::getLength() const
|
inline std::size_t FString::getLength() const
|
||||||
{ return length; }
|
{ return length; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -166,8 +166,8 @@ class FTerm
|
||||||
virtual const char* getClassName() const;
|
virtual const char* getClassName() const;
|
||||||
static FKeyboard* getKeyboard();
|
static FKeyboard* getKeyboard();
|
||||||
static FMouseControl* getMouseControl();
|
static FMouseControl* getMouseControl();
|
||||||
static int getLineNumber();
|
static std::size_t getLineNumber();
|
||||||
static int getColumnNumber();
|
static std::size_t getColumnNumber();
|
||||||
static const FString getKeyName (int);
|
static const FString getKeyName (int);
|
||||||
|
|
||||||
static int getTTYFileDescriptor();
|
static int getTTYFileDescriptor();
|
||||||
|
@ -236,7 +236,7 @@ class FTerm
|
||||||
static char* enableCursor();
|
static char* enableCursor();
|
||||||
static char* disableCursor();
|
static char* disableCursor();
|
||||||
static void detectTermSize();
|
static void detectTermSize();
|
||||||
static void setTermSize (int, int);
|
static void setTermSize (std::size_t, std::size_t);
|
||||||
static void setTermTitle(const FString&);
|
static void setTermTitle(const FString&);
|
||||||
static void setKDECursor (fc::kdeKonsoleCursorShape);
|
static void setKDECursor (fc::kdeKonsoleCursorShape);
|
||||||
static void saveColorMap();
|
static void saveColorMap();
|
||||||
|
|
|
@ -65,7 +65,7 @@ class FTermXTerminal
|
||||||
static void setCursorStyle (fc::xtermCursorStyle);
|
static void setCursorStyle (fc::xtermCursorStyle);
|
||||||
static void setFont (const FString&);
|
static void setFont (const FString&);
|
||||||
static void setTitle (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 setForeground (const FString&);
|
||||||
static void setBackground (const FString&);
|
static void setBackground (const FString&);
|
||||||
static void setCursorColor (const FString&);
|
static void setCursorColor (const FString&);
|
||||||
|
@ -139,8 +139,8 @@ class FTermXTerminal
|
||||||
static bool mouse_support;
|
static bool mouse_support;
|
||||||
static bool meta_sends_esc;
|
static bool meta_sends_esc;
|
||||||
static bool xterm_default_colors;
|
static bool xterm_default_colors;
|
||||||
static int term_width;
|
static std::size_t term_width;
|
||||||
static int term_height;
|
static std::size_t term_height;
|
||||||
static const FString* xterm_font;
|
static const FString* xterm_font;
|
||||||
static const FString* xterm_title;
|
static const FString* xterm_title;
|
||||||
static const FString* foreground_color;
|
static const FString* foreground_color;
|
||||||
|
|
|
@ -84,13 +84,13 @@ class FTextView : public FWidget
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
uInt getColumns() const;
|
std::size_t getColumns() const;
|
||||||
uInt getRows() const;
|
std::size_t getRows() const;
|
||||||
const FString getText() const;
|
const FString getText() const;
|
||||||
const FStringList& getLines() const;
|
const FStringList& getLines() const;
|
||||||
|
|
||||||
// Mutators
|
// 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 setText (const FString&);
|
||||||
void scrollToX (int);
|
void scrollToX (int);
|
||||||
void scrollToY (int);
|
void scrollToY (int);
|
||||||
|
@ -128,8 +128,8 @@ class FTextView : public FWidget
|
||||||
FTextView& operator = (const FTextView&);
|
FTextView& operator = (const FTextView&);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
int getTextHeight();
|
std::size_t getTextHeight();
|
||||||
int getTextWidth();
|
std::size_t getTextWidth();
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
|
@ -151,7 +151,7 @@ class FTextView : public FWidget
|
||||||
int xoffset;
|
int xoffset;
|
||||||
int yoffset;
|
int yoffset;
|
||||||
int nf_offset;
|
int nf_offset;
|
||||||
uInt maxLineWidth;
|
std::size_t maxLineWidth;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
@ -162,12 +162,12 @@ inline const char* FTextView::getClassName() const
|
||||||
{ return "FTextView"; }
|
{ return "FTextView"; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline uInt FTextView::getColumns() const
|
inline std::size_t FTextView::getColumns() const
|
||||||
{ return maxLineWidth; }
|
{ return maxLineWidth; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline uInt FTextView::getRows() const
|
inline std::size_t FTextView::getRows() const
|
||||||
{ return uInt(data.size()); }
|
{ return std::size_t(data.size()); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FStringList& FTextView::getLines() const
|
inline const FStringList& FTextView::getLines() const
|
||||||
|
|
|
@ -85,7 +85,7 @@ class FToggleButton : public FWidget
|
||||||
FString& getText();
|
FString& getText();
|
||||||
|
|
||||||
// Mutators
|
// 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);
|
||||||
bool setNoUnderline();
|
bool setNoUnderline();
|
||||||
bool unsetNoUnderline();
|
bool unsetNoUnderline();
|
||||||
|
@ -139,8 +139,8 @@ class FToggleButton : public FWidget
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
bool checked;
|
bool checked;
|
||||||
int label_offset_pos;
|
std::size_t label_offset_pos;
|
||||||
int button_width; // plus margin spaces
|
std::size_t button_width; // plus margin spaces
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
|
@ -154,8 +154,8 @@ class FToggleButton : public FWidget
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void init();
|
void init();
|
||||||
int getHotkeyPos (wchar_t[], wchar_t[], uInt);
|
int getHotkeyPos (wchar_t[], wchar_t[], std::size_t);
|
||||||
void drawText (wchar_t[], int, uInt);
|
void drawText (wchar_t[], int, std::size_t);
|
||||||
|
|
||||||
// Friend classes
|
// Friend classes
|
||||||
friend class FButtonGroup;
|
friend class FButtonGroup;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* 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 *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
@ -112,8 +112,8 @@ class FToolTip : public FWindow
|
||||||
FString text;
|
FString text;
|
||||||
FString* text_components;
|
FString* text_components;
|
||||||
FStringList text_split;
|
FStringList text_split;
|
||||||
uInt max_line_width;
|
std::size_t max_line_width;
|
||||||
uInt text_num_lines;
|
std::size_t text_num_lines;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
|
@ -170,23 +170,23 @@ class FWidget : public FVTerm, public FObject
|
||||||
int getTermX() const;
|
int getTermX() const;
|
||||||
int getTermY() const;
|
int getTermY() const;
|
||||||
const FPoint getTermPos() const;
|
const FPoint getTermPos() const;
|
||||||
int getWidth() const;
|
std::size_t getWidth() const;
|
||||||
int getHeight() const;
|
std::size_t getHeight() const;
|
||||||
int getTopPadding() const;
|
int getTopPadding() const;
|
||||||
int getLeftPadding() const;
|
int getLeftPadding() const;
|
||||||
int getBottomPadding() const;
|
int getBottomPadding() const;
|
||||||
int getRightPadding() const;
|
int getRightPadding() const;
|
||||||
int getClientWidth() const;
|
std::size_t getClientWidth() const;
|
||||||
int getClientHeight() const;
|
std::size_t getClientHeight() const;
|
||||||
int getMaxWidth() const;
|
std::size_t getMaxWidth() const;
|
||||||
int getMaxHeight() const;
|
std::size_t getMaxHeight() const;
|
||||||
const FPoint& getShadow() const;
|
const FPoint& getShadow() const;
|
||||||
const FRect& getGeometry() const;
|
const FRect& getGeometry() const;
|
||||||
const FRect& getGeometryWithShadow();
|
const FRect& getGeometryWithShadow();
|
||||||
const FRect& getTermGeometry();
|
const FRect& getTermGeometry();
|
||||||
const FRect& getTermGeometryWithShadow();
|
const FRect& getTermGeometryWithShadow();
|
||||||
int getDesktopWidth();
|
std::size_t getDesktopWidth();
|
||||||
int getDesktopHeight();
|
std::size_t getDesktopHeight();
|
||||||
int getFlags() const;
|
int getFlags() const;
|
||||||
FPoint getCursorPos();
|
FPoint getCursorPos();
|
||||||
FPoint getPrintPos();
|
FPoint getPrintPos();
|
||||||
|
@ -222,9 +222,9 @@ class FWidget : public FVTerm, public FObject
|
||||||
virtual void setY (int, bool = true);
|
virtual void setY (int, bool = true);
|
||||||
virtual void setPos (const FPoint&, bool = true);
|
virtual void setPos (const FPoint&, bool = true);
|
||||||
virtual void setPos (int, int, bool = true);
|
virtual void setPos (int, int, bool = true);
|
||||||
virtual void setWidth (int, bool = true);
|
virtual void setWidth (std::size_t, bool = true);
|
||||||
virtual void setHeight (int, bool = true);
|
virtual void setHeight (std::size_t, bool = true);
|
||||||
virtual void setSize (int, int, bool = true);
|
virtual void setSize (std::size_t, std::size_t, bool = true);
|
||||||
void setTopPadding (int, bool = true);
|
void setTopPadding (int, bool = true);
|
||||||
void setLeftPadding (int, bool = true);
|
void setLeftPadding (int, bool = true);
|
||||||
void setBottomPadding (int, bool = true);
|
void setBottomPadding (int, bool = true);
|
||||||
|
@ -232,17 +232,17 @@ class FWidget : public FVTerm, public FObject
|
||||||
void setParentOffset();
|
void setParentOffset();
|
||||||
void setTermOffset();
|
void setTermOffset();
|
||||||
void setTermOffsetWithPadding();
|
void setTermOffsetWithPadding();
|
||||||
void setTermSize (int, int);
|
void setTermSize (std::size_t, std::size_t);
|
||||||
virtual void setGeometry (const FRect&, bool = true);
|
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);
|
virtual void setShadowSize (int, int);
|
||||||
void setMinimumWidth (int);
|
void setMinimumWidth (std::size_t);
|
||||||
void setMinimumHeight (int);
|
void setMinimumHeight (std::size_t);
|
||||||
void setMinimumSize (int, int);
|
void setMinimumSize (std::size_t, std::size_t);
|
||||||
void setMaximumWidth (int);
|
void setMaximumWidth (std::size_t);
|
||||||
void setMaximumHeight (int);
|
void setMaximumHeight (std::size_t);
|
||||||
void setMaximumSize (int, int);
|
void setMaximumSize (std::size_t, std::size_t);
|
||||||
void setFixedSize (int, int);
|
void setFixedSize (std::size_t, std::size_t);
|
||||||
bool setCursorPos (const FPoint&);
|
bool setCursorPos (const FPoint&);
|
||||||
bool setCursorPos (int, int);
|
bool setCursorPos (int, int);
|
||||||
void unsetCursorPos();
|
void unsetCursorPos();
|
||||||
|
@ -414,8 +414,8 @@ class FWidget : public FVTerm, public FObject
|
||||||
struct widget_size_hints
|
struct widget_size_hints
|
||||||
{
|
{
|
||||||
widget_size_hints()
|
widget_size_hints()
|
||||||
: min_width (INT_MIN)
|
: min_width (0)
|
||||||
, min_height (INT_MIN)
|
, min_height (0)
|
||||||
, max_width (INT_MAX)
|
, max_width (INT_MAX)
|
||||||
, max_height (INT_MAX)
|
, max_height (INT_MAX)
|
||||||
{ }
|
{ }
|
||||||
|
@ -423,22 +423,22 @@ class FWidget : public FVTerm, public FObject
|
||||||
~widget_size_hints()
|
~widget_size_hints()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void setMinimum (int w, int h)
|
void setMinimum (std::size_t w, std::size_t h)
|
||||||
{
|
{
|
||||||
min_width = w;
|
min_width = w;
|
||||||
min_height = h;
|
min_height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMaximum (int w, int h)
|
void setMaximum (std::size_t w, std::size_t h)
|
||||||
{
|
{
|
||||||
max_width = w;
|
max_width = w;
|
||||||
max_height = h;
|
max_height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
int min_width;
|
std::size_t min_width;
|
||||||
int min_height;
|
std::size_t min_height;
|
||||||
int max_width;
|
std::size_t max_width;
|
||||||
int max_height;
|
std::size_t max_height;
|
||||||
} size_hints;
|
} size_hints;
|
||||||
|
|
||||||
struct dbl_line_mask
|
struct dbl_line_mask
|
||||||
|
@ -545,11 +545,11 @@ inline const FPoint FWidget::getTermPos() const // position on terminal
|
||||||
{ return FPoint(getTermX(), getTermY()); }
|
{ return FPoint(getTermX(), getTermY()); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getWidth() const
|
inline std::size_t FWidget::getWidth() const
|
||||||
{ return adjust_wsize.getWidth(); }
|
{ return adjust_wsize.getWidth(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getHeight() const
|
inline std::size_t FWidget::getHeight() const
|
||||||
{ return adjust_wsize.getHeight(); }
|
{ return adjust_wsize.getHeight(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -569,19 +569,19 @@ inline int FWidget::getRightPadding() const
|
||||||
{ return padding.right; }
|
{ return padding.right; }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getClientWidth() const
|
inline std::size_t FWidget::getClientWidth() const
|
||||||
{ return client_offset.getWidth(); }
|
{ return client_offset.getWidth(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getClientHeight() const
|
inline std::size_t FWidget::getClientHeight() const
|
||||||
{ return client_offset.getHeight(); }
|
{ return client_offset.getHeight(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getMaxWidth() const
|
inline std::size_t FWidget::getMaxWidth() const
|
||||||
{ return offset.getWidth(); }
|
{ return offset.getWidth(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getMaxHeight() const
|
inline std::size_t FWidget::getMaxHeight() const
|
||||||
{ return offset.getHeight(); }
|
{ return offset.getHeight(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -635,11 +635,11 @@ inline const FRect& FWidget::getTermGeometryWithShadow()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getDesktopWidth()
|
inline std::size_t FWidget::getDesktopWidth()
|
||||||
{ return getColumnNumber(); }
|
{ return getColumnNumber(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FWidget::getDesktopHeight()
|
inline std::size_t FWidget::getDesktopHeight()
|
||||||
{ return getLineNumber(); }
|
{ return getLineNumber(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -731,8 +731,8 @@ inline void FWidget::setGeometry (const FRect& box, bool adjust)
|
||||||
{
|
{
|
||||||
setGeometry ( box.getX()
|
setGeometry ( box.getX()
|
||||||
, box.getY()
|
, box.getY()
|
||||||
, box.getWidth()
|
, std::size_t(box.getWidth())
|
||||||
, box.getHeight()
|
, std::size_t(box.getHeight())
|
||||||
, adjust );
|
, adjust );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,31 +741,31 @@ inline void FWidget::setShadowSize (int right, int bottom)
|
||||||
{ wshadow.setPoint (right, 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); }
|
{ 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); }
|
{ 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); }
|
{ 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); }
|
{ 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); }
|
{ 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); }
|
{ 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.setMinimum (width, height);
|
||||||
size_hints.setMaximum (width, height);
|
size_hints.setMaximum (width, height);
|
||||||
|
@ -864,7 +864,7 @@ inline void FWidget::move (const FPoint& pos)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::drawBorder()
|
inline void FWidget::drawBorder()
|
||||||
{ drawBorder (1, 1, getWidth(), getHeight()); }
|
{ drawBorder (1, 1, int(getWidth()), int(getHeight())); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::processDestroy()
|
inline void FWidget::processDestroy()
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* *
|
* *
|
||||||
* This file is part of the Final Cut widget toolkit *
|
* 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 *
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU Lesser General Public License *
|
* 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 setX (int, bool = true);
|
||||||
virtual void setY (int, bool = true);
|
virtual void setY (int, bool = true);
|
||||||
virtual void setPos (int, int, bool = true);
|
virtual void setPos (int, int, bool = true);
|
||||||
virtual void setWidth (int, bool = true);
|
virtual void setWidth (std::size_t, bool = true);
|
||||||
virtual void setHeight (int, bool = true);
|
virtual void setHeight (std::size_t, bool = true);
|
||||||
virtual void setSize (int, int, bool = true);
|
virtual void setSize (std::size_t, std::size_t, bool = true);
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
void setGeometry (int, int, std::size_t, std::size_t, bool = true);
|
||||||
virtual void move (int, int);
|
virtual void move (int, int);
|
||||||
static FWindow* getWindowWidgetAt (const FPoint&);
|
static FWindow* getWindowWidgetAt (const FPoint&);
|
||||||
static FWindow* getWindowWidgetAt (int, int);
|
static FWindow* getWindowWidgetAt (int, int);
|
||||||
|
|
|
@ -221,7 +221,7 @@ void FStringTest::initLengthTest()
|
||||||
CPPUNIT_ASSERT ( s1.isEmpty() );
|
CPPUNIT_ASSERT ( s1.isEmpty() );
|
||||||
|
|
||||||
const int x1 = 10;
|
const int x1 = 10;
|
||||||
const uInt x2 = 10;
|
const std::size_t x2 = 10;
|
||||||
const finalcut::FString s2(x1);
|
const finalcut::FString s2(x1);
|
||||||
CPPUNIT_ASSERT ( s2.getLength() == 10 );
|
CPPUNIT_ASSERT ( s2.getLength() == 10 );
|
||||||
CPPUNIT_ASSERT ( ! s2.isNull() );
|
CPPUNIT_ASSERT ( ! s2.isNull() );
|
||||||
|
@ -1261,7 +1261,8 @@ void FStringTest::subStringTest()
|
||||||
CPPUNIT_ASSERT ( str1.left(int(11)) == L"Look behind" );
|
CPPUNIT_ASSERT ( str1.left(int(11)) == L"Look behind" );
|
||||||
CPPUNIT_ASSERT ( str1.left(999)
|
CPPUNIT_ASSERT ( str1.left(999)
|
||||||
== L"Look behind you, a three-headed monkey!" );
|
== 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) == L"" );
|
||||||
CPPUNIT_ASSERT ( str1.left(0).isEmpty() );
|
CPPUNIT_ASSERT ( str1.left(0).isEmpty() );
|
||||||
CPPUNIT_ASSERT ( ! str1.left(0).isNull() );
|
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(int(7)) == L"monkey!" );
|
||||||
CPPUNIT_ASSERT ( str1.right(999)
|
CPPUNIT_ASSERT ( str1.right(999)
|
||||||
== L"Look behind you, a three-headed monkey!" );
|
== 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) == L"" );
|
||||||
CPPUNIT_ASSERT ( str1.right(0).isEmpty() );
|
CPPUNIT_ASSERT ( str1.right(0).isEmpty() );
|
||||||
CPPUNIT_ASSERT ( ! str1.right(0).isNull() );
|
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, 0) == L"" );
|
||||||
CPPUNIT_ASSERT ( str1.mid(-5, 2) == L"" );
|
CPPUNIT_ASSERT ( str1.mid(-5, 2) == L"" );
|
||||||
CPPUNIT_ASSERT ( str1.mid(0, 0) == 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).isEmpty() );
|
||||||
CPPUNIT_ASSERT ( ! str1.mid(0, 0).isNull() );
|
CPPUNIT_ASSERT ( ! str1.mid(0, 0).isNull() );
|
||||||
CPPUNIT_ASSERT ( finalcut::FString().mid(5, 0).isNull() );
|
CPPUNIT_ASSERT ( finalcut::FString().mid(5, 0).isNull() );
|
||||||
|
|
Loading…
Reference in New Issue