Index: core/output2/src/org/netbeans/core/output2/Bundle.properties =================================================================== RCS file: /cvs/core/output2/src/org/netbeans/core/output2/Bundle.properties,v --- core/output2/src/org/netbeans/core/output2/Bundle.properties 1.11 +++ core/output2/src/org/netbeans/core/output2/Bundle.properties @@ -58,0 +58,2 @@ +ACTION_INCREASE_FONT=Increase Font Size +ACTION_DECREASE_FONT=Decrease Font Size @@ -71,0 +73,2 @@ +ACTION_INCREASE_FONT.accel=C-EQUALS +ACTION_DECREASE_FONT.accel=C-MINUS @@ -84,0 +88,2 @@ +ACTION_INCREASE_FONT.accel.mac=C-EQUALS +ACTION_DECREASE_FONT.accel.mac=C-MINUS Index: core/output2/src/org/netbeans/core/output2/Controller.java =================================================================== RCS file: /cvs/core/output2/src/org/netbeans/core/output2/Controller.java,v --- core/output2/src/org/netbeans/core/output2/Controller.java 1.45 +++ core/output2/src/org/netbeans/core/output2/Controller.java @@ -94,0 +94,2 @@ + private static final int ACTION_INCREASE_FONT = 15; + private static final int ACTION_DECREASE_FONT = 16; @@ -95,1 +97,1 @@ -// private static final int ACTION_TO_EDITOR = 15; --- +// private static final int ACTION_TO_EDITOR = 17; @@ -129,0 +131,6 @@ + + Action increaseFontAction = new ControllerAction (ACTION_INCREASE_FONT, + "ACTION_INCREASE_FONT"); //NOI18N + Action decreaseFontAction = new ControllerAction (ACTION_DECREASE_FONT, + "ACTION_DECREASE_FONT"); //NOI18N + @@ -137,1 +145,2 @@ - wrapAction, new JSeparator(), saveAsAction, clearAction, closeAction, --- + wrapAction, increaseFontAction, decreaseFontAction, + new JSeparator(), saveAsAction, clearAction, closeAction, @@ -142,1 +151,2 @@ - findPreviousAction, wrapAction, saveAsAction, closeAction, --- + findPreviousAction, wrapAction, increaseFontAction, decreaseFontAction, + saveAsAction, closeAction, @@ -432,0 +442,7 @@ + case ACTION_INCREASE_FONT : + OutputPane.changeFontSize(true); + break; + case ACTION_DECREASE_FONT : + OutputPane.changeFontSize(false); + break; + Index: core/output2/src/org/netbeans/core/output2/OutputPane.java =================================================================== RCS file: /cvs/core/output2/src/org/netbeans/core/output2/OutputPane.java,v --- core/output2/src/org/netbeans/core/output2/OutputPane.java 1.15 +++ core/output2/src/org/netbeans/core/output2/OutputPane.java @@ -17,0 +17,1 @@ +import java.util.Iterator; @@ -28,0 +29,7 @@ +import java.awt.event.InputEvent; +import java.awt.event.MouseWheelEvent; +import java.lang.ref.Reference; +import java.lang.ref.WeakReference; +import java.util.HashSet; +import java.util.Set; +import javax.swing.text.View; @@ -31,0 +39,5 @@ + + OutputPane() { + registry.add (new WeakReference(this)); + } + @@ -172,0 +185,1 @@ + setupFont(true); @@ -174,0 +188,62 @@ + } + + private static Set registry = new HashSet(); + + static void changeFontSize (boolean positive) { + int currFontSize = outputFontSize; + int newFontSize = -1; + for (Iterator i = registry.iterator(); i.hasNext();) { + Reference ref = (Reference) i.next(); + OutputPane pane = (OutputPane) ref.get(); + if (pane != null) { + if (currFontSize == -1) { + currFontSize = pane.getFontSize(); + } + if (newFontSize == -1) { + newFontSize = positive? currFontSize + 1 : currFontSize - 1; + outputFontSize = Math.min (72, Math.max (6, newFontSize)); + } + pane.setupFont (false); + } else { + i.remove(); + } + } + } + + int getFontSize() { + return textView.getFont().getSize(); + } + + public void mouseWheelMoved(MouseWheelEvent e) { + if ((e.getModifiersEx() | InputEvent.SHIFT_DOWN_MASK) != 0) { + boolean positive = e.getWheelRotation() > 0; + changeFontSize (positive); + } else { + super.mouseWheelMoved(e); + } + } + + private static int outputFontSize = -1; + private void setupFont (boolean initializing) { + if (outputFontSize != -1) { + Font f = textView.getFont(); + if (f.getSize() != outputFontSize) { + float sz = outputFontSize; + String fontStr = System.getProperty ("nb.output.font"); + if (fontStr != null) { + f = new Font (fontStr, Font.PLAIN, textView.getFont().getSize()); + } + f = f.deriveFont(sz); + textView.setFont (f); + if (!initializing && textView.getEditorKit() instanceof OutputEditorKit) { + OutputEditorKit kit = (OutputEditorKit)textView.getEditorKit(); + View v = textView.getUI().getRootView(textView); + if (v instanceof WrappedTextView) { + ((WrappedTextView) v).setChanged(); + } + if (textView.isShowing()) { + textView.repaint(); + } + } + } + } Index: core/output2/src/org/netbeans/core/output2/ui/AbstractOutputPane.java =================================================================== RCS file: /cvs/core/output2/src/org/netbeans/core/output2/ui/AbstractOutputPane.java,v --- core/output2/src/org/netbeans/core/output2/ui/AbstractOutputPane.java 1.37 +++ core/output2/src/org/netbeans/core/output2/ui/AbstractOutputPane.java @@ -570,1 +570,1 @@ - public final void mouseWheelMoved(MouseWheelEvent e) { --- + public void mouseWheelMoved(MouseWheelEvent e) {