Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-6861 - Default Graph - Fixed satellite bg color

dragonmacher0b2d3a1767d8
diff --git a/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm b/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm
index 906f4de711..5b4d0c6714 100644
--- a/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm
+++ b/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm
@@ -42,7 +42,7 @@
<LI><CODE>Control+Mouse Wheel</CODE> will zoom the graph in and out on the X-Axis only</LI>
- <LI><CODE>ALT+Mouse Wheel</CODE> will zoom the graph in and out in the Y-Axis only</LI>
+ <LI><CODE>SHIFT+Mouse Wheel</CODE> will zoom the graph in and out in the Y-Axis only</LI>
<LI><CODE>Ctrl+Click</CODE> will select a vertex
<UL>
diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java
index f736a01fb4..6b5b0c161d 100644
--- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java
+++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java
@@ -499,9 +499,9 @@ public class DefaultGraphDisplay implements GraphDisplay {
.buildAndInstallLocal(componentProvider);
new ActionBuilder("Graph Type Display Options", ACTION_OWNER)
- .popupMenuPath("Graph Type Options ...")
+ .popupMenuPath("Graph Type Options")
.popupMenuGroup("zzz")
- .menuPath("Graph Type Options ...")
+ .menuPath("Graph Type Options")
.description("Brings up option editor for configuring vertex and edge types.")
.onAction(c -> editGraphDisplayOptions())
.buildAndInstallLocal(componentProvider);
@@ -767,8 +767,18 @@ public class DefaultGraphDisplay implements GraphDisplay {
VisualizationViewer<AttributedVertex, AttributedEdge> parentViewer) {
Dimension viewerSize = parentViewer.getSize();
Dimension satelliteSize = new Dimension(viewerSize.width / 4, viewerSize.height / 4);
- final SatelliteVisualizationViewer<AttributedVertex, AttributedEdge> satellite =
- SatelliteVisualizationViewer.builder(parentViewer).viewSize(satelliteSize).build();
+ SatelliteVisualizationViewer<AttributedVertex, AttributedEdge> satellite =
+ SatelliteVisualizationViewer
+ .builder(parentViewer)
+ .viewSize(satelliteSize)
+
+ // Unusual Code: setting the background of the satellite will have no effected,
+ // since the SatelliteVisualizationViewer changes the background color in the
+ // paint method. That updated color is based on the lens color. Thus, we need
+ // to set the lens color to a value that will trigger the background to get set
+ // to what we desire.
+ .lensColor(BACKGROUND_COLOR.brighter())
+ .build();
//
// JUNGRAPHT CHANGE 3
@@ -799,6 +809,9 @@ public class DefaultGraphDisplay implements GraphDisplay {
satellite.getComponent().setSize(quarterSize);
}
});
+
+ satellite.setBackground(BACKGROUND_COLOR);
+
return satellite;
}
@@ -1198,11 +1211,6 @@ public class DefaultGraphDisplay implements GraphDisplay {
: MultiSelectionStrategy.rectangular())
.viewSize(PREFERRED_VIEW_SIZE)
.layoutSize(PREFERRED_LAYOUT_SIZE)
-
-// // This is a reminder of how we can change the modifier keys for graph scaling
-// .graphMouse(DefaultGraphMouse.builder()
-// .yAxisScalingMask(Modifiers.masks.get("SHIFT_MENU"))
-// .build())
.build();
// Add an ancestor listener to scale and center the graph after the component
diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/mouse/JgtGraphMouse.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/mouse/JgtGraphMouse.java
index 2ae17de1ef..d9533c1b28 100644
--- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/mouse/JgtGraphMouse.java
+++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/mouse/JgtGraphMouse.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.
@@ -39,6 +39,7 @@ public class JgtGraphMouse extends DefaultGraphMouse<AttributedVertex, Attribute
this.allowEdgeSelection = allowEdgeSelection;
}
+ @SuppressWarnings("rawtypes")
@Override
public void loadPlugins() {
@@ -56,16 +57,26 @@ public class JgtGraphMouse extends DefaultGraphMouse<AttributedVertex, Attribute
// JUNGRAPHT CHANGE 1,2
//
// Note: this code can go away when we can turn off the picking square
- add(allowEdgeSelection ? new SelectingGraphMousePlugin() : new VertexSelectingGraphMousePlugin<>());
+ add(allowEdgeSelection ? new SelectingGraphMousePlugin()
+ : new VertexSelectingGraphMousePlugin<>());
// add(new SelectingGraphMousePlugin<>());
add(new RegionSelectingGraphMousePlugin<>());
// the grab/pan feature
- add(TranslatingGraphMousePlugin.builder().translatingMask(InputEvent.BUTTON1_DOWN_MASK).build());
+ add(TranslatingGraphMousePlugin.builder()
+ .translatingMask(InputEvent.BUTTON1_DOWN_MASK)
+ .build());
// scaling
- add(new ScalingGraphMousePlugin());
+
+ // allow y-axis scaling using Shift. The default is Alt, which doesn't work on some OSes.
+ ScalingGraphMousePlugin.Builder builder =
+ ScalingGraphMousePlugin
+ .builder()
+ .yAxisScalingMask(Modifiers.masks.get("SHIFT"));
+ ScalingGraphMousePlugin scaler = new ScalingGraphMousePlugin(builder);
+ add(scaler);
// cursor cleanup
add(new JgtCursorRestoringPlugin<>());