void System::showCompletion(bool success) { if (success) { _output->setStatus("Done - press back [<-]"); } else { printErrorLine(); _output->setStatus("Error - see console"); showSystemScreen(true); } _output->flush(true); }
// handle the system menu void Controller::handleMenu(int menuId) { int fontSize = _output->getFontSize(); _systemMenu = false; switch (menuId) { case MENU_SOURCE: showSystemScreen(true); break; case MENU_CONSOLE: showSystemScreen(false); break; case MENU_KEYPAD: maShowVirtualKeyboard(); break; case MENU_ZOOM_UP: if (_fontScale > FONT_MIN) { _fontScale -= FONT_SCALE_INTERVAL; fontSize = (_initialFontSize * _fontScale / 100); } break; case MENU_ZOOM_DN: if (_fontScale < FONT_MAX) { _fontScale += FONT_SCALE_INTERVAL; fontSize = (_initialFontSize * _fontScale / 100); } break; } if (fontSize != _output->getFontSize()) { _output->setFontSize(fontSize); // restart the shell buttonClicked("main.bas"); brun_break(); _runMode = break_state; } if (!isRunning()) { _output->flush(true); } }
void System::runLive(const char *startupBas) { logEntered(); _mainBas = false; while (!isBack() && !isClosing()) { bool success = execute(startupBas); if (isClosing()) { break; } else if (!success) { showSystemScreen(true); _output->selectBackScreen(CONSOLE_SCREEN); _output->flush(true); waitForChange(true); } else { _state = kActiveState; waitForChange(false); } } }
void System::handleMenu(MAEvent &event) { int menuId = event.optionsBoxButtonIndex; int fontSize = _output->getFontSize(); int menuItem = _systemMenu[menuId]; delete [] _systemMenu; _systemMenu = NULL; switch (menuItem) { case MENU_SOURCE: showSystemScreen(true); break; case MENU_CONSOLE: showSystemScreen(false); break; case MENU_KEYPAD: maShowVirtualKeyboard(); break; case MENU_RESTART: setRestart(); break; case MENU_BACK: setBack(); break; case MENU_ZOOM_UP: if (_fontScale > FONT_MIN) { _fontScale -= FONT_SCALE_INTERVAL; fontSize = (_initialFontSize * _fontScale / 100); } break; case MENU_ZOOM_DN: if (_fontScale < FONT_MAX) { _fontScale += FONT_SCALE_INTERVAL; fontSize = (_initialFontSize * _fontScale / 100); } break; case MENU_COPY: case MENU_CUT: if (get_focus_edit() != NULL) { char *text = get_focus_edit()->copy(menuItem == MENU_CUT); if (text) { setClipboardText(text); free(text); _output->redraw(); } } break; case MENU_PASTE: if (get_focus_edit() != NULL) { char *text = getClipboardText(); get_focus_edit()->paste(text); _output->redraw(); free(text); } break; case MENU_SELECT_ALL: if (get_focus_edit() != NULL) { get_focus_edit()->selectAll(); _output->redraw(); } break; case MENU_CTRL_MODE: if (get_focus_edit() != NULL) { bool controlMode = get_focus_edit()->getControlMode(); get_focus_edit()->setControlMode(!controlMode); } break; case MENU_EDITMODE: opt_ide = (opt_ide == IDE_NONE ? IDE_INTERNAL : IDE_NONE); break; case MENU_AUDIO: opt_mute_audio = !opt_mute_audio; break; case MENU_SCREENSHOT: ::screen_dump(); break; case MENU_UNDO: event.type = EVENT_TYPE_KEY_PRESSED; event.key = SB_KEY_CTRL('z'); break; case MENU_REDO: event.type = EVENT_TYPE_KEY_PRESSED; event.key = SB_KEY_CTRL('y'); break; case MENU_SAVE: event.type = EVENT_TYPE_KEY_PRESSED; event.key = SB_KEY_CTRL('s'); break; case MENU_RUN: event.type = EVENT_TYPE_KEY_PRESSED; event.key = SB_KEY_F(9); break; case MENU_DEBUG: event.type = EVENT_TYPE_KEY_PRESSED; event.key = SB_KEY_F(5); break; case MENU_OUTPUT: event.type = EVENT_TYPE_KEY_PRESSED; event.key = SB_KEY_CTRL('o'); break; case MENU_HELP: event.type = EVENT_TYPE_KEY_PRESSED; event.key = SB_KEY_F(1); break; case MENU_SHORTCUT: if (!_activeFile.empty()) { addShortcut(_activeFile.c_str()); } break; case MENU_SHARE: if (!_activeFile.empty()) { share(_activeFile.c_str()); } break; case MENU_COMPLETION_0: completeKeyword(0); break; case MENU_COMPLETION_1: completeKeyword(1); break; case MENU_COMPLETION_2: completeKeyword(2); break; case MENU_COMPLETION_3: completeKeyword(3); break; } if (fontSize != _output->getFontSize()) { // restart the shell _output->setFontSize(fontSize); setRestart(); } if (!isRunning()) { _output->flush(true); } }
void Controller::showError() { _runMode = init_state; _loadPath.empty(); showSystemScreen(false); }