From 2c38f3fdffdced3cc06349c43dc052ccf8463708 Mon Sep 17 00:00:00 2001
From: Freeman Lou <freemanlou2430@Yahoo.com>
Date: Fri, 6 Dec 2013 15:57:09 +0000
Subject: [PATCH] screenshot shortcut
---
src/apps/screenshot/ScreenshotWindow.cpp | 13 +++++++------
src/apps/screenshot/ScreenshotWindow.h | 3 ++-
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/apps/screenshot/ScreenshotWindow.cpp b/src/apps/screenshot/ScreenshotWindow.cpp
index 4bca590..4a30e2e 100644
a
|
b
|
ScreenshotWindow::_SetupOutputPathMenu(const BMessage& settings)
|
481 | 481 | |
482 | 482 | BString label(B_TRANSLATE("Home folder")); |
483 | 483 | _AddItemToPathMenu(path.Path(), label, 0, |
484 | | (path.Path() == lastSelectedPath)); |
| 484 | (path.Path() == lastSelectedPath), 'H'); |
485 | 485 | |
486 | 486 | path.Append("Desktop"); |
487 | 487 | label.SetTo(B_TRANSLATE("Desktop")); |
488 | 488 | _AddItemToPathMenu(path.Path(), label, 0, ( |
489 | | path.Path() == lastSelectedPath)); |
| 489 | path.Path() == lastSelectedPath), 'D'); |
490 | 490 | |
491 | 491 | find_directory(B_BEOS_ETC_DIRECTORY, &path); |
492 | 492 | path.Append("artwork"); |
493 | 493 | |
494 | 494 | label.SetTo(B_TRANSLATE("Artwork folder")); |
495 | 495 | _AddItemToPathMenu(path.Path(), label, 2, |
496 | | (path.Path() == lastSelectedPath)); |
| 496 | (path.Path() == lastSelectedPath), 'A'); |
497 | 497 | |
498 | 498 | int32 i = 0; |
499 | 499 | BString userPath; |
… |
… |
ScreenshotWindow::_SetupOutputPathMenu(const BMessage& settings)
|
513 | 513 | |
514 | 514 | fOutputPathMenu->AddItem(new BSeparatorItem()); |
515 | 515 | fOutputPathMenu->AddItem(new BMenuItem(B_TRANSLATE("Choose folder..."), |
516 | | new BMessage(kChooseLocation))); |
| 516 | new BMessage(kChooseLocation), 'F')); |
517 | 517 | } |
518 | 518 | |
519 | 519 | |
520 | 520 | void |
521 | 521 | ScreenshotWindow::_AddItemToPathMenu(const char* path, BString& label, |
522 | | int32 index, bool markItem) |
| 522 | int32 index, bool markItem, uint32 shortcutKey = 0) |
523 | 523 | { |
524 | 524 | // Make sure that item won't be a duplicate of an existing one |
525 | 525 | for (int32 i = fOutputPathMenu->CountItems() - 1; i >= 0; --i) { |
… |
… |
ScreenshotWindow::_AddItemToPathMenu(const char* path, BString& label,
|
544 | 544 | fOutputPathMenu->TruncateString(&label, B_TRUNCATE_MIDDLE, |
545 | 545 | fOutputPathMenu->StringWidth("SomethingLongHere")); |
546 | 546 | |
547 | | fOutputPathMenu->AddItem(new BMenuItem(label.String(), message), index); |
| 547 | fOutputPathMenu->AddItem(new BMenuItem(label.String(), message, |
| 548 | shortcutKey), index); |
548 | 549 | |
549 | 550 | if (markItem) { |
550 | 551 | fOutputPathMenu->ItemAt(index)->SetMarked(true); |
diff --git a/src/apps/screenshot/ScreenshotWindow.h b/src/apps/screenshot/ScreenshotWindow.h
index 036a9b4..0e9726d 100644
a
|
b
|
private:
|
45 | 45 | void _DisallowChar(BTextView* textView); |
46 | 46 | void _SetupOutputPathMenu(const BMessage& settings); |
47 | 47 | void _AddItemToPathMenu(const char* path, |
48 | | BString& label, int32 index, bool markItem); |
| 48 | BString& label, int32 index, bool markItem, |
| 49 | uint32 shortcutKey = 0); |
49 | 50 | void _UpdateFilenameSelection(); |
50 | 51 | void _SetupTranslatorMenu(); |
51 | 52 | status_t _SaveScreenshot(); |