My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

dialog_box_base_class.cpp 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*****************************
  2. * dialog_box_base_class.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 FTDI;
  25. using namespace Theme;
  26. #define GRID_COLS 2
  27. #define GRID_ROWS 8
  28. template<typename T>
  29. void DialogBoxBaseClass::drawMessage(const T message, int16_t font) {
  30. CommandProcessor cmd;
  31. cmd.cmd(CMD_DLSTART)
  32. .cmd(CLEAR_COLOR_RGB(bg_color))
  33. .cmd(CLEAR(true,true,true))
  34. .cmd(COLOR_RGB(bg_text_enabled))
  35. .tag(0);
  36. draw_text_box(cmd, BTN_POS(1,1), BTN_SIZE(2,3), message, OPT_CENTER, font ? font : font_large);
  37. cmd.colors(normal_btn);
  38. }
  39. template void DialogBoxBaseClass::drawMessage(const char *, int16_t font);
  40. template void DialogBoxBaseClass::drawMessage(progmem_str, int16_t font);
  41. void DialogBoxBaseClass::drawYesNoButtons(uint8_t default_btn) {
  42. CommandProcessor cmd;
  43. cmd.font(font_medium)
  44. .colors(default_btn == 1 ? action_btn : normal_btn).tag(1).button( BTN_POS(1,8), BTN_SIZE(1,1), GET_TEXT_F(MSG_YES))
  45. .colors(default_btn == 2 ? action_btn : normal_btn).tag(2).button( BTN_POS(2,8), BTN_SIZE(1,1), GET_TEXT_F(MSG_NO));
  46. }
  47. void DialogBoxBaseClass::drawOkayButton() {
  48. CommandProcessor cmd;
  49. cmd.font(font_medium)
  50. .tag(1).button( BTN_POS(1,8), BTN_SIZE(2,1), GET_TEXT_F(MSG_BUTTON_OKAY));
  51. }
  52. void DialogBoxBaseClass::drawButton(const progmem_str label) {
  53. CommandProcessor cmd;
  54. cmd.font(font_medium)
  55. .tag(1).button( BTN_POS(1,8), BTN_SIZE(2,1), label);
  56. }
  57. void DialogBoxBaseClass::drawSpinner() {
  58. CommandProcessor cmd;
  59. cmd.cmd(COLOR_RGB(bg_text_enabled))
  60. .spinner(BTN_POS(1,4), BTN_SIZE(2,3)).execute();
  61. }
  62. bool DialogBoxBaseClass::onTouchEnd(uint8_t tag) {
  63. switch (tag) {
  64. case 1: GOTO_PREVIOUS(); return true;
  65. case 2: GOTO_PREVIOUS(); return true;
  66. default: return false;
  67. }
  68. }
  69. void DialogBoxBaseClass::onIdle() {
  70. reset_menu_timeout();
  71. }
  72. #endif // TOUCH_UI_FTDI_EVE