InkHUD refactoring (#6216)

* chore: todo.txt
* chore: comments
* fix: no fast refresh on VME290
Reverts a line of code which was accidentally committed
* refactor: god class
Divide the behavior from the old WindowManager class into several subclasses which each have a clear role.
* refactor: cppcheck medium warnings
Enough to pass github CI for now
* refactor: updateType selection
* refactor: don't use a setter for the shared AppletFonts
* fix: update prioritization
forceUpdate calls weren't being prioritized
* refactor: remove unhelpful logging
getTimeString is used for parsing our own time, but also the timestamps of messages. The "one time only" log printing will likely fire in unhelpful situations.
* fix: " "
* refactor: get rid of types.h file for enums
* Keep that sneaky todo file out of commits
This commit is contained in:
todd-herbert
2025-03-06 11:25:41 +01:00
committed by GitHub
parent b2ef92a328
commit e6a98b1d6b
70 changed files with 2381 additions and 1955 deletions
+18 -21
View File
@@ -14,47 +14,44 @@
#include "configuration.h"
#include "./Applet.h"
#include "./Types.h"
#include "./WindowManager.h"
#include <GFX.h>
#include "./InkHUD.h"
namespace NicheGraphics::InkHUD
{
class Applet;
class WindowManager;
class Tile
{
public:
Tile();
void placeUserTile(uint8_t layoutSize, uint8_t tileIndex); // Assign region automatically, based on layout
void placeSystemTile(int16_t left, int16_t top, uint16_t width, uint16_t height); // Assign region manually
void handleAppletPixel(int16_t x, int16_t y, Color c); // Receive px output from assigned applet
uint16_t getWidth(); // Used to set the assigned applet's width before render
uint16_t getHeight(); // Used to set the assigned applet's height before render
Tile(int16_t left, int16_t top, uint16_t width, uint16_t height);
void setRegion(uint8_t layoutSize, uint8_t tileIndex); // Assign region automatically, based on layout
void setRegion(int16_t left, int16_t top, uint16_t width, uint16_t height); // Assign region manually
void handleAppletPixel(int16_t x, int16_t y, Color c); // Receive px output from assigned applet
uint16_t getWidth();
uint16_t getHeight();
static uint16_t maxDisplayDimension(); // Largest possible width / height any tile may ever encounter
void assignApplet(Applet *a); // Place an applet onto a tile
Applet *getAssignedApplet(); // Applet which is on a tile
void assignApplet(Applet *a); // Link an applet with this tile
Applet *getAssignedApplet(); // Applet which is currently linked with this tile
void requestHighlight(); // Ask for this tile to be highlighted
static void startHighlightTimeout(); // Start the auto-dismissal timer
static void cancelHighlightTimeout(); // Cancel the auto-dismissal timer early; already dismissed
static Tile *highlightTarget; // Which tile are we highlighting? (Intending to highlight?)
static bool highlightShown; // Is the tile highlighted yet? Controlls highlight vs dismiss
static bool highlightShown; // Is the tile highlighted yet? Controls highlight vs dismiss
protected:
int16_t left;
int16_t top;
uint16_t width;
uint16_t height;
private:
InkHUD *inkhud = nullptr;
int16_t left = 0;
int16_t top = 0;
uint16_t width = 0;
uint16_t height = 0;
Applet *assignedApplet = nullptr; // Pointer to the applet which is currently linked with the tile
WindowManager *windowManager; // Convenient access to the WindowManager singleton
};
} // namespace NicheGraphics::InkHUD