diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties index 840704e39ef57bfafca53775601d2e049e15273e..54c6d96fe4c12ad51b669fb36558940d82be8100 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties @@ -85,7 +85,7 @@ MediaViewImagePanel.zoomTextField.text= MediaViewImagePanel.rotationTextField.text= MediaViewImagePanel.rotateLeftButton.toolTipText= HtmlPanel.showImagesToggleButton.text=Download Images -MediaViewImagePanel.tagsMenu.text_1=Tags Menu +MediaViewImagePanel.tagsMenu.text_1=Image Tagging MediaPlayerPanel.progressLabel.text=00:00:00/00:00:00 MediaPlayerPanel.audioSlider.toolTipText= MediaPlayerPanel.rewindButton.text= @@ -940,3 +940,5 @@ manager.properties.brokenProperty = Broken default property {0} value: {1} manager.properties.missingProperty = Missing default property {0} value: {1} +MediaViewImagePanel.tagsMenu.toolTipText=Create and modify tags specific to selected areas in the image. +MediaViewImagePanel.tagsMenu.actionCommand=Image Tagging diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED index be121574740c2aa6f082bebb85e982a39a93936d..26dfd8bd80b7b0561c998dd89fc43457115fc727 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED @@ -60,8 +60,13 @@ MediaViewImagePanel.exportTagOption=Export MediaViewImagePanel.externalViewerButton.text=Open in External Viewer Ctrl+E MediaViewImagePanel.fileChooserTitle=Choose a save location MediaViewImagePanel.hideTagOption=Hide +MediaViewImagePanel.showTagOption=Show MediaViewImagePanel.successfulExport=Tagged image was successfully saved. MediaViewImagePanel.unsuccessfulExport=Unable to export tagged image to disk. +MediaViewImagePanel_createMenu_tooltip_text=<html>Create an image area specific tag by right clicking<br>and dragging to select the area in the image to be tagged.</html> +MediaViewImagePanel_deleteMenu_tooltip_text=Delete the selected image area tag. +MediaViewImagePanel_exportMenu_tooltip_text=Export the image including the tagged areas. +MediaViewImagePanel_hideMenu_tooltip_text=Hide or show the tagged image areas. MediaViewVideoPanel.pauseButton.text=\u25ba MediaViewVideoPanel.progressLabel.text=00:00 MediaViewVideoPanel.infoLabel.text=info @@ -151,7 +156,7 @@ MediaViewImagePanel.zoomTextField.text= MediaViewImagePanel.rotationTextField.text= MediaViewImagePanel.rotateLeftButton.toolTipText= HtmlPanel.showImagesToggleButton.text=Download Images -MediaViewImagePanel.tagsMenu.text_1=Tags Menu +MediaViewImagePanel.tagsMenu.text_1=Image Tagging MediaPlayerPanel.progressLabel.text=00:00:00/00:00:00 MediaPlayerPanel.audioSlider.toolTipText= MediaPlayerPanel.rewindButton.text= @@ -1014,3 +1019,5 @@ manager.properties.brokenProperty = Broken default property {0} value: {1} manager.properties.missingProperty = Missing default property {0} value: {1} +MediaViewImagePanel.tagsMenu.toolTipText=Create and modify tags specific to selected areas in the image. +MediaViewImagePanel.tagsMenu.actionCommand=Image Tagging diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaViewImagePanel.form b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaViewImagePanel.form index b157f7a0339320987e7e8dace0aa975003b498db..77149bbde44b26908f6551b31c591f24d114e12a 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaViewImagePanel.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaViewImagePanel.form @@ -221,17 +221,14 @@ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="MediaViewImagePanel.tagsMenu.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> </Property> - <Property name="focusable" type="boolean" value="false"/> - <Property name="horizontalTextPosition" type="int" value="0"/> - <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> - <Dimension value="[75, 21]"/> - </Property> - <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> - <Dimension value="[75, 21]"/> + <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="MediaViewImagePanel.tagsMenu.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> </Property> - <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> - <Dimension value="[75, 21]"/> + <Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="MediaViewImagePanel.tagsMenu.actionCommand" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> </Property> + <Property name="focusable" type="boolean" value="false"/> + <Property name="horizontalTextPosition" type="int" value="0"/> <Property name="verticalTextPosition" type="int" value="3"/> </Properties> <Events> diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaViewImagePanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaViewImagePanel.java index a388a284321757263245cf178907a8ad3c805a26..db9ac2234bc334f9a29fd472806e39d32f588be0 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaViewImagePanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaViewImagePanel.java @@ -121,6 +121,8 @@ class MediaViewImagePanel extends JPanel implements MediaFileViewer.MediaViewPan private static final Image openInExternalViewerButtonImage = new Image(MediaViewImagePanel.class.getResource("/org/sleuthkit/autopsy/images/external.png").toExternalForm()); //NOI18N private final boolean jfxIsInited = org.sleuthkit.autopsy.core.Installer.isJavaFxInited(); private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + + private static final int TAG_POPUP_WIDTH = 200; /* * Threading policy: JFX UI components, must be accessed in JFX thread only. @@ -208,7 +210,13 @@ class MediaViewImagePanel extends JPanel implements MediaFileViewer.MediaViewPan "MediaViewImagePanel.createTagOption=Create", "MediaViewImagePanel.deleteTagOption=Delete", "MediaViewImagePanel.hideTagOption=Hide", - "MediaViewImagePanel.exportTagOption=Export" + "MediaViewImagePanel.exportTagOption=Export", + "MediaViewImagePanel.showTagOption=Show", + "MediaViewImagePanel_createMenu_tooltip_text=<html>Create an image area specific tag by right clicking<br>and dragging to select the area in the image to be tagged.</html>", + "MediaViewImagePanel_deleteMenu_tooltip_text=Delete the selected image area tag.", + "MediaViewImagePanel_exportMenu_tooltip_text=Export the image including the tagged areas.", + "MediaViewImagePanel_hideMenu_tooltip_text=Hide or show the tagged image areas.", + }) MediaViewImagePanel() { initComponents(); @@ -222,6 +230,7 @@ class MediaViewImagePanel extends JPanel implements MediaFileViewer.MediaViewPan imageTaggingOptions = new JPopupMenu(); createTagMenuItem = new JMenuItem(Bundle.MediaViewImagePanel_createTagOption()); createTagMenuItem.addActionListener((event) -> createTag()); + createTagMenuItem.setToolTipText(Bundle.MediaViewImagePanel_createMenu_tooltip_text()); imageTaggingOptions.add(createTagMenuItem); imageTaggingOptions.add(new JSeparator()); @@ -229,20 +238,23 @@ class MediaViewImagePanel extends JPanel implements MediaFileViewer.MediaViewPan deleteTagMenuItem = new JMenuItem(Bundle.MediaViewImagePanel_deleteTagOption()); deleteTagMenuItem.addActionListener((event) -> deleteTag()); imageTaggingOptions.add(deleteTagMenuItem); + deleteTagMenuItem.setToolTipText(Bundle.MediaViewImagePanel_deleteMenu_tooltip_text()); imageTaggingOptions.add(new JSeparator()); hideTagsMenuItem = new JMenuItem(Bundle.MediaViewImagePanel_hideTagOption()); hideTagsMenuItem.addActionListener((event) -> showOrHideTags()); imageTaggingOptions.add(hideTagsMenuItem); + hideTagsMenuItem.setToolTipText(Bundle.MediaViewImagePanel_hideMenu_tooltip_text()); imageTaggingOptions.add(new JSeparator()); exportTagsMenuItem = new JMenuItem(Bundle.MediaViewImagePanel_exportTagOption()); exportTagsMenuItem.addActionListener((event) -> exportTags()); imageTaggingOptions.add(exportTagsMenuItem); + exportTagsMenuItem.setToolTipText(Bundle.MediaViewImagePanel_exportMenu_tooltip_text()); - imageTaggingOptions.setPopupSize(300, 150); + imageTaggingOptions.setPopupSize(TAG_POPUP_WIDTH, 150); //Disable image tagging for non-windows users or upon failure to load OpenCV. if (!PlatformUtil.isWindowsOS() || !OpenCvLoader.openCvIsLoaded()) { @@ -457,10 +469,14 @@ final void loadFile(final AbstractFile file) { if (!isInited()) { return; } - - final double panelWidth = fxPanel.getWidth(); - final double panelHeight = fxPanel.getHeight(); + Platform.runLater(() -> { + + if (imageTagCreator != null) { + imageTagCreator.disconnect(); + masterGroup.getChildren().remove(imageTagCreator); + } + /* * Set up a new task to get the contents of the image file in * displayable form and cancel any previous task in progress. @@ -470,6 +486,8 @@ final void loadFile(final AbstractFile file) { } readImageFileTask = ImageUtils.newReadImageTask(file); readImageFileTask.setOnSucceeded(succeeded -> { + final double panelWidth = fxPanel.getWidth(); + final double panelHeight = fxPanel.getHeight(); onReadImageTaskSucceeded(file, panelWidth, panelHeight); }); readImageFileTask.setOnFailed(failed -> { @@ -536,6 +554,9 @@ private void onReadImageTaskSucceeded(AbstractFile file, double panelWidth, doub if (!tagsGroup.getChildren().isEmpty()) { pcs.firePropertyChange(new PropertyChangeEvent(this, "state", null, State.NONEMPTY)); + } else { + pcs.firePropertyChange(new PropertyChangeEvent(this, + "state", null, State.EMPTY)); } } catch (TskCoreException | NoCurrentCaseException ex) { logger.log(Level.WARNING, "Could not retrieve image tags for file in case db", ex); //NON-NLS @@ -790,11 +811,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { toolbar.add(jPanel1); org.openide.awt.Mnemonics.setLocalizedText(tagsMenu, org.openide.util.NbBundle.getMessage(MediaViewImagePanel.class, "MediaViewImagePanel.tagsMenu.text_1")); // NOI18N + tagsMenu.setToolTipText(org.openide.util.NbBundle.getMessage(MediaViewImagePanel.class, "MediaViewImagePanel.tagsMenu.toolTipText")); // NOI18N + tagsMenu.setActionCommand(org.openide.util.NbBundle.getMessage(MediaViewImagePanel.class, "MediaViewImagePanel.tagsMenu.actionCommand")); // NOI18N tagsMenu.setFocusable(false); tagsMenu.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - tagsMenu.setMaximumSize(new java.awt.Dimension(75, 21)); - tagsMenu.setMinimumSize(new java.awt.Dimension(75, 21)); - tagsMenu.setPreferredSize(new java.awt.Dimension(75, 21)); tagsMenu.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); tagsMenu.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { @@ -1083,7 +1103,7 @@ protected Void doInBackground() { FilenameUtils.getBaseName(file.getName()) + "-with_tags.png"); //NON-NLS ImageIO.write(taggedImage, "png", output.toFile()); - JOptionPane.showMessageDialog(null, Bundle.MediaViewImagePanel_successfulExport()); + JOptionPane.showMessageDialog(MediaViewImagePanel.this, Bundle.MediaViewImagePanel_successfulExport()); } catch (Exception ex) { //Runtime exceptions may spill out of ImageTagsUtil from JavaFX. //This ensures we (devs and users) have something when it doesn't work. logger.log(Level.WARNING, "Unable to export tagged image to disk", ex); //NON-NLS @@ -1099,7 +1119,7 @@ protected Void doInBackground() { private void tagsMenuMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tagsMenuMousePressed if (imageTaggingOptions.isEnabled()) { - imageTaggingOptions.show(tagsMenu, -300 + tagsMenu.getWidth(), tagsMenu.getHeight() + 3); + imageTaggingOptions.show(tagsMenu, -TAG_POPUP_WIDTH + tagsMenu.getWidth(), tagsMenu.getHeight() + 3); } }//GEN-LAST:event_tagsMenuMousePressed @@ -1107,8 +1127,8 @@ private void tagsMenuMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:ev * Display states for the show/hide tags button. */ private enum DisplayOptions { - HIDE_TAGS("Hide"), - SHOW_TAGS("Show"); + HIDE_TAGS(Bundle.MediaViewImagePanel_hideTagOption()), + SHOW_TAGS(Bundle.MediaViewImagePanel_showTagOption()); private final String name;