|
| 1 | +/* |
| 2 | + * SPDX-License-Identifier: GPL-3.0-only |
| 3 | + * MuseScore-CLA-applies |
| 4 | + * |
| 5 | + * MuseScore Studio |
| 6 | + * Music Composition & Notation |
| 7 | + * |
| 8 | + * Copyright (C) 2021 MuseScore Limited and others |
| 9 | + * |
| 10 | + * This program is free software: you can redistribute it and/or modify |
| 11 | + * it under the terms of the GNU General Public License version 3 as |
| 12 | + * published by the Free Software Foundation. |
| 13 | + * |
| 14 | + * This program is distributed in the hope that it will be useful, |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | + * GNU General Public License for more details. |
| 18 | + * |
| 19 | + * You should have received a copy of the GNU General Public License |
| 20 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 21 | + */ |
| 22 | +#include "navigationuiactions.h" |
| 23 | + |
| 24 | +#include "../uiaction.h" |
| 25 | +#include "shortcuts/shortcutcontext.h" |
| 26 | + |
| 27 | +#include "muse_framework_config.h" |
| 28 | + |
| 29 | +using namespace muse::ui; |
| 30 | +using namespace muse::actions; |
| 31 | + |
| 32 | +#ifdef MUSE_MODULE_UI_NAVIGATION_EXCLUDEPROJECT |
| 33 | +static const std::string NAVIGATION_SHORTCUTS_CTX = muse::shortcuts::CTX_NOT_PROJECT_FOCUSED; |
| 34 | +#else |
| 35 | +static const std::string NAVIGATION_SHORTCUTS_CTX = muse::shortcuts::CTX_ANY; |
| 36 | +#endif |
| 37 | + |
| 38 | +const UiActionList NavigationUiActions::m_actions = { |
| 39 | + UiAction("nav-dev-show-controls", |
| 40 | + ui::UiCtxAny, |
| 41 | + muse::shortcuts::CTX_ANY |
| 42 | + ), |
| 43 | + UiAction("nav-next-section", |
| 44 | + ui::UiCtxAny, |
| 45 | + muse::shortcuts::CTX_ANY |
| 46 | + ), |
| 47 | + UiAction("nav-prev-section", |
| 48 | + ui::UiCtxAny, |
| 49 | + muse::shortcuts::CTX_ANY |
| 50 | + ), |
| 51 | + UiAction("nav-next-panel", |
| 52 | + ui::UiCtxAny, |
| 53 | + muse::shortcuts::CTX_ANY |
| 54 | + ), |
| 55 | + UiAction("nav-prev-panel", |
| 56 | + ui::UiCtxAny, |
| 57 | + muse::shortcuts::CTX_ANY |
| 58 | + ), |
| 59 | + UiAction("nav-next-tab", |
| 60 | + ui::UiCtxAny, |
| 61 | + muse::shortcuts::CTX_ANY |
| 62 | + ), |
| 63 | + UiAction("nav-prev-tab", |
| 64 | + ui::UiCtxAny, |
| 65 | + muse::shortcuts::CTX_ANY |
| 66 | + ), |
| 67 | + UiAction("nav-right", |
| 68 | + ui::UiCtxAny, |
| 69 | + NAVIGATION_SHORTCUTS_CTX |
| 70 | + ), |
| 71 | + UiAction("nav-left", |
| 72 | + ui::UiCtxAny, |
| 73 | + NAVIGATION_SHORTCUTS_CTX |
| 74 | + ), |
| 75 | + UiAction("nav-up", |
| 76 | + ui::UiCtxAny, |
| 77 | + NAVIGATION_SHORTCUTS_CTX |
| 78 | + ), |
| 79 | + UiAction("nav-down", |
| 80 | + ui::UiCtxAny, |
| 81 | + NAVIGATION_SHORTCUTS_CTX |
| 82 | + ), |
| 83 | + UiAction("nav-escape", |
| 84 | + ui::UiCtxAny, |
| 85 | + muse::shortcuts::CTX_DISABLED |
| 86 | + ), |
| 87 | + UiAction("nav-trigger-control", |
| 88 | + ui::UiCtxAny, |
| 89 | + NAVIGATION_SHORTCUTS_CTX |
| 90 | + ), |
| 91 | + UiAction("nav-first-control", |
| 92 | + ui::UiCtxAny, |
| 93 | + NAVIGATION_SHORTCUTS_CTX |
| 94 | + ), |
| 95 | + UiAction("nav-last-control", |
| 96 | + ui::UiCtxAny, |
| 97 | + NAVIGATION_SHORTCUTS_CTX |
| 98 | + ), |
| 99 | + UiAction("nav-nextrow-control", |
| 100 | + ui::UiCtxAny, |
| 101 | + NAVIGATION_SHORTCUTS_CTX |
| 102 | + ), |
| 103 | + UiAction("nav-prevrow-control", |
| 104 | + ui::UiCtxAny, |
| 105 | + NAVIGATION_SHORTCUTS_CTX |
| 106 | + ) |
| 107 | +}; |
| 108 | + |
| 109 | +const UiActionList& NavigationUiActions::actionsList() const |
| 110 | +{ |
| 111 | + return m_actions; |
| 112 | +} |
| 113 | + |
| 114 | +bool NavigationUiActions::actionEnabled(const UiAction&) const |
| 115 | +{ |
| 116 | + return true; |
| 117 | +} |
| 118 | + |
| 119 | +muse::async::Channel<ActionCodeList> NavigationUiActions::actionEnabledChanged() const |
| 120 | +{ |
| 121 | + static async::Channel<ActionCodeList> ch; |
| 122 | + return ch; |
| 123 | +} |
| 124 | + |
| 125 | +bool NavigationUiActions::actionChecked(const UiAction&) const |
| 126 | +{ |
| 127 | + return false; |
| 128 | +} |
| 129 | + |
| 130 | +muse::async::Channel<ActionCodeList> NavigationUiActions::actionCheckedChanged() const |
| 131 | +{ |
| 132 | + static async::Channel<ActionCodeList> ch; |
| 133 | + return ch; |
| 134 | +} |
0 commit comments