fixed notation escape

This commit is contained in:
Igor Korsukov 2021-12-14 12:03:11 +02:00
parent 1be98d4125
commit 2210e3edb4
7 changed files with 16 additions and 9 deletions

View file

@ -162,10 +162,13 @@ bool UiContextResolver::isShortcutContextAllowed(const std::string& scContext) c
//! NotationStaffTab
static const std::string CTX_ANY("any");
static const std::string CTX_NOTATION_OPENED("notation-opened");
static const std::string CTX_NOTATION_STAFF_STANDARD("notation-staff-standard");
static const std::string CTX_NOTATION_STAFF_TAB("notation-staff-tab");
if (CTX_NOTATION_STAFF_STANDARD == scContext) {
if (CTX_NOTATION_OPENED == scContext) {
return matchWithCurrent(context::UiCtxNotationOpened);
} else if (CTX_NOTATION_STAFF_STANDARD == scContext) {
auto notation = globalContext()->currentNotation();
if (!notation) {
return false;

View file

@ -523,8 +523,9 @@
<seq>Ctrl+Y,Ctrl+O,Ctrl+B</seq>
</SC>
<SC>
<key>escape</key>
<key>notation-escape</key>
<seq>Esc</seq>
<ctx>notation-opened</ctx>
</SC>
<SC>
<key>delete</key>

View file

@ -523,8 +523,9 @@
<seq>Ctrl+Y,Ctrl+O,Ctrl+B</seq>
</SC>
<SC>
<key>escape</key>
<key>notation-escape</key>
<seq>Esc</seq>
<ctx>notation-opened</ctx>
</SC>
<SC>
<key>delete</key>

View file

@ -532,8 +532,9 @@
<seq>Ctrl+Y,Ctrl+O,Ctrl+B</seq>
</SC>
<SC>
<key>escape</key>
<key>notation-escape</key>
<seq>Esc</seq>
<ctx>notation-opened</ctx>
</SC>
<SC>
<key>delete</key>

View file

@ -32,7 +32,6 @@ using namespace mu::framework;
static constexpr int INVALID_BOX_INDEX = -1;
static constexpr qreal STRETCH_STEP = 0.1;
static const ActionCode ESCAPE_ACTION_CODE = "escape";
static const ActionCode UNDO_ACTION_CODE = "undo";
static const ActionCode REDO_ACTION_CODE = "redo";
@ -45,7 +44,7 @@ void NotationActionController::init()
using Interaction = INotationInteraction;
//! NOTE For historical reasons, the name of the action does not match what needs to be done
registerAction(ESCAPE_ACTION_CODE, &Controller::resetState, &Controller::isNotationPage);
registerAction("notation-escape", &Controller::resetState, &Controller::isNotationPage);
registerAction("note-input", [this]() { toggleNoteInput(); });
registerNoteInputAction("note-input-steptime", NoteInputMethod::STEPTIME);
@ -1416,7 +1415,7 @@ bool NotationActionController::canRedo() const
bool NotationActionController::isNotationPage() const
{
return interactive()->isOpened("musescore://notation").val;
return uiContextResolver()->matchWithCurrent(context::UiCtxNotationOpened);
}
bool NotationActionController::isStandardStaff() const

View file

@ -28,6 +28,7 @@
#include "actions/actiontypes.h"
#include "async/asyncable.h"
#include "context/iglobalcontext.h"
#include "context/iuicontextresolver.h"
#include "inotation.h"
#include "iinteractive.h"
#include "playback/iplaybackcontroller.h"
@ -39,6 +40,7 @@ class NotationActionController : public actions::Actionable, public async::Async
{
INJECT(notation, actions::IActionsDispatcher, dispatcher)
INJECT(notation, context::IGlobalContext, globalContext)
INJECT(notation, context::IUiContextResolver, uiContextResolver)
INJECT(notation, framework::IInteractive, interactive)
INJECT(notation, playback::IPlaybackController, playbackController)
INJECT(notation, playback::IPlaybackConfiguration, playbackConfiguration)

View file

@ -40,8 +40,8 @@ static const ActionCode SHOW_IRREGULAR_CODE("show-irregular");
static const ActionCode TOGGLE_CONCERT_PITCH_CODE("concert-pitch");
const UiActionList NotationUiActions::m_actions = {
UiAction("escape",
mu::context::UiCtxNotationFocused,
UiAction("notation-escape",
mu::context::UiCtxNotationOpened,
QT_TRANSLATE_NOOP("action", "Esc")
),
UiAction("put-note", // args: PointF pos, bool replace, bool insert