|
From: Tapio V. <aa...@us...> - 2011-01-27 08:22:20
|
Module: editor
Branch: master
Commit: 7f145f866337af4d5424c2a4b5f197adc9339910
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jan 27 10:06:45 2011 +0200
Note manipulation operations are now created in NoteGraphWidget.
---
editorapp.cc | 21 +++------------------
notegraphwidget.cc | 27 +++++++++++++++++++++++++++
notegraphwidget.hh | 3 +++
3 files changed, 33 insertions(+), 18 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index a017c6b..1b4d4a8 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -565,34 +565,19 @@ void EditorApp::on_txtYear_editingFinished() { updateSongMeta(); }
void EditorApp::on_cmbNoteType_currentIndexChanged(int index)
{
- if (noteGraph->selectedNote() && noteGraph->selectedNote()->note().getTypeInt() != index) {
- noteGraph->selectedNote()->setType(index);
- Operation op("TYPE");
- op << noteGraph->getNoteLabelId(noteGraph->selectedNote()) << index;
- operationDone(op);
- }
+ if (noteGraph) noteGraph->setType(noteGraph->selectedNote(), index);
}
void EditorApp::on_chkFloating_stateChanged(int state)
{
bool floating = (state != 0);
- if (noteGraph->selectedNote() && noteGraph->selectedNote()->isFloating() != floating) {
- noteGraph->selectedNote()->setFloating(floating);
- Operation op("FLOATING");
- op << noteGraph->getNoteLabelId(noteGraph->selectedNote()) << floating;
- operationDone(op);
- }
+ if (noteGraph) noteGraph->setFloating(noteGraph->selectedNote(), floating);
}
void EditorApp::on_chkLineBreak_stateChanged(int state)
{
bool linebreak = (state != 0);
- if (noteGraph->selectedNote() && noteGraph->selectedNote()->isLineBreak() != linebreak) {
- noteGraph->selectedNote()->setLineBreak(linebreak);
- Operation op("LINEBREAK");
- op << noteGraph->getNoteLabelId(noteGraph->selectedNote()) << linebreak;
- operationDone(op);
- }
+ if (noteGraph) noteGraph->setLineBreak(noteGraph->selectedNote(), linebreak);
}
void EditorApp::closeEvent(QCloseEvent *event)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 21942d9..807a8b1 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -406,6 +406,33 @@ void NoteGraphWidget::del(NoteLabel *note)
doOperation(op);
}
+void NoteGraphWidget::setType(NoteLabel *note, int index)
+{
+ if (note && note->note().getTypeInt() != index) {
+ Operation op("TYPE");
+ op << getNoteLabelId(note) << index;
+ doOperation(op);
+ }
+}
+
+void NoteGraphWidget::setFloating(NoteLabel *note, bool state)
+{
+ if (note && note->isFloating() != state) {
+ Operation op("FLOATING");
+ op << getNoteLabelId(note) << state;
+ doOperation(op);
+ }
+}
+
+void NoteGraphWidget::setLineBreak(NoteLabel *note, bool state)
+{
+ if (note && note->isLineBreak() != state) {
+ Operation op("LINEBREAK");
+ op << getNoteLabelId(note) << state;
+ doOperation(op);
+ }
+}
+
void NoteGraphWidget::editLyric(NoteLabel *note) {
if (!note) return;
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index 1ff7b7e..efa312e 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -47,6 +47,9 @@ public:
void split(NoteLabel *note);
void del(NoteLabel *note);
void editLyric(NoteLabel *note);
+ void setFloating(NoteLabel *note, bool state);
+ void setLineBreak(NoteLabel *note, bool state);
+ void setType(NoteLabel *note, int newtype);
int getNoteLabelId(NoteLabel* note) const;
NoteLabels& noteLabels() { return m_notes; }
|