coding style

This commit is contained in:
Markus Gans 2015-10-10 04:01:22 +02:00
parent 6a92b4a956
commit eb05f1c1ed
14 changed files with 66 additions and 63 deletions

View File

@ -168,8 +168,8 @@ void FButton::draw()
if ( is_Flat ) if ( is_Flat )
clearFlatBorder(); clearFlatBorder();
clearShadow(); clearShadow();
setColor ( parentWidget()->getForegroundColor(), setColor ( parentWidget()->getForegroundColor()
parentWidget()->getBackgroundColor() ); , parentWidget()->getBackgroundColor() );
for (int y=1; y <= height; y++) for (int y=1; y <= height; y++)
{ {
gotoxy (xpos+xmin-1, ypos+ymin-2+y); gotoxy (xpos+xmin-1, ypos+ymin-2+y);
@ -252,8 +252,8 @@ void FButton::draw()
&& (is_Flat || ! hasShadow() || isMonochron()) ) && (is_Flat || ! hasShadow() || isMonochron()) )
{ {
// clear the right █ from button down // clear the right █ from button down
setColor ( parentWidget()->getForegroundColor(), setColor ( parentWidget()->getForegroundColor()
parentWidget()->getBackgroundColor() ); , parentWidget()->getBackgroundColor() );
for (int y=1; y <= height; y++) for (int y=1; y <= height; y++)
{ {
if ( isMonochron() ) if ( isMonochron() )
@ -283,11 +283,11 @@ void FButton::draw()
print (space); // █ print (space); // █
if ( hotkeypos == -1 ) if ( hotkeypos == -1 )
setCursorPos ( xpos+xmin-1+margin+i, setCursorPos ( xpos+xmin-1+margin+i
ypos+ymin-1+j ); // first character , ypos+ymin-1+j ); // first character
else else
setCursorPos ( xpos+xmin-1+margin+i+hotkeypos, setCursorPos ( xpos+xmin-1+margin+i+hotkeypos
ypos+ymin-1+j ); // hotkey , ypos+ymin-1+j ); // hotkey
if ( isMonochron() && is_ActiveFocus ) if ( isMonochron() && is_ActiveFocus )
setBold(); setBold();
@ -337,8 +337,8 @@ void FButton::draw()
if ( is_NonFlatShadow && ! button_down ) if ( is_NonFlatShadow && ! button_down )
{ {
setColor ( parentWidget()->getForegroundColor(), setColor ( parentWidget()->getForegroundColor()
parentWidget()->getBackgroundColor() ); , parentWidget()->getBackgroundColor() );
print(' '); // restore background after button down print(' '); // restore background after button down
drawShadow(); drawShadow();
} }

View File

@ -71,8 +71,8 @@ void FButtonGroup::init()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FButtonGroup::isRadioButton(FToggleButton* button) const bool FButtonGroup::isRadioButton(FToggleButton* button) const
{ {
return bool ( strcmp ( button->getClassName(), return bool ( strcmp ( button->getClassName()
const_cast<char*>("FRadioButton") ) == 0 ); , const_cast<char*>("FRadioButton") ) == 0 );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -10,14 +10,15 @@
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FCheckBox::FCheckBox(FWidget* parent) : FToggleButton(parent) FCheckBox::FCheckBox(FWidget* parent)
: FToggleButton(parent)
{ {
init(); init();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FCheckBox::FCheckBox ( const FString& txt, FCheckBox::FCheckBox (const FString& txt, FWidget* parent)
FWidget* parent ) : FToggleButton(txt, parent) : FToggleButton(txt, parent)
{ {
init(); init();
} }

View File

@ -388,8 +388,8 @@ void FListBox::drawList()
const wchar_t* element_str; const wchar_t* element_str;
uInt i, len; uInt i, len;
element = data[y+uInt(yoffset)].getText() element = data[y+uInt(yoffset)].getText()
.mid( uInt(1+xoffset), .mid ( uInt(1+xoffset)
uInt(width-nf_offset-4) ); , uInt(width-nf_offset-4) );
element_str = element.wc_str(); element_str = element.wc_str();
len = element.getLength(); len = element.getLength();

View File

@ -215,8 +215,7 @@ void FMenuBar::drawItems()
if ( x > screenWidth ) if ( x > screenWidth )
{ {
print ( vmenubar, print (vmenubar, txt.left(uInt(int(txt_length)+screenWidth-x-1)));
txt.left(uInt(int(txt_length)+screenWidth-x-1)) );
print (vmenubar, ".."); print (vmenubar, "..");
} }
else else

View File

@ -532,8 +532,8 @@ inline bool FOptiMove::isTwoDirectionMove ( int xold, int yold
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FOptiMove::isWideMove ( int xold, int yold, inline bool FOptiMove::isWideMove ( int xold, int yold
int xnew, int ynew ) , int xnew, int ynew )
{ {
return bool ( (xnew > MOVE_LIMIT) return bool ( (xnew > MOVE_LIMIT)
&& (xnew < screen_width - 1 - MOVE_LIMIT) && (xnew < screen_width - 1 - MOVE_LIMIT)

View File

@ -54,8 +54,8 @@ void FProgressbar::drawBar()
} }
else if ( getMaxColor() < 16 ) else if ( getMaxColor() < 16 )
{ {
setColor ( wc.progressbar_bg, setColor ( wc.progressbar_bg
wc.progressbar_fg ); , wc.progressbar_fg );
if ( round(length) >= 1) if ( round(length) >= 1)
print (' '); print (' ');
else else
@ -63,11 +63,11 @@ void FProgressbar::drawBar()
} }
if ( round(length) >= 1) if ( round(length) >= 1)
setColor( wc.progressbar_fg, setColor ( wc.progressbar_fg
parentWidget()->getBackgroundColor() ); , parentWidget()->getBackgroundColor() );
else else
setColor( wc.progressbar_bg, setColor ( wc.progressbar_bg
parentWidget()->getBackgroundColor() ); , parentWidget()->getBackgroundColor() );
if ( ! isMonochron() && getMaxColor() >= 16 ) if ( ! isMonochron() && getMaxColor() >= 16 )
{ {
@ -80,8 +80,8 @@ void FProgressbar::drawBar()
print (fc::RightHalfBlock); // ▐ print (fc::RightHalfBlock); // ▐
} }
setColor ( wc.progressbar_bg, setColor ( wc.progressbar_bg
wc.progressbar_fg ); , wc.progressbar_fg );
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
for (; i < trunc(length); i++) for (; i < trunc(length); i++)

View File

@ -11,7 +11,8 @@
// constructor and destructor // constructor and destructor
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRadioButton::FRadioButton(FWidget* parent) : FToggleButton(parent) FRadioButton::FRadioButton(FWidget* parent)
: FToggleButton(parent)
{ {
init(); init();
} }

View File

@ -169,19 +169,19 @@ FRect FRect::intersect (const FRect& r) const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRect operator + (const FRect& r, const FPoint& p) FRect operator + (const FRect& r, const FPoint& p)
{ {
return FRect( r.X1, return FRect ( r.X1
r.Y1, , r.Y1
r.X2 - r.X1 + 1 + p.getX(), , r.X2 - r.X1 + 1 + p.getX()
r.Y2 - r.Y1 + 1 + p.getY() ); , r.Y2 - r.Y1 + 1 + p.getY() );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FRect operator - (const FRect& r, const FPoint& p) FRect operator - (const FRect& r, const FPoint& p)
{ {
return FRect( r.X1, return FRect ( r.X1
r.Y1, , r.Y1
r.X2 - r.X1 + 1 - p.getX(), , r.X2 - r.X1 + 1 - p.getX()
r.Y2 - r.Y1 + 1 - p.getY() ); , r.Y2 - r.Y1 + 1 - p.getY() );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -261,8 +261,8 @@ void FStatusBar::drawKeys()
} }
else else
{ {
print ( vstatusbar, print ( vstatusbar
(*iter)->getText() , (*iter)->getText()
.left(uInt(txt_length+screenWidth-x-1)) ); .left(uInt(txt_length+screenWidth-x-1)) );
print (vstatusbar, ".."); print (vstatusbar, "..");
} }
@ -612,8 +612,8 @@ void FStatusBar::drawMessage()
print (vstatusbar, getMessage()); print (vstatusbar, getMessage());
else else
{ {
print ( vstatusbar, print ( vstatusbar
getMessage().left(uInt(msg_length+termWidth-x-1)) ); , getMessage().left(uInt(msg_length+termWidth-x-1)) );
print (vstatusbar, ".."); print (vstatusbar, "..");
} }
} }

View File

@ -742,9 +742,9 @@ const FString FString::operator + (const char c)
const FString operator + (const FString& s1, const FString& s2) const FString operator + (const FString& s1, const FString& s2)
{ {
FString tmp(s1); FString tmp(s1);
tmp._insert ( uInt(wcslen(s1.wc_str())), tmp._insert ( uInt(wcslen(s1.wc_str()))
uInt(wcslen(s2.wc_str())), , uInt(wcslen(s2.wc_str()))
s2.wc_str() ); , s2.wc_str() );
return (tmp); return (tmp);
} }

View File

@ -78,8 +78,8 @@ void FSwitch::drawCheckButton()
print (on); print (on);
setColor (wc.button_inactive_fg, wc.button_inactive_bg); setColor (wc.button_inactive_fg, wc.button_inactive_bg);
print (off); print (off);
setCursorPos ( xpos + xmin + 1 + switch_offset_pos, setCursorPos ( xpos + xmin + 1 + switch_offset_pos
ypos + ymin - 1 ); , ypos + ymin - 1 );
} }
else else
{ {
@ -101,8 +101,8 @@ void FSwitch::drawCheckButton()
else else
setColor (wc.button_hotkey_fg, wc.button_active_bg); setColor (wc.button_hotkey_fg, wc.button_active_bg);
print (off); print (off);
setCursorPos ( xpos + xmin + 5 + switch_offset_pos, setCursorPos ( xpos + xmin + 5 + switch_offset_pos
ypos + ymin - 1 ); , ypos + ymin - 1 );
} }
} }

View File

@ -308,8 +308,9 @@ int FTerm::getScreenFont()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTerm::setScreenFont (uChar* fontdata, uInt count, int FTerm::setScreenFont ( uChar* fontdata, uInt count
uInt fontwidth, uInt fontheight, bool direct) , uInt fontwidth, uInt fontheight
, bool direct)
{ {
struct console_font_op font; struct console_font_op font;
int ret; int ret;
@ -347,9 +348,9 @@ int FTerm::setScreenFont (uChar* fontdata, uInt count,
memset(font.data, 0, data_size); memset(font.data, 0, data_size);
for (uInt i=0; i < count; i++) for (uInt i=0; i < count; i++)
memcpy ( const_cast<uChar*>(font.data + bytes_per_line*32*i), memcpy ( const_cast<uChar*>(font.data + bytes_per_line*32*i)
&fontdata[i * font.height], , &fontdata[i * font.height]
font.height); , font.height);
} }
// font operation // font operation
ret = ioctl (fd_tty, KDFONTOP, &font); ret = ioctl (fd_tty, KDFONTOP, &font);
@ -2440,11 +2441,11 @@ bool FTerm::setOldFont()
{ {
if ( screenFont.data ) if ( screenFont.data )
{ {
int ret = setScreenFont ( screenFont.data, int ret = setScreenFont ( screenFont.data
screenFont.charcount, , screenFont.charcount
screenFont.width, , screenFont.width
screenFont.height, , screenFont.height
true ); , true );
delete[] screenFont.data; delete[] screenFont.data;
if ( ret == 0 ) if ( ret == 0 )
retval = true; retval = true;

View File

@ -28,7 +28,8 @@ class Mandelbrot : public FDialog
#pragma pack(pop) #pragma pack(pop)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Mandelbrot::Mandelbrot (FWidget* parent) : FDialog(parent) Mandelbrot::Mandelbrot (FWidget* parent)
: FDialog(parent)
{ {
setText ("Mandelbrot set"); setText ("Mandelbrot set");
} }