Merge remote-tracking branch 'origin/GP-4019_James_lock_unlock_scrolling'

This commit is contained in:
Ryan Kurtz
2023-11-13 14:18:30 -05:00
4 changed files with 20 additions and 19 deletions

View File

@@ -132,11 +132,8 @@ public class ListingComparisonFieldPanelCoordinator extends LayoutLockedFieldPan
(leftAddress != null) ? leftAddressIndexMap.getIndex(leftAddress) : null;
BigInteger rightIndex =
(rightAddress != null) ? rightAddressIndexMap.getIndex(rightAddress) : null;
BigInteger[] lineNumbers =
new BigInteger[] { (leftIndex != null) ? leftIndex : BigInteger.ZERO,
(rightIndex != null) ? rightIndex : BigInteger.ZERO };
setLockedLines(lineNumbers);
//lockLines will set null args to BigInteger.ZERO
lockLines(leftIndex, rightIndex);
}
/**

View File

@@ -354,6 +354,7 @@ public abstract class CodeComparisonPanel<T extends FieldPanelCoordinator> exten
}
this.syncScrolling = syncScrolling;
// Refresh the left panel.
FieldPanel leftPanel = getLeftFieldPanel();
leftPanel.validate();
@@ -363,6 +364,7 @@ public abstract class CodeComparisonPanel<T extends FieldPanelCoordinator> exten
rightPanel.validate();
rightPanel.invalidate();
setFieldPanelCoordinator(syncScrolling ? createFieldPanelCoordinator() : null);
}
}

View File

@@ -15,11 +15,10 @@
*/
package docking.widgets.fieldpanel.internal;
import ghidra.util.exception.AssertException;
import java.math.BigInteger;
import docking.widgets.fieldpanel.*;
import ghidra.util.exception.AssertException;
/**
* A LayoutLockedFieldPanelCoordinator is an extension of a LineLockedFieldPanelCoordinator that

View File

@@ -55,26 +55,29 @@ public class LineLockedFieldPanelCoordinator extends FieldPanelCoordinator {
/**
* Call this method whenever you want to change the line numbers that are locked together
* for the associated field panels.
* @param lockedLineNumbers the array of locked line numbers that are directly associated with
* @param newLockedLines the array of locked line numbers that are directly associated with
* the array of field panels.<BR>
* Important: Make sure the line numbers are in the order that matches the field panels in the array.
*/
public void setLockedLines(BigInteger[] lockedLineNumbers) {
if (lockedLineNumbers.length != this.lockedLineNumbers.length) {
throw new AssertException("The number of lines(" + lockedLineNumbers.length +
") must exactly match the number of panels(" + this.lockedLineNumbers.length +
public void lockLines(BigInteger... newLockedLines) {
if (newLockedLines.length != lockedLineNumbers.length) {
throw new AssertException("The number of lines(" + newLockedLines.length +
") must exactly match the number of panels(" + lockedLineNumbers.length +
").");
}
for (int i = 0; i < lockedLineNumbers.length; i++) {
if (lockedLineNumbers[i] == null) {
lockedLineNumbers[i] = BigInteger.ZERO;
for (int i = 0; i < newLockedLines.length; i++) {
if (newLockedLines[i] == null) {
newLockedLines[i] = BigInteger.ZERO;
}
}
for (int i = 0; i < lockedLineNumbers.length; i++) {
if (!this.lockedLineNumbers[i].equals(lockedLineNumbers[i])) {
this.lockedLineNumbers[i] = lockedLineNumbers[i];
}
if (valuesChanging) {
return;
}
valuesChanging = true;
for (int i = 0; i < newLockedLines.length; i++) {
lockedLineNumbers[i] = newLockedLines[i];
}
valuesChanging = false;
}
/**