My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

confirm_user_request_alert_box.cpp 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**************************************
  2. * confirm_user_request_alert_box.cpp *
  3. **************************************/
  4. /****************************************************************************
  5. * Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
  6. * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
  7. * *
  8. * This program is free software: you can redistribute it and/or modify *
  9. * it under the terms of the GNU General Public License as published by *
  10. * the Free Software Foundation, either version 3 of the License, or *
  11. * (at your option) any later version. *
  12. * *
  13. * This program is distributed in the hope that it will be useful, *
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  16. * GNU General Public License for more details. *
  17. * *
  18. * To view a copy of the GNU General Public License, go to the following *
  19. * location: <https://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #include "../config.h"
  22. #include "../screens.h"
  23. #include "../screen_data.h"
  24. #ifdef FTDI_CONFIRM_USER_REQUEST_ALERT_BOX
  25. using namespace FTDI;
  26. void ConfirmUserRequestAlertBox::onRedraw(draw_mode_t mode) {
  27. AlertDialogBox::onRedraw(mode); // Required for the GOTO_SCREEN function to work
  28. }
  29. bool ConfirmUserRequestAlertBox::onTouchEnd(uint8_t tag) {
  30. switch (tag) {
  31. case 1:
  32. #ifdef FTDI_TUNE_MENU
  33. if (ExtUI::isPrintingPaused()) {
  34. // The TuneMenu will call ExtUI::setUserConfirmed()
  35. GOTO_SCREEN(TuneMenu);
  36. current_screen.forget();
  37. }
  38. else
  39. #endif
  40. {
  41. ExtUI::setUserConfirmed();
  42. GOTO_PREVIOUS();
  43. }
  44. return true;
  45. case 2: GOTO_PREVIOUS(); return true;
  46. default: return false;
  47. }
  48. }
  49. void ConfirmUserRequestAlertBox::show(const char *msg) {
  50. drawMessage(msg);
  51. storeBackground();
  52. screen_data.AlertDialogBox.isError = false;
  53. if (!AT_SCREEN(ConfirmUserRequestAlertBox))
  54. GOTO_SCREEN(ConfirmUserRequestAlertBox);
  55. }
  56. void ConfirmUserRequestAlertBox::hide() {
  57. if (AT_SCREEN(ConfirmUserRequestAlertBox))
  58. GOTO_PREVIOUS();
  59. }
  60. #endif // FTDI_CONFIRM_USER_REQUEST_ALERT_BOX