From 4fc2c378e16e380a78b5db6051644192504f8a7e Mon Sep 17 00:00:00 2001 From: Michael Pfeiffer Date: Sun, 21 Mar 2010 15:40:00 +0000 Subject: [PATCH] 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 --- src/apps/bootman/BootLoader.h | 65 ++++----- src/apps/bootman/BootManager.cpp | 1 + src/apps/bootman/BootManagerWindow.cpp | 1 + src/apps/bootman/DefaultPartitionPage.cpp | 152 +++++++++++++++------- src/apps/bootman/DefaultPartitionPage.h | 12 +- src/apps/bootman/EntryPage.cpp | 1 + src/apps/bootman/FileSelectionPage.cpp | 1 + src/apps/bootman/LegacyBootDrive.cpp | 1 + src/apps/bootman/PartitionsPage.cpp | 1 + src/apps/bootman/UninstallPage.cpp | 1 + src/apps/bootman/WizardView.cpp | 1 + src/apps/bootman/bootman.S | 22 +++- 12 files changed, 172 insertions(+), 87 deletions(-) diff --git a/src/apps/bootman/BootLoader.h b/src/apps/bootman/BootLoader.h index 6e69df86c4..d186687653 100644 --- a/src/apps/bootman/BootLoader.h +++ b/src/apps/bootman/BootLoader.h @@ -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, 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, - 0x07, 0x04, 0xd0, 0xe8, 0xb3, 0x0c, 0x28, 0xc3, 0x88, 0x5e, 0x02, 0xe8, 0x64, 0x00, 0x81, 0x3e, - 0x0b, 0x04, 0xff, 0xff, 0x74, 0x25, 0xb4, 0x01, 0xcd, 0x16, 0x75, 0x1f, 0xe8, 0x05, 0x00, 0x73, - 0xf5, 0xe9, 0xa6, 0x00, 0xb4, 0x00, 0xcd, 0x1a, 0x3b, 0x4e, 0x06, 0x72, 0x07, 0x77, 0x07, 0x3b, - 0x56, 0x04, 0x77, 0x02, 0xf8, 0xc3, 0xf9, 0xc3, 0xe8, 0x37, 0x00, 0xb4, 0x00, 0xcd, 0x16, 0x80, - 0xfc, 0x50, 0x74, 0x0d, 0x80, 0xfc, 0x48, 0x74, 0x19, 0x80, 0xfc, 0x1c, 0x75, 0xed, 0xe9, 0x79, - 0x00, 0x8b, 0x46, 0x00, 0x40, 0x3b, 0x06, 0x07, 0x04, 0x75, 0x02, 0x31, 0xc0, 0x89, 0x46, 0x00, - 0xeb, 0xd6, 0x8b, 0x46, 0x00, 0x09, 0xc0, 0x75, 0x03, 0xa1, 0x07, 0x04, 0x48, 0x89, 0x46, 0x00, - 0xeb, 0xc6, 0x8a, 0x46, 0x02, 0x88, 0x46, 0x09, 0xbe, 0x0d, 0x04, 0x31, 0xc9, 0xac, 0x04, 0x03, - 0xd0, 0xe8, 0xb2, 0x28, 0x28, 0xc2, 0x88, 0x56, 0x08, 0xb0, 0x10, 0xe8, 0x30, 0x00, 0xfe, 0x46, - 0x08, 0x89, 0xcf, 0x81, 0xe7, 0x03, 0x00, 0x8a, 0x9d, 0xcc, 0x03, 0x3b, 0x4e, 0x00, 0x75, 0x03, - 0x80, 0xf3, 0x08, 0xe8, 0xb6, 0x00, 0x81, 0xc6, 0x09, 0x00, 0x80, 0x46, 0x08, 0x01, 0xb0, 0x11, - 0xe8, 0x0b, 0x00, 0xfe, 0x46, 0x09, 0x41, 0x3b, 0x0e, 0x07, 0x04, 0x75, 0xc0, 0xc3, 0x3b, 0x4e, - 0x00, 0x74, 0x02, 0xb0, 0x20, 0xb3, 0x0f, 0xe9, 0xb6, 0x00, 0xe8, 0xa4, 0xfd, 0xe8, 0x83, 0x00, - 0xac, 0x88, 0xc2, 0xbf, 0xc4, 0x03, 0xb9, 0x04, 0x00, 0xad, 0xab, 0xe2, 0xfc, 0xb4, 0x42, 0xbe, - 0xbc, 0x03, 0xcd, 0x13, 0xbe, 0xd0, 0x03, 0x72, 0x40, 0xa1, 0xfe, 0x01, 0x3d, 0x55, 0xaa, 0xbe, - 0xe6, 0x03, 0x75, 0x35, 0xb4, 0x06, 0x30, 0xc0, 0xb7, 0x0f, 0x31, 0xc9, 0xba, 0x4f, 0x18, 0xcd, - 0x10, 0xc7, 0x46, 0x08, 0x00, 0x00, 0xbe, 0xff, 0x03, 0xb3, 0x07, 0xe8, 0x4e, 0x00, 0xfe, 0x46, - 0x08, 0xe8, 0x29, 0x00, 0x46, 0xe8, 0x44, 0x00, 0xba, 0x00, 0x01, 0x30, 0xff, 0xb4, 0x02, 0xcd, - 0x10, 0xe8, 0x2f, 0x00, 0x8a, 0x14, 0xe9, 0xb7, 0xfc, 0xba, 0x1a, 0x15, 0x89, 0x56, 0x08, 0xbb, - 0x0f, 0x00, 0xe8, 0x27, 0x00, 0xb4, 0x00, 0xcd, 0x16, 0xb2, 0x80, 0xcd, 0x19, 0xbe, 0x0d, 0x04, - 0x8b, 0x4e, 0x00, 0x41, 0x30, 0xe4, 0xe9, 0x07, 0x00, 0xac, 0x01, 0xc6, 0x81, 0xc6, 0x09, 0x00, - 0xe2, 0xf7, 0xc3, 0xe8, 0xe7, 0xff, 0xac, 0x30, 0xe4, 0x01, 0xc6, 0xc3, 0x50, 0x53, 0x51, 0x52, - 0x30, 0xff, 0xe9, 0x11, 0x00, 0x8b, 0x56, 0x08, 0xb4, 0x02, 0xcd, 0x10, 0xfe, 0x46, 0x08, 0xb9, - 0x01, 0x00, 0xb4, 0x09, 0xcd, 0x10, 0xac, 0x3c, 0x00, 0x75, 0xea, 0x5a, 0x59, 0x5b, 0x58, 0xc3, - 0x50, 0x53, 0x51, 0x52, 0x30, 0xff, 0x8b, 0x56, 0x08, 0xb4, 0x02, 0xcd, 0x10, 0xfe, 0x46, 0x08, - 0xb9, 0x01, 0x00, 0xb4, 0x09, 0xcd, 0x10, 0x5a, 0x59, 0x5b, 0x58, 0xc3, 0x10, 0x00, 0x01, 0x00, - 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x02, 0x03, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x65, - 0x63, 0x74, 0x6f, 0x72, 0x73, 0x00, 0x4e, 0x6f, 0x74, 0x20, 0x61, 0x20, 0x62, 0x6f, 0x6f, 0x74, - 0x61, 0x62, 0x6c, 0x65, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x4c, - 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x00 + 0x15, 0x04, 0xd0, 0xe8, 0xb3, 0x0c, 0x28, 0xc3, 0x88, 0x5e, 0x02, 0xb4, 0x02, 0xcd, 0x16, 0x24, + 0x08, 0x74, 0x06, 0xc7, 0x06, 0x19, 0x04, 0xff, 0xff, 0xe8, 0x64, 0x00, 0x81, 0x3e, 0x19, 0x04, + 0xff, 0xff, 0x74, 0x25, 0xb4, 0x01, 0xcd, 0x16, 0x75, 0x1f, 0xe8, 0x05, 0x00, 0x73, 0xf5, 0xe9, + 0xa6, 0x00, 0xb4, 0x00, 0xcd, 0x1a, 0x3b, 0x4e, 0x06, 0x72, 0x07, 0x77, 0x07, 0x3b, 0x56, 0x04, + 0x77, 0x02, 0xf8, 0xc3, 0xf9, 0xc3, 0xe8, 0x37, 0x00, 0xb4, 0x00, 0xcd, 0x16, 0x80, 0xfc, 0x50, + 0x74, 0x0d, 0x80, 0xfc, 0x48, 0x74, 0x19, 0x80, 0xfc, 0x1c, 0x75, 0xed, 0xe9, 0x79, 0x00, 0x8b, + 0x46, 0x00, 0x40, 0x3b, 0x06, 0x15, 0x04, 0x75, 0x02, 0x31, 0xc0, 0x89, 0x46, 0x00, 0xeb, 0xd6, + 0x8b, 0x46, 0x00, 0x09, 0xc0, 0x75, 0x03, 0xa1, 0x15, 0x04, 0x48, 0x89, 0x46, 0x00, 0xeb, 0xc6, + 0x8a, 0x46, 0x02, 0x88, 0x46, 0x09, 0xbe, 0x1b, 0x04, 0x31, 0xc9, 0xac, 0x04, 0x03, 0xd0, 0xe8, + 0xb2, 0x28, 0x28, 0xc2, 0x88, 0x56, 0x08, 0xb0, 0x10, 0xe8, 0x30, 0x00, 0xfe, 0x46, 0x08, 0x89, + 0xcf, 0x81, 0xe7, 0x03, 0x00, 0x8a, 0x9d, 0xda, 0x03, 0x3b, 0x4e, 0x00, 0x75, 0x03, 0x80, 0xf3, + 0x08, 0xe8, 0xb6, 0x00, 0x81, 0xc6, 0x09, 0x00, 0x80, 0x46, 0x08, 0x01, 0xb0, 0x11, 0xe8, 0x0b, + 0x00, 0xfe, 0x46, 0x09, 0x41, 0x3b, 0x0e, 0x15, 0x04, 0x75, 0xc0, 0xc3, 0x3b, 0x4e, 0x00, 0x74, + 0x02, 0xb0, 0x20, 0xb3, 0x0f, 0xe9, 0xb6, 0x00, 0xe8, 0x96, 0xfd, 0xe8, 0x83, 0x00, 0xac, 0x88, + 0xc2, 0xbf, 0xd2, 0x03, 0xb9, 0x04, 0x00, 0xad, 0xab, 0xe2, 0xfc, 0xb4, 0x42, 0xbe, 0xca, 0x03, + 0xcd, 0x13, 0xbe, 0xde, 0x03, 0x72, 0x40, 0xa1, 0xfe, 0x01, 0x3d, 0x55, 0xaa, 0xbe, 0xf4, 0x03, + 0x75, 0x35, 0xb4, 0x06, 0x30, 0xc0, 0xb7, 0x0f, 0x31, 0xc9, 0xba, 0x4f, 0x18, 0xcd, 0x10, 0xc7, + 0x46, 0x08, 0x00, 0x00, 0xbe, 0x0d, 0x04, 0xb3, 0x07, 0xe8, 0x4e, 0x00, 0xfe, 0x46, 0x08, 0xe8, + 0x29, 0x00, 0x46, 0xe8, 0x44, 0x00, 0xba, 0x00, 0x01, 0x30, 0xff, 0xb4, 0x02, 0xcd, 0x10, 0xe8, + 0x2f, 0x00, 0x8a, 0x14, 0xe9, 0xa9, 0xfc, 0xba, 0x1a, 0x15, 0x89, 0x56, 0x08, 0xbb, 0x0f, 0x00, + 0xe8, 0x27, 0x00, 0xb4, 0x00, 0xcd, 0x16, 0xb2, 0x80, 0xcd, 0x19, 0xbe, 0x1b, 0x04, 0x8b, 0x4e, + 0x00, 0x41, 0x30, 0xe4, 0xe9, 0x07, 0x00, 0xac, 0x01, 0xc6, 0x81, 0xc6, 0x09, 0x00, 0xe2, 0xf7, + 0xc3, 0xe8, 0xe7, 0xff, 0xac, 0x30, 0xe4, 0x01, 0xc6, 0xc3, 0x50, 0x53, 0x51, 0x52, 0x30, 0xff, + 0xe9, 0x11, 0x00, 0x8b, 0x56, 0x08, 0xb4, 0x02, 0xcd, 0x10, 0xfe, 0x46, 0x08, 0xb9, 0x01, 0x00, + 0xb4, 0x09, 0xcd, 0x10, 0xac, 0x3c, 0x00, 0x75, 0xea, 0x5a, 0x59, 0x5b, 0x58, 0xc3, 0x50, 0x53, + 0x51, 0x52, 0x30, 0xff, 0x8b, 0x56, 0x08, 0xb4, 0x02, 0xcd, 0x10, 0xfe, 0x46, 0x08, 0xb9, 0x01, + 0x00, 0xb4, 0x09, 0xcd, 0x10, 0x5a, 0x59, 0x5b, 0x58, 0xc3, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x02, 0x03, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x73, 0x00, 0x4e, 0x6f, 0x74, 0x20, 0x61, 0x20, 0x62, 0x6f, 0x6f, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x4c, 0x6f, 0x61, + 0x64, 0x69, 0x6e, 0x67, 0x00 }; diff --git a/src/apps/bootman/BootManager.cpp b/src/apps/bootman/BootManager.cpp index 4a29313d24..f078d84aae 100644 --- a/src/apps/bootman/BootManager.cpp +++ b/src/apps/bootman/BootManager.cpp @@ -16,6 +16,7 @@ #include +#undef TR_CONTEXT #define TR_CONTEXT "BootManager" diff --git a/src/apps/bootman/BootManagerWindow.cpp b/src/apps/bootman/BootManagerWindow.cpp index 2bba855195..378d27f3a1 100644 --- a/src/apps/bootman/BootManagerWindow.cpp +++ b/src/apps/bootman/BootManagerWindow.cpp @@ -22,6 +22,7 @@ #include +#undef TR_CONTEXT #define TR_CONTEXT "BootManagerWindow" diff --git a/src/apps/bootman/DefaultPartitionPage.cpp b/src/apps/bootman/DefaultPartitionPage.cpp index d4fc0db2c3..d904ebc758 100644 --- a/src/apps/bootman/DefaultPartitionPage.cpp +++ b/src/apps/bootman/DefaultPartitionPage.cpp @@ -11,23 +11,87 @@ #include +#include #include - #include #include #include #include -#include - +#include #include #include +#include +#undef TR_CONTEXT #define TR_CONTEXT "DefaultPartitionPage" -const uint32 kMsgPartition = 'part'; -const uint32 kMsgTimeout = 'time'; +enum { + 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) @@ -55,10 +119,7 @@ void DefaultPartitionPage::AttachedToWindow() { fDefaultPartition->Menu()->SetTargetForItems(this); - fWait0->SetTarget(this); - fWait5->SetTarget(this); - fWait10->SetTarget(this); - fWait15->SetTarget(this); + fTimeoutSlider->SetTarget(this); } @@ -75,9 +136,13 @@ DefaultPartitionPage::MessageReceived(BMessage* msg) break; case kMsgTimeout: { - int32 timeout; - msg->FindInt32("timeout", &timeout); + int32 sliderValue = fTimeoutSlider->Value(); + int32 timeout = get_timeout_for_index(sliderValue); fSettings->ReplaceInt32("timeout", timeout); + + BString label; + _GetTimeoutLabel(timeout, label); + fTimeoutSlider->SetLabel(label.String()); } break; default: @@ -86,7 +151,7 @@ DefaultPartitionPage::MessageReceived(BMessage* msg) } -static const float kTextDistance = 10; +#define kTextDistance be_control_look->DefaultItemSpacing(); void DefaultPartitionPage::_BuildUI() @@ -100,7 +165,8 @@ DefaultPartitionPage::_BuildUI() "The boot menu will load the default partition after " "the timeout unless you select another partition. 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); MakeHeading(fDescription); @@ -116,17 +182,26 @@ DefaultPartitionPage::_BuildUI() AddChild(fDefaultPartition); fDefaultPartition->ResizeToPreferred(); + // timeout slider rect.top = fDefaultPartition->Frame().bottom + kTextDistance; int32 timeout; fSettings->FindInt32("timeout", &timeout); - fWait0 = _CreateWaitRadioButton(rect, "wait0", TR("Wait Indefinitely"), - -1, timeout); - fWait5 = _CreateWaitRadioButton(rect, "wait5", TR("Wait 5 Seconds"), - 5, timeout); - fWait10 = _CreateWaitRadioButton(rect, "wait10", TR("Wait 10 Seconds"), - 10, timeout); - fWait15 = _CreateWaitRadioButton(rect, "wait15", TR("Wait 15 Seconds"), - 15, timeout); + BString timeoutLabel; + _GetTimeoutLabel(timeout, timeoutLabel); + + int32 sliderValue = get_index_for_timeout(timeout); + + fTimeoutSlider = new BSlider(rect, "timeout", timeoutLabel.String(), + new BMessage(kMsgTimeout), 0, kNumberOfTimeoutOptions-1, + 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(); } @@ -169,20 +244,12 @@ DefaultPartitionPage::_CreatePopUpMenu() } -BRadioButton* -DefaultPartitionPage::_CreateWaitRadioButton(BRect rect, const char* name, const char* label, int32 timeout, - int32 defaultTimeout) +void +DefaultPartitionPage::_GetTimeoutLabel(int32 timeout, BString& label) { - BMessage* msg = new BMessage(kMsgTimeout); - msg->AddInt32("timeout", timeout); - BRadioButton* button = new BRadioButton(rect, name, label, msg); - AddChild(button); - button->ResizeToPreferred(); - - if (timeout == defaultTimeout) - button->SetValue(1); - - return button; + const char* text = TR(get_label_for_timeout(timeout)); + label = TR("Timeout: %s"); + label.ReplaceFirst("%s", text); } @@ -194,18 +261,9 @@ DefaultPartitionPage::_Layout() float left = fDefaultPartition->Frame().left; float top = fDescription->Frame().bottom + kTextDistance; - BView* controls[] = { - fDefaultPartition, - fWait0, - fWait5, - fWait10, - fWait15 - }; - - for (int i = 0; i < 5; i ++) { - BView* view = controls[i]; - view->MoveTo(left, top); - top = view->Frame().bottom + 3; - } + fDefaultPartition->MoveTo(left, top); + top = fDefaultPartition->Frame().bottom + kTextDistance; + + fTimeoutSlider->MoveTo(left, top); } diff --git a/src/apps/bootman/DefaultPartitionPage.h b/src/apps/bootman/DefaultPartitionPage.h index 99735641b6..6358f8e855 100644 --- a/src/apps/bootman/DefaultPartitionPage.h +++ b/src/apps/bootman/DefaultPartitionPage.h @@ -11,10 +11,12 @@ #include "WizardPageView.h" + class BMenuField; class BMessage; -class BRadioButton; class BPopUpMenu; +class BRadioButton; +class BSlider; class BTextView; @@ -33,16 +35,12 @@ private: void _BuildUI(); BPopUpMenu* _CreatePopUpMenu(); - BRadioButton* _CreateWaitRadioButton(BRect frame, const char* name, const char* label, - int32 timeout, int32 defaultTimeout); + void _GetTimeoutLabel(int32 timeout, BString& label); void _Layout(); BTextView* fDescription; BMenuField* fDefaultPartition; - BRadioButton* fWait0; - BRadioButton* fWait5; - BRadioButton* fWait10; - BRadioButton* fWait15; + BSlider* fTimeoutSlider; }; #endif // DEFAULT_PARTITON_PAGE_H diff --git a/src/apps/bootman/EntryPage.cpp b/src/apps/bootman/EntryPage.cpp index 57c59edeb3..ade9985a0b 100644 --- a/src/apps/bootman/EntryPage.cpp +++ b/src/apps/bootman/EntryPage.cpp @@ -17,6 +17,7 @@ #include +#undef TR_CONTEXT #define TR_CONTEXT "EntryPage" diff --git a/src/apps/bootman/FileSelectionPage.cpp b/src/apps/bootman/FileSelectionPage.cpp index 7d944995d1..3ba2e7c453 100644 --- a/src/apps/bootman/FileSelectionPage.cpp +++ b/src/apps/bootman/FileSelectionPage.cpp @@ -21,6 +21,7 @@ #include +#undef TR_CONTEXT #define TR_CONTEXT "FileSelectionPage" diff --git a/src/apps/bootman/LegacyBootDrive.cpp b/src/apps/bootman/LegacyBootDrive.cpp index 0d8af69416..1b24a90545 100644 --- a/src/apps/bootman/LegacyBootDrive.cpp +++ b/src/apps/bootman/LegacyBootDrive.cpp @@ -37,6 +37,7 @@ #include "BootLoader.h" +#undef TR_CONTEXT #define TR_CONTEXT "LegacyBootDrive" #define USE_SECOND_DISK 0 #define GET_FIRST_BIOS_DRIVE 1 diff --git a/src/apps/bootman/PartitionsPage.cpp b/src/apps/bootman/PartitionsPage.cpp index 5ae5b561a3..15128bcc57 100644 --- a/src/apps/bootman/PartitionsPage.cpp +++ b/src/apps/bootman/PartitionsPage.cpp @@ -24,6 +24,7 @@ #include +#undef TR_CONTEXT #define TR_CONTEXT "PartitionsPage" diff --git a/src/apps/bootman/UninstallPage.cpp b/src/apps/bootman/UninstallPage.cpp index 187d841083..3d15fc535e 100644 --- a/src/apps/bootman/UninstallPage.cpp +++ b/src/apps/bootman/UninstallPage.cpp @@ -17,6 +17,7 @@ #include +#undef TR_CONTEXT #define TR_CONTEXT "UninstallPage" diff --git a/src/apps/bootman/WizardView.cpp b/src/apps/bootman/WizardView.cpp index aa4daab3eb..0171edc0da 100644 --- a/src/apps/bootman/WizardView.cpp +++ b/src/apps/bootman/WizardView.cpp @@ -15,6 +15,7 @@ #include +#undef TR_CONTEXT #define TR_CONTEXT "WizardView" diff --git a/src/apps/bootman/bootman.S b/src/apps/bootman/bootman.S index f1c08d197f..596dcc5dc9 100644 --- a/src/apps/bootman/bootman.S +++ b/src/apps/bootman/bootman.S @@ -96,6 +96,9 @@ %assign PROBE_CHAR 0x01 ; -> zf = 0 ; al - ASCII char ; ah - scan code + +%assign GET_MODIFIER_KEYS 0x02 ;-> al - modifier key bitmask + ; timer services %assign READ_CLOCK 0x00 ; -> cx - high word ; dx - low word @@ -138,6 +141,16 @@ %assign KEY_UP 0x48 %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 %define TITLE 'Haiku Boot Manager' %strlen TITLE_LENGTH TITLE @@ -348,7 +361,7 @@ kMBRSignature: ; Use code available in stage 1 %define printstr printStringStage2 -%assign TIMEOUT_OFF 0xffff +%assign TIMEOUT_OFF 0xffff stage2: @@ -375,6 +388,13 @@ stage2: sub bl, al ; y = TEXT_ROWS / 2 - number of items / 2 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 cmp word [timeout], TIMEOUT_OFF