Improve code readability through spaces between the operands and the operators
This commit is contained in:
parent
12c0d53192
commit
5f7737bf64
|
@ -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>
|
2017-08-24 Markus Gans <guru.mail@muenster.de>
|
||||||
* Rename fapp.{cpp,h} to fapplication.{cpp,h}
|
* Rename fapp.{cpp,h} to fapplication.{cpp,h}
|
||||||
|
|
||||||
|
|
|
@ -448,12 +448,12 @@ uChar FButton::getHotkey()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( (i+1 < length) && (text[uInt(i)] == '&') )
|
if ( i + 1 < length && text[uInt(i)] == '&' )
|
||||||
return uChar(text[uInt(++i)]);
|
return uChar(text[uInt(++i)]);
|
||||||
}
|
}
|
||||||
catch (const std::out_of_range&)
|
catch (const std::out_of_range&)
|
||||||
{
|
{
|
||||||
return 0;;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,7 +582,7 @@ void FButton::draw()
|
||||||
// + generate a new string without the '&'-sign
|
// + 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;
|
hotkeypos = i;
|
||||||
i++;
|
i++;
|
||||||
|
@ -595,7 +595,7 @@ void FButton::draw()
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != -1 )
|
||||||
hotkey_offset = 1;
|
hotkey_offset = 1;
|
||||||
|
|
||||||
if ( (length - hotkey_offset + mono_offset - hotkey_offset) <= getWidth() )
|
if ( length - hotkey_offset + mono_offset - hotkey_offset <= getWidth() )
|
||||||
margin = 1;
|
margin = 1;
|
||||||
else
|
else
|
||||||
margin = 0;
|
margin = 0;
|
||||||
|
|
|
@ -435,12 +435,12 @@ uChar FButtonGroup::getHotkey()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( (i+1 < length) && (text[i] == '&') )
|
if ( i + 1 < length && text[i] == '&' )
|
||||||
return uChar(text[++i]);
|
return uChar(text[++i]);
|
||||||
}
|
}
|
||||||
catch (const std::out_of_range&)
|
catch (const std::out_of_range&)
|
||||||
{
|
{
|
||||||
return 0;;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -220,16 +220,19 @@ void FDialog::setPos (int x, int y, bool)
|
||||||
if ( dx > 0 )
|
if ( dx > 0 )
|
||||||
{
|
{
|
||||||
if ( dy > 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
|
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
|
else
|
||||||
{
|
{
|
||||||
if ( dy > 0 )
|
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
|
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 )
|
if ( dy > 0 )
|
||||||
|
@ -528,7 +531,7 @@ void FDialog::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
int mouse_x = ev->getX();
|
int mouse_x = ev->getX();
|
||||||
int mouse_y = ev->getY();
|
int mouse_y = ev->getY();
|
||||||
int zoom_btn;;
|
int zoom_btn;
|
||||||
|
|
||||||
if ( ! isResizeable() )
|
if ( ! isResizeable() )
|
||||||
zoom_btn = 0;
|
zoom_btn = 0;
|
||||||
|
|
|
@ -301,12 +301,12 @@ uChar FLabel::getHotkey()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( (i+1 < length) && (text[i] == '&') )
|
if ( i + 1 < length && text[i] == '&' )
|
||||||
return uChar(text[++i]);
|
return uChar(text[++i]);
|
||||||
}
|
}
|
||||||
catch (const std::out_of_range&)
|
catch (const std::out_of_range&)
|
||||||
{
|
{
|
||||||
return 0;;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ int FLabel::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length)
|
||||||
|
|
||||||
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);
|
hotkeypos = int(i);
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -252,7 +252,8 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
|
||||||
if ( cursor_pos >= len )
|
if ( cursor_pos >= len )
|
||||||
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++;
|
text_offset++;
|
||||||
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
|
|
|
@ -1549,7 +1549,8 @@ void FListBox::drawList()
|
||||||
|
|
||||||
full_length = int(getString(iter).getLength());
|
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 )
|
if ( serach_mark && i == inc_len )
|
||||||
setColor ( wc.current_element_focus_fg
|
setColor ( wc.current_element_focus_fg
|
||||||
|
|
|
@ -902,6 +902,7 @@ void FListView::onWheel (FWheelEvent* ev)
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FListView::onFocusIn (FFocusEvent*)
|
void FListView::onFocusIn (FFocusEvent*)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1206,7 +1206,7 @@ int FMenu::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length)
|
||||||
|
|
||||||
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);
|
hotkeypos = int(i);
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -731,7 +731,7 @@ int FMenuBar::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length)
|
||||||
|
|
||||||
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);
|
hotkeypos = int(i);
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -745,12 +745,12 @@ uChar FMenuItem::hotKey()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( (i+1 < length) && (text[i] == '&') )
|
if ( i + 1 < length && text[i] == '&' )
|
||||||
return uChar(text[++i]);
|
return uChar(text[++i]);
|
||||||
}
|
}
|
||||||
catch (const std::out_of_range&)
|
catch (const std::out_of_range&)
|
||||||
{
|
{
|
||||||
return 0;;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -620,24 +620,24 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FOptiMove::printDurations()
|
void FOptiMove::printDurations()
|
||||||
{
|
{
|
||||||
std::printf (" speed: %d baud\r\n", baudrate);
|
std::cout << " speed: " << baudrate << " baud\r\n";
|
||||||
std::printf (" char_duration: %d ms\r\n", char_duration);
|
std::cout << " char_duration: " << char_duration << " ms\r\n";
|
||||||
std::printf (" cursor_home: %d ms\r\n", F_cursor_home.duration);
|
std::cout << " cursor_home: " << F_cursor_home.duration << " ms\r\n";
|
||||||
std::printf (" cursor_to_ll: %d ms\r\n", F_cursor_to_ll.duration);
|
std::cout << " cursor_to_ll: " << F_cursor_to_ll.duration << " ms\r\n";
|
||||||
std::printf (" carriage_return: %d ms\r\n", F_carriage_return.duration);
|
std::cout << " carriage_return: " << F_carriage_return.duration << " ms\r\n";
|
||||||
std::printf (" tab: %d ms\r\n", F_tab.duration);
|
std::cout << " tab: " << F_tab.duration << " ms\r\n";
|
||||||
std::printf (" back_tab: %d ms\r\n", F_back_tab.duration);
|
std::cout << " back_tab: " << F_back_tab.duration << " ms\r\n";
|
||||||
std::printf (" cursor_up: %d ms\r\n", F_cursor_up.duration);
|
std::cout << " cursor_up: " << F_cursor_up.duration << " ms\r\n";
|
||||||
std::printf (" cursor_down: %d ms\r\n", F_cursor_down.duration);
|
std::cout << " cursor_down: " << F_cursor_down.duration << " ms\r\n";
|
||||||
std::printf (" cursor_left: %d ms\r\n", F_cursor_left.duration);
|
std::cout << " cursor_left: " << F_cursor_left.duration << " ms\r\n";
|
||||||
std::printf (" cursor_right: %d ms\r\n", F_cursor_right.duration);
|
std::cout << " cursor_right: " << F_cursor_right.duration << " ms\r\n";
|
||||||
std::printf (" cursor_address: %d ms\r\n", F_cursor_address.duration);
|
std::cout << " cursor_address: " << F_cursor_address.duration << " ms\r\n";
|
||||||
std::printf (" column_address: %d ms\r\n", F_column_address.duration);
|
std::cout << " column_address: " << F_column_address.duration << " ms\r\n";
|
||||||
std::printf (" row_address: %d ms\r\n", F_row_address.duration);
|
std::cout << " row_address: " << F_row_address.duration << " ms\r\n";
|
||||||
std::printf (" parm_up_cursor: %d ms\r\n", F_parm_up_cursor.duration);
|
std::cout << " parm_up_cursor: " << F_parm_up_cursor.duration << " ms\r\n";
|
||||||
std::printf (" parm_down_cursor: %d ms\r\n", F_parm_down_cursor.duration);
|
std::cout << " parm_down_cursor: " << F_parm_down_cursor.duration << " ms\r\n";
|
||||||
std::printf (" parm_left_cursor: %d ms\r\n", F_parm_left_cursor.duration);
|
std::cout << " parm_left_cursor: " << F_parm_left_cursor.duration << " ms\r\n";
|
||||||
std::printf ("parm_right_cursor: %d ms\r\n", F_parm_right_cursor.duration);
|
std::cout << "parm_right_cursor: " << F_parm_right_cursor.duration << " ms\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <cstdio> // need for printf
|
#include <cstdio> // need for printf
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -416,19 +416,22 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
|
||||||
{
|
{
|
||||||
if ( bar_orientation == fc::vertical )
|
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
|
slider_click_pos = mouse_y; // on slider
|
||||||
}
|
}
|
||||||
else // horizontal
|
else // horizontal
|
||||||
{
|
{
|
||||||
if ( isNewFont() )
|
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
|
slider_click_pos = mouse_x; // on slider
|
||||||
}
|
}
|
||||||
else
|
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
|
slider_click_pos = mouse_x; // on slider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2344,7 +2344,7 @@ inline void FString::_remove (uInt pos, uInt len)
|
||||||
if ( (bufsize - length - 1 + len) <= FWDBUFFER )
|
if ( (bufsize - length - 1 + len) <= FWDBUFFER )
|
||||||
{
|
{
|
||||||
// shifting left side to pos
|
// shifting left side to pos
|
||||||
for (uInt i=pos; (i+len) < length+1; i++)
|
for (uInt i = pos; i + len < length + 1; i++)
|
||||||
string[i] = string[i + len];
|
string[i] = string[i + len];
|
||||||
|
|
||||||
length -= len;
|
length -= len;
|
||||||
|
|
|
@ -407,12 +407,12 @@ uChar FToggleButton::getHotkey()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( (i+1 < length) && (text[i] == '&') )
|
if ( i + 1 < length && text[i] == '&' )
|
||||||
return uChar(text[++i]);
|
return uChar(text[++i]);
|
||||||
}
|
}
|
||||||
catch (const std::out_of_range&)
|
catch (const std::out_of_range&)
|
||||||
{
|
{
|
||||||
return 0;;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ void FToggleButton::drawLabel()
|
||||||
// + generate a new string without the '&'-sign
|
// + 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);
|
hotkeypos = int(i);
|
||||||
i++;
|
i++;
|
||||||
|
|
Loading…
Reference in New Issue