From: amwaterhouse Date: Wed, 9 Mar 2005 18:36:17 +0000 (+0000) Subject: allows deletion of chars, font chooser added X-Git-Tag: Release_2_0~612 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6e9da2b0461e97e7d72711a61c9c8a982c548822;p=jalview.git allows deletion of chars, font chooser added --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 22c48bc..9566bb5 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -36,8 +36,6 @@ public class AlignFrame extends GAlignFrame viewport = new AlignViewport(al,true,true,true,false); alignPanel = new AlignmentPanel(this, viewport); getContentPane().add(alignPanel, java.awt.BorderLayout.CENTER); - fontNameMenuItem.setText(viewport.getFont().getName()); - fontSizeMenuItem.setText(viewport.getFont().getSize()+""); addInternalFrameListener(new InternalFrameAdapter() { @@ -350,8 +348,18 @@ public class AlignFrame extends GAlignFrame SequenceGroup sg = viewport.getRubberbandGroup(); for (int i=0;i < sg.sequences.size(); i++) - viewport.getAlignment().deleteSequence(sg.getSequenceAt(i)); + { + SequenceI seq = sg.getSequenceAt(i); + int index = viewport.getAlignment().findIndex(seq); + seq.deleteChars(sg.getStartRes(), sg.getEndRes()+1); + + if(seq.getSequence().length()<1) + viewport.getAlignment().deleteSequence(seq); + else + viewport.getAlignment().getSequences().setElementAt(seq, index); + } + viewport.setRubberbandGroup(null); viewport.alignment.deleteGroup(sg); viewport.resetSeqLimits( alignPanel.seqPanel.seqCanvas.getHeight()); if(viewport.getAlignment().getHeight()<1) @@ -511,55 +519,15 @@ public class AlignFrame extends GAlignFrame } - - public void fontNameMenuItem_actionPerformed(ActionEvent e) - { - String fonts[] = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); - - - String selection = JOptionPane.showInternalInputDialog(this, - "Select font", - "Font selection", - JOptionPane.QUESTION_MESSAGE, - null,fonts - ,fontNameMenuItem.getText()).toString(); - if(selection!=null) - { - fontNameMenuItem.setText(selection); - SetFont(); - } - - } - - public void fontSizeMenuItem_actionPerformed(ActionEvent e) - { - String selection = JOptionPane.showInternalInputDialog(this, - "Select font size", - "Font size", - JOptionPane.QUESTION_MESSAGE, - null, new String[]{"1","2","4","6","8","10","12","14","16","18","20"} - ,fontSizeMenuItem.getText()).toString(); - if(selection!=null) - { - fontSizeMenuItem.setText(selection); - SetFont(); - } - } - - public void fontStyleMenuItem_actionPerformed(ActionEvent e) + public void font_actionPerformed(ActionEvent e) { - String selection = JOptionPane.showInternalInputDialog(this, - "Select font style", - "Font style", - JOptionPane.QUESTION_MESSAGE, - null, new String[]{"plain", "bold", "italic"} - ,fontStyleMenuItem.getText()).toString(); - if(selection!=null) - { - fontStyleMenuItem.setText(selection); - SetFont(); - } - + JOptionPane op = new JOptionPane(); + JInternalFrame frame = op.createInternalFrame(this, "Change Font"); + FontChooser fc = new FontChooser( alignPanel ); + frame.setClosable(true); + frame.setContentPane(fc); + frame.setSize(480, 100); + frame.setVisible(true); } protected void colourTextMenuItem_actionPerformed(ActionEvent e) @@ -568,21 +536,6 @@ public class AlignFrame extends GAlignFrame alignPanel.RefreshPanels(); } - void SetFont() - { - int style = java.awt.Font.PLAIN; - if(fontStyleMenuItem.getText().equals("bold")) - style = java.awt.Font.BOLD; - else if(fontStyleMenuItem.getText().equals("italic")) - style = java.awt.Font.ITALIC; - - viewport.setFont(new java.awt.Font(fontNameMenuItem.getText(), - style, - Integer.parseInt(fontSizeMenuItem.getText()))); - alignPanel.RefreshPanels(); - - } - protected void wrapMenuItem_actionPerformed(ActionEvent e) { viewport.setWrapAlignment( wrapMenuItem.isSelected() );