1 | /*␊ |
2 | * gui.h␊ |
3 | * ␊ |
4 | *␊ |
5 | * Created by Jasmin Fazlic on 18.12.08.␊ |
6 | * Copyright 2008/09 Jasmin Fazlic All rights reserved.␊ |
7 | * Copyright 2008/09 iNDi All rights reserved.␊ |
8 | *␊ |
9 | */␊ |
10 | ␊ |
11 | #ifndef __BOOT2_GUI_H␊ |
12 | #define __BOOT2_GUI_H␊ |
13 | ␊ |
14 | #include "graphics.h"␊ |
15 | #include "picopng.h"␊ |
16 | ␊ |
17 | #define CHARACTERS_COUNT␉223␊ |
18 | ␊ |
19 | #define BOOT_NORMAL␉␉0␊ |
20 | #define BOOT_VERBOSE␉␉1␊ |
21 | #define BOOT_IGNORECACHE␉2␊ |
22 | #define BOOT_SINGLEUSER␉␉3␊ |
23 | #define DO_NOT_BOOT␉␉4␊ |
24 | #define CLOSE_INFO_MENU␉␉5␊ |
25 | ␊ |
26 | #define INFOMENU_NATIVEBOOT_START 1␊ |
27 | #define INFOMENU_NATIVEBOOT_END␉3␊ |
28 | ␊ |
29 | #define MENU_SHOW_MEMORY_INFO␉4␊ |
30 | #define MENU_SHOW_VIDEO_INFO␉5␊ |
31 | #define MENU_SHOW_HELP␉␉6␊ |
32 | ␊ |
33 | enum {␊ |
34 | ␉HorizontalLayout␉= 0,␊ |
35 | ␉VerticalLayout␉␉= 1,␊ |
36 | };␊ |
37 | ␊ |
38 | enum {␊ |
39 | ␉kBackspaceKey␉␉= 0x08,␊ |
40 | ␉kTabKey␉␉␉= 0x09,␊ |
41 | ␉kReturnKey␉␉= 0x0d,␊ |
42 | ␉kEscapeKey␉␉= 0x1b,␊ |
43 | ␉kUpArrowkey␉␉= 0x4800, ␊ |
44 | ␉kDownArrowkey␉␉= 0x5000,␊ |
45 | ␉kASCIIKeyMask␉␉= 0x7f,␊ |
46 | ␉kF2Key␉␉␉= 0x3c00,␊ |
47 | ␉kF5Key␉␉␉= 0x3f00,␊ |
48 | ␉kF10Key␉␉␉= 0x4400␊ |
49 | };␊ |
50 | ␊ |
51 | /*␊ |
52 | * Menu item structure.␊ |
53 | */␊ |
54 | ␊ |
55 | typedef struct {␊ |
56 | ␉position_t␉pos;␊ |
57 | ␉char␉␉*text;␊ |
58 | ␉bool␉␉enabled;␊ |
59 | ␉bool␉␉expandable;␊ |
60 | } menuitem_t;␊ |
61 | ␊ |
62 | /*␊ |
63 | * Image structure.␊ |
64 | */␊ |
65 | typedef struct {␊ |
66 | ␉pixmap_t␉*image;␊ |
67 | ␉char␉␉name[32];␊ |
68 | } image_t;␊ |
69 | ␊ |
70 | /*␊ |
71 | * Font structure.␊ |
72 | */␊ |
73 | typedef struct {␊ |
74 | ␉uint16_t␉height;␉␉␉// Font Height ␊ |
75 | ␉uint16_t␉width;␉␉␉// Font Width for monospace font only␊ |
76 | ␉pixmap_t␉*chars[CHARACTERS_COUNT];␊ |
77 | } font_t;␊ |
78 | ␊ |
79 | /*␊ |
80 | * Window structure.␊ |
81 | */␊ |
82 | typedef struct␊ |
83 | {␊ |
84 | ␉position_t␉pos;␉␉␉// X,Y Position of window on screen␊ |
85 | ␉pixmap_t␉*pixmap;␉␉// Buffer␊ |
86 | ␉uint16_t␉width;␉␉␉// Width␊ |
87 | ␉uint16_t␉height;␉␉␉// Height␊ |
88 | ␉uint16_t␉hborder;␉␉// Horizontal border␊ |
89 | ␉uint16_t␉vborder;␉␉// Vertical border␊ |
90 | ␉uint16_t␉iconspacing;␉␉// Icon spacing␊ |
91 | ␉position_t␉cursor;␉␉␉// Text Cursor X,Y Position will be multiples of font width & height␊ |
92 | ␉uint32_t␉bgcolor;␉␉// Background color AARRGGBB␊ |
93 | ␉uint32_t␉fgcolor;␉␉// Foreground color AARRGGBB␊ |
94 | ␉uint32_t␉font_small_color;␉// Color for small font AARRGGBB␊ |
95 | ␉uint32_t␉font_console_color;␉// Color for consle font AARRGGBB␊ |
96 | ␉bool␉␉draw;␉␉␉// Draw flag␊ |
97 | ␉//resolution specifics␊ |
98 | ␉uint16_t␉htotal;␉␉␉␉␊ |
99 | ␉uint16_t␉vtotal;␉␉␉␉␊ |
100 | ␉uint16_t␉hsyncstart;␉␉␉␊ |
101 | ␉uint16_t␉hsyncend;␊ |
102 | ␉uint16_t␉vsyncstart;␉␉␉␊ |
103 | ␉uint16_t␉vsyncend;␊ |
104 | ␉uint8_t␉␉mm;␉␉␉␉// Azi:autoresolution - debuginfo␊ |
105 | ␉uint16_t␉attr;␊ |
106 | } window_t;␊ |
107 | ␉␊ |
108 | /*␊ |
109 | * gui structure␊ |
110 | */␊ |
111 | typedef struct␊ |
112 | {␊ |
113 | ␉uint8_t␉␉maxdevices;␉␉//␊ |
114 | ␉uint8_t␉␉layout;␉␉␉// Horizontal or Vertical layout␊ |
115 | ␉␊ |
116 | ␉pixmap_t␉*backbuffer;␉␉// Off screen buffer␊ |
117 | ␊ |
118 | ␉window_t␉screen;␉␉␉// ␊ |
119 | ␉window_t␉background;␉␉// Position of background graphic within screen␊ |
120 | ␉window_t␉logo;␉␉␉// Logo␊ |
121 | ␉window_t␉bootprompt;␉␉// Bootprompt Window␊ |
122 | ␉window_t␉devicelist;␉␉// Devicelist Window␊ |
123 | ␉window_t␉infobox;␉␉// Infobox Window␊ |
124 | ␉window_t␉menu;␉␉␉// Menu␊ |
125 | ␊ |
126 | ␉window_t␉progressbar;␉␉// Progress bar␊ |
127 | ␉window_t␉countdown;␉␉// Countdown text␊ |
128 | ␉␊ |
129 | ␉window_t␉debug;␉␉␉// Debug␊ |
130 | ␊ |
131 | ␉bool␉␉initialised;␉␉// Initialised␊ |
132 | ␉bool␉␉redraw;␉␉␉// Redraw flag␊ |
133 | } gui_t;␊ |
134 | ␊ |
135 | ␊ |
136 | gui_t gui;␉␉␉␉␉// gui structure␊ |
137 | ␊ |
138 | font_t font_small;␊ |
139 | font_t font_console;␊ |
140 | ␊ |
141 | int initGUI();␊ |
142 | void drawBackground();␊ |
143 | ␊ |
144 | void setupDeviceList(config_file_t *theme);␊ |
145 | void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected);␊ |
146 | void drawDeviceList(int start, int end, int selection);␊ |
147 | void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress);␊ |
148 | ␊ |
149 | void showInfoBox(char *title, char *text);␊ |
150 | ␊ |
151 | int dprintf( window_t * window, const char * fmt, ...);␊ |
152 | int gprintf( window_t * window, const char * fmt, ...);␊ |
153 | int␉ vprf(const char * fmt, va_list ap);␊ |
154 | ␊ |
155 | int drawInfoMenu();␊ |
156 | int updateInfoMenu(int key);␊ |
157 | void drawInfoMenuItems();␊ |
158 | ␊ |
159 | void showGraphicBootPrompt();␊ |
160 | void clearGraphicBootPrompt();␊ |
161 | void updateGraphicBootPrompt(int key);␊ |
162 | ␊ |
163 | void updateVRAM();␊ |
164 | ␊ |
165 | void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
166 | void drawStrCenteredAt(char *ch, font_t *font, pixmap_t *blendInto, position_t p);␊ |
167 | ␊ |
168 | #endif /* !__BOOT2_GUI_H */␊ |
169 | |