Ticket #5451: Expander.patch

File Expander.patch, 24.3 KB (added by mt, 14 years ago)

patch file

  • ExpanderWindow.cpp

     
    1515#include <Application.h>
    1616#include <Box.h>
    1717#include <Button.h>
     18#include <Catalog.h>
    1819#include <CheckBox.h>
    1920#include <ControlLook.h>
    2021#include <Entry.h>
    2122#include <File.h>
    2223#include <GroupLayout.h>
    2324#include <GroupLayoutBuilder.h>
     25#include <Locale.h>
    2426#include <Menu.h>
    2527#include <MenuBar.h>
    2628#include <MenuItem.h>
     
    4244const uint32 MSG_SHOWCONTENTS   = 'mSCT';
    4345
    4446
     47#undef TR_CONTEXT
     48#define TR_CONTEXT "ExpanderWindow"
     49
    4550ExpanderWindow::ExpanderWindow(BRect frame, const entry_ref* ref,
    4651        BMessage* settings)
    4752    :
    48     BWindow(frame, "Expander", B_TITLED_WINDOW, B_NORMAL_WINDOW_FEEL),
     53    BWindow(frame, TR_CMT("Expander", "!! Window Title !!"), B_TITLED_WINDOW, B_NORMAL_WINDOW_FEEL),
    4954    fSourcePanel(NULL),
    5055    fDestPanel(NULL),
    5156    fSourceChanged(true),
     
    6166
    6267    _AddMenuBar(layout);
    6368
    64     fDestButton = new BButton("Destination", new BMessage(MSG_DEST));
    65     fSourceButton = new BButton("Source", new BMessage(MSG_SOURCE));
    66     fExpandButton = new BButton("Expand", new BMessage(MSG_EXPAND));
     69    fDestButton = new BButton(TR("Destination"), new BMessage(MSG_DEST));
     70    fSourceButton = new BButton(TR("Source"), new BMessage(MSG_SOURCE));
     71    fExpandButton = new BButton(TR("Expand"), new BMessage(MSG_EXPAND));
    6772
    6873    BSize size = fDestButton->PreferredSize();
    6974    size.width = max_c(size.width, fSourceButton->PreferredSize().width);
     
    98103                .Add(fDestText = new BTextControl(NULL, NULL,
    99104                    new BMessage(MSG_DESTTEXT)))
    100105                .AddGroup(B_HORIZONTAL, spacing)
    101                     .Add(fShowContents = new BCheckBox("Show contents",
     106                    .Add(fShowContents = new BCheckBox(TR("Show contents"),
    102107                        new BMessage(MSG_SHOWCONTENTS)))
    103108                    .Add(fStatusView = new BStringView(NULL, NULL))
    104109                .End()
     
    139144    BEntry entry(fDestText->Text(), true);
    140145    BVolume volume;
    141146    if (!entry.Exists()) {
    142         BAlert* alert = new BAlert("destAlert", "The destination"
    143             " folder does not exist.", "Cancel", NULL, NULL,
     147        BAlert* alert = new BAlert("destAlert",
     148            TR("The destination folder does not exist."),
     149            TR("Cancel"), NULL, NULL,
    144150            B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
    145151        alert->Go();
    146152        return false;
    147153    } else if (!entry.IsDirectory()) {
    148         (new BAlert("destAlert", "The destination"
    149             " is not a folder.", "Cancel", NULL, NULL,
     154        (new BAlert("destAlert",
     155            TR("The destination is not a folder."),
     156            TR("Cancel"), NULL, NULL,
    150157            B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT))->Go();
    151158        return false;
    152159    } else if (entry.GetVolume(&volume) != B_OK || volume.IsReadOnly()) {
    153         (new BAlert("destAlert", "The destination is read only.",
    154             "Cancel", NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING,
     160        (new BAlert("destAlert",
     161            TR("The destination is read only."),
     162            TR("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING,
    155163            B_WARNING_ALERT))->Go();
    156164        return false;
    157165    } else {
     
    175183                BMessenger messenger(this);
    176184                fSourcePanel = new BFilePanel(B_OPEN_PANEL, &messenger, &srcRef,
    177185                    B_FILE_NODE, false, NULL, new RuleRefFilter(fRules), true);
     186                (fSourcePanel->Window())->SetTitle(TR("Expander: Open"));
    178187            } else
    179188                fSourcePanel->SetPanelDirectory(&srcRef);
    180189            fSourcePanel->Show();
     
    226235        case MSG_STOP:
    227236            if (fExpandingStarted) {
    228237                fExpandingThread->SuspendExternalExpander();
    229                 BAlert* alert = new BAlert("stopAlert", "Are you sure you want "
    230                     "to stop expanding this\narchive? The expanded items may "
    231                     "not be complete.", "Stop", "Continue", NULL,
     238                BAlert* alert = new BAlert("stopAlert",
     239                    TR("Are you sure you want to stop expanding this\narchive? The expanded items may not be complete."),
     240                    TR("Stop"), TR("Continue"), NULL,
    232241                    B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
    233242                if (alert->Go() == 0) {
    234243                    fExpandingThread->ResumeExternalExpander();
     
    245254        case MSG_SHOWCONTENTS:
    246255            // change menu item label
    247256            fShowItem->SetLabel(fShowContents->Value() == B_CONTROL_OFF
    248                 ? "Show contents" : "Hide contents");
     257                ? TR("Show contents") : TR("Hide contents"));
    249258
    250259            if (fShowContents->Value() == B_CONTROL_OFF) {
    251260                if (fListingStarted)
     
    260269        {
    261270            BEntry entry(fSourceText->Text(), true);
    262271            if (!entry.Exists()) {
    263                 BAlert* alert = new BAlert("srcAlert", "The file doesn't exist",
    264                     "Cancel", NULL, NULL,
     272                BAlert* alert = new BAlert("srcAlert", TR("The file doesn't exist"),
     273                    TR("Cancel"), NULL, NULL,
    265274                    B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
    266275                alert->Go();
    267276                break;
     
    282291
    283292            BString string = "The file : ";
    284293            string += fSourceText->Text();
    285             string += " is not supported";
    286             BAlert* alert = new BAlert("srcAlert", string.String(), "Cancel",
     294            string += TR_MARK(" is not supported");
     295            BAlert* alert = new BAlert("srcAlert", string.String(), TR("Cancel"),
    287296                NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_INFO_ALERT);
    288297            alert->Go();
    289298
     
    324333            // thread has finished      (finished, quit, killed, we don't know)
    325334            // reset window state
    326335            if (fExpandingStarted) {
    327                 fStatusView->SetText("File expanded");
     336                fStatusView->SetText(TR("File expanded"));
    328337                StopExpanding();
    329338                OpenDestFolder();
    330339                CloseWindowOrKeepOpen();
     
    339348        case 'exrr':    // thread has finished
    340349            // reset window state
    341350
    342             fStatusView->SetText("Error when expanding archive");
     351            fStatusView->SetText(TR("Error when expanding archive"));
    343352            CloseWindowOrKeepOpen();
    344353            break;
    345354
     
    359368
    360369    if (fExpandingStarted) {
    361370        fExpandingThread->SuspendExternalExpander();
    362         BAlert* alert = new BAlert("stopAlert", "Are you sure you want to stop "
    363             "expanding this\narchive? The expanded items may not be complete.",
    364             "Stop", "Continue", NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING,
     371        BAlert* alert = new BAlert("stopAlert",
     372            TR("Are you sure you want to stop expanding this\narchive? The expanded items may not be complete."),
     373            TR("Stop"), TR("Continue"), NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING,
    365374            B_WARNING_ALERT);
    366375        if (alert->Go() == 0) {
    367376            fExpandingThread->ResumeExternalExpander();
     
    446455    }
    447456}
    448457
     458
     459#undef TR_CONTEXT
     460#define TR_CONTEXT "ExpanderMenu"
     461
    449462void
    450463ExpanderWindow::_AddMenuBar(BLayout* layout)
    451464{
    452465    fBar = new BMenuBar("menu_bar", B_ITEMS_IN_ROW, B_INVALIDATE_AFTER_LAYOUT);
    453     BMenu* menu = new BMenu("File");
     466    BMenu* menu = new BMenu(TR("File"));
    454467    BMenuItem* item;
    455     menu->AddItem(item = new BMenuItem("About Expander" B_UTF8_ELLIPSIS,
     468    menu->AddItem(item = new BMenuItem(TR("About Expander…"),
    456469        new BMessage(B_ABOUT_REQUESTED)));
    457470    item->SetTarget(be_app_messenger);
    458471    menu->AddSeparatorItem();
    459     menu->AddItem(fSourceItem = new BMenuItem("Set source" B_UTF8_ELLIPSIS,
     472    menu->AddItem(fSourceItem = new BMenuItem(TR("Set source…"),
    460473        new BMessage(MSG_SOURCE), 'O'));
    461     menu->AddItem(fDestItem = new BMenuItem("Set destination" B_UTF8_ELLIPSIS,
     474    menu->AddItem(fDestItem = new BMenuItem(TR("Set destination…"),
    462475        new BMessage(MSG_DEST), 'D'));
    463476    menu->AddSeparatorItem();
    464     menu->AddItem(fExpandItem = new BMenuItem("Expand", new BMessage(MSG_EXPAND),
    465         'E'));
     477    menu->AddItem(fExpandItem = new BMenuItem(TR("Expand"),
     478        new BMessage(MSG_EXPAND), 'E'));
    466479    fExpandItem->SetEnabled(false);
    467     menu->AddItem(fShowItem = new BMenuItem("Show contents",
     480    menu->AddItem(fShowItem = new BMenuItem(TR("Show contents"),
    468481        new BMessage(MSG_SHOW), 'L'));
    469482    fShowItem->SetEnabled(false);
    470483    menu->AddSeparatorItem();
    471     menu->AddItem(fStopItem = new BMenuItem("Stop", new BMessage(MSG_STOP), 'K'));
     484    menu->AddItem(fStopItem = new BMenuItem(TR("Stop"),
     485        new BMessage(MSG_STOP), 'K'));
    472486    fStopItem->SetEnabled(false);
    473487    menu->AddSeparatorItem();
    474     menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W'));
     488    menu->AddItem(new BMenuItem(TR("Close"), new BMessage(B_QUIT_REQUESTED), 'W'));
    475489    fBar->AddItem(menu);
    476490
    477     menu = new BMenu("Settings");
    478     menu->AddItem(fPreferencesItem = new BMenuItem("Settings" B_UTF8_ELLIPSIS,
     491    menu = new BMenu(TR("Settings"));
     492    menu->AddItem(fPreferencesItem = new BMenuItem(TR("Settings…"),
    479493        new BMessage(MSG_PREFERENCES), 'S'));
    480494    fBar->AddItem(menu);
    481495    layout->AddView(fBar);
    482496}
    483497
    484498
     499#undef TR_CONTEXT
     500#define TR_CONTEXT "ExpanderWindow"
     501
    485502void
    486503ExpanderWindow::StartExpanding()
    487504{
     
    491508
    492509    BEntry destEntry(fDestText->Text(), true);
    493510    if (!destEntry.Exists()) {
    494         BAlert* alert = new BAlert("destAlert", "The folder was either moved, "
    495             "renamed or not\nsupported.", "Cancel", NULL, NULL,
     511        BAlert* alert = new BAlert("destAlert",
     512        TR("The folder was either moved, renamed or not\nsupported."),
     513        TR("Cancel"), NULL, NULL,
    496514            B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
    497515        alert->Go();
    498516        return;
     
    503521    message.AddRef("srcRef", &fSourceRef);
    504522    message.AddRef("destRef", &fDestRef);
    505523
    506     fExpandButton->SetLabel("Stop");
     524    fExpandButton->SetLabel(TR("Stop"));
    507525    fSourceButton->SetEnabled(false);
    508526    fDestButton->SetEnabled(false);
    509527    fShowContents->SetEnabled(false);
     
    516534
    517535    BEntry entry(&fSourceRef);
    518536    BPath path(&entry);
    519     BString text("Expanding file ");
     537    BString text(TR("Expanding file "));
    520538    text.Append(path.Leaf());
    521539    fStatusView->SetText(text.String());
    522540
     
    537555
    538556    fExpandingStarted = false;
    539557
    540     fExpandButton->SetLabel("Expand");
     558    fExpandButton->SetLabel(TR("Expand"));
    541559    fSourceButton->SetEnabled(true);
    542560    fDestButton->SetEnabled(true);
    543561    fShowContents->SetEnabled(true);
     
    642660    fDestItem->SetEnabled(false);
    643661    fExpandItem->SetEnabled(false);
    644662    fShowItem->SetEnabled(true);
    645     fShowItem->SetLabel("Hide contents");
     663    fShowItem->SetLabel(TR("Hide contents"));
    646664    fStopItem->SetEnabled(false);
    647665    fPreferencesItem->SetEnabled(false);
    648666
     
    652670
    653671    BEntry entry(&fSourceRef);
    654672    BPath path(&entry);
    655     BString text("Creating listing for ");
     673    BString text(TR("Creating listing for "));
    656674    text.Append(path.Leaf());
    657675    fStatusView->SetText(text.String());
    658676    fListingText->SetText("");
  • ExpanderApp.cpp

     
    88#include "ExpanderWindow.h"
    99
    1010#include <Alert.h>
     11#include <Catalog.h>
     12#include <Locale.h>
    1113#include <TextView.h>
    1214
    13 
    1415ExpanderApp::ExpanderApp()
    1516    : BApplication("application/x-vnd.Haiku-Expander")
    1617{
     18    be_locale->GetAppCatalog(&fCatalog);
     19
    1720    BPoint windowPosition = fSettings.Message().FindPoint("window_position");
    1821    BRect windowFrame(0, 0, 450, 120);
    1922    windowFrame.OffsetBy(windowPosition);
     
    2225}
    2326
    2427
     28#undef TR_CONTEXT
     29#define TR_CONTEXT "About"
     30
    2531void
    2632ExpanderApp::AboutRequested()
    2733{
    28     BAlert *alert = new BAlert("about", "Expander\n"
    29         "\twritten by Jérôme Duval\n"
    30         "\tCopyright 2004-2006, Haiku Inc.\n\n"
    31         "original Be version by \n"
    32         "Dominic, Hiroshi, Peter, Pavel and Robert\n", "OK");
    33     BTextView *view = alert->TextView();
     34    BAlert* alert = new BAlert("about",
     35        TR("Expander\n\twritten by Jérôme Duval\n\tCopyright 2004-2006, Haiku Inc.\n\noriginal Be version by \nDominic, Hiroshi, Peter, Pavel and Robert\n"),
     36        TR("OK"));
     37    BTextView* view = alert->TextView();
    3438    BFont font;
    3539
    3640    view->SetStylable(true);
     
    5357void
    5458ExpanderApp::ArgvReceived(int32 argc, char **argv)
    5559{
    56     BMessage *msg = NULL;
     60    BMessage* msg = NULL;
    5761    for (int32 i = 1; i < argc; i++) {
    5862        entry_ref ref;
    5963        status_t err = get_ref_for_path(argv[i], &ref);
     
    7175
    7276
    7377void
    74 ExpanderApp::RefsReceived(BMessage *msg)
     78ExpanderApp::RefsReceived(BMessage* msg)
    7579{
    7680    BMessenger messenger(fWindow);
    7781    msg->AddBool("fromApp", true);
     
    8084
    8185
    8286void
    83 ExpanderApp::UpdateSettingsFrom(BMessage *message)
     87ExpanderApp::UpdateSettingsFrom(BMessage* message)
    8488{
    8589    fSettings.UpdateFrom(message);
    8690}
  • ExpanderApp.h

     
    3030#define _ExpanderApp_h
    3131
    3232#include <Application.h>
     33#include <Catalog.h>
    3334#include "ExpanderSettings.h"
    3435#include "ExpanderWindow.h"
    3536
     
    4748        void UpdateSettingsFrom(BMessage *message);
    4849    private:
    4950        ExpanderWindow *fWindow;
     51        BCatalog                fCatalog;
    5052};
    5153
    5254#endif /* _ExpanderApp_h */
  • DirectoryFilePanel.cpp

     
    99
    1010#include "DirectoryFilePanel.h"
    1111
     12#include <Catalog.h>
     13#include <Locale.h>
    1214#include <Window.h>
    1315
    1416#include <stdio.h>
     
    4143
    4244//  #pragma mark -
    4345
     46#undef TR_CONTEXT
     47#define TR_CONTEXT "DirectoryFilePanel"
    4448
    45 DirectoryFilePanel::DirectoryFilePanel(file_panel_mode mode, BMessenger *target,
    46         const entry_ref *startDirectory, uint32 nodeFlavors,
    47         bool allowMultipleSelection, BMessage *message, BRefFilter *filter,
     49
     50DirectoryFilePanel::DirectoryFilePanel(file_panel_mode mode, BMessenger* target,
     51        const entry_ref* startDirectory, uint32 nodeFlavors,
     52        bool allowMultipleSelection, BMessage* message, BRefFilter* filter,
    4853        bool modal, bool hideWhenDone)
    4954    : BFilePanel(mode, target, startDirectory, nodeFlavors,
    5055        allowMultipleSelection, message, filter, modal, hideWhenDone),
     
    7277        }
    7378
    7479        rect.right = rect.left -= 30;
    75         float width = be_plain_font->StringWidth("Select current") + 20;
     80        float width = be_plain_font->StringWidth(TR("Select current")) + 20;
    7681        rect.left = width > 75 ? rect.right - width : rect.right - 75;
    77         fCurrentButton = new BButton(rect, "directoryButton", "Select current",
     82        fCurrentButton = new BButton(rect, "directoryButton", TR("Select current"),
    7883            new BMessage(MSG_DIRECTORY), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
    7984
    8085        background->AddChild(fCurrentButton);
    8186        fCurrentButton->SetTarget(Messenger());
    8287
    83         SetButtonLabel(B_DEFAULT_BUTTON, "Select");
    84         Window()->SetTitle("Expander: Choose destination");
     88        SetButtonLabel(B_DEFAULT_BUTTON, TR("Select"));
     89        Window()->SetTitle(TR("Expander: Choose destination"));
    8590
    8691        Window()->Unlock();
    8792
     
    100105    char label[64];
    101106    entry_ref ref;
    102107    GetPanelDirectory(&ref);
    103     if (snprintf(label, sizeof(label), "Select '%s'", ref.name) >= (int)sizeof(label))
    104         strcpy(label + sizeof(label) - 5, B_UTF8_ELLIPSIS "'");
     108    if (snprintf(label, sizeof(label),
     109        TR("Select '%s'"), ref.name) >= (int)sizeof(label))
     110            strcpy(label + sizeof(label) - 5, B_UTF8_ELLIPSIS "'");
    105111
    106112    // Resize button so that the label fits
    107113    // maximum width is dictated by the window's size limits
  • Jamfile

     
    11SubDir HAIKU_TOP src apps expander ;
    22
    3 SetSubDirSupportedPlatformsBeOSCompatible ;
    4 
    53Application Expander :
    64    ExpanderApp.cpp
    75    ExpanderWindow.cpp
     
    119    ExpanderPreferences.cpp
    1210    DirectoryFilePanel.cpp
    1311    ExpanderRules.cpp
    14     : be tracker $(TARGET_LIBSUPC++)
     12    : be tracker liblocale.so $(TARGET_LIBSUPC++)
    1513    : Expander.rdef
    1614;
    1715
     16DoCatalogs Expander :
     17    x-vnd.Haiku-Expander
     18    :
     19    ExpanderApp.cpp
     20    ExpanderWindow.cpp
     21    ExpanderSettings.cpp
     22    DirectoryFilePanel.cpp
     23    : en.catalog
     24    :
     25;
  • ExpanderPreferences.cpp

     
    55
    66#include "ExpanderPreferences.h"
    77#include <Box.h>
     8#include <Catalog.h>
     9#include <GroupLayout.h>
     10#include <GroupLayoutBuilder.h>
     11#include <Locale.h>
    812#include <Path.h>
    913#include <Screen.h>
    1014#include <StringView.h>
     
    1721const uint32 MSG_DESTTEXT = 'mDet';
    1822const uint32 MSG_DESTSELECT = 'mDes';
    1923
     24#undef TR_CONTEXT
     25#define TR_CONTEXT "ExpanderPreferences"
     26
    2027ExpanderPreferences::ExpanderPreferences(BMessage *settings)
    2128    : BWindow(BRect(0, 0, 325, 305), "Expander", B_MODAL_WINDOW,
    22         B_NOT_CLOSABLE | B_NOT_RESIZABLE),
     29        B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS),
    2330    fSettings(settings),
    2431    fUsePanel(NULL)
    2532{
     33    BBox* box = new BBox("background");
     34    box->SetLabel(TR("Expander settings"));
    2635
    27     BRect rect = Bounds();
    28     BBox *background = new BBox(rect, "background", B_FOLLOW_ALL,
    29         B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
    30     AddChild(background);
     36    fAutoExpand = new BCheckBox("autoExpand",
     37        TR("Automatically expand files"), NULL);
     38    fCloseWindow = new BCheckBox("closeWindowWhenDone",
     39        TR("Close window when done expanding"), NULL);
    3140
    32     rect.OffsetBy(11, 9);
    33     rect.bottom -= 64;
    34     rect.right -= 22;
    35     BBox *box = new BBox(rect, "background", B_FOLLOW_NONE,
    36         B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
    37     box->SetLabel("Expander settings");
    38     background->AddChild(box);
    39 
    40     float maxWidth = box->Bounds().right;
    41 
    42     BRect frameRect = box->Bounds();
    43     frameRect.OffsetBy(15, 23);
    44     frameRect.right = frameRect.left + 200;
    45     frameRect.bottom = frameRect.top + 20;
    46     BRect textRect(frameRect);
    47     textRect.OffsetTo(B_ORIGIN);
    48     textRect.InsetBy(1, 1);
    49     BStringView *stringView = new BStringView(frameRect, "expansion", "Expansion:",
    50         B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
    51     stringView->ResizeToPreferred();
    52     if (stringView->Frame().right > maxWidth)
    53         maxWidth = stringView->Frame().right;
    54     box->AddChild(stringView);
    55 
    56     frameRect.top = stringView->Frame().bottom + 5;
    57     frameRect.left += 10;
    58 
    59     fAutoExpand = new BCheckBox(frameRect, "autoExpand", "Automatically expand files", NULL);
    60     fAutoExpand->ResizeToPreferred();
    61     if (fAutoExpand->Frame().right > maxWidth)
    62         maxWidth = fAutoExpand->Frame().right;
    63     box->AddChild(fAutoExpand);
    64 
    65     frameRect = fAutoExpand->Frame();
    66     frameRect.top = fAutoExpand->Frame().bottom + 1;
    67     fCloseWindow = new BCheckBox(frameRect, "closeWindowWhenDone", "Close window when done expanding", NULL);
    68     fCloseWindow->ResizeToPreferred();
    69     if (fCloseWindow->Frame().right > maxWidth)
    70         maxWidth = fCloseWindow->Frame().right;
    71     box->AddChild(fCloseWindow);
    72 
    73     frameRect = stringView->Frame();
    74     frameRect.top = fCloseWindow->Frame().bottom + 10;
    75     stringView = new BStringView(frameRect, "destinationFolder", "Destination folder:",
    76         B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
    77     stringView->ResizeToPreferred();
    78     if (stringView->Frame().right > maxWidth)
    79         maxWidth = stringView->Frame().right;
    80     box->AddChild(stringView);
    81 
    82     frameRect.top = stringView->Frame().bottom + 5;
    83     frameRect.left += 10;
    84 
    85     fLeaveDest = new BRadioButton(frameRect, "leaveDest", "Leave destination folder path empty",
     41    fLeaveDest = new BRadioButton("leaveDest",
     42        TR("Leave destination folder path empty"),
    8643        new BMessage(MSG_LEAVEDEST));
    87     fLeaveDest->ResizeToPreferred();
    88     if (fLeaveDest->Frame().right > maxWidth)
    89         maxWidth = fLeaveDest->Frame().right;
    90     box->AddChild(fLeaveDest);
    91 
    92     frameRect = fLeaveDest->Frame();
    93     frameRect.top = fLeaveDest->Frame().bottom + 1;
    94     fSameDest = new BRadioButton(frameRect, "sameDir", "Same directory as source (archive) file",
     44    fSameDest = new BRadioButton("sameDir",
     45        TR("Same directory as source (archive) file"),
    9546        new BMessage(MSG_SAMEDIR));
    96     fSameDest->ResizeToPreferred();
    97     if (fSameDest->Frame().right > maxWidth)
    98         maxWidth = fSameDest->Frame().right;
    99     box->AddChild(fSameDest);
    100 
    101     frameRect = fSameDest->Frame();
    102     frameRect.top = frameRect.bottom + 1;
    103     fDestUse = new BRadioButton(frameRect, "destUse", "Use:", new BMessage(MSG_DESTUSE));
    104     fDestUse->ResizeToPreferred();
    105     if (fDestUse->Frame().right > maxWidth)
    106         maxWidth = fDestUse->Frame().right;
    107     box->AddChild(fDestUse);
    108 
    109     frameRect = fDestUse->Frame();
    110     frameRect.left  = fDestUse->Frame().right + 1;
    111     frameRect.right  = frameRect.left + 58;
    112     frameRect.bottom  = frameRect.top + 38;
    113 
    114     fDestText = new BTextControl(frameRect, "destText", "", "", new BMessage(MSG_DESTTEXT));
    115     box->AddChild(fDestText);
    116     fDestText->ResizeToPreferred();
     47    fDestUse = new BRadioButton("destUse",
     48        TR("Use:"), new BMessage(MSG_DESTUSE));
     49    fDestText = new BTextControl("destText", "", "", new BMessage(MSG_DESTTEXT));
    11750    fDestText->SetDivider(0);
    11851    fDestText->TextView()->MakeEditable(false);
    119     fDestText->ResizeTo(158, fDestText->Frame().Height());
    120 
    12152    fDestText->SetEnabled(false);
    122 
    123     frameRect = fDestText->Frame();
    124     frameRect.left = frameRect.right + 5;
    125     fSelect = new BButton(frameRect, "selectButton", "Select", new BMessage(MSG_DESTSELECT));
    126     fSelect->ResizeToPreferred();
    127     if (fSelect->Frame().right > maxWidth)
    128         maxWidth = fSelect->Frame().right;
    129     box->AddChild(fSelect);
     53    fSelect = new BButton("selectButton", TR("Select"),
     54        new BMessage(MSG_DESTSELECT));
    13055    fSelect->SetEnabled(false);
    13156
    132     fDestText->MoveBy(0, (fSelect->Frame().Height() - fDestText->Frame().Height()) / 2.0);
    133     fDestText->ResizeTo(158, fDestText->Frame().Height());
     57    fOpenDest = new BCheckBox("openDestination",
     58        TR("Open destination folder after extraction"), NULL);
     59    fAutoShow = new BCheckBox("autoShow",
     60        TR("Automatically show contents listing"), NULL);
    13461
    135     frameRect = stringView->Frame();
    136     frameRect.top = fDestUse->Frame().bottom + 10;
     62    BView* view = new BGroupView();
     63    view->SetLayout(new BGroupLayout(B_HORIZONTAL));
     64    view->AddChild(BGroupLayoutBuilder(B_VERTICAL)
     65        .AddGroup(B_HORIZONTAL)
     66            .Add(new BStringView("expansion", TR("Expansion:")))
     67            .AddGlue()
     68        .End()
     69        .AddGroup(B_VERTICAL, 1)
     70            .Add(fAutoExpand)
     71            .Add(fCloseWindow)
     72            .SetInsets(10, 0, 0, 10)
     73        .End()
     74        .AddGroup(B_HORIZONTAL)
     75            .Add(new BStringView("destinationFolder", TR("Destination folder:")))
     76            .AddGlue()
     77        .End()
     78        .AddGroup(B_VERTICAL, 1)
     79            .Add(fLeaveDest)
     80            .Add(fSameDest)
     81            .Add(fDestUse)
     82            .AddGroup(B_HORIZONTAL, 5)
     83                .Add(fDestText, 0.8)
     84                .Add(fSelect, 0.2)
     85                .SetInsets(20, 0, 0, 0)
     86            .End()
     87            .SetInsets(10, 0, 0, 10)
     88        .End()
     89        .AddGroup(B_HORIZONTAL)
     90            .Add(new BStringView("other", TR("Other:")))
     91            .AddGlue()
     92        .End()
     93        .AddGroup(B_VERTICAL, 1)
     94            .Add(fOpenDest)
     95            .Add(fAutoShow)
     96            .SetInsets(10, 0, 0, 0)
     97        .End()
     98        .SetInsets(10, 10, 10, 10)
     99    );
     100    box->AddChild(view);
    137101
    138     stringView = new BStringView(frameRect, "other", "Other:", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
    139     stringView->ResizeToPreferred();
    140     if (stringView->Frame().right > maxWidth)
    141         maxWidth = stringView->Frame().right;
    142     box->AddChild(stringView);
    143 
    144     frameRect.top = stringView->Frame().bottom + 5;
    145     frameRect.left += 10;
    146 
    147     fOpenDest = new BCheckBox(frameRect, "openDestination", "Open destination folder after extraction", NULL);
    148     fOpenDest->ResizeToPreferred();
    149     if (fOpenDest->Frame().right > maxWidth)
    150         maxWidth = fOpenDest->Frame().right;
    151     box->AddChild(fOpenDest);
    152 
    153     frameRect = fOpenDest->Frame();
    154     frameRect.top = frameRect.bottom + 1;
    155     fAutoShow = new BCheckBox(frameRect, "autoShow", "Automatically show contents listing", NULL);
    156     fAutoShow->ResizeToPreferred();
    157     if (fAutoShow->Frame().right > maxWidth)
    158         maxWidth = fAutoShow->Frame().right;
    159     box->AddChild(fAutoShow);
    160 
    161     box->ResizeTo(maxWidth + 15, fAutoShow->Frame().bottom + 10);
    162 
    163     rect = BRect(Bounds().right - 89, Bounds().bottom - 40, Bounds().right - 14, Bounds().bottom - 16);
    164 
    165     rect = Bounds();
    166     BButton *button = new BButton(rect, "OKButton", "OK", new BMessage(MSG_OK));
     102    BButton* button = new BButton("OKButton", TR("OK"), new BMessage(MSG_OK));
    167103    button->MakeDefault(true);
    168     button->ResizeToPreferred();
    169     button->MoveTo(box->Frame().right - button->Frame().Width(), box->Frame().bottom + 10);
    170     background->AddChild(button);
     104    BButton* cancel = new BButton("CancelButton", TR("Cancel"),
     105        new BMessage(MSG_CANCEL));
    171106
    172     rect = button->Frame();
    173     BButton *cancel = new BButton(rect, "CancelButton", "Cancel", new BMessage(MSG_CANCEL));
    174     cancel->ResizeToPreferred();
    175     cancel->MoveBy(-cancel->Frame().Width() - 10, (button->Frame().Height() - cancel->Frame().Height()) / 2.0);
    176     background->AddChild(cancel);
     107    SetLayout(new BGroupLayout(B_HORIZONTAL));
     108    AddChild(BGroupLayoutBuilder(B_VERTICAL, 11)
     109        .Add(box)
     110        .AddGroup(B_HORIZONTAL, 10)
     111            .AddGlue()
     112            .Add(cancel)
     113            .Add(button)
     114        .End()
     115        .SetInsets(10, 10, 10, 10)
     116    );
    177117
    178     ResizeTo(box->Frame().right + 11 , button->Frame().bottom + 11);
     118    CenterOnScreen();
    179119
    180     BScreen screen(this);
    181     MoveBy((screen.Frame().Width() - Bounds().Width()) / 2,
    182         (screen.Frame().Height() - Bounds().Height()) / 2);
    183 
    184120    bool automatically_expand_files;
    185121    bool close_when_done;
    186122    int8 destination_folder;
     
    239175
    240176
    241177void
    242 ExpanderPreferences::MessageReceived(BMessage *msg)
     178ExpanderPreferences::MessageReceived(BMessage* msg)
    243179{
    244180    switch (msg->what) {
    245181        case MSG_DESTSELECT: