You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(25) |
Jul
(288) |
Aug
(119) |
Sep
(31) |
Oct
(59) |
Nov
(458) |
Dec
(359) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(268) |
Feb
(26) |
Mar
(36) |
Apr
(48) |
May
(119) |
Jun
(37) |
Jul
(173) |
Aug
(429) |
Sep
(137) |
Oct
(156) |
Nov
(59) |
Dec
(45) |
| 2011 |
Jan
(398) |
Feb
(257) |
Mar
(49) |
Apr
(5) |
May
(34) |
Jun
(11) |
Jul
(38) |
Aug
(12) |
Sep
(1) |
Oct
(49) |
Nov
(5) |
Dec
(10) |
| 2012 |
Jan
(21) |
Feb
(32) |
Mar
(20) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(173) |
Aug
|
Sep
(25) |
Oct
(6) |
Nov
(44) |
Dec
|
|
From: Tapio V. <aa...@us...> - 2011-02-02 11:26:16
|
Module: editor
Branch: master
Commit: c8880e040753f261b5ffb508af9569b07784ae51
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 13:25:42 2011 +0200
Move overgrowing function out of header.
---
notelabel.cc | 14 ++++++++++++++
notelabel.hh | 18 +++++++-----------
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/notelabel.cc b/notelabel.cc
index cc6f7e7..031a0a2 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -88,6 +88,20 @@ void NoteLabel::createPixmap(QSize size)
updateNote();
}
+void NoteLabel::setSelected(bool state) {
+ if (m_selected != state) {
+ m_selected = state; createPixmap(size());
+ if (!m_selected) {
+ if (nextSelected) nextSelected->prevSelected = prevSelected;
+ if (prevSelected) prevSelected->nextSelected = nextSelected;
+ nextSelected = NULL;
+ prevSelected = NULL;
+ startResizing(0); // Reset
+ startDragging(QPoint()); // Reset
+ }
+ }
+}
+
void NoteLabel::resizeEvent(QResizeEvent *event)
{
createPixmap(event->size());
diff --git a/notelabel.hh b/notelabel.hh
index efb0c1d..2036f97 100644
--- a/notelabel.hh
+++ b/notelabel.hh
@@ -18,18 +18,14 @@ public:
QString lyric() const { return m_note.syllable; }
void setLyric(const QString &text) { m_note.syllable = text; createPixmap(size()); }
+ /**
+ * This function handles note selecting and deselecting.
+ * Upon deselecting, clean-up is done and item is removed
+ * from the selection list.
+ * This function does not add new entry to selection list.
+ */
+ void setSelected(bool state = true);
bool isSelected() const { return m_selected; }
- void setSelected(bool state = true) {
- if (m_selected != state) {
- m_selected = state; createPixmap(size());
- if (!m_selected) {
- if (nextSelected) nextSelected->prevSelected = prevSelected;
- if (prevSelected) prevSelected->nextSelected = nextSelected;
- nextSelected = NULL;
- prevSelected = NULL;
- }
- }
- }
Note& note() { return m_note; }
Note note() const { return m_note; }
|
|
From: Yoda-JM <yo...@us...> - 2011-02-02 11:10:52
|
Module: editor
Branch: master
Commit: cd8092641355f314cd7436da3ff23de9d94b0e51
Author: Vincent Le Ligeour <yo...@us...>
Date: Wed Feb 2 12:10:35 2011 +0100
Hacked some Ctrl+Right/Left for multiselection
---
notegraphwidget.cc | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 58f34b5..f1ab117 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -551,27 +551,25 @@ void NoteGraphWidget::mouseMoveEvent(QMouseEvent *event)
}
void NoteGraphWidget::keyPressEvent(QKeyEvent *event)
- {
+{
int k = event->key(), m = event->modifiers();
if (k == Qt::Key_A && (m & Qt::ControlModifier)) { // Select all
selectNote(NULL); // Clear previous
for (int i = m_notes.size()-1; i >= 0; --i) // Traverse in reverse order to get the first note first
selectNote(m_notes[i], false);
-
} else if (k == Qt::Key_Return) { // Edit lyric
editLyric(m_selectedNote);
-
} else if (k == Qt::Key_Left) { // Select note on the left
if (m_selectedNote && m_notes.size() > 1 && m_selectedNote != m_notes.front()) {
for (NoteLabels::iterator it = m_notes.begin(); it != m_notes.end(); ++it) {
- if (m_selectedNote == *it) { selectNote(*(--it)); break; }
+ if (m_selectedNote == *it) { selectNote(*(--it), !(m & Qt::ControlModifier)); break; }
}
}
} else if (k == Qt::Key_Right) { // Select note on the right
if (m_selectedNote && m_notes.size() > 1 && m_selectedNote != m_notes.back()) {
for (NoteLabels::iterator it = m_notes.begin(); it != m_notes.end(); ++it) {
- if (m_selectedNote == *it) { selectNote(*(++it)); break; }
+ if (m_selectedNote == *it) { selectNote(*(++it), !(m & Qt::ControlModifier)); break; }
}
}
} else if (k == Qt::Key_Up) { // Move note up
@@ -582,8 +580,8 @@ void NoteGraphWidget::keyPressEvent(QKeyEvent *event)
del(m_selectedNote);
} else {
QWidget::keyPressEvent(event);
- }
- }
+ }
+}
void NoteGraphWidget::doOperation(const Operation& op, Operation::OperationFlags flags)
{
|
|
From: Yoda-JM <yo...@us...> - 2011-02-02 11:05:22
|
Module: editor
Branch: master
Commit: b8ea330da8f07309dfb0e19c9e8d03accb31d80c
Author: Vincent Le Ligeour <yo...@us...>
Date: Wed Feb 2 12:04:57 2011 +0100
Implemented multiple note move
---
notegraphwidget.cc | 37 ++++++++++++++++++++-----------------
notegraphwidget.hh | 1 +
2 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 675923c..58f34b5 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -454,6 +454,24 @@ void NoteGraphWidget::del(NoteLabel *note)
}
}
+void NoteGraphWidget::move(NoteLabel *note, int value)
+{
+ if (!note) return;
+
+ int movecount = 0;
+ for (NoteLabel *n = note ; n; n = n->nextSelected, ++movecount) {
+ Operation op("MOVE");
+ op << getNoteLabelId(n);
+ op << n->x() << int(round(px2n(n->y() + m_noteHalfHeight))) + value;
+ doOperation(op);
+ }
+
+ // Combine to one undo operation
+ if (movecount > 1) {
+ Operation op("COMBINER"); op << movecount; doOperation(op);
+ }
+}
+
void NoteGraphWidget::setType(NoteLabel *note, int index)
{
if (note && note->note().getTypeInt() != index) {
@@ -550,33 +568,18 @@ void NoteGraphWidget::keyPressEvent(QKeyEvent *event)
if (m_selectedNote == *it) { selectNote(*(--it)); break; }
}
}
-
} else if (k == Qt::Key_Right) { // Select note on the right
if (m_selectedNote && m_notes.size() > 1 && m_selectedNote != m_notes.back()) {
for (NoteLabels::iterator it = m_notes.begin(); it != m_notes.end(); ++it) {
if (m_selectedNote == *it) { selectNote(*(++it)); break; }
}
}
-
} else if (k == Qt::Key_Up) { // Move note up
- if (m_selectedNote) {
- Operation op("MOVE");
- op << getNoteLabelId(m_selectedNote);
- op << m_selectedNote->x() << int(round(px2n(m_selectedNote->y() + m_noteHalfHeight))) + 1;
- doOperation(op);
- }
-
+ move(m_selectedNote, 1);
} else if (k == Qt::Key_Down) { // Move note down
- if (m_selectedNote) {
- Operation op("MOVE");
- op << getNoteLabelId(m_selectedNote);
- op << m_selectedNote->x() << int(round(px2n(m_selectedNote->y() + m_noteHalfHeight))) - 1;
- doOperation(op);
- }
-
+ move(m_selectedNote, -1);
} else if (k == Qt::Key_Delete) { // Delete selected note(s)
del(m_selectedNote);
-
} else {
QWidget::keyPressEvent(event);
}
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index bfcef9d..d076c0c 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -46,6 +46,7 @@ public:
NoteLabel* selectedNote() const { return m_selectedNote; }
void split(NoteLabel *note, float ratio = 0.5f);
void del(NoteLabel *note);
+ void move(NoteLabel *note, int value);
void editLyric(NoteLabel *note);
void setFloating(NoteLabel *note, bool state);
void setLineBreak(NoteLabel *note, bool state);
|
|
From: Tapio V. <aa...@us...> - 2011-02-02 08:11:35
|
Module: editor
Branch: master
Commit: 6edae48232f35b526c260fae2a64adc3065907a9
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 10:10:54 2011 +0200
Implemented multiple note deletion.
---
notegraphwidget.cc | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index e8ae7c1..675923c 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -432,15 +432,26 @@ void NoteGraphWidget::split(NoteLabel *note, float ratio)
void NoteGraphWidget::del(NoteLabel *note)
{
- if (note && (note->nextSelected || note->prevSelected)) return;// FIXME: Multiple note handling
if (!note) return;
- if (m_selectedNote == note)
- selectNote(NULL);
+ // If delete is directed to a selected note, all selected notes will be deleted
+ if (note->isSelected() && m_selectedNote) {
+ note = m_selectedNote;
+ m_selectedNote = NULL;
+ }
- Operation op("DEL");
- op << getNoteLabelId(note);
- doOperation(op);
+ int delcount = 0;
+ for (NoteLabel *n = note, *nn; n; n = nn, ++delcount) {
+ nn = n->nextSelected; // Need to put this into temp variable because it is cleared in setSelected(false)
+ Operation op("DEL");
+ op << getNoteLabelId(n);
+ doOperation(op);
+ }
+
+ // Combine to one undo operation
+ if (delcount > 1) {
+ Operation op("COMBINER"); op << delcount; doOperation(op);
+ }
}
void NoteGraphWidget::setType(NoteLabel *note, int index)
@@ -563,7 +574,7 @@ void NoteGraphWidget::keyPressEvent(QKeyEvent *event)
doOperation(op);
}
- } else if (k == Qt::Key_Delete) { // Delete selected note
+ } else if (k == Qt::Key_Delete) { // Delete selected note(s)
del(m_selectedNote);
} else {
@@ -591,6 +602,7 @@ void NoteGraphWidget::doOperation(const Operation& op, Operation::OperationFlags
NoteLabel *n = m_notes.at(op.i(1));
if (n) {
if (action == "DEL") {
+ n->setSelected(false); // Remove from selection list
n->close();
m_notes.removeAt(op.i(1));
} else if (action == "SETGEOM") {
@@ -646,7 +658,7 @@ VocalTrack NoteGraphWidget::getVocalTrack() const
QString NoteGraphWidget::getCurrentSentence() const
{
QString lyrics;
- if (!m_notes.isEmpty() && m_selectedNote) {
+ if (!m_notes.isEmpty() && m_selectedNote && !m_selectedNote->nextSelected) {
int id = getNoteLabelId(m_selectedNote);
for (int i = id; i < m_notes.size(); ++i) {
if (i != id && m_notes[i]->note().lineBreak) break;
|
|
From: Tapio V. <aa...@us...> - 2011-02-02 08:11:32
|
Module: editor
Branch: master
Commit: b022143ab8d9d1192e91b7e17db41cf144602018
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 09:35:50 2011 +0200
Ctrl+A for select all.
---
notegraphwidget.cc | 34 ++++++++++++++++++++--------------
1 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index eddefc5..e8ae7c1 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -523,44 +523,50 @@ void NoteGraphWidget::mouseMoveEvent(QMouseEvent *event)
void NoteGraphWidget::keyPressEvent(QKeyEvent *event)
{
- switch (event->key()) {
- case Qt::Key_Return: // Edit lyric
+ int k = event->key(), m = event->modifiers();
+
+ if (k == Qt::Key_A && (m & Qt::ControlModifier)) { // Select all
+ selectNote(NULL); // Clear previous
+ for (int i = m_notes.size()-1; i >= 0; --i) // Traverse in reverse order to get the first note first
+ selectNote(m_notes[i], false);
+
+ } else if (k == Qt::Key_Return) { // Edit lyric
editLyric(m_selectedNote);
- break;
- case Qt::Key_Left: // Select note on the left
+
+ } else if (k == Qt::Key_Left) { // Select note on the left
if (m_selectedNote && m_notes.size() > 1 && m_selectedNote != m_notes.front()) {
for (NoteLabels::iterator it = m_notes.begin(); it != m_notes.end(); ++it) {
if (m_selectedNote == *it) { selectNote(*(--it)); break; }
}
}
- break;
- case Qt::Key_Right: // Select note on the right
+
+ } else if (k == Qt::Key_Right) { // Select note on the right
if (m_selectedNote && m_notes.size() > 1 && m_selectedNote != m_notes.back()) {
for (NoteLabels::iterator it = m_notes.begin(); it != m_notes.end(); ++it) {
if (m_selectedNote == *it) { selectNote(*(++it)); break; }
}
}
- break;
- case Qt::Key_Up: // Move note up
+
+ } else if (k == Qt::Key_Up) { // Move note up
if (m_selectedNote) {
Operation op("MOVE");
op << getNoteLabelId(m_selectedNote);
op << m_selectedNote->x() << int(round(px2n(m_selectedNote->y() + m_noteHalfHeight))) + 1;
doOperation(op);
}
- break;
- case Qt::Key_Down: // Move note down
+
+ } else if (k == Qt::Key_Down) { // Move note down
if (m_selectedNote) {
Operation op("MOVE");
op << getNoteLabelId(m_selectedNote);
op << m_selectedNote->x() << int(round(px2n(m_selectedNote->y() + m_noteHalfHeight))) - 1;
doOperation(op);
}
- break;
- case Qt::Key_Delete: // Delete selected note
+
+ } else if (k == Qt::Key_Delete) { // Delete selected note
del(m_selectedNote);
- break;
- default:
+
+ } else {
QWidget::keyPressEvent(event);
}
}
|
|
From: Tapio V. <aa...@us...> - 2011-02-02 08:11:30
|
Module: editor
Branch: master
Commit: 10625fc49aab32050aafd47592c7f799be891db6
Author: Tapio Vierros <tap...@gm...>
Date: Wed Feb 2 09:14:42 2011 +0200
Allow selecting multiple notes with Ctrl + Left Click.
Most functionality is then disabled, but stuff
will probably start breaking if this is used.
---
notegraphwidget.cc | 24 ++++++++++++++++--------
notelabel.hh | 2 ++
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index f2f1606..eddefc5 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -49,12 +49,13 @@ void NoteGraphWidget::selectNote(NoteLabel* note, bool clearPrevious)
if (!note) clearPrevious = true; // NULL means allways clear all
if (m_selectedNote) {
- m_selectedNote->setSelected(false); // Pixmap reset
// Clear all selections
if (clearPrevious) {
// Assumes m_selectedNote is the first note in the selection chain
- for (NoteLabel* n = m_selectedNote; n; n = n->nextSelected)
+ for (NoteLabel *n = m_selectedNote, *nn; n; n = nn) {
+ nn = n->nextSelected; // Need to put this into temp variable because it is cleared in setSelected(false)
n->setSelected(false);
+ }
} else {
// Add at the beginning of the chain
if (note && note != m_selectedNote && !note->isSelected()) {
@@ -332,17 +333,23 @@ void NoteGraphWidget::mousePressEvent(QMouseEvent *event)
// Left Click
if (event->button() == Qt::LeftButton) {
- selectNote(child);
// Determine if it is drag or resize
if (hotSpot.x() < NoteLabel::resize_margin || hotSpot.x() > child->width() - NoteLabel::resize_margin) {
// Start a resize
+ selectNote(child);
m_selectedAction = RESIZE;
child->startResizing( (hotSpot.x() < NoteLabel::resize_margin) ? -1 : 1 );
} else {
- // Start a drag
- m_selectedAction = MOVE;
- child->startDragging(hotSpot);
+ // Ctrl allows selecting multiple notes for dragging
+ selectNote(child, !(event->modifiers() & Qt::ControlModifier));
+ // FIXME: Drag disabled for multiple notes
+ if (m_selectedNote && !m_selectedNote->nextSelected) {
+ // Start a drag
+ m_selectedAction = MOVE;
+ child->startDragging(hotSpot);
+
+ }
}
child->createPixmap(child->size());
@@ -405,7 +412,7 @@ void NoteGraphWidget::split(NoteLabel *note, float ratio)
if (!note) return;
if (m_selectedNote == note)
- m_selectedNote = NULL;
+ selectNote(NULL);
// Cut the text
int cutpos = int(std::ceil(note->lyric().length() * ratio));
@@ -425,10 +432,11 @@ void NoteGraphWidget::split(NoteLabel *note, float ratio)
void NoteGraphWidget::del(NoteLabel *note)
{
+ if (note && (note->nextSelected || note->prevSelected)) return;// FIXME: Multiple note handling
if (!note) return;
if (m_selectedNote == note)
- m_selectedNote = NULL;
+ selectNote(NULL);
Operation op("DEL");
op << getNoteLabelId(note);
diff --git a/notelabel.hh b/notelabel.hh
index f58a270..efb0c1d 100644
--- a/notelabel.hh
+++ b/notelabel.hh
@@ -25,6 +25,8 @@ public:
if (!m_selected) {
if (nextSelected) nextSelected->prevSelected = prevSelected;
if (prevSelected) prevSelected->nextSelected = nextSelected;
+ nextSelected = NULL;
+ prevSelected = NULL;
}
}
}
|
|
From: Tapio V. <aa...@us...> - 2011-02-01 20:00:15
|
Module: editor
Branch: master
Commit: a09c9f9867d14d65ad257d9b460a487fe76d2abd
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 21:55:50 2011 +0200
Prepare for selecting multiple notes.
* Currently selected NoteLabels are "doubly linked"
* List maintaining is implemented, but not properly tested
* UI is ready for multiple note selection by not showing anything then
---
editorapp.cc | 3 ++-
notegraphwidget.cc | 23 +++++++++++++++++++----
notegraphwidget.hh | 2 +-
notelabel.cc | 6 +++---
notelabel.hh | 8 ++++++++
5 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 3811cff..b5b3680 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -146,7 +146,8 @@ void EditorApp::updateMenuStates()
void EditorApp::updateNoteInfo(NoteLabel *note)
{
- if (note) {
+ // For now we disable all controls when multiple notes are selected
+ if (note && !note->nextSelected) {
MusicalScale ms;
ui.valNoteBegin->setText(QString::number(note->note().begin, 'f', 2) + tr(" s"));
ui.valNoteEnd->setText(QString::number(note->note().end, 'f', 2) + tr(" s"));
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 4f34b87..f2f1606 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -44,12 +44,27 @@ NoteGraphWidget::NoteGraphWidget(QWidget *parent)
updateNotes();
}
-void NoteGraphWidget::selectNote(NoteLabel* note)
+void NoteGraphWidget::selectNote(NoteLabel* note, bool clearPrevious)
{
- if (m_selectedNote) // Reset old pixmap
- m_selectedNote->setSelected(false);
+ if (!note) clearPrevious = true; // NULL means allways clear all
- // Assign new selection
+ if (m_selectedNote) {
+ m_selectedNote->setSelected(false); // Pixmap reset
+ // Clear all selections
+ if (clearPrevious) {
+ // Assumes m_selectedNote is the first note in the selection chain
+ for (NoteLabel* n = m_selectedNote; n; n = n->nextSelected)
+ n->setSelected(false);
+ } else {
+ // Add at the beginning of the chain
+ if (note && note != m_selectedNote && !note->isSelected()) {
+ m_selectedNote->prevSelected = note;
+ note->nextSelected = m_selectedNote;
+ }
+ }
+ }
+
+ // Assign new selection as the first selected note
m_selectedNote = note;
if (m_selectedNote) {
m_selectedNote->setSelected();
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index c637a62..bfcef9d 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -42,7 +42,7 @@ public:
void stopMusic();
void seek(int x);
- void selectNote(NoteLabel *note);
+ void selectNote(NoteLabel *note, bool clearPrevious = true);
NoteLabel* selectedNote() const { return m_selectedNote; }
void split(NoteLabel *note, float ratio = 0.5f);
void del(NoteLabel *note);
diff --git a/notelabel.cc b/notelabel.cc
index b006831..cc6f7e7 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -16,7 +16,7 @@ const int NoteLabel::min_width = 10; // How many pixels is the resize area
const int NoteLabel::default_size = 100; // The preferred size of notes
NoteLabel::NoteLabel(const Note ¬e, QWidget *parent, const QPoint &position, const QSize &size, bool floating)
- : QLabel(parent), m_note(note), m_selected(false), m_floating(floating), m_resizing(0), m_hotspot()
+ : QLabel(parent), m_note(note), m_selected(false), m_floating(floating), m_resizing(0), m_hotspot(), nextSelected(), prevSelected()
{
createPixmap(size);
if (!position.isNull())
@@ -48,7 +48,7 @@ void NoteLabel::createPixmap(QSize size)
QLinearGradient gradient(0, 0, 0, image.height()-1);
float ff = m_floating ? 1.0f : 0.6f;
- int alpha = m_floating ? 160 : ( m_selected ? 80 : 220 );
+ int alpha = m_floating ? 160 : ( isSelected() ? 80 : 220 );
gradient.setColorAt(0.0, m_floating ? QColor(255, 255, 255, alpha) : QColor(50, 50, 50, alpha));
if (m_note.type == Note::NORMAL) {
gradient.setColorAt(0.2, QColor(100 * ff, 100 * ff, 255 * ff, alpha));
@@ -67,7 +67,7 @@ void NoteLabel::createPixmap(QSize size)
QPainter painter;
painter.begin(&image);
painter.setRenderHint(QPainter::Antialiasing);
- painter.setPen(m_selected ? Qt::red : Qt::black); // Hilight selected note
+ painter.setPen(isSelected() ? Qt::red : Qt::black); // Hilight selected note
painter.setBrush(gradient);
painter.drawRoundedRect(QRectF(0.5, 0.5, image.width()-1, image.height()-1), 8, 8);
diff --git a/notelabel.hh b/notelabel.hh
index ff68456..f58a270 100644
--- a/notelabel.hh
+++ b/notelabel.hh
@@ -18,9 +18,14 @@ public:
QString lyric() const { return m_note.syllable; }
void setLyric(const QString &text) { m_note.syllable = text; createPixmap(size()); }
+ bool isSelected() const { return m_selected; }
void setSelected(bool state = true) {
if (m_selected != state) {
m_selected = state; createPixmap(size());
+ if (!m_selected) {
+ if (nextSelected) nextSelected->prevSelected = prevSelected;
+ if (prevSelected) prevSelected->nextSelected = nextSelected;
+ }
}
}
@@ -39,6 +44,9 @@ public:
bool operator<(const NoteLabel &rhs) const { return x() < rhs.x(); }
+ NoteLabel* nextSelected;
+ NoteLabel* prevSelected;
+
public slots:
void showContextMenu(const QPoint &pos);
|
|
From: Tapio V. <aa...@us...> - 2011-02-01 16:48:53
|
Module: editor
Branch: master
Commit: 07a345d865a64e2da82838e39b2f5ad6e28898ed
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 18:45:27 2011 +0200
Note manipulation fixes.
* Moving note to either direction now stops when space runs out
* Resizing to smaller from either end now keeps note fixed at min width
* Enlarging still moves adjacent notes out of the way
- But from the intuitive side (now doesn't look so buggy)
---
notegraphwidget.cc | 31 ++++++++++++++++---------------
notegraphwidget.hh | 4 ++--
notelabel.cc | 8 ++++----
3 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 166ee8a..4f34b87 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -167,54 +167,55 @@ int NoteGraphWidget::getNoteLabelId(NoteLabel* note) const
return -1;
}
-void NoteGraphWidget::updateNotes()
+void NoteGraphWidget::updateNotes(bool leftToRight)
{
// Here happens the magic that adjusts the floating
// notes according to the fixed ones.
- FloatingGap gap(0);
+ FloatingGap gap(leftToRight ? 0 : width());
// Determine gaps between non-floating notes
- for (NoteLabels::iterator it = m_notes.begin(); it != m_notes.end(); ++it) {
- NoteLabel *child = *it;
+ // Variable leftToRight controls the iteration direction.
+ for (int i = (leftToRight ? 0 : m_notes.size()-1); i >= 0 && i < m_notes.size(); i += (leftToRight ? 1 : -1)) {
+ NoteLabel *child = m_notes[i];
if (!child) continue;
- if (child->isFloating() && child != m_notes.back()) {
+ if (child->isFloating() && i != (leftToRight ? m_notes.size()-1 : 0)) {
// Add floating note to gap
gap.addNote(child);
} else {
// Fixed note encountered, handle the gap (divide notes evenly into it)
- gap.end = child->x();
+ gap.end = child->x() + (leftToRight ? 0 : child->width());
- if (gap.width() <= gap.minWidth()) {
+ int d = (gap.end - gap.begin) * (leftToRight ? 1 : -1);
+ if (d <= gap.minWidth()) {
// We are at minimum width, enforce it
- int x = gap.begin;
+ int x = gap.begin - (leftToRight ? 0 : NoteLabel::min_width);
for (NoteLabels::iterator it2 = gap.notes.begin(); it2 != gap.notes.end(); ++it2) {
(*it2)->move(x, (*it2)->y());
(*it2)->resize(NoteLabel::min_width, (*it2)->height());
- x += NoteLabel::min_width;
+ x += NoteLabel::min_width * (leftToRight ? 1 : -1);
}
- // FIXME: Enforcing fixed note position can be cheated by rapid mouse movement
- // Also, left & right side behave differently
- child->move(gap.begin + gap.minWidth(), child->y());
+ // Also move the fixed one (probably the one being moved by user)
+ child->move(gap.begin + (leftToRight ? gap.minWidth() : (-gap.minWidth() - child->width())), child->y());
} else {
// Calculate position and size
double w = gap.width() / double(gap.notes.size()) * 0.9;
double step = (gap.width() - w * gap.notes.size()) / double(gap.notes.size() + 1);
- double x = gap.begin + step;
+ double x = gap.begin + (leftToRight ? step : (-step - w));
for (NoteLabels::iterator it2 = gap.notes.begin(); it2 != gap.notes.end(); ++it2) {
double y = (*it2)->y();
// Try to find optimal pitch
if (m_pitch) y = n2px(m_pitch->guessNote(px2s(x), px2s(x + w + step), 24)) - m_noteHalfHeight;
(*it2)->move(x, y);
(*it2)->resize(w, (*it2)->height());
- x += w + step;
+ x += (w + step) * (leftToRight ? 1 : -1);
}
}
// Start a new gap
- gap = FloatingGap(child->x() + child->width());
+ gap = FloatingGap(child->x() + (leftToRight ? child->width() : 0));
}
}
}
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index ba16547..c637a62 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -36,7 +36,7 @@ public:
void setLyrics(QString lyrics);
void setLyrics(const VocalTrack &track);
void analyzeMusic(QString filepath);
- void updateNotes();
+ void updateNotes(bool leftToRight = true);
void updateMusicPos(qint64 time, bool smoothing);
void stopMusic();
@@ -112,7 +112,7 @@ struct FloatingGap
void addNote(NoteLabel* n);
bool isEmpty() const { return notes.empty(); }
- int width() const { return end - begin; }
+ int width() const { return abs(end - begin); }
int minWidth() const;
int notesWidth() const { return m_notesWidth; }
diff --git a/notelabel.cc b/notelabel.cc
index 31c8cb5..b006831 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -99,11 +99,11 @@ void NoteLabel::mouseMoveEvent(QMouseEvent *event)
NoteGraphWidget* ngw = qobject_cast<NoteGraphWidget*>(parent());
if (m_resizing != 0) {
// Resizing
- if (m_resizing < 0)
+ if (m_resizing < 0 && width() - event->pos().x() > min_width)
setGeometry(x() + event->pos().x(), y(), width() - event->pos().x(), height());
- else
+ else if (m_resizing > 0 && event->pos().x() > min_width)
resize(event->pos().x(), height());
- if (ngw) ngw->updateNotes();
+ if (ngw) ngw->updateNotes(m_resizing > 0);
} else if (!m_hotspot.isNull()) {
// Moving
@@ -111,7 +111,7 @@ void NoteLabel::mouseMoveEvent(QMouseEvent *event)
move(newpos);
if (ngw) {
move(x(), ngw->n2px(int(round(ngw->px2n(y() + height() / 2)))) - height() / 2);
- ngw->updateNotes();
+ ngw->updateNotes((event->pos() - m_hotspot).x() < 0);
}
// Check if we need a new hotspot, because the note was constrained
if (pos().x() != newpos.x()) m_hotspot.rx() = event->x();
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-01 16:22:32
|
Module: editor
Branch: master
Commit: 70b55e8eba1eb12666cafd12eab4ae48cfd3081e
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Feb 1 17:22:21 2011 +0100
Determine the song lenght also by lyrics
---
notegraphwidget.cc | 14 +++++++-------
notegraphwidget.hh | 1 +
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 92925d5..166ee8a 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -23,7 +23,7 @@ namespace {
}
NoteGraphWidget::NoteGraphWidget(QWidget *parent)
- : QLabel(parent), m_noteHalfHeight(), m_panHotSpot(), m_selectedNote(), m_selectedAction(NONE), m_seeking(), m_actionHappened(), m_pitch(), m_seekHandle(this), m_pixelsPerSecond(200.0)
+ : QLabel(parent), m_noteHalfHeight(), m_panHotSpot(), m_selectedNote(), m_selectedAction(NONE), m_seeking(), m_actionHappened(), m_pitch(), m_seekHandle(this), m_pixelsPerSecond(200.0), m_duration(10.0)
{
// Determine NoteLabel height
NoteLabel templabel(Note(" "), NULL);
@@ -101,7 +101,7 @@ void NoteGraphWidget::setLyrics(QString lyrics)
void NoteGraphWidget::setLyrics(const VocalTrack &track)
{
clearNotes();
-
+ m_duration = std::max(m_duration, track.endTime);
const Notes ¬es = track.notes;
for (Notes::const_iterator it = notes.begin(); it != notes.end(); ++it) {
if (it->type == Note::SLEEP) continue;
@@ -139,16 +139,16 @@ void NoteGraphWidget::timerEvent(QTimerEvent*)
if (m_pitch) {
QMutexLocker locker(&m_pitch->mutex);
emit analyzeProgress(1000 * m_pitch->getProgress(), 1000);
- if (m_pitch->newDataAvailable()) update();
+ if (m_pitch->newDataAvailable()) {
+ m_duration = std::max(m_duration, m_pitch->getDuration());
+ update();
+ }
if (m_pitch->isFinished()) killTimer(m_analyzeTimer);
}
}
void NoteGraphWidget::paintEvent(QPaintEvent*) {
- double duration = 10.0;
- if (m_pitch) duration = std::max(duration, m_pitch->getDuration());
- // TODO: if (has notes) duration = std::max(duration, notes.duration);
- setFixedSize(s2px(duration), height());
+ setFixedSize(s2px(m_duration), height());
QScrollArea *scrollArea = NULL;
int x1 = 0, x2 = 0;
if (parentWidget())
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index 5bc7dcc..ba16547 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -102,6 +102,7 @@ private:
SeekHandle m_seekHandle;
int m_analyzeTimer;
double m_pixelsPerSecond;
+ double m_duration;
};
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-01 16:03:44
|
Module: editor Branch: master Commit: 16ee31b7bbc6bbcc2e8cc0058b018b4e4e6fa5f3 Author: Lasse Karkkainen <tro...@tr...> Date: Tue Feb 1 16:49:35 2011 +0100 Remove pixel dimensions and conversion functions from PitchVis in favor of doing all that in NoteGraphWidget. A lot of related cleanup and some other changes. Notice: n2px and px2n functions no longer compensate m_noteHalfHeight automatically, also notes are floating-point instead of integers. --- notegraphwidget.cc | 44 ++++++++++++++++++++---------------------- notegraphwidget.hh | 6 ++-- notelabel.cc | 4 +- pitch.hh | 1 + pitchvis.cc | 54 ++++++++++++++++++++++++--------------------------- pitchvis.hh | 20 ++++++------------ 6 files changed, 59 insertions(+), 70 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2011-02-01 13:27:44
|
Module: editor
Branch: master
Commit: 842d5dcddadb17444fad3db63baa728d011b51ee
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 15:27:05 2011 +0200
Display current sentence (or what's left of it) in the Tools tab.
---
editor.ui | 9 ++++++++-
editorapp.cc | 2 ++
notegraphwidget.cc | 14 ++++++++++++++
notegraphwidget.hh | 1 +
4 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/editor.ui b/editor.ui
index 3d29af1..040d86a 100644
--- a/editor.ui
+++ b/editor.ui
@@ -393,7 +393,7 @@
</property>
</widget>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -406,6 +406,13 @@
</property>
</spacer>
</item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QLabel" name="lblCurrentSentence">
+ <property name="text">
+ <string>Current sentence:</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<widget class="QWidget" name="tabLyrics">
diff --git a/editorapp.cc b/editorapp.cc
index eb40d35..3811cff 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -159,6 +159,7 @@ void EditorApp::updateNoteInfo(NoteLabel *note)
ui.chkFloating->setChecked(note->isFloating());
ui.chkLineBreak->setEnabled(true);
ui.chkLineBreak->setChecked(note->note().lineBreak);
+ ui.lblCurrentSentence->setText(tr("Current sentence:") + " <b>" + noteGraph->getCurrentSentence() + "</b>");
} else {
ui.valNoteBegin->setText("-");
ui.valNoteEnd->setText("-");
@@ -167,6 +168,7 @@ void EditorApp::updateNoteInfo(NoteLabel *note)
ui.cmbNoteType->setEnabled(false);
ui.chkFloating->setEnabled(false);
ui.chkLineBreak->setEnabled(false);
+ ui.lblCurrentSentence->setText(tr("Current sentence:") + " -");
}
}
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index dcdf47f..2c91c0a 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -615,6 +615,20 @@ VocalTrack NoteGraphWidget::getVocalTrack() const
return track;
}
+QString NoteGraphWidget::getCurrentSentence() const
+{
+ QString lyrics;
+ if (!m_notes.isEmpty() && m_selectedNote) {
+ int id = getNoteLabelId(m_selectedNote);
+ for (int i = id; i < m_notes.size(); ++i) {
+ if (i != id && m_notes[i]->note().lineBreak) break;
+ lyrics += m_notes[i]->lyric() + " ";
+ }
+ lyrics = lyrics.left(lyrics.size() - 1);
+ }
+ return lyrics;
+}
+
QString NoteGraphWidget::dumpLyrics() const
{
QString lyrics;
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index 7ef5ba5..56e5851 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -62,6 +62,7 @@ public:
int h() const { return m_pitch->height; }
VocalTrack getVocalTrack() const;
+ QString getCurrentSentence() const;
QString dumpLyrics() const;
public slots:
|
|
From: Tapio V. <aa...@us...> - 2011-02-01 13:08:44
|
Module: editor
Branch: master
Commit: 30570be14448b30cb72b35d433af66d1e80e8371
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 15:08:09 2011 +0200
Remove playback Stop button.
---
editor.ui | 10 ----------
editorapp.cc | 7 -------
editorapp.hh | 1 -
3 files changed, 0 insertions(+), 18 deletions(-)
diff --git a/editor.ui b/editor.ui
index 70a0362..3d29af1 100644
--- a/editor.ui
+++ b/editor.ui
@@ -380,16 +380,6 @@
</property>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QPushButton" name="cmdStop">
- <property name="toolTip">
- <string>Stop the music.</string>
- </property>
- <property name="text">
- <string>Stop</string>
- </property>
- </widget>
- </item>
<item row="2" column="1">
<widget class="QPushButton" name="cmdTimeSentence">
<property name="toolTip">
diff --git a/editorapp.cc b/editorapp.cc
index 20acc4b..eb40d35 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -73,7 +73,6 @@ EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), gettingStarted(), pr
ui.actionWhatsThis->setIcon(QIcon::fromTheme("help-hint", QIcon(":/icons/help-hint.png")));
ui.actionAbout->setIcon(QIcon::fromTheme("help-about", QIcon(":/icons/help-about.png")));
ui.cmdPlay->setIcon(QIcon::fromTheme("media-playback-start", QIcon(":/icons/media-playback-start.png")));
- ui.cmdStop->setIcon(QIcon::fromTheme("media-playback-stop", QIcon(":/icons/media-playback-stop.png")));
statusbarProgress = new QProgressBar(NULL);
ui.statusbar->addPermanentWidget(statusbarProgress);
@@ -570,12 +569,6 @@ void EditorApp::on_cmdPlay_clicked()
}
}
-void EditorApp::on_cmdStop_clicked()
-{
- if (player) player->stop();
- if (noteGraph) noteGraph->updateMusicPos(0, false);
-}
-
void EditorApp::audioTick(qint64 time)
{
if (noteGraph && player)
diff --git a/editorapp.hh b/editorapp.hh
index 0b6c607..92a049d 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -57,7 +57,6 @@ public slots:
// Automatic slots
void on_cmdPlay_clicked();
- void on_cmdStop_clicked();
void on_cmdRefreshLyrics_clicked();
// File menu
|
|
From: Tapio V. <aa...@us...> - 2011-02-01 09:54:53
|
Module: editor
Branch: master
Commit: b443f8be7d994bdb1ec149725d41628557e20eb8
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 11:52:56 2011 +0200
Make GettingStarted dialog run asynchronously.
---
editorapp.cc | 6 +++---
editorapp.hh | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 7e03dba..20acc4b 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -25,7 +25,7 @@ namespace {
static const QDataStream::Version PROJECT_SAVE_FILE_STREAM_VERSION = QDataStream::Qt_4_7;
}
-EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), projectFileName(), hasUnsavedChanges(), latestPath(QDir::homePath())
+EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), gettingStarted(), projectFileName(), hasUnsavedChanges(), latestPath(QDir::homePath())
{
ui.setupUi(this);
readSettings();
@@ -480,8 +480,8 @@ void EditorApp::on_actionLyricsFromClipboard_triggered()
void EditorApp::on_actionGettingStarted_triggered()
{
- GettingStartedDialog dialog(this);
- dialog.exec();
+ if (!gettingStarted) gettingStarted = new GettingStartedDialog(this);
+ gettingStarted->show();
}
void EditorApp::on_actionWhatsThis_triggered()
diff --git a/editorapp.hh b/editorapp.hh
index f754d19..0b6c607 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -10,6 +10,7 @@ class QProgressBar;
class QCloseEvent;
class NoteLabel;
class NoteGraphWidget;
+class GettingStartedDialog;
namespace Phonon {
class MediaObject;
class AudioOutput;
@@ -100,6 +101,7 @@ protected:
private:
Ui::EditorApp ui;
+ GettingStartedDialog *gettingStarted;
NoteGraphWidget *noteGraph;
OperationStack opStack;
OperationStack redoStack;
|
|
From: Tapio V. <aa...@us...> - 2011-02-01 09:54:51
|
Module: editor
Branch: master
Commit: aad14742afff6941182b260b62955116171817ea
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 11:49:20 2011 +0200
Add one more step to GettingStarted.
---
gettingstarted.hh | 4 ++++
gettingstarted.ui | 30 ++++++++++++++++++++++++++----
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/gettingstarted.hh b/gettingstarted.hh
index a9c9e43..2bbe1ad 100644
--- a/gettingstarted.hh
+++ b/gettingstarted.hh
@@ -46,6 +46,10 @@ public slots:
m_editorApp->showTab(0);
}
+ void on_cmdMetadata_clicked(bool) {
+ m_editorApp->showTab(1);
+ }
+
void on_cmdExport_clicked(bool) {
m_editorApp->showExportMenu();
}
diff --git a/gettingstarted.ui b/gettingstarted.ui
index 10cc2b7..dc76f57 100644
--- a/gettingstarted.ui
+++ b/gettingstarted.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>640</width>
- <height>480</height>
+ <width>550</width>
+ <height>350</height>
</rect>
</property>
<property name="windowTitle">
@@ -26,6 +26,9 @@
<property name="text">
<string>&Close</string>
</property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item row="1" column="0" colspan="2">
@@ -111,7 +114,7 @@
</property>
</widget>
</item>
- <item row="5" column="0">
+ <item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -165,13 +168,32 @@
</property>
</widget>
</item>
- <item row="4" column="1" colspan="3">
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="font">
+ <font>
+ <pointsize>20</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>6.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1" colspan="3">
<widget class="QCommandLinkButton" name="cmdExport">
<property name="text">
<string>Export to your preferred format</string>
</property>
</widget>
</item>
+ <item row="4" column="1" colspan="3">
+ <widget class="QCommandLinkButton" name="cmdMetadata">
+ <property name="text">
+ <string>Enter or correct song metadata</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
|
|
From: Tapio V. <aa...@us...> - 2011-02-01 09:54:48
|
Module: editor
Branch: master
Commit: 31190ce2446a55342b4319106984ee14086a713c
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 11:43:18 2011 +0200
Implement GettingStarted buttons.
---
editorapp.hh | 2 ++
gettingstarted.hh | 27 +++++++++++++++++++++++++++
gettingstarted.ui | 4 ++--
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/editorapp.hh b/editorapp.hh
index cb5e675..f754d19 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -33,6 +33,8 @@ public:
void updateSongMeta(bool readFromSongToUI = false);
void updateMenuStates();
+ void showTab(int tab) { ui.tabWidget->setCurrentIndex(tab); }
+ void showExportMenu() { ui.menuExport->exec(pos() + QPoint(0, ui.menubar->height())); }
private:
bool promptSaving();
diff --git a/gettingstarted.hh b/gettingstarted.hh
index 1b4b753..a9c9e43 100644
--- a/gettingstarted.hh
+++ b/gettingstarted.hh
@@ -1,6 +1,7 @@
#include <QSettings>
#include "ui_gettingstarted.h"
#include "editorapp.hh"
+#include <iostream>
class GettingStartedDialog: public QDialog, private Ui::GettingStarted
{
@@ -23,6 +24,32 @@ public slots:
settings.setValue("showhelp", state != Qt::Unchecked);
}
+ // Command link buttons
+
+ void on_cmdMusicFile_clicked(bool) {
+ m_editorApp->on_actionMusicFile_triggered();
+ }
+
+ void on_cmdLyricsFromFile_clicked(bool) {
+ m_editorApp->on_actionLyricsFromFile_triggered();
+ }
+
+ void on_cmdLyricsFromClipboard_clicked(bool) {
+ m_editorApp->on_actionLyricsFromClipboard_triggered();
+ }
+
+ void on_cmdTimeLyrics_clicked(bool) {
+ m_editorApp->showTab(2);
+ }
+
+ void on_cmdFineTuneLyrics_clicked(bool) {
+ m_editorApp->showTab(0);
+ }
+
+ void on_cmdExport_clicked(bool) {
+ m_editorApp->showExportMenu();
+ }
+
protected:
void closeEvent(QCloseEvent*) {
QSettings settings;
diff --git a/gettingstarted.ui b/gettingstarted.ui
index 26bdd75..10cc2b7 100644
--- a/gettingstarted.ui
+++ b/gettingstarted.ui
@@ -159,14 +159,14 @@
</widget>
</item>
<item row="3" column="1" colspan="3">
- <widget class="QCommandLinkButton" name="commandLinkButton">
+ <widget class="QCommandLinkButton" name="cmdFineTuneLyrics">
<property name="text">
<string>Fine tune and fix wrongly guessed note positions</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="3">
- <widget class="QCommandLinkButton" name="commandLinkButton_2">
+ <widget class="QCommandLinkButton" name="cmdExport">
<property name="text">
<string>Export to your preferred format</string>
</property>
|
|
From: Tapio V. <aa...@us...> - 2011-02-01 09:54:45
|
Module: editor
Branch: master
Commit: fb1fdce7663eda2dfb23ff8e32ea923049898fab
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 11:21:23 2011 +0200
Basic functionality to GettingStarted.
* Show on first application startup
* Allow toggling startup behaviour
* Close button works
---
editorapp.cc | 4 ++++
gettingstarted.hh | 26 ++++++++++++++++++++++++--
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 48acf21..7e03dba 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -93,6 +93,10 @@ EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), projectFileName(), h
connect(player, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(playerStateChanged(Phonon::State,Phonon::State)));
connect(player, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged()));
connect(noteGraph, SIGNAL(seeked(qint64)), player, SLOT(seek(qint64)));
+
+ QSettings settings;
+ if (settings.value("showhelp", true).toBool())
+ on_actionGettingStarted_triggered();
}
void EditorApp::operationDone(const Operation &op)
diff --git a/gettingstarted.hh b/gettingstarted.hh
index 89154da..1b4b753 100644
--- a/gettingstarted.hh
+++ b/gettingstarted.hh
@@ -1,12 +1,34 @@
+#include <QSettings>
#include "ui_gettingstarted.h"
+#include "editorapp.hh"
class GettingStartedDialog: public QDialog, private Ui::GettingStarted
{
Q_OBJECT
public:
- GettingStartedDialog(QWidget* parent = 0)
- : QDialog(parent)
+ GettingStartedDialog(QWidget* parent)
+ : QDialog(parent), m_editorApp(qobject_cast<EditorApp*>(parent))
{
+ if (!m_editorApp) throw std::runtime_error("Couldn't open help dialog.");
setupUi(this);
+ QSettings settings;
+ chkShowOnStartup->setChecked(settings.value("showhelp", false).toBool());
}
+
+public slots:
+ void on_cmdClose_clicked(bool) { close(); }
+
+ void on_chkShowOnStartup_stateChanged(int state) {
+ QSettings settings;
+ settings.setValue("showhelp", state != Qt::Unchecked);
+ }
+
+protected:
+ void closeEvent(QCloseEvent*) {
+ QSettings settings;
+ settings.setValue("showhelp", chkShowOnStartup->isChecked());
+ }
+
+private:
+ EditorApp *m_editorApp;
};
|
|
From: Tapio V. <aa...@us...> - 2011-02-01 09:54:42
|
Module: editor
Branch: master
Commit: cabbacfbe06f3afa231c8f7cf0a13aa4ed9ac88d
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 11:00:53 2011 +0200
Added a (dummy) getting started window.
---
CMakeLists.txt | 2 +-
editor.ui | 6 ++
editorapp.cc | 6 ++
editorapp.hh | 1 +
gettingstarted.hh | 12 ++++
gettingstarted.ui | 182 +++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 208 insertions(+), 1 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4d995f1..62b86a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,7 +41,7 @@ else(Phonon_FOUND)
endif(Phonon_FOUND)
# Headers that need MOC need to be defined separately
-file(GLOB MOC_HEADER_FILES "editorapp.hh" "notelabel.hh" "notegraphwidget.hh" "textcodecselector.hh")
+file(GLOB MOC_HEADER_FILES editorapp.hh notelabel.hh notegraphwidget.hh textcodecselector.hh gettingstarted.hh)
file(GLOB SOURCE_FILES "*.cc")
file(GLOB HEADER_FILES "*.hh")
diff --git a/editor.ui b/editor.ui
index da46a5a..70a0362 100644
--- a/editor.ui
+++ b/editor.ui
@@ -509,6 +509,7 @@
<property name="title">
<string>&Help</string>
</property>
+ <addaction name="actionGettingStarted"/>
<addaction name="actionWhatsThis"/>
<addaction name="separator"/>
<addaction name="actionAbout"/>
@@ -648,6 +649,11 @@
<string>Use anti-aliasing for the pitch visualization</string>
</property>
</action>
+ <action name="actionGettingStarted">
+ <property name="text">
+ <string>&Getting started</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
diff --git a/editorapp.cc b/editorapp.cc
index 37fec8f..48acf21 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -16,6 +16,7 @@
#include "notegraphwidget.hh"
#include "songwriter.hh"
#include "textcodecselector.hh"
+#include "gettingstarted.hh"
namespace {
static const QString PROJECT_SAVE_FILE_EXTENSION = "songproject"; // FIXME: Nice extension here
@@ -473,6 +474,11 @@ void EditorApp::on_actionLyricsFromClipboard_triggered()
// Help menu
+void EditorApp::on_actionGettingStarted_triggered()
+{
+ GettingStartedDialog dialog(this);
+ dialog.exec();
+}
void EditorApp::on_actionWhatsThis_triggered()
{
diff --git a/editorapp.hh b/editorapp.hh
index 9db3da7..cb5e675 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -80,6 +80,7 @@ public slots:
void on_actionLyricsFromClipboard_triggered();
// Help menu
+ void on_actionGettingStarted_triggered();
void on_actionWhatsThis_triggered();
void on_actionAbout_triggered();
diff --git a/gettingstarted.hh b/gettingstarted.hh
new file mode 100644
index 0000000..89154da
--- /dev/null
+++ b/gettingstarted.hh
@@ -0,0 +1,12 @@
+#include "ui_gettingstarted.h"
+
+class GettingStartedDialog: public QDialog, private Ui::GettingStarted
+{
+ Q_OBJECT
+public:
+ GettingStartedDialog(QWidget* parent = 0)
+ : QDialog(parent)
+ {
+ setupUi(this);
+ }
+};
diff --git a/gettingstarted.ui b/gettingstarted.ui
new file mode 100644
index 0000000..26bdd75
--- /dev/null
+++ b/gettingstarted.ui
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>GettingStarted</class>
+ <widget class="QDialog" name="GettingStarted">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>640</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Getting Started</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="chkShowOnStartup">
+ <property name="text">
+ <string>&Show this window on application start</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="cmdClose">
+ <property name="text">
+ <string>&Close</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="QFrame" name="frame">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <pointsize>20</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>1.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="3">
+ <widget class="QCommandLinkButton" name="cmdMusicFile">
+ <property name="text">
+ <string>Insert a music file</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="font">
+ <font>
+ <pointsize>20</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>2.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCommandLinkButton" name="cmdLyricsFromFile">
+ <property name="text">
+ <string>Insert lyrics from a file</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="font">
+ <font>
+ <pointsize>20</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>3.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="font">
+ <font>
+ <pointsize>20</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>4.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="font">
+ <font>
+ <pointsize>20</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>5.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="4">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="3">
+ <widget class="QCommandLinkButton" name="cmdLyricsFromClipboard">
+ <property name="text">
+ <string>Insert lyrics from clipboard</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>or</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="3">
+ <widget class="QCommandLinkButton" name="cmdTimeLyrics">
+ <property name="text">
+ <string>Time the lyrics roughly while listening to the song</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" colspan="3">
+ <widget class="QCommandLinkButton" name="commandLinkButton">
+ <property name="text">
+ <string>Fine tune and fix wrongly guessed note positions</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" colspan="3">
+ <widget class="QCommandLinkButton" name="commandLinkButton_2">
+ <property name="text">
+ <string>Export to your preferred format</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
|
|
From: Tapio V. <aa...@us...> - 2011-02-01 07:50:53
|
Module: editor
Branch: master
Commit: 0b5a6a4676b15febd00e11cb7f16d60dd9cd7255
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 09:49:41 2011 +0200
Use a proper value for pitch visualization drawing width.
---
notegraphwidget.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index b0ed152..dcdf47f 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -155,7 +155,7 @@ void NoteGraphWidget::paintEvent(QPaintEvent*) {
scrollArea = qobject_cast<QScrollArea*>(parentWidget()->parent());
if (scrollArea && scrollArea->horizontalScrollBar()) {
x1 = scrollArea->horizontalScrollBar()->value();
- x2 = x1 + 2000; // FIXME: Need to figure out the real viewport width from somewhere
+ x2 = x1 + scrollArea->width();
}
if (m_pitch) m_pitch->paint(this, x1, x2);
}
|
|
From: Tapio V. <aa...@us...> - 2011-02-01 07:34:31
|
Module: editor
Branch: master
Commit: 1015e3ef9aa3a7ca358b6994ba2a54b4e65f7174
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 09:33:57 2011 +0200
Optimize pitch guessing a bit.
---
pitchvis.cc | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/pitchvis.cc b/pitchvis.cc
index 95e1e53..870bfe2 100644
--- a/pitchvis.cc
+++ b/pitchvis.cc
@@ -117,7 +117,11 @@ int PitchVis::guessNote(double begin, double end, int note) {
if (note >= 0 || note < 48) score[note] = 10.0; // Slightly prefer the current note
// Score against paths
for (PitchVis::Paths::const_iterator it = paths.begin(), itend = paths.end(); it != itend; ++it) {
+ // Discard paths completely outside the window
+ if (it->back().time < begin) continue;
+ if (it->front().time > end) break;
for (PitchPath::const_iterator it2 = it->begin(), it2end = it->end(); it2 != it2end; ++it2) {
+ // Discard path points outside the window
if (it2->time < begin) continue;
if (it2->time > end) break;
unsigned n = round(it2->note);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-01 03:18:02
|
Module: performous
Branch: opengl2
Commit: 43cff91111114815547f3d2a7edfac27be60e103
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Feb 1 04:17:47 2011 +0100
Various rendering fixes, now both 3D modes fully working but slow.
---
game/fbo.hh | 15 +++++--
game/video_driver.cc | 77 ++++++++++++++++++++++++-------------
themes/default/shaders/core.frag | 2 +-
3 files changed, 62 insertions(+), 32 deletions(-)
diff --git a/game/fbo.hh b/game/fbo.hh
index c3668e1..77a58d2 100644
--- a/game/fbo.hh
+++ b/game/fbo.hh
@@ -9,14 +9,21 @@ class FBO: public boost::noncopyable {
public:
/// Generate the FBO and attach a fresh texture to it
FBO(): m_texture() {
- glGenFramebuffersEXT(1, &m_fbo);
- bind();
{
UseTexture tex(m_texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, screenW(), screenH(), 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- // Bind texture as COLOR_ATTACHMENT0
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_texture.id(), 0);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
+ // When texture area is large, bilinear filter the original
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ // The texture wraps over at the edges (repeat)
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
+ // Create FBO
+ glGenFramebuffersEXT(1, &m_fbo);
+ // Bind texture as COLOR_ATTACHMENT0
+ bind();
+ glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_texture.id(), 0);
unbind();
}
/// Handle clean-up
diff --git a/game/video_driver.cc b/game/video_driver.cc
index 08ce0ed..2eae46f 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -81,18 +81,60 @@ void Window::blank() {
}
void Window::render(boost::function<void (void)> drawFunc) {
- // Draw current frame for all the views
+ bool stereo = config["graphic/stereo3d"].b();
+ int type = config["graphic/stereo3dtype"].i();
+ if (type == 1 && !m_fullscreen) stereo = false; // Over/under only in full screen mode
+ // Viewport parameters (defaults)
+ double vx = 0.5f * (screen->w - s_width);
+ double vy = 0.5f * (screen->h - s_height);
+ double vw = s_width, vh = s_height;
+ glViewport(vx, vy, vw, vh);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ m_shader->setUniformMatrix("colorMatrix", glmath::Matrix());
+ if (!stereo) {
+ view(0);
+ drawFunc();
+ return;
+ }
+ // Render each eye to FBO
FBO fbo[2];
- for (unsigned i = 0; view(i); ++i) {
+ for (unsigned i = 0; i < 2; ++i) {
UseFBO user(fbo[i]);
+ view(i);
drawFunc();
}
- {
- UseTexture use(fbo[0].getTexture());
- glGenerateMipmap(GL_TEXTURE_2D);
+ // Render to actual framebuffer from FBOs
+ for (int num = 0; num < 2; ++num) {
+ if (type == 0) {
+ using namespace glmath;
+ Matrix colorMatrix;
+ float saturation = 0.6; // (0..1)
+ float col = (1.0 + 2.0 * saturation) / 3.0;
+ float gry = 0.5 * (1.0 - col);
+ if (num == 0) {
+ // Left eye
+ colorMatrix.cols[0] = Vec4(col, 0.0, 0.0); // Red in original becomes
+ colorMatrix.cols[1] = Vec4(gry, 0.0, 0.0); // Green in original becomes
+ colorMatrix.cols[2] = Vec4(gry, 0.0, 0.0); // Blue in original becomes
+ } else {
+ // Right eye
+ colorMatrix.cols[0] = Vec4(0.0, gry, gry); // Red in original becomes
+ colorMatrix.cols[1] = Vec4(0.0, col, gry); // Green in original becomes
+ colorMatrix.cols[2] = Vec4(0.0, gry, col); // Blue in original becomes
+ }
+ m_shader->setUniformMatrix("colorMatrix", colorMatrix);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ } else {
+ double margin = screen->h - s_height;
+ glViewport(vx, 0.25 * margin + (num ? 0.0 : 0.5 * screen->h), vw, 0.5 * vh);
+ }
+ {
+ UseTexture use(fbo[num].getTexture());
+ glGenerateMipmap(GL_TEXTURE_2D);
+ //drawFunc();
+ fbo[num].getTexture().draw(Dimensions().stretch(1.0, virtH()), TexCoords(0.0, 1.0, 1.0, 0.0));
+ }
}
- //getCurrentScreen()->draw();
- //fbo[0].getTexture().draw(Dimensions(1.0).center(0.0).middle(0.0), TexCoords());
}
bool Window::view(unsigned num) {
@@ -113,35 +155,16 @@ bool Window::view(unsigned num) {
);
// Setup views
bool stereo = config["graphic/stereo3d"].b();
- int type = config["graphic/stereo3dtype"].i();
- if (type == 1 && !m_fullscreen) stereo = false; // Over/under only in full screen mode
- // Viewport parameters (defaults)
- double vx = 0.5f * (screen->w - s_width);
- double vy = 0.5f * (screen->h - s_height);
- double vw = s_width, vh = s_height;
- glmath::Matrix colorMatrix;
if (stereo) {
if (num > 1) return false;
- double separation = (num ? -1 : 1) * getSeparation();
+ double separation = (num == 0 ? -1 : 1) * getSeparation();
glMatrixMode(GL_PROJECTION);
glTranslatef(separation, 0.0f, 0.0f);
glMatrixMode(GL_MODELVIEW);
glTranslatef(-separation, 0.0f, 0.0f);
- if (type == 0) {
- // FIXME: This is somewhat b0rked because what we really want is eye1 + eye2, not eye2 alpha-blended on top of eye1...
- if (!num) colorMatrix.cols[0] = Vec4(0.0, 1.0, 1.0);
- else { colorMatrix.cols[2] = colorMatrix.cols[1] = Vec4(1.0, 0.0, 0.0); colorMatrix(3,3) = 0.5; }
- }
- if (type == 1) {
- double margin = screen->h - s_height;
- vy = 0.25 * margin + (num ? 0.5 * screen->h : 0.0);
- vh *= 0.5;
- }
} else {
if (num != 0) return false;
}
- m_shader->setUniformMatrix("colorMatrix", colorMatrix);
- glViewport(vx, vy, vw, vh);
return true;
}
diff --git a/themes/default/shaders/core.frag b/themes/default/shaders/core.frag
index f1bd943..905c861 100644
--- a/themes/default/shaders/core.frag
+++ b/themes/default/shaders/core.frag
@@ -19,6 +19,6 @@ void main()
texel = vec4(1.0, 0.0, 1.0, 1.0); // Magenta to highlight
}
- gl_FragColor = colorMatrix * gl_Color * texel;
+ gl_FragColor = colorMatrix * (gl_Color * texel);
}
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-01-31 23:57:41
|
Module: performous
Branch: opengl2
Commit: 8dd69283f43236a414fb4dd546ac95b25d23fc2b
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Feb 1 00:44:41 2011 +0100
Refactor where the rendering occurs (mainloop calls window to render using SM::drawScreen).
---
game/fbo.hh | 9 +++++----
game/main.cc | 5 +++--
game/screenmanager.cc | 7 ++-----
game/video_driver.cc | 16 ++++++++++++++++
game/video_driver.hh | 2 ++
5 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/game/fbo.hh b/game/fbo.hh
index ded4f84..c3668e1 100644
--- a/game/fbo.hh
+++ b/game/fbo.hh
@@ -1,6 +1,7 @@
#pragma once
#include <boost/noncopyable.hpp>
+#include "surface.hh"
#include "video_driver.hh"
/// Frame Buffer Object class
@@ -12,9 +13,9 @@ class FBO: public boost::noncopyable {
bind();
{
UseTexture tex(m_texture);
- glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, screenW(), screenH(), 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, screenW(), screenH(), 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
// Bind texture as COLOR_ATTACHMENT0
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, m_texture.id(), 0);
+ glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_texture.id(), 0);
}
unbind();
}
@@ -23,7 +24,7 @@ class FBO: public boost::noncopyable {
if (m_fbo) glDeleteFramebuffersEXT(1, &m_fbo);
}
/// Returns a reference to the attached texture
- OpenGLTexture<GL_TEXTURE_RECTANGLE_ARB>& getTexture() {
+ OpenGLTexture<GL_TEXTURE_2D>& getTexture() {
return m_texture;
}
/// Bind the FBO into use
@@ -37,7 +38,7 @@ class FBO: public boost::noncopyable {
private:
GLuint m_fbo;
- OpenGLTexture<GL_TEXTURE_RECTANGLE_ARB> m_texture;
+ OpenGLTexture<GL_TEXTURE_2D> m_texture;
};
/// RAII FBO binder
diff --git a/game/main.cc b/game/main.cc
index a7d7987..b69a936 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -21,6 +21,7 @@
#include "screen_paths.hh"
#include "screen_players.hh"
+#include <boost/bind.hpp>
#include <boost/format.hpp>
#include <boost/program_options.hpp>
#include <boost/thread.hpp>
@@ -65,7 +66,7 @@ static void checkEvents_SDL(ScreenManager& sm) {
sm.finished();
break;
case SDL_VIDEORESIZE:
- sm.window().resize(event.resize.w, event.resize.h);
+ //sm.window().resize(event.resize.w, event.resize.h);
break;
case SDL_KEYDOWN:
int keypressed = event.key.keysym.sym;
@@ -179,7 +180,7 @@ void mainLoop(std::string const& songlist) {
try {
// Draw
window.blank();
- sm.drawScreen();
+ window.render(boost::bind(&ScreenManager::drawScreen, &sm));
prof("draw");
// Display (and wait until next frame)
window.swap();
diff --git a/game/screenmanager.cc b/game/screenmanager.cc
index c47b9f9..847abcc 100644
--- a/game/screenmanager.cc
+++ b/game/screenmanager.cc
@@ -42,11 +42,8 @@ Screen* ScreenManager::getScreen(std::string const& name) {
}
void ScreenManager::drawScreen() {
- // Draw current frame for all the views
- for (unsigned i = 0; window().view(i); ++i) {
- getCurrentScreen()->draw();
- drawNotifications();
- }
+ getCurrentScreen()->draw();
+ drawNotifications();
}
diff --git a/game/video_driver.cc b/game/video_driver.cc
index 336f179..08ce0ed 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -1,6 +1,7 @@
#include "video_driver.hh"
#include "config.hh"
+#include "fbo.hh"
#include "fs.hh"
#include "glmath.hh"
#include "image.hh"
@@ -79,6 +80,21 @@ void Window::blank() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
+void Window::render(boost::function<void (void)> drawFunc) {
+ // Draw current frame for all the views
+ FBO fbo[2];
+ for (unsigned i = 0; view(i); ++i) {
+ UseFBO user(fbo[i]);
+ drawFunc();
+ }
+ {
+ UseTexture use(fbo[0].getTexture());
+ glGenerateMipmap(GL_TEXTURE_2D);
+ }
+ //getCurrentScreen()->draw();
+ //fbo[0].getTexture().draw(Dimensions(1.0).center(0.0).middle(0.0), TexCoords());
+}
+
bool Window::view(unsigned num) {
// Setup the projection matrix for 2D translates
using namespace glmath;
diff --git a/game/video_driver.hh b/game/video_driver.hh
index 37f9f38..45ecf6b 100644
--- a/game/video_driver.hh
+++ b/game/video_driver.hh
@@ -2,6 +2,7 @@
#include "glshader.hh"
#include "glutil.hh"
+#include <boost/function.hpp>
#include <boost/scoped_ptr.hpp>
unsigned int screenW();
@@ -25,6 +26,7 @@ public:
Window(unsigned int windowW, unsigned int windowH, bool fullscreen);
/// destructor
~Window();
+ void render(boost::function<void (void)> drawFunc);
/// Setup everything for drawing a view.
/// @param num should be 0 the first time each frame then incremented for each additional view
/// @returns true if the view should be rendered, false if no more views are available
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-01-31 23:57:39
|
Module: performous
Branch: opengl2
Commit: 93c531706feb48216c4b552943ddf3fcd6be0927
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Feb 1 00:42:02 2011 +0100
Another enum value for GL errors
---
game/glutil.hh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/game/glutil.hh b/game/glutil.hh
index d07c25e..98ca652 100644
--- a/game/glutil.hh
+++ b/game/glutil.hh
@@ -204,6 +204,7 @@ namespace glutil {
case GL_INVALID_ENUM: return "Invalid enum";
case GL_INVALID_VALUE: return "Invalid value";
case GL_INVALID_OPERATION: return "Invalid operation";
+ case GL_INVALID_FRAMEBUFFER_OPERATION: return "FBO is not complete";
case GL_STACK_OVERFLOW: return "Stack overflow";
case GL_STACK_UNDERFLOW: return "Stack underflow";
case GL_OUT_OF_MEMORY: return "Out of memory";
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-01-31 23:57:36
|
Module: performous
Branch: opengl2
Commit: b115088a478a826830ecf533144d1eae109381c7
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jan 28 23:52:28 2011 +0100
New way of generating mipmaps (GL_GENERATE_MIPMAP has been removed since OpenGL 3.1)
---
game/surface.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/surface.cc b/game/surface.cc
index ec2004e..54fb533 100644
--- a/game/surface.cc
+++ b/game/surface.cc
@@ -95,7 +95,6 @@ void Texture::load(unsigned int width, unsigned int height, pix::Format format,
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f);
glerror.check("MAX_ANISOTROPY_EXT");
- glTexParameteri(type(), GL_GENERATE_MIPMAP, GL_TRUE);
PixFmt const& f = getPixFmt(format);
glPixelStorei(GL_UNPACK_SWAP_BYTES, f.swap);
// Load the data into texture
@@ -113,6 +112,7 @@ void Texture::load(unsigned int width, unsigned int height, pix::Format format,
// Just don't do it in Surface class, thanks. -Tronic
glTexImage2D(type(), 0, GL_RGBA, newWidth, newHeight, 0, f.format, f.type, &outBuf[0]);
}
+ glGenerateMipmap(type());
}
void Surface::load(unsigned int width, unsigned int height, pix::Format format, unsigned char const* buffer, float ar) {
|
|
From: Tapio V. <aa...@us...> - 2011-01-31 17:15:50
|
Module: editor
Branch: master
Commit: feb10c42ef95992cdf35a26f9b88d9433a5e4645
Author: Tapio Vierros <tap...@gm...>
Date: Mon Jan 31 19:06:04 2011 +0200
CMake target includes headers: now all of them show up in Qt Creator.
---
CMakeLists.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f675775..4d995f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,6 @@ include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR})
-add_executable(editor ${SOURCE_FILES} ${MOC_SOURCES} ${RESOURCE_SOURCES} ${UI_SOURCES} ${TRANSLATIONS})
+add_executable(editor ${HEADER_FILES} ${SOURCE_FILES} ${MOC_SOURCES} ${RESOURCE_SOURCES} ${UI_SOURCES} ${TRANSLATIONS})
target_link_libraries(editor ${LIBS})
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2011-01-31 17:06:10
|
Module: editor
Branch: master
Commit: 810e8a1325273594dab12ab4250605cfc43a5239
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Jan 31 18:05:57 2011 +0100
Automatically match floating notes to pitch
---
notegraphwidget.cc | 5 ++++-
pitchvis.cc | 17 +++++++++++++++++
pitchvis.hh | 2 +-
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index bd551e7..b0ed152 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -204,7 +204,10 @@ void NoteGraphWidget::updateNotes()
double step = (gap.width() - w * gap.notes.size()) / double(gap.notes.size() + 1);
double x = gap.begin + step;
for (NoteLabels::iterator it2 = gap.notes.begin(); it2 != gap.notes.end(); ++it2) {
- (*it2)->move(x, (*it2)->y());
+ double y = (*it2)->y();
+ // Try to find optimal pitch
+ if (m_pitch) y = n2px(m_pitch->guessNote(px2s(x), px2s(x + w + step), 24));
+ (*it2)->move(x, y);
(*it2)->resize(w, (*it2)->height());
x += w + step;
}
diff --git a/pitchvis.cc b/pitchvis.cc
index 9a324f6..95e1e53 100644
--- a/pitchvis.cc
+++ b/pitchvis.cc
@@ -111,6 +111,23 @@ void PitchVis::paint(QPaintDevice* widget, int x1, int x2) {
painter.end();
}
+int PitchVis::guessNote(double begin, double end, int note) {
+ const unsigned scoreSz = 48;
+ double score[scoreSz] = {};
+ if (note >= 0 || note < 48) score[note] = 10.0; // Slightly prefer the current note
+ // Score against paths
+ for (PitchVis::Paths::const_iterator it = paths.begin(), itend = paths.end(); it != itend; ++it) {
+ for (PitchPath::const_iterator it2 = it->begin(), it2end = it->end(); it2 != it2end; ++it2) {
+ if (it2->time < begin) continue;
+ if (it2->time > end) break;
+ unsigned n = round(it2->note);
+ if (n < scoreSz) score[n] += 100 + it2->level;
+ }
+ }
+ // Return the idx with best score
+ return std::max_element(score + 1, score + scoreSz) - score;
+}
+
unsigned PitchVis::freq2px(double freq) const { return note2px(scale.getNote(freq)); }
/* static */ unsigned PitchVis::note2px(double tone) { return height - static_cast<unsigned>(16.0 * tone); }
/* static */ double PitchVis::px2note(unsigned px) { return (height - px) / 16.0; }
diff --git a/pitchvis.hh b/pitchvis.hh
index ff24bfb..17567cb 100644
--- a/pitchvis.hh
+++ b/pitchvis.hh
@@ -32,7 +32,7 @@ public:
Paths const& getPaths() { moreAvailable = false; return paths; }
bool newDataAvailable() const { return moreAvailable; }
int getXValue() const { return curX; }
-
+ int guessNote(double begin, double end, int initial);
std::size_t width() const { return m_width; }
unsigned freq2px(double freq) const;
|