set display boxes must be applied to groups
authoramwaterhouse <Andrew Waterhouse>
Fri, 19 Nov 2004 17:24:11 +0000 (17:24 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 19 Nov 2004 17:24:11 +0000 (17:24 +0000)
src/jalview/gui/AlignFrame.java

index 76c483e..4707f3a 100755 (executable)
@@ -86,6 +86,7 @@ public class AlignFrame extends GAlignFrame
     public void run()\r
     {\r
       PrinterJob printJob = PrinterJob.getPrinterJob();\r
+    //  printJob.\r
       PageFormat pf = printJob.pageDialog(printJob.defaultPage());\r
       printJob.setPrintable(alignPanel, pf);\r
       if (printJob.printDialog())\r
@@ -395,8 +396,7 @@ public class AlignFrame extends GAlignFrame
 \r
   protected void colourTextMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    viewport.setColourText( colourTextMenuItem.isSelected() );\r
-    alignPanel.RefreshPanels();\r
+      updateResidueView();\r
   }\r
 \r
   void SetFont()\r
@@ -416,20 +416,53 @@ public class AlignFrame extends GAlignFrame
 \r
   protected void wrapMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    viewport.setWrapAlignment( wrapMenuItem.isSelected() );\r
-    alignPanel.setWrapAlignment( wrapMenuItem.isSelected() );\r
+     updateResidueView();\r
   }\r
 \r
 \r
   public void viewBoxesMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    viewport.setShowBoxes( viewBoxesMenuItem.isSelected() );\r
-    alignPanel.RefreshPanels();\r
+     updateResidueView();\r
   }\r
 \r
   public void viewTextMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    viewport.setShowText( viewTextMenuItem.isSelected() );\r
+     updateResidueView();\r
+  }\r
+\r
+  void updateResidueView()\r
+  {\r
+    if (viewport.getSelection().size() == 0)\r
+     {\r
+       for (int i = 0; i < viewport.alignment.getGroups().size(); i++)\r
+       {\r
+         SequenceGroup sg = (SequenceGroup) viewport.alignment.getGroups().elementAt(i);\r
+         sg.setDisplayBoxes( viewBoxesMenuItem.isSelected() );\r
+         sg.setDisplayText( viewTextMenuItem.isSelected() );\r
+         sg.setColourText( colourTextMenuItem.isSelected() );\r
+       }\r
+     }\r
+     else\r
+     {\r
+       SequenceGroup sg = viewport.alignment.findGroup( (Sequence) viewport.sel.sequenceAt(0));\r
+       if (alignPanel.seqPanel.isNewSelection(sg))\r
+       {\r
+         sg = viewport.getAlignment().addGroup();\r
+         for (int i = 0; i < viewport.getSelection().size(); i++)\r
+         {\r
+           viewport.alignment.removeFromGroup(viewport.alignment.findGroup( (\r
+               Sequence) viewport.sel.sequenceAt(i)),\r
+                                              (Sequence) viewport.sel.sequenceAt(\r
+               i));\r
+           viewport.alignment.addToGroup(sg,\r
+                                         (Sequence) viewport.sel.sequenceAt(i));\r
+         }\r
+       }\r
+\r
+       sg.setDisplayBoxes(viewBoxesMenuItem.isSelected());\r
+       sg.setDisplayText(viewTextMenuItem.isSelected());\r
+       sg.setColourText(colourTextMenuItem.isSelected());\r
+     }\r
     alignPanel.RefreshPanels();\r
   }\r
 \r