Ticket #6103: tvLocalization.patch
File tvLocalization.patch, 46.0 KB (added by , 14 years ago) |
---|
-
src/apps/tv/DeviceRoster.cpp
38 38 live_node_info info[MAX_DEVICE_COUNT]; 39 39 int32 info_count = MAX_DEVICE_COUNT; 40 40 status_t err; 41 err = MediaRoster()->GetLiveNodes(info, &info_count, NULL, NULL, "DVB*", B_BUFFER_PRODUCER | B_PHYSICAL_INPUT); 41 err = MediaRoster()->GetLiveNodes(info, &info_count, NULL, NULL, "DVB*", 42 B_BUFFER_PRODUCER | B_PHYSICAL_INPUT); 42 43 if (err != B_OK || info_count < 1) { 43 printf("Can't find live DVB node. Found %ld nodes, error %08lx (%s)\n", info_count, err, strerror(err)); 44 printf("Can't find live DVB node. Found %ld nodes, error %08lx (%s)\n", 45 info_count, err, strerror(err)); 44 46 fDeviceCount = 0; 45 47 } else { 46 48 fDeviceCount = info_count; … … 89 91 int32 count; 90 92 status_t err; 91 93 92 err = MediaRoster()->GetFreeOutputsFor(fDeviceInfo[i].node, &output, 1, &count, B_MEDIA_RAW_AUDIO); 94 err = MediaRoster()->GetFreeOutputsFor(fDeviceInfo[i].node, &output, 1, 95 &count, B_MEDIA_RAW_AUDIO); 93 96 return (err == B_OK) && (count == 1); 94 97 } 95 98 … … 103 106 int32 count; 104 107 status_t err; 105 108 106 err = MediaRoster()->GetFreeOutputsFor(fDeviceInfo[i].node, &output, 1, &count, B_MEDIA_ENCODED_AUDIO); 109 err = MediaRoster()->GetFreeOutputsFor(fDeviceInfo[i].node, &output, 1, 110 &count, B_MEDIA_ENCODED_AUDIO); 107 111 return (err == B_OK) && (count == 1); 108 112 } 109 113 … … 117 121 int32 count; 118 122 status_t err; 119 123 120 err = MediaRoster()->GetFreeOutputsFor(fDeviceInfo[i].node, &output, 1, &count, B_MEDIA_RAW_VIDEO); 124 err = MediaRoster()->GetFreeOutputsFor(fDeviceInfo[i].node, &output, 1, 125 &count, B_MEDIA_RAW_VIDEO); 121 126 return (err == B_OK) && (count == 1); 122 127 } 123 128 … … 131 136 int32 count; 132 137 status_t err; 133 138 134 err = MediaRoster()->GetFreeOutputsFor(fDeviceInfo[i].node, &output, 1, &count, B_MEDIA_ENCODED_VIDEO); 139 err = MediaRoster()->GetFreeOutputsFor(fDeviceInfo[i].node, &output, 1, 140 &count, B_MEDIA_ENCODED_VIDEO); 135 141 return (err == B_OK) && (count == 1); 136 142 } 137 143 -
src/apps/tv/VideoView.cpp
35 35 36 36 #define CHECK_ACTIVITY 'ChkA' 37 37 38 VideoView::VideoView(BRect frame, const char *name, uint32 resizeMask, uint32 flags) 38 VideoView::VideoView(BRect frame, const char *name, uint32 resizeMask, 39 uint32 flags) 39 40 : BView(frame, name, resizeMask, flags) 40 41 , fVideoNode(0) 41 42 , fVideoActive(false) … … 72 73 VideoView::AttachedToWindow() 73 74 { 74 75 BMessage msg(CHECK_ACTIVITY); 75 fActivityCheckMsgRunner = new BMessageRunner(BMessenger(this), &msg, 200000); 76 fActivityCheckMsgRunner = new BMessageRunner(BMessenger(this), &msg, 77 200000); 76 78 } 77 79 78 80 … … 93 95 void 94 96 VideoView::OverlayLockRelease() 95 97 { /* [19:54] <Francois> Rudolf forwarded me a mail once about it 96 * [19:55] <Francois> when you get relmease msg you are supposed to UnlockBits() on the overlay bitmaps you use 98 * [19:55] <Francois> when you get relmease msg you are supposed to 99 UnlockBits() on the overlay bitmaps you use 97 100 * [19:55] <Francois> it's used when switching workspaces 98 101 * [19:55] <Francois> as the bits might get relocated 99 102 */ … … 139 142 if (bmp) { 140 143 DrawBitmap(bmp, Bounds()); 141 144 SetViewOverlay(bmp, bmp->Bounds(), Bounds(), &fOverlayKeyColor, 142 B_FOLLOW_ALL, B_OVERLAY_FILTER_HORIZONTAL | B_OVERLAY_FILTER_VERTICAL); 145 B_FOLLOW_ALL, B_OVERLAY_FILTER_HORIZONTAL 146 | B_OVERLAY_FILTER_VERTICAL); 143 147 Invalidate(); 144 148 } 145 149 } … … 231 235 UnlockLooper(); 232 236 fOverlayActive = false; 233 237 } else { 234 printf("can't ClearViewOverlay, as LockLooperWithTimeout failed\n"); 238 printf("can't ClearViewOverlay, as LockLooperWithTimeout " 239 "failed\n"); 235 240 } 236 241 } 237 242 if (want_overlay && !fOverlayActive) { … … 239 244 BBitmap *bmp = fVideoNode->Bitmap(); 240 245 if (bmp && LockLooperWithTimeout(50000) == B_OK) { 241 246 SetViewOverlay(bmp, bmp->Bounds(), Bounds(), &fOverlayKeyColor, 242 B_FOLLOW_ALL, B_OVERLAY_FILTER_HORIZONTAL | B_OVERLAY_FILTER_VERTICAL); 247 B_FOLLOW_ALL, B_OVERLAY_FILTER_HORIZONTAL 248 | B_OVERLAY_FILTER_VERTICAL); 243 249 fOverlayActive = true; 244 250 245 251 Invalidate(); … … 363 369 364 370 bool supported = false; 365 371 for (int i = 0; colspace[i].name; i++) { 366 BBitmap *test = new BBitmap(BRect(0,0,320,240), B_BITMAP_WILL_OVERLAY | B_BITMAP_RESERVE_OVERLAY_CHANNEL, colspace[i].colspace); 372 BBitmap *test = new BBitmap(BRect(0,0,320,240), B_BITMAP_WILL_OVERLAY 373 | B_BITMAP_RESERVE_OVERLAY_CHANNEL, colspace[i].colspace); 367 374 if (test->InitCheck() == B_OK) { 368 printf("Display supports %s (0x%08x) overlay\n", colspace[i].name, colspace[i].colspace); 375 printf("Display supports %s (0x%08x) overlay\n", colspace[i].name, 376 colspace[i].colspace); 369 377 overlay_restrictions restrict; 370 378 if (B_OK == test->GetOverlayRestrictions(&restrict)) { 371 printf("Overlay restrictions: source horizontal_alignment %d\n", restrict.source.horizontal_alignment); 372 printf("Overlay restrictions: source vertical_alignment %d\n", restrict.source.vertical_alignment); 373 printf("Overlay restrictions: source width_alignment %d\n", restrict.source.width_alignment); 374 printf("Overlay restrictions: source height_alignment %d\n", restrict.source.height_alignment); 375 printf("Overlay restrictions: source min_width %d\n", restrict.source.min_width); 376 printf("Overlay restrictions: source max_width %d\n", restrict.source.max_width); 377 printf("Overlay restrictions: source min_height %d\n", restrict.source.min_height); 378 printf("Overlay restrictions: source max_height %d\n", restrict.source.max_height); 379 printf("Overlay restrictions: destination horizontal_alignment %d\n", restrict.destination.horizontal_alignment); 380 printf("Overlay restrictions: destination vertical_alignment %d\n", restrict.destination.vertical_alignment); 381 printf("Overlay restrictions: destination width_alignment %d\n", restrict.destination.width_alignment); 382 printf("Overlay restrictions: destination height_alignment %d\n", restrict.destination.height_alignment); 383 printf("Overlay restrictions: destination min_width %d\n", restrict.destination.min_width); 384 printf("Overlay restrictions: destination max_width %d\n", restrict.destination.max_width); 385 printf("Overlay restrictions: destination min_height %d\n", restrict.destination.min_height); 386 printf("Overlay restrictions: destination max_height %d\n", restrict.destination.max_height); 387 printf("Overlay restrictions: min_width_scale %.3f\n", restrict.min_width_scale); 388 printf("Overlay restrictions: max_width_scale %.3f\n", restrict.max_width_scale); 389 printf("Overlay restrictions: min_height_scale %.3f\n", restrict.min_height_scale); 390 printf("Overlay restrictions: max_height_scale %.3f\n", restrict.max_height_scale); 379 printf( 380 "Overlay restrictions: source horizontal_alignment %d\n", 381 restrict.source.horizontal_alignment); 382 printf("Overlay restrictions: source vertical_alignment %d\n", 383 restrict.source.vertical_alignment); 384 printf("Overlay restrictions: source width_alignment %d\n", 385 restrict.source.width_alignment); 386 printf("Overlay restrictions: source height_alignment %d\n", 387 restrict.source.height_alignment); 388 printf("Overlay restrictions: source min_width %d\n", 389 restrict.source.min_width); 390 printf("Overlay restrictions: source max_width %d\n", 391 restrict.source.max_width); 392 printf("Overlay restrictions: source min_height %d\n", 393 restrict.source.min_height); 394 printf("Overlay restrictions: source max_height %d\n", 395 restrict.source.max_height); 396 printf( 397 "Overlay restrictions: destination horizontal_alignment " 398 "%d\n", restrict.destination.horizontal_alignment); 399 printf("Overlay restrictions: destination vertical_alignment " 400 "%d\n", restrict.destination.vertical_alignment); 401 printf("Overlay restrictions: destination width_alignment " 402 "%d\n", restrict.destination.width_alignment); 403 printf("Overlay restrictions: destination height_alignment " 404 "%d\n", restrict.destination.height_alignment); 405 printf("Overlay restrictions: destination min_width %d\n", 406 restrict.destination.min_width); 407 printf("Overlay restrictions: destination max_width %d\n", 408 restrict.destination.max_width); 409 printf("Overlay restrictions: destination min_height %d\n", 410 restrict.destination.min_height); 411 printf("Overlay restrictions: destination max_height %d\n", 412 restrict.destination.max_height); 413 printf("Overlay restrictions: min_width_scale %.3f\n", 414 restrict.min_width_scale); 415 printf("Overlay restrictions: max_width_scale %.3f\n", 416 restrict.max_width_scale); 417 printf("Overlay restrictions: min_height_scale %.3f\n", 418 restrict.min_height_scale); 419 printf("Overlay restrictions: max_height_scale %.3f\n", 420 restrict.max_height_scale); 391 421 } 392 422 supported = true; 393 423 } -
src/apps/tv/MainWin.cpp
28 28 #include "config.h" 29 29 #include "DeviceRoster.h" 30 30 31 #include <View.h> 32 #include <Screen.h> 31 #include <stdio.h> 32 #include <string.h> 33 34 #include <Application.h> 35 #include <Alert.h> 33 36 #include <Menu.h> 34 37 #include <MenuBar.h> 35 38 #include <MenuItem.h> 36 #include <Application.h>37 #include <Alert.h>38 #include <stdio.h>39 #include <string.h>40 39 #include <Messenger.h> 41 40 #include <PopUpMenu.h> 41 #include <Screen.h> 42 42 #include <String.h> 43 #include <View.h> 43 44 45 46 #undef B_TRANSLATE_CONTEXT 47 #define B_TRANSLATE_CONTEXT "MainWin" 48 49 static const char* fLocalizedName = B_TRANSLATE_MARK("TV"); 50 static const char* fLocalizedRevision = B_TRANSLATE_MARK("unknown"); 51 static const char* fLocalizedInfo1 = B_TRANSLATE_MARK("DVB - Digital Video Broadcasting TV"); 52 44 53 enum 45 54 { 46 55 M_DUMMY = 0x100, … … 68 77 M_SELECT_INTERFACE = 0x00000800, 69 78 M_SELECT_INTERFACE_END = 0x00000fff, 70 79 M_SELECT_CHANNEL = 0x00010000, 71 M_SELECT_CHANNEL_END = 0x000fffff, // this limits possible channel count to 0xeffff = 983039 80 M_SELECT_CHANNEL_END = 0x000fffff, 81 // this limits possible channel count to 0xeffff = 983039 72 82 }; 73 83 74 84 //#define printf(a...) 75 85 76 86 77 87 MainWin::MainWin(BRect frame_rect) 78 : BWindow(frame_rect, NAME, B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */) 88 : BWindow(frame_rect, NAME, B_TITLED_WINDOW, 89 B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */) 79 90 , fController(new Controller) 80 91 , fIsFullscreen(false) 81 92 , fKeepAspectRatio(true) … … 92 103 , fFrameResizedCalled(true) 93 104 { 94 105 BRect rect = Bounds(); 95 106 96 107 // background 97 fBackground = new BView(rect, "background", B_FOLLOW_ALL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); 108 fBackground = new BView(rect, "background", B_FOLLOW_ALL, 109 B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); 98 110 fBackground->SetViewColor(0,0,0); 99 111 AddChild(fBackground); 100 112 … … 108 120 109 121 // video view 110 122 BRect video_rect = BRect(0, fMenuBarHeight, rect.right, rect.bottom); 111 fVideoView = new VideoView(video_rect, "video display", B_FOLLOW_ALL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); 123 fVideoView = new VideoView(video_rect, "video display", B_FOLLOW_ALL, 124 B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); 112 125 fBackground->AddChild(fVideoView); 113 126 114 127 fVideoView->MakeFocus(); 115 128 116 129 // SetSizeLimits(fControlViewMinWidth - 1, 32767, 117 // fMenuBarHeight + fControlViewHeight - 1, fMenuBarHeight + fControlViewHeight - 1); 130 // fMenuBarHeight + fControlViewHeight - 1, fMenuBarHeight 131 // + fControlViewHeight - 1); 118 132 119 133 // SetSizeLimits(320 - 1, 32767, 240 + fMenuBarHeight - 1, 32767); 120 134 … … 149 163 MainWin::CreateMenu() 150 164 { 151 165 fFileMenu = new BMenu(NAME); 152 fChannelMenu = new BMenu( "Channel");153 fInterfaceMenu = new BMenu( "Interface");154 fSettingsMenu = new BMenu( "Settings");155 fDebugMenu = new BMenu( "Debug");166 fChannelMenu = new BMenu(B_TRANSLATE("Channel")); 167 fInterfaceMenu = new BMenu(B_TRANSLATE("Interface")); 168 fSettingsMenu = new BMenu(B_TRANSLATE("Settings")); 169 fDebugMenu = new BMenu(B_TRANSLATE("Debug")); 156 170 157 171 fMenuBar->AddItem(fFileMenu); 158 172 fMenuBar->AddItem(fChannelMenu); … … 160 174 fMenuBar->AddItem(fSettingsMenu); 161 175 fMenuBar->AddItem(fDebugMenu); 162 176 163 fFileMenu->AddItem(new BMenuItem("About " NAME B_UTF8_ELLIPSIS, new BMessage(M_FILE_ABOUT))); 177 BString aboutStr = B_TRANSLATE_COMMENT("About %1"B_UTF8_ELLIPSIS, 178 "Parameter %1 is the name of the application."); 179 aboutStr.ReplaceFirst("%1", fLocalizedName); 180 fFileMenu->AddItem(new BMenuItem(aboutStr.String(), 181 new BMessage(M_FILE_ABOUT))); 164 182 fFileMenu->AddSeparatorItem(); 165 fFileMenu->AddItem(new BMenuItem("Quit", new BMessage(M_FILE_QUIT), 'Q', B_COMMAND_KEY)); 183 fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), 184 new BMessage(M_FILE_QUIT), 'Q', B_COMMAND_KEY)); 166 185 167 186 /* 168 fChannelMenu->AddItem(new BMenuItem("Next channel", new BMessage(M_CHANNEL_NEXT), '+', B_COMMAND_KEY)); 169 fChannelMenu->AddItem(new BMenuItem("Previous channel", new BMessage(M_CHANNEL_PREV), '-', B_COMMAND_KEY)); 187 fChannelMenu->AddItem(new BMenuItem(B_TRANSLATE("Next channel"), 188 new BMessage(M_CHANNEL_NEXT), '+', B_COMMAND_KEY)); 189 fChannelMenu->AddItem(new BMenuItem(B_TRANSLATE("Previous channel"), 190 new BMessage(M_CHANNEL_PREV), '-', B_COMMAND_KEY)); 170 191 fChannelMenu->AddSeparatorItem(); 171 fChannelMenu->AddItem(new BMenuItem("RTL", new BMessage(M_DUMMY), '0', B_COMMAND_KEY)); 172 fChannelMenu->AddItem(new BMenuItem("Pro7", new BMessage(M_DUMMY), '1', B_COMMAND_KEY)); 192 fChannelMenu->AddItem(new BMenuItem("RTL", new BMessage(M_DUMMY), '0', 193 B_COMMAND_KEY)); 194 fChannelMenu->AddItem(new BMenuItem("Pro7", new BMessage(M_DUMMY), '1', 195 B_COMMAND_KEY)); 173 196 174 fInterfaceMenu->AddItem(new BMenuItem("none", new BMessage(M_DUMMY))); 175 fInterfaceMenu->AddItem(new BMenuItem("none 1", new BMessage(M_DUMMY))); 176 fInterfaceMenu->AddItem(new BMenuItem("none 2", new BMessage(M_DUMMY))); 197 fInterfaceMenu->AddItem(new BMenuItem(B_TRANSLATE("none"), 198 new BMessage(M_DUMMY))); 199 fInterfaceMenu->AddItem(new BMenuItem(B_TRANSLATE("none 1"), 200 new BMessage(M_DUMMY))); 201 fInterfaceMenu->AddItem(new BMenuItem(B_TRANSLATE("none 2"), 202 new BMessage(M_DUMMY))); 177 203 */ 178 204 179 fSettingsMenu->AddItem(new BMenuItem("Scale to native size", new BMessage(M_SCALE_TO_NATIVE_SIZE), 'N', B_COMMAND_KEY)); 180 fSettingsMenu->AddItem(new BMenuItem("Full screen", new BMessage(M_TOGGLE_FULLSCREEN), 'F', B_COMMAND_KEY)); 205 fSettingsMenu->AddItem(new BMenuItem(B_TRANSLATE("Scale to native size"), 206 new BMessage(M_SCALE_TO_NATIVE_SIZE), 'N', B_COMMAND_KEY)); 207 fSettingsMenu->AddItem(new BMenuItem(B_TRANSLATE("Full screen"), 208 new BMessage(M_TOGGLE_FULLSCREEN), 'F', B_COMMAND_KEY)); 181 209 fSettingsMenu->AddSeparatorItem(); 182 fSettingsMenu->AddItem(new BMenuItem("No menu", new BMessage(M_TOGGLE_NO_MENU), 'M', B_COMMAND_KEY)); 183 fSettingsMenu->AddItem(new BMenuItem("No border", new BMessage(M_TOGGLE_NO_BORDER), 'B', B_COMMAND_KEY)); 184 fSettingsMenu->AddItem(new BMenuItem("Always on top", new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T', B_COMMAND_KEY)); 185 fSettingsMenu->AddItem(new BMenuItem("Keep aspect ratio", new BMessage(M_TOGGLE_KEEP_ASPECT_RATIO), 'K', B_COMMAND_KEY)); 210 fSettingsMenu->AddItem(new BMenuItem(B_TRANSLATE("No menu"), 211 new BMessage(M_TOGGLE_NO_MENU), 'M', B_COMMAND_KEY)); 212 fSettingsMenu->AddItem(new BMenuItem(B_TRANSLATE("No border"), 213 new BMessage(M_TOGGLE_NO_BORDER), 'B', B_COMMAND_KEY)); 214 fSettingsMenu->AddItem(new BMenuItem(B_TRANSLATE("Always on top"), 215 new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T', B_COMMAND_KEY)); 216 fSettingsMenu->AddItem(new BMenuItem(B_TRANSLATE("Keep aspect ratio"), 217 new BMessage(M_TOGGLE_KEEP_ASPECT_RATIO), 'K', B_COMMAND_KEY)); 186 218 fSettingsMenu->AddSeparatorItem(); 187 fSettingsMenu->AddItem(new BMenuItem("Settings"B_UTF8_ELLIPSIS, new BMessage(M_PREFERENCES), 'P', B_COMMAND_KEY)); 219 fSettingsMenu->AddItem(new BMenuItem(B_TRANSLATE("Settings"B_UTF8_ELLIPSIS) 220 , new BMessage(M_PREFERENCES), 'P', B_COMMAND_KEY)); 188 221 189 fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.00000:1", new BMessage(M_ASPECT_100000_1))); 190 fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.06666:1", new BMessage(M_ASPECT_106666_1))); 191 fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.09091:1", new BMessage(M_ASPECT_109091_1))); 192 fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.41176:1", new BMessage(M_ASPECT_141176_1))); 193 fDebugMenu->AddItem(new BMenuItem("force 720 x 576, display aspect 4:3", new BMessage(M_ASPECT_720_576))); 194 fDebugMenu->AddItem(new BMenuItem("force 704 x 576, display aspect 4:3", new BMessage(M_ASPECT_704_576))); 195 fDebugMenu->AddItem(new BMenuItem("force 544 x 576, display aspect 4:3", new BMessage(M_ASPECT_544_576))); 222 const char* pixel_ratio = B_TRANSLATE("pixel aspect ratio"); 223 BString str1 = pixel_ratio; 224 str1 << " 1.00000:1"; 225 fDebugMenu->AddItem(new BMenuItem(str1.String(), 226 new BMessage(M_ASPECT_100000_1))); 227 BString str2 = pixel_ratio; 228 str2 << " 1.06666:1"; 229 fDebugMenu->AddItem(new BMenuItem(str2.String(), 230 new BMessage(M_ASPECT_106666_1))); 231 BString str3 = pixel_ratio; 232 str3 << " 1.09091:1"; 233 fDebugMenu->AddItem(new BMenuItem(str3.String(), 234 new BMessage(M_ASPECT_109091_1))); 235 BString str4 = pixel_ratio; 236 str4 << " 1.41176:1"; 237 fDebugMenu->AddItem(new BMenuItem(str4.String(), 238 new BMessage(M_ASPECT_141176_1))); 239 fDebugMenu->AddItem(new BMenuItem(B_TRANSLATE( 240 "force 720 x 576, display aspect 4:3"), 241 new BMessage(M_ASPECT_720_576))); 242 fDebugMenu->AddItem(new BMenuItem(B_TRANSLATE( 243 "force 704 x 576, display aspect 4:3"), 244 new BMessage(M_ASPECT_704_576))); 245 fDebugMenu->AddItem(new BMenuItem(B_TRANSLATE( 246 "force 544 x 576, display aspect 4:3"), 247 new BMessage(M_ASPECT_544_576))); 196 248 197 249 fSettingsMenu->ItemAt(1)->SetMarked(fIsFullscreen); 198 250 fSettingsMenu->ItemAt(3)->SetMarked(fNoMenu); 199 251 fSettingsMenu->ItemAt(4)->SetMarked(fNoBorder); 200 252 fSettingsMenu->ItemAt(5)->SetMarked(fAlwaysOnTop); 201 253 fSettingsMenu->ItemAt(6)->SetMarked(fKeepAspectRatio); 202 fSettingsMenu->ItemAt(8)->SetEnabled(false); // XXX disable unused preference menu 254 fSettingsMenu->ItemAt(8)->SetEnabled(false); 255 // XXX disable unused preference menu 203 256 } 204 257 205 258 … … 208 261 { 209 262 fInterfaceMenu->RemoveItems(0, fInterfaceMenu->CountItems(), true); 210 263 211 fInterfaceMenu->AddItem(new BMenuItem("None", new BMessage(M_SELECT_INTERFACE))); 264 fInterfaceMenu->AddItem(new BMenuItem(B_TRANSLATE("None"), 265 new BMessage(M_SELECT_INTERFACE))); 212 266 213 267 int count = gDeviceRoster->DeviceCount(); 214 268 … … 216 270 fInterfaceMenu->AddSeparatorItem(); 217 271 218 272 for (int i = 0; i < count; i++) { 219 // 1 gets subtracted in MessageReceived, so -1 is Interface None, and 0 == Interface 0 in SelectInterface() 220 fInterfaceMenu->AddItem(new BMenuItem(gDeviceRoster->DeviceName(i), new BMessage(M_SELECT_INTERFACE + i + 1))); 273 // 1 gets subtracted in MessageReceived, so -1 is Interface None, 274 // and 0 == Interface 0 in SelectInterface() 275 fInterfaceMenu->AddItem(new BMenuItem(gDeviceRoster->DeviceName(i), 276 new BMessage(M_SELECT_INTERFACE + i + 1))); 221 277 } 222 278 } 223 279 … … 233 289 int channels = fController->ChannelCount(); 234 290 235 291 if (channels == 0) { 236 fChannelMenu->AddItem(new BMenuItem("None", new BMessage(M_DUMMY))); 292 fChannelMenu->AddItem(new BMenuItem(B_TRANSLATE("None"), 293 new BMessage(M_DUMMY))); 237 294 } else { 238 fChannelMenu->AddItem(new BMenuItem("Next channel", new BMessage(M_CHANNEL_NEXT), '+', B_COMMAND_KEY)); 239 fChannelMenu->AddItem(new BMenuItem("Previous channel", new BMessage(M_CHANNEL_PREV), '-', B_COMMAND_KEY)); 295 fChannelMenu->AddItem(new BMenuItem(B_TRANSLATE("Next channel"), 296 new BMessage(M_CHANNEL_NEXT), '+', B_COMMAND_KEY)); 297 fChannelMenu->AddItem(new BMenuItem(B_TRANSLATE("Previous channel"), 298 new BMessage(M_CHANNEL_PREV), '-', B_COMMAND_KEY)); 240 299 fChannelMenu->AddSeparatorItem(); 241 300 } 242 301 … … 318 377 319 378 if (!fController->IsInterfaceAvailable(i)) { 320 379 BString s; 321 s << "Error, interface is busy:\n\n" << gDeviceRoster->DeviceName(i); 322 (new BAlert("error", s.String(), "OK"))->Go(); 380 s << B_TRANSLATE("Error, interface is busy:\n\n"); 381 s << gDeviceRoster->DeviceName(i); 382 (new BAlert("error", s.String(), B_TRANSLATE("OK")))->Go(); 323 383 return; 324 384 } 325 385 326 386 fController->DisconnectInterface(); 327 387 if (fController->ConnectInterface(i) != B_OK) { 328 388 BString s; 329 s << "Error, connecting to interface failed:\n\n" << gDeviceRoster->DeviceName(i); 330 (new BAlert("error", s.String(), "OK"))->Go(); 389 s << B_TRANSLATE("Error, connecting to interface failed:\n\n"); 390 s << gDeviceRoster->DeviceName(i); 391 (new BAlert("error", s.String(), B_TRANSLATE("OK")))->Go(); 331 392 } 332 393 333 394 done: … … 348 409 349 410 int count = gDeviceRoster->DeviceCount(); 350 411 for (int i = 0; i < count; i++) { 351 if (fController->IsInterfaceAvailable(i) && B_OK == fController->ConnectInterface(i)) { 352 printf("MainWin::SelectInitialInterface connected to interface %d\n", i); 412 if (fController->IsInterfaceAvailable(i) 413 && B_OK == fController->ConnectInterface(i)) { 414 printf("MainWin::SelectInitialInterface connected to interface " 415 "%d\n", i); 353 416 break; 354 417 } 355 418 } … … 372 435 BPoint screen_where; 373 436 uint32 buttons = msg->FindInt32("buttons"); 374 437 375 // On Zeta, only "screen_where" is relyable, "where" and "be:view_where" seem to be broken 438 // On Zeta, only "screen_where" is relyable, "where" and "be:view_where" 439 // seem to be broken 376 440 if (B_OK != msg->FindPoint("screen_where", &screen_where)) { 377 441 // Workaround for BeOS R5, it has no "screen_where" 378 442 fVideoView->GetMouse(&screen_where, &buttons, false); … … 384 448 // if (1 == msg->FindInt32("buttons") && msg->FindInt32("clicks") == 1) { 385 449 386 450 if (1 == buttons && msg->FindInt32("clicks") % 2 == 0) { 387 BRect r(screen_where.x - 1, screen_where.y - 1, screen_where.x + 1, screen_where.y + 1); 451 BRect r(screen_where.x - 1, screen_where.y - 1, screen_where.x + 1, 452 screen_where.y + 1); 388 453 if (r.Contains(fMouseDownMousePos)) { 389 454 PostMessage(M_TOGGLE_FULLSCREEN); 390 455 return; … … 392 457 } 393 458 394 459 if (2 == buttons && msg->FindInt32("clicks") % 2 == 0) { 395 BRect r(screen_where.x - 1, screen_where.y - 1, screen_where.x + 1, screen_where.y + 1); 460 BRect r(screen_where.x - 1, screen_where.y - 1, screen_where.x + 1, 461 screen_where.y + 1); 396 462 if (r.Contains(fMouseDownMousePos)) { 397 463 PostMessage(M_TOGGLE_NO_BORDER_NO_MENU); 398 464 return; … … 401 467 402 468 /* 403 469 // very broken in Zeta: 404 fMouseDownMousePos = fVideoView->ConvertToScreen(msg->FindPoint("where")); 470 fMouseDownMousePos = fVideoView->ConvertToScreen( 471 msg->FindPoint("where")); 405 472 */ 406 473 fMouseDownMousePos = screen_where; 407 474 fMouseDownWindowPos = Frame().LeftTop(); 408 475 409 476 if (buttons == 1 && !fIsFullscreen) { 410 477 // start mouse tracking 411 fVideoView->SetMouseEventMask(B_POINTER_EVENTS | B_NO_POINTER_HISTORY /* | B_LOCK_WINDOW_FOCUS */); 478 fVideoView->SetMouseEventMask(B_POINTER_EVENTS | B_NO_POINTER_HISTORY 479 /* | B_LOCK_WINDOW_FOCUS */); 412 480 fMouseDownTracking = true; 413 481 } 414 482 … … 446 514 printf("view where: %.0f, %.0f => ", mousePos.x, mousePos.y); 447 515 fVideoView->ConvertToScreen(&mousePos); 448 516 */ 449 // On Zeta, only "screen_where" is relyable, "where" and "be:view_where" seem to be broken 517 // On Zeta, only "screen_where" is relyable, "where" and 518 // "be:view_where" seem to be broken 450 519 if (B_OK != msg->FindPoint("screen_where", &mousePos)) { 451 520 // Workaround for BeOS R5, it has no "screen_where" 452 521 fVideoView->GetMouse(&mousePos, &buttons, false); … … 477 546 printf("Show context menu\n"); 478 547 BPopUpMenu *menu = new BPopUpMenu("context menu", false, false); 479 548 BMenuItem *item; 480 menu->AddItem(new BMenuItem("Scale to native size", new BMessage(M_SCALE_TO_NATIVE_SIZE), 'N', B_COMMAND_KEY)); 481 menu->AddItem(item = new BMenuItem("Full screen", new BMessage(M_TOGGLE_FULLSCREEN), 'F', B_COMMAND_KEY)); 549 menu->AddItem(new BMenuItem(B_TRANSLATE("Scale to native size"), 550 new BMessage(M_SCALE_TO_NATIVE_SIZE), 'N', B_COMMAND_KEY)); 551 menu->AddItem(item = new BMenuItem(B_TRANSLATE("Full screen"), 552 new BMessage(M_TOGGLE_FULLSCREEN), 'F', B_COMMAND_KEY)); 482 553 item->SetMarked(fIsFullscreen); 483 554 menu->AddSeparatorItem(); 484 menu->AddItem(item = new BMenuItem("No menu", new BMessage(M_TOGGLE_NO_MENU), 'M', B_COMMAND_KEY)); 555 menu->AddItem(item = new BMenuItem(B_TRANSLATE("No menu"), 556 new BMessage(M_TOGGLE_NO_MENU), 'M', B_COMMAND_KEY)); 485 557 item->SetMarked(fNoMenu); 486 menu->AddItem(item = new BMenuItem("No border", new BMessage(M_TOGGLE_NO_BORDER), 'B', B_COMMAND_KEY)); 558 menu->AddItem(item = new BMenuItem(B_TRANSLATE("No border"), 559 new BMessage(M_TOGGLE_NO_BORDER), 'B', B_COMMAND_KEY)); 487 560 item->SetMarked(fNoBorder); 488 menu->AddItem(item = new BMenuItem("Always on top", new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T', B_COMMAND_KEY)); 561 menu->AddItem(item = new BMenuItem(B_TRANSLATE("Always on top"), 562 new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T', B_COMMAND_KEY)); 489 563 item->SetMarked(fAlwaysOnTop); 490 menu->AddItem(item = new BMenuItem("Keep aspect ratio", new BMessage(M_TOGGLE_KEEP_ASPECT_RATIO), 'K', B_COMMAND_KEY)); 564 menu->AddItem(item = new BMenuItem(B_TRANSLATE("Keep aspect ratio"), 565 new BMessage(M_TOGGLE_KEEP_ASPECT_RATIO), 'K', B_COMMAND_KEY)); 491 566 item->SetMarked(fKeepAspectRatio); 492 567 menu->AddSeparatorItem(); 493 menu->AddItem(new BMenuItem("About " NAME B_UTF8_ELLIPSIS, new BMessage(M_FILE_ABOUT))); 568 BString aboutStr = B_TRANSLATE_COMMENT("About %1"B_UTF8_ELLIPSIS, 569 "Parameter %1 is the name of the application."); 570 aboutStr.ReplaceFirst("%1", fLocalizedName); 571 menu->AddItem(new BMenuItem(aboutStr.String(), 572 new BMessage(M_FILE_ABOUT))); 494 573 menu->AddSeparatorItem(); 495 menu->AddItem(new BMenuItem("Quit", new BMessage(M_FILE_QUIT), 'Q', B_COMMAND_KEY)); 574 menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), 575 new BMessage(M_FILE_QUIT), 'Q', B_COMMAND_KEY)); 496 576 497 577 menu->AddSeparatorItem(); 498 menu->AddItem(new BMenuItem("pixel aspect ratio 1.00000:1", new BMessage(M_ASPECT_100000_1))); 499 menu->AddItem(new BMenuItem("pixel aspect ratio 1.06666:1", new BMessage(M_ASPECT_106666_1))); 500 menu->AddItem(new BMenuItem("pixel aspect ratio 1.09091:1", new BMessage(M_ASPECT_109091_1))); 501 menu->AddItem(new BMenuItem("pixel aspect ratio 1.41176:1", new BMessage(M_ASPECT_141176_1))); 502 menu->AddItem(new BMenuItem("force 720 x 576, display aspect 4:3", new BMessage(M_ASPECT_720_576))); 503 menu->AddItem(new BMenuItem("force 704 x 576, display aspect 4:3", new BMessage(M_ASPECT_704_576))); 504 menu->AddItem(new BMenuItem("force 544 x 576, display aspect 4:3", new BMessage(M_ASPECT_544_576))); 578 const char* pixel_aspect = "pixel aspect ratio"; 579 BString str1 = pixel_aspect; 580 str1 << " 1.00000:1"; 581 menu->AddItem(new BMenuItem(str1.String(), 582 new BMessage(M_ASPECT_100000_1))); 583 BString str2 = pixel_aspect; 584 str2 << " 1.06666:1"; 585 menu->AddItem(new BMenuItem(str2.String(), 586 new BMessage(M_ASPECT_106666_1))); 587 BString str3 = pixel_aspect; 588 str3 << " 1.09091:1"; 589 menu->AddItem(new BMenuItem(str3.String(), 590 new BMessage(M_ASPECT_109091_1))); 591 BString str4 = pixel_aspect; 592 str4 << " 1.41176:1"; 593 menu->AddItem(new BMenuItem(str4.String(), 594 new BMessage(M_ASPECT_141176_1))); 595 menu->AddItem(new BMenuItem(B_TRANSLATE( 596 "force 720 x 576, display aspect 4:3"), 597 new BMessage(M_ASPECT_720_576))); 598 menu->AddItem(new BMenuItem(B_TRANSLATE( 599 "force 704 x 576, display aspect 4:3"), 600 new BMessage(M_ASPECT_704_576))); 601 menu->AddItem(new BMenuItem(B_TRANSLATE( 602 "force 544 x 576, display aspect 4:3"), 603 new BMessage(M_ASPECT_544_576))); 505 604 506 605 menu->SetTargetForItems(this); 507 BRect r(screen_point.x - 5, screen_point.y - 5, screen_point.x + 5, screen_point.y + 5); 606 BRect r(screen_point.x - 5, screen_point.y - 5, screen_point.x + 5, 607 screen_point.y + 5); 508 608 menu->Go(screen_point, true, true, r, true); 509 609 } 510 610 511 611 512 612 void 513 MainWin::VideoFormatChange(int width, int height, float width_scale, float height_scale) 613 MainWin::VideoFormatChange(int width, int height, float width_scale, 614 float height_scale) 514 615 { 515 616 // called when video format or aspect ratio changes 516 617 517 printf("VideoFormatChange enter: width %d, height %d, width_scale %.6f, height_scale %.6f\n", width, height, width_scale, height_scale); 618 printf("VideoFormatChange enter: width %d, height %d, width_scale %.6f, " 619 "height_scale %.6f\n", width, height, width_scale, height_scale); 518 620 519 621 if (width_scale < 1.0 && height_scale >= 1.0) { 520 622 width_scale = 1.0 / width_scale; 521 623 height_scale = 1.0 / height_scale; 522 printf("inverting! new values: width_scale %.6f, height_scale %.6f\n", width_scale, height_scale); 624 printf("inverting! new values: width_scale %.6f, height_scale %.6f\n", 625 width_scale, height_scale); 523 626 } 524 627 525 628 fSourceWidth = width; … … 558 661 } 559 662 560 663 561 printf("FrameResized enter: new_width %.0f, new_height %.0f, bounds width %.0f, bounds height %.0f\n", new_width, new_height, Bounds().Width(), Bounds().Height()); 664 printf("FrameResized enter: new_width %.0f, new_height %.0f, bounds width " 665 "%.0f, bounds height %.0f\n", new_width, new_height, Bounds().Width(), 666 Bounds().Height()); 562 667 563 668 if (fIsFullscreen) { 564 669 … … 599 704 MainWin::UpdateWindowTitle() 600 705 { 601 706 char buf[100]; 602 sprintf(buf, "%s - %d x %d, %.3f:%.3f => %.0f x %.0f", NAME, fSourceWidth, fSourceHeight, fWidthScale, fHeightScale, fVideoView->Bounds().Width() + 1, fVideoView->Bounds().Height() + 1); 707 sprintf(buf, "%s - %d x %d, %.3f:%.3f => %.0f x %.0f", NAME, fSourceWidth, 708 fSourceHeight, fWidthScale, fHeightScale, 709 fVideoView->Bounds().Width() + 1, fVideoView->Bounds().Height() + 1); 603 710 SetTitle(buf); 604 711 } 605 712 … … 617 724 float max_height = fBackground->Bounds().Height() + 1.0f; 618 725 float scaled_width = fSourceWidth * fWidthScale; 619 726 float scaled_height = fSourceHeight * fHeightScale; 620 float factor = min_c(max_width / scaled_width, max_height / scaled_height); 727 float factor = min_c(max_width / scaled_width, max_height 728 / scaled_height); 621 729 int render_width = int(scaled_width * factor); 622 730 int render_height = int(scaled_height * factor); 623 731 int x_ofs = (int(max_width) - render_width) / 2; 624 732 int y_ofs = (int(max_height) - render_height) / 2; 625 733 626 printf("AdjustFullscreenRenderer: background %.1f x %.1f, src video %d x %d, " 627 "scaled video %.3f x %.3f, factor %.3f, render %d x %d, x-ofs %d, y-ofs %d\n", 628 max_width, max_height, fSourceWidth, fSourceHeight, scaled_width, scaled_height, 629 factor, render_width, render_height, x_ofs, y_ofs); 734 printf("AdjustFullscreenRenderer: background %.1f x %.1f, src video " 735 "%d x %d, scaled video %.3f x %.3f, factor %.3f, render %d x %d, " 736 "x-ofs %d, y-ofs %d\n", max_width, max_height, fSourceWidth, 737 fSourceHeight, scaled_width, scaled_height, factor, render_width, 738 render_height, x_ofs, y_ofs); 630 739 631 740 fVideoView->MoveTo(x_ofs, y_ofs); 632 741 fVideoView->ResizeTo(render_width - 1, render_height - 1); … … 638 747 // no need to keep aspect ratio, make 639 748 // render cover the whole background 640 749 fVideoView->MoveTo(0, 0); 641 fVideoView->ResizeTo(fBackground->Bounds().Width(), fBackground->Bounds().Height()); 750 fVideoView->ResizeTo(fBackground->Bounds().Width(), 751 fBackground->Bounds().Height()); 642 752 643 753 } 644 754 } … … 652 762 // In windowed mode, the renderer always covers the 653 763 // whole background, accounting for the menu 654 764 fVideoView->MoveTo(0, fNoMenu ? 0 : fMenuBarHeight); 655 fVideoView->ResizeTo(fBackground->Bounds().Width(), fBackground->Bounds().Height() - (fNoMenu ? 0 : fMenuBarHeight)); 765 fVideoView->ResizeTo(fBackground->Bounds().Width(), 766 fBackground->Bounds().Height() - (fNoMenu ? 0 : fMenuBarHeight)); 656 767 657 768 if (fKeepAspectRatio) { 658 769 // To keep the aspect ratio correct, we 659 770 // do resize the window as required 660 771 661 772 float max_width = Bounds().Width() + 1.0f; 662 float max_height = Bounds().Height() + 1.0f - (fNoMenu ? 0 : fMenuBarHeight); 773 float max_height = Bounds().Height() + 1.0f - (fNoMenu ? 0 774 : fMenuBarHeight); 663 775 float scaled_width = fSourceWidth * fWidthScale; 664 776 float scaled_height = fSourceHeight * fHeightScale; 665 777 666 if (!user_resized && (scaled_width > max_width || scaled_height > max_height)) { 778 if (!user_resized && (scaled_width > max_width 779 || scaled_height > max_height)) { 667 780 // A format switch occured, and the window was 668 781 // smaller then the video source. As it was not 669 782 // initiated by the user resizing the window, we 670 783 // enlarge the window to fit the video. 671 784 fIgnoreFrameResized = true; 672 ResizeTo(scaled_width - 1, scaled_height - 1 + (fNoMenu ? 0 : fMenuBarHeight)); 785 ResizeTo(scaled_width - 1, scaled_height - 1 786 + (fNoMenu ? 0 : fMenuBarHeight)); 673 787 // Sync(); 674 788 return; 675 789 } … … 678 792 int new_width = int(max_width); 679 793 int new_height = int(max_width / display_aspect_ratio + 0.5); 680 794 681 printf("AdjustWindowedRenderer: old display %d x %d, src video %d x %d, " 682 "scaled video %.3f x %.3f, aspect ratio %.3f, new display %d x %d\n", 683 int(max_width), int(max_height), fSourceWidth, fSourceHeight, scaled_width, scaled_height, 684 display_aspect_ratio, new_width, new_height); 795 printf("AdjustWindowedRenderer: old display %d x %d, src video " 796 "%d x %d, scaled video %.3f x %.3f, aspect ratio %.3f, new " 797 "display %d x %d\n", int(max_width), int(max_height), 798 fSourceWidth, fSourceHeight, scaled_width, scaled_height, 799 display_aspect_ratio, new_width, new_height); 685 800 686 801 fIgnoreFrameResized = true; 687 ResizeTo(new_width - 1, new_height - 1 + (fNoMenu ? 0 : fMenuBarHeight)); 802 ResizeTo(new_width - 1, new_height - 1 + (fNoMenu ? 0 803 : fMenuBarHeight)); 688 804 // Sync(); 689 805 } 690 806 … … 716 832 printf("ToggleFullscreen enter\n"); 717 833 718 834 if (!fFrameResizedCalled) { 719 printf("ToggleFullscreen - ignoring, as FrameResized wasn't called since last switch\n"); 835 printf("ToggleFullscreen - ignoring, as FrameResized wasn't called " 836 "since last switch\n"); 720 837 return; 721 838 } 722 839 fFrameResizedCalled = false; … … 731 848 // Sync(); 732 849 733 850 fSavedFrame = Frame(); 734 printf("saving current frame: %d %d %d %d\n", int(fSavedFrame.left), int(fSavedFrame.top), int(fSavedFrame.right), int(fSavedFrame.bottom)); 851 printf("saving current frame: %d %d %d %d\n", int(fSavedFrame.left), 852 int(fSavedFrame.top), int(fSavedFrame.right), 853 int(fSavedFrame.bottom)); 735 854 BScreen screen(this); 736 855 BRect rect(screen.Frame()); 737 856 … … 860 979 uint32 raw_char = msg->FindInt32("raw_char"); 861 980 uint32 modifiers = msg->FindInt32("modifiers"); 862 981 863 printf("key 0x%lx, raw_char 0x%lx, modifiers 0x%lx\n", key, raw_char, modifiers); 982 printf("key 0x%lx, raw_char 0x%lx, modifiers 0x%lx\n", key, raw_char, 983 modifiers); 864 984 865 985 switch (raw_char) { 866 986 case B_SPACE: … … 882 1002 break; 883 1003 884 1004 case B_TAB: 885 if ((modifiers & (B_COMMAND_KEY | B_CONTROL_KEY | B_OPTION_KEY | B_MENU_KEY)) == 0) { 1005 if ((modifiers & (B_COMMAND_KEY | B_CONTROL_KEY | B_OPTION_KEY 1006 | B_MENU_KEY)) == 0) { 886 1007 PostMessage(M_TOGGLE_FULLSCREEN); 887 1008 return B_OK; 888 1009 } else … … 974 1095 void 975 1096 MainWin::DispatchMessage(BMessage *msg, BHandler *handler) 976 1097 { 977 if ((msg->what == B_MOUSE_DOWN) && (handler == fBackground || handler == fVideoView)) 1098 if ((msg->what == B_MOUSE_DOWN) && (handler == fBackground 1099 || handler == fVideoView)) 978 1100 MouseDown(msg); 979 if ((msg->what == B_MOUSE_MOVED) && (handler == fBackground || handler == fVideoView)) 1101 if ((msg->what == B_MOUSE_MOVED) && (handler == fBackground 1102 || handler == fVideoView)) 980 1103 MouseMoved(msg); 981 if ((msg->what == B_MOUSE_UP) && (handler == fBackground || handler == fVideoView)) 1104 if ((msg->what == B_MOUSE_UP) && (handler == fBackground 1105 || handler == fVideoView)) 982 1106 MouseUp(msg); 983 1107 984 if ((msg->what == B_KEY_DOWN) && (handler == fBackground || handler == fVideoView)) { 1108 if ((msg->what == B_KEY_DOWN) && (handler == fBackground 1109 || handler == fVideoView)) { 985 1110 986 1111 // special case for PrintScreen key 987 1112 if (msg->FindInt32("key") == B_PRINT_KEY) { … … 1103 1228 break; 1104 1229 1105 1230 case M_FILE_ABOUT: 1106 BAlert *alert; 1107 alert = new BAlert("about", NAME"\n\n" 1108 INFO1 1109 #if TIME_BOMB_ACTIVE 1110 "\n\n" INFO2 1111 #endif 1112 "\n\nCopyright "COPYRIGHT"\nVersion "VERSION"\nRevision "REVISION"\nBuild "BUILD, "OK"); 1113 if (fAlwaysOnTop) { 1114 ToggleAlwaysOnTop(); 1115 alert->Go(); 1116 ToggleAlwaysOnTop(); 1117 } else { 1118 alert->Go(); 1231 { 1232 BString alertStr = fLocalizedName; 1233 alertStr << "\n\n"; 1234 alertStr << fLocalizedInfo1; 1235 #if TIME_BOMB_ACTIVE 1236 alertStr << "\n\n"; 1237 alertStr << INFO2; 1238 #endif 1239 alertStr << "\n\nCopyright "; 1240 alertStr << COPYRIGHT; 1241 alertStr << B_TRANSLATE("\nVersion "); 1242 alertStr << VERSION; 1243 alertStr << B_TRANSLATE("\nRevision "); 1244 if (strcmp(REVISION, "unknown") == 0) 1245 alertStr << fLocalizedRevision; 1246 else 1247 alertStr << REVISION; 1248 alertStr << B_TRANSLATE("\nBuild "); 1249 alertStr << BUILD; 1250 1251 BAlert *alert; 1252 alert = new BAlert("about", alertStr.String(), B_TRANSLATE("OK")); 1253 if (fAlwaysOnTop) { 1254 ToggleAlwaysOnTop(); 1255 alert->Go(); 1256 ToggleAlwaysOnTop(); 1257 } else 1258 alert->Go(); 1119 1259 } 1120 1260 break; 1121 1261 … … 1130 1270 ToggleFullscreen(); 1131 1271 } 1132 1272 ResizeTo(int(fSourceWidth * fWidthScale), 1133 int(fSourceHeight * fHeightScale) + (fNoMenu ? 0 : fMenuBarHeight)); 1273 int(fSourceHeight * fHeightScale) + (fNoMenu ? 0 1274 : fMenuBarHeight)); 1134 1275 // Sync(); 1135 1276 break; 1136 1277 … … 1167 1308 break; 1168 1309 1169 1310 default: 1170 if (msg->what >= M_SELECT_CHANNEL && msg->what <= M_SELECT_CHANNEL_END) { 1311 if (msg->what >= M_SELECT_CHANNEL 1312 && msg->what <= M_SELECT_CHANNEL_END) { 1171 1313 SelectChannel(msg->what - M_SELECT_CHANNEL); 1172 1314 break; 1173 1315 } 1174 if (msg->what >= M_SELECT_INTERFACE && msg->what <= M_SELECT_INTERFACE_END) { 1316 if (msg->what >= M_SELECT_INTERFACE 1317 && msg->what <= M_SELECT_INTERFACE_END) { 1175 1318 SelectInterface(msg->what - M_SELECT_INTERFACE - 1); 1176 1319 break; 1177 1320 } -
src/apps/tv/MainWin.h
25 25 #ifndef __MAIN_WIN_H 26 26 #define __MAIN_WIN_H 27 27 28 #include <Window.h> 28 #include <Button.h> 29 #include <Catalog.h> 30 #include <Locale.h> 29 31 #include <Menu.h> 30 #include <Button.h>31 32 #include <Slider.h> 33 #include <Window.h> 34 32 35 #include "Controller.h" 33 36 #include "VideoView.h" 34 37 -
src/apps/tv/VideoNode.cpp
37 37 #include "VideoView.h" 38 38 39 39 void 40 overlay_copy(uint32 lines, void *dst, uint32 dst_bpr, const void *src, uint32 src_bpr) 40 overlay_copy(uint32 lines, void *dst, uint32 dst_bpr, const void *src, 41 uint32 src_bpr) 41 42 { 42 43 // bigtime_t start = system_time(); 43 44 int len = min_c(dst_bpr, src_bpr); 44 45 // int len4 = len / 4; 45 46 while (lines--) { 46 47 /* 47 // this does not copy the last few bytes, if length is not aligned to 4 bytes 48 // this does not copy the last few bytes, if length is not aligned 49 // to 4 bytes 48 50 asm ("rep\n\t""movsl" 49 51 : 50 52 : "c" (len4), "S" (src), "D" (dst) … … 161 163 const void *data, 162 164 size_t size) 163 165 { 166 if (BBufferConsumer::HandleMessage(message, data, size) == B_OK 167 || BMediaEventLooper::HandleMessage(message, data, size) == B_OK) 168 return B_OK; 169 164 170 return B_ERROR; 165 171 } 166 172 … … 174 180 case BTimedEventQueue::B_START: 175 181 break; 176 182 case BTimedEventQueue::B_STOP: 177 EventQueue()->FlushEvents(event->event_time, BTimedEventQueue::B_ALWAYS, true, BTimedEventQueue::B_HANDLE_BUFFER); 183 EventQueue()->FlushEvents(event->event_time, 184 BTimedEventQueue::B_ALWAYS, true, 185 BTimedEventQueue::B_HANDLE_BUFFER); 178 186 break; 179 187 case BTimedEventQueue::B_HANDLE_BUFFER: 180 188 HandleBuffer((BBuffer *)event->pointer); … … 182 190 default: 183 191 printf("VideoNode::HandleEvent unknown event"); 184 192 break; 185 } 193 } 186 194 } 187 195 188 196 … … 258 266 fInput.format.u.raw_video.field_rate = 25.0; 259 267 260 268 color_space colorspace = format.u.raw_video.display.format; 261 BRect frame(0, 0, format.u.raw_video.display.line_width - 1, format.u.raw_video.display.line_count - 1); 269 BRect frame(0, 0, format.u.raw_video.display.line_width - 1, 270 format.u.raw_video.display.line_count - 1); 262 271 status_t err; 263 272 264 273 DeleteBuffers(); 265 274 err = CreateBuffers(frame, colorspace, fOverlayEnabled); 266 275 if (err) { 267 printf("VideoNode::Connected failed, fOverlayEnabled = %d\n", fOverlayEnabled); 276 printf("VideoNode::Connected failed, fOverlayEnabled = %d\n", 277 fOverlayEnabled); 268 278 return err; 269 279 } 270 280 … … 304 314 return B_MEDIA_BAD_DESTINATION; 305 315 306 316 color_space colorspace = format.u.raw_video.display.format; 307 BRect frame(0, 0, format.u.raw_video.display.line_width - 1, format.u.raw_video.display.line_count - 1); 317 BRect frame(0, 0, format.u.raw_video.display.line_width - 1, 318 format.u.raw_video.display.line_count - 1); 308 319 status_t err; 309 320 310 321 DeleteBuffers(); … … 312 323 fVideoView->RemoveOverlay(); 313 324 err = CreateBuffers(frame, colorspace, true); // try overlay 314 325 if (err) { 315 printf("VideoNode::FormatChanged creating overlay buffer failed\n"); 326 printf("VideoNode::FormatChanged creating overlay buffer " 327 "failed\n"); 316 328 err = CreateBuffers(frame, colorspace, false); // no overlay 317 329 } 318 330 } else { … … 343 355 344 356 // memcpy(fBitmap->Bits(), buffer->Data(), fBitmap->BitsLength()); 345 357 346 // fBitmap->SetBits(buffer->Data(), fBitmap->BitsLength(), 0, fInput.format.u.raw_video.display.format); 358 // fBitmap->SetBits(buffer->Data(), fBitmap->BitsLength(), 0, 359 // fInput.format.u.raw_video.display.format); 347 360 348 361 overlay_copy(fBitmap->Bounds().IntegerHeight() + 1, 349 362 fBitmap->Bits(), fBitmap->BytesPerRow(), 350 buffer->Data(), fInput.format.u.raw_video.display.bytes_per_row); 363 buffer->Data(), 364 fInput.format.u.raw_video.display.bytes_per_row); 351 365 352 366 353 367 fBitmap->UnlockBits(); … … 357 371 358 372 overlay_copy(fBitmap->Bounds().IntegerHeight() + 1, 359 373 fBitmap->Bits(), fBitmap->BytesPerRow(), 360 buffer->Data(), fInput.format.u.raw_video.display.bytes_per_row); 374 buffer->Data(), 375 fInput.format.u.raw_video.display.bytes_per_row); 361 376 } 362 377 // printf("overlay copy: %Ld usec\n", system_time() - start); 363 378 } … … 407 422 status_t 408 423 VideoNode::CreateBuffers(BRect frame, color_space cspace, bool overlay) 409 424 { 410 printf("VideoNode::CreateBuffers: frame %d,%d,%d,%d colorspace 0x%08x, overlay %d\n", 411 int(frame.left), int(frame.top), int(frame.right), int(frame.bottom), int(cspace), overlay); 425 printf("VideoNode::CreateBuffers: frame %d,%d,%d,%d colorspace 0x%08x, " 426 "overlay %d\n", int(frame.left), int(frame.top), int(frame.right), 427 int(frame.bottom), int(cspace), overlay); 412 428 413 429 // int32 bytesPerRow = B_ANY_BYTES_PER_ROW; 414 430 // if (cspace == B_YCbCr422) … … 418 434 419 435 LockBitmap(); 420 436 ASSERT(fBitmap == 0); 421 uint32 flags = overlay ? (B_BITMAP_WILL_OVERLAY | B_BITMAP_RESERVE_OVERLAY_CHANNEL) : 0; 437 uint32 flags = overlay ? (B_BITMAP_WILL_OVERLAY 438 | B_BITMAP_RESERVE_OVERLAY_CHANNEL) : 0; 422 439 // fBitmap = new BBitmap(frame, flags, cspace, bytesPerRow); 423 440 fBitmap = new BBitmap(frame, flags, cspace); 424 441 if (!(fBitmap && fBitmap->InitCheck() == B_OK && fBitmap->IsValid())) { … … 429 446 printf("VideoNode::CreateBuffers failed\n"); 430 447 return B_ERROR; 431 448 } 432 printf("overlay bitmap: got: bytes per row: %ld\n", fBitmap->BytesPerRow()); 449 printf("overlay bitmap: got: bytes per row: %ld\n", 450 fBitmap->BytesPerRow()); 433 451 fOverlayActive = overlay; 434 452 UnlockBitmap(); 435 453 printf("VideoNode::CreateBuffers success\n"); -
src/apps/tv/ConvertBitmap.cpp
37 37 if (dst->Bounds() != src->Bounds()) 38 38 return B_BAD_VALUE; 39 39 40 if (dst->ColorSpace() == src->ColorSpace() && dst->BytesPerRow() == src->BytesPerRow() ) { 40 if (dst->ColorSpace() == src->ColorSpace() 41 && dst->BytesPerRow() == src->BytesPerRow() ) { 41 42 memcpy(dst->Bits(), src->Bits(), src->BitsLength()); 42 43 return B_OK; 43 44 } -
src/apps/tv/MainApp.cpp
33 33 #include "config.h" 34 34 #include "DeviceRoster.h" 35 35 36 #undef B_TRANSLATE_CONTEXT 37 #define B_TRANSLATE_CONTEXT "MainApp" 38 39 36 40 MainApp *gMainApp; 37 41 38 42 bool gOverlayDisabled = false; 39 43 40 44 MainApp::MainApp() 41 : BApplication(APP_SIG) 45 : 46 BApplication(APP_SIG) 42 47 { 43 48 InitPrefs(); 44 49 50 be_locale->GetAppCatalog(&fAppCatalog); 51 45 52 gDeviceRoster = new DeviceRoster; 46 53 47 54 fMainWindow = NewWindow(); -
src/apps/tv/Jamfile
8 8 MainWin.cpp 9 9 VideoNode.cpp 10 10 VideoView.cpp 11 : be media $(TARGET_LIBSUPC++)11 : be locale media $(TARGET_LIBSUPC++) 12 12 : tv.rdef 13 13 ; 14 15 DoCatalogs TV : 16 x-vnd.Haiku.TV 17 : 18 MainApp.cpp 19 MainWin.cpp 20 ; -
src/apps/tv/MainApp.h
38 38 39 39 private: 40 40 BWindow * fMainWindow; 41 BCatalog fAppCatalog; 41 42 }; 42 43 43 44 extern MainApp *gMainApp;