[haiku-commits] r35925 - haiku/trunk/src/apps/bootman

Author: laplace
Date: 2010-03-21 16:40:00 +0100 (Sun, 21 Mar 2010)
New Revision: 35925
Changeset: http://dev.haiku-os.org/changeset/35925/haiku
Ticket: http://dev.haiku-os.org/ticket/5227

Modified:
   haiku/trunk/src/apps/bootman/BootLoader.h
   haiku/trunk/src/apps/bootman/BootManager.cpp
   haiku/trunk/src/apps/bootman/BootManagerWindow.cpp
   haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp
   haiku/trunk/src/apps/bootman/DefaultPartitionPage.h
   haiku/trunk/src/apps/bootman/EntryPage.cpp
   haiku/trunk/src/apps/bootman/FileSelectionPage.cpp
   haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp
   haiku/trunk/src/apps/bootman/PartitionsPage.cpp
   haiku/trunk/src/apps/bootman/UninstallPage.cpp
   haiku/trunk/src/apps/bootman/WizardView.cpp
   haiku/trunk/src/apps/bootman/bootman.S
Log:
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


Modified: haiku/trunk/src/apps/bootman/BootLoader.h
===================================================================
--- haiku/trunk/src/apps/bootman/BootLoader.h   2010-03-21 11:25:02 UTC (rev 
35924)
+++ haiku/trunk/src/apps/bootman/BootLoader.h   2010-03-21 15:40:00 UTC (rev 
35925)
@@ -34,37 +34,38 @@
        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
 };

Modified: haiku/trunk/src/apps/bootman/BootManager.cpp
===================================================================
--- haiku/trunk/src/apps/bootman/BootManager.cpp        2010-03-21 11:25:02 UTC 
(rev 35924)
+++ haiku/trunk/src/apps/bootman/BootManager.cpp        2010-03-21 15:40:00 UTC 
(rev 35925)
@@ -16,6 +16,7 @@
 #include <TextView.h>
 
 
+#undef TR_CONTEXT
 #define TR_CONTEXT "BootManager"
 
 

Modified: haiku/trunk/src/apps/bootman/BootManagerWindow.cpp
===================================================================
--- haiku/trunk/src/apps/bootman/BootManagerWindow.cpp  2010-03-21 11:25:02 UTC 
(rev 35924)
+++ haiku/trunk/src/apps/bootman/BootManagerWindow.cpp  2010-03-21 15:40:00 UTC 
(rev 35925)
@@ -22,6 +22,7 @@
 #include <math.h>
 
 
+#undef TR_CONTEXT
 #define TR_CONTEXT "BootManagerWindow"
 
 

Modified: haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp
===================================================================
--- haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp       2010-03-21 
11:25:02 UTC (rev 35924)
+++ haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp       2010-03-21 
15:40:00 UTC (rev 35925)
@@ -11,25 +11,89 @@
 
 
 #include <Catalog.h>
+#include <ControlLook.h>
 #include <Message.h>
-
 #include <MenuItem.h>
 #include <MenuField.h>
 #include <PopUpMenu.h>
 #include <RadioButton.h>
-#include <TextView.h>
-
+#include <Slider.h>
 #include <string.h>
 #include <String.h>
+#include <TextView.h>
 
 
+#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)
        : WizardPageView(settings, frame, name, B_FOLLOW_ALL, 
                B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE)
@@ -55,10 +119,7 @@
 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 @@
                        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 @@
 }
 
 
-static const float kTextDistance = 10;
+#define kTextDistance be_control_look->DefaultItemSpacing();
 
 void
 DefaultPartitionPage::_BuildUI()
@@ -100,7 +165,8 @@
                "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 @@
        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 @@
 }
 
 
-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 @@
        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);
 }
 

Modified: haiku/trunk/src/apps/bootman/DefaultPartitionPage.h
===================================================================
--- haiku/trunk/src/apps/bootman/DefaultPartitionPage.h 2010-03-21 11:25:02 UTC 
(rev 35924)
+++ haiku/trunk/src/apps/bootman/DefaultPartitionPage.h 2010-03-21 15:40:00 UTC 
(rev 35925)
@@ -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 @@
 
        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

Modified: haiku/trunk/src/apps/bootman/EntryPage.cpp
===================================================================
--- haiku/trunk/src/apps/bootman/EntryPage.cpp  2010-03-21 11:25:02 UTC (rev 
35924)
+++ haiku/trunk/src/apps/bootman/EntryPage.cpp  2010-03-21 15:40:00 UTC (rev 
35925)
@@ -17,6 +17,7 @@
 #include <string.h>
 
 
+#undef TR_CONTEXT
 #define TR_CONTEXT "EntryPage"
 
 

Modified: haiku/trunk/src/apps/bootman/FileSelectionPage.cpp
===================================================================
--- haiku/trunk/src/apps/bootman/FileSelectionPage.cpp  2010-03-21 11:25:02 UTC 
(rev 35924)
+++ haiku/trunk/src/apps/bootman/FileSelectionPage.cpp  2010-03-21 15:40:00 UTC 
(rev 35925)
@@ -21,6 +21,7 @@
 #include <String.h>
 
 
+#undef TR_CONTEXT
 #define TR_CONTEXT "FileSelectionPage"
 
 

Modified: haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp
===================================================================
--- haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp    2010-03-21 11:25:02 UTC 
(rev 35924)
+++ haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp    2010-03-21 15:40:00 UTC 
(rev 35925)
@@ -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

Modified: haiku/trunk/src/apps/bootman/PartitionsPage.cpp
===================================================================
--- haiku/trunk/src/apps/bootman/PartitionsPage.cpp     2010-03-21 11:25:02 UTC 
(rev 35924)
+++ haiku/trunk/src/apps/bootman/PartitionsPage.cpp     2010-03-21 15:40:00 UTC 
(rev 35925)
@@ -24,6 +24,7 @@
 #include <String.h>
 
 
+#undef TR_CONTEXT
 #define TR_CONTEXT "PartitionsPage"
 
 

Modified: haiku/trunk/src/apps/bootman/UninstallPage.cpp
===================================================================
--- haiku/trunk/src/apps/bootman/UninstallPage.cpp      2010-03-21 11:25:02 UTC 
(rev 35924)
+++ haiku/trunk/src/apps/bootman/UninstallPage.cpp      2010-03-21 15:40:00 UTC 
(rev 35925)
@@ -17,6 +17,7 @@
 #include <string.h>
 
 
+#undef TR_CONTEXT
 #define TR_CONTEXT "UninstallPage"
 
 

Modified: haiku/trunk/src/apps/bootman/WizardView.cpp
===================================================================
--- haiku/trunk/src/apps/bootman/WizardView.cpp 2010-03-21 11:25:02 UTC (rev 
35924)
+++ haiku/trunk/src/apps/bootman/WizardView.cpp 2010-03-21 15:40:00 UTC (rev 
35925)
@@ -15,6 +15,7 @@
 #include <Catalog.h>
 
 
+#undef TR_CONTEXT
 #define TR_CONTEXT "WizardView"
 
 

Modified: haiku/trunk/src/apps/bootman/bootman.S
===================================================================
--- haiku/trunk/src/apps/bootman/bootman.S      2010-03-21 11:25:02 UTC (rev 
35924)
+++ haiku/trunk/src/apps/bootman/bootman.S      2010-03-21 15:40:00 UTC (rev 
35925)
@@ -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 @@
 ; Use code available in stage 1
 %define printstr printStringStage2
 
-%assign        TIMEOUT_OFF     0xffff
+%assign        TIMEOUT_OFF             0xffff
 
 
 stage2:
@@ -375,6 +388,13 @@
        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


Other related posts:

  • » [haiku-commits] r35925 - haiku/trunk/src/apps/bootman - michael . w . pfeiffer