Improve code readability through spaces between the operands and the operators

This commit is contained in:
Markus Gans 2017-08-27 09:50:30 +02:00
parent 12c0d53192
commit 5f7737bf64
46 changed files with 626 additions and 612 deletions

View File

@ -1,3 +1,7 @@
2017-08-26 Markus Gans <guru.mail@muenster.de>
* Improve code readability through spaces between
the operands and the operators
2017-08-24 Markus Gans <guru.mail@muenster.de>
* Rename fapp.{cpp,h} to fapplication.{cpp,h}

View File

@ -423,7 +423,7 @@ int FApplication::gpmEvent (bool clear)
FD_SET(gpm_fd, &ifds);
tv.tv_sec = 0;
tv.tv_usec = 100000; // 100 ms
result = select (max+1, &ifds, 0, 0, &tv);
result = select (max + 1, &ifds, 0, 0, &tv);
if ( FD_ISSET(stdin_no, &ifds) )
{
@ -454,7 +454,7 @@ inline bool FApplication::KeyPressed()
FD_SET(stdin_no, &ifds);
tv.tv_sec = 0;
tv.tv_usec = 100000; // 100 ms
result = select (stdin_no+1, &ifds, 0, 0, &tv);
result = select (stdin_no + 1, &ifds, 0, 0, &tv);
if ( FD_ISSET(stdin_no, &ifds) )
FD_CLR (stdin_no, &ifds);
@ -467,7 +467,7 @@ inline ssize_t FApplication::readKey()
{
register ssize_t bytes;
setNonBlockingInput();
bytes = read(stdin_no, &k_buf, sizeof(k_buf)-1);
bytes = read(stdin_no, &k_buf, sizeof(k_buf) - 1);
unsetNonBlockingInput();
return bytes;
}
@ -546,7 +546,7 @@ void FApplication::processKeyboardEvent()
{
if ( bytesread + fifo_offset <= fifo_buf_size )
{
for (int i=0; i < bytesread; i++)
for (int i = 0; i < bytesread; i++)
{
fifo_buf[fifo_offset] = k_buf[i];
fifo_offset++;
@ -585,14 +585,14 @@ void FApplication::processKeyboardEvent()
x11_mouse[3] = '\0';
// Remove founded entry
for (n=len; n < fifo_buf_size; n++)
fifo_buf[n-len] = fifo_buf[n];
for (n = len; n < fifo_buf_size; n++)
fifo_buf[n - len] = fifo_buf[n];
n = fifo_buf_size - len - 1;
// Fill rest with '\0'
for (; n < fifo_buf_size; n++)
fifo_buf[n-len] = '\0';
fifo_buf[n - len] = '\0';
unprocessedInput() = bool(fifo_buf[0] != '\0');
processMouseEvent();
@ -606,22 +606,22 @@ void FApplication::processKeyboardEvent()
while ( n < len && n < fifo_buf_size )
{
sgr_mouse[n-3] = fifo_buf[n];
sgr_mouse[n - 3] = fifo_buf[n];
n++;
if ( fifo_buf[n] == 'M' || fifo_buf[n] == 'm' )
len = n + 1;
}
sgr_mouse[n-3] = '\0';
sgr_mouse[n - 3] = '\0';
for (n=len; n < fifo_buf_size; n++) // Remove founded entry
fifo_buf[n-len] = fifo_buf[n];
for (n = len; n < fifo_buf_size; n++) // Remove founded entry
fifo_buf[n - len] = fifo_buf[n];
n = fifo_buf_size-len-1;
n = fifo_buf_size - len - 1;
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
fifo_buf[n-len] = '\0';
fifo_buf[n - len] = '\0';
unprocessedInput() = bool(fifo_buf[0] != '\0');
processMouseEvent();
@ -635,22 +635,22 @@ void FApplication::processKeyboardEvent()
while ( n < len && n < fifo_buf_size )
{
urxvt_mouse[n-2] = fifo_buf[n];
urxvt_mouse[n - 2] = fifo_buf[n];
n++;
if ( fifo_buf[n] == 'M' || fifo_buf[n] == 'm' )
len = n + 1;
}
urxvt_mouse[n-2] = '\0';
urxvt_mouse[n - 2] = '\0';
for (n=len; n < fifo_buf_size; n++) // Remove founded entry
fifo_buf[n-len] = fifo_buf[n];
for (n = len; n < fifo_buf_size; n++) // Remove founded entry
fifo_buf[n - len] = fifo_buf[n];
n = fifo_buf_size-len-1;
n = fifo_buf_size - len - 1;
for (; n < fifo_buf_size; n++) // Fill rest with '\0'
fifo_buf[n-len] = '\0';
fifo_buf[n - len] = '\0';
unprocessedInput() = bool(fifo_buf[0] != '\0');
processMouseEvent();
@ -1024,7 +1024,7 @@ bool FApplication::processDialogSwitchAccelerator()
}
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
sendEvent (dialog_list->at(n-1), &a_ev);
sendEvent (dialog_list->at(n - 1), &a_ev);
return true;
}
}

View File

@ -255,7 +255,7 @@ void FButton::hide()
try
{
blank = new char[size+1];
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
@ -265,9 +265,9 @@ void FButton::hide()
std::memset(blank, ' ', uLong(size));
blank[size] = '\0';
for (int y=0; y < getHeight()+s+(f << 1); y++)
for (int y = 0; y < getHeight() + s + (f << 1); y++)
{
setPrintPos (1-f, 1+y-f);
setPrintPos (1 - f, 1 + y - f);
print (blank);
}
@ -444,16 +444,16 @@ uChar FButton::getHotkey()
length = int(text.getLength());
for (int i=0; i < length; i++)
for (int i = 0; i < length; i++)
{
try
{
if ( (i+1 < length) && (text[uInt(i)] == '&') )
if ( i + 1 < length && text[uInt(i)] == '&' )
return uChar(text[uInt(++i)]);
}
catch (const std::out_of_range&)
{
return 0;;
return 0;
}
}
@ -513,9 +513,9 @@ void FButton::draw()
try
{
if ( isMonochron() || getMaxColor() < 16 )
ButtonText = new wchar_t[length+3]();
ButtonText = new wchar_t[length + 3]();
else
ButtonText = new wchar_t[length+1]();
ButtonText = new wchar_t[length + 1]();
}
catch (const std::bad_alloc& ex)
{
@ -532,7 +532,7 @@ void FButton::draw()
is_Active = ((flags & fc::active) != 0);
is_Focus = ((flags & fc::focus) != 0);
is_Flat = isFlat();
is_NonFlatShadow = ((flags & (fc::shadow+fc::flat)) == fc::shadow);
is_NonFlatShadow = ((flags & (fc::shadow + fc::flat)) == fc::shadow);
is_NoUnderline = ((flags & fc::no_underline) != 0);
if ( isMonochron() )
@ -550,7 +550,7 @@ void FButton::draw()
setColor ( parent_widget->getForegroundColor()
, parent_widget->getBackgroundColor() );
for (int y=1; y <= getHeight(); y++)
for (int y = 1; y <= getHeight(); y++)
{
setPrintPos (1, y);
print (' '); // clear one left █
@ -580,9 +580,9 @@ void FButton::draw()
// find hotkey position in string
// + generate a new string without the '&'-sign
for (i=0; i < length; i++)
for (i = 0; i < length; i++)
{
if ( (i < length) && (txt[uInt(i)] == '&') && (hotkeypos == -1) )
if ( i < length && txt[uInt(i)] == '&' && hotkeypos == -1 )
{
hotkeypos = i;
i++;
@ -595,7 +595,7 @@ void FButton::draw()
if ( hotkeypos != -1 )
hotkey_offset = 1;
if ( (length - hotkey_offset + mono_offset - hotkey_offset) <= getWidth() )
if ( length - hotkey_offset + mono_offset - hotkey_offset <= getWidth() )
margin = 1;
else
margin = 0;
@ -607,9 +607,9 @@ void FButton::draw()
{
setColor (getForegroundColor(), button_bg);
for (int y=0; y < getHeight(); y++)
for (int y = 0; y < getHeight(); y++)
{
setPrintPos (1+d, 1+y);
setPrintPos (1 + d, 1 + y);
print (space); // full block █
}
}
@ -626,12 +626,12 @@ void FButton::draw()
setColor ( parent_widget->getForegroundColor()
, parent_widget->getBackgroundColor() );
for (int y=1; y <= getHeight(); y++)
for (int y = 1; y <= getHeight(); y++)
{
if ( isMonochron() )
setReverse(true);
setPrintPos (1+getWidth(), y);
setPrintPos (1 + getWidth(), y);
print (' '); // clear right
if ( isMonochron() )
@ -646,25 +646,25 @@ void FButton::draw()
i = int(i / 2);
if ( getHeight() >= 2 )
j = int((getHeight()-1) / 2);
j = int((getHeight() - 1) / 2);
else
j=0;
setPrintPos (1+margin+d, 1+j);
setPrintPos (1 + margin + d, 1 + j);
setColor (button_fg, button_bg);
for (x=0; x < i; x++)
for (x = 0; x < i; x++)
print (space); // █
if ( hotkeypos == -1 )
setCursorPos (1+margin+i+mono_1st_char, 1+j ); // first character
setCursorPos (1 + margin + i + mono_1st_char, 1 + j ); // first character
else
setCursorPos (1+margin+i+hotkeypos, 1+j ); // hotkey
setCursorPos (1 + margin + i + hotkeypos, 1 + j ); // hotkey
if ( is_ActiveFocus && (isMonochron() || getMaxColor() < 16) )
setBold();
for (int z=0; x < i+length && z < getWidth(); z++,x++)
for (int z = 0; x < i + length && z < getWidth(); z++,x++)
{
if ( (z == hotkeypos) && is_Active )
{
@ -695,23 +695,23 @@ void FButton::draw()
if ( is_ActiveFocus && (isMonochron() || getMaxColor() < 16) )
unsetBold();
for (x=i+length; x < getWidth()-1; x++)
for (x = i + length; x < getWidth() - 1; x++)
print (space); // █
if ( getHeight() >= 2 )
{
for (i=0; i < j; i++)
for (i = 0; i < j; i++)
{
setPrintPos (2+d, 1+i);
setPrintPos (2 + d, 1 + i);
for (int z=1; z < getWidth(); z++)
for (int z = 1; z < getWidth(); z++)
print (space); // █
}
for (i=j+1; i < getHeight(); i++)
for (i = j + 1; i < getHeight(); i++)
{
setPrintPos (2+d, 1+i);
setPrintPos (2 + d, 1 + i);
for (int z=1; z < getWidth(); z++)
for (int z = 1; z < getWidth(); z++)
print (space); // █
}
}

View File

@ -208,7 +208,7 @@ void FButtonGroup::hide()
try
{
blank = new char[size+1];
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
@ -219,9 +219,9 @@ void FButtonGroup::hide()
std::memset(blank, ' ', uLong(size));
blank[size] = '\0';
for (int y=0; y < getHeight(); y++)
for (int y = 0; y < getHeight(); y++)
{
FWidget::setPrintPos (1, 1+y);
FWidget::setPrintPos (1, 1 + y);
print (blank);
}
@ -431,16 +431,16 @@ uChar FButtonGroup::getHotkey()
length = text.getLength();
for (uInt i=0; i < length; i++)
for (uInt i = 0; i < length; i++)
{
try
{
if ( (i+1 < length) && (text[i] == '&') )
if ( i + 1 < length && text[i] == '&' )
return uChar(text[++i]);
}
catch (const std::out_of_range&)
{
return 0;;
return 0;
}
}
return 0;
@ -503,7 +503,7 @@ void FButtonGroup::drawLabel()
try
{
LabelText = new wchar_t[length+1]();
LabelText = new wchar_t[length + 1]();
}
catch (const std::bad_alloc& ex)
{
@ -520,7 +520,7 @@ void FButtonGroup::drawLabel()
// find hotkey position in string
// + generate a new string without the '&'-sign
for (uInt i=0; i < length; i++)
for (uInt i = 0; i < length; i++)
{
if ( (i < length) && (txt[i] == '&') && (hotkeypos == -1) )
{
@ -544,7 +544,7 @@ void FButtonGroup::drawLabel()
else
setColor(wc.label_inactive_fg, wc.label_inactive_bg);
for (int z=0; z < int(length); z++)
for (int z = 0; z < int(length); z++)
{
if ( (z == hotkeypos) && isActive )
{

View File

@ -188,7 +188,7 @@ void FDialog::setPos (int x, int y, bool)
height = getHeight();
// Avoid to move widget completely outside the terminal
if ( x+width <= 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() )
if ( x + width <= 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() )
return;
if ( isZoomed() )
@ -220,22 +220,25 @@ void FDialog::setPos (int x, int y, bool)
if ( dx > 0 )
{
if ( dy > 0 )
restoreVTerm (old_x+width+rsw-dx, old_y, dx, getHeight()+bsh-dy);
restoreVTerm ( old_x + width + rsw - dx, old_y
, dx, getHeight() + bsh - dy );
else
restoreVTerm (old_x+width+rsw-dx, old_y+std::abs(dy), dx, height+bsh-std::abs(dy));
restoreVTerm ( old_x + width + rsw - dx, old_y + std::abs(dy)
, dx, height + bsh - std::abs(dy));
}
else
{
if ( dy > 0 )
restoreVTerm (old_x, old_y, std::abs(dx), height+bsh-dy);
restoreVTerm (old_x, old_y, std::abs(dx), height + bsh - dy);
else
restoreVTerm (old_x, old_y+std::abs(dy), std::abs(dx), height+bsh-std::abs(dy));
restoreVTerm ( old_x, old_y + std::abs(dy)
, std::abs(dx), height + bsh - std::abs(dy) );
}
if ( dy > 0 )
restoreVTerm (old_x, old_y+height+bsh-dy, width+rsw, dy);
restoreVTerm (old_x, old_y + height + bsh - dy, width + rsw, dy);
else
restoreVTerm (old_x, old_y, width+rsw, std::abs(dy));
restoreVTerm (old_x, old_y, width + rsw, std::abs(dy));
}
else
{
@ -321,10 +324,10 @@ void FDialog::setSize (int w, int h, bool adjust)
// restoring the non-covered terminal areas
if ( dw > 0 )
restoreVTerm (x+w+rsw, y, dw, h+bsh+dh); // restore right
restoreVTerm (x + w + rsw, y, dw, h + bsh + dh); // restore right
if ( dh > 0 )
restoreVTerm (x, y+h+bsh, w+rsw+dw, dh); // restore bottom
restoreVTerm (x, y + h + bsh, w + rsw + dw, dh); // restore bottom
redraw();
@ -528,7 +531,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
{
int mouse_x = ev->getX();
int mouse_y = ev->getY();
int zoom_btn;;
int zoom_btn;
if ( ! isResizeable() )
zoom_btn = 0;
@ -549,7 +552,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
bool has_raised;
// click on titlebar or window: raise + activate
if ( mouse_x >= 4 && mouse_x <= getWidth()-zoom_btn && mouse_y == 1 )
if ( mouse_x >= 4 && mouse_x <= getWidth() - zoom_btn && mouse_y == 1 )
titlebar_click_pos.setPoint (ev->getTermX(), ev->getTermY());
else
titlebar_click_pos.setPoint (0,0);
@ -565,7 +568,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
// click on titlebar menu button
if ( mouse_x < 4 && mouse_y == 1 )
openMenu();
else if ( mouse_x > getWidth()-zoom_btn && mouse_y == 1 )
else if ( mouse_x > getWidth() - zoom_btn && mouse_y == 1 )
{
zoom_button_pressed = true;
zoom_button_active = true;
@ -575,8 +578,8 @@ void FDialog::onMouseDown (FMouseEvent* ev)
// click on the lower right resize corner
if ( isResizeable()
&& ( (mouse_x == getWidth() && mouse_y == getHeight())
|| (mouse_x == getWidth()-1 && mouse_y == getHeight())
|| (mouse_x == getWidth() && mouse_y == getHeight()-1) ) )
|| (mouse_x == getWidth() - 1 && mouse_y == getHeight())
|| (mouse_x == getWidth() && mouse_y == getHeight() - 1) ) )
{
resize_click_pos = ev->getTermPos();
FPoint lower_right_pos = getTermGeometry().getLowerRightPos();
@ -1088,7 +1091,7 @@ void FDialog::init()
return;
}
dialog_menu->setPos (getX(), getY()+1);
dialog_menu->setPos (getX(), getY() + 1);
dgl_menuitem = dialog_menu->getItem();
if ( dgl_menuitem )
@ -1170,7 +1173,7 @@ void FDialog::drawBorder()
if ( isNewFont() )
{
for (int y=y1; y < y2; y++)
for (int y = y1; y < y2; y++)
{
setPrintPos (x1, y);
// border left ⎸
@ -1184,7 +1187,7 @@ void FDialog::drawBorder()
// lower left corner border ⎣
print (fc::NF_border_corner_lower_left);
for (int x=1; x < getWidth()-1; x++) // low line _
for (int x = 1; x < getWidth() - 1; x++) // low line _
print (fc::NF_border_line_bottom);
setPrintPos (x2, y2);
@ -1269,7 +1272,7 @@ void FDialog::drawTitleBar()
i = getWidth() - length - menu_btn - zoom_btn;
i = int(i/2);
for (x=1; x <= i; x++)
for (x = 1; x <= i; x++)
print (' ');
// the title bar text
@ -1285,7 +1288,7 @@ void FDialog::drawTitleBar()
}
// fill the rest of the bar
for (; x+1+length < getWidth()-zoom_btn-1; x++)
for ( ; x + 1 + length < getWidth() - zoom_btn - 1; x++)
print (' ');
if ( getMaxColor() < 16 )
@ -1351,7 +1354,7 @@ void FDialog::drawTitleBar()
setReverse(false);
/* print the number of window in stack */
//setPrintPos (getWidth()-2, 1);
//setPrintPos (getWidth() - 2, 1);
//printf ("(%d)", getWindowLayer(this));
}
@ -1390,7 +1393,7 @@ void FDialog::openMenu()
else
{
setOpenMenu(dialog_menu);
dialog_menu->setPos (getX(), getY()+1);
dialog_menu->setPos (getX(), getY() + 1);
dialog_menu->setVisible();
drawTitleBar();
dialog_menu->show();

View File

@ -182,7 +182,7 @@ void FFileDialog::setPath (const FString& dir)
else
r_dir = dir;
if ( r_dir[r_dir.getLength()-1] != '/' )
if ( r_dir[r_dir.getLength() - 1] != '/' )
directory = r_dir + "/";
else
directory = r_dir;
@ -326,11 +326,11 @@ int FFileDialog::readDir()
dir_num = numOfDirs();
// directories first
std::sort(dir_entries.begin()+start, dir_entries.end(), sortDirFirst);
std::sort(dir_entries.begin() + start, dir_entries.end(), sortDirFirst);
// sort directories by name
std::sort(dir_entries.begin()+start, dir_entries.begin()+dir_num, sortByName);
std::sort(dir_entries.begin() + start, dir_entries.begin() + dir_num, sortByName);
// sort files by name
std::sort(dir_entries.begin()+dir_num, dir_entries.end(), sortByName);
std::sort(dir_entries.begin() + dir_num, dir_entries.end(), sortByName);
// fill list with directory entries
filebrowser->clear();
@ -472,10 +472,10 @@ void FFileDialog::adjustSize()
X = 1 + int((max_width - getWidth()) / 2);
Y = 1 + int((max_height - getHeight()) / 3);
setPos(X, Y, false);
filebrowser->setHeight (h-8, false);
hidden->setY(h-4, false);
cancel->setY(h-4, false);
open->setY(h-4, false);
filebrowser->setHeight (h - 8, false);
hidden->setY (h - 4, false);
cancel->setY (h - 4, false);
open->setY (h - 4, false);
FDialog::adjustSize();
printPath(directory);
}
@ -495,8 +495,8 @@ void FFileDialog::init()
if ( parent_widget )
{
x = 1 + int((parent_widget->getWidth()-w)/2);
y = 1 + int((parent_widget->getHeight()-h)/3);
x = 1 + int((parent_widget->getWidth() - w) / 2);
y = 1 + int((parent_widget->getHeight() - h) / 3);
}
else
x = y = 1;
@ -739,7 +739,7 @@ void FFileDialog::printPath (const FString& txt)
uInt max_width = uInt(filebrowser->getWidth()) - 4;
if ( path.getLength() > max_width )
filebrowser->setText(".." + path.right(max_width-2));
filebrowser->setText(".." + path.right(max_width - 2));
else
filebrowser->setText(path);
}
@ -805,9 +805,9 @@ void FFileDialog::cb_processRowChanged (FWidget*, data_ptr)
if ( n == 0 )
return;
FString name = dir_entries[uLong(n-1)].name;
FString name = dir_entries[uLong(n - 1)].name;
if ( dir_entries[uLong(n-1)].type == DT_DIR )
if ( dir_entries[uLong(n - 1)].type == DT_DIR )
filename->setText( name + '/' );
else
filename->setText( name );

View File

@ -160,7 +160,7 @@ void FLabel::hide()
try
{
blank = new char[size+1];
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
@ -297,16 +297,16 @@ uChar FLabel::getHotkey()
length = text.getLength();
for (uInt i=0; i < length; i++)
for (uInt i = 0; i < length; i++)
{
try
{
if ( (i+1 < length) && (text[i] == '&') )
if ( i + 1 < length && text[i] == '&' )
return uChar(text[++i]);
}
catch (const std::out_of_range&)
{
return 0;;
return 0;
}
}
@ -321,9 +321,9 @@ int FLabel::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length)
int hotkeypos = -1;
wchar_t* txt = src;
for (uInt i=0; i < length; i++)
for (uInt i = 0; i < length; i++)
{
if ( (i < length) && (txt[i] == L'&') && (hotkeypos == -1) )
if ( i < length && txt[i] == L'&' && hotkeypos == -1 )
{
hotkeypos = int(i);
i++;
@ -403,7 +403,7 @@ void FLabel::printLine ( wchar_t*& line
if ( hasReverseMode() )
setReverse(true);
for (int z=0; z < to_char; z++)
for (int z = 0; z < to_char; z++)
{
if ( ! std::iswprint(wint_t(line[z])) )
{
@ -489,7 +489,7 @@ void FLabel::draw()
try
{
LabelText = new wchar_t[length+1]();
LabelText = new wchar_t[length + 1]();
}
catch (const std::bad_alloc& ex)
{
@ -505,12 +505,12 @@ void FLabel::draw()
else
std::wcsncpy(dest, src, length);
setPrintPos (1, 1+int(y));
setPrintPos (1, 1 + int(y));
if ( hotkeypos != -1 )
{
align_offset = getAlignOffset (int(length-1));
printLine (LabelText, length-1, hotkeypos, align_offset);
align_offset = getAlignOffset (int(length - 1));
printLine (LabelText, length - 1, hotkeypos, align_offset);
hotkey_printed = true;
hotkeypos = -1;
}
@ -530,7 +530,7 @@ void FLabel::draw()
try
{
LabelText = new wchar_t[length+1]();
LabelText = new wchar_t[length + 1]();
}
catch (const std::bad_alloc& ex)
{

View File

@ -195,7 +195,7 @@ void FLineEdit::hide()
try
{
blank = new char[size+1];
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
@ -206,9 +206,9 @@ void FLineEdit::hide()
std::memset(blank, ' ', uLong(size));
blank[size] = '\0';
for (int y=0; y < getHeight()+s; y++)
for (int y = 0; y < getHeight() + s; y++)
{
setPrintPos (1, 1+y);
setPrintPos (1, 1 + y);
print (blank);
}
@ -252,7 +252,8 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
if ( cursor_pos >= len )
cursor_pos=len;
if ( cursor_pos-text_offset >= getWidth()-2 && text_offset <= len-getWidth()+1 )
if ( cursor_pos - text_offset >= getWidth() - 2
&& text_offset <= len - getWidth() + 1 )
text_offset++;
ev->accept();
@ -266,8 +267,8 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
case fc::Fkey_end:
cursor_pos=len;
if ( cursor_pos >= getWidth()-1 )
text_offset=len-getWidth()+2;
if ( cursor_pos >= getWidth() - 1 )
text_offset = len - getWidth() + 2;
ev->accept();
break;
@ -282,9 +283,9 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
cursor_pos=len;
if ( cursor_pos < 0 )
cursor_pos=0;
cursor_pos = 0;
if ( text_offset > 0 && len-text_offset < getWidth()-1 )
if ( text_offset > 0 && len - text_offset < getWidth() - 1 )
text_offset--;
ev->accept();
@ -294,7 +295,7 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
case fc::Fkey_backspace:
if ( len > 0 && cursor_pos > 0 )
{
text.remove(uInt(cursor_pos-1), 1);
text.remove(uInt(cursor_pos - 1), 1);
processChanged();
cursor_pos--;
@ -350,7 +351,7 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
}
cursor_pos++;
if ( cursor_pos >= getWidth()-1 )
if ( cursor_pos >= getWidth() - 1 )
text_offset++;
ev->accept();
@ -463,14 +464,14 @@ void FLineEdit::onMouseMove (FMouseEvent* ev)
else if ( mouse_x >= getWidth() )
{
// drag right
if ( ! scroll_timer && text_offset <= len-getWidth()+1 )
if ( ! scroll_timer && text_offset <= len - getWidth() + 1 )
{
scroll_timer = true;
addTimer(scroll_repeat);
drag_scroll = FLineEdit::scrollRight;
}
if ( text_offset == len-getWidth()+2 )
if ( text_offset == len - getWidth() + 2 )
{
delOwnTimer();
drag_scroll = FLineEdit::noScroll;
@ -515,7 +516,7 @@ void FLineEdit::onTimer (FTimerEvent*)
break;
case FLineEdit::scrollRight:
if ( text_offset == len-getWidth()+2 )
if ( text_offset == len - getWidth() + 2 )
{
drag_scroll = FLineEdit::noScroll;
return;
@ -523,8 +524,8 @@ void FLineEdit::onTimer (FTimerEvent*)
text_offset++;
if ( text_offset > len-getWidth()+2 )
text_offset = len-getWidth()+2;
if ( text_offset > len - getWidth() + 2 )
text_offset = len - getWidth() + 2;
cursor_pos++;
@ -623,11 +624,11 @@ void FLineEdit::adjustLabel()
switch ( label_orientation )
{
case label_above:
label->setGeometry(getX(), getY()-1, label_length, 1);
label->setGeometry(getX(), getY() - 1, label_length, 1);
break;
case label_left:
label->setGeometry(getX()-label_length-1, getY(), label_length, 1);
label->setGeometry(getX() - label_length - 1, getY(), label_length, 1);
break;
}
}
@ -727,7 +728,7 @@ void FLineEdit::drawInputField()
if ( isActiveFocus && getMaxColor() < 16 )
setBold();
show_text = text.mid(uInt(1+text_offset), uInt(getWidth()-2));
show_text = text.mid(uInt(1 + text_offset), uInt(getWidth() - 2));
if ( isUTF8_linux_terminal() )
{
@ -743,7 +744,7 @@ void FLineEdit::drawInputField()
x = int(show_text.getLength());
while ( x < getWidth()-1 )
while ( x < getWidth() - 1 )
{
print (' ');
x++;
@ -762,7 +763,7 @@ void FLineEdit::drawInputField()
drawShadow ();
// set the cursor to the first pos.
setCursorPos (2+cursor_pos-text_offset, 1);
setCursorPos (2 + cursor_pos - text_offset, 1);
}
//----------------------------------------------------------------------

View File

@ -174,13 +174,13 @@ void FListBox::setGeometry (int x, int y, int w, int h, bool adjust)
if ( isNewFont() )
{
vbar->setGeometry (getWidth(), 2, 2, getHeight()-2);
hbar->setGeometry (1, getHeight(), getWidth()-2, 1);
vbar->setGeometry (getWidth(), 2, 2, getHeight() - 2);
hbar->setGeometry (1, getHeight(), getWidth() - 2, 1);
}
else
{
vbar->setGeometry (getWidth(), 2, 1, getHeight()-2);
hbar->setGeometry (2, getHeight(), getWidth()-2, 1);
vbar->setGeometry (getWidth(), 2, 1, getHeight() - 2);
hbar->setGeometry (2, getHeight(), getWidth() - 2, 1);
}
}
@ -245,7 +245,7 @@ void FListBox::hide()
try
{
blank = new char[size+1];
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
@ -256,7 +256,7 @@ void FListBox::hide()
std::memset (blank, ' ', uLong(size));
blank[size] = '\0';
for (int y=0; y < getHeight(); y++)
for (int y = 0; y < getHeight(); y++)
{
setPrintPos (1, 1 + y);
print (blank);
@ -380,7 +380,7 @@ void FListBox::clear()
try
{
blank = new char[size+1];
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
@ -391,7 +391,7 @@ void FListBox::clear()
std::memset (blank, ' ', uLong(size));
blank[size] = '\0';
for (int y=0; y < getHeight()-2; y++)
for (int y = 0; y < getHeight() - 2; y++)
{
setPrintPos (2, 2 + y);
print (blank);
@ -537,7 +537,7 @@ void FListBox::onKeyPress (FKeyEvent* ev)
if ( current > element_count )
current = element_count;
if ( current-yoffset >= getHeight() - 1 )
if ( current - yoffset >= getHeight() - 1 )
yoffset++;
ev->accept();
@ -560,7 +560,7 @@ void FListBox::onKeyPress (FKeyEvent* ev)
{
if ( ! inc_found
&& inc_search.toLower()
== iter->getText().left(inc_len+1).toLower() )
== iter->getText().left(inc_len + 1).toLower() )
{
setCurrentItem(iter);
inc_found = true;
@ -599,7 +599,7 @@ void FListBox::onKeyPress (FKeyEvent* ev)
if ( inc_len > 0 )
{
inc_search.remove(inc_len-1, 1);
inc_search.remove(inc_len - 1, 1);
if ( inc_len > 1 )
{
@ -608,7 +608,7 @@ void FListBox::onKeyPress (FKeyEvent* ev)
while ( iter != data.end() )
{
if ( inc_search.toLower()
== iter->getText().left(inc_len-1).toLower() )
== iter->getText().left(inc_len - 1).toLower() )
{
setCurrentItem(iter);
break;
@ -663,7 +663,7 @@ void FListBox::onKeyPress (FKeyEvent* ev)
if ( ! inc_found )
{
inc_search.remove(inc_len-1, 1);
inc_search.remove(inc_len - 1, 1);
if ( inc_len == 1 )
ev->ignore();
@ -852,7 +852,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
from = secect_from_item + 1;
to = current;
}
for (int i=from; i <= to; i++)
for (int i = from; i <= to; i++)
{
if ( mouse_select )
{
@ -1100,7 +1100,7 @@ void FListBox::onWheel (FWheelEvent* ev)
if ( yoffset < 0 )
{
current -= 4+yoffset;
current -= 4 + yoffset;
yoffset=0;
}
else
@ -1304,7 +1304,7 @@ void FListBox::draw()
{
setColor();
for (int y=2; y < getHeight(); y++)
for (int y = 2; y < getHeight(); y++)
{
setPrintPos (getWidth(),y);
print (' '); // clear right side of the scrollbar
@ -1360,7 +1360,7 @@ void FListBox::drawLabel()
print (txt);
else
{
print (text.left(uInt(getClientWidth()-2)));
print (text.left(uInt(getClientWidth() - 2)));
setColor (wc.label_ellipsis_fg, wc.label_bg);
print("..");
}
@ -1398,7 +1398,7 @@ void FListBox::drawList()
iter = index2iterator(int(start) + yoffset);
for (uInt y=start; y < end; y++)
for (uInt y = start; y < end; y++)
{
bool serach_mark = false;
bool lineHasBrackets = hasBrackets(iter);
@ -1524,12 +1524,12 @@ void FListBox::drawList()
break;
}
element = getString(iter).mid ( uInt(1+xoffset)
, uInt(getWidth()-nf_offset-5) );
element = getString(iter).mid ( uInt(1 + xoffset)
, uInt(getWidth() - nf_offset - 5) );
}
else
element = getString(iter).mid ( uInt(xoffset)
, uInt(getWidth()-nf_offset-4) );
, uInt(getWidth() - nf_offset - 4) );
const wchar_t* const& element_str = element.wc_str();
len = element.getLength();
@ -1549,7 +1549,8 @@ void FListBox::drawList()
full_length = int(getString(iter).getLength());
if ( b+i < uInt(getWidth()-nf_offset-4) && xoffset <= full_length+1 )
if ( b + i < uInt(getWidth() - nf_offset - 4)
&& xoffset <= full_length + 1 )
{
if ( serach_mark && i == inc_len )
setColor ( wc.current_element_focus_fg
@ -1586,14 +1587,14 @@ void FListBox::drawList()
i++;
}
for (; b+i < uInt(getWidth()-nf_offset-3); i++)
for (; b + i < uInt(getWidth() - nf_offset - 3); i++)
print (' ');
}
else // line has no brackets
{
uInt i, len;
element = getString(iter).mid ( uInt(1+xoffset)
, uInt(getWidth()-nf_offset-4) );
element = getString(iter).mid ( uInt(1 + xoffset)
, uInt(getWidth() - nf_offset - 4) );
const wchar_t* const& element_str = element.wc_str();
len = element.getLength();
@ -1601,7 +1602,7 @@ void FListBox::drawList()
setColor ( wc.current_inc_search_element_fg
, wc.current_element_focus_bg );
for (i=0; i < len; i++)
for (i = 0; i < len; i++)
{
if ( serach_mark && i == inc_len )
setColor ( wc.current_element_focus_fg
@ -1616,7 +1617,7 @@ void FListBox::drawList()
i++;
}
for (; i < uInt(getWidth()-nf_offset-3); i++)
for (; i < uInt(getWidth() - nf_offset - 3); i++)
print (' ');
}
@ -1853,7 +1854,7 @@ void FListBox::cb_HBarChange (FWidget*, data_ptr)
xoffset -= 4;
if ( xoffset < 0 )
xoffset=0;
xoffset = 0;
break;

View File

@ -273,13 +273,13 @@ void FListView::setGeometry (int x, int y, int w, int h, bool adjust)
if ( isNewFont() )
{
vbar->setGeometry (getWidth(), 2, 2, getHeight()-2);
hbar->setGeometry (1, getHeight(), getWidth()-2, 1);
vbar->setGeometry (getWidth(), 2, 2, getHeight() - 2);
hbar->setGeometry (1, getHeight(), getWidth() - 2, 1);
}
else
{
vbar->setGeometry (getWidth(), 2, 1, getHeight()-2);
hbar->setGeometry (2, getHeight(), getWidth()-2, 1);
vbar->setGeometry (getWidth(), 2, 1, getHeight() - 2);
hbar->setGeometry (2, getHeight(), getWidth() - 2, 1);
}
}
@ -403,7 +403,7 @@ void FListView::insert ( const std::vector<long>& cols
if ( ! cols.empty() )
{
for (uInt i=0; i < cols.size(); i++)
for (uInt i = 0; i < cols.size(); i++)
str_cols.push_back (FString().setNumber(cols[i]));
}
@ -437,7 +437,7 @@ void FListView::onKeyPress (FKeyEvent* ev)
current--;
if ( current < 1 )
current=1;
current = 1;
if ( current <= yoffset )
yoffset--;
@ -482,14 +482,14 @@ void FListView::onKeyPress (FKeyEvent* ev)
current -= getClientHeight() - 1;
if ( current < 1 )
current=1;
current = 1;
if ( current <= yoffset )
{
yoffset -= getClientHeight() - 1;
if ( yoffset < 0 )
yoffset=0;
yoffset = 0;
}
ev->accept();
@ -776,13 +776,13 @@ void FListView::onTimer (FTimerEvent*)
current -= scroll_distance;
if ( current < 1 )
current=1;
current = 1;
if ( current <= yoffset )
yoffset -= scroll_distance;
if ( yoffset < 0 )
yoffset=0;
yoffset = 0;
break;
case fc::scrollDown:
@ -854,7 +854,7 @@ void FListView::onWheel (FWheelEvent* ev)
if ( yoffset < 0 )
{
current -= 4+yoffset;
current -= 4 + yoffset;
yoffset=0;
}
else
@ -902,6 +902,7 @@ void FListView::onWheel (FWheelEvent* ev)
updateTerminal();
flush_out();
}
//----------------------------------------------------------------------
void FListView::onFocusIn (FFocusEvent*)
{
@ -1067,7 +1068,7 @@ void FListView::draw()
{
setColor();
for (int y=2; y < getHeight(); y++)
for (int y = 2; y < getHeight(); y++)
{
setPrintPos (getWidth(),y);
print (' '); // clear right side of the scrollbar
@ -1203,7 +1204,7 @@ void FListView::drawList()
iter = index2iterator(int(start) + yoffset);
for (uInt y=start; y < end; y++)
for (uInt y = start; y < end; y++)
{
bool isCurrentLine = bool(y + uInt(yoffset) + 1 == uInt(current));
setPrintPos (2, 2 + int(y));
@ -1244,14 +1245,14 @@ void FListView::drawList()
// print columns
if ( ! (*iter)->column_line.empty() )
{
for (uInt i=0; i < (*iter)->column_line.size(); i++)
for (uInt i = 0; i < (*iter)->column_line.size(); i++)
{
static const int leading_space = 1;
static const int ellipsis_length = 2;
FString text = (*iter)->column_line[i];
int width = header[i].width;
uInt txt_length = text.getLength();
fc::text_alignment align = getColumnAlignment(int(i+1));
fc::text_alignment align = getColumnAlignment(int(i + 1));
uInt align_offset = getAlignOffset (align, txt_length, uInt(width));
if ( align_offset > 0 )
@ -1282,7 +1283,7 @@ void FListView::drawList()
uInt len = line.getLength();
uInt i;
for (i=0; i < len; i++)
for (i = 0; i < len; i++)
print (element_str[i]);
for (; i < uInt(getWidth() - nf_offset - 2); i++)
@ -1505,7 +1506,7 @@ void FListView::cb_HBarChange (FWidget*, data_ptr)
xoffset -= 4;
if ( xoffset < 0 )
xoffset=0;
xoffset = 0;
break;

View File

@ -909,7 +909,7 @@ void FMenu::adjustItems()
int FMenu::adjustX (int x_pos)
{
// Is menu outside on the right of the screen?
if ( x_pos+int(max_item_width) >= getColumnNumber()-1 )
if ( x_pos + int(max_item_width) >= getColumnNumber() - 1 )
{
x_pos = getColumnNumber() - int(max_item_width + 1);
// Menu to large for the screen
@ -1204,9 +1204,9 @@ int FMenu::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length)
int hotkeypos = -1;
wchar_t* txt = src;
for (uInt i=0; i < length; i++)
for (uInt i = 0; i < length; i++)
{
if ( (i < length) && (txt[i] == L'&') && (hotkeypos == -1) )
if ( i < length && txt[i] == L'&' && hotkeypos == -1 )
{
hotkeypos = int(i);
i++;
@ -1346,7 +1346,7 @@ void FMenu::drawItems()
try
{
item_text = new wchar_t[txt_length+1]();
item_text = new wchar_t[txt_length + 1]();
}
catch (const std::bad_alloc& ex)
{
@ -1385,7 +1385,7 @@ void FMenu::drawItems()
to_char--;
}
for (int z=0; z < to_char; z++)
for (int z = 0; z < to_char; z++)
{
if ( ! std::iswprint(wint_t(item_text[z])) )
{
@ -1444,7 +1444,7 @@ void FMenu::drawItems()
if ( is_selected )
{
for (uInt i=uInt(to_char+c); i < max_item_width - 1; i++)
for (uInt i = uInt(to_char + c); i < max_item_width - 1; i++)
print (' ');
}
@ -1471,14 +1471,14 @@ inline void FMenu::drawSeparator(int y)
if ( isNewFont() )
{
print (fc::NF_border_line_vertical_right);
FString line(getWidth()-2, wchar_t(fc::BoxDrawingsHorizontal));
FString line(getWidth() - 2, wchar_t(fc::BoxDrawingsHorizontal));
print (line);
print (fc::NF_rev_border_line_vertical_left);
}
else
{
print (fc::BoxDrawingsVerticalAndRight);
FString line(getWidth()-2, wchar_t(fc::BoxDrawingsHorizontal));
FString line(getWidth() - 2, wchar_t(fc::BoxDrawingsHorizontal));
print (line);
print (fc::BoxDrawingsVerticalAndLeft);
}

View File

@ -45,7 +45,7 @@ void FMenuBar::hide()
try
{
blank = new char[screenWidth+1];
blank = new char[screenWidth + 1];
}
catch (const std::bad_alloc& ex)
{
@ -729,9 +729,9 @@ int FMenuBar::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length)
int hotkeypos = -1;
wchar_t* txt = src;
for (uInt i=0; i < length; i++)
for (uInt i = 0; i < length; i++)
{
if ( (i < length) && (txt[i] == L'&') && (hotkeypos == -1) )
if ( i < length && txt[i] == L'&' && hotkeypos == -1 )
{
hotkeypos = int(i);
i++;
@ -819,7 +819,7 @@ void FMenuBar::drawItems()
try
{
item_text = new wchar_t[txt_length+1]();
item_text = new wchar_t[txt_length + 1]();
}
catch (const std::bad_alloc& ex)
{
@ -830,10 +830,10 @@ void FMenuBar::drawItems()
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(item_text);
if ( x-1 <= screenWidth )
if ( x - 1 <= screenWidth )
to_char = int(txt_length);
else
to_char = int(txt_length) - (screenWidth-x-1);
to_char = int(txt_length) - (screenWidth - x - 1);
hotkeypos = getHotkeyPos (src, dest, txt_length);
@ -845,9 +845,9 @@ void FMenuBar::drawItems()
x += int(txt_length);
for (int z=0; z < to_char; z++)
for (int z = 0; z < to_char; z++)
{
if ( startpos > screenWidth-z )
if ( startpos > screenWidth - z )
break;
if ( ! std::iswprint(wint_t(item_text[z])) )
@ -878,14 +878,14 @@ void FMenuBar::drawItems()
print (item_text[z]);
}
if ( x > screenWidth+1 )
if ( x > screenWidth + 1 )
{
if ( startpos < screenWidth )
{
setPrintPos (screenWidth - 1, 1);
print ("..");
}
else if ( startpos-1 <= screenWidth )
else if ( startpos - 1 <= screenWidth )
{
setPrintPos (screenWidth, 1);
print (' ');

View File

@ -688,7 +688,7 @@ void FMenuItem::init (FWidget* parent)
if ( hotkey )
text_length--;
setGeometry (1,1,int(text_length+2),1, false);
setGeometry (1, 1, int(text_length + 2), 1, false);
if ( parent )
{
@ -741,16 +741,16 @@ uChar FMenuItem::hotKey()
length = text.getLength();
for (uInt i=0; i < length; i++)
for (uInt i = 0; i < length; i++)
{
try
{
if ( (i+1 < length) && (text[i] == '&') )
if ( i + 1 < length && text[i] == '&' )
return uChar(text[++i]);
}
catch (const std::out_of_range&)
{
return 0;;
return 0;
}
}

View File

@ -90,7 +90,7 @@ FMessageBox::FMessageBox ( const FString& caption
//----------------------------------------------------------------------
FMessageBox::~FMessageBox() // destructor
{
for (uInt n=0; n < num_buttons; n++)
for (uInt n = 0; n < num_buttons; n++)
delete button[n];
}
@ -105,7 +105,7 @@ FMessageBox& FMessageBox::operator = (const FMessageBox& mbox)
}
else
{
for (uInt n=0; n < num_buttons; n++)
for (uInt n = 0; n < num_buttons; n++)
delete button[n];
if ( mbox.getParentWidget() )
@ -136,8 +136,8 @@ void FMessageBox::setHeadline (const FString& headline)
headline_text = headline;
setHeight(getHeight() + 2, true);
for (uInt n=0; n < num_buttons; n++)
button[n]->setY(getHeight()-4, false);
for (uInt n = 0; n < num_buttons; n++)
button[n]->setY (getHeight() - 4, false);
uInt len = headline_text.getLength();
@ -150,13 +150,13 @@ void FMessageBox::setText (const FString& txt)
{
text = txt;
calculateDimensions();
button[0]->setY(getHeight()-4, false);
button[0]->setY (getHeight() - 4, false);
if ( button_digit[1] != 0 )
button[1]->setY(getHeight()-4, false);
button[1]->setY (getHeight() - 4, false);
if ( button_digit[2] != 0 )
button[2]->setY(getHeight()-4, false);
button[2]->setY (getHeight() - 4, false);
adjustButtons();
}
@ -272,8 +272,8 @@ void FMessageBox::adjustSize()
max_height = 24;
}
X = 1 + int((max_width-getWidth())/2);
Y = 1 + int((max_height-getHeight())/3);
X = 1 + int((max_width - getWidth()) / 2);
Y = 1 + int((max_height - getHeight()) / 3);
setPos(X, Y, false);
FDialog::adjustSize();
}
@ -315,7 +315,7 @@ void FMessageBox::init (int button0, int button1, int button2)
{
button[0] = new FButton (this);
button[0]->setText(button_text[button0]);
button[0]->setPos(3, getHeight()-4, false);
button[0]->setPos(3, getHeight() - 4, false);
button[0]->setWidth(1, false);
button[0]->setHeight(1, false);
button[0]->setFocus();
@ -324,7 +324,7 @@ void FMessageBox::init (int button0, int button1, int button2)
{
button[1] = new FButton(this);
button[1]->setText(button_text[button1]);
button[1]->setPos(17, getHeight()-4, false);
button[1]->setPos(17, getHeight() - 4, false);
button[1]->setWidth(0, false);
button[1]->setHeight(1, false);
}
@ -333,7 +333,7 @@ void FMessageBox::init (int button0, int button1, int button2)
{
button[2] = new FButton(this);
button[2]->setText(button_text[button2]);
button[2]->setPos(32, getHeight()-4, false);
button[2]->setPos(32, getHeight() - 4, false);
button[2]->setWidth(0, false);
button[2]->setHeight(1, false);
}
@ -394,7 +394,7 @@ void FMessageBox::calculateDimensions()
if ( ! headline_text.isNull() )
headline_height = 2;
for (uInt i=0; i < text_num_lines; i++)
for (uInt i = 0; i < text_num_lines; i++)
{
uInt len = text_components[i].getLength();
@ -410,8 +410,8 @@ void FMessageBox::calculateDimensions()
if ( parent_widget )
{
x = 1 + int((parent_widget->getWidth()-w)/2);
y = 1 + int((parent_widget->getHeight()-h)/3);
x = 1 + int((parent_widget->getWidth() - w) / 2);
y = 1 + int((parent_widget->getHeight() - h) / 3);
}
else
x = y = 1;
@ -446,7 +446,7 @@ void FMessageBox::draw()
setColor();
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();
@ -466,7 +466,7 @@ void FMessageBox::resizeButtons()
{
uInt len[3], max_size;
for (uInt n=0; n < num_buttons; n++)
for (uInt n = 0; n < num_buttons; n++)
{
len[n] = button[n]->getText().getLength();
@ -488,7 +488,7 @@ void FMessageBox::resizeButtons()
if ( max_size < 7 )
max_size = 7;
for (uInt n=0; n < num_buttons; n++)
for (uInt n = 0; n < num_buttons; n++)
button[n]->setWidth(int(max_size + 3), false);
}
@ -498,26 +498,26 @@ void FMessageBox::adjustButtons()
static const int gap = 4;
int btn_width = 0;
for (uInt n=0; n < num_buttons; n++)
for (uInt n = 0; n < num_buttons; n++)
{
if ( n == num_buttons-1 )
if ( n == num_buttons - 1 )
btn_width += button[n]->getWidth();
else
btn_width += button[n]->getWidth() + gap;
}
if ( btn_width >= getWidth()-4 )
if ( btn_width >= getWidth() - 4 )
{
int max_width;
FWidget* root_widget = getRootWidget();
setWidth(btn_width + 5);
max_width = ( root_widget ) ? root_widget->getClientWidth() : 80;
setX (int((max_width-getWidth()) / 2));
setX (int((max_width - getWidth()) / 2));
}
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 (uInt n = 0; n < num_buttons; n++)
{
if ( n == 0 )
button[n]->setX(btn_x);

View File

@ -1236,7 +1236,7 @@ inline void FOptiAttr::prevent_no_color_video_attributes (char_data*& attr)
if ( hasColor(attr) && attr_without_color > 0 )
{
for (int bit=1; bit < no_mode; bit <<= 1)
for (int bit = 1; bit < no_mode; bit <<= 1)
{
switch ( bit & attr_without_color )
{

View File

@ -533,7 +533,7 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
// Method 4: home-down + local movement
if ( F_cursor_to_ll.cap )
{
new_time = relativeMove (null_ptr, 0, screen_height-1, xnew, ynew);
new_time = relativeMove (null_ptr, 0, screen_height - 1, xnew, ynew);
if ( new_time < LONG_DURATION
&& F_cursor_to_ll.duration + new_time < move_time )
@ -549,7 +549,7 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
&& yold > 0
&& F_cursor_left.cap )
{
new_time = relativeMove (null_ptr, screen_width-1, yold-1, xnew, ynew);
new_time = relativeMove (null_ptr, screen_width - 1, yold - 1, xnew, ynew);
if ( new_time < LONG_DURATION
&& F_carriage_return.cap
@ -588,7 +588,7 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
case 4:
std::strncpy (move_ptr, F_cursor_to_ll.cap, sizeof(move_buf) - 1);
move_ptr += F_cursor_to_ll.length;
relativeMove (move_ptr, 0, screen_height-1, xnew, ynew);
relativeMove (move_ptr, 0, screen_height - 1, xnew, ynew);
break;
case 5:
@ -603,7 +603,7 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
, F_cursor_left.cap
, sizeof(move_buf) - std::strlen(move_ptr) - 1 );
move_ptr += std::strlen(move_buf);
relativeMove (move_ptr, screen_width-1, yold-1, xnew, ynew);
relativeMove (move_ptr, screen_width - 1, yold - 1, xnew, ynew);
break;
default:
@ -620,24 +620,24 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
//----------------------------------------------------------------------
void FOptiMove::printDurations()
{
std::printf (" speed: %d baud\r\n", baudrate);
std::printf (" char_duration: %d ms\r\n", char_duration);
std::printf (" cursor_home: %d ms\r\n", F_cursor_home.duration);
std::printf (" cursor_to_ll: %d ms\r\n", F_cursor_to_ll.duration);
std::printf (" carriage_return: %d ms\r\n", F_carriage_return.duration);
std::printf (" tab: %d ms\r\n", F_tab.duration);
std::printf (" back_tab: %d ms\r\n", F_back_tab.duration);
std::printf (" cursor_up: %d ms\r\n", F_cursor_up.duration);
std::printf (" cursor_down: %d ms\r\n", F_cursor_down.duration);
std::printf (" cursor_left: %d ms\r\n", F_cursor_left.duration);
std::printf (" cursor_right: %d ms\r\n", F_cursor_right.duration);
std::printf (" cursor_address: %d ms\r\n", F_cursor_address.duration);
std::printf (" column_address: %d ms\r\n", F_column_address.duration);
std::printf (" row_address: %d ms\r\n", F_row_address.duration);
std::printf (" parm_up_cursor: %d ms\r\n", F_parm_up_cursor.duration);
std::printf (" parm_down_cursor: %d ms\r\n", F_parm_down_cursor.duration);
std::printf (" parm_left_cursor: %d ms\r\n", F_parm_left_cursor.duration);
std::printf ("parm_right_cursor: %d ms\r\n", F_parm_right_cursor.duration);
std::cout << " speed: " << baudrate << " baud\r\n";
std::cout << " char_duration: " << char_duration << " ms\r\n";
std::cout << " cursor_home: " << F_cursor_home.duration << " ms\r\n";
std::cout << " cursor_to_ll: " << F_cursor_to_ll.duration << " ms\r\n";
std::cout << " carriage_return: " << F_carriage_return.duration << " ms\r\n";
std::cout << " tab: " << F_tab.duration << " ms\r\n";
std::cout << " back_tab: " << F_back_tab.duration << " ms\r\n";
std::cout << " cursor_up: " << F_cursor_up.duration << " ms\r\n";
std::cout << " cursor_down: " << F_cursor_down.duration << " ms\r\n";
std::cout << " cursor_left: " << F_cursor_left.duration << " ms\r\n";
std::cout << " cursor_right: " << F_cursor_right.duration << " ms\r\n";
std::cout << " cursor_address: " << F_cursor_address.duration << " ms\r\n";
std::cout << " column_address: " << F_column_address.duration << " ms\r\n";
std::cout << " row_address: " << F_row_address.duration << " ms\r\n";
std::cout << " parm_up_cursor: " << F_parm_up_cursor.duration << " ms\r\n";
std::cout << " parm_down_cursor: " << F_parm_down_cursor.duration << " ms\r\n";
std::cout << " parm_left_cursor: " << F_parm_left_cursor.duration << " ms\r\n";
std::cout << "parm_right_cursor: " << F_parm_right_cursor.duration << " ms\r\n";
}
@ -671,7 +671,7 @@ int FOptiMove::capDuration (char*& cap, int affcnt)
const char* p;
float ms = 0;
for (p=cap; *p; p++)
for (p = cap; *p; p++)
{
// check for delay with padding character
if ( p[0] == '$' && p[1] == '<' && std::strchr(p, '>') )
@ -901,7 +901,7 @@ int FOptiMove::relativeMove ( char*& move
while ( true )
{
int tab_pos = ( pos > 0 ) ? ((pos-1)/tabstop)*tabstop : -1;
int tab_pos = ( pos > 0 ) ? ((pos - 1) / tabstop) * tabstop : -1;
if ( tab_pos < to_x )
break;
@ -949,5 +949,5 @@ inline bool FOptiMove::isWideMove ( int xold, int yold
{
return bool ( (xnew > MOVE_LIMIT)
&& (xnew < screen_width - 1 - MOVE_LIMIT)
&& (std::abs(xnew-xold) + std::abs(ynew-yold) > MOVE_LIMIT) );
&& (std::abs(xnew - xold) + std::abs(ynew - yold) > MOVE_LIMIT) );
}

View File

@ -22,6 +22,7 @@
#include <cstdio> // need for printf
#include <cstdlib>
#include <cstring>
#include <iostream>
//----------------------------------------------------------------------

View File

@ -104,7 +104,7 @@ void FProgressbar::hide()
try
{
blank = new char[size+1];
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
@ -115,7 +115,7 @@ void FProgressbar::hide()
std::memset(blank, ' ', uLong(size));
blank[size] = '\0';
for (int y=0; y < getHeight()+s; y++)
for (int y = 0; y < getHeight() + s; y++)
{
setPrintPos (1, 1 + y);
print (blank);

View File

@ -24,7 +24,7 @@ FRect::~FRect() // destructor
//----------------------------------------------------------------------
bool FRect::isNull() const
{
return X2 == X1-1 && Y2 == Y1-1;
return X2 == X1 - 1 && Y2 == Y1 - 1;
}
//----------------------------------------------------------------------
@ -111,7 +111,7 @@ void FRect::setSize (int w, int h)
//----------------------------------------------------------------------
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, r.X2 - r.X1 + 1, r.Y2 - r.Y1 + 1);
}
//----------------------------------------------------------------------
@ -119,8 +119,8 @@ void FRect::setRect (int x, int y, int width, int height)
{
X1 = short(x);
Y1 = short(y);
X2 = short(x+width-1);
Y2 = short(y+height-1);
X2 = short(x + width - 1);
Y2 = short(y + height - 1);
}
//----------------------------------------------------------------------

View File

@ -247,7 +247,7 @@ void FScrollbar::drawButtons()
{
print (fc::NF_rev_left_arrow1);
print (fc::NF_rev_left_arrow2);
setPrintPos (length-1, 1);
setPrintPos (length - 1, 1);
print (fc::NF_rev_right_arrow1);
print (fc::NF_rev_right_arrow2);
}
@ -289,7 +289,7 @@ void FScrollbar::drawBar()
{
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
for (z=1; z <= slider_pos; z++)
for (z = 1; z <= slider_pos; z++)
{
setPrintPos (1, 1 + z);
@ -307,7 +307,7 @@ void FScrollbar::drawBar()
if ( isMonochron() )
setReverse(false);
for (z=1; z <= slider_length; z++)
for (z = 1; z <= slider_length; z++)
{
setPrintPos (1, 1 + slider_pos + z);
@ -322,7 +322,7 @@ void FScrollbar::drawBar()
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
for (z=slider_pos+slider_length+1; z <= bar_length; z++)
for (z = slider_pos + slider_length + 1; z <= bar_length; z++)
{
setPrintPos (1, 1 + z);
@ -416,19 +416,22 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
{
if ( bar_orientation == fc::vertical )
{
if ( mouse_y > slider_pos+1 && mouse_y <= slider_pos+slider_length+1 )
if ( mouse_y > slider_pos + 1
&& mouse_y <= slider_pos + slider_length + 1 )
slider_click_pos = mouse_y; // on slider
}
else // horizontal
{
if ( isNewFont() )
{
if ( mouse_x > slider_pos+2 && mouse_x <= slider_pos+slider_length+2 )
if ( mouse_x > slider_pos + 2
&& mouse_x <= slider_pos + slider_length + 2 )
slider_click_pos = mouse_x; // on slider
}
else
{
if ( mouse_x > slider_pos+1 && mouse_x <= slider_pos+slider_length+1 )
if ( mouse_x > slider_pos + 1
&& mouse_x <= slider_pos + slider_length + 1 )
slider_click_pos = mouse_x; // on slider
}
}
@ -576,11 +579,11 @@ void FScrollbar::onTimer (FTimerEvent*)
if ( ( scroll_type == FScrollbar::scrollPageBackward
&& slider_pos < slider_click_stop_pos )
|| ( scroll_type == FScrollbar::scrollPageForward
&& slider_pos+slider_length > slider_click_stop_pos ) )
&& slider_pos + slider_length > slider_click_stop_pos ) )
{
// Scroll to the end
if ( scroll_type == FScrollbar::scrollPageForward
&& slider_pos+slider_length > slider_click_stop_pos )
&& slider_pos + slider_length > slider_click_stop_pos )
{
setValue(max);
processScroll();
@ -625,11 +628,11 @@ FScrollbar::sType FScrollbar::getClickedScrollType (int x, int y)
{
stype = FScrollbar::scrollStepBackward; // decrement button
}
else if ( y >1 && y <= slider_pos+1 )
else if ( y > 1 && y <= slider_pos + 1 )
{
stype = FScrollbar::scrollPageBackward; // before slider
}
else if ( y > slider_pos+slider_length+1 && y < getHeight() )
else if ( y > slider_pos + slider_length + 1 && y < getHeight() )
{
stype = FScrollbar::scrollPageForward; // after slider
}
@ -648,15 +651,15 @@ FScrollbar::sType FScrollbar::getClickedScrollType (int x, int y)
{
stype = FScrollbar::scrollStepBackward; // decrement button
}
else if ( x >2 && x <= slider_pos+2 )
else if ( x > 2 && x <= slider_pos + 2 )
{
stype = FScrollbar::scrollPageBackward; // before slider
}
else if ( x > slider_pos+slider_length+2 && x < getWidth()-1 )
else if ( x > slider_pos + slider_length + 2 && x < getWidth() - 1 )
{
stype = FScrollbar::scrollPageForward; // after slider
}
else if ( x == getWidth()-1 || x == getWidth() )
else if ( x == getWidth() - 1 || x == getWidth() )
{
stype = FScrollbar::scrollStepForward; // increment button
}
@ -669,11 +672,11 @@ FScrollbar::sType FScrollbar::getClickedScrollType (int x, int y)
{
stype = FScrollbar::scrollStepBackward; // decrement button
}
else if ( x >1 && x <= slider_pos+1 )
else if ( x > 1 && x <= slider_pos + 1 )
{
stype = FScrollbar::scrollPageBackward; // before slider
}
else if ( x > slider_pos+slider_length+1 && x < getWidth() )
else if ( x > slider_pos + slider_length + 1 && x < getWidth() )
{
stype = FScrollbar::scrollPageForward; // after slider
}

View File

@ -710,21 +710,21 @@ void FScrollView::copy2area()
y_end = getViewportHeight();
x_end = getViewportWidth();
for (int y=0; y < y_end; y++) // line loop
for (int y = 0; y < y_end; y++) // line loop
{
char_data* vc; // viewport character
char_data* ac; // area character
int v_line_len = viewport->width;
int a_line_len = print_area->width + print_area->right_shadow;
vc = &viewport->text[(dy+y) * v_line_len + dx];
ac = &print_area->text[(ay+y) * a_line_len + ax];
vc = &viewport->text[(dy + y) * v_line_len + dx];
ac = &print_area->text[(ay + y) * a_line_len + ax];
std::memcpy (ac, vc, sizeof(char_data) * unsigned(x_end));
if ( short(print_area->changes[ay+y].xmin) > ax )
print_area->changes[ay+y].xmin = uInt(ax);
if ( short(print_area->changes[ay + y].xmin) > ax )
print_area->changes[ay + y].xmin = uInt(ax);
if ( short(print_area->changes[ay+y].xmax) < ax+x_end-1 )
print_area->changes[ay+y].xmax = uInt(ax+x_end-1);
if ( short(print_area->changes[ay + y].xmax) < ax + x_end - 1 )
print_area->changes[ay + y].xmax = uInt(ax + x_end - 1);
}
setViewportCursor();
@ -747,10 +747,10 @@ inline FPoint FScrollView::getViewportCursorPos()
- viewport_geometry.getX();
int y = widget_offsetY + viewport->input_cursor_y
- viewport_geometry.getY();
return FPoint(x,y);
return FPoint (x, y);
}
else
return FPoint(-1,-1);
return FPoint (-1, -1);
}
//----------------------------------------------------------------------
@ -827,13 +827,13 @@ void FScrollView::calculateScrollbarPos()
if ( isNewFont() )
{
vbar->setGeometry (width, 2, 2, height-2);
hbar->setGeometry (1, height, width-2, 1);
vbar->setGeometry (width, 2, 2, height - 2);
hbar->setGeometry (1, height, width - 2, 1);
}
else
{
vbar->setGeometry (width, 2, 1, height-2);
hbar->setGeometry (2, height, width-2, 1);
vbar->setGeometry (width, 2, 1, height - 2);
hbar->setGeometry (2, height, width - 2, 1);
}
vbar->resize();

View File

@ -186,7 +186,7 @@ void FStatusBar::hide()
try
{
blank = new char[screenWidth+1];
blank = new char[screenWidth + 1];
}
catch (const std::bad_alloc& ex)
{
@ -220,8 +220,8 @@ void FStatusBar::drawMessage()
if ( hasKeys )
{
std::vector<FStatusKey*>::const_iterator iter = key_list.end();
isLastActiveFocus = bool ( (*(iter-1))->isActivated()
|| (*(iter-1))->hasMouseFocus() );
isLastActiveFocus = bool ( (*(iter - 1))->isActivated()
|| (*(iter - 1))->hasMouseFocus() );
}
else
isLastActiveFocus = false;
@ -235,7 +235,7 @@ void FStatusBar::drawMessage()
if ( isMonochron() )
setReverse(true);
if ( x+space_offset+3 < termWidth )
if ( x + space_offset + 3 < termWidth )
{
if ( text )
{
@ -255,17 +255,17 @@ void FStatusBar::drawMessage()
int msg_length = int(getMessage().getLength());
x += msg_length;
if ( x-1 <= termWidth )
if ( x - 1 <= termWidth )
print (getMessage());
else
{
print ( getMessage().left(uInt(msg_length+termWidth-x-1)) );
print ( getMessage().left(uInt(msg_length + termWidth - x - 1)) );
print ("..");
}
}
}
for (int i=x; i <= termWidth; i++)
for (int i = x; i <= termWidth; i++)
print (' ');
if ( isMonochron() )
@ -317,7 +317,7 @@ void FStatusBar::remove (int pos)
if ( int(getCount()) < pos )
return;
key_list.erase (key_list.begin()+pos-1);
key_list.erase (key_list.begin() + pos - 1);
}
//----------------------------------------------------------------------
@ -461,7 +461,7 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
{
std::vector<FStatusKey*>::const_iterator iter, end;
bool focus_changed = false;
int X=1;
int X = 1;
iter = key_list.begin();
end = key_list.end();
@ -583,7 +583,7 @@ void FStatusBar::drawKeys()
{
int kname_len = int(getKeyName((*iter)->getKey()).getLength());
if ( x+kname_len+2 < screenWidth )
if ( x + kname_len + 2 < screenWidth )
{
if ( (*iter)->isActivated() || (*iter)->hasMouseFocus() )
{
@ -612,7 +612,7 @@ void FStatusBar::drawKeys()
else
{
print ( (*iter)->getText()
.left(uInt(txt_length+screenWidth-x-1)) );
.left(uInt(txt_length + screenWidth - x - 1)) );
print ("..");
}
@ -635,18 +635,18 @@ void FStatusBar::drawKeys()
txt_length = int((*iter)->getText().getLength());
x += txt_length;
if ( x-1 <= screenWidth )
if ( x - 1 <= screenWidth )
print ((*iter)->getText());
else
{
print ( (*iter)->getText()
.left(uInt(txt_length+screenWidth-x-1)) );
.left(uInt(txt_length + screenWidth - x - 1)) );
print ("..");
}
if ( iter+1 != key_list.end()
&& ( (*(iter+1))->isActivated() || (*(iter+1))->hasMouseFocus() )
&& x + int(getKeyName((*(iter+1))->getKey()).getLength()) + 3
if ( iter + 1 != key_list.end()
&& ( (*(iter + 1))->isActivated() || (*(iter + 1))->hasMouseFocus() )
&& x + int(getKeyName((*(iter + 1))->getKey()).getLength()) + 3
< screenWidth )
{
// next element is active
@ -666,7 +666,7 @@ void FStatusBar::drawKeys()
if ( isMonochron() )
setReverse(true);
}
else if ( iter+1 != key_list.end() && x < screenWidth )
else if ( iter + 1 != key_list.end() && x < screenWidth )
{
// not the last element
setColor (wc.statusbar_separator_fg, wc.statusbar_bg);

View File

@ -530,7 +530,7 @@ FString& FString::sprintf (const char* format, ...)
{
try
{
buffer = new char[len+1]();
buffer = new char[len + 1]();
}
catch (const std::bad_alloc& ex)
{
@ -539,7 +539,7 @@ FString& FString::sprintf (const char* format, ...)
}
va_start (args, format);
vsnprintf (buffer, uLong(len+1), format, args);
vsnprintf (buffer, uLong(len + 1), format, args);
va_end (args);
}
@ -853,7 +853,7 @@ FString FString::rtrim() const
if ( last == p && std::iswspace(wint_t(*last)) )
s.clear();
else
*(last+1) = '\0';
*(last + 1) = '\0';
return s;
}
@ -893,7 +893,7 @@ FString FString::left (uInt len) const
p = s.string;
s.length = len;
*(p+len) = '\0';
*(p + len) = '\0';
return s;
}
@ -920,7 +920,7 @@ FString FString::right (uInt len) const
return s;
p = s.string;
p += (length-len);
p += (length - len);
return FString(p);
}
@ -952,15 +952,15 @@ FString FString::mid (uInt pos, uInt len) const
if ( pos == 0 )
pos = 1;
if ( pos <= length && pos+len > length )
if ( pos <= length && pos + len > length )
len = length - pos + 1;
if ( pos > length || pos+len-1 > length || len == 0 )
if ( pos > length || pos + len - 1 > length || len == 0 )
return FString(L"");
p = s.string;
first = p + pos - 1;
*(first+len) = '\0';
*(first + len) = '\0';
return FString(first);
}
@ -2033,7 +2033,7 @@ FString FString::expandTabs (int tabstop) const
tab_split = instr.split("\t");
last = tab_split.size();
for (uInt i=0; i < last; i++)
for (uInt i = 0; i < last; i++)
{
uInt len = tab_split[i].getLength();
uInt tab_len = uInt(tabstop);
@ -2053,8 +2053,8 @@ FString FString::removeDel() const
if ( p )
{
uInt i=0;
uInt d=0;
uInt i = 0;
uInt d = 0;
while ( *p )
{
@ -2093,7 +2093,7 @@ FString FString::removeBackspaces() const
if ( p )
{
uInt i=0;
uInt i = 0;
while ( *p )
{
@ -2138,7 +2138,7 @@ const FString& FString::overwrite (const wchar_t* s, uInt pos)
{
uInt len = uInt(std::wcslen(s));
if (length >= (pos+len) )
if (length >= (pos +len) )
{
std::wcsncpy (string + pos, s, len);
}
@ -2154,7 +2154,7 @@ const FString& FString::overwrite (const wchar_t* s, uInt pos)
//----------------------------------------------------------------------
const FString& FString::overwrite (const wchar_t c, uInt pos)
{
if ( length >= (pos+1) )
if ( length >= (pos + 1) )
{
string[pos] = c;
}
@ -2296,11 +2296,11 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t* s)
if ( (length + len + 1) <= bufsize )
{
// output string <= bufsize
for (x = length; x+1 > pos; x--) // shifting right side + '\0'
string[x+len] = string[x];
for (x = length; x + 1 > pos; x--) // shifting right side + '\0'
string[x + len] = string[x];
for (x=0; x < len; x++) // insert string
string[x+pos] = s[x];
for (x = 0; x < len; x++) // insert string
string[x + pos] = s[x];
length += len;
}
@ -2322,13 +2322,13 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t* s)
uInt y = 0;
for (x=0; x < pos; x++) // left side
for (x = 0; x < pos; x++) // left side
sptr[y++] = string[x];
for (x=0; x < len; x++) // insert string
for (x = 0 ; x < len; x++) // insert string
sptr[y++] = s[x];
for (x=pos; x < length+1; x++) // right side + '\0'
for (x = pos; x < length + 1; x++) // right side + '\0'
sptr[y++] = string[x];
length += len;
@ -2344,8 +2344,8 @@ inline void FString::_remove (uInt pos, uInt len)
if ( (bufsize - length - 1 + len) <= FWDBUFFER )
{
// shifting left side to pos
for (uInt i=pos; (i+len) < length+1; i++)
string[i] = string[i+len];
for (uInt i = pos; i + len < length + 1; i++)
string[i] = string[i + len];
length -= len;
}
@ -2366,10 +2366,10 @@ inline void FString::_remove (uInt pos, uInt len)
uInt x, y = 0;
for (x=0; x < pos; x++) // left side
for (x = 0; x < pos; x++) // left side
sptr[y++] = string[x];
for (x=pos+len; x < length+1; x++) // right side + '\0'
for (x = pos + len; x < length + 1; x++) // right side + '\0'
sptr[y++] = string[x];
delete[](string); // delete old string
@ -2493,7 +2493,7 @@ inline wchar_t* FString::c_to_wc_str (const char* s) const
}
if ( wclength == size )
dest[size-1] = '\0';
dest[size - 1] = '\0';
if ( wclength )
return dest;

View File

@ -189,7 +189,7 @@ int FTerm::getColumnNumber()
//----------------------------------------------------------------------
const FString FTerm::getKeyName (int keynum)
{
for (int i=0; FkeyName[i].string[0] != 0; i++)
for (int i = 0; FkeyName[i].string[0] != 0; i++)
if ( FkeyName[i].num && FkeyName[i].num == keynum )
return FString(FkeyName[i].string);
@ -450,17 +450,17 @@ int FTerm::parseKeyString ( char buffer[]
// SGR mouse tracking
if ( buffer[1] == '[' && buffer[2] == '<' && buf_len >= 9
&& (buffer[buf_len-1] == 'M' || buffer[buf_len-1] == 'm') )
&& (buffer[buf_len - 1] == 'M' || buffer[buf_len - 1] == 'm') )
return fc::Fkey_extended_mouse;
// urxvt mouse tracking
if ( buffer[1] == '[' && buffer[2] >= '1' && buffer[2] <= '9'
&& buffer[3] >= '0' && buffer[3] <= '9' && buf_len >= 9
&& buffer[buf_len-1] == 'M' )
&& buffer[buf_len - 1] == 'M' )
return fc::Fkey_urxvt_mouse;
// look for termcap keys
for (int i=0; Fkey[i].tname[0] != 0; i++)
for (int i = 0; Fkey[i].tname[0] != 0; i++)
{
char* k = Fkey[i].string;
len = (k) ? int(std::strlen(k)) : 0;
@ -470,10 +470,10 @@ int FTerm::parseKeyString ( char buffer[]
n = len;
for (; n < buf_size; n++) // Remove founded entry
buffer[n-len] = buffer[n];
buffer[n - len] = buffer[n];
for (; n-len < len; n++) // Fill rest with '\0'
buffer[n-len] = '\0';
for (; n - len < len; n++) // Fill rest with '\0'
buffer[n - len] = '\0';
input_data_pending = bool(buffer[0] != '\0');
return Fkey[i].num;
@ -481,7 +481,7 @@ int FTerm::parseKeyString ( char buffer[]
}
// look for meta keys
for (int i=0; Fmetakey[i].string[0] != 0; i++)
for (int i = 0; Fmetakey[i].string[0] != 0; i++)
{
char* kmeta = Fmetakey[i].string; // The string is never null
len = int(std::strlen(kmeta));
@ -498,10 +498,10 @@ int FTerm::parseKeyString ( char buffer[]
n = len;
for (; n < buf_size; n++) // Remove founded entry
buffer[n-len] = buffer[n];
buffer[n - len] = buffer[n];
for (; n-len < len; n++) // Fill rest with '\0'
buffer[n-len] = '\0';
for (; n - len < len; n++) // Fill rest with '\0'
buffer[n - len] = '\0';
input_data_pending = bool(buffer[0] != '\0');
return Fmetakey[i].num;
@ -527,7 +527,7 @@ int FTerm::parseKeyString ( char buffer[]
else if ((firstchar & 0xf8) == 0xf0)
len = 4;
for (n=0; n < len ; n++)
for (n = 0; n < len ; n++)
utf8char[n] = char(buffer[n] & 0xff);
key = UTF8decode(utf8char);
@ -538,9 +538,9 @@ int FTerm::parseKeyString ( char buffer[]
n = len;
for (; n < buf_size; n++) // remove the key from the buffer front
buffer[n-len] = buffer[n];
buffer[n - len] = buffer[n];
for (n=n-len; n < buf_size; n++) // fill the rest with '\0' bytes
for (n = n - len; n < buf_size; n++) // fill the rest with '\0' bytes
buffer[n] = '\0';
input_data_pending = bool(buffer[0] != '\0');
@ -896,7 +896,7 @@ const FString* FTerm::getXTermFont()
tv.tv_usec = 150000; // 150 ms
// read the terminal answer
if ( select (stdin_no+1, &ifds, 0, 0, &tv) > 0)
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0)
{
if ( std::scanf("\033]50;%[^\n]s", temp) == 1 )
{
@ -904,8 +904,8 @@ const FString* FTerm::getXTermFont()
std::size_t n = std::strlen(temp);
// BEL + '\0' = string terminator
if ( n >= 5 && temp[n-1] == BEL[0] && temp[n] == '\0' )
temp[n-1] = '\0';
if ( n >= 5 && temp[n - 1] == BEL[0] && temp[n] == '\0' )
temp[n - 1] = '\0';
try
{
@ -944,21 +944,21 @@ const FString* FTerm::getXTermTitle()
tv.tv_usec = 150000; // 150 ms
// read the terminal answer
if ( select (stdin_no+1, &ifds, 0, 0, &tv) > 0)
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0)
{
if ( std::scanf("\033]l%[^\n]s", temp) == 1 )
{
std::size_t n = std::strlen(temp);
// Esc + \ = OSC string terminator
if ( n >= 2 && temp[n-2] == ESC[0] && temp[n-1] == '\\' )
if ( n >= 2 && temp[n - 2] == ESC[0] && temp[n - 1] == '\\' )
{
FString* xtermtitle;
if ( n < 4 )
return 0;
temp[n-2] = '\0';
temp[n - 2] = '\0';
try
{
@ -1001,19 +1001,19 @@ const FString FTerm::getXTermColorName (int color)
tv.tv_usec = 150000; // 150 ms
// read the terminal answer
if ( select (stdin_no+1, &ifds, 0, 0, &tv) > 0)
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0)
{
if ( std::scanf("\033]4;%d;%[^\n]s", &color, temp) == 2 )
{
std::size_t n = std::strlen(temp);
// BEL + '\0' = string terminator
if ( n >= 6 && temp[n-1] == BEL[0] && temp[n] == '\0' )
temp[n-1] = '\0';
if ( n >= 6 && temp[n - 1] == BEL[0] && temp[n] == '\0' )
temp[n - 1] = '\0';
// Esc + \ = OSC string terminator (mintty)
if ( n >= 6 && temp[n-2] == ESC[0] && temp[n-1] == '\\' )
temp[n-2] = '\0';
if ( n >= 6 && temp[n - 2] == ESC[0] && temp[n - 1] == '\\' )
temp[n - 2] = '\0';
color_str = temp;
}
@ -1297,7 +1297,7 @@ void FTerm::resetColorMap()
{0x55, 0x55, 0xFF}, {0xFF, 0x55, 0xFF},
{0x55, 0xFF, 0xFF}, {0xFF, 0xFF, 0xFF}
};
for (int x=0; x<16; x++)
for (int x = 0; x < 16; x++)
{
color_map.d[x].red = CurrentColors[x].red;
color_map.d[x].green = CurrentColors[x].green;
@ -1504,8 +1504,8 @@ const FString FTerm::getAnswerbackMsg()
tv.tv_usec = 150000; // 150 ms
// read the answerback message
if ( select (stdin_no+1, &ifds, 0, 0, &tv) > 0)
if ( std::fgets (temp, sizeof(temp)-1, stdin) != 0 )
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0)
if ( std::fgets (temp, sizeof(temp) - 1, stdin) != 0 )
answerback = temp;
return answerback;
@ -1530,7 +1530,7 @@ const FString FTerm::getSecDA()
tv.tv_usec = 600000; // 600 ms
// read the answer
if ( select (stdin_no+1, &ifds, 0, 0, &tv) == 1 )
if ( select (stdin_no + 1, &ifds, 0, 0, &tv) == 1 )
if ( std::scanf("\033[>%d;%d;%dc", &a, &b, &c) == 3 )
sec_da_str.sprintf("\033[>%d;%d;%dc", a, b, c);
@ -1608,9 +1608,9 @@ int FTerm::putchar_UTF8 (register int c)
//----------------------------------------------------------------------
int FTerm::UTF8decode (const char utf8[])
{
register int ucs=0;
register int ucs = 0;
for (register int i=0; i < int(std::strlen(utf8)); ++i)
for (register int i = 0; i < int(std::strlen(utf8)); ++i)
{
register uChar ch = uChar(utf8[i]);
@ -1662,11 +1662,11 @@ void FTerm::initLinuxConsoleCharMap()
if ( screen_unicode_map.entry_ct != 0 )
{
for (int i=0; i <= lastCharItem; i++ )
for (int i = 0; i <= lastCharItem; i++ )
{
bool found = false;
for (uInt n=0; n < screen_unicode_map.entry_ct; n++)
for (uInt n = 0; n < screen_unicode_map.entry_ct; n++)
{
if ( character[i][fc::UTF8] == screen_unicode_map.entries[n].unicode )
{
@ -1711,7 +1711,7 @@ void FTerm::initFreeBSDConsoleCharMap()
if ( ! isFreeBSDConsole() )
return;
for (int i=0; i <= lastCharItem; i++ )
for (int i = 0; i <= lastCharItem; i++ )
if ( character[i][fc::PC] < 0x1c )
character[i][fc::PC] = character[i][fc::ASCII];
}
@ -1725,7 +1725,7 @@ void FTerm::initCygwinCharMap()
if ( ! cygwin_terminal )
return;
for (int i=0; i <= lastCharItem; i++ )
for (int i = 0; i <= lastCharItem; i++ )
{
if ( character[i][fc::UTF8] == fc::BlackUpPointingTriangle // ▲
|| character[i][fc::UTF8] == fc::BlackDownPointingTriangle // ▼
@ -1742,7 +1742,7 @@ void FTerm::initTeraTermCharMap()
if ( ! tera_terminal )
return;
for (int i=0; i <= lastCharItem; i++ )
for (int i = 0; i <= lastCharItem; i++ )
if ( character[i][fc::PC] < 0x20 )
character[i][fc::PC] = character[i][fc::ASCII];
}
@ -1763,7 +1763,7 @@ uInt FTerm::charEncode (uInt c)
//----------------------------------------------------------------------
uInt FTerm::charEncode (uInt c, fc::encoding enc)
{
for (uInt i=0; i <= uInt(lastCharItem); i++)
for (uInt i = 0; i <= uInt(lastCharItem); i++)
{
if ( character[i][0] == c )
{
@ -2117,7 +2117,7 @@ void FTerm::getSystemTermType()
char str[BUFSIZ];
// read and parse the file
while ( fgets(str, sizeof(str)-1, fp) != 0 )
while ( fgets(str, sizeof(str) - 1, fp) != 0 )
{
type = name = 0; // 0 == not found
p = str;
@ -2266,7 +2266,7 @@ int FTerm::setScreenFont ( uChar* fontdata, uInt count
return -1;
}
for (uInt i=0; i < count; i++)
for (uInt i = 0; i < count; i++)
std::memcpy ( const_cast<uChar*>(font.data + bytes_per_line*32*i)
, &fontdata[i * font.height]
, font.height);
@ -2715,7 +2715,7 @@ char* FTerm::parseSecDA (char*& current_termtype)
// remove the first 3 bytes ("\033[>")
FString temp = sec_da->right(sec_da->getLength() - 3);
// remove the last byte ("c")
temp.remove(temp.getLength()-1, 1);
temp.remove(temp.getLength() - 1, 1);
// split into components
std::vector<FString> sec_da_split = temp.split(';');
@ -2892,11 +2892,11 @@ void FTerm::init_alt_charset()
if ( tcap[fc::t_acs_chars].string )
{
for (int n=0; tcap[fc::t_acs_chars].string[n]; n += 2)
for (int n = 0; tcap[fc::t_acs_chars].string[n]; n += 2)
{
// insert the vt100 key/value pairs into a map
uChar p1 = uChar(tcap[fc::t_acs_chars].string[n]);
uChar p2 = uChar(tcap[fc::t_acs_chars].string[n+1]);
uChar p2 = uChar(tcap[fc::t_acs_chars].string[n + 1]);
(*vt100_alt_char)[p1] = p2;
}
}
@ -2908,7 +2908,7 @@ void FTerm::init_alt_charset()
};
// update array 'character' with discovered vt100 pairs
for (int n=0; n <= lastKeyItem; n++ )
for (int n = 0; n <= lastKeyItem; n++ )
{
uChar keyChar = uChar(vt100_key_to_utf8[n][vt100_key]);
uChar altChar = uChar((*vt100_alt_char)[ keyChar ]);
@ -3128,7 +3128,7 @@ void FTerm::init_termcaps()
// -------------------
// read termcap output strings
for (int i=0; tcap[i].tname[0] != 0; i++)
for (int i = 0; tcap[i].tname[0] != 0; i++)
tcap[i].string = tgetstr(tcap[i].tname, &buffer);
// set invisible cursor for cygwin terminal
@ -3405,7 +3405,7 @@ void FTerm::init_termcaps()
#endif
// read termcap key strings
for (int i=0; Fkey[i].tname[0] != 0; i++)
for (int i = 0; Fkey[i].tname[0] != 0; i++)
{
Fkey[i].string = tgetstr(Fkey[i].tname, &buffer);
@ -3442,7 +3442,7 @@ void FTerm::init_termcaps()
|| ( tcap[fc::t_cursor_up].string
&& (std::strcmp(tcap[fc::t_cursor_up].string, CSI "A") == 0) ) )
{
for (int i=0; Fkey[i].tname[0] != 0; i++)
for (int i = 0; Fkey[i].tname[0] != 0; i++)
{
if ( std::strncmp(Fkey[i].tname, "kux", 3) == 0 )
Fkey[i].string = const_cast<char*>(CSI "A"); // key up
@ -3839,7 +3839,7 @@ void FTerm::init()
if ( new_termtype )
{
setenv(const_cast<char*>("TERM"), new_termtype, 1);
std::strncpy (termtype, new_termtype, std::strlen(new_termtype)+1);
std::strncpy (termtype, new_termtype, std::strlen(new_termtype) + 1);
}
// Initializes variables for the current terminal
@ -4167,7 +4167,7 @@ uInt FTerm::cp437_to_unicode (uChar c)
{
register uInt ucs = uInt(c);
for (register uInt i=0; i <= lastCP437Item; i++)
for (register uInt i = 0; i <= lastCP437Item; i++)
{
if ( cp437_to_ucs[i][0] == c ) // found
{

View File

@ -54,7 +54,7 @@ int FTermBuffer::writef (const char* format, ...)
{
try
{
buffer = new char[len+1]();
buffer = new char[len + 1]();
}
catch (const std::bad_alloc& ex)
{
@ -63,7 +63,7 @@ int FTermBuffer::writef (const char* format, ...)
}
va_start (args, format);
vsnprintf (buffer, uLong(len+1), format, args);
vsnprintf (buffer, uLong(len + 1), format, args);
va_end (args);
}

View File

@ -45,20 +45,20 @@ const FString FTextView::getText() const
len = 0;
rows = getRows();
for (uInt i=0 ; i < rows; i++)
for (uInt i = 0 ; i < rows; i++)
len += data[i].getLength() + 1;
FString s(len + 1);
idx = 0;
for (uInt i=0 ; i < rows; i++)
for (uInt i = 0 ; i < rows; i++)
{
const wchar_t* p = data[i].wc_str();
if ( p )
{
while ( (s[idx++] = *p++) != 0 );
s[idx-1] = '\n';
s[idx - 1] = '\n';
}
else
{
@ -66,7 +66,7 @@ const FString FTextView::getText() const
}
}
s[idx-1] = 0;
s[idx - 1] = 0;
return s;
}
@ -81,13 +81,13 @@ void FTextView::setGeometry (int x, int y, int w, int h, bool adjust)
if ( isNewFont() )
{
vbar->setGeometry (width, 1, 2, height-1);
hbar->setGeometry (1, height, width-2, 1);
vbar->setGeometry (width, 1, 2, height - 1);
hbar->setGeometry (1, height, width - 2, 1);
}
else
{
vbar->setGeometry (width, 2, 1, height-2);
hbar->setGeometry (2, height, width-2, 1);
vbar->setGeometry (width, 2, 1, height - 2);
hbar->setGeometry (2, height, width - 2, 1);
}
vbar->resize();
@ -152,7 +152,7 @@ void FTextView::hide()
try
{
blank = new char[size+1];
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
@ -163,7 +163,7 @@ void FTextView::hide()
std::memset(blank, ' ', uLong(size));
blank[size] = '\0';
for (int y=0; y < getHeight(); y++)
for (int y = 0; y < getHeight(); y++)
{
setPrintPos (1, 1 + y);
print (blank);
@ -199,7 +199,7 @@ void FTextView::insert (const FString& str, int pos)
text_split = s.split("\r\n");
end = text_split.size();
for (uInt i=0; i < end; i++)
for (uInt i = 0; i < end; i++)
{
uInt len;
text_split[i] = text_split[i].removeBackspaces()
@ -253,7 +253,7 @@ void FTextView::replaceRange (const FString& str, int start, int end)
return;
iter = data.begin();
data.erase (iter+start, iter+end+1);
data.erase (iter + start, iter + end + 1);
if ( ! str.isNull() )
insert(str, start);
@ -287,7 +287,7 @@ void FTextView::clear()
try
{
blank = new char[size+1];
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
@ -298,7 +298,7 @@ void FTextView::clear()
std::memset(blank, ' ', uLong(size));
blank[size] = '\0';
for (int y=0; y < getHeight() + nf_offset - 2; y++)
for (int y = 0; y < getHeight() + nf_offset - 2; y++)
{
setPrintPos (2, 2 - nf_offset + y);
print (blank);
@ -345,7 +345,7 @@ void FTextView::onKeyPress (FKeyEvent* ev)
break;
case fc::Fkey_ppage:
yoffset -= getHeight()-2;
yoffset -= getHeight() - 2;
if ( yoffset < 0 )
yoffset = 0;
@ -355,7 +355,7 @@ void FTextView::onKeyPress (FKeyEvent* ev)
case fc::Fkey_npage:
if ( last_line >= getHeight() )
yoffset += getHeight()-2;
yoffset += getHeight() - 2;
if ( yoffset > last_line - getHeight() - nf_offset + 2 )
yoffset = last_line - getHeight() - nf_offset + 2;
@ -756,18 +756,18 @@ void FTextView::drawText()
if ( isMonochron() )
setReverse(true);
for (uInt y=start; y < end; y++)
for (uInt y = start; y < end; y++)
{
uInt i, len;
FString line;
const wchar_t* line_str;
setPrintPos (2, 2 - nf_offset + int(y));
line = data[y+uInt(yoffset)].mid ( uInt(1 + xoffset)
line = data[y + uInt(yoffset)].mid ( uInt(1 + xoffset)
, uInt(getWidth() - nf_offset - 2) );
line_str = line.wc_str();
len = line.getLength();
for (i=0; i < len; i++)
for (i = 0; i < len; i++)
{
wchar_t ch = line_str[i];
bool utf8 = (Encoding == fc::UTF8) ? true : false;

View File

@ -219,7 +219,7 @@ void FToggleButton::hide()
try
{
blank = new char[size+1];
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
@ -403,16 +403,16 @@ uChar FToggleButton::getHotkey()
length = text.getLength();
for (uInt i=0; i < length; i++)
for (uInt i = 0; i < length; i++)
{
try
{
if ( (i+1 < length) && (text[i] == '&') )
if ( i + 1 < length && text[i] == '&' )
return uChar(text[++i]);
}
catch (const std::out_of_range&)
{
return 0;;
return 0;
}
}
@ -496,7 +496,7 @@ void FToggleButton::drawLabel()
try
{
LabelText = new wchar_t[length+1]();
LabelText = new wchar_t[length + 1]();
}
catch (const std::bad_alloc& ex)
{
@ -512,9 +512,9 @@ void FToggleButton::drawLabel()
// find hotkey position in string
// + generate a new string without the '&'-sign
for (i=0; i < length; i++)
for (i = 0; i < length; i++)
{
if ( (i < length) && (txt[i] == '&') && (hotkeypos == -1) )
if ( i < length && txt[i] == '&' && hotkeypos == -1 )
{
hotkeypos = int(i);
i++;
@ -537,7 +537,7 @@ void FToggleButton::drawLabel()
else
setColor (wc.label_inactive_fg, wc.label_inactive_bg);
for (int z=0; z < int(length); z++)
for (int z = 0; z < int(length); z++)
{
if ( (z == hotkeypos) && isActive )
{

View File

@ -73,7 +73,7 @@ void FToolTip::draw()
clearArea();
drawBorder();
for (int i=0; i < int(text_num_lines); i++)
for (int i = 0; i < int(text_num_lines); i++)
{
setPrintPos (3, 2 + i);
print(text_components[i]);
@ -129,7 +129,7 @@ void FToolTip::calculateDimensions()
text_components = &text_split[0];
max_line_width = 0;
for (uInt i=0; i < text_num_lines; i++)
for (uInt i = 0; i < text_num_lines; i++)
{
uInt len = text_components[i].getLength();
@ -142,8 +142,8 @@ void FToolTip::calculateDimensions()
if ( r )
{
x = 1 + int((r->getWidth()-w)/2);
y = 1 + int((r->getHeight()-h)/2);
x = 1 + int((r->getWidth() - w) / 2);
y = 1 + int((r->getHeight() - h) / 2);
}
else
x = y = 1;

View File

@ -200,7 +200,7 @@ void FVTerm::resizeVTerm (int width, int height)
//----------------------------------------------------------------------
void FVTerm::putVTerm()
{
for (int i=0; i < vterm->height; i++)
for (int i = 0; i < vterm->height; i++)
{
vterm->changes[i].xmin = 0;
vterm->changes[i].xmax = uInt(vterm->width - 1);
@ -242,7 +242,7 @@ void FVTerm::updateTerminal()
// Update data on VTerm
updateVTerm();
for (register uInt y=0; y < uInt(vterm->height); y++)
for (register uInt y = 0; y < uInt(vterm->height); y++)
updateTerminalLine (y);
// sets the new input cursor position
@ -319,7 +319,7 @@ int FVTerm::printf (const char* format, ...)
{
try
{
buffer = new char[len+1]();
buffer = new char[len + 1]();
}
catch (const std::bad_alloc& ex)
{
@ -327,7 +327,7 @@ int FVTerm::printf (const char* format, ...)
return -1;
}
va_start (args, format);
vsnprintf (buffer, uLong(len+1), format, args);
vsnprintf (buffer, uLong(len + 1), format, args);
va_end (args);
}
@ -973,7 +973,7 @@ void FVTerm::resizeArea ( int offset_left, int offset_top
return;
}
area_size = (width+rsw) * (height+bsh);
area_size = (width + rsw) * (height + bsh);
if ( area->height + area->bottom_shadow != height + bsh )
{
@ -1044,11 +1044,11 @@ void FVTerm::resizeArea ( int offset_left, int offset_top
std::fill_n (area->text, area_size, default_char);
unchanged.xmin = uInt(width+rsw);
unchanged.xmin = uInt(width + rsw);
unchanged.xmax = 0;
unchanged.trans_count = 0;
std::fill_n (area->changes, height+bsh, unchanged);
std::fill_n (area->changes, height + bsh, unchanged);
}
//----------------------------------------------------------------------
@ -1105,13 +1105,13 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
if ( w < 0 || h < 0 )
return;
if ( x+w > vterm->width )
if ( x + w > vterm->width )
w = vterm->width - x;
if ( w < 0 )
return;
if ( y+h > vterm->height )
if ( y + h > vterm->height )
h = vterm->height - y;
if ( h < 0 )
@ -1119,12 +1119,12 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
widget = static_cast<FWidget*>(vterm->widget);
for (register int ty=0; ty < h; ty++)
for (register int ty = 0; ty < h; ty++)
{
for (register int tx=0; tx < w; tx++)
for (register int tx = 0; tx < w; tx++)
{
tc = &vterm->text[(y+ty) * vterm->width + (x+tx)];
sc = &vdesktop->text[(y+ty) * vdesktop->width + (x+tx)];
tc = &vterm->text[(y + ty) * vterm->width + (x + tx)];
sc = &vdesktop->text[(y + ty) * vdesktop->width + (x + tx)];
if ( widget->window_list && ! widget->window_list->empty() )
{
@ -1150,11 +1150,11 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
, win->height + win->bottom_shadow );
// window visible and contains current character
if ( geometry.contains(tx+x, ty+y) )
if ( geometry.contains(tx + x, ty + y) )
{
char_data* tmp;
int line_len = win->width + win->right_shadow;
tmp = &win->text[(ty+y-win_y) * line_len + (tx+x-win_x)];
tmp = &win->text[(ty + y - win_y) * line_len + (tx + x - win_x)];
if ( ! tmp->attr.bit.transparent ) // current character not transparent
{
@ -1193,11 +1193,11 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
std::memcpy (tc, sc, sizeof(char_data));
if ( short(vterm->changes[y+ty].xmin) > x )
vterm->changes[y+ty].xmin = uInt(x);
if ( short(vterm->changes[y + ty].xmin) > x )
vterm->changes[y + ty].xmin = uInt(x);
if ( short(vterm->changes[y+ty].xmax) < x+w-1 )
vterm->changes[y+ty].xmax = uInt(x+w-1);
if ( short(vterm->changes[y + ty].xmax) < x + w - 1 )
vterm->changes[y + ty].xmax = uInt(x + w - 1);
}
}
}
@ -1252,7 +1252,7 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
{
char_data* tmp;
int line_len = win->width + win->right_shadow;
tmp = &win->text[(y-win_y) * line_len + (x-win_x)];
tmp = &win->text[(y - win_y) * line_len + (x - win_x)];
if ( tmp->attr.bit.trans_shadow )
{
@ -1380,7 +1380,7 @@ void FVTerm::updateVTerm (term_area* area)
else
y_end = ah + bsh;
for (int y=0; y < y_end; y++) // line loop
for (int y = 0; y < y_end; y++) // line loop
{
int line_xmin = int(area->changes[y].xmin);
int line_xmax = int(area->changes[y].xmax);
@ -1399,7 +1399,7 @@ void FVTerm::updateVTerm (term_area* area)
if ( ax + line_xmin >= vterm->width )
continue;
for (int x=line_xmin; x <= line_xmax; x++) // column loop
for (int x = line_xmin; x <= line_xmax; x++) // column loop
{
int gx, gy, line_len;
covered_state is_covered;
@ -1414,7 +1414,7 @@ void FVTerm::updateVTerm (term_area* area)
ac = &area->text[y * line_len + x];
tc = &vterm->text[gy * vterm->width + gx - ol];
is_covered = isCovered(gx-ol, gy, area); // get covered state
is_covered = isCovered(gx - ol, gy, area); // get covered state
if ( is_covered != fully_covered )
{
@ -1423,7 +1423,7 @@ void FVTerm::updateVTerm (term_area* area)
// add the overlapping color to this character
char_data ch, oc;
std::memcpy (&ch, ac, sizeof(char_data));
oc = getOverlappedCharacter (gx+1 - ol, gy+1, area->widget);
oc = getOverlappedCharacter (gx + 1 - ol, gy + 1, area->widget);
ch.fg_color = oc.fg_color;
ch.bg_color = oc.bg_color;
ch.attr.bit.reverse = false;
@ -1444,7 +1444,7 @@ void FVTerm::updateVTerm (term_area* area)
{
// restore one character on vterm
char_data ch;
ch = getCoveredCharacter (gx+1 - ol, gy+1, area->widget);
ch = getCoveredCharacter (gx + 1 - ol, gy + 1, area->widget);
ch.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == ch);
std::memcpy (tc, &ch, sizeof(char_data));
}
@ -1454,7 +1454,7 @@ void FVTerm::updateVTerm (term_area* area)
{
// get covered character + add the current color
char_data ch;
ch = getCoveredCharacter (gx+1 - ol, gy+1, area->widget);
ch = getCoveredCharacter (gx + 1 - ol, gy + 1, area->widget);
ch.fg_color = ac->fg_color;
ch.bg_color = ac->bg_color;
ch.attr.bit.reverse = false;
@ -1476,7 +1476,7 @@ void FVTerm::updateVTerm (term_area* area)
// add the covered background to this character
char_data ch, cc;
std::memcpy (&ch, ac, sizeof(char_data));
cc = getCoveredCharacter (gx+1 - ol, gy+1, area->widget);
cc = getCoveredCharacter (gx + 1 - ol, gy + 1, area->widget);
ch.bg_color = cc.bg_color;
ch.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == ch);
std::memcpy (tc, &ch, sizeof(char_data));
@ -1506,14 +1506,14 @@ void FVTerm::updateVTerm (term_area* area)
_xmin = ax + line_xmin - ol;
_xmax = ax + line_xmax;
if ( _xmin < short(vterm->changes[ay+y].xmin) )
vterm->changes[ay+y].xmin = uInt(_xmin);
if ( _xmin < short(vterm->changes[ay + y].xmin) )
vterm->changes[ay + y].xmin = uInt(_xmin);
if ( _xmax >= vterm->width )
_xmax = vterm->width - 1;
if ( _xmax > short(vterm->changes[ay+y].xmax) )
vterm->changes[ay+y].xmax = uInt(_xmax);
if ( _xmax > short(vterm->changes[ay + y].xmax) )
vterm->changes[ay + y].xmax = uInt(_xmax);
area->changes[y].xmin = uInt(aw + rsh);
area->changes[y].xmax = 0;
@ -1622,27 +1622,27 @@ void FVTerm::getArea (int ax, int ay, term_area* area)
ax--;
ay--;
if ( area->height+ay > vterm->height )
if ( area->height + ay > vterm->height )
y_end = area->height - ay;
else
y_end = area->height;
if ( area->width+ax > vterm->width )
if ( area->width + ax > vterm->width )
length = vterm->width - ax;
else
length = area->width;
for (int y=0; y < y_end; y++) // line loop
for (int y = 0; y < y_end; y++) // line loop
{
tc = &vterm->text[(ay+y) * vterm->width + ax];
tc = &vterm->text[(ay + y) * vterm->width + ax];
ac = &area->text[y * area->width];
std::memcpy (ac, tc, sizeof(char_data) * unsigned(length));
if ( short(area->changes[y].xmin) > 0 )
area->changes[y].xmin = 0;
if ( short(area->changes[y].xmax) < length-1 )
area->changes[y].xmax = uInt(length-1);
if ( short(area->changes[y].xmax) < length - 1 )
area->changes[y].xmax = uInt(length - 1);
}
}
@ -1673,12 +1673,12 @@ void FVTerm::getArea (int x, int y, int w, int h, term_area* area)
if ( x < 0 || y < 0 )
return;
if ( y-1+h > vterm->height )
if ( y - 1 + h > vterm->height )
y_end = vterm->height - y + 1;
else
y_end = h - 1;
if ( x-1+w > vterm->width )
if ( x - 1 + w > vterm->width )
length = vterm->width - x + 1;
else
length = w;
@ -1686,18 +1686,18 @@ void FVTerm::getArea (int x, int y, int w, int h, term_area* area)
if ( length < 1 )
return;
for (int _y=0; _y < y_end; _y++) // line loop
for (int _y = 0; _y < y_end; _y++) // line loop
{
int line_len = area->width + area->right_shadow;
tc = &vterm->text[(y+_y-1) * vterm->width + x-1];
ac = &area->text[(dy+_y) * line_len + dx];
tc = &vterm->text[(y + _y - 1) * vterm->width + x - 1];
ac = &area->text[(dy + _y) * line_len + dx];
std::memcpy (ac, tc, sizeof(char_data) * unsigned(length));
if ( short(area->changes[dy+_y].xmin) > dx )
area->changes[dy+_y].xmin = uInt(dx);
if ( short(area->changes[dy + _y].xmin) > dx )
area->changes[dy + _y].xmin = uInt(dx);
if ( short(area->changes[dy+_y].xmax) < dx+length-1 )
area->changes[dy+_y].xmax = uInt(dx+length-1);
if ( short(area->changes[dy + _y].xmax) < dx + length - 1 )
area->changes[dy + _y].xmax = uInt(dx + length - 1);
}
}
@ -1755,30 +1755,30 @@ void FVTerm::putArea (int ax, int ay, term_area* area)
if ( length < 1 )
return;
for (register int y=0; y < y_end; y++) // line loop
for (register int y = 0; y < y_end; y++) // line loop
{
int line_len = aw + rsh;
if ( area->changes[y].trans_count == 0 )
{
// Line has only covered characters
tc = &vterm->text[(ay+y) * vterm->width + ax];
tc = &vterm->text[(ay + y) * vterm->width + ax];
ac = &area->text[y * line_len + ol];
std::memcpy (tc, ac, sizeof(char_data) * unsigned(length));
}
else
{
// Line has one or more transparent characters
for (register int x=0; x < length; x++) // column loop
for (register int x = 0; x < length; x++) // column loop
{
tc = &vterm->text[(ay+y) * vterm->width + (ax+x)];
tc = &vterm->text[(ay + y) * vterm->width + (ax + x)];
ac = &area->text[y * line_len + ol + x];
if ( ac->attr.bit.transparent ) // transparent
{
// restore one character on vterm
char_data ch;
ch = getCoveredCharacter (ax+x+1, ay+y+1, area->widget);
ch = getCoveredCharacter (ax + x + 1, ay + y + 1, area->widget);
std::memcpy (tc, &ch, sizeof(char_data));
}
else // not transparent
@ -1787,7 +1787,7 @@ void FVTerm::putArea (int ax, int ay, term_area* area)
{
// get covered character + add the current color
char_data ch;
ch = getCoveredCharacter (ax+x+1, ay+y+1, area->widget);
ch = getCoveredCharacter (ax + x + 1, ay + y + 1, area->widget);
ch.fg_color = ac->fg_color;
ch.bg_color = ac->bg_color;
ch.attr.bit.reverse = false;
@ -1808,7 +1808,7 @@ void FVTerm::putArea (int ax, int ay, term_area* area)
// add the covered background to this character
char_data ch, cc;
std::memcpy (&ch, ac, sizeof(char_data));
cc = getCoveredCharacter (ax+x+1, ay+y+1, area->widget);
cc = getCoveredCharacter (ax + x + 1, ay + y + 1, area->widget);
ch.bg_color = cc.bg_color;
std::memcpy (tc, &ch, sizeof(char_data));
}
@ -1818,11 +1818,11 @@ void FVTerm::putArea (int ax, int ay, term_area* area)
}
}
if ( ax < short(vterm->changes[ay+y].xmin) )
vterm->changes[ay+y].xmin = uInt(ax);
if ( ax < short(vterm->changes[ay + y].xmin) )
vterm->changes[ay + y].xmin = uInt(ax);
if ( ax+length-1 > short(vterm->changes[ay+y].xmax) )
vterm->changes[ay+y].xmax = uInt(ax+length-1);
if ( ax + length - 1 > short(vterm->changes[ay + y].xmax) )
vterm->changes[ay + y].xmax = uInt(ax + length - 1);
}
}
@ -1848,10 +1848,10 @@ void FVTerm::scrollAreaForward (term_area* area)
total_width = area->width + area->right_shadow;
y_max = area->height - 1;
for (int y=0; y < y_max; y++)
for (int y = 0; y < y_max; y++)
{
int pos1 = y * total_width;
int pos2 = (y+1) * total_width;
int pos2 = (y + 1) * total_width;
sc = &area->text[pos2];
dc = &area->text[pos1];
std::memcpy (dc, sc, sizeof(char_data) * unsigned(length));
@ -1877,8 +1877,8 @@ void FVTerm::scrollAreaForward (term_area* area)
scrollTermForward();
putArea (1, 1, vdesktop);
// avoid update lines from 0 to (y_max-1)
for (int y=0; y < y_max; y++)
// avoid update lines from 0 to (y_max - 1)
for (int y = 0; y < y_max; y++)
{
area->changes[y].xmin = uInt(area->width - 1);
area->changes[y].xmax = 0;
@ -1909,9 +1909,9 @@ void FVTerm::scrollAreaReverse (term_area* area)
total_width = area->width + area->right_shadow;
y_max = area->height - 1;
for (int y=y_max; y > 0; y--)
for (int y = y_max; y > 0; y--)
{
int pos1 = (y-1) * total_width;
int pos1 = (y - 1) * total_width;
int pos2 = y * total_width;
sc = &area->text[pos1];
dc = &area->text[pos2];
@ -1939,7 +1939,7 @@ void FVTerm::scrollAreaReverse (term_area* area)
putArea (1, 1, vdesktop);
// avoid update lines from 1 to y_max
for (int y=1; y <= y_max; y++)
for (int y = 1; y <= y_max; y++)
{
area->changes[y].xmin = uInt(area->width - 1);
area->changes[y].xmax = 0;
@ -1980,7 +1980,7 @@ void FVTerm::clearArea (term_area* area, int fillchar)
}
else
{
for (int i=0; i < vdesktop->height; i++)
for (int i = 0; i < vdesktop->height; i++)
{
vdesktop->changes[i].xmin = 0;
vdesktop->changes[i].xmax = uInt(vdesktop->width) - 1;
@ -1998,24 +1998,24 @@ void FVTerm::clearArea (term_area* area, int fillchar)
char_data t_char = nc;
t_char.attr.bit.transparent = true;
for (int y=0; y < area->height; y++)
for (int y = 0; y < area->height; y++)
{
int pos = y * total_width;
// area
std::fill_n (&area->text[pos], total_width, nc);
// right shadow
std::fill_n (&area->text[pos+area->width], area->right_shadow, t_char);
std::fill_n (&area->text[pos + area->width], area->right_shadow, t_char);
}
// bottom shadow
for (int y=0; y < area->bottom_shadow; y++)
for (int y = 0; y < area->bottom_shadow; y++)
{
int pos = total_width * (y + area->height);
std::fill_n (&area->text[pos], total_width, t_char);
}
}
for (int i=0; i < area->height; i++)
for (int i = 0; i < area->height; i++)
{
area->changes[i].xmin = 0;
area->changes[i].xmax = w - 1;
@ -2030,7 +2030,7 @@ void FVTerm::clearArea (term_area* area, int fillchar)
area->changes[i].trans_count = 0;
}
for (int i=0; i < area->bottom_shadow; i++)
for (int i = 0; i < area->bottom_shadow; i++)
{
int y = area->height + i;
area->changes[y].xmin = 0;
@ -2124,7 +2124,7 @@ FVTerm::char_data FVTerm::getCharacter ( character_type char_type
{
char_data* tmp;
int line_len = win->width + win->right_shadow;
tmp = &win->text[(y-win_y) * line_len + (x-win_x)];
tmp = &win->text[(y - win_y) * line_len + (x - win_x)];
// current character not transparent
if ( ! tmp->attr.bit.transparent )
@ -2373,7 +2373,7 @@ bool FVTerm::clearTerm (int fillchar)
{
term_pos->setPoint(-1,-1);
for (int i=0; i < getLineNumber(); i++)
for (int i = 0; i < getLineNumber(); i++)
{
setTermXY (0, i);
appendOutputBuffer (cb);
@ -2407,7 +2407,7 @@ void FVTerm::updateTerminalLine (uInt y)
char*& rp = tcap[fc::t_repeat_char].string;
bool ut = FTermcap::background_color_erase;
char_data* first_char = &vt->text[y * uInt(vt->width)];
char_data* last_char = &vt->text[(y+1) * uInt(vt->width) - 1];
char_data* last_char = &vt->text[(y + 1) * uInt(vt->width) - 1];
char_data* min_char = &vt->text[y * uInt(vt->width) + xmin];
// Is the line from xmin to the end of the line blank?
@ -2416,7 +2416,7 @@ void FVTerm::updateTerminalLine (uInt y)
uInt beginning_whitespace = 1;
bool normal = isNormal(min_char);
for (uInt x=xmin+1; x < uInt(vt->width); x++)
for (uInt x = xmin + 1; x < uInt(vt->width); x++)
{
char_data* ch = &vt->text[y * uInt(vt->width) + x];
@ -2440,7 +2440,7 @@ void FVTerm::updateTerminalLine (uInt y)
uInt leading_whitespace = 1;
bool normal = isNormal(first_char);
for (uInt x=1; x < uInt(vt->width); x++)
for (uInt x = 1; x < uInt(vt->width); x++)
{
char_data* ch = &vt->text[y * uInt(vt->width) + x];
@ -2465,7 +2465,7 @@ void FVTerm::updateTerminalLine (uInt y)
uInt tailing_whitespace = 1;
bool normal = isNormal(last_char);
for (uInt x=uInt(vt->width)-1; x > 0 ; x--)
for (uInt x = uInt(vt->width) - 1; x > 0 ; x--)
{
char_data* ch = &vt->text[y * uInt(vt->width) + x];
@ -2502,7 +2502,7 @@ void FVTerm::updateTerminalLine (uInt y)
markAsPrinted (0, xmin, y);
}
for (uInt x=xmin; x <= xmax; x++)
for (uInt x = xmin; x <= xmax; x++)
{
char_data* print_char;
print_char = &vt->text[y * uInt(vt->width) + x];
@ -2513,7 +2513,7 @@ void FVTerm::updateTerminalLine (uInt y)
{
uInt count = 1;
for (uInt i=x+1; i <= xmax; i++)
for (uInt i = x + 1; i <= xmax; i++)
{
char_data* ch = &vt->text[y * uInt(vt->width) + i];
@ -2537,7 +2537,7 @@ void FVTerm::updateTerminalLine (uInt y)
uInt whitespace = 1;
bool normal = isNormal(print_char);
for (uInt i=x+1; i <= xmax; i++)
for (uInt i = x + 1; i <= xmax; i++)
{
char_data* ch = &vt->text[y * uInt(vt->width) + i];
@ -2573,7 +2573,7 @@ void FVTerm::updateTerminalLine (uInt y)
{
x--;
for (uInt i=0; i < whitespace; i++, x++)
for (uInt i = 0; i < whitespace; i++, x++)
appendCharacter (print_char);
}
@ -2584,7 +2584,7 @@ void FVTerm::updateTerminalLine (uInt y)
{
uInt repetitions = 1;
for (uInt i=x+1; i <= xmax; i++)
for (uInt i = x + 1; i <= xmax; i++)
{
char_data* ch = &vt->text[y * uInt(vt->width) + i];
@ -2617,7 +2617,7 @@ void FVTerm::updateTerminalLine (uInt y)
{
x--;
for (uInt i=0; i < repetitions; i++, x++)
for (uInt i = 0; i < repetitions; i++, x++)
appendCharacter (print_char);
}
@ -2635,7 +2635,7 @@ void FVTerm::updateTerminalLine (uInt y)
{
appendAttributes (last_char);
appendOutputBuffer (ce);
markAsPrinted (xmax+1, uInt(vt->width - 1), y);
markAsPrinted (xmax + 1, uInt(vt->width - 1), y);
}
}
@ -2713,7 +2713,7 @@ inline void FVTerm::markAsPrinted (uInt from, uInt to, uInt line)
{
// Marks characters in the specified range [from .. to] as printed
for (uInt x=from; x <= to; x++)
for (uInt x = from; x <= to; x++)
vterm->text[line * uInt(vterm->width) + x].attr.bit.printed = true;
}

View File

@ -1186,7 +1186,7 @@ void FWidget::resize()
{
detectTermSize();
FRect term_geometry = getTermGeometry();
term_geometry.move(-1,-1);
term_geometry.move (-1, -1);
resizeVTerm (term_geometry);
resizeArea (term_geometry, getShadow(), vdesktop);
@ -1433,7 +1433,7 @@ void FWidget::drawShadow()
if ( trans_shadow )
{
// transparent shadow
setPrintPos (x2+1, y1);
setPrintPos (x2 + 1, y1);
setTransparent();
print (" ");
unsetTransparent();
@ -1441,14 +1441,14 @@ void FWidget::drawShadow()
setColor (wc.shadow_bg, wc.shadow_fg);
setTransShadow();
for (int i=1; i < getHeight(); i++)
for (int i = 1; i < getHeight(); i++)
{
setPrintPos (x2+1, y1+i);
setPrintPos (x2 + 1, y1 + i);
print (" ");
}
unsetTransShadow();
setPrintPos (x1, y2+1);
setPrintPos (x1, y2 + 1);
setTransparent();
print (" ");
unsetTransparent();
@ -1456,7 +1456,7 @@ void FWidget::drawShadow()
setColor (wc.shadow_bg, wc.shadow_fg);
setTransShadow();
for (int i=2; i <= getWidth()+1; i++)
for (int i = 2; i <= getWidth() + 1; i++)
print (' ');
unsetTransShadow();
@ -1472,7 +1472,7 @@ void FWidget::drawShadow()
if ( no_shadow_character )
return;
setPrintPos (x2+1, y1);
setPrintPos (x2 + 1, y1);
if ( isWindowWidget() )
{
@ -1488,18 +1488,18 @@ void FWidget::drawShadow()
if ( isWindowWidget() )
unsetInheritBackground();
for (int i=1; i < getHeight(); i++)
for (int i = 1; i < getHeight(); i++)
{
setPrintPos (x2+1, y1+i);
setPrintPos (x2 + 1, y1 + i);
print (block); // █
}
setPrintPos (x1+1, y2+1);
setPrintPos (x1 + 1, y2 + 1);
if ( isWindowWidget() )
setInheritBackground();
for (int i=1; i <= getWidth(); i++)
for (int i = 1; i <= getWidth(); i++)
print (fc::UpperHalfBlock); // ▀
if ( isWindowWidget() )
@ -1530,18 +1530,18 @@ void FWidget::clearShadow()
if ( x2 <= offset.getX2() )
{
for (int i=0; i < getHeight(); i++)
for (int i = 0; i < getHeight(); i++)
{
setPrintPos (x2+1, y1+i);
setPrintPos (x2 + 1, y1 + i);
print (' '); // clear █
}
}
if ( y2 <= offset.getY2() )
{
setPrintPos (x1+1, y2+1);
setPrintPos (x1 + 1, y2 + 1);
for (int i=1; i <= getWidth(); i++)
for (int i = 1; i <= getWidth(); i++)
print (' '); // clear ▀
}
@ -1567,9 +1567,9 @@ void FWidget::drawFlatBorder()
else
setColor (wc.dialog_fg, wc.dialog_bg);
for (int y=0; y < getHeight(); y++)
for (int y = 0; y < getHeight(); y++)
{
setPrintPos (x1-1, y1+y+1);
setPrintPos (x1 - 1, y1 + y + 1);
if ( double_flatline_mask.left[uLong(y)] )
print (fc::NF_rev_border_line_right_and_left); // left+right line (on left side)
@ -1577,21 +1577,21 @@ void FWidget::drawFlatBorder()
print (fc::NF_rev_border_line_right); // right line (on left side)
}
setPrintPos (x2, y1+1);
setPrintPos (x2, y1 + 1);
for (int y=0; y < getHeight(); y++)
for (int y = 0; y < getHeight(); y++)
{
if ( double_flatline_mask.right[uLong(y)] )
print (fc::NF_rev_border_line_right_and_left); // left+right line (on right side)
else
print (fc::NF_border_line_left); // left line (on right side)
setPrintPos (x2, y1+y+2);
setPrintPos (x2, y1 + y + 2);
}
setPrintPos (x1, y1);
for (int x=0; x < getWidth(); x++)
for (int x = 0; x < getWidth(); x++)
{
if ( double_flatline_mask.top[uLong(x)] )
print (fc::NF_border_line_up_and_down); // top+bottom line (at top)
@ -1601,7 +1601,7 @@ void FWidget::drawFlatBorder()
setPrintPos (x1, y2);
for (int x=0; x < getWidth(); x++)
for (int x = 0; x < getWidth(); x++)
{
if ( double_flatline_mask.bottom[uLong(x)] )
print (fc::NF_border_line_up_and_down); // top+bottom line (at bottom)
@ -1629,9 +1629,9 @@ void FWidget::clearFlatBorder()
setColor (wc.dialog_fg, wc.dialog_bg);
// clear on left side
for (register int y=0; y < getHeight(); y++)
for (register int y = 0; y < getHeight(); y++)
{
setPrintPos (x1-1, y1+y+1);
setPrintPos (x1 - 1, y1 + y + 1);
if ( double_flatline_mask.left[uLong(y)] )
print (fc::NF_border_line_left);
@ -1640,9 +1640,9 @@ void FWidget::clearFlatBorder()
}
// clear on right side
for (register int y=0; y < getHeight(); y++)
for (register int y = 0; y < getHeight(); y++)
{
setPrintPos (x2, y1+y+1);
setPrintPos (x2, y1 + y + 1);
if ( double_flatline_mask.right[uLong(y)] )
print (fc::NF_rev_border_line_right);
@ -1653,7 +1653,7 @@ void FWidget::clearFlatBorder()
// clear at top
setPrintPos (x1, y1);
for (register int x=0; x < getWidth(); x++)
for (register int x = 0; x < getWidth(); x++)
{
if ( double_flatline_mask.top[uLong(x)] )
print (fc::NF_border_line_upper);
@ -1664,7 +1664,7 @@ void FWidget::clearFlatBorder()
// clear at bottom
setPrintPos (x1, y2);
for (register int x=0; x < getWidth(); x++)
for (register int x = 0; x < getWidth(); x++)
{
if ( double_flatline_mask.bottom[uLong(x)] )
print (fc::NF_border_line_bottom);
@ -1699,12 +1699,12 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
setPrintPos (x1, y1);
print (fc::NF_border_corner_middle_upper_left); // ┌
for (int x=x1+1; x < x2; x++)
for (int x = x1 + 1; x < x2; x++)
print (fc::BoxDrawingsHorizontal); // ─
print (fc::NF_border_corner_middle_upper_right); // ┐
for (int y=y1+1; y <= y2; y++)
for (int y = y1 + 1; y <= y2; y++)
{
setPrintPos (x1, y);
print (fc::NF_border_line_left); // border left ⎸
@ -1715,7 +1715,7 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
setPrintPos (x1, y2);
print (fc::NF_border_corner_middle_lower_left); // └
for (int x=x1+1; x < x2; x++)
for (int x = x1 + 1; x < x2; x++)
print (fc::BoxDrawingsHorizontal); // ─
print (fc::NF_border_corner_middle_lower_right); // ┘
@ -1725,12 +1725,12 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
setPrintPos (x1, y1);
print (fc::BoxDrawingsDownAndRight); // ┌
for (int x=x1+1; x < x2; x++)
for (int x = x1 + 1; x < x2; x++)
print (fc::BoxDrawingsHorizontal); // ─
print (fc::BoxDrawingsDownAndLeft); // ┐
for (int y=y1+1; y < y2; y++)
for (int y = y1 + 1; y < y2; y++)
{
setPrintPos (x1, y);
print (fc::BoxDrawingsVertical); // │
@ -1741,12 +1741,12 @@ void FWidget::drawBorder (int x1, int y1, int x2, int y2)
setPrintPos (x1, y2);
print (fc::BoxDrawingsUpAndRight); // └
for (int x=x1+1; x < x2; x++)
for (int x = x1 + 1; x < x2; x++)
print (fc::BoxDrawingsHorizontal); // ─
print (fc::BoxDrawingsUpAndLeft); // ┘
for (int x=x1+1; x < x2; x++)
for (int x = x1 + 1; x < x2; x++)
{
setPrintPos (x, y1);
print (fc::BoxDrawingsHorizontal); // ─
@ -2368,7 +2368,7 @@ inline void FWidget::insufficientSpaceAdjust()
return;
// move left if not enough space
while ( getTermX()+getWidth()-padding.right > offset.getX2()+2 )
while ( getTermX() + getWidth() - padding.right > offset.getX2() + 2 )
{
adjust_wsize.x1_ref()--;
adjust_wsize.x2_ref()--;
@ -2378,7 +2378,7 @@ inline void FWidget::insufficientSpaceAdjust()
}
// move up if not enough space
while ( getTermY()+getHeight()-padding.bottom > offset.getY2()+2 )
while ( getTermY() + getHeight() - padding.bottom > offset.getY2() + 2 )
{
adjust_wsize.y1_ref()--;
adjust_wsize.y2_ref()--;
@ -2388,7 +2388,7 @@ inline void FWidget::insufficientSpaceAdjust()
}
// reduce the width if not enough space
while ( offset.getX1()+getWidth()-1 > offset.getX2() )
while ( offset.getX1() + getWidth() - 1 > offset.getX2() )
adjust_wsize.x2_ref()--;
if ( getWidth() < size_hints.min_width )
@ -2398,7 +2398,7 @@ inline void FWidget::insufficientSpaceAdjust()
adjust_wsize.setWidth(1);
// reduce the height if not enough space
while ( offset.getY1()+getHeight()-1 > offset.getY2() )
while ( offset.getY1() + getHeight() - 1 > offset.getY2() )
adjust_wsize.y2_ref()--;
if ( getHeight() < size_hints.min_height )

View File

@ -263,12 +263,12 @@ void FWindow::drawBorder()
setPrintPos (x1, y1);
print (fc::NF_border_corner_upper_left); // ⎡
for (int x=x1+1; x < x2; x++)
for (int x = x1 + 1; x < x2; x++)
print (fc::NF_border_line_upper); // ¯
print (fc::NF_rev_border_corner_upper_right); // ⎤
for (int y=y1+1; y < y2; y++)
for (int y = y1 + 1; y < y2; y++)
{
setPrintPos (x1, y);
// border left ⎸
@ -282,7 +282,7 @@ void FWindow::drawBorder()
// lower left corner border ⎣
print (fc::NF_border_corner_lower_left);
for (int x=2; x < getWidth(); x++) // low line _
for (int x = 2; x < getWidth(); x++) // low line _
print (fc::NF_border_line_bottom);
setPrintPos (x2, y2);

View File

@ -244,7 +244,7 @@ Calc::Calc (FWidget* parent)
setGeometry (19, 6, 37, 18);
addAccelerator('q'); // press 'q' to quit
for (int key=0; key < Calc::NUM_OF_BUTTONS; key++)
for (int key = 0; key < Calc::NUM_OF_BUTTONS; key++)
{
Button* btn = new Button(this);
button_no[key] = key;
@ -254,9 +254,9 @@ Calc::Calc (FWidget* parent)
else
{
int x, y, n;
(key <= Three) ? n=0 : n=1;
x = (key+n)%5*7 + 2;
y = (key+n)/5*2 + 3;
(key <= Three) ? n = 0 : n = 1;
x = (key + n) % 5 * 7 + 2;
y = (key + n) / 5 * 2 + 3;
btn->setGeometry(x, y, 5, 1);
}
@ -395,9 +395,9 @@ bool Calc::isDataEntryKey (int key)
Nine
};
int* iter = std::find (data_entry_keys, data_entry_keys+11, key);
int* iter = std::find (data_entry_keys, data_entry_keys + 11, key);
if ( iter != data_entry_keys+11 )
if ( iter != data_entry_keys + 11 )
return true;
else
return false;
@ -417,9 +417,9 @@ bool Calc::isOperatorKey(int key)
Equals
};
int* iter = std::find (operators, operators+6, key);
int* iter = std::find (operators, operators + 6, key);
if ( iter != operators+6 )
if ( iter != operators + 6 )
return true;
else
return false;
@ -476,7 +476,7 @@ void Calc::calcInfixOperator()
case '+':
if ( std::fabs(a) > LDBL_EPSILON ) // a != 0.0L
{
if ( std::log(std::abs(a)) + std::log(std::abs(1 + b/a)) <= std::log(LDBL_MAX) )
if ( std::log(std::abs(a)) + std::log(std::abs(1 + b / a)) <= std::log(LDBL_MAX) )
a += b;
else
error = true;
@ -488,7 +488,7 @@ void Calc::calcInfixOperator()
case '-':
if ( std::fabs(b) > LDBL_EPSILON ) // b != 0.0L
{
if ( std::log(std::abs(a)) + std::log(std::abs(1 - b/a)) <= std::log(LDBL_MAX) )
if ( std::log(std::abs(a)) + std::log(std::abs(1 - b / a)) <= std::log(LDBL_MAX) )
a -= b;
else
error = true;
@ -606,11 +606,11 @@ void Calc::cb_buttonClicked (FWidget*, data_ptr data)
else
{
if ( arcus_mode )
*x = std::asin(*x) * 180.0L/PI;
else if ( std::fabs(std::fmod(*x,180.0L)) < LDBL_EPSILON ) // x/180 = 0
*x = std::asin(*x) * 180.0L / PI;
else if ( std::fabs(std::fmod(*x, 180.0L)) < LDBL_EPSILON ) // x / 180 = 0
*x = 0.0L;
else
*x = std::sin(*x * PI/180.0L);
*x = std::sin(*x * PI / 180.0L);
}
if ( errno == EDOM )
@ -642,11 +642,11 @@ void Calc::cb_buttonClicked (FWidget*, data_ptr data)
else
{
if ( arcus_mode )
*x = std::acos(*x) * 180.0L/PI;
else if ( std::fabs(std::fmod(*x - 90.0L,180.0L)) < LDBL_EPSILON ) // (x - 90)/180 == 0
*x = std::acos(*x) * 180.0L / PI;
else if ( std::fabs(std::fmod(*x - 90.0L, 180.0L)) < LDBL_EPSILON ) // (x - 90) / 180 == 0
*x = 0.0L;
else
*x = std::cos(*x * PI/180.0L);
*x = std::cos(*x * PI / 180.0L);
}
if ( errno == EDOM )
@ -665,7 +665,7 @@ void Calc::cb_buttonClicked (FWidget*, data_ptr data)
if ( arcus_mode )
if ( *x < 1 )
{
*x = 0.5L * std::log((1+(*x))/(1-(*x)));
*x = 0.5L * std::log((1 + (*x)) / (1 - (*x)));
if ( errno == EDOM || errno == ERANGE )
error = true;
@ -678,16 +678,16 @@ void Calc::cb_buttonClicked (FWidget*, data_ptr data)
else
{
if ( arcus_mode )
*x = std::atan(*x) * 180.0L/PI;
*x = std::atan(*x) * 180.0L / PI;
else
// Test if (x/180) != 0 and x/90 == 0
if ( std::fabs(std::fmod(*x,180.0L)) > LDBL_EPSILON
&& std::fabs(std::fmod(*x,90.0L)) < LDBL_EPSILON )
// Test if (x / 180) != 0 and x / 90 == 0
if ( std::fabs(std::fmod(*x, 180.0L)) > LDBL_EPSILON
&& std::fabs(std::fmod(*x, 90.0L)) < LDBL_EPSILON )
error = true;
else if ( std::fabs(std::fmod(*x,180.0L)) < LDBL_EPSILON ) // x/180 == 0
else if ( std::fabs(std::fmod(*x, 180.0L)) < LDBL_EPSILON ) // x / 180 == 0
*x = 0.0L;
else
*x = std::tan(*x * PI/180.0L);
*x = std::tan(*x * PI / 180.0L);
}
if ( errno == EDOM )
@ -700,12 +700,12 @@ void Calc::cb_buttonClicked (FWidget*, data_ptr data)
calculator_buttons[Hyperbolic]->setChecked(false);
break;
case Reciprocal: // 1/x
case Reciprocal: // 1 / x
if ( std::fabs(*x) < LDBL_EPSILON ) // x == 0
error = true;
else
{
*x = 1/(*x);
*x = 1 / (*x);
setDisplay(*x);
}
break;
@ -984,7 +984,7 @@ void Calc::cb_buttonClicked (FWidget*, data_ptr data)
while ( ! input.includes(L'e')
&& input.includes(L'.')
&& input.back() == L'0' )
input = input.left(input.getLength()-1);
input = input.left(input.getLength() - 1);
}
}

View File

@ -91,7 +91,7 @@ Listbox::Listbox (FWidget* parent)
double_list = new std::list<double>;
for (double i=1; i<=15; i++)
double_list->push_back(2*i + (i/100));
double_list->push_back(2 * i + (i / 100));
FListBox* list2 = new FListBox (this);
list2->setGeometry(21, 1, 10, 10);

View File

@ -107,7 +107,7 @@ Listview::Listview (FWidget* parent)
const int lastItem = int(sizeof(weather) / sizeof(weather[0])) - 1;
for (int i=0; i <= lastItem; i++)
for (int i = 0; i <= lastItem; i++)
{
std::vector<FString> line (&weather[i][0], &weather[i][0] + 5);
listView->insert (line);

View File

@ -67,27 +67,27 @@ void Mandelbrot::draw()
dX = (x_max - x_min) / (Cols - 1);
dY = (y_max - y_min) / Lines;
for (y0=y_min; y0 < y_max && current_line < Lines; y0+=dY)
for (y0 = y_min; y0 < y_max && current_line < Lines; y0 += dY)
{
current_line++;
setPrintPos (xoffset, yoffset + current_line);
for (x0=x_min; x0 < x_max; x0+=dX)
for (x0 = x_min; x0 < x_max; x0 += dX)
{
x = 0.0;
y = 0.0;
iter = 0;
while ( x*x + y*y < 4 && iter < max_iter )
while ( x * x + y * y < 4 && iter < max_iter )
{
xtemp = x*x - y*y + x0;
y = 2*x*y + y0;
xtemp = x * x - y * y + x0;
y = 2 * x * y + y0;
x = xtemp;
iter++;
}
if ( iter < max_iter )
setColor(fc::Black, iter%16);
setColor(fc::Black, iter % 16);
else
setColor(fc::Black, 0);

View File

@ -206,7 +206,7 @@ Menu::~Menu()
//----------------------------------------------------------------------
void Menu::defaultCallback (FMenuList* mb)
{
for (uInt i=1; i <= mb->getCount(); i++)
for (uInt i = 1; i <= mb->getCount(); i++)
{
FMenuItem* item = mb->getItem(int(i));
@ -292,7 +292,7 @@ int main (int argc, char* argv[])
Menu main_dlg (&app);
main_dlg.setText ("Menu example");
main_dlg.setGeometry (int(1+(app.getWidth()-40)/2), 2, 40, 6);
main_dlg.setGeometry (int(1 + (app.getWidth() - 40) / 2), 2, 40, 6);
main_dlg.setShadow();
app.setMainWidget (&main_dlg);

View File

@ -81,7 +81,7 @@ void ColorChooser::onMouseDown (FMouseEvent* ev)
if ( ev->getButton() == fc::MiddleButton )
return;
for (int c=0; c < 16; c++)
for (int c = 0; c < 16; c++)
{
int xmin = 2 + (c / 8) * 3;
int xmax = 4 + (c / 8) * 3;
@ -106,9 +106,9 @@ void ColorChooser::draw()
setColor();
FWidget::drawBorder (1, 2, 8, 11);
for (short c=0; c < 16; c++)
for (short c = 0; c < 16; c++)
{
setPrintPos (2 + (c/8)*3, 3 + c%8);
setPrintPos (2 + (c / 8) * 3, 3 + c % 8);
if ( c < 6 )
setColor (fc::LightGray, c);
@ -363,7 +363,7 @@ void MouseDraw::setGeometry (int x, int y, int w, int h, bool adjust)
FDialog::setGeometry (x, y, w, h, adjust);
FPoint no_shadow(0,0);
FRect scroll_geometry (0, 0, w-11, h-3);
FRect scroll_geometry (0, 0, w - 11, h - 3);
old_w = canvas->width;
old_h = canvas->height;
resizeArea (scroll_geometry, no_shadow, canvas);
@ -406,7 +406,7 @@ void MouseDraw::draw()
setPrintPos (10, 2);
print (wchar_t(fc::BoxDrawingsDownAndHorizontal));
for (int y=3; y < y_max; y++)
for (int y = 3; y < y_max; y++)
{
setPrintPos (10, y);
print (wchar_t(fc::BoxDrawingsVertical));
@ -457,19 +457,19 @@ void MouseDraw::drawCanvas()
x_end = canvas->width;
int w_line_len = print_area->width + print_area->right_shadow;
for (int y=0; y < y_end; y++) // line loop
for (int y = 0; y < y_end; y++) // line loop
{
char_data* cc; // canvas character
char_data* wc; // window character
cc = &canvas->text[y * x_end];
wc = &print_area->text[(ay+y) * w_line_len + ax];
wc = &print_area->text[(ay + y) * w_line_len + ax];
std::memcpy (wc, cc, sizeof(char_data) * unsigned(x_end));
if ( short(print_area->changes[ay+y].xmin) > ax )
print_area->changes[ay+y].xmin = uInt(ax);
if ( short(print_area->changes[ay + y].xmin) > ax )
print_area->changes[ay + y].xmin = uInt(ax);
if ( short(print_area->changes[ay+y].xmax) < ax+x_end-1 )
print_area->changes[ay+y].xmax = uInt(ax+x_end-1);
if ( short(print_area->changes[ay + y].xmax) < ax + x_end - 1 )
print_area->changes[ay + y].xmax = uInt(ax + x_end - 1);
}
print_area->has_changes = true;

View File

@ -82,7 +82,7 @@ void move (int xold, int yold, int xnew, int ynew)
buffer = terminal->moveCursor (xold, yold, xnew, ynew);
len = uInt(std::strlen(buffer));
for (uInt i=0; i < len; i++)
for (uInt i = 0; i < len; i++)
{
switch ( buffer[i] )
{
@ -134,7 +134,7 @@ int main (int argc, char* argv[])
terminal = new FVTerm(&app);
xmax = terminal->getColumnNumber() - 1;
ymax = terminal->getLineNumber() - 1;
FString line(xmax+1, '-');
FString line(xmax + 1, '-');
terminal->setTermXY(0,0);
terminal->setNormal();
@ -154,7 +154,7 @@ int main (int argc, char* argv[])
move (5, ymax, 5, 0);
move (xmax, 1, 0, 1);
move (xmax, 1, 0, 2);
move (xmax+1, 1, 0, 2);
move (xmax + 1, 1, 0, 2);
move (9, 4, 10, 4);
move (10, 4, 9, 4);
move (9, 4, 11, 4);
@ -165,7 +165,7 @@ int main (int argc, char* argv[])
move (16, 0, 16, 2);
move (16, 2, 16, 0);
move (3, 2, xmax, 2);
move (5, 5, xmax-5, ymax-5);
move (5, 5, xmax - 5, ymax - 5);
keyPressed();

View File

@ -116,11 +116,11 @@ void scrollview::draw()
setColor (wc.label_inactive_fg, wc.dialog_bg);
clearArea();
for (int y=0; y < getScrollHeight(); y++)
for (int y = 0; y < getScrollHeight(); y++)
{
setPrintPos (1, 1 + y);
for (int x=0; x < getScrollWidth(); x++)
for (int x = 0; x < getScrollWidth(); x++)
print (32 + ((x + y) % 0x5f));
}

View File

@ -63,10 +63,10 @@ AttribDlg::AttribDlg (FWidget* parent)
+ ")");
next_button = new FButton("&Next >", this);
next_button->setGeometry(getWidth()-13, getHeight()-4, 10, 1);
next_button->setGeometry(getWidth() - 13, getHeight() - 4, 10, 1);
next_button->addAccelerator(fc::Fkey_right);
back_button = new FButton("< &Back", this);
back_button->setGeometry(getWidth()-25, getHeight()-4, 10, 1);
back_button->setGeometry(getWidth() - 25, getHeight() - 4, 10, 1);
back_button->addAccelerator(fc::Fkey_left);
// Add function callbacks
@ -151,8 +151,8 @@ void AttribDlg::cb_back (FWidget*, data_ptr)
//----------------------------------------------------------------------
void AttribDlg::adjustSize()
{
int x = ((getParentWidget()->getWidth() - getWidth()) / 2 );
int y = ((getParentWidget()->getHeight() - getHeight()) / 2 ) + 1;
int x = ((getParentWidget()->getWidth() - getWidth()) / 2);
int y = ((getParentWidget()->getHeight() - getHeight()) / 2) + 1;
if ( x < 1 )
x = 1;
@ -161,8 +161,8 @@ void AttribDlg::adjustSize()
y = 1;
setGeometry(x, y, 69, 21, false);
next_button->setGeometry(getWidth()-13, getHeight()-4, 10, 1, false);
back_button->setGeometry(getWidth()-25, getHeight()-4, 10, 1, false);
next_button->setGeometry(getWidth() - 13, getHeight() - 4, 10, 1, false);
back_button->setGeometry(getWidth() - 25, getHeight() - 4, 10, 1, false);
FDialog::adjustSize();
}
@ -222,7 +222,7 @@ void AttribDemo::printColorLine()
{
AttribDlg* parent = static_cast<AttribDlg*>(getParent());
for (short color=0; color < colors; color++)
for (short color = 0; color < colors; color++)
{
setColor (color, parent->bgcolor);
print (" # ");
@ -264,9 +264,9 @@ void AttribDemo::draw()
// test alternate character set
printAltCharset();
for (int y=0; y < getParentWidget()->getHeight()-7; y++)
for (int y = 0; y < getParentWidget()->getHeight() - 7; y++)
{
setPrintPos (1, 2+y);
setPrintPos (1, 2 + y);
if ( ! isMonochron() )
setColor (wc.label_fg, wc.label_bg);

View File

@ -50,7 +50,7 @@ void tcapString (const std::string& name, const char* cap_str)
len = uInt(std::strlen(cap_str));
for (uInt i=0; i < len; i++)
for (uInt i = 0; i < len; i++)
{
char c = cap_str[i];

View File

@ -90,9 +90,9 @@ void Transparent::draw()
FString line(getClientWidth(), wchar_t('.'));
for (int n=1; n <= getClientHeight(); n++)
for (int n = 1; n <= getClientHeight(); n++)
{
setPrintPos (2, 2+n);
setPrintPos (2, 2 + n);
print(line);
}

View File

@ -69,7 +69,7 @@ Treeview::Treeview (FWidget* parent)
const int lastItem = int(sizeof(continent) / sizeof(continent[0])) - 1;
for (int i=0; i <= lastItem; i++)
for (int i = 0; i <= lastItem; i++)
{
std::vector<FString> line (&continent[i][0], &continent[i][0] + 3);
listView->insert (line);

View File

@ -52,7 +52,7 @@ ProgressDialog::ProgressDialog (FWidget* parent)
, more()
, quit()
{
setGeometry (int((this->getParentWidget()->getWidth()-40)/2), 7, 40, 10);
setGeometry (int((this->getParentWidget()->getWidth() - 40) / 2), 7, 40, 10);
setText("Progress bar");
//setModal();
@ -198,7 +198,7 @@ TextWindow::TextWindow (FWidget* parent)
{
scrollText = new FTextView(this);
scrollText->ignorePadding();
scrollText->setGeometry (1, 2, getWidth(), getHeight()-1);
scrollText->setGeometry (1, 2, getWidth(), getHeight() - 1);
setMinimumSize (51, 6);
scrollText->setFocus();
scrollText->insert(" -----------------------------------------------\n"
@ -225,7 +225,7 @@ void TextWindow::append (const FString& str)
void TextWindow::adjustSize()
{
FDialog::adjustSize();
scrollText->setGeometry (1, 2, getWidth(), getHeight()-1);
scrollText->setGeometry (1, 2, getWidth(), getHeight() - 1);
}
@ -508,7 +508,7 @@ MyDialog::MyDialog (FWidget* parent)
myList->setStatusbarMessage ("99 items in a list");
myList->setMultiSelection();
for (int z=1; z < 100; z++)
for (int z = 1; z < 100; z++)
myList->insert (FString().setNumber(z) + L" placeholder");
// Text labels
@ -823,7 +823,7 @@ void MyDialog::cb_updateNumber (FWidget* widget, data_ptr data)
int select_num = 0;
uInt end = list->getCount();
for (uInt n=1; n <= end; n++)
for (uInt n = 1; n <= end; n++)
if ( list->isSelected(int(n)) )
select_num++;
@ -862,10 +862,10 @@ void MyDialog::cb_view (FWidget*, data_ptr data)
TextWindow* view = new TextWindow(this);
FString filename(basename(const_cast<char*>(file.c_str())));
view->setText ("Viewer: " + filename);
view->setGeometry (1+int((getRootWidget()->getWidth()-60)/2),
int(getRootWidget()->getHeight()/6),
view->setGeometry (1 + int((getRootWidget()->getWidth() - 60) / 2),
int(getRootWidget()->getHeight() / 6),
60,
int(getRootWidget()->getHeight()*3/4));
int(getRootWidget()->getHeight() * 3 / 4));
view->setResizeable();
std::string line = "";
@ -929,7 +929,7 @@ int main (int argc, char* argv[])
MyDialog d(&app);
d.setText (title);
d.setGeometry (int((app.getWidth()-56)/2), 2, 56, app.getHeight()-4);
d.setGeometry (int((app.getWidth() - 56) / 2), 2, 56, app.getHeight() - 4);
d.setShadow();
app.setMainWidget(&d);

View File

@ -67,7 +67,7 @@ watch::watch (FWidget* parent)
{
setText ("Watch");
int pw = getParentWidget()->getWidth();
setGeometry (1+(pw-22)/2, 3, 22, 13);
setGeometry (1 + (pw - 22) / 2, 3, 22, 13);
// Create labels
time_label = new FLabel(L"Time", this);
@ -200,7 +200,7 @@ void watch::cb_exitApp (FWidget*, data_ptr)
void watch::adjustSize()
{
int pw = getParentWidget()->getWidth();
setX (1+(pw-22)/2, false);
setX (1 + (pw - 22) / 2, false);
FDialog::adjustSize();
}

View File

@ -311,7 +311,7 @@ Window::Window (FWidget* parent)
F_METHOD_CALLBACK (this, &Window::cb_exitApp)
);
for (int n=1; n <= 6; n++)
for (int n = 1; n <= 6; n++)
{
win_data* win_dat = new win_data;
win_dat->is_open = false;
@ -374,8 +374,8 @@ void Window::adjustSize()
{
int x,y,n;
n = int(std::distance(begin, iter));
x = dx + 5 + (n%3)*25 + int(n/3)*3;
y = dy + 11 + int(n/3)*3;
x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
y = dy + 11 + int(n / 3) * 3;
(*iter)->dgl->setPos (x, y);
}
@ -424,8 +424,8 @@ void Window::cb_createWindows (FWidget*, data_ptr)
win_dat->is_open = true;
win->setText(*(win_dat)->title);
n = int(std::distance(begin, iter));
x = dx + 5 + (n%3)*25 + int(n/3)*3;
y = dy + 11 + int(n/3)*3;
x = dx + 5 + (n % 3) * 25 + int(n / 3) * 3;
y = dy + 11 + int(n / 3) * 3;
win->setGeometry (x, y, 20, 8);
win->setMinimumSize (20, 8);
win->setResizeable();
@ -579,7 +579,7 @@ int main (int argc, char* argv[])
Window main_dlg (&app);
main_dlg.setText ("Main window");
main_dlg.setGeometry (int(1+(app.getWidth()-40)/2), 2, 40, 6);
main_dlg.setGeometry (int(1 + (app.getWidth() - 40) / 2), 2, 40, 6);
app.setMainWidget (&main_dlg);
main_dlg.show();