fix #47 Ouverture de Fichier par dessus un second

This commit is contained in:
Lucas Vbr
2022-02-28 08:24:24 +01:00
parent a62956d889
commit 0d481ace6c
3 changed files with 18 additions and 30 deletions
+1 -29
View File
@@ -4,37 +4,9 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" scope="TEST">
<library name="JUnit4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.13.1/junit-4.13.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library" scope="TEST">
<library name="JUnit5.7.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.7.0/junit-jupiter-5.7.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.7.0/junit-platform-commons-1.7.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.7.0/junit-jupiter-params-5.7.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.7.0/junit-jupiter-engine-5.7.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.7.0/junit-platform-engine-1.7.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="pdfbox-2.0" level="project" />
<orderEntry type="library" name="pdfbox" level="project" />
<orderEntry type="library" name="pdfbox-app-2.0.25" level="project" />
</component>
</module>
@@ -6,6 +6,7 @@
package lecteur_pdf.menuBar.menuItems;
import lecteur_pdf.GestionPdf;
import lecteur_pdf.IhmPdf;
import lecteur_pdf.SelectionnerFichier;
@@ -31,8 +32,19 @@ public class OuvrirFichier extends MenuItem {
super(parent, "Ouvrir");
addActionListener(e -> {
/* On charge le fichier si c'est possible */
File fichier = SelectionnerFichier.ouvrirFichier();
if (fichier != null && parent.getPdfPanel().chargerPdf(fichier)) {
if (fichier == null) {
return;
}
/* Si il y a deja un fichier d'ouvert, on le ferme */
parent.getPdfPanel().dechargerPdf();
parent.setTitle(GestionPdf.TITRE_APPLICATION);
parent.pack();
if (parent.getPdfPanel().chargerPdf(fichier)) {
parent.setTitle(fichier.getName());
parent.pack();
} else {
+4
View File
@@ -181,6 +181,10 @@ public class PdfPanel extends JPanel {
indexPageInput.setText("");
maxPageLabel.setText("/ -");
/* Efface les données relatives au zoom */
scaleSizing = 0.0f;
scaleZoom = 1.0f;
validate();
}