boolean toggleCols = !evt.isShiftDown();
boolean hide = false;
-
SequenceGroup sg = viewport.getSelectionGroup();
+ // TODO: document ctrl-shift-h for show visible selected area and fix hack so columns for the current selected region get transferred.
+ if (!toggleSeqs && !toggleCols)
+ {
+ // Hide everything by the current selection - this is a hack - we do the invert and then hide
+ // first check that there will be visible columns after the invert.
+ if ((viewport.colSel!=null && viewport.colSel.getSelected()!=null && viewport.colSel.getSelected().size()>0) || (sg!=null && sg.getSize()>0 && sg.getStartRes()<=sg.getEndRes()))
+ {
+ // now invert the sequence set, if required - empty selection implies that no hiding is required.
+ if (sg!=null) {
+ invertSequenceMenuItem_actionPerformed(null);
+ sg = viewport.getSelectionGroup();
+ toggleSeqs = true;
+
+ }
+
+ if (sg!=null && sg.getStartRes()>=0 && sg.getStartRes()<=sg.getEndRes()&& (viewport.colSel==null || viewport.colSel.getSelected()==null || viewport.colSel.getSelected().size()==0))
+ {
+ // synthesize a column selection if none exists. this happens if a single region has been selected rather than whole columns.
+ if (viewport.colSel==null)
+ {
+ viewport.colSel = new ColumnSelection();
+ }
+ for (int cspos = sg.getStartRes(); cspos<=sg.getEndRes(); cspos++) {
+ viewport.colSel.addElement(cspos);
+ }
+ }
+ // finally invert the column selection and get the new sequence selection.
+ invertColSel_actionPerformed(null);
+ toggleCols = true;
+ }
+ }
+
if (toggleSeqs)
{
if (sg != null
{
if (!jalview.io.AppletFormatAdapter.isValidFormat(format, true))
{
- warningMessage("Cannot save file "
- + fileName + " using format " + format,
- "Alignment output format not supported");
+ warningMessage("Cannot save file " + fileName + " using format "
+ + format, "Alignment output format not supported");
saveAs_actionPerformed(null);
// JBPNote need to have a raise_gui flag here
return false;
{
if (new jalview.util.Platform().isHeadless())
{
- System.err.println("Warning: "+title+"\nWarning: "+warning);
-
- } else {
- JOptionPane.showInternalMessageDialog(this,warning,title,JOptionPane.WARNING_MESSAGE);
+ System.err.println("Warning: " + title + "\nWarning: " + warning);
+
+ }
+ else
+ {
+ JOptionPane.showInternalMessageDialog(this, warning, title,
+ JOptionPane.WARNING_MESSAGE);
}
return;
}
}
/**
- * Attempt to load a "dropped" file or URL string: First by testing whether it's and
- * Annotation file, then a JNet file, and finally a features file. If all are
- * false then the user may have dropped an alignment file onto this
+ * Attempt to load a "dropped" file or URL string: First by testing whether
+ * it's and Annotation file, then a JNet file, and finally a features file. If
+ * all are false then the user may have dropped an alignment file onto this
* AlignFrame.
*
* @param file
try
{
String protocol = jalview.io.FormatAdapter.FILE;
- String f=file.toLowerCase();
- if (f.indexOf("http:") == 0 || f.indexOf("https:")==0 || f.indexOf("file:") == 0)
+ String f = file.toLowerCase();
+ if (f.indexOf("http:") == 0 || f.indexOf("https:") == 0
+ || f.indexOf("file:") == 0)
{
protocol = jalview.io.FormatAdapter.URL;
}
alignPanel.paintAlignment(true);
}
- /* (non-Javadoc)
- * @see jalview.jbgui.GAlignFrame#showGroupConsensus_actionPerformed(java.awt.event.ActionEvent)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GAlignFrame#showGroupConsensus_actionPerformed(java.awt.event
+ * .ActionEvent)
*/
protected void showGroupConsensus_actionPerformed(ActionEvent e)
{
viewport.setShowGroupConsensus(showGroupConsensus.getState());
alignPanel.updateAnnotation();
-
+
}
- /* (non-Javadoc)
- * @see jalview.jbgui.GAlignFrame#showGroupConservation_actionPerformed(java.awt.event.ActionEvent)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GAlignFrame#showGroupConservation_actionPerformed(java.awt
+ * .event.ActionEvent)
*/
protected void showGroupConservation_actionPerformed(ActionEvent e)
{
viewport.setShowGroupConservation(showGroupConservation.getState());
alignPanel.updateAnnotation();
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.jbgui.GAlignFrame#makeGrpsFromSelection_actionPerformed(java.awt
+ * .event.ActionEvent)
+ */
+ protected void makeGrpsFromSelection_actionPerformed(ActionEvent e)
+ {
+ if (viewport.getSelectionGroup() != null)
+ {
+ SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
+ viewport.getSequenceSelection(), viewport.getAlignmentView(
+ true).getSequenceStrings(viewport.getGapCharacter()),
+ viewport.alignment.getGroups());
+ viewport.alignment.deleteAllGroups();
+ viewport.sequenceColours = null;
+ viewport.setSelectionGroup(null);
+ // set view properties for each group
+ for (int g = 0; g < gps.length; g++)
+ {
+ gps[g].setShowunconserved(viewport.getShowUnconserved());
+ gps[g].setIncludeAllConsSymbols(viewport.isIncludeAllConsensusSymbols());
+ viewport.alignment.addGroup(gps[g]);
+ Color col = new Color((int) (Math.random() * 255), (int) (Math
+ .random() * 255), (int) (Math.random() * 255));
+ col = col.brighter();
+ for (Enumeration sq = gps[g].getSequences(null).elements(); sq
+ .hasMoreElements(); viewport.setSequenceColour(
+ (SequenceI) sq.nextElement(), col))
+ ;
+ }
+ PaintRefresher.Refresh(this, viewport.getSequenceSetId());
+ alignPanel.updateAnnotation();
+ alignPanel.paintAlignment(true);
+ }
+ }
}
class PrintThread extends Thread