public static final int PASTE = 3;
public static final int REPLACE = 4;
+
+ public static final int INSERT_NUC=5;
Edit[] edits;
case REPLACE:
replace(edits[e]);
break;
+ //TODO:add deleteNuc for UNDO
+ case INSERT_NUC:
+ insertNuc(edits[e]);
+ break;
}
}
}
case REPLACE:
replace(edits[e]);
break;
- }
+ }
}
}
{
command.seqs[s].insertCharAt(command.position, command.number,
command.gapChar);
+ System.out.println("pos: "+command.position+" number: "+command.number);
+ }
+
+ adjustAnnotations(command, true, false, null);
+ }
+
+ final void insertNuc(Edit command)
+ {
+
+ for (int s = 0; s < command.seqs.length; s++)
+ {
+ System.out.println("pos: "+command.position+" number: "+command.number);
+ command.seqs[s].insertCharAt(command.position, command.number,'A');
}
adjustAnnotations(command, true, false, null);
groupEditing = group;
startseq = seqCanvas.cursorY;
lastres = seqCanvas.cursorX;
- editSequence(true, seqCanvas.cursorX + getKeyboardNo1());
+ editSequence(true, false, seqCanvas.cursorX + getKeyboardNo1());
endEditing();
}
groupEditing = group;
startseq = seqCanvas.cursorY;
lastres = seqCanvas.cursorX + getKeyboardNo1();
- editSequence(false, seqCanvas.cursorX);
+ editSequence(false, false, seqCanvas.cursorX);
endEditing();
}
+
+ void insertNucAtCursor(boolean group,String nuc){
+ groupEditing = group;
+ startseq = seqCanvas.cursorY;
+ lastres = seqCanvas.cursorX;
+ editSequence(false, true, seqCanvas.cursorX + getKeyboardNo1());
+ endEditing();
+ }
void numberPressed(char value)
{
if ((res < av.getAlignment().getWidth()) && (res < lastres))
{
// dragLeft, delete gap
- editSequence(false, res);
+ editSequence(false, false,res);
}
else
{
- editSequence(true, res);
+ editSequence(true, false,res);
}
mouseDragging = true;
}
}
- synchronized void editSequence(boolean insertGap, int startres)
+ //TODO: Make it more clever than many booleans
+ synchronized void editSequence(boolean insertGap, boolean editSeq, int startres)
{
int fixedLeft = -1;
int fixedRight = -1;
else
// ///Editing a single sequence///////////
{
- if (insertGap)
+ if (insertGap && !editSeq)
{
// dragging to the right
if (fixedColumns && fixedRight != -1)
{
insertChar(j, new SequenceI[]
{ seq }, fixedRight);
+ System.out.println("InsertGap1");
+
}
}
else
{
editCommand.appendEdit(EditCommand.INSERT_GAP, new SequenceI[]
{ seq }, lastres, startres - lastres, av.alignment, true);
+ System.out.println("InsertGap2 - lastres: "+lastres+" startres: "+startres);
+
}
}
else
{
+ if(!editSeq){
// dragging to the left
if (fixedColumns && fixedRight != -1)
{
{ seq }, startres, max, av.alignment, true);
}
}
+ }else{//insertGap==false AND editSeq==TRUE;
+ if (fixedColumns && fixedRight != -1)
+ {
+ for (int j = lastres; j < startres; j++)
+ {
+ insertChar(j, new SequenceI[]
+ { seq }, fixedRight);
+ }
+ System.out.println("EditSeq1");
+
+ }
+ else
+ {
+ editCommand.appendEdit(EditCommand.INSERT_NUC, new SequenceI[]
+ { seq }, lastres, startres - lastres, av.alignment, true);
+ System.out.println("EditSeq2");
+ }
+ }
}
}