This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 29604
Collapse All | Expand All

(-)core/output2/src/org/netbeans/core/output2/Bundle.properties (+6 lines)
Line 58 Link Here
58
ACTION_INCREASE_FONT=Increase Font Size
59
ACTION_DECREASE_FONT=Decrease Font Size
Line 71 Link Here
73
ACTION_INCREASE_FONT.accel=C-EQUALS
74
ACTION_DECREASE_FONT.accel=C-MINUS
Line 84 Link Here
88
ACTION_INCREASE_FONT.accel.mac=C-EQUALS
89
ACTION_DECREASE_FONT.accel.mac=C-MINUS
(-)core/output2/src/org/netbeans/core/output2/Controller.java (-6 / +20 lines)
Line 94 Link Here
94
    private static final int ACTION_INCREASE_FONT = 15;
95
    private static final int ACTION_DECREASE_FONT = 16;
Line 95 Link Here
95
//    private static final int ACTION_TO_EDITOR = 15;
97
//    private static final int ACTION_TO_EDITOR = 17;
96
--
Line 129 Link Here
131
    
132
    Action increaseFontAction = new ControllerAction (ACTION_INCREASE_FONT, 
133
            "ACTION_INCREASE_FONT"); //NOI18N
134
    Action decreaseFontAction = new ControllerAction (ACTION_DECREASE_FONT, 
135
            "ACTION_DECREASE_FONT"); //NOI18N
136
    
Line 137 Link Here
137
        wrapAction, new JSeparator(), saveAsAction, clearAction, closeAction,
145
        wrapAction, increaseFontAction, decreaseFontAction,
138
--
146
        new JSeparator(), saveAsAction, clearAction, closeAction,
Line 142 Link Here
142
        findPreviousAction, wrapAction, saveAsAction, closeAction,
151
        findPreviousAction, wrapAction, increaseFontAction, decreaseFontAction,
143
--
152
        saveAsAction, closeAction,
Line 432 Link Here
442
            case ACTION_INCREASE_FONT :
443
                OutputPane.changeFontSize(true);
444
                break;
445
            case ACTION_DECREASE_FONT :
446
                OutputPane.changeFontSize(false);
447
                break;
448
                
(-)core/output2/src/org/netbeans/core/output2/OutputPane.java (+76 lines)
Line 17 Link Here
17
import java.util.Iterator;
Line 28 Link Here
29
import java.awt.event.InputEvent;
30
import java.awt.event.MouseWheelEvent;
31
import java.lang.ref.Reference;
32
import java.lang.ref.WeakReference;
33
import java.util.HashSet;
34
import java.util.Set;
35
import javax.swing.text.View;
Line 31 Link Here
39
    
40
    OutputPane() {
41
        registry.add (new WeakReference(this));
42
    }
43
    
Line 172 Link Here
185
        setupFont(true);
Line 174 Link Here
188
    }
189
    
190
    private static Set registry = new HashSet();
191
    
192
    static void changeFontSize (boolean positive) {
193
        int currFontSize = outputFontSize;
194
        int newFontSize = -1;
195
        for (Iterator i = registry.iterator(); i.hasNext();) {
196
            Reference ref = (Reference) i.next();
197
            OutputPane pane = (OutputPane) ref.get();
198
            if (pane != null) {
199
                if (currFontSize == -1) {
200
                    currFontSize = pane.getFontSize();
201
                }
202
                if (newFontSize == -1) {
203
                    newFontSize = positive? currFontSize + 1 : currFontSize - 1;
204
                    outputFontSize = Math.min (72, Math.max (6, newFontSize));
205
                }
206
                pane.setupFont (false);
207
            } else {
208
                i.remove();
209
            }
210
        }
211
    }
212
    
213
    int getFontSize() {
214
        return textView.getFont().getSize();
215
    }
216
    
217
    public void mouseWheelMoved(MouseWheelEvent e) {
218
        if ((e.getModifiersEx() | InputEvent.SHIFT_DOWN_MASK) != 0) {
219
            boolean positive = e.getWheelRotation() > 0;
220
            changeFontSize (positive);
221
        } else {
222
            super.mouseWheelMoved(e);
223
        }
224
    }    
225
    
226
    private static int outputFontSize = -1;
227
    private void setupFont (boolean initializing) {
228
        if (outputFontSize != -1) {
229
            Font f = textView.getFont();
230
            if (f.getSize() != outputFontSize) {
231
                float sz = outputFontSize;
232
                String fontStr = System.getProperty ("nb.output.font");
233
                if (fontStr != null) {
234
                    f = new Font (fontStr, Font.PLAIN, textView.getFont().getSize());
235
                }
236
                f = f.deriveFont(sz);
237
                textView.setFont (f);
238
                if (!initializing && textView.getEditorKit() instanceof OutputEditorKit) {
239
                    OutputEditorKit kit = (OutputEditorKit)textView.getEditorKit();
240
                    View v = textView.getUI().getRootView(textView);
241
                    if (v instanceof WrappedTextView) {
242
                        ((WrappedTextView) v).setChanged();
243
                    }
244
                    if (textView.isShowing()) {
245
                        textView.repaint();
246
                    }
247
                }
248
            }
249
        }
(-)core/output2/src/org/netbeans/core/output2/ui/AbstractOutputPane.java (-2 / +1 lines)
Line 570 Link Here
570
    public final void mouseWheelMoved(MouseWheelEvent e) {
570
    public void mouseWheelMoved(MouseWheelEvent e) {
571
--

Return to bug 29604