Patch by mt (ticket #5573) : localize deskbar. Thanks !

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36117 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2010-04-10 17:52:05 +00:00
parent e085a65aee
commit ae7a6e3a6f
8 changed files with 121 additions and 65 deletions
+3
View File
@@ -39,10 +39,12 @@ All rights reserved.
#include <AppFileInfo.h> #include <AppFileInfo.h>
#include <Autolock.h> #include <Autolock.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Catalog.h>
#include <Directory.h> #include <Directory.h>
#include <Dragger.h> #include <Dragger.h>
#include <File.h> #include <File.h>
#include <FindDirectory.h> #include <FindDirectory.h>
#include <Locale.h>
#include <Mime.h> #include <Mime.h>
#include <Path.h> #include <Path.h>
#include <Roster.h> #include <Roster.h>
@@ -93,6 +95,7 @@ TBarApp::TBarApp()
InitSettings(); InitSettings();
InitIconPreloader(); InitIconPreloader();
be_locale->GetAppCatalog(&fCatalog);
be_roster->StartWatching(this); be_roster->StartWatching(this);
sBarTeamInfoList.MakeEmpty(); sBarTeamInfoList.MakeEmpty();
+3
View File
@@ -36,6 +36,7 @@ All rights reserved.
#include <Application.h> #include <Application.h>
#include <Catalog.h>
#include <List.h> #include <List.h>
#include "BarWindow.h" #include "BarWindow.h"
#include "PreferencesWindow.h" #include "PreferencesWindow.h"
@@ -178,6 +179,8 @@ class TBarApp : public BApplication {
static BLocker sSubscriberLock; static BLocker sSubscriberLock;
static BList sBarTeamInfoList; static BList sBarTeamInfoList;
static BList sSubscribers; static BList sSubscribers;
BCatalog fCatalog;
}; };
#endif // BAR_APP_H #endif // BAR_APP_H
+39 -19
View File
@@ -34,7 +34,9 @@ All rights reserved.
#include <Debug.h> #include <Debug.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Catalog.h>
#include <Dragger.h> #include <Dragger.h>
#include <Locale.h>
#include <Menu.h> #include <Menu.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <Roster.h> #include <Roster.h>
@@ -50,6 +52,9 @@ All rights reserved.
#include "StatusView.h" #include "StatusView.h"
#include "tracker_private.h" #include "tracker_private.h"
#undef TR_CONTEXT
#define TR_CONTEXT "BeMenu"
#define ROSTER_SIG "application/x-vnd.Be-ROST" #define ROSTER_SIG "application/x-vnd.Be-ROST"
#ifdef MOUNT_MENU_IN_DESKBAR #ifdef MOUNT_MENU_IN_DESKBAR
@@ -67,6 +72,8 @@ class DeskbarMountMenu : public BPrivate::MountMenu {
namespace BPrivate { namespace BPrivate {
BMenu* TrackerBuildRecentFindItemsMenu(const char*); BMenu* TrackerBuildRecentFindItemsMenu(const char*);
} }
using namespace BPrivate; using namespace BPrivate;
@@ -134,7 +141,7 @@ void
TBeMenu::DoneBuildingItemList() TBeMenu::DoneBuildingItemList()
{ {
if (fItemList->CountItems() <= 0) { if (fItemList->CountItems() <= 0) {
BMenuItem* item = new BMenuItem("<Be folder is empty>", 0); BMenuItem* item = new BMenuItem(TR("<Be folder is empty>"), 0);
item->SetEnabled(false); item->SetEnabled(false);
AddItem(item); AddItem(item);
} else } else
@@ -150,8 +157,8 @@ TBeMenu::AddNextItem()
TrackingHookData* data = fBarView->GetTrackingHookData(); TrackingHookData* data = fBarView->GetTrackingHookData();
if (fAddState == kAddingRecents) { if (fAddState == kAddingRecents) {
const char* recentTitle[] = {"Recent documents", "Recent folders", static const char* recentTitle[] = {TR_MARK("Recent documents"),
"Recent applications"}; TR_MARK("Recent folders"), TR_MARK("Recent applications")};
const int recentType[] = {kRecentDocuments, kRecentFolders, const int recentType[] = {kRecentDocuments, kRecentFolders,
kRecentApplications}; kRecentApplications};
const int recentTypes = 3; const int recentTypes = 3;
@@ -160,7 +167,7 @@ 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(recentTitle[i], fBarView, recentItem[i] = new TRecentsMenu(TR(recentTitle[i]), fBarView,
recentType[i]); recentType[i]);
if (recentItem[i]) if (recentItem[i])
@@ -226,63 +233,75 @@ TBeMenu::AddStandardBeMenuItems()
BMenuItem* item; BMenuItem* item;
BRoster roster; BRoster roster;
if (!roster.IsRunning(kTrackerSignature)) { if (!roster.IsRunning(kTrackerSignature)) {
item = new BMenuItem("Restart Tracker", new BMessage(kRestartTracker)); item = new BMenuItem(TR("Restart Tracker"), new BMessage(kRestartTracker));
AddItem(item); AddItem(item);
AddSeparatorItem(); AddSeparatorItem();
} }
static const char* kAboutHaikuMenuItemStr = TR_MARK(
"About Haiku" B_UTF8_ELLIPSIS);
static const char* kAboutThisSystemMenuItemStr = TR_MARK(
"About this system" B_UTF8_ELLIPSIS);
item = new BMenuItem( item = new BMenuItem(
#ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL #ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL
"About Haiku" TR(kAboutHaikuMenuItemStr)
#else #else
"About this system" TR(kAboutThisSystemMenuItemStr)
#endif #endif
B_UTF8_ELLIPSIS, 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);
#ifdef SHOW_RECENT_FIND_ITEMS #ifdef SHOW_RECENT_FIND_ITEMS
item = new BMenuItem(TrackerBuildRecentFindItemsMenu("Find"B_UTF8_ELLIPSIS), item = new BMenuItem(
TrackerBuildRecentFindItemsMenu(kFindMenuItemStr),
new BMessage(kFindButton)); new BMessage(kFindButton));
#else #else
item = new BMenuItem("Find"B_UTF8_ELLIPSIS, new BMessage(kFindButton)); item = new BMenuItem(TR(kFindMenuItemStr), new BMessage(kFindButton));
#endif #endif
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
AddItem(item); AddItem(item);
item = new BMenuItem("Show replicants", new BMessage(kToggleDraggers)); item = new BMenuItem(TR("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");
#ifdef MOUNT_MENU_IN_DESKBAR #ifdef MOUNT_MENU_IN_DESKBAR
DeskbarMountMenu* mountMenu = new DeskbarMountMenu("Mount"); DeskbarMountMenu* mountMenu = new DeskbarMountMenu(TR(kMountMenuStr));
mountMenu->SetEnabled(!dragging); mountMenu->SetEnabled(!dragging);
AddItem(mountMenu); AddItem(mountMenu);
#endif #endif
item = new BMenuItem("Deskbar preferences" B_UTF8_ELLIPSIS, item = new BMenuItem(TR("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("Shutdown" B_UTF8_ELLIPSIS); BMenu* shutdownMenu = new BMenu(TR("Shutdown" B_UTF8_ELLIPSIS));
item = new BMenuItem("Restart system", new BMessage(kRebootSystem)); item = new BMenuItem(TR("Restart system"), new BMessage(kRebootSystem));
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
shutdownMenu->AddItem(item); shutdownMenu->AddItem(item);
static const char* kSuspendMenuItemStr = TR_MARK("Suspend");
#ifdef APM_SUPPORT #ifdef APM_SUPPORT
if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) { if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) {
item = new BMenuItem("Suspend", new BMessage(kSuspendSystem)); item = new BMenuItem(kSuspendMenuItemStr), new BMessage(kSuspendSystem));
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
shutdownMenu->AddItem(item); shutdownMenu->AddItem(item);
} }
#endif #endif
item = new BMenuItem("Power off", new BMessage(kShutdownSystem)); item = new BMenuItem(TR("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);
@@ -367,10 +386,10 @@ TBeMenu::ScreenLocation()
if (expando && vertical && fBarView->Left()) { if (expando && vertical && fBarView->Left()) {
PRINT(("Left\n")); PRINT(("Left\n"));
point = rect.RightTop() + BPoint(0,3); point = rect.RightTop() + BPoint(0, 3);
} else if (expando && vertical && !fBarView->Left()) { } else if (expando && vertical && !fBarView->Left()) {
PRINT(("Right\n")); PRINT(("Right\n"));
point = rect.LeftTop() - BPoint(Bounds().Width(), 0) + BPoint(0,3); point = rect.LeftTop() - BPoint(Bounds().Width(), 0) + BPoint(0, 3);
} else } else
point = BMenu::ScreenLocation(); point = BMenu::ScreenLocation();
@@ -633,5 +652,6 @@ DeskbarMountMenu::AddDynamicItem(add_state s)
return false; return false;
} }
#endif #endif
+10 -1
View File
@@ -39,6 +39,15 @@ Application Deskbar :
ResourceSet.cpp ResourceSet.cpp
Switcher.cpp Switcher.cpp
$(targetSource) $(targetSource)
: be tracker $(targetLib) $(TARGET_LIBSUPC++) : be tracker liblocale.so $(targetLib) $(TARGET_LIBSUPC++)
; ;
DoCatalogs Deskbar :
application/x-vnd.Be-TSKB
:
BeMenu.cpp
PreferencesWindow.cpp
StatusView.cpp
TimeView.cpp
WindowMenu.cpp
;
+24 -19
View File
@@ -9,8 +9,10 @@
#include "PreferencesWindow.h" #include "PreferencesWindow.h"
#include <Catalog.h>
#include <CheckBox.h> #include <CheckBox.h>
#include <GroupLayout.h> #include <GroupLayout.h>
#include <Locale.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <OpenWithTracker.h> #include <OpenWithTracker.h>
#include <RadioButton.h> #include <RadioButton.h>
@@ -22,17 +24,20 @@
#include "StatusView.h" #include "StatusView.h"
#undef TR_CONTEXT
#define TR_CONTEXT "PreferencesWindow"
PreferencesWindow::PreferencesWindow(BRect frame) PreferencesWindow::PreferencesWindow(BRect frame)
: :
BWindow(frame, "Deskbar preferences", B_TITLED_WINDOW, BWindow(frame, TR("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("Recent documents:", fMenuRecentDocuments = new BCheckBox(TR("Recent documents:"),
new BMessage(kUpdateRecentCounts)); new BMessage(kUpdateRecentCounts));
fMenuRecentApplications = new BCheckBox("Recent applications:", fMenuRecentApplications = new BCheckBox(TR("Recent applications:"),
new BMessage(kUpdateRecentCounts)); new BMessage(kUpdateRecentCounts));
fMenuRecentFolders = new BCheckBox("Recent folders:", fMenuRecentFolders = new BCheckBox(TR("Recent folders:"),
new BMessage(kUpdateRecentCounts)); new BMessage(kUpdateRecentCounts));
fMenuRecentDocumentCount = new BTextControl(NULL, NULL, fMenuRecentDocumentCount = new BTextControl(NULL, NULL,
@@ -42,25 +47,25 @@ PreferencesWindow::PreferencesWindow(BRect frame)
fMenuRecentFolderCount = new BTextControl(NULL, NULL, fMenuRecentFolderCount = new BTextControl(NULL, NULL,
new BMessage(kUpdateRecentCounts)); new BMessage(kUpdateRecentCounts));
fAppsSort = new BCheckBox("Sort running applications", fAppsSort = new BCheckBox(TR("Sort running applications"),
new BMessage(kSortRunningApps)); new BMessage(kSortRunningApps));
fAppsSortTrackerFirst = new BCheckBox("Tracker always first", fAppsSortTrackerFirst = new BCheckBox(TR("Tracker always first"),
new BMessage(kTrackerFirst)); new BMessage(kTrackerFirst));
fAppsShowExpanders = new BCheckBox("Show application expander", fAppsShowExpanders = new BCheckBox(TR("Show application expander"),
new BMessage(kSuperExpando)); new BMessage(kSuperExpando));
fAppsExpandNew = new BCheckBox("Expand new applications", fAppsExpandNew = new BCheckBox(TR("Expand new applications"),
new BMessage(kExpandNewTeams)); new BMessage(kExpandNewTeams));
fClock24Hours = new BCheckBox("24 hour clock", new BMessage(kMilTime)); fClock24Hours = new BCheckBox(TR("24 hour clock"), new BMessage(kMilTime));
fClockSeconds = new BCheckBox("Show seconds", fClockSeconds = new BCheckBox(TR("Show seconds"),
new BMessage(kShowSeconds)); new BMessage(kShowSeconds));
fClockEuropeanDate = new BCheckBox("European date", fClockEuropeanDate = new BCheckBox(TR("European date"),
new BMessage(kEuroDate)); new BMessage(kEuroDate));
fClockFullDate = new BCheckBox("Full date", new BMessage(kFullDate)); fClockFullDate = new BCheckBox(TR("Full date"), new BMessage(kFullDate));
fWindowAlwaysOnTop = new BCheckBox("Always on top", fWindowAlwaysOnTop = new BCheckBox(TR("Always on top"),
new BMessage(kAlwaysTop)); new BMessage(kAlwaysTop));
fWindowAutoRaise = new BCheckBox("Auto-raise", new BMessage(kAutoRaise)); fWindowAutoRaise = new BCheckBox(TR("Auto-raise"), new BMessage(kAutoRaise));
BTextView* docTextView = fMenuRecentDocumentCount->TextView(); BTextView* docTextView = fMenuRecentDocumentCount->TextView();
BTextView* appTextView = fMenuRecentApplicationCount->TextView(); BTextView* appTextView = fMenuRecentApplicationCount->TextView();
@@ -149,10 +154,10 @@ PreferencesWindow::PreferencesWindow(BRect frame)
fClockBox = new BBox("fClockBox"); fClockBox = new BBox("fClockBox");
fWindowBox = new BBox("fWindowBox"); fWindowBox = new BBox("fWindowBox");
fMenuBox->SetLabel("Menu"); fMenuBox->SetLabel(TR("Menu"));
fAppsBox->SetLabel("Applications"); fAppsBox->SetLabel(TR("Applications"));
fClockBox->SetLabel("Clock"); fClockBox->SetLabel(TR("Clock"));
fWindowBox->SetLabel("Window"); fWindowBox->SetLabel(TR("Window"));
BView* view; BView* view;
view = BLayoutBuilder::Group<>() view = BLayoutBuilder::Group<>()
@@ -169,7 +174,7 @@ PreferencesWindow::PreferencesWindow(BRect frame)
.Add(fMenuRecentApplicationCount) .Add(fMenuRecentApplicationCount)
.End() .End()
.End() .End()
.Add(new BButton("Edit menu" B_UTF8_ELLIPSIS, .Add(new BButton(TR("Edit menu" B_UTF8_ELLIPSIS),
new BMessage(kEditMenuInTracker))) new BMessage(kEditMenuInTracker)))
.SetInsets(10, 10, 10, 10) .SetInsets(10, 10, 10, 10)
.End() .End()
+17 -11
View File
@@ -47,9 +47,11 @@ All rights reserved.
#include <Application.h> #include <Application.h>
#include <Beep.h> #include <Beep.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Catalog.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <Directory.h> #include <Directory.h>
#include <FindDirectory.h> #include <FindDirectory.h>
#include <Locale.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <NodeInfo.h> #include <NodeInfo.h>
#include <NodeMonitor.h> #include <NodeMonitor.h>
@@ -118,6 +120,9 @@ DumpList(BList* itemlist)
#endif /* DB_ADDONS */ #endif /* DB_ADDONS */
#undef TR_CONTEXT
#define TR_CONTEXT "Tray"
// don't change the name of this view to anything other than "Status"! // don't change the name of this view to anything other than "Status"!
TReplicantTray::TReplicantTray(TBarView* parent, bool vertical) TReplicantTray::TReplicantTray(TBarView* parent, bool vertical)
@@ -163,6 +168,7 @@ TReplicantTray::AttachedToWindow()
Window()->SetPulseRate(1000000); Window()->SetPulseRate(1000000);
DealWithClock(fBarView->ShowingClock()); DealWithClock(fBarView->ShowingClock());
#ifdef DB_ADDONS #ifdef DB_ADDONS
// load addons and rehydrate archives // load addons and rehydrate archives
#if !defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) #if !defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST)
@@ -412,7 +418,7 @@ TReplicantTray::ShowReplicantMenu(BPoint point)
if (fBarView->ShowingClock()) if (fBarView->ShowingClock())
fClock->ShowClockOptions(ConvertToScreen(point)); fClock->ShowClockOptions(ConvertToScreen(point));
else { else {
BMenuItem* item = new BMenuItem("Show Time", new BMessage('time')); BMenuItem* item = new BMenuItem(TR("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);
@@ -562,7 +568,7 @@ TReplicantTray::RunAddOnQuery(BVolume* volume, const char* predicate)
bool bool
TReplicantTray::IsAddOn(entry_ref &ref) TReplicantTray::IsAddOn(entry_ref& ref)
{ {
BFile file(&ref, B_READ_ONLY); BFile file(&ref, B_READ_ONLY);
@@ -574,7 +580,7 @@ TReplicantTray::IsAddOn(entry_ref &ref)
DeskbarItemInfo* DeskbarItemInfo*
TReplicantTray::DeskbarItemFor(node_ref &nodeRef) TReplicantTray::DeskbarItemFor(node_ref& nodeRef)
{ {
for (int32 i = fItemList->CountItems(); i-- > 0 ;) { for (int32 i = fItemList->CountItems(); i-- > 0 ;) {
DeskbarItemInfo* item = (DeskbarItemInfo*)fItemList->ItemAt(i); DeskbarItemInfo* item = (DeskbarItemInfo*)fItemList->ItemAt(i);
@@ -606,7 +612,7 @@ TReplicantTray::DeskbarItemFor(int32 id)
bool bool
TReplicantTray::NodeExists(node_ref &nodeRef) TReplicantTray::NodeExists(node_ref& nodeRef)
{ {
return DeskbarItemFor(nodeRef) != NULL; return DeskbarItemFor(nodeRef) != NULL;
} }
@@ -837,7 +843,7 @@ TReplicantTray::LoadAddOn(BEntry* entry, int32* id, bool force)
status_t status_t
TReplicantTray::AddItem(int32 id, node_ref nodeRef, BEntry &entry, bool isAddOn) TReplicantTray::AddItem(int32 id, node_ref nodeRef, BEntry& entry, bool isAddOn)
{ {
DeskbarItemInfo* item = new DeskbarItemInfo; DeskbarItemInfo* item = new DeskbarItemInfo;
if (item == NULL) if (item == NULL)
@@ -1200,7 +1206,7 @@ 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)) {
if (view) { if (view) {
*index = target; *index = target;
@@ -1386,7 +1392,7 @@ TReplicantTray::RealignReplicants(int32 startIndex)
fRightBottomReplicant.Set(0, 0, 0, 0); fRightBottomReplicant.Set(0, 0, 0, 0);
BView* view = NULL; BView* view = NULL;
for (int32 i = startIndex ; i < count ; i++){ for (int32 i = startIndex ; i < count ; i++) {
fShelf->ReplicantAt(i, &view); fShelf->ReplicantAt(i, &view);
if (view != NULL) { if (view != NULL) {
BPoint loc = LocationForReplicant(i, view->Frame().Width()); BPoint loc = LocationForReplicant(i, view->Frame().Width());
@@ -1459,9 +1465,9 @@ TDragRegion::FrameMoved(BPoint)
{ {
if (fBarView->Left() && fBarView->Vertical() && fDragLocation if (fBarView->Left() && fBarView->Vertical() && fDragLocation
!= kNoDragRegion) != kNoDragRegion)
fChild->MoveTo(5,2); fChild->MoveTo(5, 2);
else else
fChild->MoveTo(2,2); fChild->MoveTo(2, 2);
} }
@@ -1572,7 +1578,7 @@ TDragRegion::DragRegion() const
dragRegion.top += kTopBottomInset; dragRegion.top += kTopBottomInset;
dragRegion.bottom -= kTopBottomInset; dragRegion.bottom -= kTopBottomInset;
bool placeOnLeft=false; bool placeOnLeft = false;
if (fDragLocation == kAutoPlaceDragRegion) { if (fDragLocation == kAutoPlaceDragRegion) {
if (fBarView->Vertical() && fBarView->Left()) if (fBarView->Vertical() && fBarView->Left())
placeOnLeft = true; placeOnLeft = true;
@@ -1608,7 +1614,7 @@ TDragRegion::MouseDown(BPoint thePoint)
if (!dragRegion.Contains(thePoint)) if (!dragRegion.Contains(thePoint))
return; return;
while(true) { while (true) {
GetMouse(&where, &buttons); GetMouse(&where, &buttons);
if (!buttons) if (!buttons)
break; break;
+15 -10
View File
@@ -37,7 +37,9 @@ All rights reserved.
#include <string.h> #include <string.h>
#include <Catalog.h>
#include <Debug.h> #include <Debug.h>
#include <Locale.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <MessageRunner.h> #include <MessageRunner.h>
#include <PopUpMenu.h> #include <PopUpMenu.h>
@@ -66,6 +68,9 @@ enum {
}; };
#undef TR_CONTEXT
#define TR_CONTEXT "TimeView"
TTimeView::TTimeView(float maxWidth, float height, bool showSeconds, TTimeView::TTimeView(float maxWidth, float height, bool showSeconds,
bool milTime, bool fullDate, bool euroDate, bool) bool milTime, bool fullDate, bool euroDate, bool)
: :
@@ -171,12 +176,12 @@ TTimeView::GetPreferredSize(float* width, float* height)
// overlap the bevels in the parent view. // overlap the bevels in the parent view.
if (ShowingDate()) if (ShowingDate())
*width = fOrientation ? *width = fOrientation ?
min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fDateStr)) min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fDateStr))
: kHMargin + StringWidth(fDateStr); : kHMargin + StringWidth(fDateStr);
else { else {
*width = fOrientation ? *width = fOrientation ?
min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fTimeStr)) min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fTimeStr))
: kHMargin + StringWidth(fTimeStr); : kHMargin + StringWidth(fTimeStr);
} }
} }
@@ -295,7 +300,7 @@ TTimeView::StartLongClickNotifier(BPoint where)
// use the doubleClickSpeed as a threshold // use the doubleClickSpeed as a threshold
fLongClickMessageRunner = new BMessageRunner(BMessenger(this), fLongClickMessageRunner = new BMessageRunner(BMessenger(this),
&longClickMessage, longClickThreshold, 1); &longClickMessage, longClickThreshold, 1);
} }
@@ -323,7 +328,7 @@ TTimeView::GetCurrentTime()
} }
// remove leading 0 from time when hour is less than 10 // remove leading 0 from time when hour is less than 10
const char *str = tmp; const char* str = tmp;
if (str[0] == '0') if (str[0] == '0')
str++; str++;
@@ -544,7 +549,7 @@ TTimeView::CalculateTextPlacement()
BRect rectArray[1]; BRect rectArray[1];
escapement_delta delta = { 0.0, 0.0 }; escapement_delta delta = { 0.0, 0.0 };
font.GetBoundingBoxesForStrings(stringArray, 1, B_SCREEN_METRIC, &delta, font.GetBoundingBoxesForStrings(stringArray, 1, B_SCREEN_METRIC, &delta,
rectArray); rectArray);
fTimeLocation.y = fDateLocation.y = ceilf((bounds.Height() - fTimeLocation.y = fDateLocation.y = ceilf((bounds.Height() -
rectArray[0].Height() + 1.0) / 2.0 - rectArray[0].top); rectArray[0].Height() + 1.0) / 2.0 - rectArray[0].top);
@@ -558,14 +563,14 @@ TTimeView::ShowClockOptions(BPoint point)
menu->SetFont(be_plain_font); menu->SetFont(be_plain_font);
BMenuItem* item; BMenuItem* item;
item = new BMenuItem("Change time" B_UTF8_ELLIPSIS, item = new BMenuItem(TR("Change time" B_UTF8_ELLIPSIS),
new BMessage(kChangeClock)); new BMessage(kChangeClock));
menu->AddItem(item); menu->AddItem(item);
item = new BMenuItem("Hide time", new BMessage('time')); item = new BMenuItem(TR("Hide time"), new BMessage('time'));
menu->AddItem(item); menu->AddItem(item);
item = new BMenuItem("Show calendar" B_UTF8_ELLIPSIS, item = new BMenuItem(TR("Show calendar" B_UTF8_ELLIPSIS),
new BMessage(kShowCalendar)); new BMessage(kShowCalendar));
menu->AddItem(item); menu->AddItem(item);
+10 -5
View File
@@ -35,6 +35,8 @@ All rights reserved.
#include <malloc.h> #include <malloc.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <Catalog.h>
#include <Locale.h>
#include <Window.h> #include <Window.h>
#include "BarApp.h" #include "BarApp.h"
@@ -58,6 +60,9 @@ const int32 kListFloater = 5;
const int32 kSystemFloater = 6; const int32 kSystemFloater = 6;
#undef TR_CONTEXT
#define TR_CONTEXT "WindowMenu"
bool bool
TWindowMenu::WindowShouldBeListed(uint32 behavior) TWindowMenu::WindowShouldBeListed(uint32 behavior)
{ {
@@ -173,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("No windows", -1, false, false); new TWindowMenuItem(TR("No windows"), -1, false, false);
noWindowsItem->SetEnabled(false); noWindowsItem->SetEnabled(false);
@@ -183,7 +188,7 @@ 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("Quit application", fTeam, AddItem(new TShowHideMenuItem(TR("Quit application"), fTeam,
B_QUIT_REQUESTED)); B_QUIT_REQUESTED));
} }
} else { } else {
@@ -191,11 +196,11 @@ TWindowMenu::AttachedToWindow()
// to the menu // to the menu
if (!dragging) { if (!dragging) {
TShowHideMenuItem* hide = TShowHideMenuItem* hide =
new TShowHideMenuItem("Hide all", fTeam, B_MINIMIZE_WINDOW); new TShowHideMenuItem(TR("Hide all"), fTeam, B_MINIMIZE_WINDOW);
TShowHideMenuItem* show = TShowHideMenuItem* show =
new TShowHideMenuItem("Show all", fTeam, B_BRING_TO_FRONT); new TShowHideMenuItem(TR("Show all"), fTeam, B_BRING_TO_FRONT);
TShowHideMenuItem* close = TShowHideMenuItem* close =
new TShowHideMenuItem("Close all", fTeam, B_QUIT_REQUESTED); new TShowHideMenuItem(TR("Close all"), fTeam, B_QUIT_REQUESTED);
if (miniCount == itemCount) if (miniCount == itemCount)
hide->SetEnabled(false); hide->SetEnabled(false);