Changes for ticket #5227.
* Use a slider instead of radio buttons for timeout options. * Added timeout options 'after 0 seconds', 'after one minute'. * Removed timeout options 'after 10 and 15 seconds'. * Timeout can now be disabled pressing the 'ALT' key at boot time. Other: * Added #undef TR_CONTEXT to get rid of build warnings git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35925 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -34,37 +34,38 @@ static const uint8 kBootLoader[] = {
|
|||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa,
|
||||||
0xa1, 0x09, 0x04, 0x89, 0x46, 0x00, 0xb8, 0x13, 0x00, 0xf7, 0x26, 0x0b, 0x04, 0x89, 0xd3, 0x50,
|
0xa1, 0x17, 0x04, 0x89, 0x46, 0x00, 0xb8, 0x13, 0x00, 0xf7, 0x26, 0x19, 0x04, 0x89, 0xd3, 0x50,
|
||||||
0xb4, 0x00, 0xcd, 0x1a, 0x58, 0x01, 0xd0, 0x11, 0xcb, 0x89, 0x46, 0x04, 0x89, 0x5e, 0x06, 0xa0,
|
0xb4, 0x00, 0xcd, 0x1a, 0x58, 0x01, 0xd0, 0x11, 0xcb, 0x89, 0x46, 0x04, 0x89, 0x5e, 0x06, 0xa0,
|
||||||
0x07, 0x04, 0xd0, 0xe8, 0xb3, 0x0c, 0x28, 0xc3, 0x88, 0x5e, 0x02, 0xe8, 0x64, 0x00, 0x81, 0x3e,
|
0x15, 0x04, 0xd0, 0xe8, 0xb3, 0x0c, 0x28, 0xc3, 0x88, 0x5e, 0x02, 0xb4, 0x02, 0xcd, 0x16, 0x24,
|
||||||
0x0b, 0x04, 0xff, 0xff, 0x74, 0x25, 0xb4, 0x01, 0xcd, 0x16, 0x75, 0x1f, 0xe8, 0x05, 0x00, 0x73,
|
0x08, 0x74, 0x06, 0xc7, 0x06, 0x19, 0x04, 0xff, 0xff, 0xe8, 0x64, 0x00, 0x81, 0x3e, 0x19, 0x04,
|
||||||
0xf5, 0xe9, 0xa6, 0x00, 0xb4, 0x00, 0xcd, 0x1a, 0x3b, 0x4e, 0x06, 0x72, 0x07, 0x77, 0x07, 0x3b,
|
0xff, 0xff, 0x74, 0x25, 0xb4, 0x01, 0xcd, 0x16, 0x75, 0x1f, 0xe8, 0x05, 0x00, 0x73, 0xf5, 0xe9,
|
||||||
0x56, 0x04, 0x77, 0x02, 0xf8, 0xc3, 0xf9, 0xc3, 0xe8, 0x37, 0x00, 0xb4, 0x00, 0xcd, 0x16, 0x80,
|
0xa6, 0x00, 0xb4, 0x00, 0xcd, 0x1a, 0x3b, 0x4e, 0x06, 0x72, 0x07, 0x77, 0x07, 0x3b, 0x56, 0x04,
|
||||||
0xfc, 0x50, 0x74, 0x0d, 0x80, 0xfc, 0x48, 0x74, 0x19, 0x80, 0xfc, 0x1c, 0x75, 0xed, 0xe9, 0x79,
|
0x77, 0x02, 0xf8, 0xc3, 0xf9, 0xc3, 0xe8, 0x37, 0x00, 0xb4, 0x00, 0xcd, 0x16, 0x80, 0xfc, 0x50,
|
||||||
0x00, 0x8b, 0x46, 0x00, 0x40, 0x3b, 0x06, 0x07, 0x04, 0x75, 0x02, 0x31, 0xc0, 0x89, 0x46, 0x00,
|
0x74, 0x0d, 0x80, 0xfc, 0x48, 0x74, 0x19, 0x80, 0xfc, 0x1c, 0x75, 0xed, 0xe9, 0x79, 0x00, 0x8b,
|
||||||
0xeb, 0xd6, 0x8b, 0x46, 0x00, 0x09, 0xc0, 0x75, 0x03, 0xa1, 0x07, 0x04, 0x48, 0x89, 0x46, 0x00,
|
0x46, 0x00, 0x40, 0x3b, 0x06, 0x15, 0x04, 0x75, 0x02, 0x31, 0xc0, 0x89, 0x46, 0x00, 0xeb, 0xd6,
|
||||||
0xeb, 0xc6, 0x8a, 0x46, 0x02, 0x88, 0x46, 0x09, 0xbe, 0x0d, 0x04, 0x31, 0xc9, 0xac, 0x04, 0x03,
|
0x8b, 0x46, 0x00, 0x09, 0xc0, 0x75, 0x03, 0xa1, 0x15, 0x04, 0x48, 0x89, 0x46, 0x00, 0xeb, 0xc6,
|
||||||
0xd0, 0xe8, 0xb2, 0x28, 0x28, 0xc2, 0x88, 0x56, 0x08, 0xb0, 0x10, 0xe8, 0x30, 0x00, 0xfe, 0x46,
|
0x8a, 0x46, 0x02, 0x88, 0x46, 0x09, 0xbe, 0x1b, 0x04, 0x31, 0xc9, 0xac, 0x04, 0x03, 0xd0, 0xe8,
|
||||||
0x08, 0x89, 0xcf, 0x81, 0xe7, 0x03, 0x00, 0x8a, 0x9d, 0xcc, 0x03, 0x3b, 0x4e, 0x00, 0x75, 0x03,
|
0xb2, 0x28, 0x28, 0xc2, 0x88, 0x56, 0x08, 0xb0, 0x10, 0xe8, 0x30, 0x00, 0xfe, 0x46, 0x08, 0x89,
|
||||||
0x80, 0xf3, 0x08, 0xe8, 0xb6, 0x00, 0x81, 0xc6, 0x09, 0x00, 0x80, 0x46, 0x08, 0x01, 0xb0, 0x11,
|
0xcf, 0x81, 0xe7, 0x03, 0x00, 0x8a, 0x9d, 0xda, 0x03, 0x3b, 0x4e, 0x00, 0x75, 0x03, 0x80, 0xf3,
|
||||||
0xe8, 0x0b, 0x00, 0xfe, 0x46, 0x09, 0x41, 0x3b, 0x0e, 0x07, 0x04, 0x75, 0xc0, 0xc3, 0x3b, 0x4e,
|
0x08, 0xe8, 0xb6, 0x00, 0x81, 0xc6, 0x09, 0x00, 0x80, 0x46, 0x08, 0x01, 0xb0, 0x11, 0xe8, 0x0b,
|
||||||
0x00, 0x74, 0x02, 0xb0, 0x20, 0xb3, 0x0f, 0xe9, 0xb6, 0x00, 0xe8, 0xa4, 0xfd, 0xe8, 0x83, 0x00,
|
0x00, 0xfe, 0x46, 0x09, 0x41, 0x3b, 0x0e, 0x15, 0x04, 0x75, 0xc0, 0xc3, 0x3b, 0x4e, 0x00, 0x74,
|
||||||
0xac, 0x88, 0xc2, 0xbf, 0xc4, 0x03, 0xb9, 0x04, 0x00, 0xad, 0xab, 0xe2, 0xfc, 0xb4, 0x42, 0xbe,
|
0x02, 0xb0, 0x20, 0xb3, 0x0f, 0xe9, 0xb6, 0x00, 0xe8, 0x96, 0xfd, 0xe8, 0x83, 0x00, 0xac, 0x88,
|
||||||
0xbc, 0x03, 0xcd, 0x13, 0xbe, 0xd0, 0x03, 0x72, 0x40, 0xa1, 0xfe, 0x01, 0x3d, 0x55, 0xaa, 0xbe,
|
0xc2, 0xbf, 0xd2, 0x03, 0xb9, 0x04, 0x00, 0xad, 0xab, 0xe2, 0xfc, 0xb4, 0x42, 0xbe, 0xca, 0x03,
|
||||||
0xe6, 0x03, 0x75, 0x35, 0xb4, 0x06, 0x30, 0xc0, 0xb7, 0x0f, 0x31, 0xc9, 0xba, 0x4f, 0x18, 0xcd,
|
0xcd, 0x13, 0xbe, 0xde, 0x03, 0x72, 0x40, 0xa1, 0xfe, 0x01, 0x3d, 0x55, 0xaa, 0xbe, 0xf4, 0x03,
|
||||||
0x10, 0xc7, 0x46, 0x08, 0x00, 0x00, 0xbe, 0xff, 0x03, 0xb3, 0x07, 0xe8, 0x4e, 0x00, 0xfe, 0x46,
|
0x75, 0x35, 0xb4, 0x06, 0x30, 0xc0, 0xb7, 0x0f, 0x31, 0xc9, 0xba, 0x4f, 0x18, 0xcd, 0x10, 0xc7,
|
||||||
0x08, 0xe8, 0x29, 0x00, 0x46, 0xe8, 0x44, 0x00, 0xba, 0x00, 0x01, 0x30, 0xff, 0xb4, 0x02, 0xcd,
|
0x46, 0x08, 0x00, 0x00, 0xbe, 0x0d, 0x04, 0xb3, 0x07, 0xe8, 0x4e, 0x00, 0xfe, 0x46, 0x08, 0xe8,
|
||||||
0x10, 0xe8, 0x2f, 0x00, 0x8a, 0x14, 0xe9, 0xb7, 0xfc, 0xba, 0x1a, 0x15, 0x89, 0x56, 0x08, 0xbb,
|
0x29, 0x00, 0x46, 0xe8, 0x44, 0x00, 0xba, 0x00, 0x01, 0x30, 0xff, 0xb4, 0x02, 0xcd, 0x10, 0xe8,
|
||||||
0x0f, 0x00, 0xe8, 0x27, 0x00, 0xb4, 0x00, 0xcd, 0x16, 0xb2, 0x80, 0xcd, 0x19, 0xbe, 0x0d, 0x04,
|
0x2f, 0x00, 0x8a, 0x14, 0xe9, 0xa9, 0xfc, 0xba, 0x1a, 0x15, 0x89, 0x56, 0x08, 0xbb, 0x0f, 0x00,
|
||||||
0x8b, 0x4e, 0x00, 0x41, 0x30, 0xe4, 0xe9, 0x07, 0x00, 0xac, 0x01, 0xc6, 0x81, 0xc6, 0x09, 0x00,
|
0xe8, 0x27, 0x00, 0xb4, 0x00, 0xcd, 0x16, 0xb2, 0x80, 0xcd, 0x19, 0xbe, 0x1b, 0x04, 0x8b, 0x4e,
|
||||||
0xe2, 0xf7, 0xc3, 0xe8, 0xe7, 0xff, 0xac, 0x30, 0xe4, 0x01, 0xc6, 0xc3, 0x50, 0x53, 0x51, 0x52,
|
0x00, 0x41, 0x30, 0xe4, 0xe9, 0x07, 0x00, 0xac, 0x01, 0xc6, 0x81, 0xc6, 0x09, 0x00, 0xe2, 0xf7,
|
||||||
0x30, 0xff, 0xe9, 0x11, 0x00, 0x8b, 0x56, 0x08, 0xb4, 0x02, 0xcd, 0x10, 0xfe, 0x46, 0x08, 0xb9,
|
0xc3, 0xe8, 0xe7, 0xff, 0xac, 0x30, 0xe4, 0x01, 0xc6, 0xc3, 0x50, 0x53, 0x51, 0x52, 0x30, 0xff,
|
||||||
0x01, 0x00, 0xb4, 0x09, 0xcd, 0x10, 0xac, 0x3c, 0x00, 0x75, 0xea, 0x5a, 0x59, 0x5b, 0x58, 0xc3,
|
0xe9, 0x11, 0x00, 0x8b, 0x56, 0x08, 0xb4, 0x02, 0xcd, 0x10, 0xfe, 0x46, 0x08, 0xb9, 0x01, 0x00,
|
||||||
0x50, 0x53, 0x51, 0x52, 0x30, 0xff, 0x8b, 0x56, 0x08, 0xb4, 0x02, 0xcd, 0x10, 0xfe, 0x46, 0x08,
|
0xb4, 0x09, 0xcd, 0x10, 0xac, 0x3c, 0x00, 0x75, 0xea, 0x5a, 0x59, 0x5b, 0x58, 0xc3, 0x50, 0x53,
|
||||||
0xb9, 0x01, 0x00, 0xb4, 0x09, 0xcd, 0x10, 0x5a, 0x59, 0x5b, 0x58, 0xc3, 0x10, 0x00, 0x01, 0x00,
|
0x51, 0x52, 0x30, 0xff, 0x8b, 0x56, 0x08, 0xb4, 0x02, 0xcd, 0x10, 0xfe, 0x46, 0x08, 0xb9, 0x01,
|
||||||
0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x02, 0x03,
|
0x00, 0xb4, 0x09, 0xcd, 0x10, 0x5a, 0x59, 0x5b, 0x58, 0xc3, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
0x45, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x65,
|
0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x02, 0x03, 0x45, 0x72,
|
||||||
0x63, 0x74, 0x6f, 0x72, 0x73, 0x00, 0x4e, 0x6f, 0x74, 0x20, 0x61, 0x20, 0x62, 0x6f, 0x6f, 0x74,
|
0x72, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x65, 0x63, 0x74,
|
||||||
0x61, 0x62, 0x6c, 0x65, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x4c,
|
0x6f, 0x72, 0x73, 0x00, 0x4e, 0x6f, 0x74, 0x20, 0x61, 0x20, 0x62, 0x6f, 0x6f, 0x74, 0x61, 0x62,
|
||||||
0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x00
|
0x6c, 0x65, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x4c, 0x6f, 0x61,
|
||||||
|
0x64, 0x69, 0x6e, 0x67, 0x00
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
#define TR_CONTEXT "BootManager"
|
#define TR_CONTEXT "BootManager"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
#define TR_CONTEXT "BootManagerWindow"
|
#define TR_CONTEXT "BootManagerWindow"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,23 +11,87 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
#include <ControlLook.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
|
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <PopUpMenu.h>
|
#include <PopUpMenu.h>
|
||||||
#include <RadioButton.h>
|
#include <RadioButton.h>
|
||||||
#include <TextView.h>
|
#include <Slider.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
#include <TextView.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
#define TR_CONTEXT "DefaultPartitionPage"
|
#define TR_CONTEXT "DefaultPartitionPage"
|
||||||
|
|
||||||
|
|
||||||
const uint32 kMsgPartition = 'part';
|
enum {
|
||||||
const uint32 kMsgTimeout = 'time';
|
kMsgPartition = 'part',
|
||||||
|
kMsgTimeout = 'time'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// The timeout code to wait indefinitely
|
||||||
|
// Note: The timeout is encoded in seconds, -1 indicates to wait indefinitely
|
||||||
|
const int32 kTimeoutIndefinitely = -1;
|
||||||
|
const int32 kDefaultTimeout = kTimeoutIndefinitely;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32 timeout;
|
||||||
|
const char* label;
|
||||||
|
} TimeoutOption;
|
||||||
|
|
||||||
|
static const TimeoutOption gTimeoutOptions[] =
|
||||||
|
{
|
||||||
|
{ 0, TR_MARK("Immediately")},
|
||||||
|
{ 1, TR_MARK("After one second")},
|
||||||
|
{ 2, TR_MARK("After two seconds")},
|
||||||
|
{ 3, TR_MARK("After three seconds")},
|
||||||
|
{ 4, TR_MARK("After four seconds")},
|
||||||
|
{ 5, TR_MARK("After five seconds")},
|
||||||
|
{ 60, TR_MARK("After one minute")},
|
||||||
|
{ kTimeoutIndefinitely, TR_MARK("Never")}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define kNumberOfTimeoutOptions \
|
||||||
|
(int32)(sizeof(gTimeoutOptions) / sizeof(TimeoutOption))
|
||||||
|
|
||||||
|
|
||||||
|
static int32
|
||||||
|
get_index_for_timeout(int32 timeout)
|
||||||
|
{
|
||||||
|
int32 defaultIndex = 0;
|
||||||
|
for (int32 i = 0; i < kNumberOfTimeoutOptions; i ++) {
|
||||||
|
if (gTimeoutOptions[i].timeout == timeout)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
if (gTimeoutOptions[i].timeout == kDefaultTimeout)
|
||||||
|
defaultIndex = i;
|
||||||
|
}
|
||||||
|
return defaultIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int32
|
||||||
|
get_timeout_for_index(int32 index)
|
||||||
|
{
|
||||||
|
if (index < 0)
|
||||||
|
return gTimeoutOptions[0].timeout;
|
||||||
|
if (index >= kNumberOfTimeoutOptions)
|
||||||
|
return gTimeoutOptions[kNumberOfTimeoutOptions-1].timeout;
|
||||||
|
return gTimeoutOptions[index].timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
get_label_for_timeout(int32 timeout)
|
||||||
|
{
|
||||||
|
int32 index = get_index_for_timeout(timeout);
|
||||||
|
return gTimeoutOptions[index].label;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DefaultPartitionPage::DefaultPartitionPage(BMessage* settings, BRect frame, const char* name)
|
DefaultPartitionPage::DefaultPartitionPage(BMessage* settings, BRect frame, const char* name)
|
||||||
@@ -55,10 +119,7 @@ void
|
|||||||
DefaultPartitionPage::AttachedToWindow()
|
DefaultPartitionPage::AttachedToWindow()
|
||||||
{
|
{
|
||||||
fDefaultPartition->Menu()->SetTargetForItems(this);
|
fDefaultPartition->Menu()->SetTargetForItems(this);
|
||||||
fWait0->SetTarget(this);
|
fTimeoutSlider->SetTarget(this);
|
||||||
fWait5->SetTarget(this);
|
|
||||||
fWait10->SetTarget(this);
|
|
||||||
fWait15->SetTarget(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -75,9 +136,13 @@ DefaultPartitionPage::MessageReceived(BMessage* msg)
|
|||||||
break;
|
break;
|
||||||
case kMsgTimeout:
|
case kMsgTimeout:
|
||||||
{
|
{
|
||||||
int32 timeout;
|
int32 sliderValue = fTimeoutSlider->Value();
|
||||||
msg->FindInt32("timeout", &timeout);
|
int32 timeout = get_timeout_for_index(sliderValue);
|
||||||
fSettings->ReplaceInt32("timeout", timeout);
|
fSettings->ReplaceInt32("timeout", timeout);
|
||||||
|
|
||||||
|
BString label;
|
||||||
|
_GetTimeoutLabel(timeout, label);
|
||||||
|
fTimeoutSlider->SetLabel(label.String());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -86,7 +151,7 @@ DefaultPartitionPage::MessageReceived(BMessage* msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const float kTextDistance = 10;
|
#define kTextDistance be_control_look->DefaultItemSpacing();
|
||||||
|
|
||||||
void
|
void
|
||||||
DefaultPartitionPage::_BuildUI()
|
DefaultPartitionPage::_BuildUI()
|
||||||
@@ -100,7 +165,8 @@ DefaultPartitionPage::_BuildUI()
|
|||||||
"The boot menu will load the default partition after "
|
"The boot menu will load the default partition after "
|
||||||
"the timeout unless you select another partition. You "
|
"the timeout unless you select another partition. You "
|
||||||
"can also have the boot menu wait indefinitely for you "
|
"can also have the boot menu wait indefinitely for you "
|
||||||
"to select a partition.");
|
"to select a partition.\n"
|
||||||
|
"Keep the 'ALT' key pressed to disable the timeout at boot time.");
|
||||||
|
|
||||||
fDescription = CreateDescription(rect, "description", text);
|
fDescription = CreateDescription(rect, "description", text);
|
||||||
MakeHeading(fDescription);
|
MakeHeading(fDescription);
|
||||||
@@ -116,17 +182,26 @@ DefaultPartitionPage::_BuildUI()
|
|||||||
AddChild(fDefaultPartition);
|
AddChild(fDefaultPartition);
|
||||||
fDefaultPartition->ResizeToPreferred();
|
fDefaultPartition->ResizeToPreferred();
|
||||||
|
|
||||||
|
// timeout slider
|
||||||
rect.top = fDefaultPartition->Frame().bottom + kTextDistance;
|
rect.top = fDefaultPartition->Frame().bottom + kTextDistance;
|
||||||
int32 timeout;
|
int32 timeout;
|
||||||
fSettings->FindInt32("timeout", &timeout);
|
fSettings->FindInt32("timeout", &timeout);
|
||||||
fWait0 = _CreateWaitRadioButton(rect, "wait0", TR("Wait Indefinitely"),
|
BString timeoutLabel;
|
||||||
-1, timeout);
|
_GetTimeoutLabel(timeout, timeoutLabel);
|
||||||
fWait5 = _CreateWaitRadioButton(rect, "wait5", TR("Wait 5 Seconds"),
|
|
||||||
5, timeout);
|
int32 sliderValue = get_index_for_timeout(timeout);
|
||||||
fWait10 = _CreateWaitRadioButton(rect, "wait10", TR("Wait 10 Seconds"),
|
|
||||||
10, timeout);
|
fTimeoutSlider = new BSlider(rect, "timeout", timeoutLabel.String(),
|
||||||
fWait15 = _CreateWaitRadioButton(rect, "wait15", TR("Wait 15 Seconds"),
|
new BMessage(kMsgTimeout), 0, kNumberOfTimeoutOptions-1,
|
||||||
15, timeout);
|
B_BLOCK_THUMB,
|
||||||
|
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
||||||
|
fTimeoutSlider->SetModificationMessage(new BMessage(kMsgTimeout));
|
||||||
|
fTimeoutSlider->SetValue(sliderValue);
|
||||||
|
fTimeoutSlider->SetLimitLabels(TR("Immediately"),TR("Never"));
|
||||||
|
fTimeoutSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
||||||
|
fTimeoutSlider->SetHashMarkCount(kNumberOfTimeoutOptions);
|
||||||
|
fTimeoutSlider->ResizeToPreferred();
|
||||||
|
AddChild(fTimeoutSlider);
|
||||||
|
|
||||||
_Layout();
|
_Layout();
|
||||||
}
|
}
|
||||||
@@ -169,20 +244,12 @@ DefaultPartitionPage::_CreatePopUpMenu()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BRadioButton*
|
void
|
||||||
DefaultPartitionPage::_CreateWaitRadioButton(BRect rect, const char* name, const char* label, int32 timeout,
|
DefaultPartitionPage::_GetTimeoutLabel(int32 timeout, BString& label)
|
||||||
int32 defaultTimeout)
|
|
||||||
{
|
{
|
||||||
BMessage* msg = new BMessage(kMsgTimeout);
|
const char* text = TR(get_label_for_timeout(timeout));
|
||||||
msg->AddInt32("timeout", timeout);
|
label = TR("Timeout: %s");
|
||||||
BRadioButton* button = new BRadioButton(rect, name, label, msg);
|
label.ReplaceFirst("%s", text);
|
||||||
AddChild(button);
|
|
||||||
button->ResizeToPreferred();
|
|
||||||
|
|
||||||
if (timeout == defaultTimeout)
|
|
||||||
button->SetValue(1);
|
|
||||||
|
|
||||||
return button;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -194,18 +261,9 @@ DefaultPartitionPage::_Layout()
|
|||||||
float left = fDefaultPartition->Frame().left;
|
float left = fDefaultPartition->Frame().left;
|
||||||
float top = fDescription->Frame().bottom + kTextDistance;
|
float top = fDescription->Frame().bottom + kTextDistance;
|
||||||
|
|
||||||
BView* controls[] = {
|
fDefaultPartition->MoveTo(left, top);
|
||||||
fDefaultPartition,
|
top = fDefaultPartition->Frame().bottom + kTextDistance;
|
||||||
fWait0,
|
|
||||||
fWait5,
|
fTimeoutSlider->MoveTo(left, top);
|
||||||
fWait10,
|
|
||||||
fWait15
|
|
||||||
};
|
|
||||||
|
|
||||||
for (int i = 0; i < 5; i ++) {
|
|
||||||
BView* view = controls[i];
|
|
||||||
view->MoveTo(left, top);
|
|
||||||
top = view->Frame().bottom + 3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,12 @@
|
|||||||
|
|
||||||
#include "WizardPageView.h"
|
#include "WizardPageView.h"
|
||||||
|
|
||||||
|
|
||||||
class BMenuField;
|
class BMenuField;
|
||||||
class BMessage;
|
class BMessage;
|
||||||
class BRadioButton;
|
|
||||||
class BPopUpMenu;
|
class BPopUpMenu;
|
||||||
|
class BRadioButton;
|
||||||
|
class BSlider;
|
||||||
class BTextView;
|
class BTextView;
|
||||||
|
|
||||||
|
|
||||||
@@ -33,16 +35,12 @@ private:
|
|||||||
|
|
||||||
void _BuildUI();
|
void _BuildUI();
|
||||||
BPopUpMenu* _CreatePopUpMenu();
|
BPopUpMenu* _CreatePopUpMenu();
|
||||||
BRadioButton* _CreateWaitRadioButton(BRect frame, const char* name, const char* label,
|
void _GetTimeoutLabel(int32 timeout, BString& label);
|
||||||
int32 timeout, int32 defaultTimeout);
|
|
||||||
void _Layout();
|
void _Layout();
|
||||||
|
|
||||||
BTextView* fDescription;
|
BTextView* fDescription;
|
||||||
BMenuField* fDefaultPartition;
|
BMenuField* fDefaultPartition;
|
||||||
BRadioButton* fWait0;
|
BSlider* fTimeoutSlider;
|
||||||
BRadioButton* fWait5;
|
|
||||||
BRadioButton* fWait10;
|
|
||||||
BRadioButton* fWait15;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DEFAULT_PARTITON_PAGE_H
|
#endif // DEFAULT_PARTITON_PAGE_H
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
#define TR_CONTEXT "EntryPage"
|
#define TR_CONTEXT "EntryPage"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
#define TR_CONTEXT "FileSelectionPage"
|
#define TR_CONTEXT "FileSelectionPage"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "BootLoader.h"
|
#include "BootLoader.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
#define TR_CONTEXT "LegacyBootDrive"
|
#define TR_CONTEXT "LegacyBootDrive"
|
||||||
#define USE_SECOND_DISK 0
|
#define USE_SECOND_DISK 0
|
||||||
#define GET_FIRST_BIOS_DRIVE 1
|
#define GET_FIRST_BIOS_DRIVE 1
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
#define TR_CONTEXT "PartitionsPage"
|
#define TR_CONTEXT "PartitionsPage"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
#define TR_CONTEXT "UninstallPage"
|
#define TR_CONTEXT "UninstallPage"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
#define TR_CONTEXT "WizardView"
|
#define TR_CONTEXT "WizardView"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,9 @@
|
|||||||
%assign PROBE_CHAR 0x01 ; -> zf = 0
|
%assign PROBE_CHAR 0x01 ; -> zf = 0
|
||||||
; al - ASCII char
|
; al - ASCII char
|
||||||
; ah - scan code
|
; ah - scan code
|
||||||
|
|
||||||
|
%assign GET_MODIFIER_KEYS 0x02 ;-> al - modifier key bitmask
|
||||||
|
|
||||||
; timer services
|
; timer services
|
||||||
%assign READ_CLOCK 0x00 ; -> cx - high word
|
%assign READ_CLOCK 0x00 ; -> cx - high word
|
||||||
; dx - low word
|
; dx - low word
|
||||||
@@ -138,6 +141,16 @@
|
|||||||
%assign KEY_UP 0x48
|
%assign KEY_UP 0x48
|
||||||
%assign KEY_RETURN 0x1C
|
%assign KEY_RETURN 0x1C
|
||||||
|
|
||||||
|
; Modifier key bitmasks
|
||||||
|
%assign MODIFIER_RIGHT_SHIFT_KEY 0x01
|
||||||
|
%assign MODIFIER_LEFT_SHIFT_KEY 0x02
|
||||||
|
%assign MODIFIER_CONTROL_KEY 0x04
|
||||||
|
%assign MODIFIER_ALT_KEY 0x08
|
||||||
|
%assign MODIFIER_SCROLL_LOCK_KEY 0x10
|
||||||
|
%assign MODIFIER_NUM_LOCK_KEY 0x20
|
||||||
|
%assign MODIFIER_CAPS_LOCK_KEY 0x40
|
||||||
|
%assign MODIFIER_INSERT_KEY 0x80
|
||||||
|
|
||||||
; String constants with their length
|
; String constants with their length
|
||||||
%define TITLE 'Haiku Boot Manager'
|
%define TITLE 'Haiku Boot Manager'
|
||||||
%strlen TITLE_LENGTH TITLE
|
%strlen TITLE_LENGTH TITLE
|
||||||
@@ -348,7 +361,7 @@ kMBRSignature:
|
|||||||
; Use code available in stage 1
|
; Use code available in stage 1
|
||||||
%define printstr printStringStage2
|
%define printstr printStringStage2
|
||||||
|
|
||||||
%assign TIMEOUT_OFF 0xffff
|
%assign TIMEOUT_OFF 0xffff
|
||||||
|
|
||||||
|
|
||||||
stage2:
|
stage2:
|
||||||
@@ -375,6 +388,13 @@ stage2:
|
|||||||
sub bl, al ; y = TEXT_ROWS / 2 - number of items / 2
|
sub bl, al ; y = TEXT_ROWS / 2 - number of items / 2
|
||||||
mov [bp + firstLine], bl
|
mov [bp + firstLine], bl
|
||||||
|
|
||||||
|
mov ah, GET_MODIFIER_KEYS ; Disable timeout if ALT key is pressed
|
||||||
|
int BIOS_KEYBOARD_SERVICES
|
||||||
|
and al, MODIFIER_ALT_KEY
|
||||||
|
jz showMenu
|
||||||
|
mov word [timeout], TIMEOUT_OFF
|
||||||
|
|
||||||
|
showMenu:
|
||||||
call printMenu
|
call printMenu
|
||||||
|
|
||||||
cmp word [timeout], TIMEOUT_OFF
|
cmp word [timeout], TIMEOUT_OFF
|
||||||
|
|||||||
Reference in New Issue
Block a user