Ticket #5451: Expander.patch
File Expander.patch, 24.3 KB (added by , 14 years ago) |
---|
-
ExpanderWindow.cpp
15 15 #include <Application.h> 16 16 #include <Box.h> 17 17 #include <Button.h> 18 #include <Catalog.h> 18 19 #include <CheckBox.h> 19 20 #include <ControlLook.h> 20 21 #include <Entry.h> 21 22 #include <File.h> 22 23 #include <GroupLayout.h> 23 24 #include <GroupLayoutBuilder.h> 25 #include <Locale.h> 24 26 #include <Menu.h> 25 27 #include <MenuBar.h> 26 28 #include <MenuItem.h> … … 42 44 const uint32 MSG_SHOWCONTENTS = 'mSCT'; 43 45 44 46 47 #undef TR_CONTEXT 48 #define TR_CONTEXT "ExpanderWindow" 49 45 50 ExpanderWindow::ExpanderWindow(BRect frame, const entry_ref* ref, 46 51 BMessage* settings) 47 52 : 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), 49 54 fSourcePanel(NULL), 50 55 fDestPanel(NULL), 51 56 fSourceChanged(true), … … 61 66 62 67 _AddMenuBar(layout); 63 68 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)); 67 72 68 73 BSize size = fDestButton->PreferredSize(); 69 74 size.width = max_c(size.width, fSourceButton->PreferredSize().width); … … 98 103 .Add(fDestText = new BTextControl(NULL, NULL, 99 104 new BMessage(MSG_DESTTEXT))) 100 105 .AddGroup(B_HORIZONTAL, spacing) 101 .Add(fShowContents = new BCheckBox( "Show contents",106 .Add(fShowContents = new BCheckBox(TR("Show contents"), 102 107 new BMessage(MSG_SHOWCONTENTS))) 103 108 .Add(fStatusView = new BStringView(NULL, NULL)) 104 109 .End() … … 139 144 BEntry entry(fDestText->Text(), true); 140 145 BVolume volume; 141 146 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, 144 150 B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); 145 151 alert->Go(); 146 152 return false; 147 153 } 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, 150 157 B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT))->Go(); 151 158 return false; 152 159 } 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, 155 163 B_WARNING_ALERT))->Go(); 156 164 return false; 157 165 } else { … … 175 183 BMessenger messenger(this); 176 184 fSourcePanel = new BFilePanel(B_OPEN_PANEL, &messenger, &srcRef, 177 185 B_FILE_NODE, false, NULL, new RuleRefFilter(fRules), true); 186 (fSourcePanel->Window())->SetTitle(TR("Expander: Open")); 178 187 } else 179 188 fSourcePanel->SetPanelDirectory(&srcRef); 180 189 fSourcePanel->Show(); … … 226 235 case MSG_STOP: 227 236 if (fExpandingStarted) { 228 237 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, 232 241 B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); 233 242 if (alert->Go() == 0) { 234 243 fExpandingThread->ResumeExternalExpander(); … … 245 254 case MSG_SHOWCONTENTS: 246 255 // change menu item label 247 256 fShowItem->SetLabel(fShowContents->Value() == B_CONTROL_OFF 248 ? "Show contents" : "Hide contents");257 ? TR("Show contents") : TR("Hide contents")); 249 258 250 259 if (fShowContents->Value() == B_CONTROL_OFF) { 251 260 if (fListingStarted) … … 260 269 { 261 270 BEntry entry(fSourceText->Text(), true); 262 271 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, 265 274 B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); 266 275 alert->Go(); 267 276 break; … … 282 291 283 292 BString string = "The file : "; 284 293 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"), 287 296 NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_INFO_ALERT); 288 297 alert->Go(); 289 298 … … 324 333 // thread has finished (finished, quit, killed, we don't know) 325 334 // reset window state 326 335 if (fExpandingStarted) { 327 fStatusView->SetText( "File expanded");336 fStatusView->SetText(TR("File expanded")); 328 337 StopExpanding(); 329 338 OpenDestFolder(); 330 339 CloseWindowOrKeepOpen(); … … 339 348 case 'exrr': // thread has finished 340 349 // reset window state 341 350 342 fStatusView->SetText( "Error when expanding archive");351 fStatusView->SetText(TR("Error when expanding archive")); 343 352 CloseWindowOrKeepOpen(); 344 353 break; 345 354 … … 359 368 360 369 if (fExpandingStarted) { 361 370 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, 365 374 B_WARNING_ALERT); 366 375 if (alert->Go() == 0) { 367 376 fExpandingThread->ResumeExternalExpander(); … … 446 455 } 447 456 } 448 457 458 459 #undef TR_CONTEXT 460 #define TR_CONTEXT "ExpanderMenu" 461 449 462 void 450 463 ExpanderWindow::_AddMenuBar(BLayout* layout) 451 464 { 452 465 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")); 454 467 BMenuItem* item; 455 menu->AddItem(item = new BMenuItem( "About Expander" B_UTF8_ELLIPSIS,468 menu->AddItem(item = new BMenuItem(TR("About Expander…"), 456 469 new BMessage(B_ABOUT_REQUESTED))); 457 470 item->SetTarget(be_app_messenger); 458 471 menu->AddSeparatorItem(); 459 menu->AddItem(fSourceItem = new BMenuItem( "Set source" B_UTF8_ELLIPSIS,472 menu->AddItem(fSourceItem = new BMenuItem(TR("Set source…"), 460 473 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…"), 462 475 new BMessage(MSG_DEST), 'D')); 463 476 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')); 466 479 fExpandItem->SetEnabled(false); 467 menu->AddItem(fShowItem = new BMenuItem( "Show contents",480 menu->AddItem(fShowItem = new BMenuItem(TR("Show contents"), 468 481 new BMessage(MSG_SHOW), 'L')); 469 482 fShowItem->SetEnabled(false); 470 483 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')); 472 486 fStopItem->SetEnabled(false); 473 487 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')); 475 489 fBar->AddItem(menu); 476 490 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…"), 479 493 new BMessage(MSG_PREFERENCES), 'S')); 480 494 fBar->AddItem(menu); 481 495 layout->AddView(fBar); 482 496 } 483 497 484 498 499 #undef TR_CONTEXT 500 #define TR_CONTEXT "ExpanderWindow" 501 485 502 void 486 503 ExpanderWindow::StartExpanding() 487 504 { … … 491 508 492 509 BEntry destEntry(fDestText->Text(), true); 493 510 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, 496 514 B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); 497 515 alert->Go(); 498 516 return; … … 503 521 message.AddRef("srcRef", &fSourceRef); 504 522 message.AddRef("destRef", &fDestRef); 505 523 506 fExpandButton->SetLabel( "Stop");524 fExpandButton->SetLabel(TR("Stop")); 507 525 fSourceButton->SetEnabled(false); 508 526 fDestButton->SetEnabled(false); 509 527 fShowContents->SetEnabled(false); … … 516 534 517 535 BEntry entry(&fSourceRef); 518 536 BPath path(&entry); 519 BString text( "Expanding file ");537 BString text(TR("Expanding file ")); 520 538 text.Append(path.Leaf()); 521 539 fStatusView->SetText(text.String()); 522 540 … … 537 555 538 556 fExpandingStarted = false; 539 557 540 fExpandButton->SetLabel( "Expand");558 fExpandButton->SetLabel(TR("Expand")); 541 559 fSourceButton->SetEnabled(true); 542 560 fDestButton->SetEnabled(true); 543 561 fShowContents->SetEnabled(true); … … 642 660 fDestItem->SetEnabled(false); 643 661 fExpandItem->SetEnabled(false); 644 662 fShowItem->SetEnabled(true); 645 fShowItem->SetLabel( "Hide contents");663 fShowItem->SetLabel(TR("Hide contents")); 646 664 fStopItem->SetEnabled(false); 647 665 fPreferencesItem->SetEnabled(false); 648 666 … … 652 670 653 671 BEntry entry(&fSourceRef); 654 672 BPath path(&entry); 655 BString text( "Creating listing for ");673 BString text(TR("Creating listing for ")); 656 674 text.Append(path.Leaf()); 657 675 fStatusView->SetText(text.String()); 658 676 fListingText->SetText(""); -
ExpanderApp.cpp
8 8 #include "ExpanderWindow.h" 9 9 10 10 #include <Alert.h> 11 #include <Catalog.h> 12 #include <Locale.h> 11 13 #include <TextView.h> 12 14 13 14 15 ExpanderApp::ExpanderApp() 15 16 : BApplication("application/x-vnd.Haiku-Expander") 16 17 { 18 be_locale->GetAppCatalog(&fCatalog); 19 17 20 BPoint windowPosition = fSettings.Message().FindPoint("window_position"); 18 21 BRect windowFrame(0, 0, 450, 120); 19 22 windowFrame.OffsetBy(windowPosition); … … 22 25 } 23 26 24 27 28 #undef TR_CONTEXT 29 #define TR_CONTEXT "About" 30 25 31 void 26 32 ExpanderApp::AboutRequested() 27 33 { 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(); 34 38 BFont font; 35 39 36 40 view->SetStylable(true); … … 53 57 void 54 58 ExpanderApp::ArgvReceived(int32 argc, char **argv) 55 59 { 56 BMessage *msg = NULL;60 BMessage* msg = NULL; 57 61 for (int32 i = 1; i < argc; i++) { 58 62 entry_ref ref; 59 63 status_t err = get_ref_for_path(argv[i], &ref); … … 71 75 72 76 73 77 void 74 ExpanderApp::RefsReceived(BMessage *msg)78 ExpanderApp::RefsReceived(BMessage* msg) 75 79 { 76 80 BMessenger messenger(fWindow); 77 81 msg->AddBool("fromApp", true); … … 80 84 81 85 82 86 void 83 ExpanderApp::UpdateSettingsFrom(BMessage *message)87 ExpanderApp::UpdateSettingsFrom(BMessage* message) 84 88 { 85 89 fSettings.UpdateFrom(message); 86 90 } -
ExpanderApp.h
30 30 #define _ExpanderApp_h 31 31 32 32 #include <Application.h> 33 #include <Catalog.h> 33 34 #include "ExpanderSettings.h" 34 35 #include "ExpanderWindow.h" 35 36 … … 47 48 void UpdateSettingsFrom(BMessage *message); 48 49 private: 49 50 ExpanderWindow *fWindow; 51 BCatalog fCatalog; 50 52 }; 51 53 52 54 #endif /* _ExpanderApp_h */ -
DirectoryFilePanel.cpp
9 9 10 10 #include "DirectoryFilePanel.h" 11 11 12 #include <Catalog.h> 13 #include <Locale.h> 12 14 #include <Window.h> 13 15 14 16 #include <stdio.h> … … 41 43 42 44 // #pragma mark - 43 45 46 #undef TR_CONTEXT 47 #define TR_CONTEXT "DirectoryFilePanel" 44 48 45 DirectoryFilePanel::DirectoryFilePanel(file_panel_mode mode, BMessenger *target, 46 const entry_ref *startDirectory, uint32 nodeFlavors, 47 bool allowMultipleSelection, BMessage *message, BRefFilter *filter, 49 50 DirectoryFilePanel::DirectoryFilePanel(file_panel_mode mode, BMessenger* target, 51 const entry_ref* startDirectory, uint32 nodeFlavors, 52 bool allowMultipleSelection, BMessage* message, BRefFilter* filter, 48 53 bool modal, bool hideWhenDone) 49 54 : BFilePanel(mode, target, startDirectory, nodeFlavors, 50 55 allowMultipleSelection, message, filter, modal, hideWhenDone), … … 72 77 } 73 78 74 79 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; 76 81 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"), 78 83 new BMessage(MSG_DIRECTORY), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); 79 84 80 85 background->AddChild(fCurrentButton); 81 86 fCurrentButton->SetTarget(Messenger()); 82 87 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")); 85 90 86 91 Window()->Unlock(); 87 92 … … 100 105 char label[64]; 101 106 entry_ref ref; 102 107 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 "'"); 105 111 106 112 // Resize button so that the label fits 107 113 // maximum width is dictated by the window's size limits -
Jamfile
1 1 SubDir HAIKU_TOP src apps expander ; 2 2 3 SetSubDirSupportedPlatformsBeOSCompatible ;4 5 3 Application Expander : 6 4 ExpanderApp.cpp 7 5 ExpanderWindow.cpp … … 11 9 ExpanderPreferences.cpp 12 10 DirectoryFilePanel.cpp 13 11 ExpanderRules.cpp 14 : be tracker $(TARGET_LIBSUPC++)12 : be tracker liblocale.so $(TARGET_LIBSUPC++) 15 13 : Expander.rdef 16 14 ; 17 15 16 DoCatalogs 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
5 5 6 6 #include "ExpanderPreferences.h" 7 7 #include <Box.h> 8 #include <Catalog.h> 9 #include <GroupLayout.h> 10 #include <GroupLayoutBuilder.h> 11 #include <Locale.h> 8 12 #include <Path.h> 9 13 #include <Screen.h> 10 14 #include <StringView.h> … … 17 21 const uint32 MSG_DESTTEXT = 'mDet'; 18 22 const uint32 MSG_DESTSELECT = 'mDes'; 19 23 24 #undef TR_CONTEXT 25 #define TR_CONTEXT "ExpanderPreferences" 26 20 27 ExpanderPreferences::ExpanderPreferences(BMessage *settings) 21 28 : 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), 23 30 fSettings(settings), 24 31 fUsePanel(NULL) 25 32 { 33 BBox* box = new BBox("background"); 34 box->SetLabel(TR("Expander settings")); 26 35 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); 31 40 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"), 86 43 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"), 95 46 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)); 117 50 fDestText->SetDivider(0); 118 51 fDestText->TextView()->MakeEditable(false); 119 fDestText->ResizeTo(158, fDestText->Frame().Height());120 121 52 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)); 130 55 fSelect->SetEnabled(false); 131 56 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); 134 61 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); 137 101 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)); 167 103 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)); 171 106 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 ); 177 117 178 ResizeTo(box->Frame().right + 11 , button->Frame().bottom + 11);118 CenterOnScreen(); 179 119 180 BScreen screen(this);181 MoveBy((screen.Frame().Width() - Bounds().Width()) / 2,182 (screen.Frame().Height() - Bounds().Height()) / 2);183 184 120 bool automatically_expand_files; 185 121 bool close_when_done; 186 122 int8 destination_folder; … … 239 175 240 176 241 177 void 242 ExpanderPreferences::MessageReceived(BMessage *msg)178 ExpanderPreferences::MessageReceived(BMessage* msg) 243 179 { 244 180 switch (msg->what) { 245 181 case MSG_DESTSELECT: