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.

about_screen.cpp 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /********************
  2. * about_screen.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. #if ENABLED(TOUCH_UI_FTDI_EVE)
  23. #include "screens.h"
  24. #define GRID_COLS 4
  25. #define GRID_ROWS 7
  26. using namespace FTDI;
  27. using namespace Theme;
  28. using namespace ExtUI;
  29. void AboutScreen::onEntry() {
  30. BaseScreen::onEntry();
  31. sound.play(chimes, PLAY_ASYNCHRONOUS);
  32. }
  33. void AboutScreen::onRedraw(draw_mode_t) {
  34. CommandProcessor cmd;
  35. cmd.cmd(CLEAR_COLOR_RGB(bg_color))
  36. .cmd(CLEAR(true,true,true))
  37. .cmd(COLOR_RGB(bg_text_enabled))
  38. .tag(0);
  39. #define HEADING_POS BTN_POS(1,2), BTN_SIZE(4,1)
  40. #define FW_VERS_POS BTN_POS(1,3), BTN_SIZE(4,1)
  41. #define FW_INFO_POS BTN_POS(1,4), BTN_SIZE(4,1)
  42. #define LICENSE_POS BTN_POS(1,5), BTN_SIZE(4,2)
  43. #define STATS_POS BTN_POS(1,7), BTN_SIZE(2,1)
  44. #define BACK_POS BTN_POS(3,7), BTN_SIZE(2,1)
  45. #define _INSET_POS(x,y,w,h) x + w/10, y, w - w/5, h
  46. #define INSET_POS(pos) _INSET_POS(pos)
  47. char about_str[1
  48. + strlen_P(GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2))
  49. #ifdef TOOLHEAD_NAME
  50. + strlen_P(TOOLHEAD_NAME)
  51. #endif
  52. ];
  53. #ifdef TOOLHEAD_NAME
  54. // If MSG_ABOUT_TOUCH_PANEL_2 has %s, substitute in the toolhead name.
  55. // But this is optional, so squelch the compiler warning here.
  56. #pragma GCC diagnostic push
  57. #pragma GCC diagnostic ignored "-Wformat-extra-args"
  58. sprintf_P(about_str, GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2), TOOLHEAD_NAME);
  59. #pragma GCC diagnostic pop
  60. #else
  61. strcpy_P(about_str, GET_TEXT(MSG_ABOUT_TOUCH_PANEL_2));
  62. #endif
  63. draw_text_box(cmd, HEADING_POS,
  64. #ifdef CUSTOM_MACHINE_NAME
  65. F(CUSTOM_MACHINE_NAME)
  66. #else
  67. GET_TEXT_F(MSG_ABOUT_TOUCH_PANEL_1)
  68. #endif
  69. , OPT_CENTER, font_xlarge
  70. );
  71. cmd.tag(3);
  72. draw_text_box(cmd, FW_VERS_POS,
  73. #ifdef TOUCH_UI_VERSION
  74. F(TOUCH_UI_VERSION)
  75. #else
  76. progmem_str(getFirmwareName_str())
  77. #endif
  78. , OPT_CENTER, font_medium);
  79. cmd.tag(0);
  80. draw_text_box(cmd, FW_INFO_POS, about_str, OPT_CENTER, font_medium);
  81. draw_text_box(cmd, INSET_POS(LICENSE_POS), GET_TEXT_F(MSG_LICENSE), OPT_CENTER, font_tiny);
  82. cmd.font(font_medium)
  83. .colors(normal_btn)
  84. .tag(2).button(STATS_POS, GET_TEXT_F(MSG_INFO_STATS_MENU))
  85. .colors(action_btn)
  86. .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK));
  87. }
  88. bool AboutScreen::onTouchEnd(uint8_t tag) {
  89. switch (tag) {
  90. case 1: GOTO_PREVIOUS(); break;
  91. #if ENABLED(PRINTCOUNTER)
  92. case 2: GOTO_SCREEN(StatisticsScreen); break;
  93. #endif
  94. #if ENABLED(TOUCH_UI_DEVELOPER_MENU)
  95. case 3: GOTO_SCREEN(DeveloperMenu); break;
  96. #endif
  97. default: return false;
  98. }
  99. return true;
  100. }
  101. #endif // TOUCH_UI_FTDI_EVE