Patch by Jorma Karvonen: Localization of DiskProbe and small style cleanups.

Closes ticket #5916, thanks a bunch!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36849 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-05-17 19:46:52 +00:00
parent f011602b08
commit a021189bbb
9 changed files with 283 additions and 198 deletions
+26 -15
View File
@@ -11,22 +11,30 @@
#include <stdio.h>
#include <stdlib.h>
#include <Alert.h>
#include <Catalog.h>
#include <Directory.h>
#include <Locale.h>
#include <MenuBar.h>
#include <MenuItem.h>
#include <TabView.h>
#include <StringView.h>
#include <Alert.h>
#include <Directory.h>
#include <TabView.h>
#include <Volume.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "AttributeWindow"
static const uint32 kMsgRemoveAttribute = 'rmat';
class EditorTabView : public BTabView {
public:
EditorTabView(BRect frame, const char *name, button_width width = B_WIDTH_AS_USUAL,
uint32 resizingMode = B_FOLLOW_ALL, uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS);
EditorTabView(BRect frame, const char *name,
button_width width = B_WIDTH_AS_USUAL,
uint32 resizingMode = B_FOLLOW_ALL,
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS);
virtual void FrameResized(float width, float height);
virtual void Select(int32 tab);
@@ -53,8 +61,9 @@ EditorTabView::EditorTabView(BRect frame, const char *name, button_width width,
{
ContainerView()->MoveBy(-ContainerView()->Frame().left,
TabHeight() + 1 - ContainerView()->Frame().top);
fNoEditorView = new BStringView(ContainerView()->Bounds(), "Type editor",
"No type editor available", B_FOLLOW_NONE);
fNoEditorView = new BStringView(ContainerView()->Bounds(),
B_TRANSLATE("Type editor"), B_TRANSLATE("No type editor available"),
B_FOLLOW_NONE);
fNoEditorView->ResizeToPreferred();
fNoEditorView->SetAlignment(B_ALIGN_CENTER);
fTypeEditorView = fNoEditorView;
@@ -128,7 +137,7 @@ EditorTabView::AddRawEditorTab(BView *view)
fRawTab = CountTabs();
view = new BView(BRect(0, 0, 5, 5), "Raw editor", B_FOLLOW_NONE, 0);
view = new BView(BRect(0, 0, 5, 5), B_TRANSLATE("Raw editor"), B_FOLLOW_NONE, 0);
view->SetViewColor(ViewColor());
AddTab(view);
}
@@ -205,16 +214,18 @@ AttributeWindow::AttributeWindow(BRect _rect, entry_ref *ref, const char *attrib
BMenuBar *menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
AddChild(menuBar);
BMenu *menu = new BMenu("Attribute");
BMenu *menu = new BMenu(B_TRANSLATE("Attribute"));
// the ProbeView save menu items will be inserted here
menu->AddItem(new BMenuItem("Remove from file", new BMessage(kMsgRemoveAttribute)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Remove from file"),
new BMessage(kMsgRemoveAttribute)));
menu->AddSeparatorItem();
// the ProbeView print menu items will be inserted here
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Close", new BMessage(B_CLOSE_REQUESTED), 'W', B_COMMAND_KEY));
menu->AddItem(new BMenuItem(B_TRANSLATE("Close"), new BMessage(B_CLOSE_REQUESTED),
'W', B_COMMAND_KEY));
menu->SetTargetForItems(this);
menuBar->AddItem(menu);
@@ -268,12 +279,12 @@ AttributeWindow::MessageReceived(BMessage *message)
{
char buffer[1024];
snprintf(buffer, sizeof(buffer),
"Do you really want to remove the attribute \"%s\" from the file \"%s\"?\n\n"
"You cannot undo this action.",
B_TRANSLATE("Do you really want to remove the attribute \"%s\" from "
"the file \"%s\"?\n\nYou cannot undo this action."),
fAttribute, Ref().name);
int32 chosen = (new BAlert("DiskProbe request",
buffer, "Cancel", "Remove", NULL,
int32 chosen = (new BAlert(B_TRANSLATE("DiskProbe request"),
buffer, B_TRANSLATE("Cancel"), B_TRANSLATE("Remove"), NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
if (chosen == 1) {
BNode node(&Ref());
+54 -30
View File
@@ -12,20 +12,24 @@
#include "OpenWindow.h"
#include "FindWindow.h"
#include <Application.h>
#include <Screen.h>
#include <Autolock.h>
#include <Alert.h>
#include <TextView.h>
#include <FilePanel.h>
#include <FindDirectory.h>
#include <Application.h>
#include <Autolock.h>
#include <Catalog.h>
#include <Directory.h>
#include <Entry.h>
#include <FilePanel.h>
#include <FindDirectory.h>
#include <Locale.h>
#include <Path.h>
#include <Screen.h>
#include <TextView.h>
#include <stdio.h>
#include <string.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "DiskProbe"
const char *kSignature = "application/x-vnd.Haiku-DiskProbe";
@@ -85,6 +89,7 @@ class DiskProbe : public BApplication {
uint32 fWindowCount;
BRect fWindowFrame;
BMessenger fFindTarget;
BCatalog fAppCatalog;
};
@@ -115,10 +120,14 @@ Settings::Settings()
if (file.Read(&settings, sizeof(settings)) == sizeof(settings)) {
#if B_HOST_IS_BENDIAN
// settings are saved in little endian
settings.window_frame.left = B_LENDIAN_TO_HOST_FLOAT(settings.window_frame.left);
settings.window_frame.top = B_LENDIAN_TO_HOST_FLOAT(settings.window_frame.top);
settings.window_frame.right = B_LENDIAN_TO_HOST_FLOAT(settings.window_frame.right);
settings.window_frame.bottom = B_LENDIAN_TO_HOST_FLOAT(settings.window_frame.bottom);
settings.window_frame.left = B_LENDIAN_TO_HOST_FLOAT(
settings.window_frame.left);
settings.window_frame.top = B_LENDIAN_TO_HOST_FLOAT(
settings.window_frame.top);
settings.window_frame.right = B_LENDIAN_TO_HOST_FLOAT(
settings.window_frame.right);
settings.window_frame.bottom = B_LENDIAN_TO_HOST_FLOAT(
settings.window_frame.bottom);
#endif
// check if the window frame is on screen at all
BScreen screen;
@@ -127,13 +136,18 @@ Settings::Settings()
&& settings.window_frame.Height() < screen.Frame().Height())
fMessage.ReplaceRect("window_frame", settings.window_frame);
if (settings.base_type == kHexBase || settings.base_type == kDecimalBase)
fMessage.ReplaceInt32("base_type", B_LENDIAN_TO_HOST_INT32(settings.base_type));
if (settings.base_type == kHexBase
|| settings.base_type == kDecimalBase)
fMessage.ReplaceInt32("base_type",
B_LENDIAN_TO_HOST_INT32(settings.base_type));
if (settings.font_size >= 0 && settings.font_size <= 72)
fMessage.ReplaceFloat("font_size", float(B_LENDIAN_TO_HOST_INT32(settings.font_size)));
fMessage.ReplaceFloat("font_size",
float(B_LENDIAN_TO_HOST_INT32(settings.font_size)));
fMessage.ReplaceBool("case_sensitive", settings.flags & kCaseSensitive);
fMessage.ReplaceInt8("find_mode", settings.flags & kHexFindMode ? kHexMode : kAsciiMode);
fMessage.ReplaceBool("case_sensitive",
settings.flags & kCaseSensitive);
fMessage.ReplaceInt8("find_mode",
settings.flags & kHexFindMode ? kHexMode : kAsciiMode);
}
}
@@ -153,15 +167,22 @@ Settings::~Settings()
settings.window_frame = fMessage.FindRect("window_frame");
#if B_HOST_IS_BENDIAN
// settings are saved in little endian
settings.window_frame.left = B_HOST_TO_LENDIAN_FLOAT(settings.window_frame.left);
settings.window_frame.top = B_HOST_TO_LENDIAN_FLOAT(settings.window_frame.top);
settings.window_frame.right = B_HOST_TO_LENDIAN_FLOAT(settings.window_frame.right);
settings.window_frame.bottom = B_HOST_TO_LENDIAN_FLOAT(settings.window_frame.bottom);
settings.window_frame.left = B_HOST_TO_LENDIAN_FLOAT(
settings.window_frame.left);
settings.window_frame.top = B_HOST_TO_LENDIAN_FLOAT(
settings.window_frame.top);
settings.window_frame.right = B_HOST_TO_LENDIAN_FLOAT(
settings.window_frame.right);
settings.window_frame.bottom = B_HOST_TO_LENDIAN_FLOAT(
settings.window_frame.bottom);
#endif
settings.base_type = B_HOST_TO_LENDIAN_INT32(fMessage.FindInt32("base_type"));
settings.font_size = B_HOST_TO_LENDIAN_INT32(int32(fMessage.FindFloat("font_size") + 0.5f));
settings.flags = B_HOST_TO_LENDIAN_INT32((fMessage.FindBool("case_sensitive") ? kCaseSensitive : 0)
settings.base_type = B_HOST_TO_LENDIAN_INT32(
fMessage.FindInt32("base_type"));
settings.font_size = B_HOST_TO_LENDIAN_INT32(
int32(fMessage.FindFloat("font_size") + 0.5f));
settings.flags = B_HOST_TO_LENDIAN_INT32(
(fMessage.FindBool("case_sensitive") ? kCaseSensitive : 0)
| (fMessage.FindInt8("find_mode") == kHexMode ? kHexFindMode : 0));
file.Write(&settings, sizeof(settings));
@@ -215,8 +236,10 @@ DiskProbe::DiskProbe()
: BApplication(kSignature),
fOpenWindow(NULL),
fFindWindow(NULL),
fWindowCount(0)
fWindowCount(0),
fAppCatalog(NULL)
{
be_locale->GetAppCatalog(&fAppCatalog);
fFilePanel = new BFilePanel();
fWindowFrame = fSettings.Message().FindRect("window_frame");
}
@@ -341,12 +364,12 @@ DiskProbe::RefsReceived(BMessage *message)
if (status != B_OK) {
char buffer[1024];
snprintf(buffer, sizeof(buffer),
"Could not open \"%s\":\n"
"%s",
B_TRANSLATE("Could not open \"%s\":\n"
"%s"),
ref.name, strerror(status));
(new BAlert("DiskProbe request",
buffer, "OK", NULL, NULL,
(new BAlert(B_TRANSLATE("DiskProbe request"),
buffer, B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
}
}
@@ -377,7 +400,8 @@ DiskProbe::ArgvReceived(int32 argc, char **argv)
if ((status = entry.SetTo(path.Path(), false)) != B_OK
|| (status = entry.GetRef(&ref)) != B_OK) {
fprintf(stderr, "Could not open file \"%s\": %s\n", path.Path(), strerror(status));
fprintf(stderr, B_TRANSLATE("Could not open file \"%s\": %s\n"),
path.Path(), strerror(status));
continue;
}
@@ -462,10 +486,10 @@ DiskProbe::MessageReceived(BMessage *message)
void
DiskProbe::AboutRequested()
{
BAlert *alert = new BAlert("about", "DiskProbe\n"
BAlert *alert = new BAlert("about", B_TRANSLATE("DiskProbe\n"
"\twritten by Axel Dörfler\n"
"\tCopyright 2004-2007, Haiku.\n\n"
"Original Be version by Robert Polic\n", "OK");
"Original Be version by Robert Polic\n"), B_TRANSLATE("OK"));
BTextView *view = alert->TextView();
BFont font;
+1 -1
View File
@@ -14,7 +14,7 @@ resource app_version {
internal = 3,
short_info = "DiskProbe",
long_info = "DiskProbe ©2004-2009 Haiku, Inc."
long_info = "DiskProbe ©2004-2010 Haiku, Inc."
};
resource app_flags B_SINGLE_LAUNCH;
+19 -8
View File
@@ -10,6 +10,8 @@
#include "ProbeView.h"
#include <Application.h>
#include <Catalog.h>
#include <Locale.h>
#include <MenuBar.h>
#include <MenuItem.h>
#include <Path.h>
@@ -18,6 +20,10 @@
#include <be_apps/Tracker/RecentItems.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "FileWindow"
FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings)
: ProbeWindow(rect, ref)
{
@@ -43,27 +49,31 @@ FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings)
// add the menu
BMenuBar *menuBar = new BMenuBar(BRect(0, 0, Bounds().Width(), 8), "menu bar");
BMenuBar *menuBar = new BMenuBar(BRect(0, 0, Bounds().Width(), 8),
"menu bar");
AddChild(menuBar);
BMenu *menu = new BMenu("File");
menu->AddItem(new BMenuItem("New" B_UTF8_ELLIPSIS,
BMenu *menu = new BMenu(B_TRANSLATE("File"));
menu->AddItem(new BMenuItem(B_TRANSLATE("New" B_UTF8_ELLIPSIS),
new BMessage(kMsgOpenOpenWindow), 'N', B_COMMAND_KEY));
BMenu *devicesMenu = new BMenu("Open device");
BMenu *devicesMenu = new BMenu(B_TRANSLATE("Open device"));
OpenWindow::CollectDevices(devicesMenu);
devicesMenu->SetTargetForItems(be_app);
menu->AddItem(new BMenuItem(devicesMenu));
BMenu *recentsMenu = BRecentFilesList::NewFileListMenu("Open file" B_UTF8_ELLIPSIS,
BMenu *recentsMenu = BRecentFilesList::NewFileListMenu(
B_TRANSLATE("Open file" B_UTF8_ELLIPSIS),
NULL, NULL, be_app, 10, false, NULL, kSignature);
BMenuItem *item;
menu->AddItem(item = new BMenuItem(recentsMenu, new BMessage(kMsgOpenFilePanel)));
menu->AddItem(item = new BMenuItem(recentsMenu,
new BMessage(kMsgOpenFilePanel)));
item->SetShortcut('O', B_COMMAND_KEY);
menu->AddSeparatorItem();
// the ProbeView save menu items will be inserted here
item = new BMenuItem("Close", new BMessage(B_CLOSE_REQUESTED), 'W', B_COMMAND_KEY);
item = new BMenuItem(B_TRANSLATE("Close"), new BMessage(B_CLOSE_REQUESTED),
'W', B_COMMAND_KEY);
menu->AddItem(item);
menu->AddSeparatorItem();
@@ -74,7 +84,8 @@ FileWindow::FileWindow(BRect rect, entry_ref *ref, const BMessage *settings)
new BMessage(B_ABOUT_REQUESTED)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q', B_COMMAND_KEY));
menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED),
'Q', B_COMMAND_KEY));
menu->SetTargetForItems(be_app);
item->SetTarget(this);
menuBar->AddItem(menu);
+16 -12
View File
@@ -7,17 +7,19 @@
#include "FindWindow.h"
#include "DataView.h"
#include "DiskProbe.h"
#include <AutoLocker.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <Application.h>
#include <Autolock.h>
#include <AutoLocker.h>
#include <Beep.h>
#include <Button.h>
#include <Catalog.h>
#include <CheckBox.h>
#include <Clipboard.h>
#include <Locale.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <Mime.h>
@@ -25,11 +27,13 @@
#include <ScrollView.h>
#include <TextView.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "DataView.h"
#include "DiskProbe.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "FindWindow"
static const uint32 kMsgFindMode = 'FMde';
static const uint32 kMsgStartFind = 'SFnd';
@@ -500,12 +504,12 @@ FindWindow::FindWindow(BRect _rect, BMessage& previous, BMessenger& target,
fMenu = new BPopUpMenu("mode");
BMessage* message;
BMenuItem* item;
fMenu->AddItem(item = new BMenuItem("Text",
fMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Text"),
message = new BMessage(kMsgFindMode)));
message->AddInt8("mode", kAsciiMode);
if (mode == kAsciiMode)
item->SetMarked(true);
fMenu->AddItem(item = new BMenuItem("Hexadecimal",
fMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Hexadecimal"),
message = new BMessage(kMsgFindMode)));
message->AddInt8("mode", kHexMode);
if (mode == kHexMode)
@@ -513,14 +517,14 @@ FindWindow::FindWindow(BRect _rect, BMessage& previous, BMessenger& target,
BRect rect = Bounds().InsetByCopy(5, 5);
BMenuField* menuField = new BMenuField(rect, B_EMPTY_STRING,
"Mode:", fMenu, B_FOLLOW_LEFT | B_FOLLOW_TOP);
B_TRANSLATE("Mode:"), fMenu, B_FOLLOW_LEFT | B_FOLLOW_TOP);
menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 8);
menuField->ResizeToPreferred();
view->AddChild(menuField);
// add the bottom widgets
BButton* button = new BButton(rect, B_EMPTY_STRING, "Find",
BButton* button = new BButton(rect, B_EMPTY_STRING, B_TRANSLATE("Find"),
new BMessage(kMsgStartFind), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
button->MakeDefault(true);
button->ResizeToPreferred();
@@ -528,7 +532,7 @@ FindWindow::FindWindow(BRect _rect, BMessage& previous, BMessenger& target,
rect.bottom - button->Bounds().Height());
view->AddChild(button);
fCaseCheckBox = new BCheckBox(rect, B_EMPTY_STRING, "Case sensitive",
fCaseCheckBox = new BCheckBox(rect, B_EMPTY_STRING, B_TRANSLATE("Case sensitive"),
NULL, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fCaseCheckBox->ResizeToPreferred();
fCaseCheckBox->MoveTo(5, button->Frame().top);
+14 -2
View File
@@ -16,7 +16,19 @@ Application DiskProbe :
ProbeView.cpp
OpenWindow.cpp
FindWindow.cpp
: be tracker translation libexpression_parser.a libmapm.a
: be locale tracker translation libexpression_parser.a libmapm.a
$(TARGET_LIBSUPC++)
: DiskProbe.rdef
;
;
DoCatalogs DiskProbe :
x-vnd.Haiku-DiskProbe
:
AttributeWindow.cpp
DiskProbe.cpp
FindWindow.cpp
FileWindow.cpp
OpenWindow.cpp
ProbeView.cpp
TypeEditors.cpp
;
+13 -5
View File
@@ -4,14 +4,17 @@
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include "OpenWindow.h"
#include <Application.h>
#include <Button.h>
#include <Catalog.h>
#include <Directory.h>
#include <Entry.h>
#include <GroupLayout.h>
#include <GridLayoutBuilder.h>
#include <Locale.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <Path.h>
@@ -21,12 +24,15 @@
#include "DiskProbe.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "OpenWindow"
static const uint32 kMsgProbeFile = 'prDv';
static const uint32 kMsgProbeDevice = 'prFl';
OpenWindow::OpenWindow()
: BWindow(BRect(0, 0, 35, 10), "DiskProbe", B_TITLED_WINDOW,
: BWindow(BRect(0, 0, 35, 10), B_TRANSLATE("DiskProbe"), B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS
| B_AUTO_UPDATE_SIZE_LIMITS)
{
@@ -35,16 +41,18 @@ OpenWindow::OpenWindow()
if (BMenuItem *item = fDevicesMenu->ItemAt(0))
item->SetMarked(true);
BMenuField *field = new BMenuField("Examine device:", fDevicesMenu, NULL);
BMenuField *field = new BMenuField(B_TRANSLATE("Examine device:"), fDevicesMenu,
NULL);
BButton *probeDeviceButton = new BButton("device", "Probe device",
BButton *probeDeviceButton = new BButton("device", B_TRANSLATE("Probe device"),
new BMessage(kMsgProbeDevice));
probeDeviceButton->MakeDefault(true);
BButton *probeFileButton = new BButton("file", "Probe file" B_UTF8_ELLIPSIS,
BButton *probeFileButton = new BButton("file",
B_TRANSLATE("Probe file" B_UTF8_ELLIPSIS),
new BMessage(kMsgProbeFile));
BButton *cancelButton = new BButton("cancel", "Cancel",
BButton *cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
new BMessage(B_QUIT_REQUESTED));
+87 -79
View File
@@ -10,39 +10,41 @@
#include <stdlib.h>
#include <string.h>
#include <Alert.h>
#include <Application.h>
#include <Window.h>
#include <Clipboard.h>
#include <Autolock.h>
#include <MessageQueue.h>
#include <TextControl.h>
#include <StringView.h>
#include <Slider.h>
#include <Beep.h>
#include <Bitmap.h>
#include <Button.h>
#include <Box.h>
#include <Button.h>
#include <Catalog.h>
#include <Clipboard.h>
#include <Directory.h>
#include <Entry.h>
#include <ExpressionParser.h>
#include <fs_attr.h>
#include <Locale.h>
#include <MenuBar.h>
#include <MenuItem.h>
#include <ScrollView.h>
#include <Alert.h>
#include <String.h>
#include <Entry.h>
#include <Path.h>
#include <MessageQueue.h>
#include <NodeInfo.h>
#include <Node.h>
#include <NodeMonitor.h>
#include <Directory.h>
#include <Volume.h>
#include <fs_attr.h>
#include <Path.h>
#include <PrintJob.h>
#include <Beep.h>
#include <ExpressionParser.h>
#include <ScrollView.h>
#include <StringView.h>
#include <Slider.h>
#include <String.h>
#include <TextControl.h>
#include <Volume.h>
#include <Window.h>
#include "DataView.h"
#include "DiskProbe.h"
#include "TypeEditors.h"
#ifndef __HAIKU__
# define DRAW_SLIDER_BAR
// if this is defined, the standard slider bar is replaced with
@@ -50,6 +52,9 @@
// (even in Dano/Zeta)
#endif
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "ProbeView"
static const uint32 kMsgSliderUpdate = 'slup';
static const uint32 kMsgPositionUpdate = 'poup';
static const uint32 kMsgLastPosition = 'lpos';
@@ -495,7 +500,10 @@ HeaderView::HeaderView(BRect frame, const entry_ref *ref, DataEditor &editor)
BStringView *stringView = new BStringView(BRect(50, 6, rect.right, 20),
B_EMPTY_STRING, editor.IsAttribute()
? "Attribute: " : editor.IsDevice() ? "Device: " : "File: ");
? B_TRANSLATE("Attribute: ")
: editor.IsDevice()
? B_TRANSLATE("Device: ")
: B_TRANSLATE("File: "));
stringView->SetFont(&boldFont);
stringView->ResizeToPreferred();
AddChild(stringView);
@@ -519,7 +527,7 @@ HeaderView::HeaderView(BRect frame, const entry_ref *ref, DataEditor &editor)
if (editor.IsAttribute()) {
top += 3;
stringView = new BStringView(BRect(50, top, frame.right, top + 15),
B_EMPTY_STRING, "Attribute type: ");
B_EMPTY_STRING, B_TRANSLATE("Attribute type: "));
stringView->SetFont(&boldFont);
stringView->ResizeToPreferred();
AddChild(stringView);
@@ -546,7 +554,7 @@ HeaderView::HeaderView(BRect frame, const entry_ref *ref, DataEditor &editor)
fTypeControl = NULL;
stringView = new BStringView(BRect(50, top, frame.right, top + 15),
B_EMPTY_STRING, "Block: ");
B_EMPTY_STRING, B_TRANSLATE("Block: "));
stringView->SetFont(&boldFont);
stringView->ResizeToPreferred();
AddChild(stringView);
@@ -567,14 +575,14 @@ HeaderView::HeaderView(BRect frame, const entry_ref *ref, DataEditor &editor)
rect.left = rect.right + 4;
rect.right = rect.left + 75;
rect.OffsetBy(0, 2);
fSizeView = new BStringView(rect, B_EMPTY_STRING, "of 0x0");
fSizeView = new BStringView(rect, B_EMPTY_STRING, B_TRANSLATE("of 0x0"));
fSizeView->SetFont(&plainFont);
AddChild(fSizeView);
UpdateFileSizeView();
rect.left = rect.right + 4;
rect.right = frame.right;
stringView = new BStringView(rect, B_EMPTY_STRING, "Offset: ");
stringView = new BStringView(rect, B_EMPTY_STRING, B_TRANSLATE("Offset: "));
stringView->SetFont(&boldFont);
stringView->ResizeToPreferred();
AddChild(stringView);
@@ -590,8 +598,8 @@ HeaderView::HeaderView(BRect frame, const entry_ref *ref, DataEditor &editor)
rect.left = rect.right + 4;
rect.right = frame.right;
stringView = new BStringView(rect, B_EMPTY_STRING, editor.IsAttribute()
? "Attribute offset: " : editor.IsDevice()
? "Device offset: " : "File offset: ");
? B_TRANSLATE("Attribute offset: ") : editor.IsDevice()
? B_TRANSLATE("Device offset: ") : B_TRANSLATE("File offset: "));
stringView->SetFont(&boldFont);
stringView->ResizeToPreferred();
AddChild(stringView);
@@ -729,7 +737,7 @@ void
HeaderView::UpdateFileSizeView()
{
char buffer[64];
strcpy(buffer, "of ");
strcpy(buffer, B_TRANSLATE("of "));
FormatValue(buffer + 3, sizeof(buffer) - 3,
(fFileSize + fBlockSize - 1) / fBlockSize);
fSizeView->SetText(buffer);
@@ -1091,8 +1099,8 @@ EditorLooper::Find(off_t startAt, const uint8 *data, size_t dataSize,
if (system_time() > startTime + 8000000LL) {
// If the user had to wait more than 8 seconds for the result,
// we are trying to please him with a requester...
(new BAlert("DiskProbe request",
"Could not find search string.", "OK", NULL, NULL,
(new BAlert(B_TRANSLATE("DiskProbe request"),
B_TRANSLATE("Could not find search string."), B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
} else
beep();
@@ -1119,8 +1127,8 @@ TypeView::TypeView(BRect rect, const char* name, int32 index,
fTypeEditorView = GetTypeEditorAt(index, Frame(), editor);
if (fTypeEditorView == NULL) {
AddChild(new BStringView(Bounds(), "Type editor",
"Type editor not supported", B_FOLLOW_NONE));
AddChild(new BStringView(Bounds(), B_TRANSLATE("Type editor"),
B_TRANSLATE("Type editor not supported"), B_FOLLOW_NONE));
} else
AddChild(fTypeEditorView);
@@ -1311,7 +1319,7 @@ ProbeView::_UpdateAttributesMenu(BMenu *menu)
void
ProbeView::AddSaveMenuItems(BMenu* menu, int32 index)
{
menu->AddItem(fSaveMenuItem = new BMenuItem("Save",
menu->AddItem(fSaveMenuItem = new BMenuItem(B_TRANSLATE("Save"),
new BMessage(B_SAVE_REQUESTED), 'S'), index);
fSaveMenuItem->SetTarget(this);
fSaveMenuItem->SetEnabled(false);
@@ -1323,10 +1331,10 @@ void
ProbeView::AddPrintMenuItems(BMenu* menu, int32 index)
{
BMenuItem *item;
menu->AddItem(item = new BMenuItem("Page setup" B_UTF8_ELLIPSIS,
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Page setup" B_UTF8_ELLIPSIS),
new BMessage(kMsgPageSetup)), index++);
item->SetTarget(this);
menu->AddItem(item = new BMenuItem("Print" B_UTF8_ELLIPSIS,
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Print" B_UTF8_ELLIPSIS),
new BMessage(kMsgPrint), 'P'), index++);
item->SetTarget(this);
}
@@ -1340,7 +1348,7 @@ ProbeView::AddViewAsMenuItems()
if (bar == NULL)
return;
BMenuItem* item = bar->FindItem("View");
BMenuItem* item = bar->FindItem(B_TRANSLATE("View"));
BMenu* menu = NULL;
if (item != NULL)
menu = item->Submenu();
@@ -1352,11 +1360,11 @@ ProbeView::AddViewAsMenuItems()
menu->AddSeparatorItem();
BMenu* subMenu = new BMenu("View As");
BMenu* subMenu = new BMenu(B_TRANSLATE("View As"));
subMenu->SetRadioMode(true);
BMessage* message = new BMessage(kMsgViewAs);
subMenu->AddItem(item = new BMenuItem("Raw", message));
subMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Raw"), message));
item->SetMarked(true);
const char* name;
@@ -1397,44 +1405,44 @@ ProbeView::AttachedToWindow()
ResizeBy(0, -bar->Bounds().Height());
BMenu *menu = new BMenu(fEditor.IsAttribute()
? "Attribute" : fEditor.IsDevice() ? "Device" : "File");
? B_TRANSLATE("Attribute") : fEditor.IsDevice() ? B_TRANSLATE("Device") : B_TRANSLATE("File"));
AddSaveMenuItems(menu, 0);
menu->AddSeparatorItem();
AddPrintMenuItems(menu, menu->CountItems());
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Close", new BMessage(B_CLOSE_REQUESTED),
menu->AddItem(new BMenuItem(B_TRANSLATE("Close"), new BMessage(B_CLOSE_REQUESTED),
'W'));
bar->AddItem(menu);
}
// "Edit" menu
BMenu *menu = new BMenu("Edit");
BMenu *menu = new BMenu(B_TRANSLATE("Edit"));
BMenuItem *item;
menu->AddItem(fUndoMenuItem = new BMenuItem("Undo", new BMessage(B_UNDO),
menu->AddItem(fUndoMenuItem = new BMenuItem(B_TRANSLATE("Undo"), new BMessage(B_UNDO),
'Z'));
fUndoMenuItem->SetEnabled(fEditor.CanUndo());
fUndoMenuItem->SetTarget(fDataView);
menu->AddItem(fRedoMenuItem = new BMenuItem("Redo", new BMessage(B_REDO),
menu->AddItem(fRedoMenuItem = new BMenuItem(B_TRANSLATE("Redo"), new BMessage(B_REDO),
'Z', B_SHIFT_KEY));
fRedoMenuItem->SetEnabled(fEditor.CanRedo());
fRedoMenuItem->SetTarget(fDataView);
menu->AddSeparatorItem();
menu->AddItem(item = new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Copy"), new BMessage(B_COPY), 'C'));
item->SetTarget(NULL, Window());
menu->AddItem(fPasteMenuItem = new BMenuItem("Paste", new BMessage(B_PASTE),
menu->AddItem(fPasteMenuItem = new BMenuItem(B_TRANSLATE("Paste"), new BMessage(B_PASTE),
'V'));
fPasteMenuItem->SetTarget(NULL, Window());
_CheckClipboard();
menu->AddItem(item = new BMenuItem("Select all", new BMessage(B_SELECT_ALL),
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Select all"), new BMessage(B_SELECT_ALL),
'A'));
item->SetTarget(NULL, Window());
menu->AddSeparatorItem();
menu->AddItem(item = new BMenuItem("Find" B_UTF8_ELLIPSIS,
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Find" B_UTF8_ELLIPSIS),
new BMessage(kMsgOpenFindWindow), 'F'));
item->SetTarget(this);
menu->AddItem(fFindAgainMenuItem = new BMenuItem("Find again",
menu->AddItem(fFindAgainMenuItem = new BMenuItem(B_TRANSLATE("Find again"),
new BMessage(kMsgFind), 'G'));
fFindAgainMenuItem->SetEnabled(false);
fFindAgainMenuItem->SetTarget(this);
@@ -1442,20 +1450,20 @@ ProbeView::AttachedToWindow()
// "Block" menu
menu = new BMenu("Block");
menu = new BMenu(B_TRANSLATE("Block"));
BMessage *message = new BMessage(kMsgPositionUpdate);
message->AddInt32("delta", 1);
menu->AddItem(item = new BMenuItem("Next", message, B_RIGHT_ARROW));
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Next"), message, B_RIGHT_ARROW));
item->SetTarget(fHeaderView);
message = new BMessage(kMsgPositionUpdate);
message->AddInt32("delta", -1);
menu->AddItem(item = new BMenuItem("Previous", message, B_LEFT_ARROW));
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Previous"), message, B_LEFT_ARROW));
item->SetTarget(fHeaderView);
menu->AddItem(item = new BMenuItem("Back", new BMessage(kMsgLastPosition),
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Back"), new BMessage(kMsgLastPosition),
'J'));
item->SetTarget(fHeaderView);
BMenu *subMenu = new BMenu("Selection");
BMenu *subMenu = new BMenu(B_TRANSLATE("Selection"));
message = new BMessage(kMsgPositionUpdate);
message->AddInt64("block", 0);
subMenu->AddItem(fNativeMenuItem = new BMenuItem("", message, 'K'));
@@ -1467,8 +1475,8 @@ ProbeView::AttachedToWindow()
_UpdateSelectionMenuItems(0, 0);
menu->AddSeparatorItem();
fBookmarkMenu = new BMenu("Bookmarks");
fBookmarkMenu->AddItem(item = new BMenuItem("Add",
fBookmarkMenu = new BMenu(B_TRANSLATE("Bookmarks"));
fBookmarkMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Add"),
new BMessage(kMsgAddBookmark), 'B'));
item->SetTarget(this);
menu->AddItem(new BMenuItem(fBookmarkMenu));
@@ -1487,27 +1495,27 @@ ProbeView::AttachedToWindow()
if (!fEditor.IsAttribute() && volume.InitCheck() == B_OK
&& (volume.KnowsMime() || volume.KnowsAttr())) {
bar->AddItem(menu = new BMenu("Attributes"));
bar->AddItem(menu = new BMenu(B_TRANSLATE("Attributes")));
_UpdateAttributesMenu(menu);
}
// "View" menu
menu = new BMenu("View");
menu = new BMenu(B_TRANSLATE("View"));
// Number Base (hex/decimal)
subMenu = new BMenu("Base");
subMenu = new BMenu(B_TRANSLATE("Base"));
message = new BMessage(kMsgBaseType);
message->AddInt32("base_type", kDecimalBase);
subMenu->AddItem(item = new BMenuItem("Decimal", message, 'D'));
subMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Decimal"), message, 'D'));
item->SetTarget(this);
if (fHeaderView->Base() == kDecimalBase)
item->SetMarked(true);
message = new BMessage(kMsgBaseType);
message->AddInt32("base_type", kHexBase);
subMenu->AddItem(item = new BMenuItem("Hex", message, 'H'));
subMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Hex"), message, 'H'));
item->SetTarget(this);
if (fHeaderView->Base() == kHexBase)
item->SetMarked(true);
@@ -1517,14 +1525,14 @@ ProbeView::AttachedToWindow()
// Block Size
subMenu = new BMenu("BlockSize");
subMenu = new BMenu(B_TRANSLATE("BlockSize"));
subMenu->SetRadioMode(true);
const uint32 blockSizes[] = {512, 1024, 2048};
for (uint32 i = 0; i < sizeof(blockSizes) / sizeof(blockSizes[0]); i++) {
char buffer[32];
snprintf(buffer, sizeof(buffer), "%ld%s", blockSizes[i],
fEditor.IsDevice() && fEditor.BlockSize() == blockSizes[i]
? " (native)" : "");
? B_TRANSLATE(" (native)") : "");
subMenu->AddItem(item = new BMenuItem(buffer,
message = new BMessage(kMsgBlockSize)));
message->AddInt32("block_size", blockSizes[i]);
@@ -1534,7 +1542,7 @@ ProbeView::AttachedToWindow()
if (subMenu->FindMarked() == NULL) {
// if the device has some weird block size, we'll add it here, too
char buffer[32];
snprintf(buffer, sizeof(buffer), "%ld (native)", fEditor.BlockSize());
snprintf(buffer, sizeof(buffer), B_TRANSLATE("%ld (native)"), fEditor.BlockSize());
subMenu->AddItem(item = new BMenuItem(buffer,
message = new BMessage(kMsgBlockSize)));
message->AddInt32("block_size", fEditor.BlockSize());
@@ -1546,7 +1554,7 @@ ProbeView::AttachedToWindow()
// Font Size
subMenu = new BMenu("Font size");
subMenu = new BMenu(B_TRANSLATE("Font size"));
subMenu->SetRadioMode(true);
const int32 fontSizes[] = {9, 10, 11, 12, 13, 14, 18, 24, 36, 48};
int32 fontSize = int32(fDataView->FontSize() + 0.5);
@@ -1562,7 +1570,7 @@ ProbeView::AttachedToWindow()
item->SetMarked(true);
}
subMenu->AddSeparatorItem();
subMenu->AddItem(item = new BMenuItem("Fit",
subMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Fit"),
message = new BMessage(kMsgFontSize)));
message->AddFloat("font_size", 0.0f);
if (fontSize == 0)
@@ -1625,9 +1633,9 @@ ProbeView::_UpdateSelectionMenuItems(int64 start, int64 end)
char buffer[128];
if (fDataView->Base() == kHexBase)
snprintf(buffer, sizeof(buffer), "Native: 0x%0*Lx", size * 2, position);
snprintf(buffer, sizeof(buffer), B_TRANSLATE("Native: 0x%0*Lx"), size * 2, position);
else
snprintf(buffer, sizeof(buffer), "Native: %Ld (0x%0*Lx)", position, size * 2, position);
snprintf(buffer, sizeof(buffer), B_TRANSLATE("Native: %Ld (0x%0*Lx)"), position, size * 2, position);
fNativeMenuItem->SetLabel(buffer);
fNativeMenuItem->SetEnabled(position >= 0 && (position * fEditor.BlockSize()) < fEditor.FileSize());
@@ -1635,9 +1643,9 @@ ProbeView::_UpdateSelectionMenuItems(int64 start, int64 end)
position = B_SWAP_INT64(position) >> (8 * (8 - size));
if (fDataView->Base() == kHexBase)
snprintf(buffer, sizeof(buffer), "Swapped: 0x%0*Lx", size * 2, position);
snprintf(buffer, sizeof(buffer), B_TRANSLATE("Swapped: 0x%0*Lx"), size * 2, position);
else
snprintf(buffer, sizeof(buffer), "Swapped: %Ld (0x%0*Lx)", position, size * 2, position);
snprintf(buffer, sizeof(buffer), B_TRANSLATE("Swapped: %Ld (0x%0*Lx)"), position, size * 2, position);
fSwappedMenuItem->SetLabel(buffer);
fSwappedMenuItem->SetEnabled(position >= 0 && (position * fEditor.BlockSize()) < fEditor.FileSize());
@@ -1661,9 +1669,9 @@ ProbeView::_UpdateBookmarkMenuItems()
char buffer[128];
if (fDataView->Base() == kHexBase)
snprintf(buffer, sizeof(buffer), "Block 0x%Lx", block);
snprintf(buffer, sizeof(buffer), B_TRANSLATE("Block 0x%Lx"), block);
else
snprintf(buffer, sizeof(buffer), "Block %Ld (0x%Lx)", block, block);
snprintf(buffer, sizeof(buffer), B_TRANSLATE("Block %Ld (0x%Lx)"), block, block);
item->SetLabel(buffer);
}
@@ -1701,9 +1709,9 @@ ProbeView::_AddBookmark(off_t position)
char buffer[128];
if (fDataView->Base() == kHexBase)
snprintf(buffer, sizeof(buffer), "Block 0x%Lx", block);
snprintf(buffer, sizeof(buffer), B_TRANSLATE("Block 0x%Lx"), block);
else
snprintf(buffer, sizeof(buffer), "Block %Ld (0x%Lx)", block, block);
snprintf(buffer, sizeof(buffer), B_TRANSLATE("Block %Ld (0x%Lx)"), block, block);
BMessage *message;
item = new BMenuItem(buffer, message = new BMessage(kMsgPositionUpdate));
@@ -1748,7 +1756,7 @@ ProbeView::_SetTypeEditor(int32 index)
_RemoveTypeEditor();
fTypeView = new TypeView(Frame(), "type shell", index, fEditor,
fTypeView = new TypeView(Frame(), B_TRANSLATE("type shell"), index, fEditor,
B_FOLLOW_ALL);
if (Parent() != NULL)
@@ -1835,13 +1843,13 @@ ProbeView::_Save()
char buffer[1024];
snprintf(buffer, sizeof(buffer),
"Writing to the file failed:\n"
B_TRANSLATE("Writing to the file failed:\n"
"%s\n\n"
"All changes will be lost when you quit.",
"All changes will be lost when you quit."),
strerror(status));
(new BAlert("DiskProbe request",
buffer, "OK", NULL, NULL,
(new BAlert(B_TRANSLATE("DiskProbe request"),
buffer, B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
return status;
@@ -1856,9 +1864,9 @@ ProbeView::QuitRequested()
if (!fEditor.IsModified())
return true;
int32 chosen = (new BAlert("DiskProbe request",
"Save changes before closing?", "Don't save", "Cancel", "Save",
B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
int32 chosen = (new BAlert(B_TRANSLATE("DiskProbe request"),
B_TRANSLATE("Save changes before closing?"), B_TRANSLATE("Don't save"), B_TRANSLATE("Cancel"),
B_TRANSLATE("Save"), B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
if (chosen == 0)
return true;
+53 -46
View File
@@ -7,16 +7,17 @@
#include "TypeEditors.h"
#include "DataEditor.h"
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
# include <IconUtils.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <Alert.h>
#include <Autolock.h>
#include <Bitmap.h>
#include <Catalog.h>
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
# include <IconUtils.h>
#endif
#include <Locale.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <Mime.h>
@@ -31,6 +32,9 @@
#include <TranslatorFormats.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "TypeEditors"
static const uint32 kMsgValueChanged = 'vlch';
static const uint32 kMsgScaleChanged = 'scch';
static const uint32 kMimeTypeItem = 'miti';
@@ -196,7 +200,7 @@ StringEditor::StringEditor(BRect rect, DataEditor& editor)
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BStringView *stringView = new BStringView(BRect(5, 5, rect.right, 20),
B_EMPTY_STRING, "Contents:");
B_EMPTY_STRING, B_TRANSLATE("Contents:"));
stringView->ResizeToPreferred();
AddChild(stringView);
@@ -275,12 +279,12 @@ StringEditor::MessageReceived(BMessage *message)
MimeTypeEditor::MimeTypeEditor(BRect rect, DataEditor& editor)
: TypeEditorView(rect, "MIME type editor", B_FOLLOW_LEFT_RIGHT, 0, editor)
: TypeEditorView(rect, B_TRANSLATE("MIME type editor"), B_FOLLOW_LEFT_RIGHT, 0, editor)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fTextControl = new BTextControl(rect.InsetByCopy(5, 5), B_EMPTY_STRING,
"MIME type:", NULL, new BMessage(kMsgValueChanged), B_FOLLOW_ALL);
B_TRANSLATE("MIME type:"), NULL, new BMessage(kMsgValueChanged), B_FOLLOW_ALL);
fTextControl->SetDivider(StringWidth(fTextControl->Label()) + 8);
float width, height;
@@ -366,7 +370,7 @@ MimeTypeEditor::MessageReceived(BMessage *message)
NumberEditor::NumberEditor(BRect rect, DataEditor &editor)
: TypeEditorView(rect, "Number editor", B_FOLLOW_LEFT_RIGHT, 0, editor)
: TypeEditorView(rect, B_TRANSLATE("Number editor"), B_FOLLOW_LEFT_RIGHT, 0, editor)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
@@ -593,35 +597,35 @@ NumberEditor::_TypeLabel()
{
switch (fEditor.Type()) {
case B_INT8_TYPE:
return "8 bit signed value:";
return B_TRANSLATE("8 bit signed value:");
case B_UINT8_TYPE:
return "8 bit unsigned value:";
return B_TRANSLATE("8 bit unsigned value:");
case B_INT16_TYPE:
return "16 bit signed value:";
return B_TRANSLATE("16 bit signed value:");
case B_UINT16_TYPE:
return "16 bit unsigned value:";
return B_TRANSLATE("16 bit unsigned value:");
case B_INT32_TYPE:
return "32 bit signed value:";
return B_TRANSLATE("32 bit signed value:");
case B_UINT32_TYPE:
return "32 bit unsigned value:";
return B_TRANSLATE("32 bit unsigned value:");
case B_INT64_TYPE:
return "64 bit signed value:";
return B_TRANSLATE("64 bit signed value:");
case B_UINT64_TYPE:
return "64 bit unsigned value:";
return B_TRANSLATE("64 bit unsigned value:");
case B_FLOAT_TYPE:
return "Floating-point value:";
return B_TRANSLATE("Floating-point value:");
case B_DOUBLE_TYPE:
return "Double precision floating-point value:";
return B_TRANSLATE("Double precision floating-point value:");
case B_SSIZE_T_TYPE:
return "32 bit size or status:";
return B_TRANSLATE("32 bit size or status:");
case B_SIZE_T_TYPE:
return "32 bit unsigned size:";
return B_TRANSLATE("32 bit unsigned size:");
case B_OFF_T_TYPE:
return "64 bit signed offset:";
return B_TRANSLATE("64 bit signed offset:");
case B_POINTER_TYPE:
return "32 bit unsigned pointer:";
return B_TRANSLATE("32 bit unsigned pointer:");
default:
return "Number:";
return B_TRANSLATE("Number:");
}
}
@@ -755,7 +759,7 @@ BooleanEditor::BooleanEditor(BRect rect, DataEditor &editor)
message->AddInt8("value", 1);
BMenuField *menuField = new BMenuField(rect.InsetByCopy(5, 5),
B_EMPTY_STRING, "Boolean value:", menu, B_FOLLOW_LEFT_RIGHT);
B_EMPTY_STRING, B_TRANSLATE("Boolean value:"), menu, B_FOLLOW_LEFT_RIGHT);
menuField->SetDivider(StringWidth(menuField->Label()) + 8);
menuField->ResizeToPreferred();
ResizeTo(menuField->Bounds().Width() + 10,
@@ -839,16 +843,18 @@ BooleanEditor::MessageReceived(BMessage *message)
ImageView::ImageView(BRect rect, DataEditor &editor)
: TypeEditorView(rect, "Image view", B_FOLLOW_NONE, B_WILL_DRAW, editor),
: TypeEditorView(rect, B_TRANSLATE("Image view"), B_FOLLOW_NONE,
B_WILL_DRAW, editor),
fBitmap(NULL),
fScaleSlider(NULL)
{
if (editor.Type() == B_MINI_ICON_TYPE || editor.Type() == B_LARGE_ICON_TYPE
if (editor.Type() == B_MINI_ICON_TYPE
|| editor.Type() == B_LARGE_ICON_TYPE
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|| editor.Type() == B_VECTOR_ICON_TYPE
#endif
)
SetName("Icon view");
SetName(B_TRANSLATE("Icon view"));
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
if (editor.Type() == B_VECTOR_ICON_TYPE) {
@@ -864,7 +870,8 @@ ImageView::ImageView(BRect rect, DataEditor &editor)
}
#endif
fDescriptionView = new BStringView(Bounds(), "", "Could not read image", B_FOLLOW_NONE);
fDescriptionView = new BStringView(Bounds(), "",
B_TRANSLATE("Could not read image"), B_FOLLOW_NONE);
fDescriptionView->SetAlignment(B_ALIGN_CENTER);
AddChild(fDescriptionView);
@@ -1020,20 +1027,20 @@ ImageView::_UpdateImage()
if (fBitmap != NULL) {
char buffer[256];
const char *type = "Unknown type";
const char *type = B_TRANSLATE("Unknown type");
switch (fEditor.Type()) {
case B_MINI_ICON_TYPE:
case B_LARGE_ICON_TYPE:
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
case B_VECTOR_ICON_TYPE:
#endif
type = "Icon";
type = B_TRANSLATE("Icon");
break;
case B_PNG_FORMAT:
type = "PNG format";
type = B_TRANSLATE("PNG format");
break;
case B_MESSAGE_TYPE:
type = "Flattened bitmap";
type = B_TRANSLATE("Flattened bitmap");
break;
default:
break;
@@ -1042,36 +1049,36 @@ ImageView::_UpdateImage()
switch (fBitmap->ColorSpace()) {
case B_GRAY1:
case B_GRAY8:
colorSpace = "Grayscale";
colorSpace = B_TRANSLATE("Grayscale");
break;
case B_CMAP8:
colorSpace = "8 bit palette";
colorSpace = B_TRANSLATE("8 bit palette");
break;
case B_RGB32:
case B_RGBA32:
case B_RGB32_BIG:
case B_RGBA32_BIG:
colorSpace = "32 bit";
colorSpace = B_TRANSLATE("32 bit");
break;
case B_RGB15:
case B_RGBA15:
case B_RGB15_BIG:
case B_RGBA15_BIG:
colorSpace = "15 bit";
colorSpace = B_TRANSLATE("15 bit");
break;
case B_RGB16:
case B_RGB16_BIG:
colorSpace = "16 bit";
colorSpace = B_TRANSLATE("16 bit");
break;
default:
colorSpace = "Unknown format";
colorSpace = B_TRANSLATE("Unknown format");
break;
}
snprintf(buffer, sizeof(buffer), "%s, %g x %g, %s", type,
fBitmap->Bounds().Width() + 1, fBitmap->Bounds().Height() + 1, colorSpace);
fDescriptionView->SetText(buffer);
} else
fDescriptionView->SetText("Could not read image");
fDescriptionView->SetText(B_TRANSLATE("Could not read image"));
// Update the view size to match the image and its description
@@ -1124,7 +1131,7 @@ ImageView::_UpdateImage()
MessageView::MessageView(BRect rect, DataEditor &editor)
: TypeEditorView(rect, "Message View", B_FOLLOW_ALL, 0, editor)
: TypeEditorView(rect, B_TRANSLATE("Message View"), B_FOLLOW_ALL, 0, editor)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
@@ -1177,7 +1184,7 @@ MessageView::SetTo(BMessage& message)
fTextView->SetText("");
char text[512];
snprintf(text, sizeof(text), "what: '%.4s'\n\n", (char*)&message.what);
snprintf(text, sizeof(text), B_TRANSLATE("what: '%.4s'\n\n"), (char*)&message.what);
fTextView->Insert(text);
type_code type;
@@ -1346,11 +1353,11 @@ status_t
GetNthTypeEditor(int32 index, const char** _name)
{
static const char* kEditors[] = {
"Text",
"Number",
"Boolean",
"Message",
"Image"
B_TRANSLATE("Text"),
B_TRANSLATE("Number"),
B_TRANSLATE("Boolean"),
B_TRANSLATE("Message"),
B_TRANSLATE("Image")
};
if (index < 0 || index >= int32(sizeof(kEditors) / sizeof(kEditors[0])))