Example #1
0
// get the string for a modifier key
const char*
ModifierKeysWindow::_KeyToString(int32 key)
{
	switch (key) {
		case MENU_ITEM_SHIFT:
			return B_TRANSLATE_COMMENT("Shift key",
				"Label of key above Ctrl, usually Shift");

		case MENU_ITEM_CONTROL:
			return B_TRANSLATE_COMMENT("Ctrl key",
				"Label of key farthest from the spacebar, usually Ctrl"
				"e.g. Strg for German keyboard");

		case MENU_ITEM_OPTION:
			return B_TRANSLATE_COMMENT("Win/Cmd key",
				"Label of the \"Windows\" key (PC)/Command key (Mac)");

		case MENU_ITEM_COMMAND:
			return B_TRANSLATE_COMMENT("Alt/Opt key",
				"Label of Alt key (PC)/Option key (Mac)");

		case MENU_ITEM_DISABLED:
			return B_TRANSLATE_COMMENT("Disabled", "Do nothing");
	}

	return "";
}
Example #2
0
DriveItem::DriveItem(const BDiskDevice& device, const BootMenuList& menus)
	:
	fBaselineOffset(0),
	fSizeWidth(0)
{
	device.GetPath(&fPath);
	if (device.Name() != NULL && device.Name()[0])
		fName = device.Name();
	else if (strstr(fPath.Path(), "usb") != NULL)
		fName = B_TRANSLATE_COMMENT("USB Drive", "Default disk name");
	else
		fName = B_TRANSLATE_COMMENT("Hard Drive", "Default disk name");

	fIcon = new BBitmap(BRect(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1),
		B_RGBA32);
	if (device.GetIcon(fIcon, B_LARGE_ICON) != B_OK)
		memset(fIcon->Bits(), 0, fIcon->BitsLength());

	fDrive = new BootDrive(fPath.Path());

	fIsInstalled = fDrive->InstalledMenu(menus) != NULL;
	fCanBeInstalled = fDrive->CanMenuBeInstalled(menus);

	char buffer[256];
	fSize = string_for_size(device.Size(), buffer, sizeof(buffer));
}
Example #3
0
void
InfoWin::_UpdateDuration()
{
	if (!fController->HasFile()) {
		fDurationInfo->SetText("-");
		return;
	}

	BString info;

	bigtime_t d = fController->TimeDuration() / 1000;
	bigtime_t v = d / (3600 * 1000);
	d = d % (3600 * 1000);
	bool hours = v > 0;
	if (hours)
		info << v << ":";
	v = d / (60 * 1000);
	d = d % (60 * 1000);
	info << v << ":";
	v = d / 1000;
	if (v < 10)
		info << '0';
	info << v;
	if (hours)
		info << " " << B_TRANSLATE_COMMENT("h", "Hours");
	else
		info << " " << B_TRANSLATE_COMMENT("min", "Minutes");

	fDurationInfo->SetText(info.String());
}
Example #4
0
bool
BootManagerController::_RestoreMBR()
{
	BString disk;
	BString path;
	fSettings.FindString("disk", &disk);
	fSettings.FindString("file", &path);

	BString message;
	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(),
		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;

	BFile file(path.String(), B_READ_ONLY);
	fRestoreMBRStatus = fBootMenu->RestoreMasterBootRecord(&fSettings, &file);
	return true;
}
Example #5
0
void
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",
		B_TRANSLATE_COMMENT("Select", "Button"),
		new BMessage(kMsgOpenFilePanel),
		B_FOLLOW_RIGHT);
	fSelect->ResizeToPreferred();

	float selectLeft = rect.right - fSelect->Bounds().Width();
	rect.right = selectLeft - kFileButtonDistance;
	fFile = new BTextControl(rect, "file",
		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();
}
void
DefaultPartitionPage::_BuildUI()
{
	const float kTextDistance = be_control_look->DefaultItemSpacing();
	BRect rect(Bounds());

	BString text;
	text << B_TRANSLATE_COMMENT("Default Partition", "Title") << "\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 "
			"to select a partition.\n"
			"Keep the 'ALT' key pressed to disable the timeout at boot time.");

	fDescription = CreateDescription(rect, "description", text);
	MakeHeading(fDescription);
	AddChild(fDescription);
	LayoutDescriptionVertically(fDescription);
	rect.top = fDescription->Frame().bottom + kTextDistance;

	BPopUpMenu* popUpMenu = _CreatePopUpMenu();
	fDefaultPartition = new BMenuField(rect, "partitions",
		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;
	fSettings->FindInt32("timeout", &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(B_TRANSLATE("Immediately"),
		B_TRANSLATE("Never"));
	fTimeoutSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fTimeoutSlider->SetHashMarkCount(kNumberOfTimeoutOptions);
	fTimeoutSlider->ResizeToPreferred();
	AddChild(fTimeoutSlider);

	_Layout();
}
Example #7
0
/*static*/ void
ShortcutsSpec::_InitModifierNames()
{
	sShiftName = B_TRANSLATE_COMMENT("Shift",
		"Name for modifier on keyboard");
	sControlName = B_TRANSLATE_COMMENT("Control",
		"Name for modifier on keyboard");
	sOptionName = B_TRANSLATE_COMMENT("Option",
		"Name for modifier on keyboard");
	sCommandName = B_TRANSLATE_COMMENT("Alt",
		"Name for modifier on keyboard");
}
Example #8
0
WizardPageView*
BootManagerController::CreatePage(int32 state, WizardView* wizard)
{
	WizardPageView* page = NULL;
	BRect frame(0, 0, 300, 250);

	switch (state) {
		case kStateEntry:
			fSettings.ReplaceBool("install", true);
			page = new DrivesPage(wizard, fBootMenus, &fSettings, "drives");
			break;
		case kStateErrorEntry:
			page = _CreateErrorEntryPage();
			wizard->SetPreviousButtonHidden(true);
			wizard->SetNextButtonLabel(B_TRANSLATE_COMMENT("Done", "Button"));
			break;
		case kStateSaveMBR:
			page = _CreateSaveMBRPage(frame);
			wizard->SetPreviousButtonHidden(false);
			break;
		case kStateMBRSaved:
			page = _CreateMBRSavedPage();
			break;
		case kStatePartitions:
			page = new PartitionsPage(&fSettings, "partitions");
			wizard->SetPreviousButtonHidden(false);
			break;
		case kStateDefaultPartitions:
			page = new DefaultPartitionPage(&fSettings, frame, "default");
			break;
		case kStateInstallSummary:
			page = _CreateInstallSummaryPage();
			break;
		case kStateInstalled:
			page = _CreateInstalledPage();
			wizard->SetNextButtonLabel(B_TRANSLATE_COMMENT("Done", "Button"));
			break;
		case kStateUninstall:
			page = _CreateUninstallPage(frame);
			wizard->SetPreviousButtonHidden(false);
			break;
		case kStateUninstalled:
			// TODO prevent overwriting MBR after clicking "Previous"
			page = _CreateUninstalledPage();
			wizard->SetNextButtonLabel(B_TRANSLATE_COMMENT("Done", "Button"));
			break;
	}

	return page;
}
Example #9
0
bool
BootManagerController::_WriteBootMenu()
{
	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;

	fWriteBootMenuStatus = fBootMenu->Install(*fBootDrive, fSettings);
	return true;
}
Example #10
0
WizardPageView*
BootManagerController::_CreateInstallSummaryPage()
{
	BString description;
	BString disk;
	fSettings.FindString("disk", &disk);

	description << B_TRANSLATE_COMMENT("Summary", "Title") << "\n"
		<< B_TRANSLATE("About to write the following boot menu to the boot "
			"disk (%s). Please verify the information below before continuing.")
		<< "\n\n";
	description.ReplaceFirst("%s", disk);

	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;
		BString path;
		message.FindString("name", &name);
		message.FindString("path", &path);

		BString displayName;
		if (fBootMenu->GetDisplayText(name.String(), displayName) == B_OK)
			description << displayName << "\t(" << path << ")\n";
		else
			description << name << "\t(" << path << ")\n";
	}

	return new DescriptionPage("summary", description.String(), true);
}
void
PartitionsPage::_BuildUI()
{
	BString text;
	text << B_TRANSLATE_COMMENT("Partitions", "Title") << "\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 "
			"boot menu.");
	fDescription = CreateDescription("description", text);
	MakeHeading(fDescription);

	fPartitions = new BGridView("partitions", 0,
		be_control_look->DefaultItemSpacing() / 3);

	BLayoutBuilder::Grid<>(fPartitions)
		.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
		.SetColumnWeight(0, 0)
		.SetColumnWeight(1, 1)
		.SetColumnWeight(2, 0.5)
		.SetColumnWeight(3, 0.5);
	_FillPartitionsView(fPartitions);

	BScrollView* scrollView = new BScrollView("scrollView", fPartitions, 0,
		false, true);

	SetLayout(new BGroupLayout(B_VERTICAL));

	BLayoutBuilder::Group<>((BGroupLayout*)GetLayout())
		.Add(fDescription)
		.Add(scrollView);
}
Example #12
0
void
MainWindow::_DisplayPartitionError(BString _message,
	const BPartition* partition, status_t error) const
{
	char message[1024];

	if (partition && _message.FindFirst("%s") >= 0) {
		BString name;
		name << "\"" << partition->ContentName() << "\"";
		snprintf(message, sizeof(message), _message.String(), name.String());
	} else {
		_message.ReplaceAll("%s", "");
		snprintf(message, sizeof(message), _message.String());
	}

	if (error < B_OK) {
		BString helper = message;
		const char* errorString
			= B_TRANSLATE_COMMENT("Error: ", "in any error alert");
		snprintf(message, sizeof(message), "%s\n\n%s%s", helper.String(),
			errorString, strerror(error));
	}

	BAlert* alert = new BAlert("error", message, B_TRANSLATE("OK"), NULL, NULL,
		B_WIDTH_FROM_WIDEST, error < B_OK ? B_STOP_ALERT : B_INFO_ALERT);
	alert->Go(NULL);
}
Example #13
0
bool
ClipView::GetToolTipAt(BPoint point, BToolTip** _tip)
{
	ClipItem* item = static_cast<ClipItem*>(this->ItemAt(this->IndexOf(point)));
	if (item == NULL)
		return false;

	BString dateString = "";
	bigtime_t added = item->GetTimeAdded();
	if (BDateFormat().Format(dateString, added,
		B_MEDIUM_DATE_FORMAT) != B_OK)
		return false;

	BString timeString = "";
	added = item->GetTimeAdded();
	if (BTimeFormat().Format(timeString, added,
		B_SHORT_TIME_FORMAT) != B_OK)
		return false;

	BString toolTip(B_TRANSLATE_COMMENT("Added:\n%time%\n%date%",
		"Tooltip, don't change the variables %time% and %date%."));
	toolTip.ReplaceAll("%time%", timeString.String());
	toolTip.ReplaceAll("%date%", dateString.String());

	SetToolTip(toolTip.String());
	*_tip = ToolTip();

	return true;
}
Example #14
0
DrivesPage::DrivesPage(WizardView* wizardView, const BootMenuList& menus,
	BMessage* settings, const char* name)
	:
	WizardPageView(settings, name),
	fWizardView(wizardView),
	fHasInstallableItems(false)
{
	BString text;
	text << B_TRANSLATE_COMMENT("Drives", "Title") << "\n"
		<< B_TRANSLATE("Please select the drive you want the boot manager to "
			"be installed to or uninstalled from.");
	BTextView* description = CreateDescription("description", text);
	MakeHeading(description);

	fDrivesView = new BListView("drives", B_SINGLE_SELECTION_LIST,
		B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE | B_FULL_UPDATE_ON_RESIZE);
	fDrivesView->SetSelectionMessage(new BMessage(kMsgSelectionChanged));

	BScrollView* scrollView = new BScrollView("scrollView", fDrivesView, 0,
		false, true);

	SetLayout(new BGroupLayout(B_VERTICAL));

	BLayoutBuilder::Group<>((BGroupLayout*)GetLayout())
		.Add(description, 0.5)
		.Add(scrollView, 1);

	_UpdateWizardButtons(NULL);
	_FillDrivesView(menus);
}
Example #15
0
void
DiskProbe::RefsReceived(BMessage* message)
{
	bool traverseLinks = (modifiers() & B_SHIFT_KEY) == 0;

	int32 index = 0;
	entry_ref ref;
	while (message->FindRef("refs", index++, &ref) == B_OK) {
		const char* attribute = NULL;
		if (message->FindString("attributes", index - 1, &attribute) == B_OK)
			traverseLinks = false;

		BEntry entry;
		status_t status = entry.SetTo(&ref, traverseLinks);

		if (status == B_OK)
			status = Probe(entry, attribute);

		if (status != B_OK) {
			char buffer[1024];
			snprintf(buffer, sizeof(buffer),
				B_TRANSLATE_COMMENT("Could not open \"%s\":\n"
				"%s", "Opening of entry reference buffer for a DiskProbe "
				"request Alert message. The name of entry reference and "
				"error message is shown."),
				ref.name, strerror(status));

			BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"),
				buffer, B_TRANSLATE("OK"), NULL, NULL,
				B_WIDTH_AS_USUAL, B_STOP_ALERT);
			alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
			alert->Go();
		}
	}
}
Example #16
0
BMenuField*
ModifierKeysWindow::_CreateCommandMenuField()
{
	fCommandMenu = new BPopUpMenu(
		B_TRANSLATE_NOCOLLECT(_KeyToString(MENU_ITEM_COMMAND)), true, true);

	for (int32 key = MENU_ITEM_SHIFT; key <= MENU_ITEM_DISABLED; key++) {
		if (key == MENU_ITEM_SEPERATOR) {
			// add separator item
			BSeparatorItem* separator = new BSeparatorItem;
			fCommandMenu->AddItem(separator, MENU_ITEM_SEPERATOR);
			continue;
		}

		BMessage* message = new BMessage(kMsgUpdateModifier);
		message->AddInt32(_KeyToString(MENU_ITEM_COMMAND), key);
		BMenuItem* item = new BMenuItem(
			B_TRANSLATE_NOCOLLECT(_KeyToString(key)), message);
		fCommandMenu->AddItem(item, key);
	}

	fCommandMenu->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
		B_ALIGN_VERTICAL_UNSET));

	return new BMenuField(B_TRANSLATE_COMMENT("Command:",
		"Command key role name"), fCommandMenu);
}
BPopUpMenu*
DefaultPartitionPage::_CreatePopUpMenu()
{
	int32 defaultPartitionIndex;
	fSettings->FindInt32("defaultPartition", &defaultPartitionIndex);

	BMenuItem* selectedItem = NULL;
	int32 selectedItemIndex = 0;

	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);

		BMessage* msg = new BMessage(kMsgPartition);
		msg->AddInt32("index", i);
		BMenuItem* item = new BMenuItem(name.String(), msg);
		menu->AddItem(item);
		if (defaultPartitionIndex == i || selectedItem == NULL) {
			selectedItem = item;
			selectedItemIndex = i;
		}
	}
	fSettings->ReplaceInt32("defaultPartition", selectedItemIndex);
	selectedItem->SetMarked(true);
	return menu;
}
Example #18
0
void
GLifeConfig::_UpdateLabels()
{
	char newLabel[64];
	snprintf(newLabel, sizeof(newLabel), B_TRANSLATE("Grid Width: %li"),
		fGridWidth->Value());
	fGridWidth->SetLabel(newLabel);
	snprintf(newLabel, sizeof(newLabel), B_TRANSLATE("Grid Height: %li"),
		fGridHeight->Value());
	fGridHeight->SetLabel(newLabel);
	snprintf(newLabel, sizeof(newLabel), B_TRANSLATE("Grid Border: %li"),
		fGridBorder->Value());
	fGridBorder->SetLabel(newLabel);

	char delay[16];
	if (fGridDelay->Value() <= 0)
		sprintf(delay, B_TRANSLATE("none"));
	else {
		sprintf(delay, "%" B_PRId32, fGridDelay->Value());
		sprintf(delay, B_TRANSLATE_COMMENT("%sx", 
				"This is a factor: the x represents 'times'"), delay);
	}
	snprintf(newLabel, sizeof(newLabel), B_TRANSLATE("Grid Life Delay: %s"), 
		delay);
	fGridDelay->SetLabel(newLabel);
}
Example #19
0
void BepdfApplication::AboutRequested()
{
	BString version;
	BString str("BePDF\n");
	str += B_TRANSLATE("Version");
	str += " ";
	str += GetVersion(version);
	str += "\n";

	str += bePDFCopyright;

	str += "\n";
	str += B_TRANSLATE_COMMENT("Language 'English', translated by the BePDF authors.",
		"Replace 'English' with the language you're translating to, and 'the BePDF authors' with your name or your translation group's name.");
	str += "\n\n";

	str += BString().SetToFormat(B_TRANSLATE_COMMENT("BePDF is based on XPDF %s, %s.", "XPDF version, copyright"),
		xpdfVersion, xpdfCopyright);

	str += GPLCopyright;

	BAlert *about = new BAlert("About", str.String(), "OK");
	BTextView *v = about->TextView();
	if (v) {
		rgb_color red = {255, 0, 51, 255};
		rgb_color blue = {0, 102, 255, 255};

		v->SetStylable(true);
		char *text = (char*)v->Text();
		char *s = text;
		// set all Be in BePDF in blue and red
		while ((s = strstr(s, "BePDF")) != NULL) {
			int32 i = s - text;
			v->SetFontAndColor(i, i+1, NULL, 0, &blue);
			v->SetFontAndColor(i+1, i+2, NULL, 0, &red);
			s += 2;
		}
		// first text line
		s = strchr(text, '\n');
		BFont font;
		v->GetFontAndColor(0, &font);
		font.SetSize(16);
		v->SetFontAndColor(0, s-text+1, &font, B_FONT_SIZE);
	};
	about->Go();
}
Example #20
0
status_t
GetNthTypeEditor(int32 index, const char** _name)
{
	static const char* kEditors[] = {
		B_TRANSLATE_COMMENT("Text", "This is the type of editor"),
		B_TRANSLATE_COMMENT("Number", "This is the type of editor"),
		B_TRANSLATE_COMMENT("Boolean", "This is the type of editor"),
		B_TRANSLATE_COMMENT("Message", "This is the type of view"),
		B_TRANSLATE_COMMENT("Image", "This is the type of view")
	};

	if (index < 0 || index >= int32(sizeof(kEditors) / sizeof(kEditors[0])))
		return B_BAD_VALUE;

	*_name = kEditors[index];
	return B_OK;
}
Example #21
0
FontSelectionView::FontSelectionView(const char* name,
	const char* label, const BFont* currentFont)
	:
	BView(name, B_WILL_DRAW),
	fMessageTarget(this)
{
	if (currentFont == NULL) {
		if (!strcmp(Name(), "plain"))
			fCurrentFont = *be_plain_font;
		else if (!strcmp(Name(), "bold"))
			fCurrentFont = *be_bold_font;
		else if (!strcmp(Name(), "fixed"))
			fCurrentFont = *be_fixed_font;
		else if (!strcmp(Name(), "menu")) {
			menu_info info;
			get_menu_info(&info);

			fCurrentFont.SetFamilyAndStyle(info.f_family, info.f_style);
			fCurrentFont.SetSize(info.font_size);
		}
	} else
		fCurrentFont = *currentFont;

	fSavedFont = fCurrentFont;

	fSizesMenu = new BPopUpMenu("size menu");
	_BuildSizesMenu();

	fFontsMenu = new BPopUpMenu("font menu");

	// font menu
	fFontsMenuField = new BMenuField("fonts", label, fFontsMenu);
	fFontsMenuField->SetAlignment(B_ALIGN_RIGHT);

	// size menu
	fSizesMenuField = new BMenuField("size", B_TRANSLATE("Size:"), fSizesMenu);
	fSizesMenuField->SetAlignment(B_ALIGN_RIGHT);

	// preview
	fPreviewText = new BStringView("preview text",
		B_TRANSLATE_COMMENT("The quick brown fox jumps over the lazy dog.",
			"Don't translate this literally ! Use a phrase showing all chars "
			"from A to Z."));

	fPreviewText->SetFont(&fCurrentFont);
	fPreviewText->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));

	// box around preview
	fPreviewBox = new BBox("preview box", B_WILL_DRAW | B_FRAME_EVENTS);
	fPreviewBox->AddChild(BGroupLayoutBuilder(B_HORIZONTAL)
		.Add(fPreviewText)
		.SetInsets(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING,
			B_USE_SMALL_SPACING, B_USE_SMALL_SPACING)
		.TopView()
	);
}
Example #22
0
bool
DesktopWindow::QuitRequested()
{
	status_t err;
	err = fDesktopShelf->Save();
	printf(B_TRANSLATE_COMMENT("error %s\n",
		"A return message from fDesktopShelf->Save(). It can be \"B_OK\""),
		strerror(err));
	return BWindow::QuitRequested();
}
Example #23
0
FontSelectionView::FontSelectionView(const char* name, const char* label,
		bool separateStyles, const BFont* currentFont)
	:
	BHandler(name),
	fMessage(NULL),
	fTarget(NULL)
{
	if (currentFont == NULL)
		fCurrentFont = _DefaultFont();
	else
		fCurrentFont = *currentFont;

	fSavedFont = fCurrentFont;

	fSizesMenu = new BPopUpMenu("size menu");
	fFontsMenu = new BPopUpMenu("font menu");

	// font menu
	fFontsMenuField = new BMenuField("fonts", label, fFontsMenu, B_WILL_DRAW);
	fFontsMenuField->SetAlignment(B_ALIGN_RIGHT);

	// styles menu, if desired
	if (separateStyles) {
		fStylesMenu = new BPopUpMenu("styles menu");
		fStylesMenuField = new BMenuField("styles", B_TRANSLATE("Style:"),
			fStylesMenu, B_WILL_DRAW);
	} else {
		fStylesMenu = NULL;
		fStylesMenuField = NULL;
	}

	// size menu
	fSizesMenuField = new BMenuField("size", B_TRANSLATE("Size:"), fSizesMenu,
		B_WILL_DRAW);
	fSizesMenuField->SetAlignment(B_ALIGN_RIGHT);

	// preview
	fPreviewText = new BStringView("preview text",
		B_TRANSLATE_COMMENT("The quick brown fox jumps over the lazy dog.",
		"Don't translate this literally ! Use a phrase showing all "
		"chars from A to Z."));

	fPreviewText->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED,
		B_SIZE_UNLIMITED));
	fPreviewText->SetHighUIColor(B_PANEL_BACKGROUND_COLOR, 1.65);

	fPreviewBox = new BBox("preview box", B_WILL_DRAW | B_FRAME_EVENTS);
	fPreviewBox->AddChild(BGroupLayoutBuilder(B_VERTICAL, B_USE_HALF_ITEM_SPACING)
		.Add(fPreviewText)
		.SetInsets(B_USE_HALF_ITEM_SPACING, B_USE_HALF_ITEM_SPACING,
			B_USE_HALF_ITEM_SPACING, B_USE_HALF_ITEM_SPACING)
		.TopView()
	);
	_UpdateFontPreview();
}
status_t
RAWTranslator::DerivedIdentify(BPositionIO *stream,
	const translation_format *format, BMessage *settings,
	translator_info *info, uint32 outType)
{
	if (!outType)
		outType = B_TRANSLATOR_BITMAP;
	if (outType != B_TRANSLATOR_BITMAP)
		return B_NO_TRANSLATOR;

	BBufferIO io(stream, 128 * 1024, false);
	DCRaw raw(io);
	status_t status;

	try {
		status = raw.Identify();
	} catch (status_t error) {
		status = error;
	}

	if (status < B_OK)
		return B_NO_TRANSLATOR;

	image_meta_info meta;
	raw.GetMetaInfo(meta);

	if (settings) {
		int32 count = raw.CountImages();

		// Add page count to ioExtension
		settings->RemoveName(kDocumentCount);
		settings->AddInt32(kDocumentCount, count);

		// Check if a document index has been specified
		int32 index;
		if (settings->FindInt32(kDocumentIndex, &index) == B_OK)
			index--;
		else
			index = 0;

		if (index < 0 || index >= count)
			return B_NO_TRANSLATOR;
	}

	info->type = RAW_IMAGE_FORMAT;
	info->group = B_TRANSLATOR_BITMAP;
	info->quality = RAW_IN_QUALITY;
	info->capability = RAW_IN_CAPABILITY;
	snprintf(info->name, sizeof(info->name), 
		B_TRANSLATE_COMMENT("%s RAW image", "Parameter (%s) is the name of "
		"the manufacturer (like 'Canon')"), meta.manufacturer);
	strcpy(info->MIME, "image/x-vnd.photo-raw");

	return B_OK;
}
Example #25
0
const char*
MainWindow::TranslateWellKnownThemes(const char *name)
{
	if (strcmp(name, "Be") == 0)
		return B_TRANSLATE_COMMENT("Be", "Theme name");
	else
	if (strcmp(name, "Default") == 0)
		return B_TRANSLATE_COMMENT("Default", "Theme name");
	else
	if (strcmp(name, "Classic") == 0)
		return B_TRANSLATE_COMMENT("Classic", "Theme name");
	else
	if (strcmp(name, "Gray") == 0)
		return B_TRANSLATE_COMMENT("Gray", "Theme name");
	else
	if (strcmp(name, "Gnome") == 0)
		return B_TRANSLATE_COMMENT("Gnome", "Theme name");
	else
		return name;
}
Example #26
0
WizardPageView*
BootManagerController::_CreateInstalledPage()
{
	BString description;

	if (fWriteBootMenuStatus == B_OK) {
		description << B_TRANSLATE_COMMENT("Installation of boot menu "
				"completed", "Title") << "\n"
			<< B_TRANSLATE("The boot manager has been successfully installed "
				"on your system.");
	} else {
		description << B_TRANSLATE_COMMENT("Installation of boot menu failed",
				"Title") << "\n"
			<< B_TRANSLATE("An error occurred writing the boot menu. "
				"The Master Boot Record might be destroyed, "
				"you should restore the MBR now!");
	}

	return new DescriptionPage("done", description, true);
}
Example #27
0
void
DrivesPage::_UpdateWizardButtons(DriveItem* item)
{
	fWizardView->SetPreviousButtonHidden(!fHasInstallableItems);
	fWizardView->SetPreviousButtonLabel(
		B_TRANSLATE_COMMENT("Uninstall", "Button"));
	if (item == NULL) {
		fWizardView->SetPreviousButtonEnabled(false);
		fWizardView->SetNextButtonEnabled(false);
	} else {
		fWizardView->SetPreviousButtonEnabled(
			item->CanBeInstalled() && item->IsInstalled());
		fWizardView->SetNextButtonEnabled(item->CanBeInstalled());

		fWizardView->SetNextButtonLabel(
			item->IsInstalled() && item->CanBeInstalled()
				? B_TRANSLATE_COMMENT("Update", "Button")
				: B_TRANSLATE_COMMENT("Install", "Button"));
	}

}
Example #28
0
WizardPageView*
BootManagerController::_CreateErrorEntryPage()
{
	BString description;

	if (fCollectPartitionsStatus == B_PARTITION_TOO_SMALL) {
		description << 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 << B_TRANSLATE_COMMENT("Error reading partition table",
				"Title") << "\n\n"
			<< B_TRANSLATE("Boot Manager is unable to read the partition "
				"table!");
	}

	return new DescriptionPage("errorEntry", description.String(), true);
}
Example #29
0
WizardPageView*
BootManagerController::_CreateUninstallPage(BRect frame)
{
	BString description;
	description << B_TRANSLATE_COMMENT("Uninstall boot manager", "Title")
		<< "\n\n"
		<< B_TRANSLATE("Please locate the Master Boot Record (MBR) save file "
			"to restore from. This is the file that was created when the "
			"boot manager was first installed.");

	return new FileSelectionPage(&fSettings, frame, "restoreMBR",
		description.String(), B_OPEN_PANEL);
}
Example #30
0
WizardPageView*
BootManagerController::_CreateMBRSavedPage()
{
	BString description;
	BString file;
	fSettings.FindString("file", &file);

	if (fSaveMBRStatus == B_OK) {
		description << B_TRANSLATE_COMMENT("Old Master Boot Record saved",
				"Title") << "\n"
			<< B_TRANSLATE("The old Master Boot Record was successfully "
				"saved to %s.") << "\n";
	} else {
		description << B_TRANSLATE_COMMENT("Old Master Boot Record Saved "
				"failure", "Title") << "\n"
			<< B_TRANSLATE("The old Master Boot Record could not be saved "
				"to %s") << "\n";
	}
	description.ReplaceFirst("%s", file);

	return new DescriptionPage("summary", description.String(), true);
}