From 64699ab9b9d4adbb5008e6e71c8aec4962735ee6 Mon Sep 17 00:00:00 2001 From: MLEP Date: Fri, 2 Aug 2024 13:43:43 +0200 Subject: [PATCH 1/3] Update StandardActions.java : typo corrected (#11560) --- src/main/java/org/jabref/gui/actions/StandardActions.java | 2 +- src/main/resources/l10n/JabRef_en.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/actions/StandardActions.java b/src/main/java/org/jabref/gui/actions/StandardActions.java index 92d1923e52e..5c247a32147 100644 --- a/src/main/java/org/jabref/gui/actions/StandardActions.java +++ b/src/main/java/org/jabref/gui/actions/StandardActions.java @@ -94,7 +94,7 @@ public enum StandardActions implements Action { PARSE_LATEX(Localization.lang("Search for citations in LaTeX files..."), IconTheme.JabRefIcons.LATEX_CITATIONS), NEW_SUB_LIBRARY_FROM_AUX(Localization.lang("New sublibrary based on AUX file") + "...", Localization.lang("New BibTeX sublibrary") + Localization.lang("This feature generates a new library based on which entries are needed in an existing LaTeX document."), IconTheme.JabRefIcons.NEW), NEW_LIBRARY_FROM_PDF_ONLINE(Localization.lang("New library based on references in PDF file... (online)"), Localization.lang("This feature generates a new library based on the list of references in a PDF file. Thereby, it uses GROBID's functionality."), IconTheme.JabRefIcons.NEW), - NEW_LIBRARY_FROM_PDF_OFFLINE(Localization.lang("New library based on references in PDF file... (offline)"), Localization.lang("This feature generates a new library based on the list of references in a PDF file. Thereby, it uses JabRef's build-in functionality.."), IconTheme.JabRefIcons.NEW), + NEW_LIBRARY_FROM_PDF_OFFLINE(Localization.lang("New library based on references in PDF file... (offline)"), Localization.lang("This feature generates a new library based on the list of references in a PDF file. Thereby, it uses JabRef's built-in functionality."), IconTheme.JabRefIcons.NEW), WRITE_METADATA_TO_PDF(Localization.lang("Write metadata to PDF files"), Localization.lang("Will write metadata to the PDFs linked from selected entries."), KeyBinding.WRITE_METADATA_TO_PDF), START_NEW_STUDY(Localization.lang("Start new systematic literature review")), diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 36d64cacca7..74bb5fb8922 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -895,7 +895,7 @@ nested\ AUX\ files=nested AUX files New\ library\ based\ on\ references\ in\ PDF\ file...\ (offline)=New library based on references in PDF file... (offline) New\ library\ based\ on\ references\ in\ PDF\ file...\ (online)=New library based on references in PDF file... (online) This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ GROBID's\ functionality.=This feature generates a new library based on the list of references in a PDF file. Thereby, it uses GROBID's functionality. -This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ JabRef's\ build-in\ functionality..=This feature generates a new library based on the list of references in a PDF file. Thereby, it uses JabRef's build-in functionality.. +This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ JabRef's\ built-in\ functionality.=This feature generates a new library based on the list of references in a PDF file. Thereby, it uses JabRef's built-in functionality. Sublibrary\ from\ AUX\ to\ BibTeX=Sublibrary from AUX to BibTeX New\ BibTeX\ sublibrary=New BibTeX sublibrary From 60282b498a55bac4188ae0a37a4d2cb1da015158 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Fri, 2 Aug 2024 14:57:38 +0200 Subject: [PATCH 2/3] Fix window decorations (#11440) * Fix window decorations * Enable debug log * Check all screens * Debug output screens * Always save new window position * Save window state after fixing it * Fix casing * Update tinylog.properties * CHANGELOG.md --------- Co-authored-by: Oliver Kopp --- CHANGELOG.md | 1 + src/main/java/org/jabref/gui/JabRefGUI.java | 60 ++++++++++--------- .../jabref/preferences/GuiPreferences.java | 15 ----- .../jabref/preferences/JabRefPreferences.java | 4 -- 4 files changed, 32 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cebfa2df86b..86a0d559a7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We fixed an issue where the 'Check for updates' preference was not saved. [#11485](https://github.com/JabRef/jabref/pull/11485) - We fixed an issue where an exception was thrown after changing "show preview as a tab" in the preferences. [#11515](https://github.com/JabRef/jabref/pull/11515) - We fixed an issue where a new unsaved library was not marked with an asterisk [#11519](https://github.com/JabRef/jabref/pull/11519) +- We fixed an issue where JabRef starts without window decorations. [#11440](https://github.com/JabRef/jabref/pull/11440) ### Removed diff --git a/src/main/java/org/jabref/gui/JabRefGUI.java b/src/main/java/org/jabref/gui/JabRefGUI.java index 496bdc20334..66f3117790d 100644 --- a/src/main/java/org/jabref/gui/JabRefGUI.java +++ b/src/main/java/org/jabref/gui/JabRefGUI.java @@ -7,6 +7,7 @@ import javafx.application.Application; import javafx.application.Platform; +import javafx.geometry.Rectangle2D; import javafx.scene.Scene; import javafx.scene.input.KeyEvent; import javafx.stage.Screen; @@ -66,7 +67,6 @@ public class JabRefGUI extends Application { private static RemoteListenerServerManager remoteListenerServerManager; - private boolean correctedWindowPos = false; private Stage mainStage; public static void setup(List uiCommands, @@ -184,22 +184,29 @@ private void openWindow() { mainStage.setMinHeight(330); mainStage.setMinWidth(580); - mainStage.setFullScreen(guiPreferences.isWindowFullscreen()); - mainStage.setMaximized(guiPreferences.isWindowMaximised()); - if ((Screen.getScreens().size() == 1) && isWindowPositionOutOfBounds()) { - // corrects the Window, if it is outside the mainscreen - LOGGER.debug("The Jabref window is outside the main screen"); - mainStage.setX(0); - mainStage.setY(0); - mainStage.setWidth(1024); - mainStage.setHeight(768); - correctedWindowPos = true; + // maximized target state is stored, because "saveWindowState" saves x and y only if not maximized + boolean windowMaximised = guiPreferences.isWindowMaximised(); + + LOGGER.debug("Screens: {}", Screen.getScreens()); + debugLogWindowState(mainStage); + + if (isWindowPositionOutOfBounds()) { + LOGGER.debug("The JabRef window is outside of screen bounds. Position and size will be corrected. Main screen will be used."); + Rectangle2D bounds = Screen.getPrimary().getBounds(); + mainStage.setX(bounds.getMinX()); + mainStage.setY(bounds.getMinY()); + mainStage.setHeight(Math.min(bounds.getHeight(), 786.0)); + mainStage.setWidth(Math.min(bounds.getWidth(), 1024.0)); + saveWindowState(); } else { + LOGGER.debug("The JabRef window is inside screen bounds."); mainStage.setX(guiPreferences.getPositionX()); mainStage.setY(guiPreferences.getPositionY()); mainStage.setWidth(guiPreferences.getSizeX()); mainStage.setHeight(guiPreferences.getSizeY()); } + // after calling "saveWindowState" the maximized state can be set + mainStage.setMaximized(windowMaximised); debugLogWindowState(mainStage); Scene scene = new Scene(JabRefGUI.mainFrame); @@ -239,26 +246,20 @@ public void onCloseRequest(WindowEvent event) { } public void onHiding(WindowEvent event) { - if (!correctedWindowPos) { - // saves the window position only if its not corrected -> the window will rest at the old Position, - // if the external Screen is connected again. - saveWindowState(); - } - + saveWindowState(); preferencesService.flush(); - - // Goodbye! Platform.exit(); } private void saveWindowState() { GuiPreferences preferences = preferencesService.getGuiPreferences(); - preferences.setPositionX(mainStage.getX()); - preferences.setPositionY(mainStage.getY()); - preferences.setSizeX(mainStage.getWidth()); - preferences.setSizeY(mainStage.getHeight()); + if (!mainStage.isMaximized()) { + preferences.setPositionX(mainStage.getX()); + preferences.setPositionY(mainStage.getY()); + preferences.setSizeX(mainStage.getWidth()); + preferences.setSizeY(mainStage.getHeight()); + } preferences.setWindowMaximised(mainStage.isMaximized()); - preferences.setWindowFullScreen(mainStage.isFullScreen()); debugLogWindowState(mainStage); } @@ -281,13 +282,14 @@ private void debugLogWindowState(Stage mainStage) { /** * Tests if the window coordinates are out of the mainscreen - * - * @return outbounds */ private boolean isWindowPositionOutOfBounds() { - return !Screen.getPrimary().getBounds().contains( - preferencesService.getGuiPreferences().getPositionX(), - preferencesService.getGuiPreferences().getPositionY()); + // The upper right corner is checked as there are most probably the window controls. + GuiPreferences guiPreferences = preferencesService.getGuiPreferences(); + double rightX = guiPreferences.getPositionX() + guiPreferences.getSizeX(); + double topY = guiPreferences.getPositionY(); + return Screen.getScreens().stream().noneMatch((screen -> screen.getBounds().contains( + rightX, topY))); } // Background tasks diff --git a/src/main/java/org/jabref/preferences/GuiPreferences.java b/src/main/java/org/jabref/preferences/GuiPreferences.java index 31c349ccb2e..8f703027cad 100644 --- a/src/main/java/org/jabref/preferences/GuiPreferences.java +++ b/src/main/java/org/jabref/preferences/GuiPreferences.java @@ -23,7 +23,6 @@ public class GuiPreferences { private final DoubleProperty sizeY; private final BooleanProperty windowMaximised; - private final BooleanProperty windowFullScreen; // the last libraries that were open when jabref closes and should be reopened on startup private final ObservableList lastFilesOpened; @@ -39,7 +38,6 @@ public GuiPreferences(double positionX, double sizeX, double sizeY, boolean windowMaximised, - boolean windowFullScreen, List lastFilesOpened, Path lastFocusedFile, FileHistory fileHistory, @@ -50,7 +48,6 @@ public GuiPreferences(double positionX, this.sizeX = new SimpleDoubleProperty(sizeX); this.sizeY = new SimpleDoubleProperty(sizeY); this.windowMaximised = new SimpleBooleanProperty(windowMaximised); - this.windowFullScreen = new SimpleBooleanProperty(windowFullScreen); this.lastFilesOpened = FXCollections.observableArrayList(lastFilesOpened); this.lastFocusedFile = new SimpleObjectProperty<>(lastFocusedFile); this.lastSelectedIdBasedFetcher = new SimpleStringProperty(lastSelectedIdBasedFetcher); @@ -118,18 +115,6 @@ public void setWindowMaximised(boolean windowMaximised) { this.windowMaximised.set(windowMaximised); } - public BooleanProperty windowFullScreenProperty() { - return windowFullScreen; - } - - public void setWindowFullScreen(boolean windowFullScreen) { - this.windowFullScreen.set(windowFullScreen); - } - - public boolean isWindowFullscreen() { - return windowFullScreen.get(); - } - public ObservableList getLastFilesOpened() { return lastFilesOpened; } diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index 68c86020389..b87d1d254b4 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -184,7 +184,6 @@ public class JabRefPreferences implements PreferencesService { public static final String ENTRY_EDITOR_PREVIEW_DIVIDER_POS = "entryEditorPreviewDividerPos"; public static final String AUTO_RESIZE_MODE = "autoResizeMode"; public static final String WINDOW_MAXIMISED = "windowMaximised"; - public static final String WINDOW_FULLSCREEN = "windowFullscreen"; public static final String REFORMAT_FILE_ON_SAVE_AND_EXPORT = "reformatFileOnSaveAndExport"; public static final String EXPORT_IN_ORIGINAL_ORDER = "exportInOriginalOrder"; @@ -620,7 +619,6 @@ private JabRefPreferences() { defaults.put(SIZE_X, 1024); defaults.put(SIZE_Y, 768); defaults.put(WINDOW_MAXIMISED, Boolean.TRUE); - defaults.put(WINDOW_FULLSCREEN, Boolean.FALSE); defaults.put(AUTO_RESIZE_MODE, Boolean.FALSE); // By default disable "Fit table horizontally on the screen" defaults.put(ENTRY_EDITOR_HEIGHT, 0.65); defaults.put(ENTRY_EDITOR_PREVIEW_DIVIDER_POS, 0.5); @@ -2617,7 +2615,6 @@ public GuiPreferences getGuiPreferences() { getDouble(SIZE_X), getDouble(SIZE_Y), getBoolean(WINDOW_MAXIMISED), - getBoolean(WINDOW_FULLSCREEN), getStringList(LAST_EDITED).stream() .map(Path::of) .collect(Collectors.toList()), @@ -2631,7 +2628,6 @@ public GuiPreferences getGuiPreferences() { EasyBind.listen(guiPreferences.sizeXProperty(), (obs, oldValue, newValue) -> putDouble(SIZE_X, newValue.doubleValue())); EasyBind.listen(guiPreferences.sizeYProperty(), (obs, oldValue, newValue) -> putDouble(SIZE_Y, newValue.doubleValue())); EasyBind.listen(guiPreferences.windowMaximisedProperty(), (obs, oldValue, newValue) -> putBoolean(WINDOW_MAXIMISED, newValue)); - EasyBind.listen(guiPreferences.windowFullScreenProperty(), (obs, oldValue, newValue) -> putBoolean(WINDOW_FULLSCREEN, newValue)); guiPreferences.getLastFilesOpened().addListener((ListChangeListener) change -> { if (change.getList().isEmpty()) { prefs.remove(LAST_EDITED); From 3f4f0b0b37f2b716502fb41b0f0b5d70e8b9cce5 Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 2 Aug 2024 16:05:37 +0200 Subject: [PATCH 3/3] New Crowdin updates (#11566) * New translations jabref_en.properties (French) * New translations jabref_en.properties (German) * New translations jabref_en.properties (Italian) * New translations jabref_en.properties (Polish) * New translations jabref_en.properties (Portuguese, Brazilian) --- src/main/resources/l10n/JabRef_de.properties | 1 - src/main/resources/l10n/JabRef_fr.properties | 1 - src/main/resources/l10n/JabRef_it.properties | 2 +- src/main/resources/l10n/JabRef_pl.properties | 1 - src/main/resources/l10n/JabRef_pt_BR.properties | 1 - 5 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/resources/l10n/JabRef_de.properties b/src/main/resources/l10n/JabRef_de.properties index 773869e6f5c..39e81c05da5 100644 --- a/src/main/resources/l10n/JabRef_de.properties +++ b/src/main/resources/l10n/JabRef_de.properties @@ -895,7 +895,6 @@ nested\ AUX\ files=referenzierte AUX Dateien New\ library\ based\ on\ references\ in\ PDF\ file...\ (offline)=Neue Bibliothek basierend auf Referenzen in PDF-Datei... (offline) New\ library\ based\ on\ references\ in\ PDF\ file...\ (online)=Neue Bibliothek basierend auf Referenzen in PDF-Dateien... (online) This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ GROBID's\ functionality.=Dieses Feature generiert eine neue Bibliothek, basierend auf der Liste der Referenzen in einer PDF-Datei. Dabei verwendet es die Funktionalität von GROBID. -This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ JabRef's\ build-in\ functionality..=Diese Funktion generiert eine neue Bibliothek, basierend auf der Liste der Referenzen in einer PDF-Datei. Dabei verwendet es die integrierte Funktionalität von JabRef. Sublibrary\ from\ AUX\ to\ BibTeX=Subbibliothek von AUX bis BibTeX New\ BibTeX\ sublibrary=Neue BibTeX-Teilbibliothek diff --git a/src/main/resources/l10n/JabRef_fr.properties b/src/main/resources/l10n/JabRef_fr.properties index 4b0a2566a16..3d224022cbb 100644 --- a/src/main/resources/l10n/JabRef_fr.properties +++ b/src/main/resources/l10n/JabRef_fr.properties @@ -895,7 +895,6 @@ nested\ AUX\ files=fichiers AUX imbriqués New\ library\ based\ on\ references\ in\ PDF\ file...\ (offline)=Nouveau fichier basé sur les références dans le fichier PDF... (hors ligne) New\ library\ based\ on\ references\ in\ PDF\ file...\ (online)=Nouveau fichier basé sur les références dans le fichier PDF... (en ligne) This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ GROBID's\ functionality.=Cette fonction génère un nouveau fichier basé sur la liste des références dans un fichier PDF. Pour cela, elle utilise les fonctionnalités de GROBID. -This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ JabRef's\ build-in\ functionality..=Cette fonction génère un nouveau fichier basé sur la liste des références dans un fichier PDF. Sublibrary\ from\ AUX\ to\ BibTeX=Sous-fichier à partir du AUX vers BibTeX New\ BibTeX\ sublibrary=Nouveau sous-fichier BibTeX diff --git a/src/main/resources/l10n/JabRef_it.properties b/src/main/resources/l10n/JabRef_it.properties index 61596fd266d..be3b3fb74d6 100644 --- a/src/main/resources/l10n/JabRef_it.properties +++ b/src/main/resources/l10n/JabRef_it.properties @@ -895,7 +895,7 @@ nested\ AUX\ files=File AUX nidificati New\ library\ based\ on\ references\ in\ PDF\ file...\ (offline)=Nuova libreria basata sui riferimenti nel file PDF... (offline) New\ library\ based\ on\ references\ in\ PDF\ file...\ (online)=Nuova libreria basata sui riferimenti nel file PDF... (offline) This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ GROBID's\ functionality.=Questa funzionalità genera una nuova libreria basata sulla lista di riferimenti in un file PDF. In questo modo utilizza la funzionalità di GROBID. -This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ JabRef's\ build-in\ functionality..=Questa funzionalità genera una nuova libreria basata sull'elenco dei riferimenti in un file PDF. A tal fine, utilizza la funzionalità integrata di JabRef. +This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ JabRef's\ built-in\ functionality.=Questa funzionalità genera una nuova libreria basata sull'elenco dei riferimenti in un file PDF. A tal fine, essa utilizza la funzionalità integrata di JabRef. Sublibrary\ from\ AUX\ to\ BibTeX=Sotto-libreria da AUX a BibTeX New\ BibTeX\ sublibrary=Nuova sottolibreria BibTeX diff --git a/src/main/resources/l10n/JabRef_pl.properties b/src/main/resources/l10n/JabRef_pl.properties index bb9a49896c8..c008cb34997 100644 --- a/src/main/resources/l10n/JabRef_pl.properties +++ b/src/main/resources/l10n/JabRef_pl.properties @@ -856,7 +856,6 @@ nested\ AUX\ files=zagnieżdżone pliki AUX New\ library\ based\ on\ references\ in\ PDF\ file...\ (offline)=Nowa biblioteka oparta na referencjach w pliku PDF... (offline) New\ library\ based\ on\ references\ in\ PDF\ file...\ (online)=Nowa biblioteka oparta na referencjach w pliku PDF... (online) This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ GROBID's\ functionality.=Ta funkcja generuje nową bibliotekę na podstawie listy referencji w pliku PDF. W związku z tym korzysta z funkcji GROBID. -This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ JabRef's\ build-in\ functionality..=Ta funkcja generuje nową bibliotekę na podstawie listy referencji w pliku PDF. W związku z tym używa wbudowanej funkcjonalności JabRef.. New\ BibTeX\ sublibrary=Nowa pod-biblioteka BibTeX diff --git a/src/main/resources/l10n/JabRef_pt_BR.properties b/src/main/resources/l10n/JabRef_pt_BR.properties index 2871e2d96ed..ac126025e0e 100644 --- a/src/main/resources/l10n/JabRef_pt_BR.properties +++ b/src/main/resources/l10n/JabRef_pt_BR.properties @@ -895,7 +895,6 @@ nested\ AUX\ files=arquivos AUXiliares aninhados New\ library\ based\ on\ references\ in\ PDF\ file...\ (offline)=Nova biblioteca baseada em referências em arquivo PDF... (off-line) New\ library\ based\ on\ references\ in\ PDF\ file...\ (online)=Nova biblioteca baseada em referências em arquivo PDF... (online) This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ GROBID's\ functionality.=Esta funcionalidade gera uma nova biblioteca com base na lista de referências em um arquivo PDF. Por isso, ela usa a funcionalidade do GROBID. -This\ feature\ generates\ a\ new\ library\ based\ on\ the\ list\ of\ references\ in\ a\ PDF\ file.\ Thereby,\ it\ uses\ JabRef's\ build-in\ functionality..=Esta funcionalidade gera uma nova biblioteca com base na lista de referências em um arquivo PDF. Assim, ela utiliza a funcionalidade integrada do JabRef.. Sublibrary\ from\ AUX\ to\ BibTeX=Subbiblioteca de AUX para BibTeX New\ BibTeX\ sublibrary=Nova sub-base de dados BibTeX