Skip to content

Commit

Permalink
SongEditorPanel::revert/addEmptyPattern rename patternPosition into i…
Browse files Browse the repository at this point in the history
…dx, it's a [0;x] index

git-svn-id: http://svn.assembla.com/svn/hydrogen/trunk@2294 3b3fb362-3133-0410-aa15-cf69e0a59cb7
  • Loading branch information
jeremyz committed Jul 21, 2011
1 parent bf74654 commit 219c1d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/gui/src/SongEditor/SongEditorPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,23 +372,23 @@ void SongEditorPanel::newPatBtnClicked( Button* btn )
}


void SongEditorPanel::addEmptyPattern( QString newPatternName , QString newPatternCategory, int patternPosition )
void SongEditorPanel::addEmptyPattern( QString newPatternName , QString newPatternCategory, int idx )
{
Hydrogen *engine = Hydrogen::get_instance();
Song *song = engine->getSong();
PatternList *patternList = song->get_pattern_list();
patternList->insert( patternPosition, new Pattern( newPatternName, newPatternCategory ) );
patternList->insert( idx, new Pattern( newPatternName, newPatternCategory ) );
song->__is_modified = true;
updateAll();
}

void SongEditorPanel::revertaddEmptyPattern( int patternPosition )
void SongEditorPanel::revertaddEmptyPattern( int idx )
{
Hydrogen *engine = Hydrogen::get_instance();
Song *song = engine->getSong();
PatternList *patternList = song->get_pattern_list();
H2Core::Pattern *pattern = patternList->get( patternPosition );
if( patternPosition == engine->getSelectedPatternNumber() ) engine->setSelectedPatternNumber( patternPosition -1 );
H2Core::Pattern *pattern = patternList->get( idx );
if( idx == engine->getSelectedPatternNumber() ) engine->setSelectedPatternNumber( idx -1 );
patternList->del( pattern );
delete pattern;
song->__is_modified = true;
Expand Down
6 changes: 4 additions & 2 deletions src/gui/src/SongEditor/SongEditorPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ class SongEditorPanel : public QWidget, public EventListener, public H2Core::Obj
virtual void selectedPatternChangedEvent();
void restoreGroupVector( QString filename );
//~ Implements EventListener interface
void addEmptyPattern( QString newPatternName , QString newPatternCategory, int patternPosition );
void revertaddEmptyPattern( int patternPosition );
///< an empty new pattern will be added to pattern list at idx
void addEmptyPattern( QString newPatternName , QString newPatternCategory, int idx );
///< pattern at idx within pattern list will be destroyed
void revertaddEmptyPattern( int idx );

private slots:
void on_patternListScroll();
Expand Down

0 comments on commit 219c1d8

Please sign in to comment.