3 * Copyright (C) 1999, 2000 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 static int nOSListBoxLeft
;
27 static int nOSListBoxRight
;
28 static int nOSListBoxTop
;
29 static int nOSListBoxBottom
;
31 static int nOSSelected
= 0; // Currently selected OS (zero based)
40 nTimeOut
++; // Increment the timeout since 0 doesn't count for a second
42 // Initialise the menu
53 // Check for a keypress
68 key
= getch(); // Yes - so get the extended key
83 if (nOSSelected
< (nNumOS
-1))
102 // Update the date & time
107 if (getsecond() != second
)
109 second
= getsecond();
128 int height
= 1; // Allow room for top & bottom borders
131 for(i
=0; i
<nNumOS
; i
++)
134 if(strlen(OSList
[i
].name
) > width
)
135 width
= strlen(OSList
[i
].name
);
137 width
+= 18; // Allow room for left & right borders, plus 8 spaces on each side
139 // Calculate the OS list box area
140 nOSListBoxLeft
= (nScreenWidth
- width
) / 2;
141 nOSListBoxRight
= nOSListBoxLeft
+ width
;
142 nOSListBoxTop
= (nScreenHeight
- height
) / 2 + 1;
143 nOSListBoxBottom
= nOSListBoxTop
+ height
;
153 int space
, space_left
, space_right
;
155 // Update the status bar
156 DrawStatusText(" Use \x18\x19 to select, ENTER to boot. Press F8 for advanced options.");
158 DrawBox(nOSListBoxLeft
, nOSListBoxTop
, nOSListBoxRight
, nOSListBoxBottom
, D_VERT
, D_HORZ
, TRUE
, TRUE
, ATTR(cMenuFgColor
, cMenuBgColor
));
160 for(i
=0; i
<nNumOS
; i
++)
162 space
= (nOSListBoxRight
- nOSListBoxLeft
- 2) - strlen(OSList
[i
].name
);
163 space_left
= (space
/ 2) + 1;
164 space_right
= (space
- space_left
) + 1;
167 for(j
=0; j
<space_left
; j
++)
169 strcat(text
, OSList
[i
].name
);
170 for(j
=0; j
<space_right
; j
++)
175 DrawText(nOSListBoxLeft
+1, nOSListBoxTop
+1+i
, text
, ATTR(cSelectedTextColor
, cSelectedTextBgColor
));
179 DrawText(nOSListBoxLeft
+1, nOSListBoxTop
+1+i
, text
, ATTR(cTextColor
, cMenuBgColor
));
185 strcpy(text
, "[ Time Remaining: ");
186 itoa(nTimeOut
, temp
, 10);
190 DrawText(nOSListBoxRight
- strlen(text
) - 1, nOSListBoxBottom
, text
, ATTR(cMenuFgColor
, cMenuBgColor
));