-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement 'reset text to style' in inspector for text elements
- Loading branch information
Showing
7 changed files
with
127 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
//============================================================================= | ||
// MuseScore | ||
// Music Composition & Notation | ||
// | ||
// Copyright (C) 2011 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 "inspectorText.h" | ||
#include "libmscore/score.h" | ||
|
||
namespace Ms { | ||
|
||
//--------------------------------------------------------- | ||
// InspectorText | ||
//--------------------------------------------------------- | ||
|
||
InspectorText::InspectorText(QWidget* parent) | ||
: InspectorBase(parent) | ||
{ | ||
e.setupUi(addWidget()); | ||
t.setupUi(addWidget()); | ||
|
||
iList = { | ||
{ P_ID::COLOR, 0, 0, e.color, e.resetColor }, | ||
{ P_ID::VISIBLE, 0, 0, e.visible, e.resetVisible }, | ||
{ P_ID::USER_OFF, 0, 0, e.offsetX, e.resetX }, | ||
{ P_ID::USER_OFF, 1, 0, e.offsetY, e.resetY }, | ||
{ P_ID::TEXT_STYLE_TYPE, 0, 0, t.style, t.resetStyle } | ||
}; | ||
mapSignals(); | ||
connect(t.resetToStyle, SIGNAL(clicked()), SLOT(resetToStyle())); | ||
} | ||
|
||
//--------------------------------------------------------- | ||
// setElement | ||
//--------------------------------------------------------- | ||
|
||
void InspectorText::setElement() | ||
{ | ||
Element* e = inspector->element(); | ||
Score* score = e->score(); | ||
|
||
t.style->blockSignals(true); | ||
t.style->clear(); | ||
const QList<TextStyle>& ts = score->style()->textStyles(); | ||
int n = ts.size(); | ||
for (int i = 0; i < n; ++i) { | ||
if (!(ts.at(i).hidden() & TextStyleHidden::IN_LISTS) ) | ||
t.style->addItem(qApp->translate("TextStyle",ts.at(i).name().toLatin1().data()), i); | ||
} | ||
t.style->blockSignals(false); | ||
InspectorBase::setElement(); | ||
} | ||
|
||
//--------------------------------------------------------- | ||
// resetToStyle | ||
//--------------------------------------------------------- | ||
|
||
void InspectorText::resetToStyle() | ||
{ | ||
Text* text = static_cast<Text*>(inspector->element()); | ||
Score* score = text->score(); | ||
score->startCmd(); | ||
text->undoChangeProperty(P_ID::TEXT, text->plainText()); | ||
score->endCmd(); | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//============================================================================= | ||
// MuseScore | ||
// Music Composition & Notation | ||
// | ||
// 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_TEXT_H__ | ||
#define __INSPECTOR_TEXT_H__ | ||
|
||
#include "inspector.h" | ||
#include "inspectorBase.h" | ||
#include "ui_inspector_text.h" | ||
|
||
namespace Ms { | ||
|
||
//--------------------------------------------------------- | ||
// InspectorText | ||
//--------------------------------------------------------- | ||
|
||
class InspectorText : public InspectorBase { | ||
Q_OBJECT | ||
|
||
UiInspectorElement e; | ||
Ui::InspectorText t; | ||
|
||
private slots: | ||
void resetToStyle(); | ||
|
||
public: | ||
InspectorText(QWidget* parent); | ||
virtual void setElement() override; | ||
}; | ||
|
||
} | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters