Merge commit 'alpha/update_2_12_for_2_11_2_series_merge^2' into HEAD
[jalview.git] / src / jalview / gui / AlignViewport.java
index dca9047..3d44a7c 100644 (file)
@@ -74,14 +74,11 @@ import javax.swing.JInternalFrame;
 public class AlignViewport extends AlignmentViewport
         implements SelectionSource
 {
-
   public final static int NO_SPLIT = 0;
 
   public final static int SPLIT_FRAME = 1;
 
   public final static int NEW_WINDOW = 2;
-
-
   Font font;
 
   boolean cursorMode = false;
@@ -171,7 +168,7 @@ public class AlignViewport extends AlignmentViewport
    * @param hiddenColumns
    * @param seqsetid
    *          (may be null)
-f   */
+   */
   public AlignViewport(AlignmentI al, HiddenColumns hiddenColumns,
           String seqsetid)
   {
@@ -322,6 +319,7 @@ f   */
     }
     setColourAppliesToAllGroups(true);
   }
+
   
   boolean validCharWidth;
 
@@ -460,32 +458,6 @@ f   */
   }
 
   /**
-   * Returns an iterator over the visible column regions of the alignment
-   * 
-   * @param selectedRegionOnly
-   *          true to just return the contigs intersecting with the selected
-   *          area
-   * @return
-   */
-  public Iterator<int[]> getViewAsVisibleContigs(boolean selectedRegionOnly)
-  {
-    int start = 0;
-    int end = 0;
-    if (selectedRegionOnly && selectionGroup != null)
-    {
-      start = selectionGroup.getStartRes();
-      end = selectionGroup.getEndRes() + 1;
-    }
-    else
-    {
-      end = alignment.getWidth();
-    }
-
-    return (alignment.getHiddenColumns().getVisContigsIterator(start,
-            end, false));
-  }
-
-  /**
    * get hash of undo and redo list for the alignment
    * 
    * @return long[] { historyList.hashCode, redoList.hashCode };
@@ -532,7 +504,7 @@ f   */
   }
 
   public boolean followSelection = true;
-  
+
   /**
    * @return true if view selection should always follow the selections
    *         broadcast by other selection sources
@@ -597,6 +569,7 @@ f   */
     return StructureSelectionManager
             .getStructureSelectionManager(Desktop.getInstance());
   }
+
   
   @Override
   public boolean isNormaliseSequenceLogo()
@@ -610,7 +583,6 @@ public void setNormaliseSequenceLogo(boolean state)
     normaliseSequenceLogo = state;
   }
 
-
   /**
    * 
    * @return true if alignment characters should be displayed
@@ -764,7 +736,6 @@ public void setNormaliseSequenceLogo(boolean state)
 
     ranges.setEndSeq(getAlignment().getHeight() - 1); // BH 2019.04.18
     notifyAlignment();
-
   }
 
   /**
@@ -803,10 +774,10 @@ public void setNormaliseSequenceLogo(boolean state)
               @Override
               public void run()
               {
+                // Make a copy of this one to open it in a splitframe
                 openLinkedAlignmentAs(getAlignPanel().alignFrame,
                         new Alignment(getAlignment()), al, title,
                         SPLIT_FRAME);
-//                us.openLinkedAlignmentAs(al, title, true);
               }
             }).setResponseHandler(NEW_WINDOW, new Runnable()
             {
@@ -822,6 +793,7 @@ public void setNormaliseSequenceLogo(boolean state)
             JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null,
             options, options[0]);
   }
+
   /**
    * Open a split frame or a new window
    * 
@@ -834,11 +806,11 @@ public void setNormaliseSequenceLogo(boolean state)
           AlignmentI thisAlignment, AlignmentI al, String title, int mode)
   {
     /*
-     * Identify protein and dna alignments. Make a copy of this one if opening
-     * in a new split pane.
+     * Identify protein and dna alignments. 
      */
     AlignmentI protein = al.isNucleotide() ? thisAlignment : al;
     AlignmentI cdna = al.isNucleotide() ? al : thisAlignment;
+
     /*
      * Map sequences. At least one should get mapped as we have already passed
      * the test for 'mappability'. Any mappings made will be added to the
@@ -909,7 +881,6 @@ public void setNormaliseSequenceLogo(boolean state)
             AlignFrame.DEFAULT_HEIGHT);
     copyMe.setTitle(thisFrame.getTitle());
 
-
     AlignmentI al = newAlignFrame.viewport.getAlignment();
     final AlignFrame proteinFrame = al.isNucleotide() ? copyMe
             : newAlignFrame;
@@ -1102,7 +1073,6 @@ public void setNormaliseSequenceLogo(boolean state)
               .getFeatureColour(type);
       FeatureMatcherSetI preferredFilters = featureSettings
               .getFeatureFilters(type);
-
       FeatureColourI origColour = fr.getFeatureStyle(type);
       if (!mergeOnly || (!origRenderOrder.contains(type)
               || origColour == null
@@ -1126,6 +1096,10 @@ public void setNormaliseSequenceLogo(boolean state)
         {
           displayed.setVisible(type);
         }
+        else if (featureSettings.isFeatureHidden(type))
+        {
+          displayed.setHidden(type);
+        }
       }
     }
 
@@ -1154,6 +1128,7 @@ public void setNormaliseSequenceLogo(boolean state)
       fr.orderFeatures(featureSettings);
     }
     fr.setTransparency(featureSettings.getTransparency());
+    fr.notifyFeaturesChanged();
   }
 
   public String getViewName()
@@ -1165,5 +1140,4 @@ public void setNormaliseSequenceLogo(boolean state)
   {
     this.viewName = viewName;
   }
-
 }