Skip to content

Commit

Permalink
Fire: Names of drum pads are now displayed when switching selection i…
Browse files Browse the repository at this point in the history
…n drum mode.

Updated manual.
  • Loading branch information
git-moss committed May 21, 2023
1 parent fdde0f6 commit c5fdd83
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
Binary file modified DrivenByMoss-Manual.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import de.mossgrabers.framework.featuregroup.ModeManager;
import de.mossgrabers.framework.mode.Modes;
import de.mossgrabers.framework.utils.ButtonEvent;
import de.mossgrabers.framework.utils.StringUtils;
import de.mossgrabers.framework.view.sequencer.AbstractDrum4View;

import java.util.Optional;
Expand Down Expand Up @@ -268,9 +269,13 @@ private void adjustPage (final boolean isUp, final int selection)

private void selectDrumPad (final int index)
{
this.primary.getDrumPadBank ().getItem (index).select ();
final IDrumPad item = this.primary.getDrumPadBank ().getItem (index);
item.select ();
final IMode activeMode = this.surface.getModeManager ().getActive ();
if (activeMode instanceof final FireLayerMode fireLayerMode)
fireLayerMode.parametersAdjusted ();

if (item.doesExist ())
this.surface.getDisplay ().notify (StringUtils.limit (item.getName (), 14));
}
}
15 changes: 15 additions & 0 deletions src/main/java/de/mossgrabers/framework/utils/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,21 @@ public static String optimizeName (final String text, final int length)
}


/**
* Limits a text to the given length.
*
* @param text The text to limit
* @param length The length to limit to
* @return The limited text
*/
public static String limit (final String text, final int length)
{
if (text == null)
return "";
return text.length () <= length ? text : text.substring (0, length);
}


/**
* Convert the bytes to a hex string.
*
Expand Down
Binary file modified src/main/resources/Documentation/DrivenByMoss-Manual.pdf
Binary file not shown.

0 comments on commit c5fdd83

Please sign in to comment.