CursesDialog: don't use else after return

This commit is contained in:
Daniel Pfeifer 2016-08-18 19:39:54 +02:00
parent 11e0ceaeab
commit 4988b914e1
4 changed files with 27 additions and 32 deletions

View File

@ -40,9 +40,8 @@ bool cmCursesBoolWidget::HandleInput(int& key, cmCursesMainForm* /*fm*/,
touchwin(w); touchwin(w);
wrefresh(w); wrefresh(w);
return true; return true;
} else {
return false;
} }
return false;
} }
void cmCursesBoolWidget::SetValueAsBool(bool value) void cmCursesBoolWidget::SetValueAsBool(bool value)

View File

@ -110,7 +110,6 @@ const char* cmCursesCacheEntryComposite::GetValue()
{ {
if (this->Label) { if (this->Label) {
return this->Label->GetValue(); return this->Label->GetValue();
} else { }
return CM_NULLPTR; return CM_NULLPTR;
} }
}

View File

@ -13,10 +13,7 @@
#include "cmCursesMainForm.h" #include "cmCursesMainForm.h"
inline int ctrl(int z) #define ctrl(z) ((z)&037)
{
return (z & 037);
}
cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left, cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left,
int top) int top)
@ -34,24 +31,26 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left,
bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm* /*fm*/, bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm* /*fm*/,
WINDOW* w) WINDOW* w)
{ {
switch (key) {
// 10 == enter case 10: // 10 == enter
if (key == 10 || key == KEY_ENTER) { case KEY_ENTER:
this->NextOption(); this->NextOption();
touchwin(w); touchwin(w);
wrefresh(w); wrefresh(w);
return true; return true;
} else if (key == KEY_LEFT || key == ctrl('b')) { case KEY_LEFT:
case ctrl('b'):
touchwin(w); touchwin(w);
wrefresh(w); wrefresh(w);
this->PreviousOption(); this->PreviousOption();
return true; return true;
} else if (key == KEY_RIGHT || key == ctrl('f')) { case KEY_RIGHT:
case ctrl('f'):
this->NextOption(); this->NextOption();
touchwin(w); touchwin(w);
wrefresh(w); wrefresh(w);
return true; return true;
} else { default:
return false; return false;
} }
} }

View File

@ -94,11 +94,10 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
// quit // quit
if (key == 'q') { if (key == 'q') {
return false; return false;
} else { }
key = getch(); key = getch();
continue; continue;
} }
}
// If resize occurred during edit, move out of edit mode // If resize occurred during edit, move out of edit mode
if (!this->InEdit && (key != 10 && key != KEY_ENTER && key != 'i')) { if (!this->InEdit && (key != 10 && key != KEY_ENTER && key != 'i')) {
@ -207,7 +206,6 @@ bool cmCursesStringWidget::PrintKeys()
curses_move(y - 3, 0); curses_move(y - 3, 0);
printw(fmt_s, "Editing option, press [enter] to leave edit."); printw(fmt_s, "Editing option, press [enter] to leave edit.");
return true; return true;
} else { }
return false; return false;
} }
}