Ticket #5626: screenshotEnhancement-5626.patch
File screenshotEnhancement-5626.patch, 3.3 KB (added by , 14 years ago) |
---|
-
src/apps/screenshot/ScreenshotWindow.cpp
159 159 BCardLayout* layout = dynamic_cast<BCardLayout*> (GetLayout()); 160 160 if (layout) 161 161 layout->SetVisibleItem(1L); 162 163 fSaveScreenshot->MakeDefault(true); 164 162 165 SetTitle(TR("Save screenshot")); 163 166 break; 164 167 } … … 168 171 _TakeScreenshot(); 169 172 _UpdatePreviewPanel(); 170 173 Show(); 174 _UpdateFilenameSelection(); 171 175 break; 172 176 173 177 case kImageOutputFormat: 174 178 message->FindInt32("be:type", &fImageFileType); 175 179 message->FindInt32("be:translator", &fTranslator); 176 180 fNameControl->SetText(_FindValidFileName(fNameControl->Text()).String()); 181 _UpdateFilenameSelection(); 177 182 break; 178 183 179 184 case kLocationChanged: … … 183 188 fLastSelectedPath = static_cast<BMenuItem*> (source); 184 189 185 190 fNameControl->SetText(_FindValidFileName(fNameControl->Text()).String()); 191 _UpdateFilenameSelection(); 186 192 break; 187 193 } 188 194 … … 235 241 236 242 if (layout) 237 243 layout->SetVisibleItem(0L); 244 SetDefaultButton(NULL); 238 245 239 246 SetTitle(TR("Take Screenshot")); 240 247 fBackToSave->SetEnabled(true); … … 280 287 _TakeScreenshot(); 281 288 _UpdatePreviewPanel(); 282 289 layout->SetVisibleItem(1L); 283 } else 290 fSaveScreenshot->MakeDefault(true); 291 } else { 284 292 layout->SetVisibleItem(0L); 293 SetDefaultButton(NULL); 294 } 285 295 } 286 296 287 297 … … 392 402 BBox* divider = new BBox(B_FANCY_BORDER, NULL); 393 403 divider->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1)); 394 404 405 fSaveScreenshot = new BButton("", 406 TR("Save"), new BMessage(kFinishScreenshot)); 407 395 408 BGridLayout* gridLayout = BGridLayoutBuilder(0.0, 5.0) 396 409 .Add(fNameControl->CreateLabelLayoutItem(), 0, 0) 397 410 .Add(fNameControl->CreateTextViewLayoutItem(), 1, 0) … … 416 429 .Add(new BButton("", TR("Options"), new BMessage(kShowOptions))) 417 430 .AddGlue() 418 431 .Add(new BButton("", TR("Cancel"), new BMessage(B_QUIT_REQUESTED))) 419 .Add( new BButton("", TR("Save"), new BMessage(kFinishScreenshot)))432 .Add(fSaveScreenshot) 420 433 .End() 421 434 .SetInsets(10.0, 10.0, 10.0, 10.0) 422 435 ); … … 561 574 if (layout) 562 575 layout->SetVisibleItem(1L); 563 576 577 _UpdateFilenameSelection(); 578 564 579 SetTitle(TR("Save screenshot")); 565 580 } 566 581 567 582 583 void 584 ScreenshotWindow::_UpdateFilenameSelection() 585 { 586 fNameControl->MakeFocus(true); 587 fNameControl->TextView()->Select(0, 588 fNameControl->TextView()->TextLength() - 589 fExtension.Length()); 590 fNameControl->TextView()->ScrollToSelection(); 591 } 592 593 568 594 BString 569 595 ScreenshotWindow::_FindValidFileName(const char* name) 570 596 { -
src/apps/screenshot/ScreenshotWindow.h
56 56 BString& label, int32 index, bool markItem); 57 57 58 58 void _UpdatePreviewPanel(); 59 void _UpdateFilenameSelection(); 59 60 BString _FindValidFileName(const char* name); 60 61 int32 _PathIndexInMenu(const BString& path) const; 61 62 … … 76 77 BCheckBox* fShowMouse; 77 78 BButton* fBackToSave; 78 79 BButton* fTakeScreenshot; 80 BButton* fSaveScreenshot; 79 81 BTextControl* fNameControl; 80 82 BMenu* fTranslatorMenu; 81 83 BMenu* fOutputPathMenu;