Skip to content

Commit

Permalink
Merge pull request musescore#1300 from mgavioli/Edit_element_only_if_…
Browse files Browse the repository at this point in the history
…isEditable

Enter Edit Mode on an element only if isEditable()
  • Loading branch information
mgavioli committed Sep 10, 2014
2 parents 36380df + 8b686a3 commit 1479442
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions mscore/editelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ namespace Ms {

void ScoreView::startEdit(Element* e)
{
if (!e || !e->isEditable()) {
qDebug("The element cannot be edited");
return;
}
if (e->type() == Element::Type::TBOX)
e = static_cast<TBox*>(e)->getText();
editObject = e;
Expand All @@ -49,6 +53,10 @@ void ScoreView::startEdit(Element* e)

void ScoreView::startEdit(Element* element, int startGrip)
{
if (!element || !element->isEditable()) {
qDebug("The element cannot be edited");
return;
}
editObject = element;
startEdit();
if (startGrip == -1)
Expand Down
2 changes: 1 addition & 1 deletion mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2583,7 +2583,7 @@ void ScoreView::cmd(const QAction* a)

else if (cmd == "edit-element") {
Element* e = _score->selection().element();
if (e) {
if (e && e->isEditable()) {
_score->setLayoutAll(false);
startEdit(e);
}
Expand Down

0 comments on commit 1479442

Please sign in to comment.