Ticket #5573: Deskbar.patch
File Deskbar.patch, 17.2 KB (added by , 14 years ago) |
---|
-
BarApp.h
36 36 37 37 38 38 #include <Application.h> 39 #include <Catalog.h> 39 40 #include <List.h> 40 41 #include "BarWindow.h" 41 42 #include "PreferencesWindow.h" … … 178 179 static BLocker sSubscriberLock; 179 180 static BList sBarTeamInfoList; 180 181 static BList sSubscribers; 182 183 BCatalog fCatalog; 181 184 }; 182 185 183 186 #endif // BAR_APP_H -
BeMenu.cpp
34 34 35 35 #include <Debug.h> 36 36 #include <Bitmap.h> 37 #include <Catalog.h> 37 38 #include <Dragger.h> 39 #include <Locale.h> 38 40 #include <Menu.h> 39 41 #include <MenuItem.h> 40 42 #include <Roster.h> … … 50 52 #include "StatusView.h" 51 53 #include "tracker_private.h" 52 54 55 #undef TR_CONTEXT 56 #define TR_CONTEXT "BeMenu" 57 53 58 #define ROSTER_SIG "application/x-vnd.Be-ROST" 54 59 55 60 #ifdef MOUNT_MENU_IN_DESKBAR … … 67 72 namespace BPrivate { 68 73 BMenu* TrackerBuildRecentFindItemsMenu(const char*); 69 74 } 75 76 70 77 using namespace BPrivate; 71 78 72 79 … … 134 141 TBeMenu::DoneBuildingItemList() 135 142 { 136 143 if (fItemList->CountItems() <= 0) { 137 BMenuItem* item = new BMenuItem( "<Be folder is empty>", 0);144 BMenuItem* item = new BMenuItem(TR("<Be folder is empty>"), 0); 138 145 item->SetEnabled(false); 139 146 AddItem(item); 140 147 } else … … 150 157 151 158 TrackingHookData* data = fBarView->GetTrackingHookData(); 152 159 if (fAddState == kAddingRecents) { 153 const char* recentTitle[] = { "Recent documents", "Recent folders",154 "Recent applications"};160 const char* recentTitle[] = {TR_MARK("Recent documents"), 161 TR_MARK("Recent folders"), TR_MARK("Recent applications")}; 155 162 const int recentType[] = {kRecentDocuments, kRecentFolders, 156 163 kRecentApplications}; 157 164 const int recentTypes = 3; … … 160 167 bool enabled = false; 161 168 162 169 for (int i = 0; i < recentTypes; i++) { 163 recentItem[i] = new TRecentsMenu( recentTitle[i], fBarView,170 recentItem[i] = new TRecentsMenu(TR(recentTitle[i]), fBarView, 164 171 recentType[i]); 165 172 166 173 if (recentItem[i]) … … 226 233 BMenuItem* item; 227 234 BRoster roster; 228 235 if (!roster.IsRunning(kTrackerSignature)) { 229 item = new BMenuItem( "Restart Tracker", new BMessage(kRestartTracker));236 item = new BMenuItem(TR("Restart Tracker"), new BMessage(kRestartTracker)); 230 237 AddItem(item); 231 238 AddSeparatorItem(); 232 239 } 233 240 234 241 item = new BMenuItem( 235 242 #ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL 236 "About Haiku"243 TR("About Haiku" B_UTF8_ELLIPSIS) 237 244 #else 238 "About this system"245 TR("About this system" B_UTF8_ELLIPSIS) 239 246 #endif 240 B_UTF8_ELLIPSIS, new BMessage(kShowSplash));247 , new BMessage(kShowSplash)); 241 248 item->SetEnabled(!dragging); 242 249 AddItem(item); 243 250 244 251 #ifdef SHOW_RECENT_FIND_ITEMS 245 item = new BMenuItem(TrackerBuildRecentFindItemsMenu("Find"B_UTF8_ELLIPSIS), 252 item = new BMenuItem( 253 TrackerBuildRecentFindItemsMenu(TR("Find"B_UTF8_ELLIPSIS)), 246 254 new BMessage(kFindButton)); 247 255 #else 248 item = new BMenuItem( "Find"B_UTF8_ELLIPSIS, new BMessage(kFindButton));256 item = new BMenuItem(TR("Find"B_UTF8_ELLIPSIS), new BMessage(kFindButton)); 249 257 #endif 250 258 item->SetEnabled(!dragging); 251 259 AddItem(item); 252 260 253 item = new BMenuItem( "Show replicants", new BMessage(kToggleDraggers));261 item = new BMenuItem(TR("Show replicants"), new BMessage(kToggleDraggers)); 254 262 item->SetEnabled(!dragging); 255 263 item->SetMarked(BDragger::AreDraggersDrawn()); 256 264 AddItem(item); 257 265 258 266 #ifdef MOUNT_MENU_IN_DESKBAR 259 DeskbarMountMenu* mountMenu = new DeskbarMountMenu( "Mount");267 DeskbarMountMenu* mountMenu = new DeskbarMountMenu(TR("Mount")); 260 268 mountMenu->SetEnabled(!dragging); 261 269 AddItem(mountMenu); 262 270 #endif 263 271 264 item = new BMenuItem( "Deskbar preferences" B_UTF8_ELLIPSIS,272 item = new BMenuItem(TR("Deskbar preferences" B_UTF8_ELLIPSIS), 265 273 new BMessage(kConfigShow)); 266 274 item->SetTarget(be_app); 267 275 AddItem(item); 268 276 269 277 AddSeparatorItem(); 270 278 271 BMenu* shutdownMenu = new BMenu( "Shutdown" B_UTF8_ELLIPSIS);279 BMenu* shutdownMenu = new BMenu(TR("Shutdown" B_UTF8_ELLIPSIS)); 272 280 273 item = new BMenuItem( "Restart system", new BMessage(kRebootSystem));281 item = new BMenuItem(TR("Restart system"), new BMessage(kRebootSystem)); 274 282 item->SetEnabled(!dragging); 275 283 shutdownMenu->AddItem(item); 276 284 277 285 #ifdef APM_SUPPORT 278 286 if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) { 279 item = new BMenuItem( "Suspend", new BMessage(kSuspendSystem));287 item = new BMenuItem(TR("Suspend"), new BMessage(kSuspendSystem)); 280 288 item->SetEnabled(!dragging); 281 289 shutdownMenu->AddItem(item); 282 290 } 283 291 #endif 284 292 285 item = new BMenuItem( "Power off", new BMessage(kShutdownSystem));293 item = new BMenuItem(TR("Power off"), new BMessage(kShutdownSystem)); 286 294 item->SetEnabled(!dragging); 287 295 shutdownMenu->AddItem(item); 288 296 shutdownMenu->SetFont(be_plain_font); … … 367 375 368 376 if (expando && vertical && fBarView->Left()) { 369 377 PRINT(("Left\n")); 370 point = rect.RightTop() + BPoint(0, 3);378 point = rect.RightTop() + BPoint(0, 3); 371 379 } else if (expando && vertical && !fBarView->Left()) { 372 380 PRINT(("Right\n")); 373 point = rect.LeftTop() - BPoint(Bounds().Width(), 0) + BPoint(0, 3);381 point = rect.LeftTop() - BPoint(Bounds().Width(), 0) + BPoint(0, 3); 374 382 } else 375 383 point = BMenu::ScreenLocation(); 376 384 … … 633 641 return false; 634 642 } 635 643 644 636 645 #endif 637 646 -
StatusView.cpp
47 47 #include <Application.h> 48 48 #include <Beep.h> 49 49 #include <Bitmap.h> 50 #include <Catalog.h> 50 51 #include <ControlLook.h> 51 52 #include <Directory.h> 52 53 #include <FindDirectory.h> 54 #include <Locale.h> 53 55 #include <MenuItem.h> 54 56 #include <NodeInfo.h> 55 57 #include <NodeMonitor.h> … … 118 120 #endif /* DB_ADDONS */ 119 121 120 122 123 #undef TR_CONTEXT 124 #define TR_CONTEXT "Tray" 125 121 126 // don't change the name of this view to anything other than "Status"! 122 127 123 128 TReplicantTray::TReplicantTray(TBarView* parent, bool vertical) … … 163 168 Window()->SetPulseRate(1000000); 164 169 DealWithClock(fBarView->ShowingClock()); 165 170 171 166 172 #ifdef DB_ADDONS 167 173 // load addons and rehydrate archives 168 174 #if !defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST) … … 412 418 if (fBarView->ShowingClock()) 413 419 fClock->ShowClockOptions(ConvertToScreen(point)); 414 420 else { 415 BMenuItem* item = new BMenuItem( "Show Time", new BMessage('time'));421 BMenuItem* item = new BMenuItem(TR("Show Time"), new BMessage('time')); 416 422 menu->AddItem(item); 417 423 menu->SetTargetForItems(this); 418 424 BPoint where = ConvertToScreen(point); … … 562 568 563 569 564 570 bool 565 TReplicantTray::IsAddOn(entry_ref &ref)571 TReplicantTray::IsAddOn(entry_ref& ref) 566 572 { 567 573 BFile file(&ref, B_READ_ONLY); 568 574 … … 574 580 575 581 576 582 DeskbarItemInfo* 577 TReplicantTray::DeskbarItemFor(node_ref &nodeRef)583 TReplicantTray::DeskbarItemFor(node_ref& nodeRef) 578 584 { 579 585 for (int32 i = fItemList->CountItems(); i-- > 0 ;) { 580 586 DeskbarItemInfo* item = (DeskbarItemInfo*)fItemList->ItemAt(i); … … 606 612 607 613 608 614 bool 609 TReplicantTray::NodeExists(node_ref &nodeRef)615 TReplicantTray::NodeExists(node_ref& nodeRef) 610 616 { 611 617 return DeskbarItemFor(nodeRef) != NULL; 612 618 } … … 837 843 838 844 839 845 status_t 840 TReplicantTray::AddItem(int32 id, node_ref nodeRef, BEntry &entry, bool isAddOn)846 TReplicantTray::AddItem(int32 id, node_ref nodeRef, BEntry& entry, bool isAddOn) 841 847 { 842 848 DeskbarItemInfo* item = new DeskbarItemInfo; 843 849 if (item == NULL) … … 1200 1206 *index = -1; 1201 1207 1202 1208 BView* view; 1203 if (byIndex) {1209 if (byIndex) { 1204 1210 if (fShelf->ReplicantAt(target, &view, (uint32*)id)) { 1205 1211 if (view) { 1206 1212 *index = target; … … 1386 1392 fRightBottomReplicant.Set(0, 0, 0, 0); 1387 1393 1388 1394 BView* view = NULL; 1389 for (int32 i = startIndex ; i < count ; i++) {1395 for (int32 i = startIndex ; i < count ; i++) { 1390 1396 fShelf->ReplicantAt(i, &view); 1391 1397 if (view != NULL) { 1392 1398 BPoint loc = LocationForReplicant(i, view->Frame().Width()); … … 1459 1465 { 1460 1466 if (fBarView->Left() && fBarView->Vertical() && fDragLocation 1461 1467 != kNoDragRegion) 1462 fChild->MoveTo(5, 2);1468 fChild->MoveTo(5, 2); 1463 1469 else 1464 fChild->MoveTo(2, 2);1470 fChild->MoveTo(2, 2); 1465 1471 } 1466 1472 1467 1473 … … 1572 1578 dragRegion.top += kTopBottomInset; 1573 1579 dragRegion.bottom -= kTopBottomInset; 1574 1580 1575 bool placeOnLeft =false;1581 bool placeOnLeft = false; 1576 1582 if (fDragLocation == kAutoPlaceDragRegion) { 1577 1583 if (fBarView->Vertical() && fBarView->Left()) 1578 1584 placeOnLeft = true; … … 1608 1614 if (!dragRegion.Contains(thePoint)) 1609 1615 return; 1610 1616 1611 while (true) {1617 while (true) { 1612 1618 GetMouse(&where, &buttons); 1613 1619 if (!buttons) 1614 1620 break; -
Jamfile
39 39 ResourceSet.cpp 40 40 Switcher.cpp 41 41 $(targetSource) 42 : be tracker $(targetLib) $(TARGET_LIBSUPC++)42 : be tracker liblocale.so $(targetLib) $(TARGET_LIBSUPC++) 43 43 ; 44 44 45 DoCatalogs Deskbar : 46 application/x-vnd.Be-TSKB 47 : 48 BeMenu.cpp 49 PreferencesWindow.cpp 50 StatusView.cpp 51 TimeView.cpp 52 WindowMenu.cpp 53 : en.catalog 54 ; -
TimeView.cpp
37 37 38 38 #include <string.h> 39 39 40 #include <Catalog.h> 40 41 #include <Debug.h> 42 #include <Locale.h> 41 43 #include <MenuItem.h> 42 44 #include <MessageRunner.h> 43 45 #include <PopUpMenu.h> … … 66 68 }; 67 69 68 70 71 #undef TR_CONTEXT 72 #define TR_CONTEXT "TimeView" 73 69 74 TTimeView::TTimeView(float maxWidth, float height, bool showSeconds, 70 75 bool milTime, bool fullDate, bool euroDate, bool) 71 76 : … … 171 176 // overlap the bevels in the parent view. 172 177 if (ShowingDate()) 173 178 *width = fOrientation ? 174 175 179 min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fDateStr)) 180 : kHMargin + StringWidth(fDateStr); 176 181 else { 177 182 *width = fOrientation ? 178 179 183 min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fTimeStr)) 184 : kHMargin + StringWidth(fTimeStr); 180 185 } 181 186 } 182 187 … … 295 300 // use the doubleClickSpeed as a threshold 296 301 297 302 fLongClickMessageRunner = new BMessageRunner(BMessenger(this), 298 303 &longClickMessage, longClickThreshold, 1); 299 304 } 300 305 301 306 … … 323 328 } 324 329 325 330 // remove leading 0 from time when hour is less than 10 326 const char *str = tmp;331 const char* str = tmp; 327 332 if (str[0] == '0') 328 333 str++; 329 334 … … 544 549 BRect rectArray[1]; 545 550 escapement_delta delta = { 0.0, 0.0 }; 546 551 font.GetBoundingBoxesForStrings(stringArray, 1, B_SCREEN_METRIC, &delta, 547 552 rectArray); 548 553 549 554 fTimeLocation.y = fDateLocation.y = ceilf((bounds.Height() - 550 555 rectArray[0].Height() + 1.0) / 2.0 - rectArray[0].top); … … 558 563 menu->SetFont(be_plain_font); 559 564 BMenuItem* item; 560 565 561 item = new BMenuItem( "Change time" B_UTF8_ELLIPSIS,566 item = new BMenuItem(TR("Change time" B_UTF8_ELLIPSIS), 562 567 new BMessage(kChangeClock)); 563 568 menu->AddItem(item); 564 569 565 item = new BMenuItem( "Hide time", new BMessage('time'));570 item = new BMenuItem(TR("Hide time"), new BMessage('time')); 566 571 menu->AddItem(item); 567 572 568 item = new BMenuItem( "Show calendar" B_UTF8_ELLIPSIS,573 item = new BMenuItem(TR("Show calendar" B_UTF8_ELLIPSIS), 569 574 new BMessage(kShowCalendar)); 570 575 menu->AddItem(item); 571 576 -
WindowMenu.cpp
35 35 #include <malloc.h> 36 36 #include <stdio.h> 37 37 #include <string.h> 38 #include <Catalog.h> 39 #include <Locale.h> 38 40 #include <Window.h> 39 41 40 42 #include "BarApp.h" … … 58 60 const int32 kSystemFloater = 6; 59 61 60 62 63 #undef TR_CONTEXT 64 #define TR_CONTEXT "WindowMenu" 65 61 66 bool 62 67 TWindowMenu::WindowShouldBeListed(uint32 behavior) 63 68 { … … 173 178 int32 itemCount = CountItems() + parentMenuItems; 174 179 if (itemCount < 1) { 175 180 TWindowMenuItem* noWindowsItem = 176 new TWindowMenuItem( "No windows", -1, false, false);181 new TWindowMenuItem(TR("No windows"), -1, false, false); 177 182 178 183 noWindowsItem->SetEnabled(false); 179 184 … … 183 188 // it. (but we only add this option if the application is not Tracker.) 184 189 if (fApplicationSignature.ICompare(kTrackerSignature) != 0) { 185 190 AddSeparatorItem(); 186 AddItem(new TShowHideMenuItem( "Quit application", fTeam,191 AddItem(new TShowHideMenuItem(TR("Quit application"), fTeam, 187 192 B_QUIT_REQUESTED)); 188 193 } 189 194 } else { … … 191 196 // to the menu 192 197 if (!dragging) { 193 198 TShowHideMenuItem* hide = 194 new TShowHideMenuItem( "Hide all", fTeam, B_MINIMIZE_WINDOW);199 new TShowHideMenuItem(TR("Hide all"), fTeam, B_MINIMIZE_WINDOW); 195 200 TShowHideMenuItem* show = 196 new TShowHideMenuItem( "Show all", fTeam, B_BRING_TO_FRONT);201 new TShowHideMenuItem(TR("Show all"), fTeam, B_BRING_TO_FRONT); 197 202 TShowHideMenuItem* close = 198 new TShowHideMenuItem( "Close all", fTeam, B_QUIT_REQUESTED);203 new TShowHideMenuItem(TR("Close all"), fTeam, B_QUIT_REQUESTED); 199 204 200 205 if (miniCount == itemCount) 201 206 hide->SetEnabled(false); -
BarApp.cpp
39 39 #include <AppFileInfo.h> 40 40 #include <Autolock.h> 41 41 #include <Bitmap.h> 42 #include <Catalog.h> 42 43 #include <Directory.h> 43 44 #include <Dragger.h> 44 45 #include <File.h> 45 46 #include <FindDirectory.h> 47 #include <Locale.h> 46 48 #include <Mime.h> 47 49 #include <Path.h> 48 50 #include <Roster.h> … … 93 95 InitSettings(); 94 96 InitIconPreloader(); 95 97 98 be_locale->GetAppCatalog(&fCatalog); 96 99 be_roster->StartWatching(this); 97 100 98 101 sBarTeamInfoList.MakeEmpty(); -
PreferencesWindow.cpp
9 9 10 10 #include "PreferencesWindow.h" 11 11 12 #include <Catalog.h> 12 13 #include <CheckBox.h> 13 14 #include <GroupLayout.h> 15 #include <Locale.h> 14 16 #include <LayoutBuilder.h> 15 17 #include <OpenWithTracker.h> 16 18 #include <RadioButton.h> … … 22 24 #include "StatusView.h" 23 25 24 26 27 #undef TR_CONTEXT 28 #define TR_CONTEXT "PreferencesWindow" 29 25 30 PreferencesWindow::PreferencesWindow(BRect frame) 26 31 : 27 BWindow(frame, "Deskbar preferences", B_TITLED_WINDOW,32 BWindow(frame, TR("Deskbar preferences"), B_TITLED_WINDOW, 28 33 B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE) 29 34 { 30 35 // Controls 31 fMenuRecentDocuments = new BCheckBox( "Recent documents:",36 fMenuRecentDocuments = new BCheckBox(TR("Recent documents:"), 32 37 new BMessage(kUpdateRecentCounts)); 33 fMenuRecentApplications = new BCheckBox( "Recent applications:",38 fMenuRecentApplications = new BCheckBox(TR("Recent applications:"), 34 39 new BMessage(kUpdateRecentCounts)); 35 fMenuRecentFolders = new BCheckBox( "Recent folders:",40 fMenuRecentFolders = new BCheckBox(TR("Recent folders:"), 36 41 new BMessage(kUpdateRecentCounts)); 37 42 38 43 fMenuRecentDocumentCount = new BTextControl(NULL, NULL, … … 42 47 fMenuRecentFolderCount = new BTextControl(NULL, NULL, 43 48 new BMessage(kUpdateRecentCounts)); 44 49 45 fAppsSort = new BCheckBox( "Sort running applications",50 fAppsSort = new BCheckBox(TR("Sort running applications"), 46 51 new BMessage(kSortRunningApps)); 47 fAppsSortTrackerFirst = new BCheckBox( "Tracker always first",52 fAppsSortTrackerFirst = new BCheckBox(TR("Tracker always first"), 48 53 new BMessage(kTrackerFirst)); 49 fAppsShowExpanders = new BCheckBox( "Show application expander",54 fAppsShowExpanders = new BCheckBox(TR("Show application expander"), 50 55 new BMessage(kSuperExpando)); 51 fAppsExpandNew = new BCheckBox( "Expand new applications",56 fAppsExpandNew = new BCheckBox(TR("Expand new applications"), 52 57 new BMessage(kExpandNewTeams)); 53 58 54 fClock24Hours = new BCheckBox( "24 hour clock", new BMessage(kMilTime));55 fClockSeconds = new BCheckBox( "Show seconds",59 fClock24Hours = new BCheckBox(TR("24 hour clock"), new BMessage(kMilTime)); 60 fClockSeconds = new BCheckBox(TR("Show seconds"), 56 61 new BMessage(kShowSeconds)); 57 fClockEuropeanDate = new BCheckBox( "European date",62 fClockEuropeanDate = new BCheckBox(TR("European date"), 58 63 new BMessage(kEuroDate)); 59 fClockFullDate = new BCheckBox( "Full date", new BMessage(kFullDate));64 fClockFullDate = new BCheckBox(TR("Full date"), new BMessage(kFullDate)); 60 65 61 fWindowAlwaysOnTop = new BCheckBox( "Always on top",66 fWindowAlwaysOnTop = new BCheckBox(TR("Always on top"), 62 67 new BMessage(kAlwaysTop)); 63 fWindowAutoRaise = new BCheckBox( "Auto-raise", new BMessage(kAutoRaise));68 fWindowAutoRaise = new BCheckBox(TR("Auto-raise"), new BMessage(kAutoRaise)); 64 69 65 70 BTextView* docTextView = fMenuRecentDocumentCount->TextView(); 66 71 BTextView* appTextView = fMenuRecentApplicationCount->TextView(); … … 149 154 fClockBox = new BBox("fClockBox"); 150 155 fWindowBox = new BBox("fWindowBox"); 151 156 152 fMenuBox->SetLabel( "Menu");153 fAppsBox->SetLabel( "Applications");154 fClockBox->SetLabel( "Clock");155 fWindowBox->SetLabel( "Window");157 fMenuBox->SetLabel(TR("Menu")); 158 fAppsBox->SetLabel(TR("Applications")); 159 fClockBox->SetLabel(TR("Clock")); 160 fWindowBox->SetLabel(TR("Window")); 156 161 157 162 BView* view; 158 163 view = BLayoutBuilder::Group<>() … … 169 174 .Add(fMenuRecentApplicationCount) 170 175 .End() 171 176 .End() 172 .Add(new BButton( "Edit menu" B_UTF8_ELLIPSIS,177 .Add(new BButton(TR("Edit menu" B_UTF8_ELLIPSIS), 173 178 new BMessage(kEditMenuInTracker))) 174 179 .SetInsets(10, 10, 10, 10) 175 180 .End()