Start with Capture Route
This commit is contained in:
+15
-28
@@ -23,29 +23,24 @@ void Menu::addEntry(MenuAction* entry) {
|
||||
|
||||
void Menu::printMenu() {
|
||||
if (this->lcd) {
|
||||
MenuAction* selectedEntry = *(this->it);
|
||||
lcd->clear();
|
||||
lcd->setCursor(0, 0);
|
||||
lcd->print("-> ");
|
||||
lcd->print(selectedEntry->getName());
|
||||
lcd->print((**this->it).getName());
|
||||
lcd->setCursor(0, 1);
|
||||
std::list<MenuAction*>::iterator iter = this->it;
|
||||
iter++;
|
||||
if (iter != this->entrys.end()) {
|
||||
selectedEntry = *iter;
|
||||
lcd->print(selectedEntry->getName());
|
||||
} else {
|
||||
selectedEntry = *this->entrys.begin();
|
||||
lcd->print(selectedEntry->getName());
|
||||
}
|
||||
lcd->print((**iter).getName());
|
||||
} else
|
||||
lcd->print((*this->entrys.begin())->getName());
|
||||
} else {
|
||||
std::cout << std::endl;
|
||||
for (std::list<MenuAction*>::iterator iter = this->entrys.begin(); iter != this->entrys.end(); iter++) {
|
||||
MenuAction* selectedEntry = *(iter);
|
||||
if (this->it == iter)
|
||||
std::cout << " " << selectedEntry->getName() << std::endl;
|
||||
std::cout << " " << (**iter).getName() << std::endl;
|
||||
else
|
||||
std::cout << selectedEntry->getName() << std::endl;
|
||||
std::cout << (**iter).getName() << std::endl;
|
||||
}
|
||||
}
|
||||
this->inSubmenu = false;
|
||||
@@ -53,8 +48,7 @@ void Menu::printMenu() {
|
||||
|
||||
void Menu::down() {
|
||||
if (this->inSubmenu) {
|
||||
MenuAction* selectedEntry = *(this->it);
|
||||
selectedEntry->getMenu()->down();
|
||||
(**this->it).getMenu()->down();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,8 +64,7 @@ void Menu::down() {
|
||||
|
||||
void Menu::up() {
|
||||
if (this->inSubmenu) {
|
||||
MenuAction* selectedEntry = *(this->it);
|
||||
selectedEntry->getMenu()->up();
|
||||
(**this->it).getMenu()->up();
|
||||
return;
|
||||
}
|
||||
std::list<MenuAction*>::iterator iter = this->entrys.end();
|
||||
@@ -86,25 +79,21 @@ void Menu::up() {
|
||||
}
|
||||
|
||||
void Menu::right() {
|
||||
// TODO: find out why i cannot call runAction() directly from the iterator
|
||||
MenuAction* selectedEntry = *(this->it);
|
||||
|
||||
if (this->inSubmenu) {
|
||||
selectedEntry->getMenu()->right();
|
||||
(**this->it).getMenu()->right();
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedEntry->getIsMenu()) {
|
||||
if ((**this->it).getIsMenu()) {
|
||||
this->inSubmenu = true;
|
||||
selectedEntry->getMenu()->setParentMenu(this);
|
||||
(**this->it).getMenu()->setParentMenu(this);
|
||||
}
|
||||
selectedEntry->runAction();
|
||||
(**this->it).runAction();
|
||||
}
|
||||
|
||||
void Menu::left() {
|
||||
if (this->inSubmenu) {
|
||||
MenuAction* selectedEntry = *(this->it);
|
||||
selectedEntry->getMenu()->left();
|
||||
(**this->it).getMenu()->left();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,8 +103,7 @@ void Menu::left() {
|
||||
|
||||
void Menu::yes() {
|
||||
if (this->inSubmenu) {
|
||||
MenuAction* selectedEntry = *(this->it);
|
||||
selectedEntry->getMenu()->yes();
|
||||
(**this->it).getMenu()->yes();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -124,8 +112,7 @@ void Menu::yes() {
|
||||
|
||||
void Menu::no() {
|
||||
if (this->inSubmenu) {
|
||||
MenuAction* selectedEntry = *(this->it);
|
||||
selectedEntry->getMenu()->no();
|
||||
(**this->it).getMenu()->no();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user