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