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_start_print_dialog_box.cpp 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**************************************
  2. * confirm_start_print_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: <https://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #include "../config.h"
  22. #include "../screens.h"
  23. #include "../screen_data.h"
  24. #ifdef FTDI_CONFIRM_START_PRINT_DIALOG_BOX
  25. using namespace FTDI;
  26. using namespace Theme;
  27. using namespace ExtUI;
  28. constexpr static ConfirmStartPrintDialogBoxData &mydata = screen_data.ConfirmStartPrintDialogBox;
  29. void ConfirmStartPrintDialogBox::onRedraw(draw_mode_t) {
  30. const char *filename = getFilename();
  31. char buffer[strlen_P(GET_TEXT(MSG_START_PRINT_CONFIRMATION)) + strlen(filename) + 1];
  32. sprintf_P(buffer, GET_TEXT(MSG_START_PRINT_CONFIRMATION), filename);
  33. drawMessage((const char *)buffer);
  34. drawYesNoButtons(1);
  35. }
  36. bool ConfirmStartPrintDialogBox::onTouchEnd(uint8_t tag) {
  37. switch (tag) {
  38. case 1:
  39. printFile(getShortFilename());
  40. StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PRINT_STARTING));
  41. GOTO_SCREEN(StatusScreen);
  42. return true;
  43. case 2: GOTO_PREVIOUS(); return true;
  44. default: return false;
  45. }
  46. }
  47. const char *ConfirmStartPrintDialogBox::getFilename(bool shortName) {
  48. FileList files;
  49. files.seek(mydata.file_index, true);
  50. return shortName ? files.shortFilename() : files.filename();
  51. }
  52. void ConfirmStartPrintDialogBox::show(uint8_t file_index) {
  53. mydata.file_index = file_index;
  54. GOTO_SCREEN(ConfirmStartPrintDialogBox);
  55. }
  56. #endif // FTDI_CONFIRM_START_PRINT_DIALOG_BOX