My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

save_settings_dialog_box.cpp 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /********************************
  2. * save_settings_dialog_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: <http://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #include "../config.h"
  22. #if ENABLED(TOUCH_UI_FTDI_EVE)
  23. #include "screens.h"
  24. using namespace ExtUI;
  25. bool SaveSettingsDialogBox::needs_save = false;
  26. void SaveSettingsDialogBox::onRedraw(draw_mode_t) {
  27. drawMessage(GET_TEXT_F(MSG_EEPROM_SAVE_PROMPT));
  28. drawYesNoButtons();
  29. }
  30. bool SaveSettingsDialogBox::onTouchEnd(uint8_t tag) {
  31. needs_save = false;
  32. switch (tag) {
  33. case 1:
  34. injectCommands_P(PSTR("M500"));
  35. AlertDialogBox::show(GET_TEXT_F(MSG_EEPROM_SAVED));
  36. // Remove SaveSettingsDialogBox from the stack
  37. // so the alert box doesn't return to me.
  38. current_screen.forget();
  39. return true;
  40. default:
  41. return DialogBoxBaseClass::onTouchEnd(tag);
  42. }
  43. }
  44. void SaveSettingsDialogBox::promptToSaveSettings() {
  45. if (needs_save) {
  46. // Remove current screen from the stack
  47. // so SaveSettingsDialogBox doesn't return here.
  48. GOTO_SCREEN(SaveSettingsDialogBox);
  49. current_screen.forget();
  50. } else {
  51. // No save needed.
  52. GOTO_PREVIOUS();
  53. }
  54. }
  55. #endif // TOUCH_UI_FTDI_EVE