diff options
Diffstat (limited to '')
-rw-r--r-- | screen_ui.h | 73 |
1 files changed, 44 insertions, 29 deletions
diff --git a/screen_ui.h b/screen_ui.h index 01a33bfe2..ea05bf15f 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -18,6 +18,7 @@ #define RECOVERY_SCREEN_UI_H #include <pthread.h> +#include <stdio.h> #include "ui.h" #include "minui/minui.h" @@ -47,18 +48,23 @@ class ScreenRecoveryUI : public RecoveryUI { bool WasTextEverVisible(); // printing messages - void Print(const char* fmt, ...); // __attribute__((format(printf, 1, 2))); + void Print(const char* fmt, ...) __printflike(2, 3); + void ShowFile(const char* filename); // menu display void StartMenu(const char* const * headers, const char* const * items, - int initial_selection); + int initial_selection); int SelectMenu(int sel); void EndMenu(); + void KeyLongPress(int); + void Redraw(); - enum UIElement { HEADER, MENU, MENU_SEL_BG, MENU_SEL_FG, LOG, TEXT_FILL }; - virtual void SetColor(UIElement e); + enum UIElement { + HEADER, MENU, MENU_SEL_BG, MENU_SEL_BG_ACTIVE, MENU_SEL_FG, LOG, TEXT_FILL, INFO + }; + void SetColor(UIElement e); private: Icon currentIcon; @@ -67,43 +73,43 @@ class ScreenRecoveryUI : public RecoveryUI { bool rtl_locale; pthread_mutex_t updateMutex; - gr_surface backgroundIcon[5]; - gr_surface backgroundText[5]; - gr_surface *installation; - gr_surface progressBarEmpty; - gr_surface progressBarFill; - gr_surface stageMarkerEmpty; - gr_surface stageMarkerFill; + GRSurface* backgroundIcon[5]; + GRSurface* backgroundText[5]; + GRSurface** installation; + GRSurface* progressBarEmpty; + GRSurface* progressBarFill; + GRSurface* stageMarkerEmpty; + GRSurface* stageMarkerFill; ProgressType progressBarType; float progressScopeStart, progressScopeSize, progress; double progressScopeTime, progressScopeDuration; - // true when both graphics pages are the same (except for the - // progress bar) + // true when both graphics pages are the same (except for the progress bar). bool pagesIdentical; - static const int kMaxCols = 96; - static const int kMaxRows = 96; + size_t text_cols_, text_rows_; + + // Log text overlay, displayed when a magic key is pressed. + char** text_; + size_t text_col_, text_row_, text_top_; - // Log text overlay, displayed when a magic key is pressed - char text[kMaxRows][kMaxCols]; - int text_cols, text_rows; - int text_col, text_row, text_top; bool show_text; bool show_text_ever; // has show_text ever been true? - char menu[kMaxRows][kMaxCols]; + char** menu_; + const char* const* menu_headers_; bool show_menu; - int menu_top, menu_items, menu_sel; + int menu_items, menu_sel; - pthread_t progress_t; + // An alternate text screen, swapped with 'text_' when we're viewing a log file. + char** file_viewer_text_; + + pthread_t progress_thread_; int animation_fps; int installing_frames; - protected: - private: int iconX, iconY; @@ -114,12 +120,21 @@ class ScreenRecoveryUI : public RecoveryUI { void draw_screen_locked(); void update_screen_locked(); void update_progress_locked(); - static void* progress_thread(void* cookie); - void progress_loop(); - void LoadBitmap(const char* filename, gr_surface* surface); - void LoadBitmapArray(const char* filename, int* frames, gr_surface** surface); - void LoadLocalizedBitmap(const char* filename, gr_surface* surface); + static void* ProgressThreadStartRoutine(void* data); + void ProgressThreadLoop(); + + void ShowFile(FILE*); + void PutChar(char); + void ClearText(); + + void DrawHorizontalRule(int* y); + void DrawTextLine(int* y, const char* line, bool bold); + void DrawTextLines(int* y, const char* const* lines); + + void LoadBitmap(const char* filename, GRSurface** surface); + void LoadBitmapArray(const char* filename, int* frames, GRSurface*** surface); + void LoadLocalizedBitmap(const char* filename, GRSurface** surface); }; #endif // RECOVERY_UI_H |