Skip to content

Ghidra is a software reverse engineering (SRE) framework

Fixed a help bug that prevented the correct scrolling to the requested page reference

dragonmacher839062373796
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/help/CalloutRequest.java b/Ghidra/Framework/Docking/src/main/java/docking/help/CalloutRequest.java
new file mode 100644
index 0000000000..5785aeda35
--- /dev/null
+++ b/Ghidra/Framework/Docking/src/main/java/docking/help/CalloutRequest.java
@@ -0,0 +1,437 @@
+/* ###
+ * IP: GHIDRA
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package docking.help;
+
+import java.awt.*;
+import java.awt.geom.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.net.*;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import javax.help.WindowPresentation;
+import javax.swing.*;
+import javax.swing.event.ChangeListener;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+
+import org.jdesktop.animation.timing.Animator;
+import org.jdesktop.animation.timing.TimingTargetAdapter;
+
+import docking.util.AnimationPainter;
+import docking.util.AnimationUtils;
+import generic.theme.GColor;
+import ghidra.framework.preferences.Preferences;
+import ghidra.util.Msg;
+import ghidra.util.bean.GGlassPane;
+import ghidra.util.task.SwingUpdateManager;
+
+/**
+ * A class that will trigger a UI aid to show users to where in the given html page the view has
+ * been navigated. As users follow links, the new page is loaded, but it is not always easy to see
+ * where on the page the original link is pointing. This will paint a UI marker where at the
+ * destination of the clicked link. Perhaps the most important job of this class is to reposition
+ * the view once the html loading has finished.
+ * <p>
+ * This class is complicated due to the asynchronous nature of html document loading and rendering.
+ * The document is loaded in a background thread. After the page is loaded, some elements on the
+ * page, such as images, may also be loaded asynchronously. As these elements get loaded, the
+ * geometry of the page may change. This means that the destination bounds of a link may change as
+ * the page is being loaded and rendered. To compensate for these changes, we need a way to delay
+ * showing the UI marker until the page is fully rendered. Here we use a {@link SwingUpdateManager}
+ * to delay the UI marker until no new changes are being made. At that point, the bounds of the
+ * anchor should be finalized.
+ */
+class CalloutRequest {
+
+ private DockingHelpBroker helpBroker;
+ private Animator animator;
+ private JEditorPane editorPane;
+ private URL requestUrl;
+
+ private String pageInfo;
+
+ private PropertyChangeListener pageLoadListener = new PageLoadingListener();
+
+ private SwingUpdateManager calloutUpdater = new SwingUpdateManager(this::doUpdate);
+ private ChangeListener changeListener = e -> {
+ Object source = e.getSource();
+ if (source instanceof JViewport) {
+
+ // push back the callout so it can get the up-to-date dimensions
+ calloutUpdater.updateLater();
+ }
+ };
+
+ CalloutRequest(DockingHelpBroker helpBroker, JEditorPane editorPane, URL requestUrl) {
+ this.helpBroker = helpBroker;
+ this.editorPane = editorPane;
+ this.requestUrl = requestUrl;
+
+ savePageInfo();
+ }
+
+ private void savePageInfo() {
+ URI uri;
+ try {
+ uri = requestUrl.toURI();
+ }
+ catch (URISyntaxException e) {
+ // shouldn't happen
+ pageInfo = requestUrl.toString();
+ return;
+ }
+
+ String uriPathString = uri.getPath();
+ Path path = Paths.get(uriPathString);
+ Path fileName = path.getFileName();
+ pageInfo = fileName.toString();
+ String ref = requestUrl.getRef();
+ if (ref != null) {
+ pageInfo = "#" + ref;
+ }
+ }
+
+ public void runLater() {
+
+ String ref = requestUrl.getRef();
+ if (ref == null) {
+ dispose();
+ return; // no ref to callout for this url
+ }
+
+ if (isCurrentPage(requestUrl)) {
+ start(); // page already loaded; just start
+ }
+ else {
+ // start when loaded
+ editorPane.addPropertyChangeListener("page", pageLoadListener);
+ }
+ }
+
+ private void start() {
+ JScrollPane scrollPane = getScrollPane();
+ JViewport viewport = scrollPane.getViewport();
+ viewport.addChangeListener(changeListener);
+
+ calloutUpdater.updateLater();
+ }
+
+ public void dispose() {
+ calloutUpdater.dispose();
+
+ if (animator != null) {
+ animator.stop();
+ animator = null;
+ }
+ }
+
+ private void doUpdate() {
+
+ // stop listening for document changes now that we are going to do our work
+ JScrollPane scrollPane = getScrollPane();
+ JViewport viewport = scrollPane.getViewport();
+ viewport.removeChangeListener(changeListener);
+
+ // Always place the area at the top of the screen.
+ String ref = requestUrl.getRef();
+ Rectangle currentRefArea = getReferenceArea(ref);
+ currentRefArea.y += (viewport.getHeight() - currentRefArea.getHeight());
+ editorPane.scrollRectToVisible(currentRefArea);
+
+ Rectangle updatedRefArea = getReferenceArea(ref);
+ doCalloutReference(updatedRefArea);
+ }
+
+ private JScrollPane getScrollPane() {
+ Container parent = editorPane.getParent();
+ while (parent != null) {
+ if (parent instanceof JScrollPane) {
+ return (JScrollPane) parent;
+ }
+ parent = parent.getParent();
+ }
+ return null;
+ }
+
+ private Rectangle getReferenceArea(String ref) {
+
+ int pos = getAnchorPosition(ref);
+ if (pos == -1) {
+ return null;
+ }
+
+ Rectangle2D startArea = null;
+ try {
+ startArea = editorPane.modelToView2D(pos);
+ }
+ catch (BadLocationException ble) {
+ Msg.trace(this, "Unexpected exception searching for help reference", ble);
+ return null;
+ }
+
+ Rectangle bounds = startArea.getBounds();
+
+ // Ensure the bounds has a non-zero width. This makes rectangle intersection work
+ // correctly in the client code.
+ bounds.width = Math.max(bounds.width, 10);
+ return bounds;
+ }
+
+ private int getAnchorPosition(String ref) {
+ HTMLDocument document = (HTMLDocument) editorPane.getDocument();
+ HTMLDocument.Iterator it = document.getIterator(HTML.Tag.A);
+ for (; it.isValid(); it.next()) {
+ AttributeSet attrs = it.getAttributes();
+ String name = (String) attrs.getAttribute(HTML.Attribute.NAME);
+ if (ref.equals(name)) {
+ return it.getStartOffset();
+ }
+ }
+ return -1;
+ }
+
+ private boolean isCalloutEnabled() {
+ String showAidString = Preferences.getProperty(HelpManager.SHOW_AID_KEY);
+ if (showAidString == null) {
+ return false;
+ }
+
+ return Boolean.parseBoolean(showAidString);
+ }
+
+ private void doCalloutReference(final Rectangle area) {
+
+ if (!isCalloutEnabled()) {
+ return; // the user has disabled the animation
+ }
+
+ WindowPresentation windowPresentation = helpBroker.getWindowPresentation();
+ Window helpWindow = windowPresentation.getHelpWindow();
+ Container contentPane = null;
+ if (helpWindow instanceof JDialog) {
+ contentPane = ((JDialog) helpWindow).getContentPane();
+ }
+ else {
+ contentPane = ((JFrame) helpWindow).getContentPane();
+ }
+
+ JScrollPane scrollPane = getScrollPane();
+ JViewport viewport = scrollPane.getViewport();
+ Point viewPosition = viewport.getViewPosition();
+
+ //
+ // The area of the HTML content is absolute inside of the entire document.
+ // However, the user is viewing the document inside of a scroll pane. So, we
+ // want the offset of the element within the viewer, not the absolute position.
+ //
+ Rectangle offsetArea = new Rectangle(area);
+ offsetArea.y -= viewPosition.y;
+
+ //
+ // Update the coordinates to be relative to the content pane, which is where we
+ // are doing the painting.
+ //
+ Rectangle relativeArea =
+ SwingUtilities.convertRectangle(scrollPane, offsetArea, contentPane);
+ Shape star = new StarShape(relativeArea.getLocation());
+
+ animator = AnimationUtils.createPaintingAnimator(helpWindow, new LocationHintPainter(star));
+ if (animator == null) {
+ return; // animations are disabled
+ }
+
+ animator.addTarget(new TimingTargetAdapter() {
+ @Override
+ public void end() {
+ animator = null;
+ dispose();
+ }
+ });
+ }
+
+ private boolean isCurrentPage(URL newURL) {
+ if (newURL == null) {
+ return false;// not sure if this can happen
+ }
+
+ String newFile = newURL.getFile();
+ URL currentURL = editorPane.getPage();
+ if (currentURL == null) {
+ return false;
+ }
+
+ String currentFile = currentURL.getFile();
+ return newFile.equals(currentFile);
+ }
+
+ @Override
+ public String toString() {
+ return pageInfo;
+ }
+
+//=================================================================================================
+// Inner Classes
+//=================================================================================================
+
+ private class PageLoadingListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ editorPane.removePropertyChangeListener("page", pageLoadListener);
+ start();
+ }
+ }
+
+ private class StarShape extends Path2D.Float {
+
+ StarShape(Point location) {
+ this(5, location, 1, .3);// reasonable star qualities
+ }
+
+ StarShape(int points, Point location, double outerRadius, double innerRadius) {
+ // note: location is the origin of the shape
+
+ double angle = Math.PI / points;
+ GeneralPath path = new GeneralPath();
+
+ int scale = 20;
+ double lr = Math.max(outerRadius, innerRadius);
+ int width = (int) (scale * (2 * lr));
+ int height = width;// square bounds
+ double cx = location.x + width / 2;
+ double cy = location.y + height / 2;
+ Point2D.Double center = new Point2D.Double(cx, cy);
+
+ // start the first point...
+ double r = outerRadius;
+ double x = center.x + Math.cos(0 * angle) * r;
+ double y = center.y + Math.sin(0 * angle) * r;
+ path.moveTo(x, y);
+
+ // ...the remaining points
+ for (int i = 1; i < 2 * points; i++) {
+ r = (i % 2) == 0 ? outerRadius : innerRadius;
+ x = center.x + Math.cos(i * angle) * r;
+ y = center.y + Math.sin(i * angle) * r;
+ path.lineTo(x, y);
+ }
+
+ path.closePath();
+
+ // scaled center x/y
+ double scx = scale * cx;
+ double scy = scale * cy;
+
+ // note: An offset of (width / 2) moves from center to 0. This didn't look quite
+ // right, so, through trial and error, we updated the offset so that the
+ // shape's location is just over the beginning of the text that follows the
+ // anchor, in most cases.
+ double offsetx = width / 4;
+ double offsety = height / 4;
+
+ // scaled offset x/y
+ double sox = scx - offsetx;// move the x from center to 0
+ double soy = scy - offsety;// ...
+
+ // delta x/y
+ double dx = sox - location.x;
+ double dy = soy - location.y;
+
+ // move the origin so that after we scale, it goes back to 0,0
+ AffineTransform xform = AffineTransform.getTranslateInstance(-dx, -dy);
+ xform.scale(scale, scale);
+
+ Shape shape = xform.createTransformedShape(path);
+ super.append(shape, true);
+ }
+ }
+
+ private class LocationHintPainter implements AnimationPainter {
+
+ private Color color = new GColor("color.bg.help.hint");
+ private Shape paintShape;
+
+ LocationHintPainter(Shape paintShape) {
+ this.paintShape = paintShape;
+ }
+
+ @Override
+ public void paint(GGlassPane glassPane, Graphics graphics, double percentComplete) {
+
+ Graphics2D g2d = (Graphics2D) graphics;
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
+ RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+
+ //
+ // At 0%, with 100% opacity; at the end, paint with 0% opacity
+ //
+ Composite originalComposite = g2d.getComposite();
+ AlphaComposite alphaComposite = AlphaComposite
+ .getInstance(AlphaComposite.SrcOver.getRule(), (float) (1 - percentComplete));
+ g2d.setComposite(alphaComposite);
+
+ double transition = 1 - percentComplete;
+ Color originalColor = g2d.getColor();
+
+ AffineTransform originalTransform = g2d.getTransform();
+
+ double scale = 4 * transition;
+
+ int degrees = (int) (480 * transition);
+ double rad = Math.toRadians(transition * degrees);
+
+ Rectangle b = paintShape.getBounds();
+ double cx = b.getCenterX();
+ double cy = b.getCenterY();
+ double scx = cx * scale;
+ double scy = cy * scale;
+ double dcx = scx - cx;
+ double dcy = scy - cy;
+
+ AffineTransform scaler = new AffineTransform();
+ scaler.translate(-dcx, -dcy);
+ scaler.scale(scale, scale);
+ Shape scaled = scaler.createTransformedShape(paintShape);
+
+ AffineTransform rotater = new AffineTransform();
+ rotater.rotate(rad, cx, cy);
+ Shape finalShape = rotater.createTransformedShape(scaled);
+
+ /*
+ // Debug
+ Shape box = scaler.createTransformedShape(b);
+ g2d.setColor(Palette.GREEN);
+ g2d.fill(box);
+
+ box = transform.createTransformedShape(box);
+ g2d.setColor(Palette.YELLOW);
+ g2d.fill(box);
+ */
+
+ g2d.setColor(color);
+ g2d.fill(finalShape);
+
+ g2d.setColor(originalColor);
+ g2d.setTransform(originalTransform);
+ g2d.setComposite(originalComposite);
+ }
+
+ }
+
+}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/help/DockingHelpBroker.java b/Ghidra/Framework/Docking/src/main/java/docking/help/DockingHelpBroker.java
index 0ac74b4ddd..b19717fc8f 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/help/DockingHelpBroker.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/help/DockingHelpBroker.java
@@ -15,11 +15,9 @@
*/
package docking.help;
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Image;
import java.awt.event.ActionEvent;
-import java.awt.geom.*;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
import java.net.URL;
import java.util.List;
@@ -27,21 +25,10 @@ import javax.help.*;
import javax.help.event.HelpModelEvent;
import javax.help.event.HelpModelListener;
import javax.swing.*;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.html.HTML;
-import javax.swing.text.html.HTMLDocument;
-
-import org.jdesktop.animation.timing.Animator;
-import org.jdesktop.animation.timing.TimingTargetAdapter;
import docking.framework.ApplicationInformationDisplayFactory;
-import docking.util.AnimationPainter;
-import docking.util.AnimationUtils;
-import generic.theme.GColor;
-import ghidra.framework.preferences.Preferences;
-import ghidra.util.*;
-import ghidra.util.bean.GGlassPane;
+import ghidra.util.Msg;
+import ghidra.util.SystemUtilities;
import help.CustomTOCView;
import help.GHelpBroker;
import resources.Icons;
@@ -49,18 +36,20 @@ import resources.Icons;
/**
* An extension of the {@link GHelpBroker} that allows {@code Docking} classes to be installed.
* <p>
- * Additions include a search feature a navigation aid.
+ * Additions include:
+ * <UL>
+ * <LI>A find feature</LI>
+ * <LI>A UI navigation aid</LI>
+ * <LI>An action to refresh the current page</LI>
+ * </UL>
*/
public class DockingHelpBroker extends GHelpBroker {
private static final List<Image> ICONS = ApplicationInformationDisplayFactory.getWindowIcons();
- private static final int MAX_CALLOUT_RETRIES = 3;
-
- private PropertyChangeListener pageLoadListener = new PageLoadingListener();
private HelpModelListener helpModelListener = new HelpIDChangedListener();
- private Animator lastAnimator;
- private URL loadingURL;
+
+ private CalloutRequest callout;
public DockingHelpBroker(HelpSet hs) {
super(hs);
@@ -128,7 +117,7 @@ public class DockingHelpBroker extends GHelpBroker {
// separate the Java help stuff from our actions
toolbar.addSeparator();
- ToggleNavigationAid action = new ToggleNavigationAid();
+ NavigationAidToggleAction action = new NavigationAidToggleAction();
toolbar.add(new JButton(action));
if (SystemUtilities.isInDevelopmentMode()) {
@@ -158,254 +147,15 @@ public class DockingHelpBroker extends GHelpBroker {
// Navigation Aid Section
//=================================================================================================
- private JScrollPane getScrollPane(JEditorPane editorPane) {
- Container parent = editorPane.getParent();
- while (parent != null) {
- if (parent instanceof JScrollPane) {
- return (JScrollPane) parent;
- }
- parent = parent.getParent();
- }
- return null;
- }
-
- private void showNavigationAid() {
- String showAidString = Preferences.getProperty(HelpManager.SHOW_AID_KEY);
- if (showAidString == null) {
- return;
- }
-
- boolean showAid = Boolean.parseBoolean(showAidString);
- if (!showAid) {
- return;
- }
-
- calloutReferenceLater();
- }
-
- private void calloutReferenceLater() {
- Swing.runLater(() -> calloutReference(loadingURL));
- }
-
- private void calloutReference(final URL url) {
- String ref = url.getRef();
- if (ref == null) {
- return;
- }
-
- final Rectangle area = getReferenceArea(ref);
- if (area == null) {
- return;
- }
-
- doCalloutReference(area, 0);
- }
-
- private Rectangle getReferenceArea(String ref) {
- HTMLDocument document = (HTMLDocument) htmlEditorPane.getDocument();
- HTMLDocument.Iterator iter = document.getIterator(HTML.Tag.A);
- for (; iter.isValid(); iter.next()) {
- AttributeSet attributes = iter.getAttributes();
- String name = (String) attributes.getAttribute(HTML.Attribute.NAME);
- if (name == null || !name.equals(ref)) {
- continue;
- }
-
- try {
- int start = iter.getStartOffset();
- Rectangle2D startArea = htmlEditorPane.modelToView2D(start);
- return startArea.getBounds();
- }
- catch (BadLocationException ble) {
- Msg.trace(this, "Unexpected exception searching for help reference", ble);
- }
- }
- return null;
- }
-
- /**
- * This method exists to address the threaded timing nature of how the help system loads
- * help pages and when the UI is adjusted in response to those changes.
- * <p>
- * Note: this method will call itself if the view is not yet updated for the requested
- * model change. In that case, this method will call itself again later. This may
- * need to happen more than once. However, we will only try a few times and
- * then just give up.
- *
- * @param area the area to call out
- * @param callCount the number of times this method has already been called
- */
- private void doCalloutReference(final Rectangle area, int callCount) {
-
- if (callCount > MAX_CALLOUT_RETRIES) {
- // this probably can't happen, but we don't want to keep calling this method
- // forever.
- return;
- }
-
- WindowPresentation windowPresentation = getWindowPresentation();
- Window helpWindow = windowPresentation.getHelpWindow();
- Container contentPane = null;
- if (helpWindow instanceof JDialog) {
- contentPane = ((JDialog) helpWindow).getContentPane();
- }
- else {
- contentPane = ((JFrame) helpWindow).getContentPane();
- }
-
- JScrollPane scrollPane = getScrollPane(htmlEditorPane);
- JViewport viewport = scrollPane.getViewport();
- Point viewPosition = viewport.getViewPosition();
-
- final int numberOfCalls = callCount + 1;
- if (viewPosition.x == 0 && viewPosition.y == 0) {
-
- //
- // Unusual Code: Not yet rendered! Try again.
- //
- Swing.runLater(() -> doCalloutReference(area, numberOfCalls));
-
- return;
- }
-
- //
- // The area of the HTML content is absolute inside of the entire document.
- // However, the user is viewing the document inside of a scroll pane. So, we
- // want the offset of the element within the viewer, not the absolute position.
- //
- area.y -= viewPosition.y;
-
- //
- // Update the coordinates to be relative to the content pane, which is where we
- // are doing the painting.
- //
- Rectangle relativeArea = SwingUtilities.convertRectangle(scrollPane, area, contentPane);
- Shape star = new StarShape(relativeArea.getLocation());
-
- Animator animator =
- AnimationUtils.createPaintingAnimator(helpWindow, new LocationHintPainter(star));
- if (animator == null) {
- return;
- }
-
- lastAnimator = animator;
- lastAnimator.addTarget(new TimingTargetAdapter() {
- @Override
- public void end() {
- lastAnimator = null;
- }
- });
- }
-
private void prepareToCallout(URL url) {
- if (lastAnimator != null) {
+ if (callout != null) {
// prevent animations from lingering when moving to new pages
- lastAnimator.stop();
- }
-
- loadingURL = url;
-
- // updateTitle();
-
- if (isCurrentPage(loadingURL)) {
- showNavigationAid();
- return;// page already loaded; no need to use the listener
- }
-
- // listen for the page to be loaded, as it is asynchronous
- htmlEditorPane.removePropertyChangeListener("page", pageLoadListener);
- htmlEditorPane.addPropertyChangeListener("page", pageLoadListener);
- }
-
- private boolean isCurrentPage(URL newURL) {
- if (newURL == null) {
- return false;// not sure if this can happen
+ callout.dispose();
+ callout = null;
}
- String newFile = newURL.getFile();
- URL currentURL = htmlEditorPane.getPage();
- if (currentURL == null) {
- return false;
- }
-
- String currentFile = currentURL.getFile();
- return newFile.equals(currentFile);
- }
-
-//==================================================================================================
-// Inner Classes
-//==================================================================================================
-
- private class StarShape extends Path2D.Float {
-
- StarShape(Point location) {
- this(5, location, 1, .3);// reasonable star qualities
- }
-
- StarShape(int points, Point location, double outerRadius, double innerRadius) {
- // note: location is the origin of the shape
-
- double angle = Math.PI / points;
- GeneralPath path = new GeneralPath();
-
- int scale = 20;
- double lr = Math.max(outerRadius, innerRadius);
- int width = (int) (scale * (2 * lr));
- int height = width;// square bounds
- double cx = location.x + width / 2;
- double cy = location.y + height / 2;
- Point2D.Double center = new Point2D.Double(cx, cy);
-
- // start the first point...
- double r = outerRadius;
- double x = center.x + Math.cos(0 * angle) * r;
- double y = center.y + Math.sin(0 * angle) * r;
- path.moveTo(x, y);
-
- // ...the remaining points
- for (int i = 1; i < 2 * points; i++) {
- r = (i % 2) == 0 ? outerRadius : innerRadius;
- x = center.x + Math.cos(i * angle) * r;
- y = center.y + Math.sin(i * angle) * r;
- path.lineTo(x, y);
- }
-
- path.closePath();
-
- // scaled center x/y
- double scx = scale * cx;
- double scy = scale * cy;
-
- // note: An offset of (width / 2) moves from center to 0. This didn't look quite
- // right, so, through trial and error, we updated the offset so that the
- // shape's location is just over the beginning of the text that follows the
- // anchor, in most cases.
- double offsetx = width / 4;
- double offsety = height / 4;
-
- // scaled offset x/y
- double sox = scx - offsetx;// move the x from center to 0
- double soy = scy - offsety;// ...
-
- // delta x/y
- double dx = sox - location.x;
- double dy = soy - location.y;
-
- // move the origin so that after we scale, it goes back to 0,0
- AffineTransform xform = AffineTransform.getTranslateInstance(-dx, -dy);
- xform.scale(scale, scale);
-
- Shape shape = xform.createTransformedShape(path);
- super.append(shape, true);
- }
- }
-
- private class PageLoadingListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- showNavigationAid();
- htmlEditorPane.removePropertyChangeListener("page", pageLoadListener);
- }
+ callout = new CalloutRequest(this, htmlEditorPane, url);
+ callout.runLater();
}
private class HelpIDChangedListener implements HelpModelListener {
@@ -415,75 +165,4 @@ public class DockingHelpBroker extends GHelpBroker {
}
}
- private class LocationHintPainter implements AnimationPainter {
-
- private Color color = new GColor("color.bg.help.hint");
- private Shape paintShape;
-
- LocationHintPainter(Shape paintShape) {
- this.paintShape = paintShape;
- }
-
- @Override
- public void paint(GGlassPane glassPane, Graphics graphics, double percentComplete) {
-
- Graphics2D g2d = (Graphics2D) graphics;
- g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
- RenderingHints.VALUE_INTERPOLATION_BILINEAR);
-
- //
- // At 0%, with 100% opacity; at the end, paint with 0% opacity
- //
- Composite originalComposite = g2d.getComposite();
- AlphaComposite alphaComposite = AlphaComposite
- .getInstance(AlphaComposite.SrcOver.getRule(), (float) (1 - percentComplete));
- g2d.setComposite(alphaComposite);
-
- double transition = 1 - percentComplete;
- Color originalColor = g2d.getColor();
-
- AffineTransform originalTransform = g2d.getTransform();
-
- double scale = 4 * transition;
-
- int degrees = (int) (480 * transition);
- double rad = Math.toRadians(transition * degrees);
-
- Rectangle b = paintShape.getBounds();
- double cx = b.getCenterX();
- double cy = b.getCenterY();
- double scx = cx * scale;
- double scy = cy * scale;
- double dcx = scx - cx;
- double dcy = scy - cy;
-
- AffineTransform scaler = new AffineTransform();
- scaler.translate(-dcx, -dcy);
- scaler.scale(scale, scale);
- Shape scaled = scaler.createTransformedShape(paintShape);
-
- AffineTransform rotater = new AffineTransform();
- rotater.rotate(rad, cx, cy);
- Shape finalShape = rotater.createTransformedShape(scaled);
-
- /*
- // Debug
- Shape box = scaler.createTransformedShape(b);
- g2d.setColor(Palette.GREEN);
- g2d.fill(box);
-
- box = transform.createTransformedShape(box);
- g2d.setColor(Palette.YELLOW);
- g2d.fill(box);
- */
-
- g2d.setColor(color);
- g2d.fill(finalShape);
-
- g2d.setColor(originalColor);
- g2d.setTransform(originalTransform);
- g2d.setComposite(originalComposite);
- }
-
- }
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/help/HelpManager.java b/Ghidra/Framework/Docking/src/main/java/docking/help/HelpManager.java
index abd7baa20c..2241ae2b8b 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/help/HelpManager.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/help/HelpManager.java
@@ -815,7 +815,12 @@ public class HelpManager implements HelpService {
}
}
else {
- buffy.append("<NO HELP AVAILABLE>");
+ if (isExcludedFromHelp(helpObj)) {
+ buffy.append("<EXCLUDED FROM HELP>");
+ }
+ else {
+ buffy.append("<NO HELP AVAILABLE>");
+ }
}
return buffy.toString();
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/help/ToggleNavigationAid.java b/Ghidra/Framework/Docking/src/main/java/docking/help/NavigationAidToggleAction.java
similarity index 96%
rename from Ghidra/Framework/Docking/src/main/java/docking/help/ToggleNavigationAid.java
rename to Ghidra/Framework/Docking/src/main/java/docking/help/NavigationAidToggleAction.java
index 8bd568c358..f8d226d17d 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/help/ToggleNavigationAid.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/help/NavigationAidToggleAction.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,7 @@ import resources.ResourceManager;
import resources.icons.CenterTranslateIcon;
import resources.icons.TranslateIcon;
-public class ToggleNavigationAid extends AbstractAction {
+public class NavigationAidToggleAction extends AbstractAction {
private static final Icon ENABLED_ICON = new GIcon("icon.help.navigation.aid.enabled");
private static final Icon DISABLED_OVERLAY_ICON =
@@ -37,7 +37,7 @@ public class ToggleNavigationAid extends AbstractAction {
private boolean showingNavigationAid = true;
- public ToggleNavigationAid() {
+ public NavigationAidToggleAction() {
putValue(Action.SMALL_ICON, new SelfPaintingIcon());
putValue(Action.SHORT_DESCRIPTION,