Skip to content

Commit

Permalink
fix #45961 Adding measures does not mark the file as changed
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Feb 3, 2015
1 parent 791625f commit 24419cb
Show file tree
Hide file tree
Showing 26 changed files with 79 additions and 107 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ include (GetCompilerVersion)
include (CreatePrecompiledHeader)

# for debugging the make system uncomment next line:
# set(CMAKE_VERBOSE_MAKEFILE ON)
#set(CMAKE_VERBOSE_MAKEFILE ON)

set (CMAKE_AUTOMOC TRUE)

Expand Down
2 changes: 2 additions & 0 deletions libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <assert.h>

#include "musescoreCore.h"
#include "score.h"
#include "utils.h"
#include "key.h"
Expand Down Expand Up @@ -144,6 +145,7 @@ void Score::endCmd(bool rollback)
rootScore()->_playlistDirty = true; // TODO: flag individual operations
rootScore()->_autosaveDirty = true;
}
MuseScoreCore::mscoreCore->endCmd();
}

//---------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions libmscore/mscore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//=============================================================================

#include "config.h"
#include "musescoreCore.h"
#include "style.h"
#include "mscore.h"
#include "sequencer.h"
Expand Down Expand Up @@ -95,6 +96,7 @@ QQmlEngine* MScore::_qml = 0;
#endif

Sequencer* MScore::seq = 0;
MuseScoreCore* MuseScoreCore::mscoreCore;

extern void initDrumset();
extern void initScoreFonts();
Expand Down
1 change: 1 addition & 0 deletions libmscore/mscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ class MScore : public QObject {
#ifdef SCRIPT_INTERFACE
static QQmlEngine* qml();
#endif
virtual void endCmd() { };
};

//---------------------------------------------------------
Expand Down
7 changes: 4 additions & 3 deletions mscore/musescoreCore.h → libmscore/musescoreCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ class MuseScoreCore
QList<Score*> scoreList;

public:
MuseScoreCore() {}
Score* currentScore() const { return cs; }
void setCurrentScore(Score* score) { cs = score; }
static MuseScoreCore* mscoreCore;
MuseScoreCore() { mscoreCore = this; }
Score* currentScore() const { return cs; }
void setCurrentScore(Score* score) { cs = score; }

bool saveAs(Score*, bool /*saveCopy*/, const QString& /*path*/, const QString& /*ext*/) { return false; }
virtual void cmd(QAction* /*a*/) {}
Expand Down
5 changes: 0 additions & 5 deletions libmscore/ottava.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,9 @@ Ottava::Ottava(Score* s)
: TextLine(s)
{
_numbersOnly = score()->styleB(StyleIdx::ottavaNumbersOnly);
numbersOnlyStyle = PropertyStyle::STYLED;
beginTextStyle = PropertyStyle::STYLED;
continueTextStyle = PropertyStyle::STYLED;
setOttavaType(Type::OTTAVA_8VA);
setLineWidth(score()->styleS(StyleIdx::ottavaLineWidth));
lineWidthStyle = PropertyStyle::STYLED;
setLineStyle(Qt::PenStyle(score()->styleI(StyleIdx::ottavaLineStyle)));
lineStyleStyle = PropertyStyle::STYLED;
setFlag(ElementFlag::ON_STAFF, true);
}

Expand Down
12 changes: 6 additions & 6 deletions libmscore/ottava.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Ottava : public TextLine {
Q_ENUMS(Type)

public:
enum class Type : char {
enum Type : char {
OTTAVA_8VA,
OTTAVA_8VB,
OTTAVA_15MA,
Expand All @@ -75,11 +75,11 @@ class Ottava : public TextLine {
private:
Type _ottavaType;
bool _numbersOnly;
PropertyStyle numbersOnlyStyle;
PropertyStyle lineWidthStyle;
PropertyStyle lineStyleStyle;
PropertyStyle beginTextStyle;
PropertyStyle continueTextStyle;
PropertyStyle numbersOnlyStyle { PropertyStyle::STYLED };
PropertyStyle lineWidthStyle { PropertyStyle::STYLED };
PropertyStyle lineStyleStyle { PropertyStyle::STYLED };
PropertyStyle beginTextStyle { PropertyStyle::STYLED };
PropertyStyle continueTextStyle { PropertyStyle::STYLED };

int _pitchShift;

Expand Down
4 changes: 0 additions & 4 deletions mscore/dragdrop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,6 @@ void ScoreView::dropEvent(QDropEvent* event)
// update input cursor position (must be done after layout)
if (noteEntryMode())
moveCursor();
mscore->endCmd();
return;
}

Expand All @@ -633,7 +632,6 @@ void ScoreView::dropEvent(QDropEvent* event)
}
event->acceptProposedAction();
score()->endCmd();
mscore->endCmd();
setDropTarget(0); // this also resets dropRectangle and dropAnchor
return;
}
Expand Down Expand Up @@ -671,7 +669,6 @@ void ScoreView::dropEvent(QDropEvent* event)
}
event->acceptProposedAction();
score()->endCmd();
mscore->endCmd();
setDropTarget(0); // this also resets dropRectangle and dropAnchor
return;
}
Expand Down Expand Up @@ -726,7 +723,6 @@ void ScoreView::dropEvent(QDropEvent* event)
event->acceptProposedAction();
_score->setLayoutAll(true);
_score->endCmd();
mscore->endCmd();
}
setDropTarget(0); // this also resets dropRectangle and dropAnchor
}
Expand Down
1 change: 0 additions & 1 deletion mscore/dragelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ void ScoreView::endDrag()
dragElement = 0;
setDropTarget(0); // this also resets dropAnchor
_score->endCmd();
mscore->endCmd();
}
}

1 change: 0 additions & 1 deletion mscore/drumroll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ void DrumrollEditor::cmd(QAction* a)
}

gv->setStaff(staff, locator);
score()->endCmd();
}
}

1 change: 0 additions & 1 deletion mscore/editelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ void ScoreView::endEdit()
}

_score->endCmd();
mscore->endCmd();

if (dragElement && (dragElement != editObject)) {
curElement = dragElement;
Expand Down
8 changes: 4 additions & 4 deletions mscore/inspector/inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class InspectorRest : public InspectorBase {

public:
InspectorRest(QWidget* parent);
virtual void setElement();
virtual void setElement() override;
};

//---------------------------------------------------------
Expand All @@ -148,7 +148,7 @@ class InspectorClef : public InspectorBase {
Clef* otherClef; // the courtesy clef for a main clef or viceversa
// used to keep in sync ShowCourtesy setting of both clefs
protected slots:
virtual void valueChanged(int idx);
virtual void valueChanged(int idx) override;

public:
InspectorClef(QWidget* parent);
Expand Down Expand Up @@ -244,7 +244,7 @@ class InspectorTempoText : public InspectorBase {
public:
InspectorTempoText(QWidget* parent);
virtual void setElement() override;
virtual void postInit();
virtual void postInit() override;
};

//---------------------------------------------------------
Expand Down Expand Up @@ -340,7 +340,7 @@ class InspectorEmpty : public InspectorBase {

public:
InspectorEmpty(QWidget* parent);
virtual QSize sizeHint() const;
virtual QSize sizeHint() const override;
};

} // namespace Ms
Expand Down
4 changes: 1 addition & 3 deletions mscore/inspector/inspectorAmbitus.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ class InspectorAmbitus : public InspectorBase {

public:
InspectorAmbitus(QWidget* parent);
// virtual void setElement();

protected slots:
void updateRange();
virtual void valueChanged(int idx);

virtual void valueChanged(int idx) override;
};


Expand Down
2 changes: 1 addition & 1 deletion mscore/inspector/inspectorImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class InspectorImage : public InspectorBase {
void updateSizeFromScale(const QSizeF&);

protected slots:
virtual void valueChanged(int idx);
virtual void valueChanged(int idx) override;

public:
InspectorImage(QWidget* parent);
Expand Down
2 changes: 1 addition & 1 deletion mscore/inspector/inspectorNote.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class InspectorNote : public InspectorBase {

public:
InspectorNote(QWidget* parent);
virtual void setElement();
virtual void setElement() override;
};


Expand Down
1 change: 0 additions & 1 deletion mscore/mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ void PartEdit::patchChanged(int n)
score->startCmd();
score->undo(new ChangePatch(channel, p));
score->endCmd();
mscore->endCmd();
}
}

Expand Down
22 changes: 11 additions & 11 deletions mscore/mscorePlugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void MuseScore::unregisterPlugin(PluginDescription* plugin)
if (np.suffix() != "qml")
return;
QString baseName = np.baseName();

bool found = false;
foreach(QString s, plugins) {
QFileInfo fi(s);
Expand All @@ -146,15 +146,15 @@ void MuseScore::unregisterPlugin(PluginDescription* plugin)
return;
}
plugins.removeAll(pluginPath);


removeMenuEntry(plugin);
QAction* a = plugin->shortcut.action();
pluginActions.removeAll(a);

disconnect(a, SIGNAL(triggered()), pluginMapper, SLOT(map()));
pluginMapper->removeMappings(a);

}

//---------------------------------------------------------
Expand Down Expand Up @@ -251,12 +251,12 @@ void MuseScore::createMenuEntry(PluginDescription* plugin)
}
}


void MuseScore::removeMenuEntry(PluginDescription* plugin)
{
if (!pluginMapper)
return;

QString menu = plugin->menuPath;
QStringList ml;
QString s;
Expand All @@ -282,13 +282,13 @@ void MuseScore::removeMenuEntry(PluginDescription* plugin)
}
if (!s.isEmpty())
ml += s;

if(ml.isEmpty())
return;

int n = ml.size();
QWidget* curMenu = menuBar();

for(int i = 0; i < n-1; ++i) {
QString m = ml[i];
QList<QObject*> ol = curMenu->children();
Expand All @@ -308,7 +308,7 @@ void MuseScore::removeMenuEntry(PluginDescription* plugin)
QMenu* cm = static_cast<QMenu*>(curMenu);
cm->removeAction(a);
for(int i = n-2; i >= 0; --i) {

QMenu* menu = qobject_cast<QMenu*>(cm->parent());
if (cm->isEmpty())
if(cm->isEmpty()) {
Expand Down Expand Up @@ -451,7 +451,7 @@ void MuseScore::pluginTriggered(int idx)
p->runPlugin();
if (cs && p->pluginType() != "dock")
cs->endCmd();
endCmd();
// endCmd();
}

//---------------------------------------------------------
Expand Down
25 changes: 12 additions & 13 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,16 @@ extern TextPalette* textPalette;

void MuseScore::cmdInsertMeasures()
{
if (cs) {
if (cs->selection().isNone() && !cs->selection().findMeasure()) {
QMessageBox::warning(0, "MuseScore",
tr("No measure selected:\n" "Please select a measure and try again"));
}
else {
insertMeasuresDialog = new InsertMeasuresDialog;
insertMeasuresDialog->show();
if (cs) {
if (cs->selection().isNone() && !cs->selection().findMeasure()) {
QMessageBox::warning(0, "MuseScore",
tr("No measure selected:\n" "Please select a measure and try again"));
}
else {
insertMeasuresDialog = new InsertMeasuresDialog;
insertMeasuresDialog->show();
}
}
}
}

//---------------------------------------------------------
Expand Down Expand Up @@ -3867,8 +3867,9 @@ void MuseScore::cmd(QAction* a)

//---------------------------------------------------------
// endCmd
// called after every command action (including every
// mouse action)
// Called after every command action (including every
// mouse action).
// Updates the UI after a possible score change.
//---------------------------------------------------------

void MuseScore::endCmd()
Expand Down Expand Up @@ -4121,7 +4122,6 @@ void MuseScore::cmd(QAction* a, const QString& cmd)
tr("MuseScore: Load Style"), MScore::lastError);
}
cs->endCmd();
endCmd();
}
}
else if (cmd == "edit-style") {
Expand Down Expand Up @@ -4361,7 +4361,6 @@ void MuseScore::switchLayoutMode(int val)
cv->pageTop();
if (m && m != cs->firstMeasure())
cv->adjustCanvasPosition(m, false);
endCmd();
}
}

Expand Down
4 changes: 2 additions & 2 deletions mscore/musescore.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "updatechecker.h"
#include "loginmanager.h"
#include "uploadscoredialog.h"
#include "musescoreCore.h"
#include "libmscore/musescoreCore.h"

namespace Ms {

Expand Down Expand Up @@ -589,7 +589,7 @@ class MuseScore : public QMainWindow, public MuseScoreCore {

Q_INVOKABLE void openExternalLink(const QString&);

void endCmd();
virtual void endCmd() override;
void printFile();
bool exportFile();
bool exportParts();
Expand Down
1 change: 0 additions & 1 deletion mscore/osc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ void MuseScore::oscColorNote(QVariantList list)
cs->startCmd();
cs->undo(new ChangeProperty(note, P_ID::COLOR, noteColor));
cs->endCmd();
cs->end();
return;
}
}
Expand Down
Loading

0 comments on commit 24419cb

Please sign in to comment.