Skip to content

Commit

Permalink
#148 lots of selection improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesholdenmusic committed May 22, 2024
1 parent 825ba87 commit 0e6fa47
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 23 deletions.
70 changes: 48 additions & 22 deletions note_blocks/seq.note.tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,18 +294,29 @@ function drawcell(c,r){
outlet(1,"lineto",sx+(c+xoffs)*cw+x_pos,sy+rh*(1+r)+y_pos);
}
var rc2 = rc;
if((rr>=sel_sy)&&(rr<=sel_ey)&&(cc>=sel_sx)&&(cc<=sel_ex)){
var ts=0;
var te=1;
if(cc==sel_sx) ts = sel_sx2/(UNIVERSAL_COLUMNS)+(sel_sx2==0)*inset;
if(cc==sel_sy) te = (sel_ex2+1)/(UNIVERSAL_COLUMNS);
rc2 += 0.2;
outlet(1,"paintrect",sx+(c+inset+xoffs)*cw+x_pos,sy+rh*r+y_pos,sx+(c+ww+xoffs)*cw+x_pos,sy+rh*(r+1)+y_pos,bc[0]*rc,bc[1]*rc*lp,bc[2]*rc);
outlet(1,"paintrect",sx+(c+ts+xoffs)*cw+x_pos,sy+rh*r+y_pos,sx+(c+te+xoffs)*cw+x_pos,sy+rh*(r+1)+y_pos,bc[0]*rc2,bc[1]*rc2*lp,bc[2]*rc2);
}else{// all not
outlet(1,"paintrect",sx+(c+inset+xoffs)*cw+x_pos,sy+rh*r+y_pos,sx+(c+ww+xoffs)*cw+x_pos,sy+rh*(r+1)+y_pos,bc[0]*rc,bc[1]*rc*lp,bc[2]*rc);
}
if(!mini){
if((rr>=sel_sy)&&(rr<=sel_ey)&&(cc>=sel_sx)&&(cc<=sel_ex)){
var ts=0;
var te=1;
//start sx+(c+inset*(sel_sx2==0)+(3*sel_sx2 + (sel_sx2!=0)-0.5)/(2+(3+(sel_sx2==0))*(UNIVERSAL_COLUMNS-1)))*cw+3+x_pos,
//end sx+(c+(x+(3+(sel_ex2==0))+(sel_ex2==0))/(2+(3+(sel_ex2==0))*(UNIVERSAL_COLUMNS-1))+xoffs)*cw+x_pos
x = 3*sel_sx2 + (sel_sx2!=0)
if(cc==sel_sx){
ts = sx+(c+inset*(sel_sx2==0)+(3*sel_sx2 + (sel_sx2!=0)-0.5)/(2+(3+(sel_sx2==0))*(UNIVERSAL_COLUMNS-1)))*cw+3+x_pos;//sel_sx2/(UNIVERSAL_COLUMNS)+(sel_sx2==0)*inset;
}else{
ts = sx+(c+inset+xoffs)*cw+x_pos;
}
if(cc==sel_ex){
te = sx+(c+((3*sel_ex2 + (sel_ex2!=0))+(3+(sel_ex2==0))+(sel_ex2==0))/(2+(3+(sel_ex2==0))*(UNIVERSAL_COLUMNS-1))+xoffs)*cw+x_pos;
}else{
te = sx+(c+ww+xoffs)*cw+x_pos;// sx+(c+(3*(UNIVERSAL_COLUMNS-1) + 4)/(2+3*(UNIVERSAL_COLUMNS-1))+xoffs)*cw+x_pos;
} //te = (sel_ex2+1)/(UNIVERSAL_COLUMNS);
rc2 += 0.2;
outlet(1,"paintrect",sx+(c+inset+xoffs)*cw+x_pos,sy+rh*r+y_pos,sx+(c+ww+xoffs)*cw+x_pos,sy+rh*(r+1)+y_pos,bc[0]*rc,bc[1]*rc*lp,bc[2]*rc);
outlet(1,"paintrect",ts,sy+rh*r+y_pos,te,sy+rh*(r+1)+y_pos,bc[0]*rc2,bc[1]*rc2*lp,bc[2]*rc2);
}else{// all not
outlet(1,"paintrect",sx+(c+inset+xoffs)*cw+x_pos,sy+rh*r+y_pos,sx+(c+ww+xoffs)*cw+x_pos,sy+rh*(r+1)+y_pos,bc[0]*rc,bc[1]*rc*lp,bc[2]*rc);
}
outlet(1,"frgb",fc);
var incell = ((cursorx==(cc))&&(cursory==rr));
var x=0;
Expand Down Expand Up @@ -359,6 +370,7 @@ function drawcell(c,r){
}
}else{
//values = voice_data_buffer.peek(1,MAX_DATA*v_list[(cc)]+1+UNIVERSAL_COLUMNS*rr+pattern_offs[c],UNIVERSAL_COLUMNS);
outlet(1,"paintrect",sx+(c+inset+xoffs)*cw+x_pos,sy+rh*r+y_pos,sx+(c+ww+xoffs)*cw+x_pos,sy+rh*(r+1)+y_pos,bc[0]*rc,bc[1]*rc*lp,bc[2]*rc);
for(i=0;i<2;i++){ //just plot note/vel squares in mini view?
if(values[i]!=0) outlet(1,"paintrect",sx+(c+(i*4)/7)*cw+x_pos,sy+rh*r+y_pos,sx+(c+(i*4+1)/7)*cw+x_pos,sy+rh*(r+1)+y_pos,fc);
}
Expand Down Expand Up @@ -416,9 +428,9 @@ function mouse(x,y,lb,sh,al,ct,scr){
}
}
}else{
cursorx2 = clickx2;
cursorx = Math.min(v_list.length-1,Math.floor(clickx));
cursory = clicky;
//cursorx2 = clickx2;
//cursorx = Math.min(v_list.length-1,Math.floor(clickx));
//cursory = clicky;
if(((clickx>sel_sx)||((clickx==sel_sx)&&(clickx2>=sel_sx2)))&&((clickx<sel_ex)||((clickx==sel_ex)&&(clickx2<=sel_ex2)))&&(clicky>=sel_sy)&&(clicky<=sel_ey)){
for(var tx=sel_sx;tx<=sel_ex;tx++){
tt = clickx2;
Expand Down Expand Up @@ -459,6 +471,7 @@ function mouse(x,y,lb,sh,al,ct,scr){
voice_data_buffer.poke(1,MAX_DATA*v_list[clickx]+clickx2+1+pattern_offs[clickx]+UNIVERSAL_COLUMNS*(clicky+display_row_offset),v);
}
}
drawflag = 1;
}
}else if(lb){
if(sh){
Expand Down Expand Up @@ -727,7 +740,7 @@ function keydown(key){
sel_ey=cursory;
sel_sy=cursory;
}
if(sel_ex==cursorx){
if((sel_ex==cursorx)&&(sel_ex2==cursorx2)){
cursorx2++;
if(cursorx2>UNIVERSAL_COLUMNS-2){
cursorx2=0;
Expand All @@ -744,17 +757,29 @@ function keydown(key){
sel_sx2 = cursorx2;
sel_sx = cursorx;
}
drawflag=1;
break;
case 501:
if(sel_ex==-1){
sel_ex=cursorx;
sel_sx=cursorx;
sel_ex2=cursorx2;
sel_sx2=cursorx2;
/*if((cursorx2>0)||(cursorx>0)){
cursorx2--;
if(cursorx2<0){
cursorx--;
cursorx2 = UNIVERSAL_COLUMNS -1;
}else{
sel_sx=cursorx;
sel_sx2=cursorx2;
}
}else{*/ //this didn't work well, selection wasn't displaying right.
sel_sx=cursorx;
sel_sx2=cursorx2;
//}
sel_ey=cursory;
sel_sy=cursory;
}
if(sel_ex==cursorx){
if((sel_ex==cursorx)&&(sel_ex2==cursorx2)){
cursorx2--;
if(cursorx2<0){
cursorx2=UNIVERSAL_COLUMNS-2;
Expand All @@ -771,6 +796,7 @@ function keydown(key){
sel_sx2 = cursorx2;
sel_sx = cursorx;
}
drawflag =1;
break;
case 502:
if(sel_ex==-1){
Expand Down Expand Up @@ -799,12 +825,12 @@ function keydown(key){
sel_ey=cursory;
sel_sy=cursory;
}
if(sel_ey==cursory){
cursory=(cursory+max_rows-1) % max_rows;
sel_ey=cursory;
}else if(sel_sy==cursory){
if(sel_sy==cursory){
cursory=(cursory+max_rows-1) % max_rows;
sel_sy==cursory;
}else if(sel_ey==cursory){
cursory=(cursory+max_rows-1) % max_rows;
sel_ey=cursory;
}
drawflag=1;
break;
Expand Down
2 changes: 1 addition & 1 deletion note_blocks/seq.note.tracker.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"patcher" : "universal.step.sequence",
"type" : "note",
"block_ui_patcher" : "seq.note.tracker.ui",
"help_text" : "note tracker. add more voices for more polyphony. ££on the trigger input C=clock B=back D=reset, you can also directly access the first 128 rows through the row select input. start point can be before, inside or even after the loop points. ££notes with no length are only cut off by the next note or entering an 'off' with the 1 key. ££editor keys:£l and , switch octave£.or backspace clears a cell (or row if you're in the note column)£notes start at z for the bottom octave and q for the top octave and a half£1 enters an 'off' in the notes column£del deletes a row£insert inserts one£hold shift and use arrows or click to select an area£ctl-c,ctl-x,ctl-v,ctl-a copy cut paste select all£ctl-i interpolates values from one end of a selection to the other.",
"help_text" : "note tracker. each voice is monophonic channel of midi notes, add more voices for more polyphony.££on the trigger input C=clock B=back D=reset, you can also directly access the first 128 rows through the row select input. start point can be before, inside or even after the loop points. ££notes with no length are only cut off by the next note or entering an 'off' with the 1 key. ££editor keys:£-----------£notes start at z for the bottom octave and q for the top octave and a half£1 enters an 'off' in the notes column£L and , switch octave£.or backspace clears a cell (or row if you're in the note column)£del deletes a row, insert inserts one£hold shift and use arrows or click to select an area£ctl-c,ctl-x,ctl-v,ctl-a, ctl-l copy cut paste select all select a whole column£ctl-i interpolates values from one end of a selection to the other.£# toggles 'grouping' for a row. grouped rows (indicated by a small indent) work as a single step, every time the playhead lands on this step it plays the next one of the grouped notes, round-robin-ing. so if you have a sequence CCCDEF and the last 4 are grouped it'll play CCCCCCCDCCCECCCF",
"max_polyphony" : 0,
"default_polymode" : {
"stack_mode" : "1x",
Expand Down

0 comments on commit 0e6fa47

Please sign in to comment.