mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
New editor: restored CTRL+K (open sketch folder). Fixes #3103
This commit is contained in:
parent
03283bb098
commit
166c1aa7bb
@ -54,6 +54,7 @@ import processing.app.macosx.ThinkDifferent;
|
|||||||
import processing.app.packages.LibraryList;
|
import processing.app.packages.LibraryList;
|
||||||
import processing.app.packages.UserLibrary;
|
import processing.app.packages.UserLibrary;
|
||||||
import processing.app.syntax.PdeKeywords;
|
import processing.app.syntax.PdeKeywords;
|
||||||
|
import processing.app.syntax.SketchTextAreaDefaultInputMap;
|
||||||
import processing.app.tools.MenuScroller;
|
import processing.app.tools.MenuScroller;
|
||||||
import processing.app.tools.ZipDeflater;
|
import processing.app.tools.ZipDeflater;
|
||||||
|
|
||||||
@ -476,6 +477,8 @@ public class Base {
|
|||||||
} else if (parser.isGuiMode()) {
|
} else if (parser.isGuiMode()) {
|
||||||
splashScreenHelper.splashText(_("Starting..."));
|
splashScreenHelper.splashText(_("Starting..."));
|
||||||
|
|
||||||
|
installKeyboardInputMap();
|
||||||
|
|
||||||
// Check if there were previously opened sketches to be restored
|
// Check if there were previously opened sketches to be restored
|
||||||
restoreSketches();
|
restoreSketches();
|
||||||
|
|
||||||
@ -505,6 +508,10 @@ public class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void installKeyboardInputMap() {
|
||||||
|
UIManager.put("RSyntaxTextAreaUI.inputMap", new SketchTextAreaDefaultInputMap());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post-constructor setup for the editor area. Loads the last
|
* Post-constructor setup for the editor area. Loads the last
|
||||||
* sketch that was used (if any), and restores other Editor settings.
|
* sketch that was used (if any), and restores other Editor settings.
|
||||||
|
@ -150,17 +150,22 @@ public class SketchTextArea extends RSyntaxTextArea {
|
|||||||
// Removing the default focus traversal keys
|
// Removing the default focus traversal keys
|
||||||
// This is because the DefaultKeyboardFocusManager handles the keypress and consumes the event
|
// This is because the DefaultKeyboardFocusManager handles the keypress and consumes the event
|
||||||
protected void fixControlTab() {
|
protected void fixControlTab() {
|
||||||
KeyStroke ctrlTab = KeyStroke.getKeyStroke("ctrl TAB");
|
removeCTRLTabFromFocusTraversal();
|
||||||
KeyStroke ctrlShiftTab = KeyStroke.getKeyStroke("ctrl shift TAB");
|
|
||||||
|
|
||||||
// Remove ctrl-tab from normal focus traversal
|
removeCTRLSHIFTTabFromFocusTraversal();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeCTRLSHIFTTabFromFocusTraversal() {
|
||||||
|
KeyStroke ctrlShiftTab = KeyStroke.getKeyStroke("ctrl shift TAB");
|
||||||
|
Set<AWTKeyStroke> backwardKeys = new HashSet<AWTKeyStroke>(this.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS));
|
||||||
|
backwardKeys.remove(ctrlShiftTab);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeCTRLTabFromFocusTraversal() {
|
||||||
|
KeyStroke ctrlTab = KeyStroke.getKeyStroke("ctrl TAB");
|
||||||
Set<AWTKeyStroke> forwardKeys = new HashSet<AWTKeyStroke>(this.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
|
Set<AWTKeyStroke> forwardKeys = new HashSet<AWTKeyStroke>(this.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
|
||||||
forwardKeys.remove(ctrlTab);
|
forwardKeys.remove(ctrlTab);
|
||||||
this.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forwardKeys);
|
this.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forwardKeys);
|
||||||
|
|
||||||
// Remove ctrl-shift-tab from normal focus traversal
|
|
||||||
Set<AWTKeyStroke> backwardKeys = new HashSet<AWTKeyStroke>(this.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS));
|
|
||||||
backwardKeys.remove(ctrlShiftTab);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package processing.app.syntax;
|
||||||
|
|
||||||
|
import org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaDefaultInputMap;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
|
public class SketchTextAreaDefaultInputMap extends RSyntaxTextAreaDefaultInputMap {
|
||||||
|
|
||||||
|
public SketchTextAreaDefaultInputMap() {
|
||||||
|
int defaultMod = getDefaultModifier();
|
||||||
|
|
||||||
|
remove(KeyStroke.getKeyStroke(KeyEvent.VK_K, defaultMod));
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user