Author: mmadia Date: 2010-05-06 18:11:12 +0200 (Thu, 06 May 2010) New Revision: 36663 Changeset: http://dev.haiku-os.org/changeset/36663/haiku Ticket: http://dev.haiku-os.org/ticket/5408 Modified: haiku/trunk/src/apps/bootman/BootManager.cpp haiku/trunk/src/apps/bootman/BootManagerController.cpp haiku/trunk/src/apps/bootman/BootManagerWindow.cpp haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp 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 Log: Updated to use B_TRANSLATE* macros. relates to #5408. Modified: haiku/trunk/src/apps/bootman/BootManager.cpp =================================================================== --- haiku/trunk/src/apps/bootman/BootManager.cpp 2010-05-06 16:06:33 UTC (rev 36662) +++ haiku/trunk/src/apps/bootman/BootManager.cpp 2010-05-06 16:11:12 UTC (rev 36663) @@ -1,12 +1,12 @@ /* * Copyright 2008-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * + * * Authors: * Michael Pfeiffer <laplace@xxxxxxxxxxxxxxxxxxxxx> * Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> - */ - + */ + #include "BootManagerWindow.h" #include <Alert.h> @@ -55,17 +55,19 @@ BootManager::AboutRequested() { BString aboutText; - const char* title = TR_CMT("Haiku Boot Manager", "About text title"); + const char* title = B_TRANSLATE_COMMENT("Haiku Boot Manager", + "About text title"); aboutText << title << "\n\n" << - TR("written by") << "\n" + B_TRANSLATE("written by") << "\n" "\tDavid Dengg\n" "\tMichael Pfeiffer\n" "\n" << - TR_CMT("Copyright %year, Haiku Inc.\n", "Leave %year untranslated"); + B_TRANSLATE_COMMENT("Copyright %year, Haiku Inc.\n", + "Leave %year untranslated"); aboutText.ReplaceLast("%year", "2008-2010"); BAlert *alert = new BAlert("about", - aboutText.String(), TR("OK")); + aboutText.String(), B_TRANSLATE("OK")); BTextView *view = alert->TextView(); BFont font; Modified: haiku/trunk/src/apps/bootman/BootManagerController.cpp =================================================================== --- haiku/trunk/src/apps/bootman/BootManagerController.cpp 2010-05-06 16:06:33 UTC (rev 36662) +++ haiku/trunk/src/apps/bootman/BootManagerController.cpp 2010-05-06 16:11:12 UTC (rev 36663) @@ -155,8 +155,8 @@ } BAlert* alert = new BAlert("info", - TR("At least one partition must be selected!"), - TR_CMT("OK", "Button")); + B_TRANSLATE("At least one partition must be selected!"), + B_TRANSLATE_COMMENT("OK", "Button")); alert->Go(); return false; @@ -166,10 +166,10 @@ bool BootManagerController::_WriteBootMenu() { - BAlert* alert = new BAlert("confirm", TR("About to write the boot menu " - "to disk. Are you sure you want to continue?"), - TR_CMT("Write boot menu", "Button"), - TR_CMT("Back", "Button"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + BAlert* alert = new BAlert("confirm", B_TRANSLATE("About to write the " + "boot menu to disk. Are you sure you want to continue?"), + B_TRANSLATE_COMMENT("Write boot menu", "Button"), + B_TRANSLATE_COMMENT("Back", "Button"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); if (alert->Go() == 1) return false; @@ -199,15 +199,15 @@ fSettings.FindString("file", &path); BString message; - message << TR_CMT("About to restore the Master Boot Record (MBR) of" - " %disk from %file. Do you wish to continue?", + message << B_TRANSLATE_COMMENT("About to restore the Master Boot Record " + "(MBR) of %disk from %file. Do you wish to continue?", "Don't translate the place holders: %disk and %file"); message.ReplaceFirst("%disk", disk); message.ReplaceFirst("%file", path); BAlert* alert = new BAlert("confirm", message.String(), - TR_CMT("Restore MBR", "Button"), - TR_CMT("Back", "Button"), + B_TRANSLATE_COMMENT("Restore MBR", "Button"), + B_TRANSLATE_COMMENT("Back", "Button"), NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); if (alert->Go() == 1) return false; @@ -232,7 +232,7 @@ case kStateErrorEntry: page = _CreateErrorEntryPage(frame); wizard->SetPreviousButtonHidden(true); - wizard->SetNextButtonLabel(TR_CMT("Done", "Button")); + wizard->SetNextButtonLabel(B_TRANSLATE_COMMENT("Done", "Button")); break; case kStateSaveMBR: page = _CreateSaveMBRPage(frame); @@ -250,21 +250,21 @@ break; case kStateInstallSummary: page = _CreateInstallSummaryPage(frame); - wizard->SetNextButtonLabel(TR_CMT("Next", "Button")); + wizard->SetNextButtonLabel(B_TRANSLATE_COMMENT("Next", "Button")); break; case kStateInstalled: page = _CreateInstalledPage(frame); - wizard->SetNextButtonLabel(TR_CMT("Done", "Button")); + wizard->SetNextButtonLabel(B_TRANSLATE_COMMENT("Done", "Button")); break; case kStateUninstall: page = _CreateUninstallPage(frame); wizard->SetPreviousButtonHidden(false); - wizard->SetNextButtonLabel(TR_CMT("Next", "Button")); + wizard->SetNextButtonLabel(B_TRANSLATE_COMMENT("Next", "Button")); break; case kStateUninstalled: // TODO prevent overwriting MBR after clicking "Previous" page = _CreateUninstalledPage(frame); - wizard->SetNextButtonLabel(TR_CMT("Done", "Button")); + wizard->SetNextButtonLabel(B_TRANSLATE_COMMENT("Done", "Button")); break; } @@ -279,15 +279,17 @@ if (fReadPartitionsStatus == kErrorBootSectorTooSmall) description << - TR_CMT("Partition table not compatible", "Title") << "\n\n" << - TR("The partition table of the first hard disk is not compatible " - "with Boot Manager.\n" + B_TRANSLATE_COMMENT("Partition table not compatible", "Title") << + "\n\n" << + B_TRANSLATE("The partition table of the first hard disk is not " + "compatible with Boot Manager.\n" "Boot Manager needs 2 KB available space before the first " "partition."); else description << - TR_CMT("Error reading partition table", "Title") << "\n\n" << - TR("Boot Manager is unable to read the partition table!"); + B_TRANSLATE_COMMENT("Error reading partition table", "Title") << + "\n\n" << + B_TRANSLATE("Boot Manager is unable to read the partition table!"); return new DescriptionPage(frame, "errorEntry", description.String(), true); } @@ -301,8 +303,8 @@ fSettings.FindString("disk", &disk); description << - TR_CMT("Backup Master Boot Record", "Title") << "\n\n" << - TR("The Master Boot Record (MBR) of the boot device:\n" + B_TRANSLATE_COMMENT("Backup Master Boot Record", "Title") << "\n\n" << + B_TRANSLATE("The Master Boot Record (MBR) of the boot device:\n" "\t%s\n" "will now be saved to disk. Please select a file to " "save the MBR into.\n\n" @@ -326,8 +328,10 @@ if (fSaveMBRStatus == B_OK) { description << - TR_CMT("Old Master Boot Record saved", "Title") << "\n\n" << - TR("The old Master Boot Record was successfully save to %s.") << + B_TRANSLATE_COMMENT("Old Master Boot Record saved", "Title") << + "\n\n" << + B_TRANSLATE("The old Master Boot Record was successfully save to " + "%s.") << "\n"; } else { description << Modified: haiku/trunk/src/apps/bootman/BootManagerWindow.cpp =================================================================== --- haiku/trunk/src/apps/bootman/BootManagerWindow.cpp 2010-05-06 16:06:33 UTC (rev 36662) +++ haiku/trunk/src/apps/bootman/BootManagerWindow.cpp 2010-05-06 16:11:12 UTC (rev 36663) @@ -1,7 +1,7 @@ /* * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * + * * Authors: * Michael Pfeiffer <laplace@xxxxxxxxxxxxxxxxxxxxx> */ @@ -32,19 +32,20 @@ BootManagerWindow::BootManagerWindow() : - BWindow(BRect(100, 100, 500, 400), TR_CMT("Boot Manager", "Window Title"), + BWindow(BRect(100, 100, 500, 400), B_TRANSLATE_COMMENT("Boot Manager", + "Window Title"), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE) { float minWidth, maxWidth, minHeight, maxHeight; GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); SetSizeLimits(250, maxWidth, 250, maxHeight); - + fWizardView = new WizardView(Bounds(), "wizard", B_FOLLOW_ALL); AddChild(fWizardView); - + fController.Initialize(fWizardView); - + AddShortcut('A', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED)); CenterOnScreen(); @@ -68,18 +69,18 @@ case kMessageNext: fController.Next(fWizardView); break; - + case kMessagePrevious: fController.Previous(fWizardView); break; - + case B_ABOUT_REQUESTED: be_app_messenger.SendMessage(B_ABOUT_REQUESTED); break; - + default: BWindow::MessageReceived(msg); - } + } } Modified: haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp =================================================================== --- haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp 2010-05-06 16:06:33 UTC (rev 36662) +++ haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp 2010-05-06 16:11:12 UTC (rev 36663) @@ -1,7 +1,7 @@ /* * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * + * * Authors: * Michael Pfeiffer <laplace@xxxxxxxxxxxxxxxxxxxxx> */ @@ -45,14 +45,14 @@ 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")} + { 0, B_TRANSLATE_MARK("Immediately")}, + { 1, B_TRANSLATE_MARK("After one second")}, + { 2, B_TRANSLATE_MARK("After two seconds")}, + { 3, B_TRANSLATE_MARK("After three seconds")}, + { 4, B_TRANSLATE_MARK("After four seconds")}, + { 5, B_TRANSLATE_MARK("After five seconds")}, + { 60, B_TRANSLATE_MARK("After one minute")}, + { kTimeoutIndefinitely, B_TRANSLATE_MARK("Never")} }; @@ -95,7 +95,7 @@ DefaultPartitionPage::DefaultPartitionPage(BMessage* settings, BRect frame, const char* name) - : WizardPageView(settings, frame, name, B_FOLLOW_ALL, + : WizardPageView(settings, frame, name, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE) { _BuildUI(); @@ -157,11 +157,11 @@ DefaultPartitionPage::_BuildUI() { BRect rect(Bounds()); - + BString text; text << - TR_CMT("Default Partition", "Title") << "\n\n" << - TR("Please specify a default partition and a timeout.\n" + B_TRANSLATE_COMMENT("Default Partition", "Title") << "\n\n" << + B_TRANSLATE("Please specify a default partition and a timeout.\n" "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 " @@ -173,15 +173,16 @@ AddChild(fDescription); LayoutDescriptionVertically(fDescription); rect.top = fDescription->Frame().bottom + kTextDistance; - - BPopUpMenu* popUpMenu = _CreatePopUpMenu(); + + BPopUpMenu* popUpMenu = _CreatePopUpMenu(); fDefaultPartition = new BMenuField(rect, "partitions", - TR_CMT("Default Partition:", "Menu field label"), popUpMenu); + B_TRANSLATE_COMMENT("Default Partition:", "Menu field label"), + popUpMenu); float divider = be_plain_font->StringWidth(fDefaultPartition->Label()) + 3; fDefaultPartition->SetDivider(divider); AddChild(fDefaultPartition); fDefaultPartition->ResizeToPreferred(); - + // timeout slider rect.top = fDefaultPartition->Frame().bottom + kTextDistance; int32 timeout; @@ -197,12 +198,13 @@ B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); fTimeoutSlider->SetModificationMessage(new BMessage(kMsgTimeout)); fTimeoutSlider->SetValue(sliderValue); - fTimeoutSlider->SetLimitLabels(TR("Immediately"),TR("Never")); + fTimeoutSlider->SetLimitLabels(B_TRANSLATE("Immediately"), + B_TRANSLATE("Never")); fTimeoutSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fTimeoutSlider->SetHashMarkCount(kNumberOfTimeoutOptions); fTimeoutSlider->ResizeToPreferred(); AddChild(fTimeoutSlider); - + _Layout(); } @@ -212,20 +214,20 @@ { int32 defaultPartitionIndex; fSettings->FindInt32("defaultPartition", &defaultPartitionIndex); - + BMenuItem* selectedItem = NULL; int32 selectedItemIndex = 0; - - BPopUpMenu* menu = new BPopUpMenu(TR_CMT("Partitions", + + BPopUpMenu* menu = new BPopUpMenu(B_TRANSLATE_COMMENT("Partitions", "Pop up menu title")); BMessage message; for (int32 i = 0; fSettings->FindMessage("partition", i, &message) == B_OK; i ++) { - + bool show; if (message.FindBool("show", &show) != B_OK || !show) continue; - + BString name; message.FindString("name", &name); @@ -247,8 +249,8 @@ void DefaultPartitionPage::_GetTimeoutLabel(int32 timeout, BString& label) { - const char* text = TR(get_label_for_timeout(timeout)); - label = TR("Timeout: %s"); + const char* text = B_TRANSLATE(get_label_for_timeout(timeout)); + label = B_TRANSLATE("Timeout: %s"); label.ReplaceFirst("%s", text); } @@ -257,10 +259,10 @@ DefaultPartitionPage::_Layout() { LayoutDescriptionVertically(fDescription); - + float left = fDefaultPartition->Frame().left; float top = fDescription->Frame().bottom + kTextDistance; - + fDefaultPartition->MoveTo(left, top); top = fDefaultPartition->Frame().bottom + kTextDistance; Modified: haiku/trunk/src/apps/bootman/EntryPage.cpp =================================================================== --- haiku/trunk/src/apps/bootman/EntryPage.cpp 2010-05-06 16:06:33 UTC (rev 36662) +++ haiku/trunk/src/apps/bootman/EntryPage.cpp 2010-05-06 16:11:12 UTC (rev 36663) @@ -66,8 +66,8 @@ BString text; text << - TR_CMT("Install boot menu", "Title") << "\n\n" << - TR("Choose this option to install a boot menu, " + B_TRANSLATE_COMMENT("Install boot menu", "Title") << "\n\n" << + B_TRANSLATE("Choose this option to install a boot menu, " "allowing you to select which operating " "system to boot when you turn on your " "computer.") << "\n"; @@ -83,8 +83,8 @@ text.Truncate(0); text << - TR_CMT("Uninstall boot menu", "Title") << "\n\n" << - TR("Choose this option to remove the boot menu " + B_TRANSLATE_COMMENT("Uninstall boot menu", "Title") << "\n\n" << + B_TRANSLATE("Choose this option to remove the boot menu " "previously installed by this program.\n"); fUninstallText = CreateDescription(textRect, "uninstallText", text); MakeHeading(fUninstallText); Modified: haiku/trunk/src/apps/bootman/FileSelectionPage.cpp =================================================================== --- haiku/trunk/src/apps/bootman/FileSelectionPage.cpp 2010-05-06 16:06:33 UTC (rev 36662) +++ haiku/trunk/src/apps/bootman/FileSelectionPage.cpp 2010-05-06 16:11:12 UTC (rev 36663) @@ -1,7 +1,7 @@ /* * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * + * * Authors: * Michael Pfeiffer <laplace@xxxxxxxxxxxxxxxxxxxxx> */ @@ -30,7 +30,7 @@ FileSelectionPage::FileSelectionPage(BMessage* settings, BRect frame, const char* name, const char* description, file_panel_mode mode) - : WizardPageView(settings, frame, name, B_FOLLOW_ALL, + : WizardPageView(settings, frame, name, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE) , fMode(mode) , fFilePanel(NULL) @@ -93,16 +93,17 @@ FileSelectionPage::_BuildUI(const char* description) { BRect rect(Bounds()); - + fDescription = CreateDescription(rect, "description", description); - + MakeHeading(fDescription); AddChild(fDescription); - + BString file; fSettings->FindString("file", &file); - - fSelect = new BButton(rect, "select", TR_CMT("Select", "Button"), + + fSelect = new BButton(rect, "select", + B_TRANSLATE_COMMENT("Select", "Button"), new BMessage(kMsgOpenFilePanel), B_FOLLOW_RIGHT); fSelect->ResizeToPreferred(); @@ -110,14 +111,14 @@ float selectLeft = rect.right - fSelect->Bounds().Width(); rect.right = selectLeft - kFileButtonDistance; fFile = new BTextControl(rect, "file", - TR_CMT("File:", "Text control label"), + B_TRANSLATE_COMMENT("File:", "Text control label"), file.String(), new BMessage()); fFile->SetDivider(be_plain_font->StringWidth(fFile->Label()) + 5); AddChild(fFile); - + fSelect->MoveTo(selectLeft, 0); AddChild(fSelect); - + _Layout(); } @@ -126,7 +127,7 @@ FileSelectionPage::_Layout() { LayoutDescriptionVertically(fDescription); - + float left = fFile->Frame().left; float top = fDescription->Frame().bottom + kTextDistance; @@ -144,10 +145,10 @@ } fFile->MoveTo(left, fileTop); - + float width = fSelect->Frame().left - kFileButtonDistance - left; fFile->ResizeTo(width, fileHeight); - + left = fSelect->Frame().left; fSelect->MoveTo(left, selectTop); } @@ -167,7 +168,7 @@ if (file.GetParent(&parent) == B_OK && get_ref_for_path(parent.Path(), &base) == B_OK) directory = &base; - + BMessenger messenger(this); fFilePanel = new BFilePanel(fMode, &messenger, directory, B_FILE_NODE, @@ -198,7 +199,7 @@ BEntry entry(&entryRef); BPath path; if (entry.GetPath(&path) == B_OK) - fFile->SetText(path.Path()); + fFile->SetText(path.Path()); } } Modified: haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp =================================================================== --- haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp 2010-05-06 16:06:33 UTC (rev 36662) +++ haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp 2010-05-06 16:11:12 UTC (rev 36663) @@ -1,7 +1,7 @@ /* * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * + * * Authors: * Michael Pfeiffer <laplace@xxxxxxxxxxxxxxxxxxxxx> */ @@ -43,7 +43,7 @@ #define GET_FIRST_BIOS_DRIVE 1 -class Buffer : public BMallocIO +class Buffer : public BMallocIO { public: Buffer() : BMallocIO() {} @@ -58,7 +58,7 @@ bool -Buffer::WriteInt8(int8 value) +Buffer::WriteInt8(int8 value) { return Write(&value, sizeof(value)) == sizeof(value); } @@ -123,12 +123,12 @@ public: PartitionRecorder(BMessage* settings, int8 drive); - virtual bool Visit(BDiskDevice* device); + virtual bool Visit(BDiskDevice* device); virtual bool Visit(BPartition* partition, int32 level); - bool HasPartitions() const; + bool HasPartitions() const; off_t FirstOffset() const; - + private: bool _Record(BPartition* partition); @@ -181,7 +181,7 @@ { if (partition->ContainsPartitioningSystem()) return false; - + BPath partitionPath; partition->GetPath(&partitionPath); @@ -191,17 +191,18 @@ fIndex ++; BString number; number << fIndex; - buffer << TR_CMT("Unnamed %d", + buffer << B_TRANSLATE_COMMENT("Unnamed %d", "Default name of a partition whose name could not be read from " "disk; characters in codepage 437 are allowed only"); buffer.ReplaceFirst("%d", number); name = buffer.String(); } - + const char* type = partition->Type(); if (type == NULL) - type = TR_CMT("Unknown", "Text is shown for an unknown partition type"); - + type = B_TRANSLATE_COMMENT("Unknown", "Text is shown for an unknown " + "partition type"); + BMessage message; // Data as required by BootLoader.h message.AddBool("show", true); @@ -209,16 +210,16 @@ message.AddString("type", type); message.AddString("path", partitionPath.Path()); message.AddInt8("drive", fDrive); - message.AddInt64("size", partition->Size()); + message.AddInt64("size", partition->Size()); // Specific data off_t offset = partition->Offset(); message.AddInt64("offset", offset); - + fSettings->AddMessage("partition", &message); if (offset < fFirstOffset) fFirstOffset = offset; - + return false; } @@ -248,42 +249,42 @@ BDiskDevice device; bool diskFound = false; while (diskDeviceRoster.GetNextDevice(&device) == B_OK) { - + BPath path; - status_t status = device.GetPath(&path); + status_t status = device.GetPath(&path); if (status != B_OK) return status; - + // skip not from BIOS bootable drives int8 drive; if (!_GetBiosDrive(path.Path(), &drive)) continue; - + PartitionRecorder recorder(settings, drive); device.VisitEachDescendant(&recorder); if (!diskFound) { settings->AddString("disk", path.Path()); diskFound = true; - + #if !USE_SECOND_DISK // Enough space to write boot menu to drive? // (ignored in test build) off_t size = sizeof(kBootLoader); if (!recorder.HasPartitions() || recorder.FirstOffset() < size) return kErrorBootSectorTooSmall; - + // TODO remove when booting from all drives works break; #endif } - } + } #if USE_SECOND_DISK // for testing only write boot menu to second hdd settings->ReplaceString("disk", "/dev/disk/ata/1/master/raw"); #endif - + if (diskFound) return B_OK; else @@ -297,40 +298,40 @@ BString path; if (settings->FindString("disk", &path) != B_OK) return B_BAD_VALUE; - + int32 defaultPartitionIndex; if (settings->FindInt32("defaultPartition", &defaultPartitionIndex) != B_OK) return B_BAD_VALUE; - + int32 timeout; if (settings->FindInt32("timeout", &timeout) != B_OK) return B_BAD_VALUE; - + int fd = open(path.String(), O_RDWR); if (fd < 0) return B_IO_ERROR; - + MasterBootRecord oldMBR; if (read(fd, &oldMBR, sizeof(oldMBR)) != sizeof(oldMBR)) { close(fd); return B_IO_ERROR; } - + if (!_IsValid(&oldMBR)) { close(fd); return B_BAD_VALUE; } - + Buffer newBootLoader; ssize_t size = sizeof(kBootLoader); if (newBootLoader.Write(kBootLoader, size) != size) { close(fd); return B_NO_MEMORY; } - + MasterBootRecord* newMBR = (MasterBootRecord*)newBootLoader.BMallocIO::Buffer(); _CopyPartitionTable(newMBR, &oldMBR); - + int menuEntries = 0; int defaultMenuEntry = 0; BMessage partition; @@ -342,14 +343,14 @@ continue; if (index == defaultPartitionIndex) defaultMenuEntry = menuEntries; - + menuEntries ++; } newBootLoader.WriteInt16(menuEntries); newBootLoader.WriteInt16(defaultMenuEntry); newBootLoader.WriteInt16(timeout); - - + + for (index = 0; settings->FindMessage("partition", index, &partition) == B_OK; index ++) { bool show; BString name; @@ -364,20 +365,20 @@ partition.FindInt8("drive", &drive); if (!show) continue; - + BString biosName; _ConvertToBIOSText(name.String(), biosName); newBootLoader.WriteString(biosName.String()); newBootLoader.WriteInt8(drive); newBootLoader.WriteInt64(offset / kBlockSize); - } + } if (!newBootLoader.Align(kBlockSize)) { close(fd); return B_ERROR; } - + lseek(fd, 0, SEEK_SET); const uint8* buffer = (uint8*)newBootLoader.BMallocIO::Buffer(); status_t status = _WriteBlocks(fd, buffer, newBootLoader.Position()); @@ -388,20 +389,20 @@ status_t LegacyBootDrive::SaveMasterBootRecord(BMessage* settings, BFile* file) -{ +{ BString path; if (settings->FindString("disk", &path) != B_OK) return B_BAD_VALUE; - + int fd = open(path.String(), O_RDONLY); if (fd < 0) return B_IO_ERROR; - + ssize_t size = kBlockSize * kNumberOfBootLoaderBlocks; uint8* buffer = new(std::nothrow) uint8[size]; if (buffer == NULL) { - close(fd); + close(fd); return B_NO_MEMORY; } @@ -410,7 +411,7 @@ close(fd); delete[] buffer; return B_IO_ERROR; - } + } MasterBootRecord* mbr = (MasterBootRecord*)buffer; if (!_IsValid(mbr)) { @@ -421,7 +422,7 @@ if (file->Write(buffer, size) != size) status = B_IO_ERROR; - delete[] buffer; + delete[] buffer; close(fd); return status; } @@ -433,27 +434,27 @@ BString path; if (settings->FindString("disk", &path) != B_OK) return B_BAD_VALUE; - + int fd = open(path.String(), O_RDWR); if (fd < 0) return B_IO_ERROR; - + MasterBootRecord oldMBR; if (read(fd, &oldMBR, sizeof(oldMBR)) != sizeof(oldMBR)) { close(fd); - return B_IO_ERROR; + return B_IO_ERROR; } if (!_IsValid(&oldMBR)) { close(fd); return B_BAD_VALUE; } - - lseek(fd, 0, SEEK_SET); - + + lseek(fd, 0, SEEK_SET); + size_t size = kBlockSize * kNumberOfBootLoaderBlocks; uint8* buffer = new(std::nothrow) uint8[size]; if (buffer == NULL) { - close(fd); + close(fd); return B_NO_MEMORY; } @@ -461,7 +462,7 @@ close(fd); delete[] buffer; return B_IO_ERROR; - } + } MasterBootRecord* newMBR = (MasterBootRecord*)buffer; if (!_IsValid(newMBR)) { @@ -469,11 +470,11 @@ delete[] buffer; return B_BAD_VALUE; } - + _CopyPartitionTable(newMBR, &oldMBR); status_t status = _WriteBlocks(fd, buffer, size); - delete[] buffer; + delete[] buffer; close(fd); return status; } @@ -590,7 +591,7 @@ LegacyBootDrive::_CopyPartitionTable(MasterBootRecord* destination, const MasterBootRecord* source) { - memcpy(destination->diskSignature, source->diskSignature, + memcpy(destination->diskSignature, source->diskSignature, sizeof(source->diskSignature) + sizeof(source->reserved) + sizeof(source->partition)); } Modified: haiku/trunk/src/apps/bootman/PartitionsPage.cpp =================================================================== --- haiku/trunk/src/apps/bootman/PartitionsPage.cpp 2010-05-06 16:06:33 UTC (rev 36662) +++ haiku/trunk/src/apps/bootman/PartitionsPage.cpp 2010-05-06 16:11:12 UTC (rev 36663) @@ -1,7 +1,7 @@ /* * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * + * * Authors: * Michael Pfeiffer, laplace@xxxxxxxxxxxxxxxxxxxxx * Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx> @@ -33,7 +33,7 @@ PartitionsPage::PartitionsPage(BMessage* settings, BRect frame, const char* name) - : WizardPageView(settings, frame, name, B_FOLLOW_ALL, + : WizardPageView(settings, frame, name, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE) { _BuildUI(); @@ -59,23 +59,23 @@ BControl* control = dynamic_cast<BControl*>(child); if (control == NULL) continue; - + int32 index; BMessage* message = control->Message(); if (message == NULL || message->FindInt32("index", &index) != B_OK) continue; - + BMessage partition; if (fSettings->FindMessage("partition", index, &partition) != B_OK) continue; - + if (kMessageShow == message->what) { partition.ReplaceBool("show", control->Value() == 1); } else if (kMessageName == message->what && dynamic_cast<BTextControl*>(control) != NULL) { partition.ReplaceString("name", ((BTextControl*)control)->Text()); } - + fSettings->ReplaceMessage("partition", index, &partition); } } @@ -96,11 +96,11 @@ PartitionsPage::_BuildUI() { BRect rect(Bounds()); - + BString text; text << - TR_CMT("Partitions", "Title") << "\n\n" << - TR("The following partitions were detected. Please " + B_TRANSLATE_COMMENT("Partitions", "Title") << "\n\n" << + B_TRANSLATE("The following partitions were detected. Please " "check the box next to the partitions to be included " "in the boot menu. You can also set the names of the " "partitions as you would like them to appear in the " @@ -109,24 +109,24 @@ MakeHeading(fDescription); AddChild(fDescription); LayoutDescriptionVertically(fDescription); - + rect.left = fDescription->Frame().left + 1; rect.top = fDescription->Frame().bottom + kTextDistance; rect.right -= B_V_SCROLL_BAR_WIDTH; rect.bottom -= B_H_SCROLL_BAR_HEIGHT + 3; - + fPartitions = new BView(rect, "partitions", B_FOLLOW_ALL, B_WILL_DRAW); - - fPartitionsScrollView = new BScrollView("scrollView", fPartitions, + + fPartitionsScrollView = new BScrollView("scrollView", fPartitions, B_FOLLOW_ALL, 0, true, true); fPartitionsScrollView->SetViewColor(ViewColor()); AddChild(fPartitionsScrollView); - + _FillPartitionsView(fPartitions); - + _Layout(); } @@ -139,11 +139,11 @@ float left = fPartitionsScrollView->Frame().left; float top = fDescription->Frame().bottom + kTextDistance; fPartitionsScrollView->MoveTo(left, top); - + float width = fPartitionsScrollView->Frame().Width(); float height = Bounds().bottom - top; fPartitionsScrollView->ResizeTo(width, height); - + // update scroll bar range and proportion BScrollBar* scrollbar = fPartitionsScrollView->ScrollBar(B_HORIZONTAL); float viewWidth = fPartitions->Bounds().IntegerWidth(); @@ -157,7 +157,7 @@ else proportion = viewWidth / fPartitionsWidth; scrollbar->SetProportion(proportion); - + scrollbar = fPartitionsScrollView->ScrollBar(B_VERTICAL); float viewHeight = fPartitions->Bounds().IntegerHeight(); max = fPartitionsHeight - viewHeight; @@ -180,10 +180,10 @@ PartitionsPage::_FillPartitionsView(BView* view) { const int32 inset = 1; - + font_height fontHeight; be_plain_font->GetHeight(&fontHeight); - + [... truncated: 296 lines follow ...]