src/codeandchords/ModuleMenu.java
public void addRangeSegments(int xVal, int yVal, int numSegments, int defaultNumSegments, String label, String tabName)
	{
		if(defaultNumSegments > numSegments) {
			throw new IllegalArgumentException("ModuleTemplate.addRangeSegments: defaultNumSegments " + defaultNumSegments + " is greater than total segments, " + numSegments);
		}
		/*
		this.totalRangeSegments	= numSegments;
		System.out.println("just set totalRangeSegments to " + this.totalRangeSegments);
		this.curRangeSegments	= defaultNumSegments;
		 */
		float	toggleSpace	= (this.sidebarWidth) - this.leftAlign - this.rightEdgeSpacer /*(this.labelX) - this.labelWidth - this.spacer */;
		int		toggleWidth	= (int)(toggleSpace / numSegments) - this.spacer;

		int[]	xVals	= new int[numSegments];
		for(int i = 0; i < xVals.length; i++)
		{
			xVals[i]	= xVal + (this.leftAlign + (i * (toggleWidth + spacer)));
		}

		this.controlP5.addLabel("rangeSegments")
		.setPosition(xVal + this.labelX, yVal)
		.setValue(label)
		.moveTo(tabName);

		this.firstRangeSegmentsId	= this.nextToggleId;

		for(int i = 0; i < numSegments; i++)
		{
			this.controlP5.addToggle("toggle" + this.nextToggleId)
			.setPosition(xVals[i], yVal)
			.setWidth(toggleWidth)
			.setLabel((i + 1) + "")
			.moveTo(tabName)
			.setId(this.nextToggleId)
			.setInternalValue(i + 1);
			this.controlP5.getController("toggle" + this.nextToggleId).getCaptionLabel().align(ControlP5.CENTER, ControlP5.CENTER);


			if(i == (this.curRangeSegments - 1))
			{
				((Toggle) this.controlP5.getController("toggle" + this.nextToggleId)).setState(true);
			}

			this.nextToggleId	= this.nextToggleId + 1;
		} // for - adding Toggles
	}
/**
	 * Adds the Buttons for selecting the number of range segments.
	 * 
	 * @param yVal	y value for the row of Buttons
	 * @param numSegments	total number of range segments
	 * @param defaultNumSegments	number of segments that are set as current at the beginning
	 * @param label	text to display on the label at the beginning of the row
	 * @param tabName	String indicating to which Tab this group of Controllers should be added
	 * 					(for no Tab, use "default")
	 */
Adds the Buttons for selecting the number of range segments.


Adds the Buttons for selecting the number of range segments .
public void addRangeSegments(int xVal, int yVal, int numSegments, int defaultNumSegments, String label, String tabName)
	{
		if(defaultNumSegments > numSegments) {
			throw new IllegalArgumentException("ModuleTemplate.addRangeSegments: defaultNumSegments " + defaultNumSegments + " is greater than total segments, " + numSegments);
		}
		/*
		this.totalRangeSegments	= numSegments;
		System.out.println("just set totalRangeSegments to " + this.totalRangeSegments);
		this.curRangeSegments	= defaultNumSegments;
		 */
		float	toggleSpace	= (this.sidebarWidth) - this.leftAlign - this.rightEdgeSpacer /*(this.labelX) - this.labelWidth - this.spacer */;
		int		toggleWidth	= (int)(toggleSpace / numSegments) - this.spacer;
		int[]	xVals	= new int[numSegments];
		for(int i = 0; i < xVals.length; i++)
		{
			xVals[i]	= xVal + (this.leftAlign + (i * (toggleWidth + spacer)));
		}
		this.controlP5.addLabel("rangeSegments")
		.setPosition(xVal + this.labelX, yVal)
		.setValue(label)
		.moveTo(tabName);
		this.firstRangeSegmentsId	= this.nextToggleId;
		for(int i = 0; i < numSegments; i++)
		{
			this.controlP5.addToggle("toggle" + this.nextToggleId)
			.setPosition(xVals[i], yVal)
			.setWidth(toggleWidth)
			.setLabel((i + 1) + "")
			.moveTo(tabName)
			.setId(this.nextToggleId)
			.setInternalValue(i + 1);
			this.controlP5.getController("toggle" + this.nextToggleId).getCaptionLabel().align(ControlP5.CENTER, ControlP5.CENTER);
			if(i == (this.curRangeSegments - 1))
			{
				((Toggle) this.controlP5.getController("toggle" + this.nextToggleId)).setState(true);
			}
			this.nextToggleId	= this.nextToggleId + 1;
		} 
	}
public void addRangeSegments ( int xVal , int yVal , int numSegments , int defaultNumSegments , String label , String tabName ) { if ( defaultNumSegments > numSegments ) { throw new IllegalArgumentException ( "ModuleTemplate.addRangeSegments: defaultNumSegments " + defaultNumSegments + " is greater than total segments, " + numSegments ) ; } /*
		this.totalRangeSegments	= numSegments;
		System.out.println("just set totalRangeSegments to " + this.totalRangeSegments);
		this.curRangeSegments	= defaultNumSegments;
		 */ float toggleSpace = ( this . sidebarWidth ) - this . leftAlign - this . rightEdgeSpacer /*(this.labelX) - this.labelWidth - this.spacer */ ; int toggleWidth = ( int ) ( toggleSpace / numSegments ) - this . spacer ; int [ ] xVals = new int [ numSegments ] ; for ( int i = 0 ; i < xVals . length ; i ++ ) { xVals [ i ] = xVal + ( this . leftAlign + ( i * ( toggleWidth + spacer ) ) ) ; } this . controlP5 . addLabel ( "rangeSegments" ) . setPosition ( xVal + this . labelX , yVal ) . setValue ( label ) . moveTo ( tabName ) ; this . firstRangeSegmentsId = this . nextToggleId ; for ( int i = 0 ; i < numSegments ; i ++ ) { this . controlP5 . addToggle ( "toggle" + this . nextToggleId ) . setPosition ( xVals [ i ] , yVal ) . setWidth ( toggleWidth ) . setLabel ( ( i + 1 ) + "" ) . moveTo ( tabName ) . setId ( this . nextToggleId ) . setInternalValue ( i + 1 ) ; this . controlP5 . getController ( "toggle" + this . nextToggleId ) . getCaptionLabel ( ) . align ( ControlP5 . CENTER , ControlP5 . CENTER ) ; if ( i == ( this . curRangeSegments - 1 ) ) { ( ( Toggle ) this . controlP5 . getController ( "toggle" + this . nextToggleId ) ) . setState ( true ) ; } this . nextToggleId = this . nextToggleId + 1 ; } }
Adds the Buttons for selecting the number of range segments.
Adds the Buttons for selecting the number of range segments .
// for - adding Toggles