Ticket #2117: 2117.diff

File 2117.diff, 39.2 KB (added by maxime.simon, 10 years ago)

(TIFF, RAW, PPM, EXR, GIF, TGA) These Translators's about box now use the layout manager to be font sensitive.

  • src/add-ons/translators/tiff/TIFFTranslator.cpp

     
    945945BView *
    946946TIFFTranslator::NewConfigView(TranslatorSettings *settings)
    947947{
    948     return new TIFFView(BRect(0, 0, 225, 175), "TIFFTranslator Settings",
    949         B_FOLLOW_ALL, B_WILL_DRAW, settings);
     948    return new TIFFView("TIFFTranslator Settings", B_WILL_DRAW, settings);
    950949}
  • src/add-ons/translators/tiff/TIFFView.cpp

     
    3232#include <stdio.h>
    3333#include <string.h>
    3434
     35#include <GridLayoutBuilder.h>
     36#include <GroupLayout.h>
     37#include <GroupLayoutBuilder.h>
    3538#include <MenuBar.h>
    3639#include <MenuField.h>
    3740#include <MenuItem.h>
     
    7376//
    7477// Returns:
    7578// ---------------------------------------------------------------
    76 TIFFView::TIFFView(const BRect &frame, const char *name,
    77     uint32 resize, uint32 flags, TranslatorSettings *settings)
    78     :   BView(frame, name, resize, flags)
     79TIFFView::TIFFView(const char *name, uint32 flags, TranslatorSettings *settings)
     80    :   BView(name, flags)
    7981{
    8082    fSettings = settings;
    8183
    8284    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    8385    SetLowColor(ViewColor());
    8486
     87    fTitle = new BStringView("title", "TIFF Image Translator");
     88    fTitle->SetFont(be_bold_font);
     89
     90    char detail[100];
     91    sprintf(detail, "Version %d.%d.%d %s",
     92        static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TIFF_TRANSLATOR_VERSION)),
     93        static_cast<int>(B_TRANSLATION_MINOR_VERSION(TIFF_TRANSLATOR_VERSION)),
     94        static_cast<int>(B_TRANSLATION_REVISION_VERSION(TIFF_TRANSLATOR_VERSION)),
     95        __DATE__);
     96    fDetail = new BStringView("detail", detail);
     97
     98    int16 i = 1;
     99    fLibTIFF[0] = new BStringView(NULL, "TIFF Library:");
     100    char libtiff[] = TIFFLIB_VERSION_STR;
     101    char *tok = strtok(libtiff, "\n");
     102    while (i < 5 && tok) {
     103        fLibTIFF[i] = new BStringView(NULL, tok);
     104        tok = strtok(NULL, "\n");
     105        i++;
     106    }
     107
    85108    BPopUpMenu* menu = new BPopUpMenu("pick compression");
    86109
    87110    uint32 currentCompression = fSettings->SetGetInt32(TIFF_SETTING_COMPRESSION);
     
    98121// TODO ? - strip encoding is not implemented in libTIFF for this compression
    99122//  add_menu_item(menu, COMPRESSION_JP2000, "JPEG2000", currentCompression);
    100123
    101     fCompressionMF = new BMenuField(BRect(20, 50, 215, 70), "compression",
    102                                     "Use Compression:", menu, true);
    103     fCompressionMF->ResizeToPreferred();
    104     fCompressionMF->SetDivider(
    105         fCompressionMF->StringWidth(fCompressionMF->Label()) + 7);
    106     AddChild(fCompressionMF);
     124    fCompressionMF = new BMenuField("Use Compression:", menu, NULL);
    107125
     126    // Build the layout
     127    SetLayout(new BGroupLayout(B_VERTICAL));
     128
     129    i = 0;
     130    AddChild(BGroupLayoutBuilder(B_VERTICAL, 7)
     131        .Add(fTitle)
     132        .Add(fDetail)
     133        .AddGlue()
     134        .Add(fCompressionMF)
     135        .AddGlue()
     136        .Add(fLibTIFF[0])
     137        .Add(fLibTIFF[1])
     138        .Add(fLibTIFF[2])
     139        .Add(fLibTIFF[3])
     140            // Theses 4 adding above work because we know there are 4 strings
     141            // but it's fragile: one string less in the library version and the application breaks
     142        .AddGlue()
     143        .SetInsets(5, 5, 5, 5)
     144    );
     145
     146    BFont font;
     147    GetFont(&font);
     148    SetExplicitPreferredSize(BSize((font.Size() * 350)/12, (font.Size() * 200)/12));
    108149}
    109150
    110151// ---------------------------------------------------------------
     
    148189                fSettings->SetGetInt32(TIFF_SETTING_COMPRESSION, &value);
    149190                fSettings->SaveSettings();
    150191            }
    151             fCompressionMF->ResizeToPreferred();
    152192            break;
    153193        }
    154194        default:
     
    177217    fCompressionMF->ResizeToPreferred();
    178218}
    179219
    180 
    181 // ---------------------------------------------------------------
    182 // Draw
    183 //
    184 // Draws information about the TIFFTranslator to this view.
    185 //
    186 // Preconditions:
    187 //
    188 // Parameters: area,    not used
    189 //
    190 // Postconditions:
    191 //
    192 // Returns:
    193 // ---------------------------------------------------------------
    194 void
    195 TIFFView::Draw(BRect area)
    196 {
    197     SetFont(be_bold_font);
    198     font_height fh;
    199     GetFontHeight(&fh);
    200     float xbold, ybold;
    201     xbold = fh.descent + 1;
    202     ybold = fh.ascent + fh.descent * 2 + fh.leading;
    203    
    204     char title[] = "TIFF Image Translator";
    205     DrawString(title, BPoint(xbold, ybold));
    206    
    207     SetFont(be_plain_font);
    208     font_height plainh;
    209     GetFontHeight(&plainh);
    210     float yplain;
    211     yplain = plainh.ascent + plainh.descent * 2 + plainh.leading;
    212    
    213     char detail[100];
    214     sprintf(detail, "Version %d.%d.%d %s",
    215         static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TIFF_TRANSLATOR_VERSION)),
    216         static_cast<int>(B_TRANSLATION_MINOR_VERSION(TIFF_TRANSLATOR_VERSION)),
    217         static_cast<int>(B_TRANSLATION_REVISION_VERSION(TIFF_TRANSLATOR_VERSION)),
    218         __DATE__);
    219     DrawString(detail, BPoint(xbold, yplain + ybold));
    220    
    221     int32 lineno = 6;
    222     DrawString("TIFF Library:", BPoint(xbold, yplain * lineno + ybold));
    223     lineno += 2;
    224    
    225     char libtiff[] = TIFFLIB_VERSION_STR;
    226     char *tok = strtok(libtiff, "\n");
    227     while (tok) {
    228         DrawString(tok, BPoint(xbold, yplain * lineno + ybold));
    229         lineno++;
    230         tok = strtok(NULL, "\n");
    231     }
    232 }
  • src/add-ons/translators/tiff/TIFFMain.cpp

     
    5454{
    5555    BApplication app("application/x-vnd.obos-tiff-translator");
    5656    status_t result;
    57     result = LaunchTranslatorWindow(new TIFFTranslator,
    58         "TIFF Settings", BRect(0, 0, 225, 175));
     57    result = LaunchTranslatorWindow(new TIFFTranslator, "TIFF Settings");
    5958    if (result == B_OK) {
    6059        app.Run();
    6160        return 0;
  • src/add-ons/translators/tiff/TIFFView.h

     
    3434
    3535#include <View.h>
    3636#include <MenuField.h>
     37#include <StringView.h>
    3738#include "TranslatorSettings.h"
    3839
    3940class TIFFView : public BView {
    4041public:
    41     TIFFView(const BRect &frame, const char *name, uint32 resize,
    42         uint32 flags, TranslatorSettings *settings);
     42    TIFFView(const char *name, uint32 flags, TranslatorSettings *settings);
    4343        // sets up the view
    4444       
    4545    ~TIFFView();
     
    4848    virtual void AllAttached();
    4949    virtual void MessageReceived(BMessage *message);
    5050
    51     virtual void Draw(BRect area);
    52         // draws information about the TIFFTranslator
    53 
    5451    enum {
    5552        MSG_COMPRESSION_CHANGED = 'cmch',
    5653    };
    5754
    5855private:
     56    BStringView*            fTitle;
     57    BStringView*            fDetail;
     58    BStringView*            fLibTIFF[5];
    5959    BMenuField*             fCompressionMF;
    6060
    6161    TranslatorSettings *fSettings;
  • src/add-ons/translators/raw/ConfigView.cpp

     
    99
    1010#include <StringView.h>
    1111#include <CheckBox.h>
     12#include <GroupLayout.h>
     13#include <GroupLayoutBuilder.h>
    1214
    1315#include <stdio.h>
    1416#include <string.h>
    1517
    1618
    17 ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
    18     : BView(frame, "RAWTranslator Settings", resize, flags)
     19ConfigView::ConfigView(uint32 flags)
     20    : BView("RAWTranslator Settings", flags)
    1921{
    2022    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    2123
    22     font_height fontHeight;
    23     be_bold_font->GetHeight(&fontHeight);
    24     float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
     24    BStringView *fTitle = new BStringView("title", "RAW Images");
     25    fTitle->SetFont(be_bold_font);
    2526
    26     BRect rect(10, 10, 200, 10 + height);
    27     BStringView *stringView = new BStringView(rect, "title", "RAW Images");
    28     stringView->SetFont(be_bold_font);
    29     stringView->ResizeToPreferred();
    30     AddChild(stringView);
    31 
    32     rect.OffsetBy(0, height + 10);
    3327    char version[256];
    3428    sprintf(version, "Version %d.%d.%d, %s",
    3529        int(B_TRANSLATION_MAJOR_VERSION(RAW_TRANSLATOR_VERSION)),
    3630        int(B_TRANSLATION_MINOR_VERSION(RAW_TRANSLATOR_VERSION)),
    3731        int(B_TRANSLATION_REVISION_VERSION(RAW_TRANSLATOR_VERSION)),
    3832        __DATE__);
    39     stringView = new BStringView(rect, "version", version);
    40     stringView->ResizeToPreferred();
    41     AddChild(stringView);
     33    BStringView *fVersion = new BStringView("version", version);
    4234
    43     GetFontHeight(&fontHeight);
    44     height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
     35    BStringView *fCopyright = new BStringView("copyright",
     36        B_UTF8_COPYRIGHT "2007 Haiku Inc.");
    4537
    46     rect.OffsetBy(0, height + 5);
    47     stringView = new BStringView(rect, "copyright", B_UTF8_COPYRIGHT "2007 Haiku Inc.");
    48     stringView->ResizeToPreferred();
    49     AddChild(stringView);
     38    BStringView *fCopyright2 = new BStringView("copyright2",
     39        "Based on Dave Coffin's dcraw 8.63");
    5040
    51     rect.OffsetBy(0, height + 10);
    52     stringView = new BStringView(rect, "copyright2", "Based on Dave Coffin's dcraw 8.63");
    53     stringView->ResizeToPreferred();
    54     AddChild(stringView);
     41    BStringView *fCopyright3 = new BStringView("copyright3",
     42        B_UTF8_COPYRIGHT "1997-2007 Dave Coffin");
    5543
    56     rect.OffsetBy(0, height + 5);
    57     stringView = new BStringView(rect, "copyright3", B_UTF8_COPYRIGHT "1997-2007 Dave Coffin");
    58     stringView->ResizeToPreferred();
    59     AddChild(stringView);
     44    // Build the layout
     45    SetLayout(new BGroupLayout(B_HORIZONTAL));
     46
     47    AddChild(BGroupLayoutBuilder(B_VERTICAL, 7)
     48        .Add(fTitle)
     49        .AddGlue()
     50        .Add(fVersion)
     51        .Add(fCopyright)
     52        .AddGlue()
     53        .Add(fCopyright2)
     54        .Add(fCopyright3)
     55        .AddGlue()
     56        .SetInsets(5, 5, 5, 5)
     57    );
     58
     59    BFont font;
     60    GetFont(&font);
     61    SetExplicitPreferredSize(BSize((font.Size() * 233)/12, (font.Size() * 200)/12));
    6062}
    6163
    6264
  • src/add-ons/translators/raw/RAWTranslator.cpp

     
    326326BView *
    327327RAWTranslator::NewConfigView(TranslatorSettings *settings)
    328328{
    329     return new ConfigView(BRect(0, 0, 225, 175));
     329    return new ConfigView();
    330330}
    331331
    332332
  • src/add-ons/translators/raw/main.cpp

     
    1515#if SHOW_MODE && TEST_MODE
    1616#   include <Bitmap.h>
    1717#   include <BitmapStream.h>
     18#   include <GroupLayout.h>
    1819#   include <String.h>
    1920#   include <View.h>
    2021#   include <Window.h>
     
    114115                    if (status == B_OK)
    115116                        status = output.DetachBitmap(&bitmap);
    116117                    if (status == B_OK) {
    117                         BWindow* window = new BWindow(BRect(50, 50,
    118                                 bitmap->Bounds().Width() + 50,
    119                                 bitmap->Bounds().Height() + 50),
     118                        BWindow* window = new BWindow(BRect(0, 0, 1, 1),
    120119                            "RAW", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS
    121                             | B_NOT_RESIZABLE);
     120                            | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS);
    122121                        BView* view = new BView(window->Bounds(), NULL,
    123122                            B_WILL_DRAW, B_FOLLOW_NONE);
    124123                        window->AddChild(view);
     124                        window->SetLayout(new BGroupLayout(B_HORIZONTAL));
    125125                        window->Show();
    126126                        snooze(300000);
    127127                        window->Lock();
     
    140140    }
    141141#endif
    142142
    143     status_t status = LaunchTranslatorWindow(new RAWTranslator, "RAW Settings",
    144         BRect(0, 0, 225, 175));
     143    status_t status = LaunchTranslatorWindow(new RAWTranslator, "RAW Settings");
    145144    if (status != B_OK)
    146145        return 1;
    147146
  • src/add-ons/translators/raw/ConfigView.h

     
    1111
    1212class ConfigView : public BView {
    1313    public:
    14         ConfigView(const BRect &frame, uint32 resize = B_FOLLOW_ALL,
    15             uint32 flags = B_WILL_DRAW);   
     14        ConfigView(uint32 flags = B_WILL_DRAW);
    1615        virtual ~ConfigView();
    1716};
    1817
  • src/add-ons/translators/ppm/PPMMain.cpp

     
    99#include <Application.h>
    1010#include <Alert.h>
    1111#include <Screen.h>
     12#include <GroupLayout.h>
    1213
    1314#include <stdio.h>
    1415
     
    2021    public BWindow
    2122{
    2223public:
    23     PPMWindow(
    24             BRect area) :
    25         BWindow(area, "PPM Settings", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
     24    PPMWindow(BRect area) :
     25        BWindow(area, "PPM Settings", B_TITLED_WINDOW,
     26            B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
    2627        {
     28            SetLayout(new BGroupLayout(B_HORIZONTAL));
    2729        }
    2830    ~PPMWindow()
    2931        {
     
    3941{
    4042    BApplication app("application/x-vnd.hplus-ppm-translator");
    4143    BView * v = NULL;
    42     BRect r(0,0,225,175);
     44    BRect r(0, 0, 1, 1);
    4345    if (MakeConfig(NULL, &v, &r)) {
    4446        BAlert * err = new BAlert("Error", "Something is wrong with the PPMTranslator!", "OK");
    4547        err->Go();
  • src/add-ons/translators/ppm/PPMTranslator.cpp

     
    2121#include <MenuItem.h>
    2222#include <CheckBox.h>
    2323#include <Bitmap.h>
     24#include <StringView.h>
     25#include <GridLayoutBuilder.h>
     26#include <GroupLayout.h>
     27#include <GroupLayoutBuilder.h>
     28#include <SpaceLayoutItem.h>
    2429
    2530#include <ctype.h>
    2631#include <string.h>
     
    430435{
    431436public:
    432437        PPMView(
    433                 const BRect & frame,
    434438                const char * name,
    435                 uint32 resize,
    436439                uint32 flags) :
    437             BView(frame, name, resize, flags)
     440            BView(name, flags)
    438441            {
    439442                SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    440443                SetLowColor(ViewColor());
     444
     445                mTitle = new BStringView("title", "PPM Image Translator");
     446                mTitle->SetFont(be_bold_font);
     447
     448                char detail[100];
     449                int ver = static_cast<int>(translatorVersion);
     450                sprintf(detail, "Version %d.%d.%d %s", ver >> 8, ((ver >> 4) & 0xf),
     451                    (ver & 0xf), __DATE__);
     452                mDetail = new BStringView("detail", detail);
     453
     454                mBasedOn = new BStringView("basedOn",
     455                    "Based on PPMTranslator sample code");
     456
     457                mCopyright = new BStringView("copyright",
     458                    "Sample code copyright 1999, Be Incorporated");
     459
    441460                mMenu = new BPopUpMenu("Color Space");
    442461                mMenu->AddItem(new BMenuItem("None", CSMessage(B_NO_COLOR_SPACE)));
    443462                mMenu->AddItem(new BMenuItem("RGB 8:8:8 32 bits", CSMessage(B_RGB32)));
     
    458477                mMenu->AddItem(new BMenuItem("RGB 5:5:5 16 bits big-endian", CSMessage(B_RGB15_BIG)));
    459478                mMenu->AddItem(new BMenuItem("RGBA 5:5:5:1 16 bits big-endian", CSMessage(B_RGBA15_BIG)));
    460479                mMenu->AddItem(new BMenuItem("RGB 5:6:5 16 bits big-endian", CSMessage(B_RGB16)));
    461                 mField = new BMenuField(BRect(10,110,190,130), "Color Space Field", "Input Color Space", mMenu);
    462                 mField->SetDivider(mField->StringWidth(mField->Label()) + 7);
     480                mField = new BMenuField("Input Color Space", mMenu, NULL);
    463481                mField->SetViewColor(ViewColor());
    464                 AddChild(mField);
    465482                SelectColorSpace(g_settings.out_space);
    466483                BMessage * msg = new BMessage(CHANGE_ASCII);
    467                 mAscii = new BCheckBox(BRect(10,135,170,155), "Write ASCII", "Write ASCII", msg);
    468                 if (g_settings.write_ascii) {
     484                mAscii = new BCheckBox("Write ASCII", msg);
     485                if (g_settings.write_ascii)
    469486                    mAscii->SetValue(1);
    470                 }
    471487                mAscii->SetViewColor(ViewColor());
    472                 AddChild(mAscii);
     488
     489                // Build the layout
     490                SetLayout(new BGroupLayout(B_HORIZONTAL));
     491
     492                AddChild(BGroupLayoutBuilder(B_VERTICAL, 7)
     493                    .Add(mTitle)
     494                    .Add(mDetail)
     495                    .AddGlue()
     496                    .Add(mBasedOn)
     497                    .Add(mCopyright)
     498                    .AddGlue()
     499                    .Add(BGridLayoutBuilder(10, 10)
     500                        .Add(mField->CreateLabelLayoutItem(), 0, 0)
     501                        .Add(mField->CreateMenuBarLayoutItem(), 1, 0)
     502                        .Add(mAscii, 0, 1)
     503                    )
     504                    .AddGlue()
     505                    .SetInsets(5, 5, 5, 5)
     506                );
     507
     508                BFont font;
     509                GetFont(&font);
     510                SetExplicitPreferredSize(BSize((font.Size() * 350)/12, (font.Size() * 200)/12));
    473511            }
    474512        ~PPMView()
    475513            {
     
    481519            CHANGE_ASCII
    482520        };
    483521
    484 virtual void Draw(
    485                 BRect area)
    486             {
    487                 SetFont(be_bold_font);
    488                 font_height fh;
    489                 GetFontHeight(&fh);
    490                 float xbold, ybold;
    491                 xbold = fh.descent + 1;
    492                 ybold = fh.ascent + fh.descent * 2 + fh.leading;
    493    
    494                 char title[] = "PPM Image Translator";
    495                 DrawString(title, BPoint(xbold, ybold));
    496    
    497                 SetFont(be_plain_font);
    498                 font_height plainh;
    499                 GetFontHeight(&plainh);
    500                 float yplain;
    501                 yplain = plainh.ascent + plainh.descent * 2 + plainh.leading;
    502    
    503                 char detail[100];
    504                 int ver = static_cast<int>(translatorVersion);
    505                 sprintf(detail, "Version %d.%d.%d %s", ver >> 8, ((ver >> 4) & 0xf),
    506                     (ver & 0xf), __DATE__);
    507                 DrawString(detail, BPoint(xbold, yplain + ybold));
    508 
    509                 DrawString("Based on PPMTranslator sample code",
    510                     BPoint(xbold, yplain * 3 + ybold));
    511                 DrawString("Sample code copyright 1999, Be Incorporated",
    512                     BPoint(xbold, yplain * 4 + ybold));
    513             }
    514522virtual void MessageReceived(
    515523                BMessage * message)
    516524            {
     
    559567            }
    560568
    561569private:
     570        BStringView * mTitle;
     571        BStringView * mDetail;
     572        BStringView * mBasedOn;
     573        BStringView * mCopyright;
    562574        BPopUpMenu * mMenu;
    563575        BMenuField * mField;
    564576        BCheckBox * mAscii;
     
    604616    BView * * outView,
    605617    BRect * outExtent)
    606618{
    607     PPMView * v = new PPMView(BRect(0,0,225,175), "PPMTranslator Settings", B_FOLLOW_ALL, B_WILL_DRAW);
     619    PPMView * v = new PPMView("PPMTranslator Settings", B_WILL_DRAW);
    608620    *outView = v;
     621    v->ResizeTo(v->ExplicitPreferredSize());;
    609622    *outExtent = v->Bounds();
    610623    if (ioExtension) {
    611624        v->SetSettings(ioExtension);
  • src/add-ons/translators/exr/ConfigView.cpp

     
    1010
    1111#include <StringView.h>
    1212#include <CheckBox.h>
     13#include <GroupLayout.h>
     14#include <GroupLayoutBuilder.h>
     15#include <SpaceLayoutItem.h>
    1316
    1417#include <stdio.h>
    1518#include <string.h>
    1619
    1720
    18 ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
    19     : BView(frame, "EXRTranslator Settings", resize, flags)
     21ConfigView::ConfigView(uint32 flags)
     22    : BView("EXRTranslator Settings", flags)
    2023{
    2124    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    2225
    23     font_height fontHeight;
    24     be_bold_font->GetHeight(&fontHeight);
    25     float height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
     26    BStringView *fTitle = new BStringView("title", "EXR Images");
     27    fTitle->SetFont(be_bold_font);
    2628
    27     BRect rect(10, 10, 200, 10 + height);
    28     BStringView *stringView = new BStringView(rect, "title", "EXR Images");
    29     stringView->SetFont(be_bold_font);
    30     stringView->ResizeToPreferred();
    31     AddChild(stringView);
    32 
    33     rect.OffsetBy(0, height + 10);
    3429    char version[256];
    3530    sprintf(version, "Version %d.%d.%d, %s",
    3631        int(B_TRANSLATION_MAJOR_VERSION(EXR_TRANSLATOR_VERSION)),
    3732        int(B_TRANSLATION_MINOR_VERSION(EXR_TRANSLATOR_VERSION)),
    3833        int(B_TRANSLATION_REVISION_VERSION(EXR_TRANSLATOR_VERSION)),
    3934        __DATE__);
    40     stringView = new BStringView(rect, "version", version);
    41     stringView->ResizeToPreferred();
    42     AddChild(stringView);
     35    BStringView *fVersion = new BStringView("version", version);
    4336
    44     GetFontHeight(&fontHeight);
    45     height = fontHeight.descent + fontHeight.ascent + fontHeight.leading;
     37    BStringView *fCopyright = new BStringView("copyright",
     38        B_UTF8_COPYRIGHT "2008 Haiku Inc.");
    4639
    47     rect.OffsetBy(0, height + 5);
    48     stringView = new BStringView(rect, "copyright", B_UTF8_COPYRIGHT "2008 Haiku Inc.");
    49     stringView->ResizeToPreferred();
    50     AddChild(stringView);
     40    BStringView *fCopyright2 = new BStringView("copyright2",
     41        "Based on OpenEXR (http://www.openexr.com)");
    5142
    52     rect.OffsetBy(0, height + 10);
    53     stringView = new BStringView(rect, "copyright2", "Based on OpenEXR (http://www.openexr.com)");
    54     stringView->ResizeToPreferred();
    55     AddChild(stringView);
     43    BStringView *fCopyright3 = new BStringView("copyright3",
     44        B_UTF8_COPYRIGHT "2006, Industrial Light & Magic,");
    5645
    57     rect.OffsetBy(0, height + 5);
    58     stringView = new BStringView(rect, "copyright3", B_UTF8_COPYRIGHT "2006, Industrial Light & Magic, a division of Lucasfilm "
    59         "Entertainment Company Ltd");
    60     stringView->ResizeToPreferred();
    61     AddChild(stringView);
     46    BStringView *fCopyright4 = new BStringView("copyright4",
     47        "a division of Lucasfilm Entertainment Company Ltd");
     48
     49    // Build the layout
     50    SetLayout(new BGroupLayout(B_HORIZONTAL));
     51
     52    AddChild(BGroupLayoutBuilder(B_VERTICAL, 7)
     53        .Add(fTitle)
     54        .Add(fVersion)
     55        .AddGlue()
     56        .Add(fCopyright)
     57        .Add(fCopyright2)
     58        .AddGlue()
     59        .Add(fCopyright3)
     60        .Add(fCopyright4)
     61        .AddGlue()
     62        .SetInsets(5, 5, 5, 5)
     63    );
     64
     65    BFont font;
     66    GetFont(&font);
     67    SetExplicitPreferredSize(BSize((font.Size() * 400)/12, (font.Size() * 200)/12));
    6268}
    6369
    6470
  • src/add-ons/translators/exr/main.cpp

     
    1616    BApplication app("application/x-vnd.haiku-exr-translator");
    1717
    1818    status_t result;
    19     result = LaunchTranslatorWindow(new EXRTranslator, "EXR Settings", BRect(0, 0, 225, 175));
     19    result = LaunchTranslatorWindow(new EXRTranslator, "EXR Settings");
    2020    if (result != B_OK)
    2121        return 1;
    2222
  • src/add-ons/translators/exr/ConfigView.h

     
    1111
    1212class ConfigView : public BView {
    1313    public:
    14         ConfigView(const BRect &frame, uint32 resize = B_FOLLOW_ALL,
    15             uint32 flags = B_WILL_DRAW);   
     14        ConfigView(uint32 flags = B_WILL_DRAW);
    1615        virtual ~ConfigView();
    1716};
    1817
  • src/add-ons/translators/exr/EXRTranslator.cpp

     
    229229BView *
    230230EXRTranslator::NewConfigView(TranslatorSettings *settings)
    231231{
    232     return new ConfigView(BRect(0, 0, 225, 175));
     232    return new ConfigView();
    233233}
    234234
    235235
  • src/add-ons/translators/gif/GIFView.cpp

     
    1818#include <stdio.h>
    1919#include <stdlib.h>
    2020
     21#include <GridLayoutBuilder.h>
     22#include <GroupLayout.h>
     23#include <GroupLayoutBuilder.h>
    2124#include <InterfaceKit.h>
    2225#include <String.h>
    2326
     
    3033extern char translatorName[];
    3134
    3235// constructor
    33 GIFView::GIFView(BRect rect, const char *name)
    34     : BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
     36GIFView::GIFView(const char *name)
     37    : BView(name, B_WILL_DRAW)
    3538{
    3639    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    37    
    38     font_height fh;
    39     be_bold_font->GetHeight(&fh);
    40     BRect r(10, 15, 10 + be_bold_font->StringWidth(translatorName),
    41         15 + fh.ascent + fh.descent);
    4240
    43     BStringView *title = new BStringView(r, "Title", translatorName);
     41    BStringView *title = new BStringView("Title", translatorName);
    4442    title->SetFont(be_bold_font);
    45     AddChild(title);
    4643
    4744    char version_string[100];
    4845    sprintf(version_string, "v%d.%d.%d %s", (int)(translatorVersion >> 8), (int)((translatorVersion >> 4) & 0xf),
    4946        (int)(translatorVersion & 0xf), __DATE__);
    50     be_plain_font->GetHeight(&fh);
    51     r.bottom = r.top + fh.ascent + fh.descent;
    52     r.left = r.right + 2.0 * r.Height();
    53     r.right = r.left + be_plain_font->StringWidth(version_string);
     47    BStringView *version = new BStringView("Version", version_string);
    5448
    55     BStringView *version = new BStringView(r, "Version", version_string);
    56     version->SetFont(be_plain_font);
    57     AddChild(version);
    58 
    5949    const char *copyrightString = "©2003 Daniel Switkin, software@switkin.com";
    60     r.top = r.bottom + 5;
    61     r.left = 10;
    62     r.bottom = r.top + fh.ascent + fh.descent;
    63     r.right = rect.right - 10;
     50    BStringView *copyright = new BStringView("Copyright", copyrightString);
    6451
    65     BStringView *copyright = new BStringView(r, "Copyright", copyrightString);
    66     copyright->ResizeToPreferred();
    67     AddChild(copyright);
    68 
    6952    // menu fields (Palette & Colors)
    7053    fWebSafeMI = new BMenuItem("Websafe", new BMessage(GV_WEB_SAFE), 0, 0);
    7154    fBeOSSystemMI = new BMenuItem("BeOS System", new BMessage(GV_BEOS_SYSTEM), 0, 0);
     
    8972        count *= 2;
    9073    }
    9174    fColorCount256MI = fColorCountMI[7];
    92    
    93     r.top = r.bottom + 14;
    94     r.bottom = r.top + 24;
    95     fPaletteMF = new BMenuField(r, "PaletteMenuField", "Palette",
    96         fPaletteM, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
    97     AddChild(fPaletteMF);
    9875
    99     r.top = r.bottom + 5;
    100     r.bottom = r.top + 24;
    101     fColorCountMF = new BMenuField(r, "ColorCountMenuField", "Colors",
    102         fColorCountM, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
    103     AddChild(fColorCountMF);
     76    fPaletteMF = new BMenuField("Palette", fPaletteM, NULL);
    10477
    105     // align menu fields
    106     float maxLabelWidth = ceilf(max_c(be_plain_font->StringWidth("Colors"),
    107                                       be_plain_font->StringWidth("Palette")));
    108     fPaletteMF->SetDivider(maxLabelWidth + 7);
    109     fColorCountMF->SetDivider(maxLabelWidth + 7);
     78    fColorCountMF = new BMenuField("Colors", fColorCountM, NULL);
    11079
    111     // check boxen
    112     r.top = fColorCountMF->Frame().bottom + 5;
    113     r.bottom = r.top + 10;
    114     fUseDitheringCB = new BCheckBox(r, "UseDithering", "Use dithering",
     80    // check boxes
     81    fUseDitheringCB = new BCheckBox("Use dithering",
    11582        new BMessage(GV_USE_DITHERING));
    116     AddChild(fUseDitheringCB);
    11783
    118     r.top = fUseDitheringCB->Frame().bottom + 2;
    119     r.bottom = r.top + 10;
    120     fInterlacedCB = new BCheckBox(r, "Interlaced", "Write interlaced images",
     84    fInterlacedCB = new BCheckBox("Write interlaced images",
    12185        new BMessage(GV_INTERLACED));
    122     AddChild(fInterlacedCB);
    123    
    124     r.top = fInterlacedCB->Frame().bottom + 2;
    125     r.bottom = r.top + 10;
    126     fUseTransparentCB = new BCheckBox(r, "UseTransparent", "Write transparent images",
     86
     87    fUseTransparentCB = new BCheckBox("Write transparent images",
    12788        new BMessage(GV_USE_TRANSPARENT));
    128     AddChild(fUseTransparentCB);
    12989
    13090    // radio buttons
    131     r.top = fUseTransparentCB->Frame().bottom + 2;
    132     r.bottom = r.top + 10;
    133     r.right = r.left + be_plain_font->StringWidth("Automatic (from alpha channel)") + 20;
    134     fUseTransparentAutoRB = new BRadioButton(r, "UseTransparentAuto", "Automatic (from alpha channel)",
     91    fUseTransparentAutoRB = new BRadioButton("Automatic (from alpha channel)",
    13592        new BMessage(GV_USE_TRANSPARENT_AUTO));
    136     AddChild(fUseTransparentAutoRB);
    137    
    138     r.top = fUseTransparentAutoRB->Frame().bottom + 0;
    139     r.bottom = r.top + 10;
    140     r.left = 10;
    141     r.right = r.left + be_plain_font->StringWidth("Use RGB color") + 20;
    142     fUseTransparentColorRB = new BRadioButton(r, "UseTransparentColor", "Use RGB color",
     93
     94    fUseTransparentColorRB = new BRadioButton("Use RGB color",
    14395        new BMessage(GV_USE_TRANSPARENT_COLOR));
    144     AddChild(fUseTransparentColorRB);
    145    
    146     r.left = r.right + 1;
    147     r.right = r.left + 30;
    148     fTransparentRedTC = new BTextControl(r, "TransparentRed", "", "0",
    149         new BMessage(GV_TRANSPARENT_RED));
    150     AddChild(fTransparentRedTC);
    151     fTransparentRedTC->SetDivider(0);
    152    
    153     r.left = r.right + 5;
    154     r.right = r.left + 30;
    155     fTransparentGreenTC = new BTextControl(r, "TransparentGreen", "", "0",
    156         new BMessage(GV_TRANSPARENT_GREEN));
    157     AddChild(fTransparentGreenTC);
    158     fTransparentGreenTC->SetDivider(0);
    159    
    160     r.left = r.right + 5;
    161     r.right = r.left + 30;
    162     fTransparentBlueTC = new BTextControl(r, "TransparentBlue", "", "0",
    163         new BMessage(GV_TRANSPARENT_BLUE));
    164     AddChild(fTransparentBlueTC);
    165     fTransparentBlueTC->SetDivider(0);
    16696
     97    fTransparentRedTC = new BTextControl("", "0", new BMessage(GV_TRANSPARENT_RED));
     98
     99    fTransparentGreenTC = new BTextControl("", "0", new BMessage(GV_TRANSPARENT_GREEN));
     100
     101    fTransparentBlueTC = new BTextControl("", "0", new BMessage(GV_TRANSPARENT_BLUE));
     102
    167103    BTextView *tr = fTransparentRedTC->TextView();
    168104    BTextView *tg = fTransparentGreenTC->TextView();
    169105    BTextView *tb = fTransparentBlueTC->TextView();
     
    176112        }
    177113    }
    178114
    179     RestorePrefs();
     115    SetLayout(new BGroupLayout(B_HORIZONTAL));
    180116
    181     if (copyright->Frame().right + 10 > Bounds().Width())
    182         ResizeTo(copyright->Frame().right + 10, Bounds().Height());
     117    AddChild(BGroupLayoutBuilder(B_VERTICAL, 7)
     118        .Add(BGridLayoutBuilder(10, 10)
     119            .Add(title, 0, 0)
     120            .Add(version, 1, 0)
     121        )
     122        .Add(copyright)
     123        .AddGlue()
     124
     125        .Add(BGridLayoutBuilder(10, 10)
     126            .Add(fPaletteMF->CreateLabelLayoutItem(), 0, 0)
     127            .Add(fPaletteMF->CreateMenuBarLayoutItem(), 1, 0)
     128
     129            .Add(fColorCountMF->CreateLabelLayoutItem(), 0, 1)
     130            .Add(fColorCountMF->CreateMenuBarLayoutItem(), 1, 1)
     131        )
     132        .AddGlue()
     133
     134        .Add(fUseDitheringCB)
     135        .Add(fInterlacedCB)
     136        .Add(fUseTransparentCB)
     137
     138        .Add(fUseTransparentAutoRB)
     139        .Add(BGridLayoutBuilder(10, 10)
     140            .Add(fUseTransparentColorRB, 0, 0)
     141            .Add(fTransparentRedTC, 1, 0)
     142            .Add(fTransparentGreenTC, 2, 0)
     143            .Add(fTransparentBlueTC, 3, 0)
     144        )
     145        .AddGlue()
     146        .SetInsets(5, 5, 5, 5)
     147    );
     148
     149    BFont font;
     150    GetFont(&font);
     151    SetExplicitPreferredSize(BSize((font.Size() * 400)/12, (font.Size() * 300)/12));
     152
     153    RestorePrefs();
    183154}
    184155
    185156
  • src/add-ons/translators/gif/GIFView.h

     
    4444
    4545class GIFView : public BView {
    4646 public:
    47                             GIFView(BRect rect, const char* name);
     47                            GIFView(const char* name);
    4848    virtual                 ~GIFView();
    4949
    5050    virtual void            MessageReceived(BMessage* message);
  • src/add-ons/translators/gif/GIFTranslator.cpp

     
    6161status_t
    6262MakeConfig(BMessage *ioExtension, BView **outView, BRect *outExtent)
    6363{
    64     outExtent->Set(0, 0, 239, 239);
    65     GIFView *gifview = new GIFView(*outExtent, "TranslatorView");
     64    GIFView *gifview = new GIFView("TranslatorView");
    6665    *outView = gifview;
     66    gifview->ResizeTo(gifview->ExplicitPreferredSize());
     67    *outExtent = gifview->Bounds();
    6768    return B_OK;
    6869}
    6970
  • src/add-ons/translators/gif/GIFWindow.cpp

     
    1616#include "GIFWindow.h"
    1717#include "GIFView.h"
    1818#include <Application.h>
     19#include <GroupLayout.h>
    1920
    2021GIFWindow::GIFWindow(BRect rect, const char *name) :
    21     BWindow(rect, name, B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE,
    22     B_CURRENT_WORKSPACE) {
    23    
    24     BRect r(Bounds());
    25     gifview = new GIFView(r, "GIFView");
     22    BWindow(rect, name, B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
     23    | B_AUTO_UPDATE_SIZE_LIMITS, B_CURRENT_WORKSPACE) {
     24    SetLayout(new BGroupLayout(B_HORIZONTAL));
     25    gifview = new GIFView("GIFView");
    2626    AddChild(gifview);
    2727}
    2828
  • src/add-ons/translators/shared/TranslatorWindow.cpp

     
    3131
    3232#include <Screen.h>
    3333#include <Alert.h>
     34#include <GroupLayout.h>
    3435#include "TranslatorWindow.h"
    3536
    3637// ---------------------------------------------------------------
     
    4849// ---------------------------------------------------------------
    4950TranslatorWindow::TranslatorWindow(BRect area, const char *title)
    5051    :   BWindow(area, title, B_TITLED_WINDOW,
    51             B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
     52            B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
    5253{
     54    SetLayout(new BGroupLayout(B_HORIZONTAL));
     55        // Set the layout on layout window
     56        // Do nothing for a non-layout window
    5357}
    5458
    5559// ---------------------------------------------------------------
     
    8589    translator = NULL;
    8690
    8791    TranslatorWindow *wnd = new TranslatorWindow(rect, title);
    88     view->ResizeTo(rect.Width(), rect.Height());
    8992    wnd->AddChild(view);
    9093    BPoint wndpt = B_ORIGIN;
    9194    {
  • src/add-ons/translators/shared/BaseTranslator.cpp

     
    641641
    642642    BView *view = NewConfigView(AcquireSettings());
    643643        // implemented in derived class
     644
    644645    if (view) {
    645646        *outView = view;
     647        if ((view->Flags() & B_SUPPORTS_LAYOUT) != 0)
     648            view->ResizeTo(view->ExplicitPreferredSize());
     649
    646650        *outExtent = view->Bounds();
    647651
    648652        return B_OK;
  • src/add-ons/translators/shared/TranslatorWindow.h

     
    4848};
    4949
    5050status_t
    51 LaunchTranslatorWindow(BTranslator *translator, const char *title, BRect rect);
     51LaunchTranslatorWindow(BTranslator *translator, const char *title,
     52                        BRect rect = BRect(0, 0, 1, 1));
    5253
    5354#endif // #ifndef TRANSLATORWINDOW_H
    5455
  • src/add-ons/translators/tga/TGAMain.cpp

     
    4949{
    5050    BApplication app("application/x-vnd.obos-tga-translator");
    5151    status_t result;
    52     result = LaunchTranslatorWindow(new TGATranslator,
    53         "TGA Settings", BRect(0, 0, 225, 175));
     52    result = LaunchTranslatorWindow(new TGATranslator, "TGA Settings");
    5453    if (result == B_OK) {
    5554        app.Run();
    5655        return 0;
  • src/add-ons/translators/tga/TGATranslator.cpp

     
    21882188BView *
    21892189TGATranslator::NewConfigView(TranslatorSettings *settings)
    21902190{
    2191     return new TGAView(BRect(0, 0, 225, 175), "TGATranslator Settings",
    2192         B_FOLLOW_ALL, B_WILL_DRAW, settings);
     2191    return new TGAView("TGATranslator Settings", B_WILL_DRAW, settings);
    21932192}
    21942193
  • src/add-ons/translators/tga/TGAView.cpp

     
    3030
    3131#include <stdio.h>
    3232#include <string.h>
     33#include <GroupLayout.h>
     34#include <GroupLayoutBuilder.h>
     35#include <SpaceLayoutItem.h>
    3336#include "TGAView.h"
    3437#include "TGATranslator.h"
    3538
     
    4649//
    4750// Returns:
    4851// ---------------------------------------------------------------
    49 TGAView::TGAView(const BRect &frame, const char *name,
    50     uint32 resize, uint32 flags, TranslatorSettings *settings)
    51     :   BView(frame, name, resize, flags)
     52TGAView::TGAView(const char *name, uint32 flags, TranslatorSettings *settings)
     53    :   BView(name, flags)
    5254{
    5355    fSettings = settings;
    5456   
     
    5759   
    5860    BMessage *pmsg;
    5961    int32 val;
    60    
     62
     63    fTitle = new BStringView("title", "TGA Image Translator");
     64    fTitle->SetFont(be_bold_font);
     65
     66    char detail[100];
     67    sprintf(detail, "Version %d.%d.%d %s",
     68        static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TGA_TRANSLATOR_VERSION)),
     69        static_cast<int>(B_TRANSLATION_MINOR_VERSION(TGA_TRANSLATOR_VERSION)),
     70        static_cast<int>(B_TRANSLATION_REVISION_VERSION(TGA_TRANSLATOR_VERSION)),
     71        __DATE__);
     72    fDetail = new BStringView("detail", detail);
     73    fWrittenBy = new BStringView("writtenby",
     74        "Written by the Haiku Translation Kit Team");
     75
    6176    pmsg = new BMessage(CHANGE_IGNORE_ALPHA);
    62     fpchkIgnoreAlpha = new BCheckBox(BRect(10, 45, 180, 62),
    63         "Ignore TGA alpha channel",
    64         "Ignore TGA alpha channel", pmsg);
     77    fpchkIgnoreAlpha = new BCheckBox("Ignore TGA alpha channel", pmsg);
    6578    val = (fSettings->SetGetBool(TGA_SETTING_IGNORE_ALPHA)) ? 1 : 0;
    6679    fpchkIgnoreAlpha->SetValue(val);
    6780    fpchkIgnoreAlpha->SetViewColor(ViewColor());
    68     AddChild(fpchkIgnoreAlpha);
    6981   
    7082    pmsg = new BMessage(CHANGE_RLE);
    71     fpchkRLE = new BCheckBox(BRect(10, 67, 180, 84),
    72         "Save with RLE Compression",
    73         "Save with RLE Compression", pmsg);
     83    fpchkRLE = new BCheckBox("Save with RLE Compression", pmsg);
    7484    val = (fSettings->SetGetBool(TGA_SETTING_RLE)) ? 1 : 0;
    7585    fpchkRLE->SetValue(val);
    7686    fpchkRLE->SetViewColor(ViewColor());
    77     AddChild(fpchkRLE);
     87
     88    // Build the layout
     89    SetLayout(new BGroupLayout(B_HORIZONTAL));
     90
     91    AddChild(BGroupLayoutBuilder(B_VERTICAL, 7)
     92        .Add(fTitle)
     93        .Add(fDetail)
     94        .AddGlue()
     95        .Add(fpchkIgnoreAlpha)
     96        .Add(fpchkRLE)
     97        .AddGlue()
     98        .Add(fWrittenBy)
     99        .AddGlue()
     100        .SetInsets(5, 5, 5, 5)
     101    );
     102
     103    BFont font;
     104    GetFont(&font);
     105    SetExplicitPreferredSize(BSize((font.Size() * 333)/12, (font.Size() * 200)/12));
    78106}
    79107
    80108// ---------------------------------------------------------------
     
    157185            break;
    158186    }
    159187}
    160 
    161 // ---------------------------------------------------------------
    162 // Draw
    163 //
    164 // Draws information about the TGATranslator to this view.
    165 //
    166 // Preconditions:
    167 //
    168 // Parameters: area,    not used
    169 //
    170 // Postconditions:
    171 //
    172 // Returns:
    173 // ---------------------------------------------------------------
    174 void
    175 TGAView::Draw(BRect area)
    176 {
    177     SetFont(be_bold_font);
    178     font_height fh;
    179     GetFontHeight(&fh);
    180     float xbold, ybold;
    181     xbold = fh.descent + 1;
    182     ybold = fh.ascent + fh.descent * 2 + fh.leading;
    183    
    184     char title[] = "TGA Image Translator";
    185     DrawString(title, BPoint(xbold, ybold));
    186    
    187     SetFont(be_plain_font);
    188     font_height plainh;
    189     GetFontHeight(&plainh);
    190     float yplain;
    191     yplain = plainh.ascent + plainh.descent * 2 + plainh.leading;
    192    
    193     char detail[100];
    194     sprintf(detail, "Version %d.%d.%d %s",
    195         static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TGA_TRANSLATOR_VERSION)),
    196         static_cast<int>(B_TRANSLATION_MINOR_VERSION(TGA_TRANSLATOR_VERSION)),
    197         static_cast<int>(B_TRANSLATION_REVISION_VERSION(TGA_TRANSLATOR_VERSION)),
    198         __DATE__);
    199     DrawString(detail, BPoint(xbold, yplain + ybold));
    200 /*  char copyright[] = "© 2002 Haiku Project";
    201     DrawString(copyright, BPoint(xbold, yplain * 2 + ybold));
    202 */ 
    203     char writtenby[] = "Written by the Haiku Translation Kit Team";
    204     DrawString(writtenby, BPoint(xbold, yplain * 7 + ybold));
    205 }
  • src/add-ons/translators/tga/TGAView.h

     
    3333
    3434#include <View.h>
    3535#include <CheckBox.h>
     36#include <StringView.h>
    3637#include "TranslatorSettings.h"
    3738
    3839class TGAView : public BView {
    3940public:
    40     TGAView(const BRect &frame, const char *name, uint32 resize,
    41         uint32 flags, TranslatorSettings *settings);
     41    TGAView(const char *name, uint32 flags, TranslatorSettings *settings);
    4242        // sets up the view
    4343       
    4444    ~TGAView();
     
    4646       
    4747    virtual void AllAttached();
    4848    virtual void MessageReceived(BMessage *message);
    49 
    50     virtual void Draw(BRect area);
    51         // draws information about the TGATranslator
    5249       
    5350    enum { CHANGE_RLE, CHANGE_IGNORE_ALPHA };
    5451private:
     52    BStringView *fTitle;
     53    BStringView *fDetail;
     54    BStringView *fWrittenBy;
    5555    BCheckBox *fpchkIgnoreAlpha;
    5656    BCheckBox *fpchkRLE;
    5757