Exemple #1
0
/************************************************************************
  FUNCTION
    Returns the left X coordinate relative to track->fx.y for the subtrack
    'subtrack'.
************************************************************************/
int GetRelXSubTrack1(
	const struct WTracks *wtrack,
	int subtrack
){
  int num_subtracks = GetNumSubtracks(wtrack->track);
  return (wtrack->fxwidth*subtrack/num_subtracks) + (subtrack>0 ? 1 : 0 ) ;
}
Exemple #2
0
/************************************************************************
  FUNCTION
    Returns the right X coordinate relative to track->fx.y for the subtrack
    'subtrack'.
************************************************************************/
int GetRelXSubTrack2(
	const struct WTracks *wtrack,
	int subtrack
){
        int num_subtracks = GetNumSubtracks(wtrack->track);
	return
          (wtrack->fxwidth*(subtrack+1)/num_subtracks) -
          (subtrack == num_subtracks-1 ? 0 : 1)
          ;
}
Exemple #3
0
int CursorLeft(struct Tracker_Windows *window,struct WBlocks *wblock){
	if(window->curr_track>0 || (0==window->curr_track && window->curr_track_sub>=0)){

		window->curr_track_sub--;

		if(window->curr_track_sub==-2){
                  do{
                    ATOMIC_INC(window->curr_track, -1);
                    R_ASSERT_RETURN_IF_FALSE2(window->curr_track >= 0, 0);
                    ATOMIC_WRITE(wblock->wtrack, ListFindElement1(&wblock->wtracks->l,window->curr_track));
                  }while(wblock->wtrack==NULL);
                  int num_subtracks = GetNumSubtracks(wblock->wtrack);
                  window->curr_track_sub=num_subtracks-1;
		}

		if(
			window->curr_track<wblock->left_track ||
			(window->curr_track==wblock->left_track && window->curr_track_sub<wblock->left_subtrack)
		){
                        wblock->left_subtrack=-1;//window->curr_track_sub;
			wblock->left_track=window->curr_track;
                        printf("   left_track: %d, left_subtrack: %d. curr_track: %d\n",wblock->left_track, wblock->left_subtrack,window->curr_track);
			//UpdateAllWTracksCoordinates(window,wblock);
                        UpdateWBlockCoordinates(window,wblock);
			return 2;
		}else{
                        printf("   left_track: %d, left_subtrack: %d, curr_track: %d\n",wblock->left_track, wblock->left_subtrack,window->curr_track);
			return 1;
		}
	}else{
                
                if (window->curr_track==TEMPOTRACK)
                  return 0;
                
		ATOMIC_INC(window->curr_track, -1);

                if (window->curr_track==TEMPONODETRACK && window->show_reltempo_track==false)
                  ATOMIC_INC(window->curr_track, -1);

                if (window->curr_track==LINENUMBTRACK)
                  ATOMIC_INC(window->curr_track, -1);

                if (window->curr_track==SIGNATURETRACK && window->show_signature_track==false)
                  ATOMIC_INC(window->curr_track, -1);
                
                if (window->curr_track==LPBTRACK && window->show_lpb_track==false)
                  ATOMIC_INC(window->curr_track, -1);
                
                if (window->curr_track==TEMPOTRACK && window->show_bpm_track==false)
                  set_curr_track_to_leftmost_legal_track(window);

		return 1;
	}
}
Exemple #4
0
/**************************************************************
  FUNCTION
    Returns the subtrack 'x' belongs to in the wtrack 'wtrack'.
    If it doesn't belong to a subtrack. Returns -2;
**************************************************************/
int GetSubTrack(
	const struct WTracks *wtrack,
	int x
){
	int lokke;
        int num_subtracks = GetNumSubtracks(wtrack->track);

	for(lokke= -1;lokke<num_subtracks;lokke++){
		if(x==SubtrackBoundaries(wtrack,lokke,x)) return lokke;
	}

	return -2;
}
Exemple #5
0
bool SetCursorPosConcrete(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
	NInt tracknum,
	int subtrack
){
        struct WTracks *wtrack;
	int ret=0,tempret;

	if(tracknum>=wblock->block->num_tracks || tracknum<TEMPOTRACK) return false;

	if(tracknum<0){
		if(tracknum==window->curr_track) return true;

		if(tracknum>window->curr_track){
			while(window->curr_track!=tracknum){
				tempret=CursorRight(window,wblock);
				ret=R_MAX(tempret,ret);
			}
		}else{
			while(window->curr_track!=tracknum){
				tempret=CursorLeft(window,wblock);
				ret=R_MAX(tempret,ret);
			}
		}
	}else{
		wtrack=ListFindElement1(&wblock->wtracks->l,tracknum);
                int num_subtracks = GetNumSubtracks(wtrack);

		subtrack=R_MIN(num_subtracks-1,subtrack);

		if(tracknum==window->curr_track && subtrack==window->curr_track_sub)
                  return 0;

		if(tracknum>window->curr_track || (tracknum==window->curr_track && subtrack>window->curr_track_sub)){
			while(window->curr_track!=tracknum || window->curr_track_sub!=subtrack){
				tempret=CursorRight(window,wblock);
                                //printf("wtrack->num: %d, curr_track: %d, num_tracks: %d\n",wtrack->l.num, window->curr_track,wblock->block->num_tracks);
				ret=R_MAX(tempret,ret);
			}
		}else{
			while(window->curr_track!=tracknum || window->curr_track_sub!=subtrack){
				tempret=CursorLeft(window,wblock);
				ret=R_MAX(tempret,ret);
			}
		}
	}

	return true;
}
Exemple #6
0
int CursorLeft(struct Tracker_Windows *window,struct WBlocks *wblock){
	struct WTracks *wtrack=wblock->wtrack;

	if(window->curr_track>0 || (0==window->curr_track && window->curr_track_sub>=0)){

		window->curr_track_sub--;

		if(window->curr_track_sub==-2){
			wblock->wtrack=ListFindElement1(&wblock->wtracks->l,wtrack->l.num-1);
                        int num_subtracks = GetNumSubtracks(wblock->wtrack->track);
			window->curr_track_sub=num_subtracks-1;
			window->curr_track--;
		}

		if(
			window->curr_track<wblock->left_track ||
			(window->curr_track==wblock->left_track && window->curr_track_sub<wblock->left_subtrack)
		){
			wblock->left_subtrack=window->curr_track_sub;
			wblock->left_track=window->curr_track;
			UpdateAllWTracksCoordinates(window,wblock);
			return 2;
		}else{
			return 1;
		}
	}else{
                
                if (window->curr_track==TEMPOTRACK)
                  return 0;
                
		window->curr_track--;

                if (window->curr_track==TEMPONODETRACK && window->show_reltempo_track==false)
                  window->curr_track--;

                if (window->curr_track==LINENUMBTRACK)
                  window->curr_track--;

                if (window->curr_track==SIGNATURETRACK && window->show_signature_track==false)
                  window->curr_track--;
                
                if (window->curr_track==LPBTRACK && window->show_lpb_track==false)
                  window->curr_track--;
                
                if (window->curr_track==TEMPOTRACK && window->show_bpm_track==false)
                  set_curr_track_to_leftmost_legal_track(window);

		return 1;
	}
}
Exemple #7
0
int CursorRight(struct Tracker_Windows *window,struct WBlocks *wblock){
	struct WTracks *wtrack=wblock->wtrack;
	struct WTracks *leftwtrack;
	struct WTracks *rightwtrack;
	int update=0;
	int x2;
        
	if(window->curr_track>=0){

		window->curr_track_sub++;
                int num_subtracks = GetNumSubtracks(wtrack);

		if(window->curr_track_sub>=num_subtracks){
			window->curr_track++;
			if(NextWTrack(wtrack)==NULL){
				window->curr_track--;
				window->curr_track_sub--;
				return 0;
			}else{
				window->curr_track_sub= -1;
				ATOMIC_WRITE(wblock->wtrack, NextWTrack(wtrack));
			}
		}

		while(
			window->curr_track>wblock->right_track
			||
			(
			 window->curr_track==wblock->right_track
			 && window->curr_track_sub>wblock->right_subtrack
			 )
		){
			leftwtrack=ListFindElement1(&wblock->wtracks->l,wblock->left_track);
                        int num_subtracks = GetNumSubtracks(leftwtrack);
			wblock->left_subtrack++;
			if(wblock->left_subtrack>=num_subtracks){
                          if (wblock->left_track < wblock->block->num_tracks-1) {
                            wblock->left_subtrack= -1;
                            wblock->left_track++;
                            //return 0;
                          } else {
                            UpdateAllWTracksCoordinates(window,wblock);
                            wblock->left_subtrack--;
                            return 1;
                          }
			}
			leftwtrack=ListFindElement1(&wblock->wtracks->l,wblock->left_track);
			if(
				wblock->left_track==wblock->block->num_tracks-1 &&
				wblock->left_subtrack==num_subtracks-1
			){
                                UpdateAllWTracksCoordinates(window,wblock);
				return 2;
			}
			UpdateAllWTracksCoordinates(window,wblock);
			update=1;
		}
		for(;;){
		  rightwtrack=ListFindElement1(&wblock->wtracks->l,window->curr_track);
                  int num_subtracks = GetNumSubtracks(rightwtrack);
		  x2=GetXSubTrack2(rightwtrack,window->curr_track_sub);
		  if(x2>wblock->a.x2){
			leftwtrack=ListFindElement1(&wblock->wtracks->l,wblock->left_track);
			wblock->left_subtrack++;
			if(wblock->left_subtrack>=num_subtracks){
                          if (wblock->left_track < wblock->block->num_tracks-1) {
				wblock->left_subtrack= -1;
				wblock->left_track++;
                          } else {
                            wblock->left_subtrack--;
                            UpdateAllWTracksCoordinates(window,wblock);
                            return 1;
                          }
			}
			leftwtrack=ListFindElement1(&wblock->wtracks->l,wblock->left_track);
			UpdateAllWTracksCoordinates(window,wblock);
			update=1;
		  }else{
		    break;
		  }
		}
	
	}else{
                ATOMIC_INC(window->curr_track, 1);

                if (window->curr_track==LPBTRACK && window->show_lpb_track==false)
                  ATOMIC_INC(window->curr_track, 1);

                if (window->curr_track==SIGNATURETRACK && window->show_signature_track==false)
                  ATOMIC_INC(window->curr_track, 1);
                
                if (window->curr_track==LINENUMBTRACK)
                  ATOMIC_INC(window->curr_track, 1);

                if (window->curr_track==TEMPONODETRACK && window->show_reltempo_track==false)
                  ATOMIC_INC(window->curr_track, 1);

		if (0==window->curr_track)
                  window->curr_track_sub= -1;
                
                
	}
	if(update==1){
		return 2;
	}else{
		return 1;
	}
}