}
}
-
-
+ /**
+ *
+ * @return alignment objects for all views
+ */
+ AlignmentI[] getViewAlignments()
+ {
+ if (alignPanels!=null)
+ {
+ Enumeration e = alignPanels.elements();
+ AlignmentI[] als = new AlignmentI[alignPanels.size()];
+ for (int i=0; e.hasMoreElements(); i++)
+ {
+ als[i] = ((AlignmentPanel) e.nextElement()).av.getAlignment();
+ }
+ return als;
+ }
+ if (viewport!=null)
+ {
+ return new AlignmentI[] { viewport.alignment };
+ }
+ return null;
+ }
/**
* DOCUMENT ME!
*
*/
protected void undoMenuItem_actionPerformed(ActionEvent e)
{
+ if (viewport.historyList.empty())
+ return;
CommandI command = (CommandI)viewport.historyList.pop();
viewport.redoList.push(command);
- command.undoCommand();
+ command.undoCommand(getViewAlignments());
AlignViewport originalSource = getOriginatingSource(command);
updateEditMenuBar();
CommandI command = (CommandI) viewport.redoList.pop();
viewport.historyList.push(command);
- command.doCommand();
+ command.doCommand(getViewAlignments());
AlignViewport originalSource = getOriginatingSource(command);
updateEditMenuBar();
alignment.addAnnotation(sequences[i].getAnnotation()[a]); // annotation was duplicated earlier
alignment.setAnnotationIndex(sequences[i].getAnnotation()[a], a);
}
-
-
}
}
if (!newAlignment) {
+
// propagate alignment changed.
viewport.setEndSeq(alignment.getHeight());
if (annotationAdded)
{
- alignPanel.annotationPanel.adjustPanelHeight();
+ // Duplicate sequence annotation in all views.
+ AlignmentI[] alview = this.getViewAlignments();
+ for (int avnum=0;avnum<alview.length; avnum++)
+ {
+ if (alview[avnum]!=alignment)
+ {
+ // duplicate in a view other than the one with input focus
+ int avwidth = alview[avnum].getWidth()+1;
+ for (int i=0; i < sequences.length; i++)
+ {
+ AlignmentAnnotation sann[] = sequences[i].getAnnotation();
+ if (sann==null)
+ continue;
+ // this relies on sann being preserved after we modify the sequence's annotation array
+ for (int a=0; a<sann.length; a++)
+ {
+ AlignmentAnnotation newann = new AlignmentAnnotation(sann[a]);
+ sequences[i].addAlignmentAnnotation(newann);
+ newann.padAnnotation(avwidth);
+ alview[avnum].addAnnotation(newann); // annotation was duplicated earlier
+ alview[avnum].setAnnotationIndex(newann, a);
+ }
+ }
+ }
+ }
buildSortByAnnotationScoresMenu();
}
viewport.firePropertyChange("alignment", null, alignment.getSequences());
+
} else {
AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, DEFAULT_HEIGHT);
String newtitle = new String("Copied sequences");