Skip to content

Commit

Permalink
fix state handling when editing lyrics/figured-bass etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Feb 18, 2013
1 parent 9bc13fa commit 861d884
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
2 changes: 0 additions & 2 deletions libmscore/simpletext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ SimpleText::SimpleText(const SimpleText& st)

void SimpleText::draw(QPainter* p) const
{
drawFrame(p);
p->setFont(textStyle().fontPx(spatium()));
p->setBrush(Qt::NoBrush);
p->setPen(textColor());
Expand All @@ -72,7 +71,6 @@ QRectF SimpleText::cursorRect() const
{
QFontMetricsF fm(_textStyle.fontPx(spatium()));
int line = _cursor.line;
// qreal lh = lineHeight();
QPointF pt = _layout[line].pos;
qreal xo = fm.width(_layout[line].text.left(_cursor.column));

Expand Down
4 changes: 2 additions & 2 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2607,8 +2607,8 @@ void MuseScore::changeState(ScoreState val)
if (MScore::debugMode)
qDebug("MuseScore::changeState: %s", stateName(val));

if (_sstate == val)
return;
// if (_sstate == val)
// return;
foreach (const Shortcut* s, Shortcut::shortcuts()) {
QAction* a = s->action();
if (!a)
Expand Down
13 changes: 8 additions & 5 deletions mscore/propertymenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "jumpproperties.h"
#include "selinstrument.h"
#include "chordedit.h"
#include "chordeditor.h"
#include "pianoroll.h"
#include "editstyle.h"
#include "editstaff.h"
#include "measureproperties.h"
Expand Down Expand Up @@ -676,10 +676,13 @@ void ScoreView::elementPropertyAction(const QString& cmd, Element* e)
}
else if (cmd == "articulation") {
Note* note = static_cast<Note*>(e);
ChordEditor ce(note->chord());
mscore->disableCommands(true);
ce.exec();
mscore->disableCommands(false);
mscore->editInPianoroll(note->staff());

// PianorollEditor ce(note->chord());
// PianorollEditor ce;
// mscore->disableCommands(true);
// ce.exec();
// mscore->disableCommands(false);
}
else if (cmd == "style") {
EditStyle es(e->score(), 0);
Expand Down
14 changes: 13 additions & 1 deletion mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1730,7 +1730,7 @@ void ScoreView::paint(const QRect& r, QPainter& p)
e = e->parent();
Text* text = static_cast<Text*>(editObject);
QRectF r = text->pageRectangle().translated(e->pos()); // abbox();
p.setPen(QPen(QBrush(Qt::blue), 2.0 / matrix().m11())); // 2 pixel pen size
p.setPen(QPen(QBrush(Qt::lightGray), 2.0 / matrix().m11())); // 2 pixel pen size
p.setBrush(QBrush(Qt::NoBrush));
p.drawRect(r);
}
Expand Down Expand Up @@ -4318,6 +4318,8 @@ void ScoreView::lyricsTab(bool back, bool end, bool moveOnly)

_score->select(lyrics, SELECT_SINGLE, 0);
startEdit(lyrics, -1);
mscore->changeState(mscoreState());

adjustCanvasPosition(lyrics, false);
if (end)
((Lyrics*)editObject)->moveCursorToEnd();
Expand Down Expand Up @@ -4407,6 +4409,8 @@ void ScoreView::lyricsMinus()

_score->select(lyrics, SELECT_SINGLE, 0);
startEdit(lyrics, -1);
mscore->changeState(mscoreState());

adjustCanvasPosition(lyrics, false);
((Lyrics*)editObject)->moveCursorToEnd();

Expand Down Expand Up @@ -4496,6 +4500,8 @@ void ScoreView::lyricsUnderscore()

_score->select(lyrics, SELECT_SINGLE, 0);
startEdit(lyrics, -1);
mscore->changeState(mscoreState());

adjustCanvasPosition(lyrics, false);
((Lyrics*)editObject)->moveCursorToEnd();

Expand Down Expand Up @@ -4526,6 +4532,8 @@ void ScoreView::lyricsReturn()
_score->undoAddElement(lyrics);
_score->select(lyrics, SELECT_SINGLE, 0);
startEdit(lyrics, -1);
mscore->changeState(mscoreState());

adjustCanvasPosition(lyrics, false);
_score->setLayoutAll(true);
_score->end2();
Expand Down Expand Up @@ -4653,6 +4661,8 @@ void ScoreView::chordTab(bool back)

_score->select(cn, SELECT_SINGLE, 0);
startEdit(cn, -1);
mscore->changeState(mscoreState());

adjustCanvasPosition(cn, false);
((Harmony*)editObject)->moveCursorToEnd();

Expand Down Expand Up @@ -5255,6 +5265,7 @@ void ScoreView::figuredBassTab(bool bMeas, bool bBack)
_score->undoAddElement(fbNew);
_score->select(fbNew, SELECT_SINGLE, 0);
startEdit(fbNew, -1);
mscore->changeState(mscoreState());
adjustCanvasPosition(fbNew, false);
((FiguredBass*)editObject)->moveCursorToEnd();
_score->setLayoutAll(true);
Expand Down Expand Up @@ -5299,6 +5310,7 @@ void ScoreView::figuredBassTicksTab(int ticks)
if(bNew)
_score->undoAddElement(fbNew);
_score->select(fbNew, SELECT_SINGLE, 0);
mscore->changeState(mscoreState());
startEdit(fbNew, -1);
adjustCanvasPosition(fbNew, false);
((FiguredBass*)editObject)->moveCursorToEnd();
Expand Down
1 change: 1 addition & 0 deletions mscore/texttools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ void TextTools::updateTools()
{
if (!_textElement->editMode()) {
qDebug("TextTools::updateTools(): not in edit mode");
abort();
return;
}
if (_textElement->styled()) // TODO
Expand Down

0 comments on commit 861d884

Please sign in to comment.