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.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 Enhanced implementation for PRO UI
  25. * Author: Miguel A. Risco-Castillo (MRISCOC)
  26. * Version: 3.11.1
  27. * Date: 2022/02/28
  28. */
  29. #include "dwinui.h"
  30. #include "dwin.h"
  31. typedef void (*popupDrawFunc_t)();
  32. typedef void (*popupClickFunc_t)();
  33. typedef void (*popupChangeFunc_t)(const bool state);
  34. extern popupDrawFunc_t popupDraw;
  35. void Draw_Select_Highlight(const bool sel, const uint16_t ypos);
  36. inline void Draw_Select_Highlight(const bool sel) { Draw_Select_Highlight(sel, 280); };
  37. void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2);
  38. void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2);
  39. void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick=nullptr, const popupChangeFunc_t fnChange=nullptr);
  40. void HMI_Popup();
  41. inline void Draw_Popup_Bkgd() {
  42. DWIN_Draw_Rectangle(1, HMI_data.PopupBg_color, 14, 60, 258, 330);
  43. DWIN_Draw_Rectangle(0, HMI_data.Highlight_Color, 14, 60, 258, 330);
  44. }
  45. template<typename T, typename U>
  46. void DWIN_Draw_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) {
  47. DWINUI::ClearMainArea();
  48. Draw_Popup_Bkgd();
  49. if (icon) DWINUI::Draw_Icon(icon, 101, 105);
  50. if (amsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, amsg1);
  51. if (amsg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, amsg2);
  52. if (button) DWINUI::Draw_Button(button, 86, 280);
  53. }
  54. template<typename T, typename U>
  55. void DWIN_Show_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) {
  56. DWIN_Draw_Popup(icon, amsg1, amsg2, button);
  57. DWIN_UpdateLCD();
  58. }
  59. template<typename T, typename U>
  60. void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) {
  61. HMI_SaveProcessID(WaitResponse);
  62. DWIN_Draw_Popup(icon, amsg1, amsg2, BTN_Confirm); // Button Confirm
  63. DWIN_UpdateLCD();
  64. }