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.

dwin_popup.h 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  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. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * DWIN UI Enhanced implementation
  25. * Author: Miguel A. Risco-Castillo (MRISCOC)
  26. * Version: 3.10.1
  27. * Date: 2022/01/21
  28. *
  29. * Based on the original code provided by Creality under GPL
  30. */
  31. #include "dwinui.h"
  32. #include "dwin.h"
  33. // Popup windows
  34. void Draw_Select_Highlight(const bool sel);
  35. inline void Draw_Popup_Bkgd() {
  36. DWIN_Draw_Rectangle(1, HMI_data.PopupBg_color, 14, 60, 258, 330);
  37. DWIN_Draw_Rectangle(0, HMI_data.Highlight_Color, 14, 60, 258, 330);
  38. }
  39. template<typename T, typename U>
  40. void DWIN_Draw_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) {
  41. DWINUI::ClearMenuArea();
  42. Draw_Popup_Bkgd();
  43. if (icon) DWINUI::Draw_Icon(icon, 101, 105);
  44. if (amsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, amsg1);
  45. if (amsg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, amsg2);
  46. if (button) DWINUI::Draw_IconWB(button, 86, 280);
  47. }
  48. template<typename T, typename U>
  49. void DWIN_Show_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) {
  50. DWIN_Draw_Popup(icon, amsg1, amsg2, button);
  51. DWIN_UpdateLCD();
  52. }
  53. template<typename T, typename U>
  54. void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) {
  55. HMI_SaveProcessID(WaitResponse);
  56. DWIN_Draw_Popup(icon, amsg1, amsg2, ICON_Confirm_E); // Button Confirm
  57. DWIN_UpdateLCD();
  58. }
  59. void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2);
  60. void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2);