Ticket #6103: tvLocalization.patch

File tvLocalization.patch, 46.0 KB (added by Karvjorm, 10 years ago)

An updated localization patch for TV

  • src/apps/tv/DeviceRoster.cpp

     
    3838    live_node_info info[MAX_DEVICE_COUNT];
    3939    int32 info_count = MAX_DEVICE_COUNT;
    4040    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);
    4243    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));
    4446        fDeviceCount = 0;
    4547    } else {
    4648        fDeviceCount = info_count;
     
    8991    int32           count;
    9092    status_t        err;
    9193
    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);
    9396    return (err == B_OK) && (count == 1);
    9497}
    9598
     
    103106    int32           count;
    104107    status_t        err;
    105108
    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);
    107111    return (err == B_OK) && (count == 1);
    108112}
    109113
     
    117121    int32           count;
    118122    status_t        err;
    119123
    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);
    121126    return (err == B_OK) && (count == 1);
    122127}
    123128
     
    131136    int32           count;
    132137    status_t        err;
    133138
    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);
    135141    return (err == B_OK) && (count == 1);
    136142}
    137143
  • src/apps/tv/VideoView.cpp

     
    3535
    3636#define CHECK_ACTIVITY 'ChkA'
    3737
    38 VideoView::VideoView(BRect frame, const char *name, uint32 resizeMask, uint32 flags)
     38VideoView::VideoView(BRect frame, const char *name, uint32 resizeMask,
     39    uint32 flags)
    3940 :  BView(frame, name, resizeMask, flags)
    4041 ,  fVideoNode(0)
    4142 ,  fVideoActive(false)
     
    7273VideoView::AttachedToWindow()
    7374{
    7475    BMessage msg(CHECK_ACTIVITY);
    75     fActivityCheckMsgRunner = new BMessageRunner(BMessenger(this), &msg, 200000);
     76    fActivityCheckMsgRunner = new BMessageRunner(BMessenger(this), &msg,
     77        200000);
    7678}   
    7779
    7880
     
    9395void
    9496VideoView::OverlayLockRelease()
    9597{ /* [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
    97100   * [19:55] <Francois> it's used when switching workspaces
    98101   * [19:55] <Francois> as the bits might get relocated
    99102   */
     
    139142        if (bmp) {
    140143            DrawBitmap(bmp, Bounds());
    141144            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);
    143147            Invalidate();
    144148        }
    145149    }
     
    231235            UnlockLooper();         
    232236            fOverlayActive = false;
    233237        } else {
    234             printf("can't ClearViewOverlay, as LockLooperWithTimeout failed\n");
     238            printf("can't ClearViewOverlay, as LockLooperWithTimeout "
     239                "failed\n");
    235240        }
    236241    }
    237242    if (want_overlay && !fOverlayActive) {
     
    239244        BBitmap *bmp = fVideoNode->Bitmap();
    240245        if (bmp && LockLooperWithTimeout(50000) == B_OK) {
    241246            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);
    243249            fOverlayActive = true;
    244250
    245251            Invalidate();
     
    363369   
    364370    bool supported = false;
    365371    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);
    367374        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);
    369377            overlay_restrictions restrict;
    370378            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);
    391421            }
    392422            supported = true;
    393423        }
  • src/apps/tv/MainWin.cpp

     
    2828#include "config.h"
    2929#include "DeviceRoster.h"
    3030
    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>
    3336#include <Menu.h>
    3437#include <MenuBar.h>
    3538#include <MenuItem.h>
    36 #include <Application.h>
    37 #include <Alert.h>
    38 #include <stdio.h>
    39 #include <string.h>
    4039#include <Messenger.h>
    4140#include <PopUpMenu.h>
     41#include <Screen.h>
    4242#include <String.h>
     43#include <View.h>
    4344
     45
     46#undef B_TRANSLATE_CONTEXT
     47#define B_TRANSLATE_CONTEXT "MainWin"
     48
     49static const char* fLocalizedName = B_TRANSLATE_MARK("TV");
     50static const char* fLocalizedRevision = B_TRANSLATE_MARK("unknown");
     51static const char* fLocalizedInfo1 = B_TRANSLATE_MARK("DVB - Digital Video Broadcasting TV");
     52
    4453enum
    4554{
    4655    M_DUMMY = 0x100,
     
    6877    M_SELECT_INTERFACE      = 0x00000800,
    6978    M_SELECT_INTERFACE_END  = 0x00000fff,
    7079    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
    7282};
    7383
    7484//#define printf(a...)
    7585
    7686
    7787MainWin::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 */)
    7990 ,  fController(new Controller)
    8091 ,  fIsFullscreen(false)
    8192 ,  fKeepAspectRatio(true)
     
    92103 ,  fFrameResizedCalled(true)
    93104{
    94105    BRect rect = Bounds();
    95 
     106   
    96107    // 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);
    98110    fBackground->SetViewColor(0,0,0);
    99111    AddChild(fBackground);
    100112
     
    108120
    109121    // video view
    110122    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);
    112125    fBackground->AddChild(fVideoView);
    113126
    114127    fVideoView->MakeFocus();
    115128
    116129//  SetSizeLimits(fControlViewMinWidth - 1, 32767,
    117 //      fMenuBarHeight + fControlViewHeight - 1, fMenuBarHeight + fControlViewHeight - 1);
     130//      fMenuBarHeight + fControlViewHeight - 1, fMenuBarHeight
     131//      + fControlViewHeight - 1);
    118132
    119133//  SetSizeLimits(320 - 1, 32767, 240 + fMenuBarHeight - 1, 32767);
    120134
     
    149163MainWin::CreateMenu()
    150164{
    151165    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"));
    156170
    157171    fMenuBar->AddItem(fFileMenu);
    158172    fMenuBar->AddItem(fChannelMenu);
     
    160174    fMenuBar->AddItem(fSettingsMenu);
    161175    fMenuBar->AddItem(fDebugMenu);
    162176
    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)));
    164182    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));
    166185
    167186/*
    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));
    170191    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));
    173196
    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)));
    177203*/
    178204
    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));
    181209    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));
    186218    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));
    188221
    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)));
    196248
    197249    fSettingsMenu->ItemAt(1)->SetMarked(fIsFullscreen);
    198250    fSettingsMenu->ItemAt(3)->SetMarked(fNoMenu);
    199251    fSettingsMenu->ItemAt(4)->SetMarked(fNoBorder);
    200252    fSettingsMenu->ItemAt(5)->SetMarked(fAlwaysOnTop);
    201253    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
    203256}
    204257
    205258
     
    208261{
    209262    fInterfaceMenu->RemoveItems(0, fInterfaceMenu->CountItems(), true);
    210263
    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)));
    212266
    213267    int count = gDeviceRoster->DeviceCount();
    214268
     
    216270        fInterfaceMenu->AddSeparatorItem();
    217271
    218272    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)));
    221277    }
    222278}
    223279
     
    233289    int channels = fController->ChannelCount();
    234290
    235291    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)));
    237294    } 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));
    240299        fChannelMenu->AddSeparatorItem();
    241300    }
    242301
     
    318377
    319378    if (!fController->IsInterfaceAvailable(i)) {
    320379        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();
    323383        return;
    324384    }
    325385
    326386    fController->DisconnectInterface();
    327387    if (fController->ConnectInterface(i) != B_OK) {
    328388        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();
    331392    }
    332393
    333394done:
     
    348409
    349410    int count = gDeviceRoster->DeviceCount();
    350411    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);
    353416            break;
    354417        }
    355418    }
     
    372435    BPoint screen_where;
    373436    uint32 buttons = msg->FindInt32("buttons");
    374437
    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
    376440    if (B_OK != msg->FindPoint("screen_where", &screen_where)) {
    377441        // Workaround for BeOS R5, it has no "screen_where"
    378442        fVideoView->GetMouse(&screen_where, &buttons, false);
     
    384448//  if (1 == msg->FindInt32("buttons") && msg->FindInt32("clicks") == 1) {
    385449
    386450    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);
    388453        if (r.Contains(fMouseDownMousePos)) {
    389454            PostMessage(M_TOGGLE_FULLSCREEN);
    390455            return;
     
    392457    }
    393458
    394459    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);
    396462        if (r.Contains(fMouseDownMousePos)) {
    397463            PostMessage(M_TOGGLE_NO_BORDER_NO_MENU);
    398464            return;
     
    401467
    402468/*
    403469        // very broken in Zeta:
    404         fMouseDownMousePos = fVideoView->ConvertToScreen(msg->FindPoint("where"));
     470        fMouseDownMousePos = fVideoView->ConvertToScreen(
     471            msg->FindPoint("where"));
    405472*/
    406473    fMouseDownMousePos = screen_where;
    407474    fMouseDownWindowPos = Frame().LeftTop();
    408475
    409476    if (buttons == 1 && !fIsFullscreen) {
    410477        // 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 */);
    412480        fMouseDownTracking = true;
    413481    }
    414482
     
    446514        printf("view where: %.0f, %.0f => ", mousePos.x, mousePos.y);
    447515        fVideoView->ConvertToScreen(&mousePos);
    448516*/
    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
    450519        if (B_OK != msg->FindPoint("screen_where", &mousePos)) {
    451520            // Workaround for BeOS R5, it has no "screen_where"
    452521            fVideoView->GetMouse(&mousePos, &buttons, false);
     
    477546    printf("Show context menu\n");
    478547    BPopUpMenu *menu = new BPopUpMenu("context menu", false, false);
    479548    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));
    482553    item->SetMarked(fIsFullscreen);
    483554    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));
    485557    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));
    487560    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));
    489563    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));
    491566    item->SetMarked(fKeepAspectRatio);
    492567    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)));
    494573    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));
    496576
    497577    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)));
    505604
    506605    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);
    508608    menu->Go(screen_point, true, true, r, true);
    509609}
    510610
    511611
    512612void
    513 MainWin::VideoFormatChange(int width, int height, float width_scale, float height_scale)
     613MainWin::VideoFormatChange(int width, int height, float width_scale,
     614    float height_scale)
    514615{
    515616    // called when video format or aspect ratio changes
    516617
    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);
    518620
    519621    if (width_scale < 1.0 && height_scale >= 1.0) {
    520622        width_scale  = 1.0 / width_scale;
    521623        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);
    523626    }
    524627
    525628    fSourceWidth  = width;
     
    558661    }
    559662
    560663
    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());
    562667
    563668    if (fIsFullscreen) {
    564669
     
    599704MainWin::UpdateWindowTitle()
    600705{
    601706    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);
    603710    SetTitle(buf);
    604711}
    605712
     
    617724        float max_height = fBackground->Bounds().Height() + 1.0f;
    618725        float scaled_width  = fSourceWidth * fWidthScale;
    619726        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);
    621729        int render_width = int(scaled_width * factor);
    622730        int render_height = int(scaled_height * factor);
    623731        int x_ofs = (int(max_width) - render_width) / 2;
    624732        int y_ofs = (int(max_height) - render_height) / 2;
    625733
    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);
    630739
    631740        fVideoView->MoveTo(x_ofs, y_ofs);
    632741        fVideoView->ResizeTo(render_width - 1, render_height - 1);
     
    638747        // no need to keep aspect ratio, make
    639748        // render cover the whole background
    640749        fVideoView->MoveTo(0, 0);
    641         fVideoView->ResizeTo(fBackground->Bounds().Width(), fBackground->Bounds().Height());
     750        fVideoView->ResizeTo(fBackground->Bounds().Width(),
     751            fBackground->Bounds().Height());
    642752
    643753    }
    644754}
     
    652762    // In windowed mode, the renderer always covers the
    653763    // whole background, accounting for the menu
    654764    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));
    656767
    657768    if (fKeepAspectRatio) {
    658769        // To keep the aspect ratio correct, we
    659770        // do resize the window as required
    660771
    661772        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);
    663775        float scaled_width  = fSourceWidth * fWidthScale;
    664776        float scaled_height = fSourceHeight * fHeightScale;
    665777
    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)) {
    667780            // A format switch occured, and the window was
    668781            // smaller then the video source. As it was not
    669782            // initiated by the user resizing the window, we
    670783            // enlarge the window to fit the video.
    671784            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));
    673787//          Sync();
    674788            return;
    675789        }
     
    678792        int new_width  = int(max_width);
    679793        int new_height = int(max_width / display_aspect_ratio + 0.5);
    680794
    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);
    685800
    686801        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));
    688804//      Sync();
    689805    }
    690806
     
    716832    printf("ToggleFullscreen enter\n");
    717833
    718834    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");
    720837        return;
    721838    }
    722839    fFrameResizedCalled = false;
     
    731848//      Sync();
    732849
    733850        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));
    735854        BScreen screen(this);
    736855        BRect rect(screen.Frame());
    737856
     
    860979    uint32 raw_char  = msg->FindInt32("raw_char");
    861980    uint32 modifiers = msg->FindInt32("modifiers");
    862981
    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);
    864984
    865985    switch (raw_char) {
    866986        case B_SPACE:
     
    8821002                break;
    8831003
    8841004        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) {
    8861007                PostMessage(M_TOGGLE_FULLSCREEN);
    8871008                return B_OK;
    8881009            } else
     
    9741095void
    9751096MainWin::DispatchMessage(BMessage *msg, BHandler *handler)
    9761097{
    977     if ((msg->what == B_MOUSE_DOWN) && (handler == fBackground || handler == fVideoView))
     1098    if ((msg->what == B_MOUSE_DOWN) && (handler == fBackground
     1099        || handler == fVideoView))
    9781100        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))
    9801103        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))
    9821106        MouseUp(msg);
    9831107
    984     if ((msg->what == B_KEY_DOWN) && (handler == fBackground || handler == fVideoView)) {
     1108    if ((msg->what == B_KEY_DOWN) && (handler == fBackground
     1109        || handler == fVideoView)) {
    9851110
    9861111        // special case for PrintScreen key
    9871112        if (msg->FindInt32("key") == B_PRINT_KEY) {
     
    11031228            break;
    11041229
    11051230        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();
    11191259            }
    11201260            break;
    11211261
     
    11301270                ToggleFullscreen();
    11311271            }
    11321272            ResizeTo(int(fSourceWidth * fWidthScale),
    1133                      int(fSourceHeight * fHeightScale) + (fNoMenu ? 0 : fMenuBarHeight));
     1273                     int(fSourceHeight * fHeightScale) + (fNoMenu ? 0
     1274                        : fMenuBarHeight));
    11341275//          Sync();
    11351276            break;
    11361277
     
    11671308            break;
    11681309
    11691310        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) {
    11711313                SelectChannel(msg->what - M_SELECT_CHANNEL);
    11721314                break;
    11731315            }
    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) {
    11751318                SelectInterface(msg->what - M_SELECT_INTERFACE - 1);
    11761319                break;
    11771320            }
  • src/apps/tv/MainWin.h

     
    2525#ifndef __MAIN_WIN_H
    2626#define __MAIN_WIN_H
    2727
    28 #include <Window.h>
     28#include <Button.h>
     29#include <Catalog.h>
     30#include <Locale.h>
    2931#include <Menu.h>
    30 #include <Button.h>
    3132#include <Slider.h>
     33#include <Window.h>
     34
    3235#include "Controller.h"
    3336#include "VideoView.h"
    3437
  • src/apps/tv/VideoNode.cpp

     
    3737#include "VideoView.h"
    3838
    3939void
    40 overlay_copy(uint32 lines, void *dst, uint32 dst_bpr, const void *src, uint32 src_bpr)
     40overlay_copy(uint32 lines, void *dst, uint32 dst_bpr, const void *src,
     41    uint32 src_bpr)
    4142{
    4243//  bigtime_t start = system_time();
    4344    int len = min_c(dst_bpr, src_bpr);
    4445//  int len4 = len / 4;
    4546    while (lines--) {
    4647/*
    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
    4850        asm ("rep\n\t""movsl"
    4951             :
    5052             : "c" (len4), "S" (src), "D" (dst)
     
    161163                          const void *data,
    162164                          size_t size)
    163165{
     166    if (BBufferConsumer::HandleMessage(message, data, size) == B_OK
     167        || BMediaEventLooper::HandleMessage(message, data, size) == B_OK)
     168        return B_OK;
     169
    164170    return B_ERROR;
    165171}
    166172
     
    174180        case BTimedEventQueue::B_START:
    175181            break;
    176182        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);
    178186            break;
    179187        case BTimedEventQueue::B_HANDLE_BUFFER:
    180188            HandleBuffer((BBuffer *)event->pointer);
     
    182190        default:
    183191            printf("VideoNode::HandleEvent unknown event");
    184192            break;
    185     }           
     193    }
    186194}
    187195
    188196
     
    258266        fInput.format.u.raw_video.field_rate = 25.0;
    259267
    260268    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);
    262271    status_t    err;
    263272
    264273    DeleteBuffers();
    265274    err = CreateBuffers(frame, colorspace, fOverlayEnabled);
    266275    if (err) {
    267         printf("VideoNode::Connected failed, fOverlayEnabled = %d\n", fOverlayEnabled);
     276        printf("VideoNode::Connected failed, fOverlayEnabled = %d\n",
     277            fOverlayEnabled);
    268278        return err;
    269279    }   
    270280
     
    304314        return B_MEDIA_BAD_DESTINATION;
    305315
    306316    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);
    308319    status_t    err;
    309320
    310321    DeleteBuffers();
     
    312323        fVideoView->RemoveOverlay();
    313324        err = CreateBuffers(frame, colorspace, true); // try overlay
    314325        if (err) {
    315             printf("VideoNode::FormatChanged creating overlay buffer failed\n");
     326            printf("VideoNode::FormatChanged creating overlay buffer "
     327                "failed\n");
    316328            err = CreateBuffers(frame, colorspace, false); // no overlay
    317329        }
    318330    } else {
     
    343355
    344356//              memcpy(fBitmap->Bits(), buffer->Data(), fBitmap->BitsLength());
    345357
    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);
    347360
    348361                overlay_copy(fBitmap->Bounds().IntegerHeight() + 1,
    349362                             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);
    351365
    352366                           
    353367                fBitmap->UnlockBits();
     
    357371
    358372            overlay_copy(fBitmap->Bounds().IntegerHeight() + 1,
    359373                         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);
    361376        }
    362377//      printf("overlay copy: %Ld usec\n", system_time() - start);
    363378    }
     
    407422status_t
    408423VideoNode::CreateBuffers(BRect frame, color_space cspace, bool overlay)
    409424{
    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);
    412428
    413429//  int32 bytesPerRow = B_ANY_BYTES_PER_ROW;
    414430//  if (cspace == B_YCbCr422)
     
    418434
    419435    LockBitmap();
    420436    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;
    422439//  fBitmap = new BBitmap(frame, flags, cspace, bytesPerRow);
    423440    fBitmap = new BBitmap(frame, flags, cspace);
    424441    if (!(fBitmap && fBitmap->InitCheck() == B_OK && fBitmap->IsValid())) {
     
    429446        printf("VideoNode::CreateBuffers failed\n");
    430447        return B_ERROR;
    431448    }
    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());
    433451    fOverlayActive = overlay;
    434452    UnlockBitmap();
    435453    printf("VideoNode::CreateBuffers success\n");
  • src/apps/tv/ConvertBitmap.cpp

     
    3737    if (dst->Bounds() != src->Bounds())
    3838        return B_BAD_VALUE;
    3939   
    40     if (dst->ColorSpace() == src->ColorSpace() && dst->BytesPerRow() == src->BytesPerRow() ) {
     40    if (dst->ColorSpace() == src->ColorSpace()
     41        && dst->BytesPerRow() == src->BytesPerRow() ) {
    4142        memcpy(dst->Bits(), src->Bits(), src->BitsLength());
    4243        return B_OK;
    4344    }
  • src/apps/tv/MainApp.cpp

     
    3333#include "config.h"
    3434#include "DeviceRoster.h"
    3535
     36#undef B_TRANSLATE_CONTEXT
     37#define B_TRANSLATE_CONTEXT "MainApp"
     38
     39
    3640MainApp *gMainApp;
    3741
    3842bool gOverlayDisabled = false;
    3943
    4044MainApp::MainApp()
    41  :  BApplication(APP_SIG)
     45 :
     46 BApplication(APP_SIG)
    4247{
    4348    InitPrefs();
    4449   
     50    be_locale->GetAppCatalog(&fAppCatalog);
     51   
    4552    gDeviceRoster = new DeviceRoster;
    4653   
    4754    fMainWindow = NewWindow();
  • src/apps/tv/Jamfile

     
    88    MainWin.cpp
    99    VideoNode.cpp
    1010    VideoView.cpp
    11     : be media $(TARGET_LIBSUPC++)
     11    : be locale media $(TARGET_LIBSUPC++)
    1212    : tv.rdef
    1313;
     14
     15DoCatalogs TV :
     16    x-vnd.Haiku.TV
     17    :
     18    MainApp.cpp
     19    MainWin.cpp
     20;
  • src/apps/tv/MainApp.h

     
    3838
    3939private:   
    4040    BWindow *       fMainWindow;
     41    BCatalog        fAppCatalog;
    4142};
    4243
    4344extern MainApp *gMainApp;