| 866 | } |
| 867 | |
| 868 | void StepSequencer::ButtonClicked(ClickButton* button, double time) |
| 869 | { |
| 870 | if (button == mShiftLeftButton || button == mShiftRightButton) |
| 871 | { |
| 872 | int shift = (button == mShiftRightButton) ? 1 : -1; |
| 873 | |
| 874 | for (int row = 0; row < mGrid->GetRows(); ++row) |
| 875 | { |
| 876 | int start = (shift == 1) ? mGrid->GetCols() - 1 : 0; |
| 877 | int end = (shift == 1) ? 0 : mGrid->GetCols() - 1; |
| 878 | float startVal = mGrid->GetVal(start, row); |
| 879 | for (int col = start; col != end; col -= shift) |
| 880 | mGrid->SetVal(col, row, mGrid->GetVal(col - shift, row)); |
| 881 | mGrid->SetVal(end, row, startVal); |
| 882 | } |
| 883 | } |
| 884 | if (button == mRandomizeButton) |
| 885 | { |
| 886 | for (int row = 0; row < mGrid->GetRows(); ++row) |
| 887 | RandomizeRow(row); |
| 888 | } |
| 889 | for (int row = 0; row < mRandomizeRowButton.size(); ++row) |
| 890 | { |
| 891 | if (button == mRandomizeRowButton[row]) |
| 892 | RandomizeRow(row); |
| 893 | } |
| 894 | if (button == mClearButton) |
| 895 | mGrid->Clear(); |
| 896 | } |
| 897 | |
| 898 | void StepSequencer::DropdownUpdated(DropdownList* list, int oldVal, double time) |
| 899 | { |