Skip to content

Commit

Permalink
inspector for Marker/Jump properties
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Feb 25, 2013
1 parent d846e3d commit a80f730
Show file tree
Hide file tree
Showing 16 changed files with 445 additions and 430 deletions.
14 changes: 6 additions & 8 deletions mscore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ QT4_WRAP_UI (ui_headers
measureproperties.ui segment.ui text.ui textpalette.ui timedialog.ui
symboldialog.ui dynamic.ui tuplet.ui shortcutcapturedialog.ui slurtie.ui
slur.ui editdrumset.ui editstaff.ui line.ui linesegment.ui
voltaproperties.ui timesigproperties.ui
jumpproperties.ui markerproperties.ui boxproperties.ui
voltaproperties.ui timesigproperties.ui boxproperties.ui
instrwizard.ui timesigwizard.ui newwizard.ui aboutbox.ui aboutmusicxmlbox.ui
chordedit.ui transposedialog.ui tempoproperties.ui
lineproperties.ui excerptsdialog.ui lyrics.ui stafftext.ui
Expand All @@ -61,7 +60,7 @@ QT4_WRAP_UI (ui_headers
rest.ui inspector_chord.ui omrpanel.ui startdialog.ui masterpalette.ui
inspector_group_element.ui inspector_image.ui stem.ui inspector_lasso.ui
inspector_volta.ui inspector_ottava.ui inspector_trill.ui inspector_hairpin.ui
box.ui pluginManager.ui
box.ui pluginManager.ui inspector_jump.ui inspector_marker.ui
${SCRIPT_UI}
)

Expand All @@ -76,8 +75,7 @@ QT4_WRAP_CPP (mocs
measureproperties.h seq.h textpalette.h textstyle.h
timedialog.h symboldialog.h shortcutcapturedialog.h simplebutton.h
greendotbutton.h recordbutton.h editdrumset.h editstaff.h selinstrument.h
voltaproperties.h timesigproperties.h
jumpproperties.h markerproperties.h boxproperties.h newwizard.h
voltaproperties.h timesigproperties.h boxproperties.h newwizard.h
transposedialog.h chordedit.h tempoproperties.h lineproperties.h
excerptsdialog.h stafftextproperties.h glissandoproperties.h
articulationprop.h metaedit.h magbox.h voiceselector.h
Expand All @@ -94,6 +92,7 @@ QT4_WRAP_CPP (mocs
inspectorGroupElement.h inspectorImage.h waveview.h helpBrowser.h
inspectorLasso.h inspectorVolta.h inspectorOttava.h inspectorTrill.h
inspectorHairpin.h qmlplugin.h palettebox.h workspace.h pluginManager.h
inspectorJump.h inspectorMarker.h
${OMR_MOCS}
${SCRIPT_MOCS}
)
Expand Down Expand Up @@ -190,16 +189,15 @@ add_executable ( ${ExecutableName}
articulationprop.cpp textprop.cpp dynamicprop.cpp
fretproperties.cpp sectionbreakprop.cpp hairpinprop.cpp
bendproperties.cpp tremolobarprop.cpp file.cpp keyb.cpp osc.cpp
layer.cpp jumpproperties.cpp selectdialog.cpp
propertymenu.cpp shortcut.cpp bb.cpp
layer.cpp selectdialog.cpp propertymenu.cpp shortcut.cpp bb.cpp
inspector.cpp dragelement.cpp svggenerator.cpp
inspectorBase.cpp inspectorBeam.cpp masterpalette.cpp
inspectorGroupElement.cpp dragdrop.cpp inspectorImage.cpp
waveview.cpp helpBrowser.cpp inspectorLasso.cpp
editelement.cpp inspectorVolta.cpp inspectorOttava.cpp inspectorTrill.cpp
inspectorHairpin.cpp qmlplugin.cpp
musicxmlsupport.cpp exportxml.cpp importxml.cpp importxmlfirstpass.cpp
savePositions.cpp pluginManager.cpp
savePositions.cpp pluginManager.cpp inspectorJump.cpp inspectorMarker.cpp
${OMR_FILES}
${AUDIO}
${SCRIPT_FILES}
Expand Down
17 changes: 14 additions & 3 deletions mscore/inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "inspectorOttava.h"
#include "inspectorTrill.h"
#include "inspectorHairpin.h"
#include "inspectorMarker.h"
#include "inspectorJump.h"
#include "musescore.h"
#include "scoreview.h"

Expand Down Expand Up @@ -79,6 +81,7 @@ Inspector::Inspector(QWidget* parent)
sa->setWidget(mainWidget);

layout = new QVBoxLayout;
layout->setSpacing(0);
mainWidget->setLayout(layout);
ie = 0;
_element = 0;
Expand Down Expand Up @@ -116,11 +119,12 @@ void Inspector::setElement(Element* e)
{
// if the element is being set again because of an edit originated
// from within the inspector itself, do nothing
if(_inspectorEdit) { // if within an inspector-originated edit

if (_inspectorEdit) { // if within an inspector-originated edit
_inspectorEdit = false; // reset flag
if(_element == e) // if element is not changing...
if (_element == e) // if element is not changing...
return; // ...do nothing
}
}

if (e == 0 || _element == 0 || (e->type() != _element->type())) {
if (ie)
Expand Down Expand Up @@ -184,6 +188,12 @@ void Inspector::setElement(Element* e)
case Element::BAR_LINE:
ie = new InspectorBarLine(this);
break;
case Element::JUMP:
ie = new InspectorJump(this);
break;
case Element::MARKER:
ie = new InspectorMarker(this);
break;
default:
ie = new InspectorElement(this);
break;
Expand Down Expand Up @@ -400,6 +410,7 @@ InspectorVBox::InspectorVBox(QWidget* parent)
{
QWidget* w = new QWidget;
vb.setupUi(w);
layout->setSpacing(0);
layout->addWidget(w);

iList[0].t = P_TOP_GAP;
Expand Down
3 changes: 2 additions & 1 deletion mscore/inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@ class Inspector : public QDockWidget {
InspectorBase* ie;
Element* _element;
QList<Element*> _el;
bool _inspectorEdit; // set to true when an edit originates from within the inspector itself
bool _inspectorEdit; // set to true when an edit originates from
// within the inspector itself

virtual void closeEvent(QCloseEvent*);

Expand Down
83 changes: 83 additions & 0 deletions mscore/inspectorJump.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
// $Id:$
//
// Copyright (C) 2012 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENSE.GPL
//=============================================================================

#include "inspectorJump.h"
#include "musescore.h"
#include "libmscore/jump.h"
#include "libmscore/score.h"

//---------------------------------------------------------
// InspectorJump
//---------------------------------------------------------

InspectorJump::InspectorJump(QWidget* parent)
: InspectorBase(parent)
{
iElement = new InspectorElementElement(this);
layout->addWidget(iElement);
QWidget* w = new QWidget;
iJump.setupUi(w);
layout->addWidget(w);
connect(iJump.jumpTo, SIGNAL(textChanged(const QString&)), SLOT(apply()));
connect(iJump.playUntil, SIGNAL(textChanged(const QString&)), SLOT(apply()));
connect(iJump.continueAt, SIGNAL(textChanged(const QString&)), SLOT(apply()));
}

//---------------------------------------------------------
// setElement
//---------------------------------------------------------

void InspectorJump::setElement(Element* e)
{
Jump* jump = static_cast<Jump*>(e);
iElement->setElement(jump);

iJump.jumpTo->blockSignals(true);
iJump.playUntil->blockSignals(true);
iJump.continueAt->blockSignals(true);

iJump.jumpTo->setText(jump->jumpTo());
iJump.playUntil->setText(jump->playUntil());
iJump.continueAt->setText(jump->continueAt());

iJump.jumpTo->blockSignals(false);
iJump.playUntil->blockSignals(false);
iJump.continueAt->blockSignals(false);
}

//---------------------------------------------------------
// apply
//---------------------------------------------------------

void InspectorJump::apply()
{
Jump* jump = static_cast<Jump*>(inspector->element());

if (iJump.jumpTo->text() != jump->jumpTo()
|| iJump.playUntil->text() != jump->playUntil()
|| iJump.continueAt->text() != jump->continueAt()) {
Score* score = jump->score();
score->startCmd();

if (iJump.jumpTo->text() != jump->jumpTo())
score->undoChangeProperty(jump, P_JUMP_TO, iJump.jumpTo->text());
if (iJump.playUntil->text() != jump->playUntil())
score->undoChangeProperty(jump, P_PLAY_UNTIL, iJump.playUntil->text());
if (iJump.continueAt->text() != jump->continueAt())
score->undoChangeProperty(jump, P_CONTINUE_AT, iJump.continueAt->text());

score->endCmd();
mscore->endCmd();
}
}

42 changes: 42 additions & 0 deletions mscore/inspectorJump.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
// $Id:$
//
// Copyright (C) 2012 Werner Schweer and others
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENSE.GPL
//=============================================================================

#ifndef __INSPECTOR_JUMP_H__
#define __INSPECTOR_JUMP_H__

#include "inspector.h"
#include "ui_inspector_jump.h"
#include "libmscore/property.h"

//---------------------------------------------------------
// InspectorJump
//---------------------------------------------------------

class InspectorJump : public InspectorBase {
Q_OBJECT

InspectorElementElement* iElement;
Ui::InspectorJump iJump;

public slots:
virtual void apply();

public:
InspectorJump(QWidget* parent);
virtual void setElement(Element*);
bool dirty() const;
};

#endif


74 changes: 74 additions & 0 deletions mscore/inspectorMarker.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
// $Id:$
//
// Copyright (C) 2012 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENSE.GPL
//=============================================================================

#include "inspectorMarker.h"
#include "musescore.h"
#include "libmscore/marker.h"
#include "libmscore/score.h"

//---------------------------------------------------------
// inspectorMarker
//---------------------------------------------------------

InspectorMarker::InspectorMarker(QWidget* parent)
: InspectorBase(parent)
{
iElement = new InspectorElementElement(this);
layout->addWidget(iElement);
QWidget* w = new QWidget;
iMarker.setupUi(w);
layout->addWidget(w);
connect(iMarker.subtype, SIGNAL(currentIndexChanged(int)), SLOT(apply()));
connect(iMarker.jumpLabel, SIGNAL(textChanged(const QString&)), SLOT(apply()));
}

//---------------------------------------------------------
// setElement
//---------------------------------------------------------

void InspectorMarker::setElement(Element* e)
{
Marker* marker = static_cast<Marker*>(e);
iElement->setElement(marker);

iMarker.subtype->blockSignals(true);
iMarker.jumpLabel->blockSignals(true);

iMarker.subtype->setCurrentIndex(int(marker->markerType()));
iMarker.jumpLabel->setText(marker->label());

iMarker.subtype->blockSignals(false);
iMarker.jumpLabel->blockSignals(false);
}

//---------------------------------------------------------
// apply
//---------------------------------------------------------

void InspectorMarker::apply()
{
Marker* marker = static_cast<Marker*>(inspector->element());

if (iMarker.subtype->currentIndex() != int(marker->markerType())
|| iMarker.jumpLabel->text() != marker->label()) {
Score* score = marker->score();
score->startCmd();
score->undoChangeProperty(marker, P_MARKER_TYPE, iMarker.subtype->currentIndex());
score->undoChangeProperty(marker, P_LABEL, iMarker.jumpLabel->text());
score->endCmd();
mscore->endCmd();
}
}



42 changes: 42 additions & 0 deletions mscore/inspectorMarker.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
// $Id:$
//
// Copyright (C) 2013 Werner Schweer and others
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENSE.GPL
//=============================================================================

#ifndef __INSPECTOR_MARKER_H__
#define __INSPECTOR_MARKER_H__

#include "inspector.h"
#include "ui_inspector_marker.h"
#include "libmscore/property.h"

//---------------------------------------------------------
// InspectorMarker
//---------------------------------------------------------

class InspectorMarker : public InspectorBase {
Q_OBJECT

InspectorElementElement* iElement;
Ui::InspectorMarker iMarker;

public slots:
virtual void apply();

public:
InspectorMarker(QWidget* parent);
virtual void setElement(Element*);
bool dirty() const;
};

#endif


Loading

0 comments on commit a80f730

Please sign in to comment.