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