Commented out for compilation
authoramwaterhouse <Andrew Waterhouse>
Tue, 24 Oct 2006 11:16:53 +0000 (11:16 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 24 Oct 2006 11:16:53 +0000 (11:16 +0000)
src/jalview/appletgui/APopupMenu.java
src/jalview/appletgui/AlignFrame.java
src/jalview/appletgui/FeatureRenderer.java
src/jalview/appletgui/RedundancyPanel.java
src/jalview/appletgui/SeqPanel.java

index 853574b..4972874 100755 (executable)
@@ -232,7 +232,7 @@ public class APopupMenu
     else if(source==cut)\r
       ap.alignFrame.cut_actionPerformed();\r
     else if(source==toUpper || source==toLower || source==toggleCase)\r
-    {\r
+    {/*\r
       SequenceGroup sg = ap.av.getSelectionGroup();\r
       if (sg != null)\r
       {\r
@@ -269,7 +269,7 @@ public class APopupMenu
         while (end < sg.getEndRes());\r
         }\r
         ap.seqPanel.seqCanvas.repaint();\r
-      }\r
+      }*/\r
     }\r
     else\r
       outputText(evt);\r
index 8e54ba9..b0e5715 100755 (executable)
@@ -23,6 +23,7 @@ import jalview.schemes.*;
 import jalview.datamodel.*;\r
 import jalview.analysis.*;\r
 import jalview.io.*;\r
+import jalview.commands.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
 import java.util.*;\r
@@ -668,68 +669,21 @@ public void itemStateChanged(ItemEvent evt)
 \r
   void updateEditMenuBar()\r
   {\r
-    if (historyList.size() > 0)\r
-    {\r
-      undoMenuItem.setEnabled(true);\r
-      HistoryItem hi = (HistoryItem) historyList.peek();\r
-      undoMenuItem.setLabel("Undo " + hi.getDescription());\r
-    }\r
-    else\r
-    {\r
-      undoMenuItem.setEnabled(false);\r
-      undoMenuItem.setLabel("Undo");\r
-    }\r
-\r
-    if (redoList.size() > 0)\r
-    {\r
-      redoMenuItem.setEnabled(true);\r
-      HistoryItem hi = (HistoryItem) redoList.peek();\r
-      redoMenuItem.setLabel("Redo " + hi.getDescription());\r
-    }\r
-    else\r
-    {\r
-      redoMenuItem.setEnabled(false);\r
-      redoMenuItem.setLabel("Redo");\r
-    }\r
   }\r
 \r
-  public void addHistoryItem(HistoryItem hi)\r
-  {\r
-    historyList.push(hi);\r
-    redoList.removeAllElements();\r
-    updateEditMenuBar();\r
-  }\r
 \r
   protected void undoMenuItem_actionPerformed()\r
   {\r
-    HistoryItem nh,hi = (HistoryItem) historyList.pop();\r
-    redoList.push(nh=new HistoryItem(hi.getDescription(), viewport.alignment,\r
-                                  HistoryItem.HIDE));\r
-    if (hi.alColumnChanges!=null)\r
-      nh.alColumnChanges=hi.alColumnChanges.getInverse();\r
-    restoreHistoryItem(hi);\r
-    viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());\r
   }\r
 \r
   protected void redoMenuItem_actionPerformed()\r
   {\r
-    HistoryItem nh,hi = (HistoryItem) redoList.pop();\r
-    historyList.push(nh=new HistoryItem(hi.getDescription(), viewport.alignment,\r
-                                  HistoryItem.HIDE));\r
-    if (hi.alColumnChanges!=null)\r
-      nh.alColumnChanges=hi.alColumnChanges.getInverse();\r
-    restoreHistoryItem(hi);\r
-    updateEditMenuBar();\r
-    viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());\r
+\r
   }\r
 \r
   // used by undo and redo\r
-  void restoreHistoryItem(HistoryItem hi)\r
+  void restoreHistoryItem(CommandI command)\r
   {\r
-    hi.restore(viewport.getColumnSelection());\r
-    updateEditMenuBar();\r
-\r
-    viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());\r
   }\r
 \r
   public void moveSelectedSequences(boolean up)\r
@@ -882,8 +836,8 @@ public void itemStateChanged(ItemEvent evt)
 \r
   protected void pasteThis_actionPerformed()\r
   {\r
-    addHistoryItem(new HistoryItem("Paste Sequences", viewport.alignment,\r
-                                   HistoryItem.PASTE));\r
+  //  addHistoryItem(new HistoryItem("Paste Sequences", viewport.alignment,\r
+   //                                HistoryItem.PASTE));\r
     paste(false);\r
   }\r
 \r
@@ -970,8 +924,8 @@ public void itemStateChanged(ItemEvent evt)
 \r
   protected void delete_actionPerformed()\r
   {\r
-    addHistoryItem(new HistoryItem("Delete Sequences", viewport.alignment,\r
-                                   HistoryItem.HIDE));\r
+    //addHistoryItem(new HistoryItem("Delete Sequences", viewport.alignment,\r
+    //                               HistoryItem.HIDE));\r
     if (viewport.getSelectionGroup() == null)\r
     {\r
       return;\r
@@ -1073,149 +1027,18 @@ public void itemStateChanged(ItemEvent evt)
 \r
   public void remove2LeftMenuItem_actionPerformed()\r
   {\r
-    ColumnSelection colSel = viewport.getColumnSelection();\r
-    if (colSel.size() > 0)\r
-    {\r
-      HistoryItem edit;\r
-      addHistoryItem(edit=new HistoryItem("Remove Left", viewport.alignment,\r
-                                     HistoryItem.HIDE));\r
-      int min = colSel.getMin();\r
-      viewport.getAlignment().trimLeft(min);\r
-      colSel.compensateForEdit(0, min);\r
-      edit.addShift(0, min);\r
-      if (viewport.getSelectionGroup() != null)\r
-      {\r
-        viewport.getSelectionGroup().adjustForRemoveLeft(min);\r
-      }\r
-\r
-      Vector groups = viewport.alignment.getGroups();\r
-      for (int i = 0; i < groups.size(); i++)\r
-      {\r
-        SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
-        if (!sg.adjustForRemoveLeft(min))\r
-        {\r
-          viewport.alignment.deleteGroup(sg);\r
-        }\r
-      }\r
-      viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());\r
-    }\r
   }\r
 \r
   public void remove2RightMenuItem_actionPerformed()\r
   {\r
-    ColumnSelection colSel = viewport.getColumnSelection();\r
-    if (colSel.size() > 0)\r
-    {\r
-      addHistoryItem(new HistoryItem("Remove Right", viewport.alignment,\r
-                                     HistoryItem.HIDE));\r
-      int max = colSel.getMax();\r
-      viewport.getAlignment().trimRight(max);\r
-\r
-      if (viewport.getSelectionGroup() != null)\r
-      {\r
-        viewport.getSelectionGroup().adjustForRemoveRight(max);\r
-      }\r
-\r
-      Vector groups = viewport.alignment.getGroups();\r
-      for (int i = 0; i < groups.size(); i++)\r
-      {\r
-        SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
-        if (!sg.adjustForRemoveRight(max))\r
-        {\r
-          viewport.alignment.deleteGroup(sg);\r
-        }\r
-      }\r
-      viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());\r
-    }\r
-\r
   }\r
 \r
   public void removeGappedColumnMenuItem_actionPerformed()\r
   {\r
-    HistoryItem edit;\r
-    addHistoryItem(edit=new HistoryItem("Remove Gapped Columns",\r
-                                   viewport.alignment,\r
-                                   HistoryItem.HIDE));\r
-\r
-    //This is to maintain viewport position on first residue\r
-    //of first sequence\r
-    SequenceI seq = viewport.alignment.getSequenceAt(0);\r
-    int startRes = seq.findPosition(viewport.startRes);\r
-\r
-    viewport.getAlignment().removeGaps();\r
-\r
-    viewport.setStartRes(seq.findIndex(startRes)-1);\r
-\r
-    viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());\r
   }\r
 \r
   public void removeAllGapsMenuItem_actionPerformed()\r
   {\r
-    // TODO: hidden regions should not be touched by removeAllGaps - a minimal number of gaps will remain in alignment segments containing uneven length subsequences\r
-    // TODO: columnSelection.compensateforedits should be called (and passed to history item)\r
-    HistoryItem editgaps;\r
-    addHistoryItem(editgaps=new HistoryItem("Remove Gaps", viewport.alignment,\r
-                                   HistoryItem.HIDE));\r
-\r
-    //This is to maintain viewport position on first residue\r
-    //of first sequence\r
-    SequenceI seq = viewport.alignment.getSequenceAt(0);\r
-    int startRes = seq.findPosition(viewport.startRes);\r
-\r
-    SequenceI current;\r
-    Vector seqs=null;\r
-\r
-    int start=0, end = viewport.alignment.getWidth();\r
-\r
-    if (viewport.getSelectionGroup() != null\r
-        && viewport.getSelectionGroup().getSequences(false) != null\r
-        && viewport.getSelectionGroup().getSize(false)>0)\r
-    {\r
-      seqs = viewport.getSelectionGroup().getSequences(true);\r
-      start = viewport.getSelectionGroup().getStartRes();\r
-      end = viewport.getSelectionGroup().getEndRes()+1;\r
-    }\r
-    else\r
-      seqs = viewport.alignment.getSequences();\r
-\r
-    /* Commented out regions below are partial implementation of todo above.\r
-     * divide start,end into visible chunks, and for each:\r
-     int diff=end-start+1;\r
-     int diffmax=0;\r
-     int dr[] = new int[seqs.size()];\r
-     */\r
-    for (int i = 0; i < seqs.size(); i++)\r
-    {\r
-      current = (SequenceI) seqs.elementAt(i);\r
-      //dr[i]=\r
-      current.removeGaps(start, end);\r
-      /*if (d<diff) // can only shift\r
-        diff=d;\r
-      if (diffmax<d)\r
-        diffmax=d;\r
-        */\r
-    }\r
-    /* // after the end of each chunk -\r
-     * if (diff>0) {\r
-     // record shift for history.\r
-      editgaps.addShift(start, diff);\r
-      if (viewport.hasHiddenColumns && diffmax>diff) {\r
-      // pad sequence\r
-       StringBuffer gaps=new StringBuffer(diffmax);\r
-       for (int i=0,j=diffmax-diff; i<j; i++)\r
-       gaps.append(viewport.getGapCharacter());\r
-       for (int i=0, j=seqs.size(); i<j; i++) {\r
-       current = (SequenceI) seqs.elementAt(i);\r
-       if (dr[i]-diff>0) {\r
-       String sq = current.getSequence();\r
-       current.setSequence(sq.substring(0, hcend-dr[i])+gaps.substring(0, dr[i]-diff)+sq.substring());\r
-       }\r
-       }\r
-      }\r
-      }*/\r
-\r
-    viewport.setStartRes(seq.findIndex(startRes)-1);\r
-    viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());\r
   }\r
 \r
   public void alignmentChanged()\r
@@ -1622,8 +1445,8 @@ public void itemStateChanged(ItemEvent evt)
 \r
   public void sortPairwiseMenuItem_actionPerformed()\r
   {\r
-    addHistoryItem(new HistoryItem("Pairwise Sort", viewport.alignment,\r
-                                   HistoryItem.SORT));\r
+  //  addHistoryItem(new HistoryItem("Pairwise Sort", viewport.alignment,\r
+   //                                HistoryItem.SORT));\r
     AlignmentSorter.sortByPID(viewport.getAlignment(),\r
                               viewport.getAlignment().getSequenceAt(0));\r
     alignPanel.repaint();\r
@@ -1631,16 +1454,16 @@ public void itemStateChanged(ItemEvent evt)
 \r
   public void sortIDMenuItem_actionPerformed()\r
   {\r
-    addHistoryItem(new HistoryItem("ID Sort", viewport.alignment,\r
-                                   HistoryItem.SORT));\r
+  //  addHistoryItem(new HistoryItem("ID Sort", viewport.alignment,\r
+   //                                HistoryItem.SORT));\r
     AlignmentSorter.sortByID(viewport.getAlignment());\r
     alignPanel.repaint();\r
   }\r
 \r
   public void sortGroupMenuItem_actionPerformed()\r
   {\r
-    addHistoryItem(new HistoryItem("Group Sort", viewport.alignment,\r
-                                   HistoryItem.SORT));\r
+  //  addHistoryItem(new HistoryItem("Group Sort", viewport.alignment,\r
+  //                                 HistoryItem.SORT));\r
     AlignmentSorter.sortByGroup(viewport.getAlignment());\r
     alignPanel.repaint();\r
 \r
@@ -1786,8 +1609,8 @@ public void itemStateChanged(ItemEvent evt)
     {\r
       public void actionPerformed(ActionEvent evt)\r
       {\r
-        addHistoryItem(new HistoryItem("Sort", viewport.alignment,\r
-                                       HistoryItem.SORT));\r
+      //  addHistoryItem(new HistoryItem("Sort", viewport.alignment,\r
+      //                                 HistoryItem.SORT));\r
         AlignmentSorter.sortByTree(viewport.getAlignment(), treePanel.getTree());\r
         alignPanel.repaint();\r
       }\r
index a24525e..954a95e 100755 (executable)
@@ -412,10 +412,10 @@ public class FeatureRenderer
   {\r
     void setTransparency(Graphics g, float value)\r
     {\r
-     Graphics2D g2 = (Graphics2D) g;\r
-     g2.setComposite(\r
-        AlphaComposite.getInstance(\r
-             AlphaComposite.SRC_OVER, value));\r
+     //Graphics2D g2 = (Graphics2D) g;\r
+    // g2.setComposite(\r
+    //    AlphaComposite.getInstance(\r
+    //         AlphaComposite.SRC_OVER, value));\r
     }\r
   }\r
 \r
index 5037a50..7ceb570 100755 (executable)
@@ -193,14 +193,14 @@ public class RedundancyPanel extends SliderPanel implements Runnable, WindowList
     }\r
   public void applyButton_actionPerformed()\r
   {\r
-    historyList.push(new HistoryItem("Remove redundancy",\r
-                        ap.av.alignment, HistoryItem.HIDE));\r
+   // historyList.push(new HistoryItem("Remove redundancy",\r
+   //                     ap.av.alignment, HistoryItem.HIDE));\r
 \r
             if ((historyList.size() == 1) ||\r
                     !ap.alignFrame.historyList.contains(historyList.firstElement()))\r
             {\r
-                ap.alignFrame.addHistoryItem((HistoryItem) historyList.firstElement());\r
-                ap.alignFrame.updateEditMenuBar();\r
+      //          ap.alignFrame.addHistoryItem((HistoryItem) historyList.firstElement());\r
+     //           ap.alignFrame.updateEditMenuBar();\r
             }\r
 \r
             Vector del = new Vector();\r
@@ -243,8 +243,8 @@ public class RedundancyPanel extends SliderPanel implements Runnable, WindowList
 \r
   public void undoButton_actionPerformed()\r
   {\r
-    HistoryItem hi = (HistoryItem) historyList.pop();\r
-    ap.alignFrame.restoreHistoryItem(hi);\r
+  //  HistoryItem hi = (HistoryItem) historyList.pop();\r
+  //  ap.alignFrame.restoreHistoryItem(hi);\r
 \r
     if (historyList.size() == 0)\r
     {\r
index 7e5a207..8d42655 100755 (executable)
@@ -246,8 +246,6 @@ public class SeqPanel
 \r
    void insertGapAtCursor(boolean group)\r
    {\r
-     ap.alignFrame.addHistoryItem(new HistoryItem("Edit Sequence",\r
-                                                  av.alignment, HistoryItem.EDIT));\r
      groupEditing = group;\r
      startseq = seqCanvas.cursorY;\r
      lastres = seqCanvas.cursorX;\r
@@ -257,8 +255,6 @@ public class SeqPanel
 \r
    void deleteGapAtCursor(boolean group)\r
    {\r
-     ap.alignFrame.addHistoryItem(new HistoryItem("Edit Sequence",\r
-                                                  av.alignment, HistoryItem.EDIT));\r
      groupEditing = group;\r
      startseq = seqCanvas.cursorY;\r
      lastres = seqCanvas.cursorX+getKeyboardNo(keyboardNo1);\r
@@ -354,8 +350,6 @@ public class SeqPanel
        if(seq<0 || res<0)\r
          return;\r
 \r
-       ap.alignFrame.addHistoryItem(new HistoryItem("Edit Sequence",\r
-                                                          av.alignment, HistoryItem.EDIT));\r
 \r
          if ((seq < av.getAlignment().getHeight()) &&\r
                  (res < av.getAlignment().getSequenceAt(seq).getLength()))\r
@@ -472,8 +466,6 @@ public class SeqPanel
 \r
   public void doMousePressed(MouseEvent evt)\r
   {\r
-    ap.alignFrame.addHistoryItem(new HistoryItem(\r
-        "Edit Sequence", av.alignment, HistoryItem.EDIT));\r
 \r
     int seq = findSeq(evt);\r
     int res = findRes(evt);\r