implement inspector for foto mode

This commit is contained in:
Werner Schweer 2012-07-12 15:35:35 +02:00
parent 25599827b5
commit a8b0d63308
10 changed files with 254 additions and 22 deletions

View file

@ -59,7 +59,7 @@ QT4_WRAP_UI (ui_headers
inspector_articulation.ui inspector_spacer.ui inspector_hbox.ui keysig.ui
inspector_segment.ui inspector_beam.ui inspector_note.ui
rest.ui inspector_chord.ui omrpanel.ui startdialog.ui masterpalette.ui
inspector_group_element.ui inspector_image.ui stem.ui
inspector_group_element.ui inspector_image.ui stem.ui inspector_lasso.ui
${SCRIPT_UI}
)
@ -89,6 +89,7 @@ QT4_WRAP_CPP (mocs
editstringdata.h editraster.h mediadialog.h chordeditor.h chordview.h album.h layer.h
webpage.h inspector.h inspectorBase.h inspectorBeam.h masterpalette.h
inspectorGroupElement.h inspectorImage.h waveview.h helpBrowser.h
inspectorLasso.h
${OMR_MOCS}
${SCRIPT_MOCS}
)
@ -183,7 +184,7 @@ add_executable ( ${ExecutableName}
inspector.cpp dragelement.cpp svggenerator.cpp
inspectorBase.cpp inspectorBeam.cpp masterpalette.cpp
inspectorGroupElement.cpp dragdrop.cpp inspectorImage.cpp
waveview.cpp musicxmlsupport.cpp helpBrowser.cpp
waveview.cpp musicxmlsupport.cpp helpBrowser.cpp inspectorLasso.cpp
${OMR_FILES}
${AUDIO}
${SCRIPT_FILES}

View file

@ -2262,19 +2262,19 @@ Shortcut Shortcut::sc[] = {
QT_TRANSLATE_NOOP("action", "Plugin Creator")
),
Shortcut(
STATE_NORMAL | STATE_NOTE_ENTRY | STATE_PLAY | STATE_EDIT | STATE_LYRICS_EDIT,
STATE_NORMAL | STATE_NOTE_ENTRY | STATE_PLAY | STATE_EDIT | STATE_LYRICS_EDIT | STATE_FOTO,
0,
"inspector",
QT_TRANSLATE_NOOP("action","Show Inspector"),
QT_TRANSLATE_NOOP("action","Inspector"),
QT_TRANSLATE_NOOP("action","Show Inspector"),
QT_TRANSLATE_NOOP("action","Show inspector")
),
Shortcut(
STATE_NORMAL | STATE_NOTE_ENTRY | STATE_PLAY | STATE_EDIT | STATE_LYRICS_EDIT,
0,
"omr",
QT_TRANSLATE_NOOP("action","Show OMR Panel"),
QT_TRANSLATE_NOOP("action","OmrPanel"),
QT_TRANSLATE_NOOP("action","Show OMR Panel"),
QT_TRANSLATE_NOOP("action","Show OMR PAnel")
),
Shortcut(
@ -2320,8 +2320,8 @@ Shortcut Shortcut::sc[] = {
STATE_NORMAL | STATE_NOTE_ENTRY,
0,
"masterpalette",
QT_TRANSLATE_NOOP("action","Show master palette"),
QT_TRANSLATE_NOOP("action","Master Palette..."),
QT_TRANSLATE_NOOP("action","Show master palette"),
QT_TRANSLATE_NOOP("action","Show master palette")
),
Shortcut(

View file

@ -28,6 +28,7 @@
#include "libmscore/image.h"
#include "libmscore/mscore.h"
#include "svggenerator.h"
#include "inspector.h"
//---------------------------------------------------------
// FotoScoreViewDragTransition
@ -327,7 +328,6 @@ void ScoreView::setupFotoMode()
s->setInitialState(f1);
s->addTransition(new ScoreViewDragTransition(this, f2));
connect(s, SIGNAL(entered()), mscore, SLOT(setFotomode()));
connect(s, SIGNAL(entered()), SLOT(startFotomode()));
connect(s, SIGNAL(exited()), SLOT(stopFotomode()));
}
@ -355,6 +355,7 @@ void ScoreView::startFotomode()
updateGrips();
_score->addRefresh(_foto->abbox());
_score->end();
mscore->changeState(STATE_FOTO);
}
//---------------------------------------------------------
@ -439,6 +440,8 @@ void ScoreView::doFotoDragEdit(QMouseEvent* ev)
updateGrips();
startMove = p;
_score->end();
if (mscore->getInspector())
mscore->getInspector()->setElement(_foto);
}
//---------------------------------------------------------
@ -535,6 +538,8 @@ void ScoreView::doDragFotoRect(QMouseEvent* ev)
startMove = p;
updateGrips();
_score->end();
if (mscore->getInspector())
mscore->getInspector()->setElement(_foto);
}
//---------------------------------------------------------

View file

@ -14,6 +14,7 @@
#include "inspector.h"
#include "inspectorBeam.h"
#include "inspectorImage.h"
#include "inspectorLasso.h"
#include "inspectorGroupElement.h"
#include "musescore.h"
#include "scoreview.h"
@ -46,13 +47,7 @@ void MuseScore::showInspector(bool visible)
connect(inspector, SIGNAL(inspectorVisible(bool)), a, SLOT(setChecked(bool)));
addDockWidget(Qt::RightDockWidgetArea, inspector);
}
if (cs) {
if (state() == STATE_EDIT) {
inspector->setElement(cv->getEditObject());
}
else
selectionChanged(cs->selection().state());
}
updateInspector();
}
if (inspector)
inspector->setVisible(visible);
@ -129,6 +124,7 @@ void Inspector::setElement(Element* e)
case CLEF: ie = new InspectorClef(this); break;
case BEAM: ie = new InspectorBeam(this); break;
case IMAGE: ie = new InspectorImage(this); break;
case LASSO: ie = new InspectorLasso(this); break;
default: ie = new InspectorElement(this); break;
}
layout->insertWidget(0, ie);

46
mscore/inspectorLasso.cpp Normal file
View file

@ -0,0 +1,46 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
// $Id:$
//
// Copyright (C) 2011 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
//=============================================================================
#include "inspectorLasso.h"
#include "musescore.h"
#include "libmscore/lasso.h"
//---------------------------------------------------------
// InspectorLasso
//---------------------------------------------------------
InspectorLasso::InspectorLasso(QWidget* parent)
: InspectorBase(parent)
{
QWidget* w = new QWidget;
b.setupUi(w);
layout->addWidget(w);
}
//---------------------------------------------------------
// setElement
//---------------------------------------------------------
void InspectorLasso::setElement(Element* e)
{
Lasso* lasso = static_cast<Lasso*>(e);
QRectF bb(lasso->rect());
b.posX->setValue(bb.x() / MScore::DPMM);
b.posY->setValue(bb.y() / MScore::DPMM);
b.sizeWidth->setValue(bb.width() / MScore::DPMM);
b.sizeHeight->setValue(bb.height() / MScore::DPMM);
InspectorBase::setElement(e);
}

40
mscore/inspectorLasso.h Normal file
View file

@ -0,0 +1,40 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
// $Id:$
//
// Copyright (C) 2011 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_LASSO_H__
#define __INSPECTOR_LASSO_H__
#include "inspector.h"
#include "ui_inspector_lasso.h"
#include "libmscore/property.h"
//---------------------------------------------------------
// InspectorLasso
//---------------------------------------------------------
class InspectorLasso : public InspectorBase {
Q_OBJECT
Ui::InspectorLasso b;
protected slots:
protected:
public:
InspectorLasso(QWidget* parent);
virtual void setElement(Element*);
};
#endif

125
mscore/inspector_lasso.ui Normal file
View file

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InspectorLasso</class>
<widget class="QWidget" name="InspectorLasso">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>287</width>
<height>93</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="elementName">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Lasso</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Position:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QDoubleSpinBox" name="posY">
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>999999.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="sizeHeight">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>99999.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="sizeWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>99999.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Size</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="posX">
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>999999.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="musescore.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -83,6 +83,7 @@
#include "libmscore/measurebase.h"
#include "libmscore/chordlist.h"
#include "libmscore/volta.h"
#include "libmscore/lasso.h"
#include "msynth/synti.h"
@ -1208,18 +1209,33 @@ void MuseScore::selectionChanged(int selectionState)
pianorollEditor->changeSelection(selectionState);
if (drumrollEditor)
drumrollEditor->changeSelection(selectionState);
if (inspector && (state() != STATE_EDIT)) {
if (cs) {
updateInspector();
}
//---------------------------------------------------------
// updateInspector
//---------------------------------------------------------
void MuseScore::updateInspector()
{
if (!inspector)
return;
if (cs) {
if (state() == STATE_EDIT)
inspector->setElement(cv->getEditObject());
else if (state() == STATE_FOTO)
inspector->setElement(cv->fotoLasso());
else {
if (cs->selection().isSingle())
inspector->setElement(cs->selection().element());
else if (selectionState == SEL_NONE)
else if (cs->selection().state() == SEL_NONE)
inspector->setElement(0);
else
inspector->setElementList(cs->selection().elements());
}
else
inspector->setElement(0);
}
else
inspector->setElement(0);
}
//---------------------------------------------------------
@ -2652,14 +2668,15 @@ void MuseScore::changeState(ScoreState val)
}
menuProfiles->setEnabled(enable);
// foreach (QAction* a, pluginActions) allow for "create score" plugins
// a->setEnabled(true);
transportTools->setEnabled(enable && !noSeq);
cpitchTools->setEnabled(enable);
mag->setEnabled(enable);
entryTools->setEnabled(enable);
if (_sstate == STATE_FOTO)
updateInspector();
switch(val) {
case STATE_DISABLED:
_modeText->setText(tr("no score"));
@ -2690,6 +2707,7 @@ void MuseScore::changeState(ScoreState val)
case STATE_FOTO:
_modeText->setText(tr("foto mode"));
_modeText->show();
updateInspector();
break;
case STATE_SEARCH:
if (searchDialog == 0) {

View file

@ -394,6 +394,7 @@ class MuseScore : public QMainWindow {
static void convertCapella(Score*, Capella* cap);
void changeScore(int);
virtual void resizeEvent(QResizeEvent*);
void updateInspector();
private slots:
void cmd(QAction* a, const QString& cmd);
@ -462,7 +463,6 @@ class MuseScore : public QMainWindow {
void setNoteEntryState() { changeState(STATE_NOTE_ENTRY); }
void setPlayState() { changeState(STATE_PLAY); }
void setSearchState() { changeState(STATE_SEARCH); }
void setFotomode() { changeState(STATE_FOTO); }
void checkForUpdate();
QMenu* fileMenu() const { return _fileMenu; }
void midiNoteReceived(int channel, int pitch, int velo);

View file

@ -425,6 +425,7 @@ class ScoreView : public QWidget, public MuseScoreView {
OmrView* omrView() const { return _omrView; }
void setOmrView(OmrView* v) { _omrView = v; }
Element* getEditObject() { return editObject; }
Lasso* fotoLasso() const { return _foto; }
};
//---------------------------------------------------------