Hi there,
I find this really usefull ...
--
Jérémy Zurcher
rte de Cully 29
1091 Grandvaux
+41 (0) 79 599 84 27
>From 5e75a61605c65181aa7505837f3f9104102e78b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= <[email protected]>
Date: Sat, 24 Oct 2009 09:55:56 +0200
Subject: [PATCH] PatternEditorInstrument popup menu fill every
---
.../PatternEditor/PatternEditorInstrumentList.cpp | 20 +++++++++++++++++---
.../PatternEditor/PatternEditorInstrumentList.h | 9 ++++++++-
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/gui/src/PatternEditor/PatternEditorInstrumentList.cpp
b/gui/src/PatternEditor/PatternEditorInstrumentList.cpp
index 3dc8b31..3176c8e 100644
--- a/gui/src/PatternEditor/PatternEditorInstrumentList.cpp
+++ b/gui/src/PatternEditor/PatternEditorInstrumentList.cpp
@@ -91,7 +91,14 @@ InstrumentLine::InstrumentLine(QWidget* pParent)
// Popup menu
m_pFunctionPopup = new QMenu( this );
m_pFunctionPopup->addAction( trUtf8( "Clear notes" ), this, SLOT(
functionClearNotes() ) );
- m_pFunctionPopup->addAction( trUtf8( "Fill notes" ), this, SLOT(
functionFillNotes() ) );
+ m_pFunctionPopupSub = new QMenu( trUtf8( "Fill notes ..." ),
m_pFunctionPopup );
+ m_pFunctionPopupSub->addAction( trUtf8( "Fill all notes" ), this, SLOT(
functionFillAllNotes() ) );
+ m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/2 notes" ), this, SLOT(
functionFillEveryTwoNotes() ) );
+ m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/3 notes" ), this, SLOT(
functionFillEveryThreeNotes() ) );
+ m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/4 notes" ), this, SLOT(
functionFillEveryFourNotes() ) );
+ m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/6 notes" ), this, SLOT(
functionFillEverySixNotes() ) );
+ m_pFunctionPopupSub->addAction( trUtf8( "Fill 1/8 notes" ), this, SLOT(
functionFillEveryEightNotes() ) );
+ m_pFunctionPopup->addMenu( m_pFunctionPopupSub );
m_pFunctionPopup->addAction( trUtf8( "Randomize velocity" ), this,
SLOT( functionRandomizeVelocity() ) );
m_pFunctionPopup->addSeparator();
m_pFunctionPopup->addAction( trUtf8( "Delete instrument" ), this, SLOT(
functionDeleteInstrument() ) );
@@ -239,7 +246,14 @@ void InstrumentLine::functionClearNotes()
-void InstrumentLine::functionFillNotes()
+void InstrumentLine::functionFillAllNotes(){ functionFillNotes(1); }
+void InstrumentLine::functionFillEveryTwoNotes(){ functionFillNotes(2); }
+void InstrumentLine::functionFillEveryThreeNotes(){ functionFillNotes(3); }
+void InstrumentLine::functionFillEveryFourNotes(){ functionFillNotes(4); }
+void InstrumentLine::functionFillEverySixNotes(){ functionFillNotes(6); }
+void InstrumentLine::functionFillEveryEightNotes(){ functionFillNotes(8); }
+
+void InstrumentLine::functionFillNotes( int every )
{
Hydrogen *pEngine = Hydrogen::get_instance();
@@ -258,7 +272,7 @@ void InstrumentLine::functionFillNotes()
else {
nBase = 4;
}
- int nResolution = 4 * MAX_NOTES / ( nBase *
pPatternEditor->getResolution() );
+ int nResolution = 4 * MAX_NOTES * every / ( nBase *
pPatternEditor->getResolution() );
AudioEngine::get_instance()->lock( RIGHT_HERE ); // lock the
audio engine
diff --git a/gui/src/PatternEditor/PatternEditorInstrumentList.h
b/gui/src/PatternEditor/PatternEditorInstrumentList.h
index a563e65..e4ea1cd 100644
--- a/gui/src/PatternEditor/PatternEditorInstrumentList.h
+++ b/gui/src/PatternEditor/PatternEditorInstrumentList.h
@@ -56,7 +56,13 @@ class InstrumentLine : public PixmapWidget
private slots:
void functionClearNotes();
- void functionFillNotes();
+ void functionFillAllNotes();
+ void functionFillEveryTwoNotes();
+ void functionFillEveryThreeNotes();
+ void functionFillEveryFourNotes();
+ void functionFillEverySixNotes();
+ void functionFillEveryEightNotes();
+ void functionFillNotes( int every );
void functionRandomizeVelocity();
void functionDeleteInstrument();
void muteClicked();
@@ -65,6 +71,7 @@ class InstrumentLine : public PixmapWidget
private:
QMenu *m_pFunctionPopup;
+ QMenu *m_pFunctionPopupSub;
QLabel *m_pNameLbl;
bool m_bIsSelected;
int m_nInstrumentNumber; ///< The related instrument
number
--
1.6.5.1
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Hydrogen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel