Updated to use B_TRANSLATE* macros. relates to #5408.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36664 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia
2010-05-06 16:19:00 +00:00
parent 04bcc0b403
commit 61863f2c44
5 changed files with 125 additions and 106 deletions
+30 -20
View File
@@ -141,7 +141,8 @@ void
TBeMenu::DoneBuildingItemList() TBeMenu::DoneBuildingItemList()
{ {
if (fItemList->CountItems() <= 0) { if (fItemList->CountItems() <= 0) {
BMenuItem* item = new BMenuItem(TR("<Be folder is empty>"), 0); BMenuItem* item = new BMenuItem(B_TRANSLATE("<Be folder is empty>"),
0);
item->SetEnabled(false); item->SetEnabled(false);
AddItem(item); AddItem(item);
} else } else
@@ -157,8 +158,10 @@ TBeMenu::AddNextItem()
TrackingHookData* data = fBarView->GetTrackingHookData(); TrackingHookData* data = fBarView->GetTrackingHookData();
if (fAddState == kAddingRecents) { if (fAddState == kAddingRecents) {
static const char* recentTitle[] = {TR_MARK("Recent documents"), static const char* recentTitle[] = {
TR_MARK("Recent folders"), TR_MARK("Recent applications")}; B_TRANSLATE_MARK("Recent documents"),
B_TRANSLATE_MARK("Recent folders"),
B_TRANSLATE_MARK("Recent applications")};
const int recentType[] = {kRecentDocuments, kRecentFolders, const int recentType[] = {kRecentDocuments, kRecentFolders,
kRecentApplications}; kRecentApplications};
const int recentTypes = 3; const int recentTypes = 3;
@@ -167,8 +170,8 @@ TBeMenu::AddNextItem()
bool enabled = false; bool enabled = false;
for (int i = 0; i < recentTypes; i++) { for (int i = 0; i < recentTypes; i++) {
recentItem[i] = new TRecentsMenu(TR(recentTitle[i]), fBarView, recentItem[i] = new TRecentsMenu(B_TRANSLATE(recentTitle[i]),
recentType[i]); fBarView, recentType[i]);
if (recentItem[i]) if (recentItem[i])
enabled |= recentItem[i]->RecentsEnabled(); enabled |= recentItem[i]->RecentsEnabled();
@@ -233,65 +236,71 @@ TBeMenu::AddStandardBeMenuItems()
BMenuItem* item; BMenuItem* item;
BRoster roster; BRoster roster;
if (!roster.IsRunning(kTrackerSignature)) { if (!roster.IsRunning(kTrackerSignature)) {
item = new BMenuItem(TR("Restart Tracker"), new BMessage(kRestartTracker)); item = new BMenuItem(B_TRANSLATE("Restart Tracker"),
new BMessage(kRestartTracker));
AddItem(item); AddItem(item);
AddSeparatorItem(); AddSeparatorItem();
} }
static const char* kAboutHaikuMenuItemStr = TR_MARK( static const char* kAboutHaikuMenuItemStr = B_TRANSLATE_MARK(
"About Haiku" B_UTF8_ELLIPSIS); "About Haiku" B_UTF8_ELLIPSIS);
static const char* kAboutThisSystemMenuItemStr = TR_MARK( static const char* kAboutThisSystemMenuItemStr = B_TRANSLATE_MARK(
"About this system" B_UTF8_ELLIPSIS); "About this system" B_UTF8_ELLIPSIS);
item = new BMenuItem( item = new BMenuItem(
#ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL #ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL
TR(kAboutHaikuMenuItemStr) B_TRANSLATE(kAboutHaikuMenuItemStr)
#else #else
TR(kAboutThisSystemMenuItemStr) B_TRANSLATE(kAboutThisSystemMenuItemStr)
#endif #endif
, new BMessage(kShowSplash)); , new BMessage(kShowSplash));
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
AddItem(item); AddItem(item);
static const char* kFindMenuItemStr = TR_MARK("Find" B_UTF8_ELLIPSIS); static const char* kFindMenuItemStr =
B_TRANSLATE_MARK("Find" B_UTF8_ELLIPSIS);
#ifdef SHOW_RECENT_FIND_ITEMS #ifdef SHOW_RECENT_FIND_ITEMS
item = new BMenuItem( item = new BMenuItem(
TrackerBuildRecentFindItemsMenu(kFindMenuItemStr), TrackerBuildRecentFindItemsMenu(kFindMenuItemStr),
new BMessage(kFindButton)); new BMessage(kFindButton));
#else #else
item = new BMenuItem(TR(kFindMenuItemStr), new BMessage(kFindButton)); item = new BMenuItem(B_TRANSLATE(kFindMenuItemStr),
new BMessage(kFindButton));
#endif #endif
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
AddItem(item); AddItem(item);
item = new BMenuItem(TR("Show replicants"), new BMessage(kToggleDraggers)); item = new BMenuItem(B_TRANSLATE("Show replicants"),
new BMessage(kToggleDraggers));
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
item->SetMarked(BDragger::AreDraggersDrawn()); item->SetMarked(BDragger::AreDraggersDrawn());
AddItem(item); AddItem(item);
static const char* kMountMenuStr = TR_MARK("Mount"); static const char* kMountMenuStr = B_TRANSLATE_MARK("Mount");
#ifdef MOUNT_MENU_IN_DESKBAR #ifdef MOUNT_MENU_IN_DESKBAR
DeskbarMountMenu* mountMenu = new DeskbarMountMenu(TR(kMountMenuStr)); DeskbarMountMenu* mountMenu = new DeskbarMountMenu(
B_TRANSLATE(kMountMenuStr));
mountMenu->SetEnabled(!dragging); mountMenu->SetEnabled(!dragging);
AddItem(mountMenu); AddItem(mountMenu);
#endif #endif
item = new BMenuItem(TR("Deskbar preferences" B_UTF8_ELLIPSIS), item = new BMenuItem(B_TRANSLATE("Deskbar preferences" B_UTF8_ELLIPSIS),
new BMessage(kConfigShow)); new BMessage(kConfigShow));
item->SetTarget(be_app); item->SetTarget(be_app);
AddItem(item); AddItem(item);
AddSeparatorItem(); AddSeparatorItem();
BMenu* shutdownMenu = new BMenu(TR("Shutdown" B_UTF8_ELLIPSIS)); BMenu* shutdownMenu = new BMenu(B_TRANSLATE("Shutdown" B_UTF8_ELLIPSIS));
item = new BMenuItem(TR("Restart system"), new BMessage(kRebootSystem)); item = new BMenuItem(B_TRANSLATE("Restart system"),
new BMessage(kRebootSystem));
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
shutdownMenu->AddItem(item); shutdownMenu->AddItem(item);
static const char* kSuspendMenuItemStr = TR_MARK("Suspend"); static const char* kSuspendMenuItemStr = B_TRANSLATE_MARK("Suspend");
#ifdef APM_SUPPORT #ifdef APM_SUPPORT
if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) { if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) {
@@ -301,7 +310,8 @@ TBeMenu::AddStandardBeMenuItems()
} }
#endif #endif
item = new BMenuItem(TR("Power off"), new BMessage(kShutdownSystem)); item = new BMenuItem(B_TRANSLATE("Power off"),
new BMessage(kShutdownSystem));
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
shutdownMenu->AddItem(item); shutdownMenu->AddItem(item);
shutdownMenu->SetFont(be_plain_font); shutdownMenu->SetFont(be_plain_font);
+26 -21
View File
@@ -29,15 +29,16 @@
PreferencesWindow::PreferencesWindow(BRect frame) PreferencesWindow::PreferencesWindow(BRect frame)
: :
BWindow(frame, TR("Deskbar preferences"), B_TITLED_WINDOW, BWindow(frame, B_TRANSLATE("Deskbar preferences"), B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE) B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE)
{ {
// Controls // Controls
fMenuRecentDocuments = new BCheckBox(TR("Recent documents:"), fMenuRecentDocuments = new BCheckBox(B_TRANSLATE("Recent documents:"),
new BMessage(kUpdateRecentCounts)); new BMessage(kUpdateRecentCounts));
fMenuRecentApplications = new BCheckBox(TR("Recent applications:"), fMenuRecentApplications = new BCheckBox(
B_TRANSLATE("Recent applications:"),
new BMessage(kUpdateRecentCounts)); new BMessage(kUpdateRecentCounts));
fMenuRecentFolders = new BCheckBox(TR("Recent folders:"), fMenuRecentFolders = new BCheckBox(B_TRANSLATE("Recent folders:"),
new BMessage(kUpdateRecentCounts)); new BMessage(kUpdateRecentCounts));
fMenuRecentDocumentCount = new BTextControl(NULL, NULL, fMenuRecentDocumentCount = new BTextControl(NULL, NULL,
@@ -47,25 +48,29 @@ PreferencesWindow::PreferencesWindow(BRect frame)
fMenuRecentFolderCount = new BTextControl(NULL, NULL, fMenuRecentFolderCount = new BTextControl(NULL, NULL,
new BMessage(kUpdateRecentCounts)); new BMessage(kUpdateRecentCounts));
fAppsSort = new BCheckBox(TR("Sort running applications"), fAppsSort = new BCheckBox(B_TRANSLATE("Sort running applications"),
new BMessage(kSortRunningApps)); new BMessage(kSortRunningApps));
fAppsSortTrackerFirst = new BCheckBox(TR("Tracker always first"), fAppsSortTrackerFirst = new BCheckBox(B_TRANSLATE("Tracker always first"),
new BMessage(kTrackerFirst)); new BMessage(kTrackerFirst));
fAppsShowExpanders = new BCheckBox(TR("Show application expander"), fAppsShowExpanders = new BCheckBox(
B_TRANSLATE("Show application expander"),
new BMessage(kSuperExpando)); new BMessage(kSuperExpando));
fAppsExpandNew = new BCheckBox(TR("Expand new applications"), fAppsExpandNew = new BCheckBox(B_TRANSLATE("Expand new applications"),
new BMessage(kExpandNewTeams)); new BMessage(kExpandNewTeams));
fClock24Hours = new BCheckBox(TR("24 hour clock"), new BMessage(kMilTime)); fClock24Hours = new BCheckBox(B_TRANSLATE("24 hour clock"),
fClockSeconds = new BCheckBox(TR("Show seconds"), new BMessage(kMilTime));
fClockSeconds = new BCheckBox(B_TRANSLATE("Show seconds"),
new BMessage(kShowSeconds)); new BMessage(kShowSeconds));
fClockEuropeanDate = new BCheckBox(TR("European date"), fClockEuropeanDate = new BCheckBox(B_TRANSLATE("European date"),
new BMessage(kEuroDate)); new BMessage(kEuroDate));
fClockFullDate = new BCheckBox(TR("Full date"), new BMessage(kFullDate)); fClockFullDate = new BCheckBox(B_TRANSLATE("Full date"),
new BMessage(kFullDate));
fWindowAlwaysOnTop = new BCheckBox(TR("Always on top"), fWindowAlwaysOnTop = new BCheckBox(B_TRANSLATE("Always on top"),
new BMessage(kAlwaysTop)); new BMessage(kAlwaysTop));
fWindowAutoRaise = new BCheckBox(TR("Auto-raise"), new BMessage(kAutoRaise)); fWindowAutoRaise = new BCheckBox(B_TRANSLATE("Auto-raise"),
new BMessage(kAutoRaise));
BTextView* docTextView = fMenuRecentDocumentCount->TextView(); BTextView* docTextView = fMenuRecentDocumentCount->TextView();
BTextView* appTextView = fMenuRecentApplicationCount->TextView(); BTextView* appTextView = fMenuRecentApplicationCount->TextView();
@@ -98,10 +103,10 @@ PreferencesWindow::PreferencesWindow(BRect frame)
fMenuRecentDocuments->SetValue(appSettings->recentDocsEnabled); fMenuRecentDocuments->SetValue(appSettings->recentDocsEnabled);
fMenuRecentDocumentCount->SetEnabled(appSettings->recentDocsEnabled); fMenuRecentDocumentCount->SetEnabled(appSettings->recentDocsEnabled);
fMenuRecentApplications->SetValue(appSettings->recentAppsEnabled); fMenuRecentApplications->SetValue(appSettings->recentAppsEnabled);
fMenuRecentApplicationCount->SetEnabled(appSettings->recentAppsEnabled); fMenuRecentApplicationCount->SetEnabled(appSettings->recentAppsEnabled);
fMenuRecentFolders->SetValue(appSettings->recentFoldersEnabled); fMenuRecentFolders->SetValue(appSettings->recentFoldersEnabled);
fMenuRecentFolderCount->SetEnabled(appSettings->recentFoldersEnabled); fMenuRecentFolderCount->SetEnabled(appSettings->recentFoldersEnabled);
@@ -154,10 +159,10 @@ PreferencesWindow::PreferencesWindow(BRect frame)
fClockBox = new BBox("fClockBox"); fClockBox = new BBox("fClockBox");
fWindowBox = new BBox("fWindowBox"); fWindowBox = new BBox("fWindowBox");
fMenuBox->SetLabel(TR("Menu")); fMenuBox->SetLabel(B_TRANSLATE("Menu"));
fAppsBox->SetLabel(TR("Applications")); fAppsBox->SetLabel(B_TRANSLATE("Applications"));
fClockBox->SetLabel(TR("Clock")); fClockBox->SetLabel(B_TRANSLATE("Clock"));
fWindowBox->SetLabel(TR("Window")); fWindowBox->SetLabel(B_TRANSLATE("Window"));
BView* view; BView* view;
view = BLayoutBuilder::Group<>() view = BLayoutBuilder::Group<>()
@@ -174,7 +179,7 @@ PreferencesWindow::PreferencesWindow(BRect frame)
.Add(fMenuRecentApplicationCount) .Add(fMenuRecentApplicationCount)
.End() .End()
.End() .End()
.Add(new BButton(TR("Edit menu" B_UTF8_ELLIPSIS), .Add(new BButton(B_TRANSLATE("Edit menu" B_UTF8_ELLIPSIS),
new BMessage(kEditMenuInTracker))) new BMessage(kEditMenuInTracker)))
.SetInsets(10, 10, 10, 10) .SetInsets(10, 10, 10, 10)
.End() .End()
+57 -56
View File
@@ -133,8 +133,8 @@ TReplicantTray::TReplicantTray(TBarView* parent, bool vertical)
fShelf(new TReplicantShelf(this)), fShelf(new TReplicantShelf(this)),
fMultiRowMode(vertical), fMultiRowMode(vertical),
fMinimumTrayWidth(kMinimumTrayWidth), fMinimumTrayWidth(kMinimumTrayWidth),
fAlignmentSupport(false) fAlignmentSupport(false)
{ {
// init the minimum window width according to the logo. // init the minimum window width according to the logo.
const BBitmap* logoBitmap = AppResSet()->FindBitmap(B_MESSAGE_TYPE, const BBitmap* logoBitmap = AppResSet()->FindBitmap(B_MESSAGE_TYPE,
R_BeLogoIcon); R_BeLogoIcon);
@@ -290,14 +290,14 @@ void
TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight) TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
{ {
float width = 0, height = kMinimumTrayHeight; float width = 0, height = kMinimumTrayHeight;
if (fMultiRowMode) { if (fMultiRowMode) {
if (fShelf->CountReplicants() > 0) if (fShelf->CountReplicants() > 0)
height = fRightBottomReplicant.bottom; height = fRightBottomReplicant.bottom;
// the height will be uniform for the number of rows // the height will be uniform for the number of rows
// necessary to show all the reps + any gutters // necessary to show all the reps + any gutters
// necessary for spacing // necessary for spacing
int32 rowCount = (int32)(height / kMaxReplicantHeight); int32 rowCount = (int32)(height / kMaxReplicantHeight);
height = kGutter + (rowCount * kMaxReplicantHeight) height = kGutter + (rowCount * kMaxReplicantHeight)
+ ((rowCount - 1) * kIconGap) + kGutter; + ((rowCount - 1) * kIconGap) + kGutter;
@@ -311,7 +311,7 @@ TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
&& fRightBottomReplicant.right + 6 >= fClock->Frame().left) { && fRightBottomReplicant.right + 6 >= fClock->Frame().left) {
width = fRightBottomReplicant.right + 6 width = fRightBottomReplicant.right + 6
+ fClock->Frame().Width(); + fClock->Frame().Width();
} else } else
width = fRightBottomReplicant.right + 3; width = fRightBottomReplicant.right + 3;
} }
// this view has a fixed minimum width // this view has a fixed minimum width
@@ -333,7 +333,7 @@ TReplicantTray::AdjustPlacement()
BRect bounds = Bounds(); BRect bounds = Bounds();
float width, height; float width, height;
GetPreferredSize(&width, &height); GetPreferredSize(&width, &height);
if (width == bounds.Width() && height == bounds.Height()) { if (width == bounds.Width() && height == bounds.Height()) {
// no need to change anything // no need to change anything
return; return;
@@ -353,13 +353,13 @@ return;
rgb_color menuColor = ViewColor(); rgb_color menuColor = ViewColor();
rgb_color vdark = tint_color(menuColor, B_DARKEN_3_TINT); rgb_color vdark = tint_color(menuColor, B_DARKEN_3_TINT);
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT); rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
BRect frame(Bounds()); BRect frame(Bounds());
SetHighColor(light); SetHighColor(light);
StrokeLine(frame.LeftBottom(), frame.RightBottom()); StrokeLine(frame.LeftBottom(), frame.RightBottom());
StrokeLine(frame.RightBottom(), frame.RightTop()); StrokeLine(frame.RightBottom(), frame.RightTop());
SetHighColor(vdark); SetHighColor(vdark);
StrokeLine(frame.RightTop(), frame.LeftTop()); StrokeLine(frame.RightTop(), frame.LeftTop());
StrokeLine(frame.LeftTop(), frame.LeftBottom()); StrokeLine(frame.LeftTop(), frame.LeftBottom());
@@ -418,11 +418,12 @@ TReplicantTray::ShowReplicantMenu(BPoint point)
if (fBarView->ShowingClock()) if (fBarView->ShowingClock())
fClock->ShowClockOptions(ConvertToScreen(point)); fClock->ShowClockOptions(ConvertToScreen(point));
else { else {
BMenuItem* item = new BMenuItem(TR("Show Time"), new BMessage('time')); BMenuItem* item = new BMenuItem(B_TRANSLATE("Show Time"),
new BMessage('time'));
menu->AddItem(item); menu->AddItem(item);
menu->SetTargetForItems(this); menu->SetTargetForItems(this);
BPoint where = ConvertToScreen(point); BPoint where = ConvertToScreen(point);
menu->Go(where, true, true, BRect(where - BPoint(4, 4), menu->Go(where, true, true, BRect(where - BPoint(4, 4),
where + BPoint(4, 4)), true); where + BPoint(4, 4)), true);
} }
} }
@@ -432,7 +433,7 @@ void
TReplicantTray::MouseDown(BPoint where) TReplicantTray::MouseDown(BPoint where)
{ {
#ifdef DB_ADDONS #ifdef DB_ADDONS
if (modifiers() & B_CONTROL_KEY) if (modifiers() & B_CONTROL_KEY)
DumpList(fItemList); DumpList(fItemList);
#endif #endif
@@ -466,7 +467,7 @@ TReplicantTray::MouseDown(BPoint where)
BView::MouseDown(where); BView::MouseDown(where);
} }
#ifdef DB_ADDONS #ifdef DB_ADDONS
void void
TReplicantTray::InitAddOnSupport() TReplicantTray::InitAddOnSupport()
@@ -526,7 +527,7 @@ TReplicantTray::DeleteAddOnSupport()
if (item) { if (item) {
if (item->isAddOn) if (item->isAddOn)
watch_node(&(item->nodeRef), B_STOP_WATCHING, this, Window()); watch_node(&(item->nodeRef), B_STOP_WATCHING, this, Window());
delete item; delete item;
} }
} }
@@ -646,7 +647,7 @@ TReplicantTray::HandleEntryUpdate(BMessage* message)
// that we expect // that we expect
if (IsAddOn(ref)) { if (IsAddOn(ref)) {
int32 id; int32 id;
BEntry entry(&ref); BEntry entry(&ref);
LoadAddOn(&entry, &id); LoadAddOn(&entry, &id);
} }
} }
@@ -750,10 +751,10 @@ TReplicantTray::HandleEntryUpdate(BMessage* message)
if (message->FindInt32("device", &device) != B_OK) if (message->FindInt32("device", &device) != B_OK)
break; break;
UnloadAddOn(NULL, &device, false, true); UnloadAddOn(NULL, &device, false, true);
break; break;
} }
} }
} }
@@ -800,7 +801,7 @@ TReplicantTray::LoadAddOn(BEntry* entry, int32* id, bool force)
if (image < B_OK) if (image < B_OK)
return image; return image;
// get the view loading function symbol // get the view loading function symbol
// we first look for a symbol that takes an image_id // we first look for a symbol that takes an image_id
// and entry_ref pointer, if not found, go with normal // and entry_ref pointer, if not found, go with normal
// instantiate function // instantiate function
@@ -864,7 +865,7 @@ TReplicantTray::AddItem(int32 id, node_ref nodeRef, BEntry& entry, bool isAddOn)
if (isAddOn) if (isAddOn)
watch_node(&nodeRef, B_WATCH_NAME | B_WATCH_ATTR, this, Window()); watch_node(&nodeRef, B_WATCH_NAME | B_WATCH_ATTR, this, Window());
return B_OK; return B_OK;
} }
@@ -883,7 +884,7 @@ TReplicantTray::UnloadAddOn(node_ref* nodeRef, dev_t* device,
if ((which && nodeRef && item->nodeRef == *nodeRef) if ((which && nodeRef && item->nodeRef == *nodeRef)
|| (device && item->nodeRef.device == *device)) { || (device && item->nodeRef.device == *device)) {
if (device && be_roster->IsRunning(&item->entryRef)) if (device && be_roster->IsRunning(&item->entryRef))
continue; continue;
@@ -911,14 +912,14 @@ TReplicantTray::RemoveItem(int32 id)
} }
fItemList->RemoveItem(item); fItemList->RemoveItem(item);
delete item; delete item;
} }
/** ENTRY_MOVED message, moving only occurs on a device /** ENTRY_MOVED message, moving only occurs on a device
* copying will occur (ENTRY_CREATED) between devices * copying will occur (ENTRY_CREATED) between devices
*/ */
void void
TReplicantTray::MoveItem(entry_ref* ref, ino_t toDirectory) TReplicantTray::MoveItem(entry_ref* ref, ino_t toDirectory)
{ {
@@ -984,12 +985,12 @@ TReplicantTray::ItemInfo(const char* name, int32* id)
{ {
if (!name || strlen(name) <= 0) if (!name || strlen(name) <= 0)
return B_ERROR; return B_ERROR;
int32 index; int32 index;
BView* view = ViewAt(&index, id, name); BView* view = ViewAt(&index, id, name);
if (view) if (view)
return B_OK; return B_OK;
return B_ERROR; return B_ERROR;
} }
@@ -1003,14 +1004,14 @@ TReplicantTray::ItemInfo(int32 index, const char** name, int32* id)
{ {
if (index < 0) if (index < 0)
return B_ERROR; return B_ERROR;
BView* view; BView* view;
fShelf->ReplicantAt(index, &view, (uint32*)id, NULL); fShelf->ReplicantAt(index, &view, (uint32*)id, NULL);
if (view) { if (view) {
*name = view->Name(); *name = view->Name();
return B_OK; return B_OK;
} }
return B_ERROR; return B_ERROR;
} }
@@ -1022,7 +1023,7 @@ TReplicantTray::IconExists(int32 target, bool byIndex)
{ {
int32 index, id; int32 index, id;
BView* view = ViewAt(&index, &id, target, byIndex); BView* view = ViewAt(&index, &id, target, byIndex);
return view && index >= 0; return view && index >= 0;
} }
@@ -1034,10 +1035,10 @@ TReplicantTray::IconExists(const char* name)
{ {
if (!name || strlen(name) == 0) if (!name || strlen(name) == 0)
return false; return false;
int32 index, id; int32 index, id;
BView* view = ViewAt(&index, &id, name); BView* view = ViewAt(&index, &id, name);
return view && index >= 0; return view && index >= 0;
} }
@@ -1115,7 +1116,7 @@ TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
if (originalBounds != view->Bounds()) { if (originalBounds != view->Bounds()) {
// The replicant changed its size when added to the window, so we need // The replicant changed its size when added to the window, so we need
// to recompute all over again (it's already done once via // to recompute all over again (it's already done once via
// BShelf::AddReplicant() and TReplicantShelf::CanAcceptReplicantView()) // BShelf::AddReplicant() and TReplicantShelf::CanAcceptReplicantView())
RealignReplicants(); RealignReplicants();
} }
@@ -1139,7 +1140,7 @@ TReplicantTray::RemoveIcon(int32 target, bool byIndex)
{ {
if (target < 0) if (target < 0)
return; return;
int32 index, id; int32 index, id;
BView* view = ViewAt(&index, &id, target, byIndex); BView* view = ViewAt(&index, &id, target, byIndex);
if (view && index >= 0) { if (view && index >= 0) {
@@ -1158,7 +1159,7 @@ TReplicantTray::RemoveIcon(const char* name)
{ {
if (!name || strlen(name) <= 0) if (!name || strlen(name) <= 0)
return; return;
int32 id, index; int32 id, index;
BView* view = ViewAt(&index, &id, name); BView* view = ViewAt(&index, &id, name);
if (view && index >= 0) { if (view && index >= 0) {
@@ -1204,7 +1205,7 @@ BView*
TReplicantTray::ViewAt(int32* index, int32* id, int32 target, bool byIndex) TReplicantTray::ViewAt(int32* index, int32* id, int32 target, bool byIndex)
{ {
*index = -1; *index = -1;
BView* view; BView* view;
if (byIndex) { if (byIndex) {
if (fShelf->ReplicantAt(target, &view, (uint32*)id)) { if (fShelf->ReplicantAt(target, &view, (uint32*)id)) {
@@ -1225,7 +1226,7 @@ TReplicantTray::ViewAt(int32* index, int32* id, int32 target, bool byIndex)
} }
} }
} }
return NULL; return NULL;
} }
@@ -1239,7 +1240,7 @@ TReplicantTray::ViewAt(int32* index, int32* id, const char* name)
{ {
*index = -1; *index = -1;
*id = -1; *id = -1;
BView* view; BView* view;
int32 count = fShelf->CountReplicants()-1; int32 count = fShelf->CountReplicants()-1;
for (int32 repIndex = count ; repIndex >= 0 ; repIndex--) { for (int32 repIndex = count ; repIndex >= 0 ; repIndex--) {
@@ -1249,7 +1250,7 @@ TReplicantTray::ViewAt(int32* index, int32* id, const char* name)
return view; return view;
} }
} }
return NULL; return NULL;
} }
@@ -1449,9 +1450,9 @@ TDragRegion::GetPreferredSize(float* width, float* height)
{ {
fChild->ResizeToPreferred(); fChild->ResizeToPreferred();
*width = fChild->Bounds().Width(); *width = fChild->Bounds().Width();
*height = fChild->Bounds().Height(); *height = fChild->Bounds().Height();
if (fDragLocation != kNoDragRegion) if (fDragLocation != kNoDragRegion)
*width += 7; *width += 7;
else else
*width += 6; *width += 6;
@@ -1471,7 +1472,7 @@ TDragRegion::FrameMoved(BPoint)
} }
void void
TDragRegion::Draw(BRect) TDragRegion::Draw(BRect)
{ {
rgb_color menuColor = ViewColor(); rgb_color menuColor = ViewColor();
@@ -1481,7 +1482,7 @@ TDragRegion::Draw(BRect)
rgb_color vdark = tint_color(menuColor, B_DARKEN_3_TINT); rgb_color vdark = tint_color(menuColor, B_DARKEN_3_TINT);
rgb_color vvdark = tint_color(menuColor, B_DARKEN_4_TINT); rgb_color vvdark = tint_color(menuColor, B_DARKEN_4_TINT);
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT); rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
BRect frame(Bounds()); BRect frame(Bounds());
BeginLineArray(4); BeginLineArray(4);
@@ -1516,7 +1517,7 @@ TDragRegion::Draw(BRect)
BPoint(frame.right - 1, frame.bottom), hilite); BPoint(frame.right - 1, frame.bottom), hilite);
} else if (fBarView->AcrossBottom()) { } else if (fBarView->AcrossBottom()) {
AddLine(BPoint(frame.left, frame.top + 1), AddLine(BPoint(frame.left, frame.top + 1),
BPoint(frame.right - 1, frame.top + 1), light); BPoint(frame.right - 1, frame.top + 1), light);
AddLine(frame.LeftBottom(), frame.RightBottom(), hilite); AddLine(frame.LeftBottom(), frame.RightBottom(), hilite);
AddLine(frame.RightTop(), frame.RightBottom(), vvdark); AddLine(frame.RightTop(), frame.RightBottom(), vvdark);
AddLine(BPoint(frame.right - 1, frame.top + 1), AddLine(BPoint(frame.right - 1, frame.top + 1),
@@ -1525,7 +1526,7 @@ TDragRegion::Draw(BRect)
} }
EndLineArray(); EndLineArray();
if (fDragLocation != kDontDrawDragRegion || fDragLocation != kNoDragRegion) if (fDragLocation != kDontDrawDragRegion || fDragLocation != kNoDragRegion)
DrawDragRegion(); DrawDragRegion();
} }
@@ -1533,7 +1534,7 @@ TDragRegion::Draw(BRect)
void void
TDragRegion::DrawDragRegion() TDragRegion::DrawDragRegion()
{ {
BRect dragRegion(DragRegion()); BRect dragRegion(DragRegion());
rgb_color menuColor = ViewColor(); rgb_color menuColor = ViewColor();
@@ -1551,11 +1552,11 @@ TDragRegion::DrawDragRegion()
BPoint pt; BPoint pt;
pt.x = floorf((dragRegion.left + dragRegion.right) / 2 + 0.5) - 1; pt.x = floorf((dragRegion.left + dragRegion.right) / 2 + 0.5) - 1;
pt.y = dragRegion.top + 2; pt.y = dragRegion.top + 2;
while (pt.y + 1 <= dragRegion.bottom) { while (pt.y + 1 <= dragRegion.bottom) {
AddLine(pt, pt, vdark); AddLine(pt, pt, vdark);
AddLine(pt + BPoint(1, 1), pt + BPoint(1, 1), light); AddLine(pt + BPoint(1, 1), pt + BPoint(1, 1), light);
pt.y += 3; pt.y += 3;
} }
EndLineArray(); EndLineArray();
@@ -1588,7 +1589,7 @@ TDragRegion::DragRegion() const
placeOnLeft = true; placeOnLeft = true;
else if (fDragLocation == kDragRegionRight) else if (fDragLocation == kDragRegionRight)
placeOnLeft = false; placeOnLeft = false;
if (placeOnLeft) { if (placeOnLeft) {
dragRegion.left += kLeftRightInset; dragRegion.left += kLeftRightInset;
dragRegion.right = dragRegion.left + kDragWidth; dragRegion.right = dragRegion.left + kDragWidth;
@@ -1596,12 +1597,12 @@ TDragRegion::DragRegion() const
dragRegion.right -= kLeftRightInset; dragRegion.right -= kLeftRightInset;
dragRegion.left = dragRegion.right - kDragWidth; dragRegion.left = dragRegion.right - kDragWidth;
} }
return dragRegion; return dragRegion;
} }
void void
TDragRegion::MouseDown(BPoint thePoint) TDragRegion::MouseDown(BPoint thePoint)
{ {
ulong buttons; ulong buttons;
@@ -1633,7 +1634,7 @@ TDragRegion::MouseDown(BPoint thePoint)
} }
void void
TDragRegion::MouseUp(BPoint pt) TDragRegion::MouseUp(BPoint pt)
{ {
if (IsTracking()) { if (IsTracking()) {
@@ -1644,8 +1645,8 @@ TDragRegion::MouseUp(BPoint pt)
} }
bool bool
TDragRegion::SwitchModeForRect(BPoint mouse, BRect rect, TDragRegion::SwitchModeForRect(BPoint mouse, BRect rect,
bool newVertical, bool newLeft, bool newTop, int32 newState) bool newVertical, bool newLeft, bool newTop, int32 newState)
{ {
if (!rect.Contains(mouse)) if (!rect.Contains(mouse))
@@ -1664,7 +1665,7 @@ TDragRegion::SwitchModeForRect(BPoint mouse, BRect rect,
} }
void void
TDragRegion::MouseMoved(BPoint where, uint32 code, const BMessage* message) TDragRegion::MouseMoved(BPoint where, uint32 code, const BMessage* message)
{ {
if (IsTracking()) { if (IsTracking()) {
@@ -1678,7 +1679,7 @@ TDragRegion::MouseMoved(BPoint where, uint32 code, const BMessage* message)
float vDivider = frame.Height() / 2; float vDivider = frame.Height() / 2;
#ifdef FULL_MODE #ifdef FULL_MODE
float thirdScreen = frame.Height() / 3; float thirdScreen = frame.Height() / 3;
#endif #endif
BRect topLeft(frame.left, frame.top, frame.left + hDivider, BRect topLeft(frame.left, frame.top, frame.left + hDivider,
miniDivider); miniDivider);
BRect topMiddle(frame.left + hDivider, frame.top, frame.right BRect topMiddle(frame.left + hDivider, frame.top, frame.right
@@ -1701,7 +1702,7 @@ TDragRegion::MouseMoved(BPoint where, uint32 code, const BMessage* message)
frame.bottom - thirdScreen); frame.bottom - thirdScreen);
vDivider = frame.bottom - thirdScreen; vDivider = frame.bottom - thirdScreen;
#endif #endif
BRect bottomLeft(frame.left, vDivider, frame.left + hDivider, BRect bottomLeft(frame.left, vDivider, frame.left + hDivider,
frame.bottom); frame.bottom);
BRect bottomMiddle(frame.left + hDivider, vDivider, frame.right BRect bottomMiddle(frame.left + hDivider, vDivider, frame.right
@@ -1746,7 +1747,7 @@ TDragRegion::MouseMoved(BPoint where, uint32 code, const BMessage* message)
int32 int32
TDragRegion::DragRegionLocation() const TDragRegion::DragRegionLocation() const
{ {
return fDragLocation; return fDragLocation;
} }
@@ -1755,7 +1756,7 @@ TDragRegion::SetDragRegionLocation(int32 location)
{ {
if (location == fDragLocation) if (location == fDragLocation)
return; return;
fDragLocation = location; fDragLocation = location;
Invalidate(); Invalidate();
} }
+3 -3
View File
@@ -563,14 +563,14 @@ TTimeView::ShowClockOptions(BPoint point)
menu->SetFont(be_plain_font); menu->SetFont(be_plain_font);
BMenuItem* item; BMenuItem* item;
item = new BMenuItem(TR("Change time" B_UTF8_ELLIPSIS), item = new BMenuItem(B_TRANSLATE("Change time" B_UTF8_ELLIPSIS),
new BMessage(kChangeClock)); new BMessage(kChangeClock));
menu->AddItem(item); menu->AddItem(item);
item = new BMenuItem(TR("Hide time"), new BMessage('time')); item = new BMenuItem(B_TRANSLATE("Hide time"), new BMessage('time'));
menu->AddItem(item); menu->AddItem(item);
item = new BMenuItem(TR("Show calendar" B_UTF8_ELLIPSIS), item = new BMenuItem(B_TRANSLATE("Show calendar" B_UTF8_ELLIPSIS),
new BMessage(kShowCalendar)); new BMessage(kShowCalendar));
menu->AddItem(item); menu->AddItem(item);
+9 -6
View File
@@ -178,7 +178,7 @@ TWindowMenu::AttachedToWindow()
int32 itemCount = CountItems() + parentMenuItems; int32 itemCount = CountItems() + parentMenuItems;
if (itemCount < 1) { if (itemCount < 1) {
TWindowMenuItem* noWindowsItem = TWindowMenuItem* noWindowsItem =
new TWindowMenuItem(TR("No windows"), -1, false, false); new TWindowMenuItem(B_TRANSLATE("No windows"), -1, false, false);
noWindowsItem->SetEnabled(false); noWindowsItem->SetEnabled(false);
@@ -188,19 +188,22 @@ TWindowMenu::AttachedToWindow()
// it. (but we only add this option if the application is not Tracker.) // it. (but we only add this option if the application is not Tracker.)
if (fApplicationSignature.ICompare(kTrackerSignature) != 0) { if (fApplicationSignature.ICompare(kTrackerSignature) != 0) {
AddSeparatorItem(); AddSeparatorItem();
AddItem(new TShowHideMenuItem(TR("Quit application"), fTeam, AddItem(new TShowHideMenuItem(B_TRANSLATE("Quit application"),
B_QUIT_REQUESTED)); fTeam, B_QUIT_REQUESTED));
} }
} else { } else {
// if we are in drag mode, then don't add the window controls // if we are in drag mode, then don't add the window controls
// to the menu // to the menu
if (!dragging) { if (!dragging) {
TShowHideMenuItem* hide = TShowHideMenuItem* hide =
new TShowHideMenuItem(TR("Hide all"), fTeam, B_MINIMIZE_WINDOW); new TShowHideMenuItem(B_TRANSLATE("Hide all"), fTeam,
B_MINIMIZE_WINDOW);
TShowHideMenuItem* show = TShowHideMenuItem* show =
new TShowHideMenuItem(TR("Show all"), fTeam, B_BRING_TO_FRONT); new TShowHideMenuItem(B_TRANSLATE("Show all"), fTeam,
B_BRING_TO_FRONT);
TShowHideMenuItem* close = TShowHideMenuItem* close =
new TShowHideMenuItem(TR("Close all"), fTeam, B_QUIT_REQUESTED); new TShowHideMenuItem(B_TRANSLATE("Close all"), fTeam,
B_QUIT_REQUESTED);
if (miniCount == itemCount) if (miniCount == itemCount)
hide->SetEnabled(false); hide->SetEnabled(false);