diff --git a/CHANGELOG.md b/CHANGELOG.md index 445a5983b3c..a4f3bc78fbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We added a feature that allows the user to copy highlighted text in the preview window. [#6962](https://github.com/JabRef/jabref/issues/6962) - We added a feature that allows you to create new BibEntry via paste arxivId [#2292](https://github.com/JabRef/jabref/issues/2292) - We added a feature that allows the user to choose whether to trust the target site when unable to find a valid certification path from the file download site. [#7616](https://github.com/JabRef/jabref/issues/7616) +- We added a keybinding preset for new entries. [#7705](https://github.com/JabRef/jabref/issues/7705) ### Changed @@ -36,6 +37,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - Automatically found pdf files now have the linking button to the far left and uses a link icon with a plus instead of a briefcase. The file name also has lowered opacity(70%) until added. [#3607](https://github.com/JabRef/jabref/issues/3607) - We simplified the select entry type form by splitting it into two parts ("Recommended" and "Others") based on internal usage data. [#6730](https://github.com/JabRef/jabref/issues/6730) - The export to MS Office XML now uses the month name for the field `Month` instead of the two digit number [forum#2685](https://discourse.jabref.org/t/export-month-as-text-not-number/2685) +- We reintroduced missing default keybindings for new entries. [#7346](https://github.com/JabRef/jabref/issues/7346) [#7439](https://github.com/JabRef/jabref/issues/7439) - Lists of available fields are now sorted alphabetically. [#7716](https://github.com/JabRef/jabref/issues/7716) ### Fixed diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java index 026d4ba3a5d..7665da90056 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java @@ -189,7 +189,7 @@ private void setupKeyBindings() { event.consume(); break; case CLOSE: - case CLOSE_ENTRY: + case EDIT_ENTRY: close(); event.consume(); break; diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java index d6de24e3e62..1aa41a08ae6 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java @@ -29,7 +29,6 @@ public enum KeyBinding { CHECK_INTEGRITY("Check integrity", Localization.lang("Check integrity"), "ctrl+F8", KeyBindingCategory.QUALITY), CLEANUP("Cleanup", Localization.lang("Cleanup entries"), "alt+F8", KeyBindingCategory.QUALITY), CLOSE_DATABASE("Close library", Localization.lang("Close library"), "ctrl+W", KeyBindingCategory.FILE), - CLOSE_ENTRY("Close entry", Localization.lang("Close entry"), "ctrl+E", KeyBindingCategory.VIEW), CLOSE("Close dialog", Localization.lang("Close dialog"), "Esc", KeyBindingCategory.VIEW), COPY("Copy", Localization.lang("Copy"), "ctrl+C", KeyBindingCategory.EDIT), COPY_TITLE("Copy title", Localization.lang("Copy title"), "ctrl+shift+alt+T", KeyBindingCategory.EDIT), @@ -44,7 +43,7 @@ public enum KeyBinding { DELETE_ENTRY("Delete entry", Localization.lang("Delete entry"), "DELETE", KeyBindingCategory.BIBTEX), DEFAULT_DIALOG_ACTION("Execute default action in dialog", Localization.lang("Execute default action in dialog"), "ctrl+ENTER", KeyBindingCategory.VIEW), DOWNLOAD_FULL_TEXT("Download full text documents", Localization.lang("Download full text documents"), "alt+F7", KeyBindingCategory.QUALITY), - EDIT_ENTRY("Edit entry", Localization.lang("Edit entry"), "ctrl+E", KeyBindingCategory.BIBTEX), + EDIT_ENTRY("Open / close entry editor", Localization.lang("Open / close entry editor"), "ctrl+E", KeyBindingCategory.VIEW), EXPORT("Export", Localization.lang("Export"), "ctrl+alt+e", KeyBindingCategory.FILE), EXPORT_SELECTED("Export Selected", Localization.lang("Export selected entries"), "ctrl+shift+e", KeyBindingCategory.FILE), EDIT_STRINGS("Edit strings", Localization.lang("Edit strings"), "ctrl+T", KeyBindingCategory.BIBTEX), @@ -61,17 +60,19 @@ public enum KeyBinding { IMPORT_INTO_CURRENT_DATABASE("Import into current library", Localization.lang("Import into current library"), "ctrl+I", KeyBindingCategory.FILE), IMPORT_INTO_NEW_DATABASE("Import into new library", Localization.lang("Import into new library"), "ctrl+alt+I", KeyBindingCategory.FILE), MERGE_ENTRIES("Merge entries", Localization.lang("Merge entries"), "ctrl+M", KeyBindingCategory.TOOLS), + NEW_ARTICLE("New article", Localization.lang("New article"), "ctrl+shift+A", KeyBindingCategory.BIBTEX), NEW_BOOK("New book", Localization.lang("New book"), "ctrl+shift+B", KeyBindingCategory.BIBTEX), NEW_ENTRY("New entry", Localization.lang("New entry"), "ctrl+N", KeyBindingCategory.BIBTEX), NEW_ENTRY_FROM_PLAIN_TEXT("New entry from plain text", Localization.lang("New entry from plain text"), "ctrl+shift+N", KeyBindingCategory.BIBTEX), - NEW_INBOOK("New inbook", Localization.lang("New inbook"), "", KeyBindingCategory.BIBTEX), - NEW_MASTERSTHESIS("New mastersthesis", Localization.lang("New mastersthesis"), "", KeyBindingCategory.BIBTEX), - NEW_PHDTHESIS("New phdthesis", Localization.lang("New phdthesis"), "", KeyBindingCategory.BIBTEX), - NEW_PROCEEDINGS("New proceedings", Localization.lang("New proceedings"), "", KeyBindingCategory.BIBTEX), - NEW_UNPUBLISHED("New unpublished", Localization.lang("New unpublished"), "", KeyBindingCategory.BIBTEX), + NEW_INBOOK("New inbook", Localization.lang("New inbook"), "ctrl+shift+I", KeyBindingCategory.BIBTEX), + NEW_MASTERSTHESIS("New mastersthesis", Localization.lang("New mastersthesis"), "ctrl+shift+M", KeyBindingCategory.BIBTEX), + NEW_PHDTHESIS("New phdthesis", Localization.lang("New phdthesis"), "ctrl+shift+T", KeyBindingCategory.BIBTEX), + NEW_PROCEEDINGS("New proceedings", Localization.lang("New proceedings"), "ctrl+shift+P", KeyBindingCategory.BIBTEX), + NEW_UNPUBLISHED("New unpublished", Localization.lang("New unpublished"), "ctrl+shift+U", KeyBindingCategory.BIBTEX), NEW_TECHREPORT("New technical report", Localization.lang("New technical report"), "", KeyBindingCategory.BIBTEX), NEW_INPROCEEDINGS("New inproceesings", Localization.lang("New inproceedings"), "", KeyBindingCategory.BIBTEX), + NEXT_PREVIEW_LAYOUT("Next preview layout", Localization.lang("Next preview layout"), "F9", KeyBindingCategory.VIEW), NEXT_LIBRARY("Next library", Localization.lang("Next library"), "ctrl+PAGE_DOWN", KeyBindingCategory.VIEW), OPEN_CONSOLE("Open terminal here", Localization.lang("Open terminal here"), "ctrl+shift+L", KeyBindingCategory.TOOLS), diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTabViewModel.java b/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTabViewModel.java index e5cd3ab63a2..cf7332d5432 100644 --- a/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTabViewModel.java @@ -21,6 +21,7 @@ import org.jabref.gui.preferences.PreferenceTabViewModel; import org.jabref.gui.preferences.keybindings.presets.BashKeyBindingPreset; import org.jabref.gui.preferences.keybindings.presets.KeyBindingPreset; +import org.jabref.gui.preferences.keybindings.presets.NewEntryBindingPreset; import org.jabref.gui.util.OptionalObjectProperty; import org.jabref.logic.l10n.Localization; import org.jabref.preferences.PreferencesService; @@ -45,6 +46,7 @@ public KeyBindingsTabViewModel(KeyBindingRepository keyBindingRepository, Dialog this.preferences = Objects.requireNonNull(preferences); keyBindingPresets.add(new BashKeyBindingPreset()); + keyBindingPresets.add(new NewEntryBindingPreset()); } /** diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/presets/BashKeyBindingPreset.java b/src/main/java/org/jabref/gui/preferences/keybindings/presets/BashKeyBindingPreset.java index eceaa0d577f..72265447c39 100644 --- a/src/main/java/org/jabref/gui/preferences/keybindings/presets/BashKeyBindingPreset.java +++ b/src/main/java/org/jabref/gui/preferences/keybindings/presets/BashKeyBindingPreset.java @@ -7,29 +7,6 @@ public class BashKeyBindingPreset implements KeyBindingPreset { - private static final Map KEY_BINDINGS = new HashMap<>(); - - static { - KEY_BINDINGS.put(KeyBinding.EDITOR_DELETE, "ctrl+D"); - // DELETE BACKWARDS = Rubout - KEY_BINDINGS.put(KeyBinding.EDITOR_BACKWARD, "ctrl+B"); - KEY_BINDINGS.put(KeyBinding.EDITOR_FORWARD, "ctrl+F"); - KEY_BINDINGS.put(KeyBinding.EDITOR_WORD_BACKWARD, "alt+B"); - KEY_BINDINGS.put(KeyBinding.EDITOR_WORD_FORWARD, "alt+F"); - KEY_BINDINGS.put(KeyBinding.EDITOR_BEGINNING, "ctrl+A"); - KEY_BINDINGS.put(KeyBinding.EDITOR_END, "ctrl+E"); - KEY_BINDINGS.put(KeyBinding.EDITOR_BEGINNING_DOC, "alt+LESS"); - KEY_BINDINGS.put(KeyBinding.EDITOR_END_DOC, "alt+shift+LESS"); - KEY_BINDINGS.put(KeyBinding.EDITOR_UP, "ctrl+P"); - KEY_BINDINGS.put(KeyBinding.EDITOR_DOWN, "ctrl+N"); - KEY_BINDINGS.put(KeyBinding.EDITOR_CAPITALIZE, "alt+C"); - KEY_BINDINGS.put(KeyBinding.EDITOR_LOWERCASE, "alt+L"); - KEY_BINDINGS.put(KeyBinding.EDITOR_UPPERCASE, "alt+U"); - KEY_BINDINGS.put(KeyBinding.EDITOR_KILL_LINE, "ctrl+K"); - KEY_BINDINGS.put(KeyBinding.EDITOR_KILL_WORD, "alt+D"); - KEY_BINDINGS.put(KeyBinding.EDITOR_KILL_WORD_BACKWARD, "alt+DELETE"); - } - @Override public String getName() { return "Bash"; @@ -37,6 +14,27 @@ public String getName() { @Override public Map getKeyBindings() { - return KEY_BINDINGS; + final Map keyBindings = new HashMap<>(); + + keyBindings.put(KeyBinding.EDITOR_DELETE, "ctrl+D"); + // DELETE BACKWARDS = Rubout + keyBindings.put(KeyBinding.EDITOR_BACKWARD, "ctrl+B"); + keyBindings.put(KeyBinding.EDITOR_FORWARD, "ctrl+F"); + keyBindings.put(KeyBinding.EDITOR_WORD_BACKWARD, "alt+B"); + keyBindings.put(KeyBinding.EDITOR_WORD_FORWARD, "alt+F"); + keyBindings.put(KeyBinding.EDITOR_BEGINNING, "ctrl+A"); + keyBindings.put(KeyBinding.EDITOR_END, "ctrl+E"); + keyBindings.put(KeyBinding.EDITOR_BEGINNING_DOC, "alt+LESS"); + keyBindings.put(KeyBinding.EDITOR_END_DOC, "alt+shift+LESS"); + keyBindings.put(KeyBinding.EDITOR_UP, "ctrl+P"); + keyBindings.put(KeyBinding.EDITOR_DOWN, "ctrl+N"); + keyBindings.put(KeyBinding.EDITOR_CAPITALIZE, "alt+C"); + keyBindings.put(KeyBinding.EDITOR_LOWERCASE, "alt+L"); + keyBindings.put(KeyBinding.EDITOR_UPPERCASE, "alt+U"); + keyBindings.put(KeyBinding.EDITOR_KILL_LINE, "ctrl+K"); + keyBindings.put(KeyBinding.EDITOR_KILL_WORD, "alt+D"); + keyBindings.put(KeyBinding.EDITOR_KILL_WORD_BACKWARD, "alt+DELETE"); + + return keyBindings; } } diff --git a/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java new file mode 100644 index 00000000000..c86f0647cc0 --- /dev/null +++ b/src/main/java/org/jabref/gui/preferences/keybindings/presets/NewEntryBindingPreset.java @@ -0,0 +1,39 @@ +package org.jabref.gui.preferences.keybindings.presets; + +import java.util.HashMap; +import java.util.Map; + +import org.jabref.gui.keyboard.KeyBinding; +import org.jabref.logic.l10n.Localization; + +public class NewEntryBindingPreset implements KeyBindingPreset { + + @Override + public String getName() { + return Localization.lang("New entry by type"); + } + + @Override + public Map getKeyBindings() { + final Map keyBindings = new HashMap<>(); + + // Clear conflicting default presets + keyBindings.put(KeyBinding.PULL_CHANGES_FROM_SHARED_DATABASE, ""); + keyBindings.put(KeyBinding.COPY_PREVIEW, ""); + + // Add new entry presets + keyBindings.put(KeyBinding.NEW_ARTICLE, "ctrl+shift+A"); + keyBindings.put(KeyBinding.NEW_BOOK, "ctrl+shift+B"); + keyBindings.put(KeyBinding.NEW_ENTRY, "ctrl+N"); + keyBindings.put(KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT, "ctrl+shift+N"); + keyBindings.put(KeyBinding.NEW_INBOOK, "ctrl+shift+I"); + keyBindings.put(KeyBinding.NEW_INPROCEEDINGS, "ctrl+shift+C"); + keyBindings.put(KeyBinding.NEW_MASTERSTHESIS, "ctrl+shift+M"); + keyBindings.put(KeyBinding.NEW_PHDTHESIS, "ctrl+shift+T"); + keyBindings.put(KeyBinding.NEW_PROCEEDINGS, "ctrl+shift+P"); + keyBindings.put(KeyBinding.NEW_TECHREPORT, "ctrl+shift+R"); + keyBindings.put(KeyBinding.NEW_UNPUBLISHED, "ctrl+shift+U"); + + return keyBindings; + } +} diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 7bbc176507b..bd8194bb584 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -137,7 +137,7 @@ Clear=Clear Clear\ fields=Clear fields -Close\ entry=Close entry +Open\ /\ close\ entry\ editor=Open / close entry editor Close\ dialog=Close dialog @@ -269,7 +269,6 @@ Each\ line\ must\ be\ of\ the\ following\ form\:\ \'tab\:field1;field2;...;field Edit=Edit -Edit\ entry=Edit entry Edit\ file\ type=Edit file type Edit\ group=Edit group @@ -2300,3 +2299,4 @@ Download\ operation\ canceled.=Download operation canceled. Convert\ timestamp\ field\ to\ field\ 'creationdate'=Convert timestamp field to field 'creationdate' Convert\ timestamp\ field\ to\ field\ 'modificationdate'=Convert timestamp field to field 'modificationdate' +New\ entry\ by\ type=New entry by type