Beispiel #1
0
void DLoadLocalZooms(
                     const struct Root *newroot,
                     struct Tracker_Windows *window,
                     struct WBlocks *wblock
){
	UpdateRealLines(window,wblock);
	UpdateReallinesDependens(window,wblock);

        //SetZoomLevelAreaWidth(window,wblock);
}
Beispiel #2
0
/* Argh. This one was difficult, I don`t think it works correctly
   in all situations yet either.
*/
void InsertLines(
	struct Blocks *block,
	int line,
	int toinsert
){
	int lokke;
	struct LocalZooms *localzoom;
	struct Tracker_Windows *window=root->song->tracker_windows;
	struct WBlocks *wblock;
	struct Tracks *track=block->tracks;

	int num_lines=block->num_lines;

	if(line>num_lines+toinsert){
		toinsert=line-num_lines;
	}

        if (line==num_lines-1) { // special case
          Block_Properties(block, block->num_tracks, block->num_lines + toinsert);
          return;
        }
        
	if( line<0 || line>=num_lines) return;

	if(toinsert==0 || num_lines+toinsert<2 || num_lines+toinsert>=MAX_UINT32) return;

        
        PC_Pause();{
        
          blocktobelongtoforinsertlines_notes_a_terrible_hack=block;
          
          block->num_lines=num_lines+toinsert;
          
          List_InsertLines3(&block->temponodes,block->temponodes->l.next,line,toinsert,NULL);
          LegalizeTempoNodes(block);
          List_InsertLines3(&block->signatures,&block->signatures->l,line,toinsert,NULL);
          List_InsertLines3(&block->lpbs,&block->lpbs->l,line,toinsert,NULL);
          List_InsertLines3(&block->tempos,&block->tempos->l,line,toinsert,NULL);
          
          UpdateSTimes(block);
          UpdateBeats(block);

          while(track!=NULL){
            List_InsertLines3(&track->notes,&track->notes->l,line,toinsert,InsertLines_notes);
            LegalizeNotes(block,track);
            List_InsertLines3(&track->stops,&track->stops->l,line,toinsert,NULL);
            VECTOR_FOR_EACH(struct FXs *fxs, &track->fxs){
              List_InsertLines3(&fxs->fxnodelines,&fxs->fxnodelines->l,line,toinsert,NULL);
            }END_VECTOR_FOR_EACH;
            LegalizeFXlines(block,track);
            track=NextTrack(track);
          }

          while(window!=NULL){
            wblock=ListFindElement1(&window->wblocks->l,block->l.num);
            List_InsertLines3(
                              &wblock->localzooms,
                              &wblock->localzooms->l,
                              line,
                              toinsert,
                              InsertLines_localzooms
                              //			NULL
                              );
            for(lokke=line;lokke<line+toinsert;lokke++){
              localzoom=talloc(sizeof(struct LocalZooms));
              localzoom->Tline=lokke;
              localzoom->Tdividor=1;
              localzoom->zoomline=lokke;
              ListAddElement3(&wblock->localzooms,&localzoom->l);
            }
            UpdateWBlockWidths(window,wblock);
            wblock->reallines = NULL; // We changed the localzooms, which is used to set new curr_realline. We don't need to set new curr_realline, so just set reallines to NULL.
            UpdateRealLines(window,wblock);
            UpdateReallinesDependens(window,wblock);
            if(wblock->curr_realline>=wblock->num_reallines){
              wblock->curr_realline=wblock->num_reallines-1;
            }
            window=NextWindow(window);
          }
          
          blocktobelongtoforinsertlines_notes_a_terrible_hack=NULL;

        }PC_StopPause(window);
}
Beispiel #3
0
void Block_Set_num_lines(
	struct Blocks *block,
	int num_lines
){
	Place lastplace1,lastplace;
	struct Tracker_Windows *window=root->song->tracker_windows;
	struct WBlocks *wblock;
	struct LocalZooms *localzoom;
	struct Tracks *track=block->tracks;
	struct Notes *note;
	struct FXs *fxs;
	int org_num_lines=block->num_lines;
	int lokke;

	if(org_num_lines==num_lines || num_lines<2) return;

	PlaceSetLastPos(block,&lastplace1);

	block->num_lines=num_lines;

	PlaceSetLastPos(block,&lastplace);

	if(num_lines<org_num_lines){

		CutListAt_a(&block->lpbs,&lastplace);
		CutListAt_a(&block->tempos,&lastplace);
		CutListAt_a(&block->temponodes,&lastplace);
		PlaceSetLastPos(block,&block->lasttemponode->l.p);
		ListAddElement3(&block->temponodes,&block->lasttemponode->l);

		while(track!=NULL){
			CutListAt_a(&track->notes,&lastplace);
			note=track->notes;
			while(note!=NULL){
				CutListAt(&note->velocities,&lastplace);
				CutListAt(&note->pitches,&lastplace);
				if(PlaceEqual(&note->end,&lastplace1) && note->noend==1){
					PlaceCopy(&note->end,&lastplace);
				}
				note=NextNote(note);
			}
			LegalizeNotes(block,track);

			CutListAt_a(&track->stops,&lastplace);

			fxs=track->fxs;
			while(fxs!=NULL){
				CutListAt_a(&fxs->fxnodelines,&lastplace);
				fxs=NextFX(fxs);
			}
			LegalizeFXlines(block,track);
			track=NextTrack(track);
		}
		while(window!=NULL){
			wblock=ListFindElement1(&window->wblocks->l,block->l.num);
			CutListAt_a(&wblock->localzooms,&lastplace);
			window=NextWindow(window);
		}
	}else{

		PlaceSetLastPos(block,&block->lasttemponode->l.p);

		while(track!=NULL){
			note=track->notes;
			while(note!=NULL){
				if(PlaceEqual(&note->end,&lastplace1) && note->noend==1){
					PlaceSetLastPos(block,&note->end);
				}
				note=NextNote(note);
			}
			LegalizeNotes(block,track);
			track=NextTrack(track);
		}
		while(window!=NULL){
			wblock=ListFindElement1(&window->wblocks->l,block->l.num);
			for(lokke=org_num_lines;lokke<num_lines;lokke++){
				localzoom=talloc(sizeof(struct LocalZooms));
				localzoom->Tline=lokke;
				localzoom->Tdividor=1;
				localzoom->zoomline=lokke;
				ListAddElement3(&wblock->localzooms,&localzoom->l);
			}
			window=NextWindow(window);
		}

	}


	window=root->song->tracker_windows;

	while(window!=NULL){
		wblock=ListFindElement1(&window->wblocks->l,block->l.num);
                UpdateWBlockWidths(window,wblock);
		UpdateRealLines(window,wblock);
		window=NextWindow(window);
	}

	UpdateSTimes(block);
        UpdateBeats(block);
}