• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java TGString类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.herac.tuxguitar.song.models.TGString的典型用法代码示例。如果您正苦于以下问题:Java TGString类的具体用法?Java TGString怎么用?Java TGString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

TGString类属于org.herac.tuxguitar.song.models包,在下文中一共展示了TGString类的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: paintTurning

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private void paintTurning(TGPainter target, float x, float y) {
    TGCaret caret = TGSongViewController.getInstance(controller.getContext()).getCaret();
    TGTrack track = caret.getTrack();
    List<TGString> strings = track.getStrings();

    String key = "";
    if (isStandKey(strings)) {
        key = "标准调弦";
    } else {
        key = praseStrings(strings);
    }

    if (track.getOffset() != 0) {
        key = "capo=" + track.getOffset() + "\n" + key;
    }

    for (String line : key.split("\n")) {
        target.drawString(line, x, y);
        y += target.getFMHeight() + 8;
    }
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:22,
代码来源:TGSongViewTitlePainter.java

示例2: isStandKey

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private boolean isStandKey(List<TGString> strings) {
    int pos = 1;
    int diff = Integer.MAX_VALUE;

    for (TGString string : strings) {
        int i = string.getValue();
        if (pos <= STANDARD_KEY.length) {
            if (diff == Integer.MAX_VALUE) {
                diff = i - STANDARD_KEY[pos - 1];
            } else {
                if (diff != i - STANDARD_KEY[pos - 1]) {
                    return false;
                }
            }
        }
        pos++;
    }

    return diff >= 0;
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:21,
代码来源:TGSongViewTitlePainter.java

示例3: select

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
public boolean select(float x, float y) {
	if( x >= 0 && y >= 0 ){
		TGTrackImpl track = findSelectedTrack(y);
		if (track != null) {
			TGMeasureImpl measure = findSelectedMeasure(track, x, y);
			if (measure != null) {
				TGBeat beat = findSelectedBeat(measure, x);
				if (beat != null) {
					TGString string = findSelectedString(measure, y);
					if( string == null ){
						string = this.controller.getCaret().getSelectedString();
					}
					
					this.callMoveTo(track, measure, beat, string);
					
					return true;
				}
			}
		}
	}
	return false;
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:23,
代码来源:TGSongViewAxisSelector.java

示例4: findSelectedString

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private TGString findSelectedString(TGMeasureImpl measure, float y) {
	TGString string = null;
	float stringSpacing = this.controller.getLayout().getStringSpacing();
	float minorDistance = 0;
	float firstStringY = measure.getPosY() + measure.getTs().getPosition(TGTrackSpacing.POSITION_TABLATURE);
	
	Iterator<?> it = measure.getTrack().getStrings().iterator();
	while(it.hasNext()){
		TGString currString = (TGString)it.next();
		float distanceX = Math.abs(y - (firstStringY + ((currString.getNumber() * stringSpacing) - stringSpacing)));
		if(string == null || distanceX < minorDistance){
			string = currString;
			minorDistance = distanceX;
		}
	}
	
	return string;
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:19,
代码来源:TGSongViewAxisSelector.java

示例5: findCurrentState

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private SelectionState findCurrentState() {
	TGCaret caret = getCaret();
	
	SelectionState state = new SelectionState();
	state.setTrack(caret.getTrack().getNumber());
	state.setPosition(caret.getPosition());
	state.setVelocity(caret.getVelocity());
	state.setDuration(caret.getDuration().clone(getSongManager().getFactory()));
	state.setString(1);
	TGString instrumentString = caret.getSelectedString();
	if(instrumentString != null){
		state.setString(instrumentString.getNumber());
	}
	
	return state;
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:17,
代码来源:TGUndoableCaretState.java

示例6: update

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
@Override
public void update(final TGContext context, TGActionContext actionContext) {
	if( Boolean.TRUE.equals( actionContext.getAttribute(TGActionBase.ATTRIBUTE_SUCCESS)) ) {
		final TGMeasureHeader header = (TGMeasureHeader) actionContext.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_HEADER);
		final TGString tgString = (TGString) actionContext.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_STRING);
		
		if( header != null ) {
			this.findUpdateBuffer(context).requestUpdateMeasure(header.getNumber());
		}
		
		this.findUpdateBuffer(context).doPostUpdate(new Runnable() {
			public void run() {
				TGCaret tgCaret = TGSongViewController.getInstance(context).getCaret();
				tgCaret.setStringNumber(tgString.getNumber());
			}
		});
	}
	
	// Call super update.
	super.update(context, actionContext);
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:22,
代码来源:TGUpdateShiftedNoteController.java

示例7: writeTrack

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private void writeTrack(TGTrack track) throws IOException {
	GMChannelRoute channel = getChannelRoute(track.getChannelId());
	
	int flags = 0;
	if (isPercussionChannel(track.getSong(),track.getChannelId())) {
		flags |= 0x01;
	}
	writeUnsignedByte(flags);
	writeStringByte(track.getName(), 40);
	writeInt(track.getStrings().size());
	for (int i = 0; i < 7; i++) {
		int value = 0;
		if (track.getStrings().size() > i) {
			TGString string = (TGString) track.getStrings().get(i);
			value = string.getValue();
		}
		writeInt(value);
	}
	writeInt(1);
	writeInt(channel.getChannel1() + 1);
	writeInt(channel.getChannel2() + 1);
	writeInt(24);
	writeInt(Math.min(Math.max(track.getOffset(),0),12));
	writeColor(track.getColor());
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:26,
代码来源:GP4OutputStream.java

示例8: createTrack

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private void createTrack(TGTrack track) throws IOException {
	GMChannelRoute channel = getChannelRoute(track.getChannelId());
	
	int flags = 0;
	if (isPercussionChannel(track.getSong(),track.getChannelId())) {
		flags |= 0x01;
	}
	writeUnsignedByte(flags);
	
	writeStringByte(track.getName(), 40);
	writeInt(track.getStrings().size());
	for (int i = 0; i < 7; i++) {
		int value = 0;
		if (track.getStrings().size() > i) {
			TGString string = (TGString) track.getStrings().get(i);
			value = string.getValue();
		}
		writeInt(value);
	}
	writeInt(1);
	writeInt(channel.getChannel1() + 1);
	writeInt(channel.getChannel2() + 1);
	writeInt(24);
	writeInt(Math.min(Math.max(track.getOffset(),0),12));
	writeColor(track.getColor());
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:27,
代码来源:GP3OutputStream.java

示例9: readTrack

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private TGTrack readTrack(TGSong song, int number, List<TGChannel> channels) throws IOException {
	TGTrack track = getFactory().newTrack();
	track.setNumber(number);
	readUnsignedByte();
	track.setName(readStringByte(40));
	int stringCount = readInt();
	for (int i = 0; i < 7; i++) {
		int tuning = readInt();
		if (stringCount > i) {
			TGString string = getFactory().newString();
			string.setNumber(i + 1);
			string.setValue(tuning);
			track.getStrings().add(string);
		}
	}
	readInt();
	readChannel(song, track,channels);
	readInt();
	track.setOffset(readInt());
	readColor(track.getColor());
	return track;
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:23,
代码来源:GP3InputStream.java

示例10: readTrack

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private TGTrack readTrack(TGSong song, int number, List<TGChannel> channels,TGLyric lyrics) throws IOException {
	TGTrack track = getFactory().newTrack();
	track.setNumber(number);
	track.setLyrics(lyrics);
	readUnsignedByte();
	track.setName(readStringByte(40));
	int stringCount = readInt();
	for (int i = 0; i < 7; i++) {
		int tuning = readInt();
		if (stringCount > i) {
			TGString string = getFactory().newString();
			string.setNumber(i + 1);
			string.setValue(tuning);
			track.getStrings().add(string);
		}
	}
	readInt();
	readChannel(song, track, channels);
	readInt();
	track.setOffset(readInt());
	readColor(track.getColor());
	return track;
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:24,
代码来源:GP4InputStream.java

示例11: processAction

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
protected void processAction(TGActionContext context){
	Long start = (Long) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_POSITION);
	Integer fret = (Integer) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_FRET);
	Integer velocity = (Integer) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_VELOCITY);
	TGDuration duration = (TGDuration) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_DURATION);
	TGVoice voice = ((TGVoice) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_VOICE));
	TGMeasure measure = (TGMeasure) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_MEASURE);
	TGString string = (TGString) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_STRING);
	TGSongManager songManager = getSongManager(context);
	
	if( measure != null && fret >= 0 ) {
		this.addNote(songManager, measure, voice, duration, string, start, fret, velocity);
		
		context.setAttribute(ATTRIBUTE_SUCCESS, Boolean.TRUE);
	}
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:17,
代码来源:TGChangeNoteAction.java

示例12: processAction

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
protected void processAction(TGActionContext context){
	TGSongManager songManager = getSongManager(context);
	TGBeat beat = ((TGBeat) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_BEAT));
	TGVoice voice = ((TGVoice) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_VOICE));
	TGMeasure measure = ((TGMeasure) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_MEASURE));
	TGString string = ((TGString) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_STRING));
	
	if( beat.isTextBeat() && beat.isRestBeat() ){
		songManager.getMeasureManager().removeText(beat);
	} 
	else if( voice.isRestVoice() ){
		songManager.getMeasureManager().removeVoice(voice, true);
	}
	else {
		songManager.getMeasureManager().removeNote(measure, beat.getStart(), voice.getIndex(), string.getNumber());
	}
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:18,
代码来源:TGDeleteNoteOrRestAction.java

示例13: processAction

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void processAction(TGActionContext context){
	TGTrack track = ((TGTrack) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_TRACK));
	List<TGString> strings = ((List<TGString>) context.getAttribute(ATTRIBUTE_STRINGS));
	if( track != null && strings != null ){
		int[] transpositions = createTranspositions(track, strings);
		
		TGSongManager tgSongManager = getSongManager(context);
		tgSongManager.getTrackManager().changeInstrumentStrings(track, strings);
		
		Boolean transposeStrings = Boolean.TRUE.equals(context.getAttribute(ATTRIBUTE_TRANSPOSE_STRINGS));
		if( Boolean.TRUE.equals(transposeStrings) ){
			boolean transposeTryKeepString = Boolean.TRUE.equals(context.getAttribute(ATTRIBUTE_TRANSPOSE_TRY_KEEP_STRINGS));
			boolean transposeApplyToChords = Boolean.TRUE.equals(context.getAttribute(ATTRIBUTE_TRANSPOSE_APPLY_TO_CHORDS));
			
			tgSongManager.getTrackManager().transposeNotes(track, transpositions, transposeTryKeepString, transposeApplyToChords );
		}
	}
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:20,
代码来源:TGChangeTrackTuningAction.java

示例14: processAction

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
protected void processAction(TGActionContext context){
	TGSongManager songManager = getSongManager(context);
	TGMeasure measure = ((TGMeasure) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_MEASURE));
	TGBeat beat = ((TGBeat) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_BEAT));
	TGVoice voice = ((TGVoice) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_VOICE));
	TGNote note = ((TGNote) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_NOTE));
	TGDuration duration = ((TGDuration) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_DURATION));
	TGString string = ((TGString) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_STRING));
	int velocity = ((Integer) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_VELOCITY)).intValue();
	
	if( note == null ){
		note = songManager.getFactory().newNote();
		note.setValue(0);
		note.setVelocity(velocity);
		note.setString(string.getNumber());
		
		TGDuration noteDuration = duration.clone(songManager.getFactory());
					
		songManager.getMeasureManager().addNote(measure, beat.getStart(), note, noteDuration, voice.getIndex());
	}
	songManager.getMeasureManager().changeDeadNote(note);
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:23,
代码来源:TGChangeDeadNoteAction.java

示例15: getStringFor

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private TGString getStringFor(TGBeat tgBeat, int value ){
	List<TGString> strings = tgBeat.getMeasure().getTrack().getStrings();
	for(int i = 0;i < strings.size();i ++){
		TGString string = (TGString)strings.get(i);
		if(value >= string.getValue()){
			boolean emptyString = true;
			
			for(int v = 0; v < tgBeat.countVoices(); v ++){
				TGVoice voice = tgBeat.getVoice( v );
				Iterator<TGNote> it = voice.getNotes().iterator();
				while (it.hasNext()) {
					TGNoteImpl note = (TGNoteImpl) it.next();
					if (note.getString() == string.getNumber()) {
						emptyString = false;
						break;
					}
				}
			}
			if(emptyString){
				return string;
			}
		}
	}
	return null;
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:26,
代码来源:GPXDocumentParser.java

示例16: createStrings

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
public List<TGString> createStrings(int stringCount, int[][] defaultTunings){
	List<TGString> strings = new ArrayList<TGString>();
	if( defaultTunings != null ) {
		for(int i = 0; i < defaultTunings.length ; i++) {
			if( stringCount == defaultTunings[i].length ) {
				for(int n = 0; n < defaultTunings[i].length ; n ++) {
					strings.add(newString(getFactory(),(n + 1), defaultTunings[i][n]));
				}
				break;
			}
		}
	}
	if( strings.isEmpty() ) {
		for(int i = 1;i <= stringCount; i++){
			strings.add(newString(getFactory(),i, 0));
		}
	}
	return strings;
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:20,
代码来源:TGSongManager.java

示例17: shiftNote

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
/**
 * Mueve la nota a la siguiente cuerda
 */
private int shiftNote(TGMeasure measure,long start,int string,int move){
	TGNote note = getNote(measure,start,string);
	if(note != null){
		int nextStringNumber = (note.getString() + move);
		while(getNote(measure,start,nextStringNumber) != null){
			nextStringNumber += move;
		}
		if(nextStringNumber >= 1 && nextStringNumber <= measure.getTrack().stringCount()){
			TGString currentString = measure.getTrack().getString(note.getString());
			TGString nextString = measure.getTrack().getString(nextStringNumber);
			int noteValue = (note.getValue() + currentString.getValue());
			boolean percussionChannel = getSongManager().isPercussionChannel(measure.getTrack().getSong(), measure.getTrack().getChannelId());
			if(noteValue >= nextString.getValue() && ((nextString.getValue() + 30 > noteValue) || percussionChannel) ){
				note.setValue(noteValue - nextString.getValue());
				note.setString(nextString.getNumber());
				return note.getString();
			}
		}
	}
	return 0;
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:25,
代码来源:TGMeasureManager.java

示例18: getSortedStringsByValue

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
public List<TGString> getSortedStringsByValue( TGTrack track , final int direction ){
	List<TGString> strings = new ArrayList<TGString>();
	for( int number = 1 ; number <= track.stringCount() ; number ++ ){
		strings.add( track.getString( number ) );
	}
	
	Collections.sort( strings , new Comparator<TGString>() {
		public int compare(TGString s1, TGString s2) {
			if( s1 != null && s2 != null ){
				int status = ( s1.getValue() - s2.getValue() );
				if( status == 0 ){
					return 0;
				}
				return ( (status * direction) > 0 ? 1 : -1 );
			}
			return 0;
		}
	});
	
	return strings;
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:22,
代码来源:TGMeasureManager.java

示例19: setTrackInfo

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private void setTrackInfo(TGSong tgSong, TGTrack tgTrack , PTTrackInfo info){
	TGChannel tgChannel = this.manager.addChannel(tgSong);
	tgChannel.setProgram((short) info.getInstrument() );
	tgChannel.setVolume((short) info.getVolume() );
	tgChannel.setBalance((short) info.getBalance() );
	tgChannel.setName(this.manager.createChannelNameFromProgram(tgSong, tgChannel));
	
	tgTrack.setName( info.getName() );
	tgTrack.setChannelId(tgChannel.getChannelId());
	tgTrack.getStrings().clear();
	for(int i = 0; i < info.getStrings().length; i ++){
		TGString string = this.manager.getFactory().newString();
		string.setNumber( (i + 1) );
		string.setValue( info.getStrings()[i] );
		tgTrack.getStrings().add(string);
	}
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:18,
代码来源:PTSongParser.java

示例20: getSortedStringsByValue

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
public List getSortedStringsByValue( TGTrack track , final int direction ){
	List strings = new ArrayList();
	for( int number = 1 ; number <= track.stringCount() ; number ++ ){
		strings.add( track.getString( number ) );
	}
	
	Collections.sort( strings , new Comparator() {
		public int compare(Object o1, Object o2) {
			if( o1 != null && o2 != null && o1 instanceof TGString && o2 instanceof TGString ){
				TGString s1 = (TGString)o1;
				TGString s2 = (TGString)o2;
				int status = ( s1.getValue() - s2.getValue() );
				if( status == 0 ){
					return 0;
				}
				return ( (status * direction) > 0 ? 1 : -1 );
			}
			return 0;
		}
	});
	
	return strings;
}
 

开发者ID:lathspell,
项目名称:dtx2gp,
代码行数:24,
代码来源:TGMeasureManager.java

示例21: readTrack

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private TGTrack readTrack(int number, List channels,TGLyric lyrics) throws IOException {
	TGTrack track = getFactory().newTrack();
	track.setNumber(number);
	track.setLyrics(lyrics);
	readUnsignedByte();
	track.setName(readStringByte(40));
	int stringCount = readInt();
	for (int i = 0; i < 7; i++) {
		int tuning = readInt();
		if (stringCount > i) {
			TGString string = getFactory().newString();
			string.setNumber(i + 1);
			string.setValue(tuning);
			track.getStrings().add(string);
		}
	}
	readInt();
	readChannel(track.getChannel(), channels);
	readInt();
	track.setOffset(readInt());
	readColor(track.getColor());
	return track;
}
 

开发者ID:lathspell,
项目名称:dtx2gp,
代码行数:24,
代码来源:GP4InputStream.java

示例22: writeTrack

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private void writeTrack(TGTrack track) throws IOException {
	int flags = 0;
	if (track.isPercussionTrack()) {
		flags |= 0x01;
	}
	writeUnsignedByte(flags);
	writeByte((byte)8);
	writeStringByte(track.getName(), 40);
	writeInt(track.getStrings().size());
	for (int i = 0; i < 7; i++) {
		int value = 0;
		if (track.getStrings().size() > i) {
			TGString string = (TGString) track.getStrings().get(i);
			value = string.getValue();
		}
		writeInt(value);
	}
	writeInt(1);
	writeInt(track.getChannel().getChannel() + 1);
	writeInt(track.getChannel().getEffectChannel() + 1);
	writeInt(24);
	writeInt(track.getOffset());
	writeColor(track.getColor());
	writeBytes(new byte[]{ 67, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1});
}
 

开发者ID:lathspell,
项目名称:dtx2gp,
代码行数:26,
代码来源:GP5OutputStream.java

示例23: hasTuningChanges

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
protected boolean hasTuningChanges(TGTrack track, List<TGString> newStrings){
	List<TGString> oldStrings = track.getStrings();
	//check the number of strings
	if(oldStrings.size() != newStrings.size()){
		return true;
	}
	//check the tuning of strings
	for(int i = 0;i < oldStrings.size();i++){
		TGString oldString = (TGString)oldStrings.get(i);
		boolean stringExists = false;
		for(int j = 0;j < newStrings.size();j++){
			TGString newString = (TGString)newStrings.get(j);
			if(newString.isEqual(oldString)){
				stringExists = true;
			}
		}
		if(!stringExists){
			return true;
		}
	}
	return false;
}
 

开发者ID:theokyr,
项目名称:TuxGuitar-1.3.1-fork,
代码行数:23,
代码来源:TGTrackPropertiesDialog.java

示例24: updateTuningGroup

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
protected void updateTuningGroup(boolean enabled) {
	for (int i = 0; i < this.tempStrings.size(); i++) {
		TGString string = (TGString)this.tempStrings.get(i);
		this.stringCombos[i].select(string.getValue());
		this.stringCombos[i].setVisible(true);
		this.stringCombos[i].setEnabled(enabled);
	}
	
	for (int i = this.tempStrings.size(); i < MAX_STRINGS; i++) {
		this.stringCombos[i].select(0);
		this.stringCombos[i].setVisible(false);
	}
	this.offsetCombo.setEnabled(enabled);
	this.stringTransposition.setEnabled(enabled);
	this.stringTranspositionApplyToChords.setEnabled(enabled && this.stringTransposition.getSelection());
	this.stringTranspositionTryKeepString.setEnabled(enabled && this.stringTransposition.getSelection());
}
 

开发者ID:theokyr,
项目名称:TuxGuitar-1.3.1-fork,
代码行数:18,
代码来源:TGTrackPropertiesDialog.java

示例25: findSelectedString

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private TGString findSelectedString(TGMeasureImpl measure, float y) {
	TGString string = null;
	float stringSpacing = getTablature().getViewLayout().getStringSpacing();
	float minorDistance = 0;
	float firstStringY = measure.getPosY() + measure.getTs().getPosition(TGTrackSpacing.POSITION_TABLATURE);
	
	Iterator<TGString> it = measure.getTrack().getStrings().iterator();
	while(it.hasNext()){
		TGString currString = (TGString)it.next();
		float distanceX = Math.abs(y - (firstStringY + ((currString.getNumber() * stringSpacing) - stringSpacing)));
		if(string == null || distanceX < minorDistance){
			string = currString;
			minorDistance = distanceX;
		}
	}
	
	return string;
}
 

开发者ID:theokyr,
项目名称:TuxGuitar-1.3.1-fork,
代码行数:19,
代码来源:EditorKit.java

示例26: fillCreateNoteContext

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
public boolean fillCreateNoteContext(TGAbstractContext targetContext) {		
	TGVoiceImpl voice = targetContext.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_VOICE);
	Integer value = targetContext.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_VALUE);
	int x = targetContext.getAttribute(ATTRIBUTE_X);
	long start = getRealStart(voice, x);
	
	Caret caret = this.getTablature().getCaret();
	TGTrack track = caret.getTrack();
	TGString string = findBestString(track, voice, value);
	if( string != null ){
		targetContext.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_POSITION, start);
		targetContext.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_FRET, (value - string.getValue()));
		targetContext.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_VOICE, voice);
		targetContext.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_STRING, string);
		targetContext.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_BEAT, voice.getBeat());
		
		return true;
	}
	return false;
}
 

开发者ID:theokyr,
项目名称:TuxGuitar-1.3.1-fork,
代码行数:21,
代码来源:EditorKit.java

示例27: findCurrentState

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private SelectionState findCurrentState() {
	Caret caret = getCaret();
	
	SelectionState state = new SelectionState();
	state.setTrack(caret.getTrack().getNumber());
	state.setPosition(caret.getPosition());
	state.setVelocity(caret.getVelocity());
	state.setDuration(caret.getDuration().clone(getSongManager().getFactory()));
	state.setString(1);
	TGString instrumentString = caret.getSelectedString();
	if(instrumentString != null){
		state.setString(instrumentString.getNumber());
	}
	
	return state;
}
 

开发者ID:theokyr,
项目名称:TuxGuitar-1.3.1-fork,
代码行数:17,
代码来源:TGUndoableCaretState.java

示例28: update

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
@Override
public void update(final TGContext context, TGActionContext actionContext) {
	if( Boolean.TRUE.equals( actionContext.getAttribute(TGActionBase.ATTRIBUTE_SUCCESS)) ) {
		final TGMeasureHeader header = (TGMeasureHeader) actionContext.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_HEADER);
		final TGString tgString = (TGString) actionContext.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_STRING);
		
		if( header != null ) {
			this.findUpdateBuffer(context, actionContext).requestUpdateMeasure(header.getNumber());
		}
		
		this.findUpdateBuffer(context, actionContext).doPostUpdate(new Runnable() {
			public void run() {
				Caret caret = TuxGuitar.getInstance().getTablatureEditor().getTablature().getCaret();
				caret.setStringNumber(tgString.getNumber());
			}
		});
	}
	
	// Call super update.
	super.update(context, actionContext);
}
 

开发者ID:theokyr,
项目名称:TuxGuitar-1.3.1-fork,
代码行数:22,
代码来源:TGUpdateShiftedNoteController.java

示例29: getLilypondTuning

点赞 3

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
private String getLilypondTuning(TGTrack track){
	String tuning = ("\\with { stringTunings = #`( ");
	Iterator<TGString> strings = track.getStrings().iterator();
	while(strings.hasNext()){
		TGString string = (TGString)strings.next();
		if ( this.settings.getLilypondVersion().compareTo("2.13.46") < 0) {
			tuning += ( (string.getValue() - 60) + " ");
		} else {
			// 2.13.46: Change stringTunings from a list of semitones to a
			// list of pitches (in scheme syntax).  There is the option of 
			// pre-defining a custom tuning as follows instead.
			// \makeStringTuning #'custom-tuning <c' g' d'' a''>
			// TODO: if this is a normal guitar tuning, skip this whole thing
			tuning += ("," + this.getLilypondPitch(string.getValue()) + " ");
		}
	}
	tuning += (") }");
	return tuning;
}
 

开发者ID:theokyr,
项目名称:TuxGuitar-1.3.1-fork,
代码行数:20,
代码来源:LilypondOutputStream.java

示例30: processAction

点赞 2

import org.herac.tuxguitar.song.models.TGString; //导入依赖的package包/类
public void processAction(TGMeasure measure, TGBeat beat, TGString string, TGEffectBend effect) {
	TGActionProcessor tgActionProcessor = new TGActionProcessor(findContext(), TGChangeBendNoteAction.NAME);
	tgActionProcessor.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_MEASURE, measure);
	tgActionProcessor.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_BEAT, beat);
	tgActionProcessor.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_STRING, string);
	tgActionProcessor.setAttribute(TGChangeBendNoteAction.ATTRIBUTE_EFFECT, effect);
	tgActionProcessor.process();
}
 

开发者ID:axlecho,
项目名称:tuxguitar,
代码行数:9,
代码来源:TGBendDialog.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)