Ticket #7987: 0001-screenshot-shortcut.patch

File 0001-screenshot-shortcut.patch, 2.9 KB (added by Freeman, 10 years ago)
  • src/apps/screenshot/ScreenshotWindow.cpp

    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)  
    481481
    482482    BString label(B_TRANSLATE("Home folder"));
    483483    _AddItemToPathMenu(path.Path(), label, 0,
    484         (path.Path() == lastSelectedPath));
     484        (path.Path() == lastSelectedPath), 'H');
    485485
    486486    path.Append("Desktop");
    487487    label.SetTo(B_TRANSLATE("Desktop"));
    488488    _AddItemToPathMenu(path.Path(), label, 0, (
    489         path.Path() == lastSelectedPath));
     489        path.Path() == lastSelectedPath), 'D');
    490490
    491491    find_directory(B_BEOS_ETC_DIRECTORY, &path);
    492492    path.Append("artwork");
    493493
    494494    label.SetTo(B_TRANSLATE("Artwork folder"));
    495495    _AddItemToPathMenu(path.Path(), label, 2,
    496         (path.Path() == lastSelectedPath));
     496        (path.Path() == lastSelectedPath), 'A');
    497497
    498498    int32 i = 0;
    499499    BString userPath;
    ScreenshotWindow::_SetupOutputPathMenu(const BMessage& settings)  
    513513
    514514    fOutputPathMenu->AddItem(new BSeparatorItem());
    515515    fOutputPathMenu->AddItem(new BMenuItem(B_TRANSLATE("Choose folder..."),
    516         new BMessage(kChooseLocation)));
     516        new BMessage(kChooseLocation), 'F'));
    517517}
    518518
    519519
    520520void
    521521ScreenshotWindow::_AddItemToPathMenu(const char* path, BString& label,
    522     int32 index, bool markItem)
     522    int32 index, bool markItem, uint32 shortcutKey = 0)
    523523{
    524524    // Make sure that item won't be a duplicate of an existing one
    525525    for (int32 i = fOutputPathMenu->CountItems() - 1; i >= 0; --i) {
    ScreenshotWindow::_AddItemToPathMenu(const char* path, BString& label,  
    544544    fOutputPathMenu->TruncateString(&label, B_TRUNCATE_MIDDLE,
    545545        fOutputPathMenu->StringWidth("SomethingLongHere"));
    546546
    547     fOutputPathMenu->AddItem(new BMenuItem(label.String(), message), index);
     547    fOutputPathMenu->AddItem(new BMenuItem(label.String(), message,
     548        shortcutKey), index);
    548549
    549550    if (markItem) {
    550551        fOutputPathMenu->ItemAt(index)->SetMarked(true);
  • src/apps/screenshot/ScreenshotWindow.h

    diff --git a/src/apps/screenshot/ScreenshotWindow.h b/src/apps/screenshot/ScreenshotWindow.h
    index 036a9b4..0e9726d 100644
    a b private:  
    4545            void            _DisallowChar(BTextView* textView);
    4646            void            _SetupOutputPathMenu(const BMessage& settings);
    4747            void            _AddItemToPathMenu(const char* path,
    48                                 BString& label, int32 index, bool markItem);
     48                                BString& label, int32 index, bool markItem,
     49                                uint32 shortcutKey = 0);
    4950            void            _UpdateFilenameSelection();
    5051            void            _SetupTranslatorMenu();
    5152            status_t        _SaveScreenshot();